UNIX xv6 (rev8, 9/1/15)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Functions | Variables
sh.c File Reference
#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
 

Macros

#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 cmdparsecmd (char *)
 
void runcmd (struct cmd *cmd)
 
int getcmd (char *buf, int nbuf)
 
int main (void)
 
struct cmdexeccmd (void)
 
struct cmdredircmd (struct cmd *subcmd, char *file, char *efile, int mode, int fd)
 
struct cmdpipecmd (struct cmd *left, struct cmd *right)
 
struct cmdlistcmd (struct cmd *left, struct cmd *right)
 
struct cmdbackcmd (struct cmd *subcmd)
 
int gettoken (char **ps, char *es, char **q, char **eq)
 
int peek (char **ps, char *es, char *toks)
 
struct cmdparseline (char **, char *)
 
struct cmdparsepipe (char **, char *)
 
struct cmdparseexec (char **, char *)
 
struct cmdnulterminate (struct cmd *)
 
struct cmdparseredirs (struct cmd *cmd, char **ps, char *es)
 
struct cmdparseblock (char **ps, char *es)
 

Variables

char whitespace [] = " \t\r\n\v"
 
char symbols [] = "<|>&;()"
 

Macro Definition Documentation

#define BACK   5

Definition at line 12 of file sh.c.

#define EXEC   1

Definition at line 8 of file sh.c.

#define LIST   4

Definition at line 11 of file sh.c.

#define MAXARGS   10

Definition at line 14 of file sh.c.

#define PIPE   3

Definition at line 10 of file sh.c.

#define REDIR   2

Definition at line 9 of file sh.c.

Function Documentation

struct cmd* backcmd ( struct cmd subcmd)

Definition at line 250 of file sh.c.

struct cmd* execcmd ( void  )

Definition at line 197 of file sh.c.

int fork1 ( void  )

Definition at line 183 of file sh.c.

int getcmd ( char *  buf,
int  nbuf 
)

Definition at line 134 of file sh.c.

int gettoken ( char **  ps,
char *  es,
char **  q,
char **  eq 
)

Definition at line 267 of file sh.c.

struct cmd* listcmd ( struct cmd left,
struct cmd right 
)

Definition at line 237 of file sh.c.

int main ( void  )

Definition at line 145 of file sh.c.

struct cmd * nulterminate ( struct cmd cmd)

Definition at line 451 of file sh.c.

void panic ( char *  s)

Definition at line 106 of file console.c.

struct cmd* parseblock ( char **  ps,
char *  es 
)

Definition at line 401 of file sh.c.

struct cmd * parsecmd ( char *  s)

Definition at line 329 of file sh.c.

struct cmd * parseexec ( char **  ps,
char *  es 
)

Definition at line 417 of file sh.c.

struct cmd * parseline ( char **  ps,
char *  es 
)

Definition at line 346 of file sh.c.

struct cmd * parsepipe ( char **  ps,
char *  es 
)

Definition at line 363 of file sh.c.

struct cmd* parseredirs ( struct cmd cmd,
char **  ps,
char *  es 
)

Definition at line 376 of file sh.c.

int peek ( char **  ps,
char *  es,
char *  toks 
)

Definition at line 312 of file sh.c.

struct cmd* pipecmd ( struct cmd left,
struct cmd right 
)

Definition at line 224 of file sh.c.

struct cmd* redircmd ( struct cmd subcmd,
char *  file,
char *  efile,
int  mode,
int  fd 
)

Definition at line 208 of file sh.c.

void runcmd ( struct cmd cmd)

Definition at line 58 of file sh.c.

Variable Documentation

char symbols[] = "<|>&;()"

Definition at line 264 of file sh.c.

char whitespace[] = " \t\r\n\v"

Definition at line 263 of file sh.c.