cmd                28 sh.c             struct cmd *cmd;
cmd                37 sh.c             struct cmd *left;
cmd                38 sh.c             struct cmd *right;
cmd                43 sh.c             struct cmd *left;
cmd                44 sh.c             struct cmd *right;
cmd                49 sh.c             struct cmd *cmd;
cmd                54 sh.c           struct cmd *parsecmd(char*);
cmd                58 sh.c           runcmd(struct cmd *cmd)
cmd                67 sh.c             if(cmd == 0)
cmd                70 sh.c             switch(cmd->type){
cmd                75 sh.c               ecmd = (struct execcmd*)cmd;
cmd                83 sh.c               rcmd = (struct redircmd*)cmd;
cmd                89 sh.c               runcmd(rcmd->cmd);
cmd                93 sh.c               lcmd = (struct listcmd*)cmd;
cmd               101 sh.c               pcmd = (struct pipecmd*)cmd;
cmd               125 sh.c               bcmd = (struct backcmd*)cmd;
cmd               127 sh.c                 runcmd(bcmd->cmd);
cmd               195 sh.c           struct cmd*
cmd               198 sh.c             struct execcmd *cmd;
cmd               200 sh.c             cmd = malloc(sizeof(*cmd));
cmd               201 sh.c             memset(cmd, 0, sizeof(*cmd));
cmd               202 sh.c             cmd->type = EXEC;
cmd               203 sh.c             return (struct cmd*)cmd;
cmd               206 sh.c           struct cmd*
cmd               207 sh.c           redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
cmd               209 sh.c             struct redircmd *cmd;
cmd               211 sh.c             cmd = malloc(sizeof(*cmd));
cmd               212 sh.c             memset(cmd, 0, sizeof(*cmd));
cmd               213 sh.c             cmd->type = REDIR;
cmd               214 sh.c             cmd->cmd = subcmd;
cmd               215 sh.c             cmd->file = file;
cmd               216 sh.c             cmd->efile = efile;
cmd               217 sh.c             cmd->mode = mode;
cmd               218 sh.c             cmd->fd = fd;
cmd               219 sh.c             return (struct cmd*)cmd;
cmd               222 sh.c           struct cmd*
cmd               223 sh.c           pipecmd(struct cmd *left, struct cmd *right)
cmd               225 sh.c             struct pipecmd *cmd;
cmd               227 sh.c             cmd = malloc(sizeof(*cmd));
cmd               228 sh.c             memset(cmd, 0, sizeof(*cmd));
cmd               229 sh.c             cmd->type = PIPE;
cmd               230 sh.c             cmd->left = left;
cmd               231 sh.c             cmd->right = right;
cmd               232 sh.c             return (struct cmd*)cmd;
cmd               235 sh.c           struct cmd*
cmd               236 sh.c           listcmd(struct cmd *left, struct cmd *right)
cmd               238 sh.c             struct listcmd *cmd;
cmd               240 sh.c             cmd = malloc(sizeof(*cmd));
cmd               241 sh.c             memset(cmd, 0, sizeof(*cmd));
cmd               242 sh.c             cmd->type = LIST;
cmd               243 sh.c             cmd->left = left;
cmd               244 sh.c             cmd->right = right;
cmd               245 sh.c             return (struct cmd*)cmd;
cmd               248 sh.c           struct cmd*
cmd               249 sh.c           backcmd(struct cmd *subcmd)
cmd               251 sh.c             struct backcmd *cmd;
cmd               253 sh.c             cmd = malloc(sizeof(*cmd));
cmd               254 sh.c             memset(cmd, 0, sizeof(*cmd));
cmd               255 sh.c             cmd->type = BACK;
cmd               256 sh.c             cmd->cmd = subcmd;
cmd               257 sh.c             return (struct cmd*)cmd;
cmd               322 sh.c           struct cmd *parseline(char**, char*);
cmd               323 sh.c           struct cmd *parsepipe(char**, char*);
cmd               324 sh.c           struct cmd *parseexec(char**, char*);
cmd               325 sh.c           struct cmd *nulterminate(struct cmd*);
cmd               327 sh.c           struct cmd*
cmd               331 sh.c             struct cmd *cmd;
cmd               334 sh.c             cmd = parseline(&s, es);
cmd               340 sh.c             nulterminate(cmd);
cmd               341 sh.c             return cmd;
cmd               344 sh.c           struct cmd*
cmd               347 sh.c             struct cmd *cmd;
cmd               349 sh.c             cmd = parsepipe(ps, es);
cmd               352 sh.c               cmd = backcmd(cmd);
cmd               356 sh.c               cmd = listcmd(cmd, parseline(ps, es));
cmd               358 sh.c             return cmd;
cmd               361 sh.c           struct cmd*
cmd               364 sh.c             struct cmd *cmd;
cmd               366 sh.c             cmd = parseexec(ps, es);
cmd               369 sh.c               cmd = pipecmd(cmd, parsepipe(ps, es));
cmd               371 sh.c             return cmd;
cmd               374 sh.c           struct cmd*
cmd               375 sh.c           parseredirs(struct cmd *cmd, char **ps, char *es)
cmd               386 sh.c                 cmd = redircmd(cmd, q, eq, O_RDONLY, 0);
cmd               389 sh.c                 cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
cmd               392 sh.c                 cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
cmd               396 sh.c             return cmd;
cmd               399 sh.c           struct cmd*
cmd               402 sh.c             struct cmd *cmd;
cmd               407 sh.c             cmd = parseline(ps, es);
cmd               411 sh.c             cmd = parseredirs(cmd, ps, es);
cmd               412 sh.c             return cmd;
cmd               415 sh.c           struct cmd*
cmd               420 sh.c             struct execcmd *cmd;
cmd               421 sh.c             struct cmd *ret;
cmd               427 sh.c             cmd = (struct execcmd*)ret;
cmd               436 sh.c               cmd->argv[argc] = q;
cmd               437 sh.c               cmd->eargv[argc] = eq;
cmd               443 sh.c             cmd->argv[argc] = 0;
cmd               444 sh.c             cmd->eargv[argc] = 0;
cmd               449 sh.c           struct cmd*
cmd               450 sh.c           nulterminate(struct cmd *cmd)
cmd               459 sh.c             if(cmd == 0)
cmd               462 sh.c             switch(cmd->type){
cmd               464 sh.c               ecmd = (struct execcmd*)cmd;
cmd               470 sh.c               rcmd = (struct redircmd*)cmd;
cmd               471 sh.c               nulterminate(rcmd->cmd);
cmd               476 sh.c               pcmd = (struct pipecmd*)cmd;
cmd               482 sh.c               lcmd = (struct listcmd*)cmd;
cmd               488 sh.c               bcmd = (struct backcmd*)cmd;
cmd               489 sh.c               nulterminate(bcmd->cmd);
cmd               492 sh.c             return cmd;