I need this project done by 10/7 11:59pm (central time). I have a file with the provided code which is (Command.cpp, Command.hpp, main.cpp, MakFile, Token.cpp, Token.hpp, TokenStream.cpp and TokenStream.hpp). using these classes you will finish the project. The main.cpp file needs to be edited and you can see in the project instructions There is a example output that shows other files that were made for the projects .
CSC35500 Programming Project 1 Due: 9/28/2023 10/5/2023, 11:59 PM
Early Submission Deadline: 9/26/2023 10/3/2023, 11:59 PM
Problem Statement
You will be writing a program that presents its user with a shell in which they can type commands and see their results. This shell should support changing directories, running commands, redirecting input and/or output, and piping output from one command to the input of another command.
Problem Details
You are to take the provided Command class (which can read commands from the keyboard) and use it to repeatedly read in and process commands until the user types in “exit” as a command.
With the exception of the “cd” and “exit” commands, each command should create a new process and execute the command in the new process. Some other details:
• the “exit” command should cause your shell program to end. printing a message indicating such.
• the “cd” command should used the chdir() system call to change directories in the current shell. The chdir function call takes one parameter, namely a string (c-style character array/ pointer version) representing the name of the directory to change into.
• other commands should be executed using an execvp() call. • a command with an input redirect should use the contents of the specified input file as if it
is standard input. For example, wc -l < data.txt
will count the number of lines (the wc – l command) found in the file data.txt and display that number on standard output (i.e. on the console.) • a command with an output redirect should use the contents of the specified output file as if
it is standard output. For example, wc -l < data.txt > output.txt
will count the number of lines (the wc – l command) found in the file data.txt and output the result in the file output.txt . Note that this will overwrite the contents of the file output.txt. Also note that you can do file output redirection without file input redirection. • a command specified to run in the background (by adding an &) means that the shell
should immediately allow another command to be entered at a new command prompt. When a backgrounded program completes, a summary including the name of the command and its PID should be printed.
• on the other hand, a command entered without an & indicating background processing should wait for the associated command to complete before prompting the user to enter another command.
• a command with a pipe out (“|”) should redirect its output to a pipe. This pipe should then be used as the input for the next command read. For example,
cat somefile.txt | sort should output the file somefile.txt (i.e. cat somefile.txt) into a pipe (not on the screen) and then another command (i.e. sort) uses the pipe for its input (and displays its output on the screen, since there is no pipe out for the sort command or any output file redirection for the sort command. )
Remember that upon exit your shell program should print a message indicating that your shell has completed.
Example Run
The following is an example run with >>>> being the project’s shell prompt. User input is in italics; you should not attempt to make your input in italics, it is being shown that way here to distinguish between input and output in the example run.
>>>> ls -l total 888 -rw-r–r–. 1 sblythe sblythe 2289 Sep 12 16:33 Command.cpp -rw-r–r–. 1 sblythe sblythe 979 Sep 12 16:33 Command.h -rw-r–r–. 1 sblythe sblythe 95296 Sep 12 16:38 Command.o -rw-r–r–. 1 sblythe sblythe 5156 Sep 12 17:23 main.cpp -rw-r–r–. 1 sblythe sblythe 243512 Sep 12 17:23 main.o -rw-r–r–. 1 sblythe sblythe 597 Sep 12 16:35 Makefile -rw-r–r–. 1 sblythe sblythe 1002 Sep 12 16:33 PipeDream.cpp -rwxr-xr-x. 1 sblythe sblythe 268736 Sep 12 17:23 proj1 -rw-r–r–. 1 sblythe sblythe 630 Sep 12 16:33 ShellProcess.cpp -rw-r–r–. 1 sblythe sblythe 579 Sep 12 16:33 ShellProcess.h -rw-r–r–. 1 sblythe sblythe 75800 Sep 12 16:38 ShellProcess.o -rw-r–r–. 1 sblythe sblythe 322 Sep 12 16:33 Token.cpp -rw-r–r–. 1 sblythe sblythe 599 Sep 12 16:33 Token.h -rw-r–r–. 1 sblythe sblythe 80256 Sep 12 16:38 Token.o -rw-r–r–. 1 sblythe sblythe 2186 Sep 12 16:33 TokenStream.cpp -rw-r–r–. 1 sblythe sblythe 227 Sep 12 16:33 TokenStream.h -rw-r–r–. 1 sblythe sblythe 86000 Sep 12 16:38 TokenStream.o >>>> ls -l > output.txt >>>> cat output.txt total 888 -rw-r–r–. 1 sblythe sblythe 2289 Sep 12 16:33 Command.cpp -rw-r–r–. 1 sblythe sblythe 979 Sep 12 16:33 Command.h -rw-r–r–. 1 sblythe sblythe 95296 Sep 12 16:38 Command.o -rw-r–r–. 1 sblythe sblythe 5156 Sep 12 17:23 main.cpp -rw-r–r–. 1 sblythe sblythe 243512 Sep 12 17:23 main.o -rw-r–r–. 1 sblythe sblythe 597 Sep 12 16:35 Makefile -rw-r–r–. 1 sblythe sblythe 1115 Sep 12 22:08 output.txt -rw-r–r–. 1 sblythe sblythe 1002 Sep 12 16:33 PipeDream.cpp -rwxr-xr-x. 1 sblythe sblythe 268736 Sep 12 17:23 proj1 -rw-r–r–. 1 sblythe sblythe 630 Sep 12 16:33 ShellProcess.cpp -rw-r–r–. 1 sblythe sblythe 579 Sep 12 16:33 ShellProcess.h -rw-r–r–. 1 sblythe sblythe 75800 Sep 12 16:38 ShellProcess.o -rw-r–r–. 1 sblythe sblythe 322 Sep 12 16:33 Token.cpp -rw-r–r–. 1 sblythe sblythe 599 Sep 12 16:33 Token.h -rw-r–r–. 1 sblythe sblythe 80256 Sep 12 16:38 Token.o -rw-r–r–. 1 sblythe sblythe 2186 Sep 12 16:33 TokenStream.cpp -rw-r–r–. 1 sblythe sblythe 227 Sep 12 16:33 TokenStream.h -rw-r–r–. 1 sblythe sblythe 86000 Sep 12 16:38 TokenStream.o >>>> cat output.txt | wc Completed: PID= 13477 : cat output.txt 19 164 1115
>>>> cat output.txt & >>>> total 888 -rw-r–r–. 1 sblythe sblythe 2289 Sep 12 16:33 Command.cpp -rw-r–r–. 1 sblythe sblythe 979 Sep 12 16:33 Command.h -rw-r–r–. 1 sblythe sblythe 95296 Sep 12 16:38 Command.o -rw-r–r–. 1 sblythe sblythe 5156 Sep 12 17:23 main.cpp -rw-r–r–. 1 sblythe sblythe 243512 Sep 12 17:23 main.o -rw-r–r–. 1 sblythe sblythe 597 Sep 12 16:35 Makefile -rw-r–r–. 1 sblythe sblythe 1115 Sep 12 22:08 output.txt -rw-r–r–. 1 sblythe sblythe 1002 Sep 12 16:33 PipeDream.cpp -rwxr-xr-x. 1 sblythe sblythe 268736 Sep 12 17:23 proj1 -rw-r–r–. 1 sblythe sblythe 630 Sep 12 16:33 ShellProcess.cpp -rw-r–r–. 1 sblythe sblythe 579 Sep 12 16:33 ShellProcess.h -rw-r–r–. 1 sblythe sblythe 75800 Sep 12 16:38 ShellProcess.o -rw-r–r–. 1 sblythe sblythe 322 Sep 12 16:33 Token.cpp -rw-r–r–. 1 sblythe sblythe 599 Sep 12 16:33 Token.h -rw-r–r–. 1 sblythe sblythe 80256 Sep 12 16:38 Token.o -rw-r–r–. 1 sblythe sblythe 2186 Sep 12 16:33 TokenStream.cpp -rw-r–r–. 1 sblythe sblythe 227 Sep 12 16:33 TokenStream.h -rw-r–r–. 1 sblythe sblythe 86000 Sep 12 16:38 TokenStream.o Completed: PID= 13493 : cat output.txt & ls Command.cpp main.o proj1 Token.cpp TokenStream.h Command.h Makefile ShellProcess.cpp Token.h TokenStream.o Command.o output.txt ShellProcess.h Token.o main.cpp PipeDream.cpp ShellProcess.o TokenStream.cpp >>>> pwd /home/sblythe/MyShare/MySol >>>> cd /home/sblythe >>>> pwd /home/sblythe >>>> ls a.out Documents Music shared workspace-fcdtdebug Blythes_CSC24400 Downloads myFork.cpp silliness busyWait.cpp fcdtdebugger MyShare Templates CSC24400 hello Pictures Videos Desktop hello.cpp Public workspace >>>> exit Thank you for using blythe-shell. We now return you to your regularly scheduled shell!
Note that the previous command was a backgrounded command, and the shell prompt appeared before the previous command completed … in fact, the output only starts after the command prompt prints!
The backgrounded command completed, so this line printed
New user command typed
Submission
You should post to Canvas both your C++ source code file and a plain text file (not an MS Word file) called read.me in a zip or tgz file. Make sure the “root” of your submission is a folder (not just a collection of files.) The read.me file should contain: • your name and any other identifying information. • any special details on how to compile your project • any special details on how to run your project – note that you cannot circumvent the project specifications here! • any known bugs your project has, and possible fixes to those bugs (partial credit abounds here). • an overview of how you solved the project. • You may put any other information you like in this file, although you are not required to do so – one common additional set of entries is a “software engineering log” that indicates what you have done every time you sat down and worked on the project. Many programmers find that such actually helps you to finish projects faster!
Grading Breakdown
Final Notes
• Have you started this project yet? If not, start now! • If you have any questions about this project, see me as soon as possible. • Have you started this project yet? If not, start NOW !
Correct Submission 15%
Successful Compilation 20%
Following Directions 15%
Correct Execution 40%
Comments/ read.me 10%
