CSE 190 Sp 2000 -- Assignment 2 -- April 25, 2000

Assignment 2. Download the tar file to get the provided C parser code. See the man page on tar if you don't remember how to run it.

new!: My working sources is available -- minus run.c and run.h -- in /home/solaris/ieng9/cs190e/public/v0.9.tar and here. You are not required to change your code to use this right now -- this is just what the parser team has done while you've been working on the execution module, and integration will happen sometime after this assignment is due -- in a subsequent assignment, when engineering change requests come in from the customers/marketing.

For testing purposes, you can run my working binary at /home/solaris/ieng9/cs190e/public/yaish.

old: A version of shvar.c with a couple of bug fixes is now available.

Note: you should confine your changes to run.c and run.h. The other files may change due to bug fixes -- and will almost certainly change for subsequent assignments based on newer versions of this source code. Are there problems with the following design?

You are to implement the following shell built-in commands:
cd dirchanges the current working directory to be dir
pipe pnamecreates a pipe to be later referred to by the name pname
pclose pnamecloses both descriptors of the pipe pname
pclose pname modemode is r, w, or combination thereof; pclose closes the specified end of the descriptor(s) of the pipe pname. This is not a required part of the assignment.

You are to also implement the execution of simple commands, using exec(2), fork(2), dup(2), dup2(2), pipe(2), etc as appropriate to handle command execution and I/O redirection. You may not use the system(3) library routine.

The shell syntax includes the following I/O redirection directives:
num< fnameassociate input descriptor num with file fname
num> fnameassociate output descriptor num with file fname, truncating the file and creating it if necessary
num>> fnameassociate output descriptor num with file fname, appending to the file and creating it if necessary
num<&num2make input descriptor num refer to the same object as descriptor num2
num>&num2make output descriptor num refer to the same object as descriptor num2
num<&-close input descriptor num
num>&-close output descriptor num
num<| pnamemake input descriptor num read from the pipe pname
num>| pnamemake output descriptor num write to the pipe pname
In all cases, if num is omitted, the default of 0 is used for input redirection and 1 is used for output redirection.

[ search CSE | CSE home | bsy's home page | webster i/f | MRQE | google | yahoo | hotbot | lycos | altavista | pgp key svr | spam | commerce ]
picture of bsy

bsy+cse190.s00@cs.ucsd.edu, last updated Tue Jun 6 18:27:31 PDT 2000. Copyright 2000 Bennet Yee.
email bsy.

Don't make me hand over my privacy keys!