This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CMSC 216 Project #5 Fall 2011 A Simple Shell Due: November 22, 2011, 6:00PM This project will have you write a simple shell, much like the one you have been using for all your work on the Linux Grace machines. You will use your knowledge of file operations and process control to effect file redirection, backgrounding, and program pipelines. Note: Your code will be compared against prior semesters via automated testing. 1 Procedure 1.1 Obtain the project files We have supplied several files for your use in this project, in addition to the usual .submit file: (a) parser.c , which defines a function to parse a command line into a C structure that is easier to use in your program; (b) parser_test.c , a program that demonstrates the use of the parse_line() function; (c) mysh.c , a very simple shell program that only recognizes two commands: exit and cd ; and (d) execute.c , which defines the function execute_command_line() . In addition, we also supply the header files parser.h and execute.h . All these files are contained in ~/216public/project5/project5.tgz ; you should copy this file to your home directory and extract the files in a similar manner to the procedure you followed in previous projects. Your code for this project should be contained in your ~/216/project5 subdirectory, which is created by extracting files from the tarball you copied. 1.2 Create a Makefile As for Project #3, you must create a Makefile that we will use to build your shell implementation. Section 2.1 lists the targets you are required to implement, as well as other requirements for your Makefile . 1.3 Implement and test the shell You must implement your shell program by supplying the necessary code in execute.c . As you implement various features of the shell, you can test them by either interactively running mysh while typing in commands, or you can create text files with one command per line, and use redirection to feed them as input to your shell. 2 Specifications 2.1 Makefile Your Makefile should be set up so that all programs are built using separate compilation (i.e., source files are turned into object files, which are then linked together in a separate step). All object files should be built using the-ansi and-Wall flags to gcc . You must have the following targets in your Makefile : 1. all : make all executables 2. clean : delete all object files and executables 3. parser.o , execute.o , and mysh.o , the object files for the parsing code and shell code 4. mysh : the executable created by linking the parsing object file with the shell object files We will use the Makefile you provide to build the public test executables on the submit server; if there is no Makefile , your shell program will not be built, and you will not receive credit for any tests....
View Full Document
This note was uploaded on 01/13/2012 for the course CMSC 216 taught by Professor Plane during the Spring '11 term at Maryland.
- Spring '11