void cmd_port(t_ftpserv *ftpserv, t_client *client, char *args) { int i; char *tmp; char *tmp2; tmp = strchr(args, ','); for (i = 0; i < 3; i++) { if (!tmp && pars_error(client)) return ; *tmp = '.'; tmp = strchr(tmp, ','); } if (!tmp && pars_error(client)) return ; *tmp++ = 0; tmp2 = strchr(tmp, ','); if (!tmp2 && pars_error(client)) return ; *tmp2++ = 0; if (!*tmp && pars_error(client)) return ; client->data_port = 256 * atoi(tmp) + atoi(tmp2); client->ip = strdup(args); client->mode = MODE_ACTF; send_msg2client(client, "200 PORT command successful.\r\n"); }
PUBLIC int lex_floatnum() { char *endptr; yylval.dubbel.val = strtod(yytext, &endptr); yylval.dubbel.text=yytext; if (*endptr) pars_error("Error converting numeric value %s", yytext); return floatnumSYM; }
PUBLIC struct expression *pars_exp_unary(int op, struct expression *exp) { GETEXP(sizeof(struct expression *)); work->optype = T_UNARY; work->op = op; work->e.exp = exp; if (exp && ISARRAY(exp)) pars_error("Arrays may not be part of an expression"); return work; }
PUBLIC struct expression *pars_exp_substr(struct expression *exp, struct two_exp *twoexp) { GETEXP(sizeof(struct exp_substr)); if (ISARRAY(exp)) pars_error("You may not take a substring of an array in this way"); work->optype = T_SUBSTR; work->e.expsubstr.exp = exp; work->e.expsubstr.twoexp = *twoexp; return work; }
PUBLIC struct expression *pars_exp_binary(int op, struct expression *exp1, struct expression *exp2) { GETEXP(sizeof(struct two_exp)); work->optype = T_BINARY; work->op = op; work->e.twoexp.exp1 = exp1; work->e.twoexp.exp2 = exp2; if (ISARRAY(exp1) || ISARRAY(exp2)) pars_error("Arrays may not be part of an expression"); return work; }
PUBLIC struct assign_list *pars_assign_item(int op, struct expression *lval, struct expression *rval) { struct assign_list *work = mem_alloc(PARSE_POOL, sizeof(struct assign_list)); if (op!=becomesSYM && (ISARRAY(lval) || ISARRAY2(rval))) pars_error("Semi-complex assignment (e.g. :+ and :-) not supported with arrays"); work->op = op; work->lval = lval; work->exp = rval; work->next = NULL; return work; }