void slush(void) { char *line; char **args; int stat; size_t MAX_LINE; stat = 1; while(stat) { children = 0; printf("slush: "); //Read in the line line = sl_read_line(); //Split the line based on delims (for exec) args = sl_split_line(line); //Send to setup for builtin or pipe stat = sl_exec(args); //Wait for all children while(children) { wait(NULL); children--; } //Destroy line free(line); //Destroy previous tokens free(args); } }
mixed query(string q, varargs mixed args) { // TODO: it might be wise to db_conv_string on each arg to // avoid sql injections return sl_exec(sprintf(q, args...)); }