Lines Matching refs:cmd
204 struct command *cmd; member
213 static char *parse_word(char *start, struct command **cmd) in parse_word() argument
223 (*cmd)->argv[(*cmd)->argc++] = xstrndup(start, end-start); in parse_word()
227 if (!((*cmd)->argc & 7)) in parse_word()
228 *cmd=xrealloc(*cmd, in parse_word()
229 sizeof(struct command) + ((*cmd)->argc+8)*sizeof(char *)); in parse_word()
230 (*cmd)->argv[(*cmd)->argc] = 0; in parse_word()
239 struct command **cmd = &(line->cmd); in parse_pipeline() local
258 if (!*cmd) *cmd = xzalloc(sizeof(struct command)+8*sizeof(char *)); in parse_pipeline()
261 end = parse_word(start, cmd); in parse_pipeline()
286 struct command *cmd = line->cmd; in run_pipeline() local
287 if (!cmd || !cmd->argc) return; in run_pipeline()
289 tl = toy_find(cmd->argv[0]); in run_pipeline()
301 toy_init(tl, cmd->argv); in run_pipeline()
304 cmd->pid = toys.exitval; in run_pipeline()
311 cmd->pid = vfork(); in run_pipeline()
312 if (!cmd->pid) xexec(cmd->argv); in run_pipeline()
313 else waitpid(cmd->pid, &status, 0); in run_pipeline()
315 if (WIFEXITED(status)) cmd->pid = WEXITSTATUS(status); in run_pipeline()
316 if (WIFSIGNALED(status)) cmd->pid = WTERMSIG(status); in run_pipeline()
325 struct command *cmd=(struct command *)data; in free_cmd() local
327 while(cmd->argc) free(cmd->argv[--cmd->argc]); in free_cmd()
345 if (!line.cmd) break; in handle()
350 llist_traverse(line.cmd, free_cmd); in handle()