Jim's
Tutorials

Spring 2010
course
navigation
Notes and errata relating to the shell
For the most part, I'm following http://www.cs.ucsb.edu/~chris/teaching/cs170/projects/proj1.html
This ended up being for Linux/BSD and not Minix; I'll try compiling it when I have a working system, though.
Testing is, as always, weak. Pipes (just |) are not handled at all. Redirects seemed to work when I tried, but I did not test very much, being more concerned about zombies at that point.
Note that multiple identical redirects might do interesting things; I didn't try it but I'd actually expect that it wouldn't error out.
On the positive side, I did manage to make something that compiles cleanly with -Wall (GCC 4.1.2 and 4.2.1)
The thing that took me the longest and caused the most grief was formatting the arguments list for execvp. For some reason, I totally forgot that the first argument needed to be the command itself, then I had an utter nightmare trying to get the last argument to be null, eventually resorting to a horribly hacky use of calloc.
http://cs.marlboro.edu/ courses/ spring2010/jims_tutorials/ richard/ shell
last modified Thursday February 18 2010 10:02 am EST

attachments [paper clip]

     name last modified size
[COD]shell.c Feb 18 2010 10:02 am 4.50kB