#include "types.h"#include "user.h"#include "fcntl.h"Go to the source code of this file.
Data Structures | |
| struct | cmd |
| struct | execcmd |
| struct | redircmd |
| struct | pipecmd |
| struct | listcmd |
| struct | backcmd |
Defines | |
| #define | EXEC 1 |
| #define | REDIR 2 |
| #define | PIPE 3 |
| #define | LIST 4 |
| #define | BACK 5 |
| #define | MAXARGS 10 |
Functions | |
| int | fork1 (void) |
| void | panic (char *) |
| struct cmd * | parsecmd (char *) |
| void | runcmd (struct cmd *cmd) |
| int | getcmd (char *buf, int nbuf) |
| int | main (void) |
| struct cmd * | execcmd (void) |
| struct cmd * | redircmd (struct cmd *subcmd, char *file, char *efile, int mode, int fd) |
| struct cmd * | pipecmd (struct cmd *left, struct cmd *right) |
| struct cmd * | listcmd (struct cmd *left, struct cmd *right) |
| struct cmd * | backcmd (struct cmd *subcmd) |
| int | gettoken (char **ps, char *es, char **q, char **eq) |
| int | peek (char **ps, char *es, char *toks) |
| struct cmd * | parseline (char **, char *) |
| struct cmd * | parsepipe (char **, char *) |
| struct cmd * | parseexec (char **, char *) |
| struct cmd * | nulterminate (struct cmd *) |
| struct cmd * | parseredirs (struct cmd *cmd, char **ps, char *es) |
| struct cmd * | parseblock (char **ps, char *es) |
Variables | |
| char | whitespace [] = " \t\r\n\v" |
| char | symbols [] = "<|>&;()" |
| #define BACK 5 |
| #define EXEC 1 |
| #define LIST 4 |
| #define MAXARGS 10 |
| #define PIPE 3 |
| #define REDIR 2 |
Definition at line 249 of file sh.c.
References BACK, backcmd::cmd, malloc(), memset(), and backcmd::type.
Referenced by parseline().
Definition at line 196 of file sh.c.
References EXEC, malloc(), memset(), and execcmd::type.
Referenced by parseexec().
| int fork1 | ( | void | ) |
| int getcmd | ( | char * | buf, | |
| int | nbuf | |||
| ) |
| int gettoken | ( | char ** | ps, | |
| char * | es, | |||
| char ** | q, | |||
| char ** | eq | |||
| ) |
Definition at line 265 of file sh.c.
References strchr(), symbols, and whitespace.
Referenced by parseblock(), parseexec(), parseline(), parsepipe(), and parseredirs().
Definition at line 236 of file sh.c.
References listcmd::left, LIST, malloc(), memset(), listcmd::right, and listcmd::type.
Referenced by parseline().
| int main | ( | void | ) |
Definition at line 449 of file sh.c.
References execcmd::argv, BACK, backcmd::cmd, redircmd::cmd, execcmd::eargv, redircmd::efile, EXEC, listcmd::left, pipecmd::left, LIST, PIPE, REDIR, listcmd::right, pipecmd::right, and cmd::type.
Referenced by parsecmd().
| void panic | ( | char * | s | ) |
Definition at line 101 of file console.c.
References cli(), cons, cprintf(), getcallerpcs(), panicked, and spinlock::pcs.
Referenced by acquire(), balloc(), bfree(), bget(), bmap(), brelse(), bwrite(), create(), dirlink(), dirlookup(), exit(), fileclose(), filedup(), fileread(), filewrite(), fork1(), ialloc(), iderw(), idestart(), iget(), ilock(), iput(), isdirempty(), iunlock(), kalloc(), kfree(), mpinit(), parseblock(), parsecmd(), parseexec(), parseredirs(), popcli(), release(), runcmd(), sched(), sleep(), sys_unlink(), and trap().
| struct cmd* parseblock | ( | char ** | ps, | |
| char * | es | |||
| ) | [read] |
Definition at line 399 of file sh.c.
References gettoken(), panic(), parseline(), parseredirs(), and peek().
Referenced by parseexec().
| struct cmd * parsecmd | ( | char * | s | ) | [read] |
Definition at line 327 of file sh.c.
References nulterminate(), panic(), parseline(), peek(), printf(), and strlen().
Referenced by main().
| struct cmd * parseexec | ( | char ** | ps, | |
| char * | es | |||
| ) | [read] |
Definition at line 415 of file sh.c.
References execcmd::argv, execcmd::eargv, execcmd(), gettoken(), MAXARGS, panic(), parseblock(), parseredirs(), and peek().
Referenced by parsepipe().
| struct cmd * parseline | ( | char ** | ps, | |
| char * | es | |||
| ) | [read] |
Definition at line 344 of file sh.c.
References backcmd(), gettoken(), listcmd(), parsepipe(), and peek().
Referenced by parseblock(), and parsecmd().
| struct cmd * parsepipe | ( | char ** | ps, | |
| char * | es | |||
| ) | [read] |
Definition at line 361 of file sh.c.
References gettoken(), parseexec(), peek(), and pipecmd().
Referenced by parseline().
Definition at line 374 of file sh.c.
References gettoken(), O_CREATE, O_RDONLY, O_WRONLY, panic(), peek(), and redircmd().
Referenced by parseblock(), and parseexec().
| int peek | ( | char ** | ps, | |
| char * | es, | |||
| char * | toks | |||
| ) |
Definition at line 310 of file sh.c.
References strchr(), and whitespace.
Referenced by parseblock(), parsecmd(), parseexec(), parseline(), parsepipe(), and parseredirs().
Definition at line 223 of file sh.c.
References pipecmd::left, malloc(), memset(), PIPE, pipecmd::right, and pipecmd::type.
Referenced by parsepipe().
Definition at line 207 of file sh.c.
References redircmd::cmd, redircmd::efile, redircmd::fd, redircmd::file, malloc(), memset(), redircmd::mode, REDIR, and redircmd::type.
Referenced by parseredirs().
| void runcmd | ( | struct cmd * | cmd | ) |
Definition at line 58 of file sh.c.
References execcmd::argv, BACK, close(), backcmd::cmd, redircmd::cmd, dup(), exec(), EXEC, exit(), redircmd::fd, redircmd::file, fork1(), pipecmd::left, listcmd::left, LIST, redircmd::mode, open(), panic(), pipe(), PIPE, printf(), REDIR, pipecmd::right, listcmd::right, cmd::type, and wait().
Referenced by main().
| char symbols[] = "<|>&;()" |
| char whitespace[] = " \t\r\n\v" |
1.5.6