7310 Operating Systems Fall 2013 Dayton Clark cissh project Due December 4th Name: ID (4-digit): Introduction In this project we implement a simple shell called, cissh. I have implemented the some of the shell, you are to complete the implementation of two features. As is cissh can execute commands like “Is” cissh-l Is Is Distribution Makeflle Solution TAGS cissh cissh. c cissh. o cissh. output cissh. ps cisshSingleCommand. c cisshDescription. odt cisshSingleCommand. o cisshPipe. c discussion. tpl cisshPipe. o solution. output cisshRedirectedlnput. csysCallManPages. pdf cisshRedirectedlnput. otestScript. xt isshRedirectedOutput. c cisshRedirectedOutput. o and “Is > filelist” cissh-l Is > fileList Is > fileLsist but cannot execute “sort -r
I believe that “unzip cissh. zip” will do it. This will create a directory called cissh. Enter the cissh directory and type make. This should compile cissh and run it on testscript. txt. You will notice that the redirected input and pipe features do not work. You will need to work on a Unix-like system for this project. Here are several possibilities: ??? If you have access to a Linux or other Unix system, that should work. If you have a Windows system you can install cygwin which provides a Unix-like environment on your Windows system. Here is a brief description of how to install cygwin (thanks Maor):
Author: Maor Leger posted date: Friday, March 19, 2010 PM EDT Last modified date: Friday, March 19, 2010 PM EDT Total views: 18 Your views: 2 Hey all, Don’t know how much it will help people, but I had some friends ask me how to install cygwin on windows. Well it’s really easy actually and I Just tested that it works: 1 . go to http://cygwin. com/ 2. Scroll down until you see a link for setup. exe 3. Run setup. exe and keep clicking next until you see “Choose a Download Site”. Choose any download site and hit next 4. The package selection window pops up. That’s where my friends at least were having difficulties.
You need to select the packages you want installed. Like emacs/ xemacs, g++, gcc, make, zip, unzip and anything else you want installed have to do is click on the cygwin icon You can also load the cissh. zip file from windows by going to C:cygwinhomeMleger (the path will change based on your username Hope this helps, feel free to post any problems you may have Most of you will not want or need emacs or xemacs, but you will need the other packages suggested. You can edit your file from Windows or if you want an editor in cygwin, you can try the nano package. Page 2 of 7 If you have a Mac, you should be able to work on that.
You will have to install Xcode. You can use the Solaris systems in the WEB building. To work from home you will need to use ssh to access the systems. A good way to use ssh on Windows is to use putty (http://www. chiark. greenend. org. uk/??”sgtatham/putty/download. html). Here is a post on using Unix (thanks George): Subject: Unix Programming Tools Quick Start Remove Reply Quote Modify Set Flag Author: George Howard posted date: Monday, March 22, 2010 PM EDT Last modified date: Monday, March 22, 2010 PM EDT Total views: 4 Your views: 2 UnixProgrammingTools. pdf (37. 881 Kb) Unix Programming Tools attached is a short Unix review.
Stanford CS Education Library: a 16 page introduction to the use of common Unix programming tools. Introduces the overall edit-compile-link-debug programming cycle and the explains the basic usage of… gcc, make, gdb, emacs, and the shell. The goal is to describe the major features and typical uses of the tools and show how they fit together with enough detail for basic projects. A version of this handout is used at Stanford to help students get started building programs on Unix. http://cslibrary. stanford. edu/107/UnixProgrammingTools. pdf favorite Linux/Unix links (Easy install) http://www. ubuntu. com https://help. buntu. om/community/lnstallation http://www. opensolaris. com/ (For the Unix nuts) (gcc – not installed by default? ) (Apple is Unix also but, it is hiding in developer tools. ) http://developer. apple. com/mac/library/documentation/Xcode/Conceptual/XcodeCo existence/Contents/Resources/en. lproJ/Basics/Basics. html One more post, this fixes an error in my code that only appears under some compilers (thanks Yasuhiro): Subject: RE: Description Reply Quote Modify Set Flag Remove Author: Yasuhiro Saito posted date: Thursday, March 11, 2010 4:19:32 PM EST Last modified date: Thursday, March 1 1, 2010 4:19:32 PM EST [cissh. segmentation fault] I think we need to correct cissh. c file. Otherwise a segmentation fault occurs. In the processLine function, we need to correct as follows; if(tokenCount ??”??”0 | I *tokens[tokencount- 1] ‘;’) tokens[tokenCount] = tokenCount++; tokens[tokenCount] – – NULL; Page 3 of 7 you Just add “tokenCount = O I I ” before *tokens[tokenCount -1] When you type Just only return key in the cissh, tokenCount is Zero. So *tokens[tokencountl] is *tokens[-l]. [sun compiler problem] If you compile these files by the sun c compiler (cc), the compiler does not have -Wall option.
So you have to change cc to gcc or -Wall to -v in Makeflle. Thanks What is to be done? To implement these features you will need (at least) two system calls, dup(2) and pipe(2). You also need to download the cissh distribution file from BlackBoard. This is a zip believe that “unzip cissh. zip” will do it. Enter the cissh directory and type make. This will compile cissh and run it on testscript. txt. You will notice that the redirected input and pipe features do not work. There are four files that will be of most interest to you.
These are cisshSingleCommand. c, cisshRedirectedOutput. c, cisshRedirectedlnput. c, and cisshPipe. c. The first two implement the corresponding features. The latter two print rror messages. These two are where you will implement the corresponding features. The files cisshSingleCommand. c and cisshRedirectedOutput. c are well commented and should you a good idea of what you need to do to implement the other two features. Submission You are to submit a cissh_submission. zip file containing four items: ??? this file, cissh. oc, (with your discussion below); C files you modified, cisshRedirectedlnput. c and cisshPipe. c; and a file, output. txt, containing the output from running the command make clean test. You can create output. txt as follows (l give two examples the first for the bash hell (this applies to most of you) the second is for csh users. : For bash use (note: no spaces in Page 4 of 7 $ make clean test > output. txt 2>&1 For csh use: > make clean test > & output. txt You can create the . zip file as follows: zip cissh_submission. zip cissh. doc output. txt cisshRedirectedlnput. cisshPipe. c I would like you to submit this file, cissh_submission. zip, via Sakai. Files Include the source files directly in this document. include the file here: Page 5 of 7 Discussion The rest of this document is where you place your discussion of your work on the assignment. I have provided an outline. Boxes like this one describe what I expect from your. Put your discussion right in this file. Leave in the description of the assignment and these boxes. The primary purpose of this document is for you to convince me that you understand the assignment.
The reason I give this sort of project is for you to get some experience with the topic and then to convince me that you learned and understand the topic. This document is the most important part of demonstrating your understanding and consequently is a major factor in your grade. Rules: 1 . Your discussion must consist of complete sentences and paragraphs, not single ord or single phrase answers. 2. You should site any references you use Just as you would in a term paper. You can put all references at the end. 3. The words in your document must be your own.
Do not cut and paste from web documents or other sources. If you must quote from a document, do so in the proper manner and cite the reference. 4. You are encouraged to discuss your work, difficulties, and discoveries with your class mates. But, your submissions (source files, log files, output, this document) must be your own and unique. 5. For each topic or question put your discussion/answer following the box, not inside he box. Description A brief description of the assignment. This includes what you are to do for the assignment and why the assignment was made.
I generally do not give assignments that are Just busy-work. In this section I want you to discuss in your own words why I made this assignment (or perhaps why you think I made the assignment). Page 6 of 7 assignments, the details of your solution are in other files (e. g. , the source files). In this case, present a brief description solution of your solution here. I would like more than “l wrote a program to implement the assignment. ” unless the assignment is really trivial. This is the place to include discussion of particular problems you had (and how you solved them).
Furthermore this is the place to highlight particularly clever solutions you found or other special parts or your work. I am willing to give extra credit if warranted. I do not do this very often though. Comments Any comments you might have. Including: interesting problems/solutions; problems with the assignment itself; problems with the tools you used; things I should do if I assign this in a future term. Other noteworthy comments. A comment like “This assignment was a complete waste of time. ” is legitimate. page 7 of 7