CMSC 216 Exercise #5 Spring 2019Shell Jr (”Shellito”) Due: Tue Apr 23, 2019, 11:30PM1 ObjectivesTo practice fork() and exec by implementing a very simple shell.2 OverviewThe first thing you need to do is to copy the directory shelljr we have left in the grace cluster under the exercisesdirectory. Remember that you need that folder as it contains the .submit file that allows you to submit.3 SpecificationsFor this exercise you will implement a very simpliflied shell. A shell is a C program that executes commandsby forking itself and using exec. We have been using tcsh, but there are other shells like ksh, sh, bash, etc. Thename of our shell is shell jr .Unlike other assignments for this course, you can work together with other classmates, but you may NOTexchange any code.4 Shell Jr FunctionalityYour shell will have a loop that reads command lines and process them. The prompt for your shell will be”shell jr: ”. The commands your shell must handle are:1. exit - When the user enters the exit command the shell will stop executing by calling exit(). Beforeexecuting exit, the shell will print the message ”See you”.2. hastalavista - Has the same functionality as exit.3. cd - This command changes the current directory. You can assume the user will always provide a directoryas an argument.4. A command with a maximum of one argument (e.g., wc location.txt). That means your shell should beable to handle commands like pwd, date or wc location.txt .5 Requirements1. You must NOT use an exec* function to implement the functionality associated with the commandsexit, hastalavista, and cd. For other commands, you must create a child (via fork()) and use execvp() toexecute the command.2. If the user provides an invalid command, the message ”Failed to execute ” followed by the commandname should be printed. In this case the child will exit returning the error code EX OSERR. Use printfto display the message and flush the output buffer (e.g., fflush(stdout)). Note that the shell is not terminatedby executing an invalid command.3. You don’t need to handle the case where the user just types enter (you can assume the user will alwaysprovide a command).4. Make sure you use printf to print the shell prompt and that you flush the buffer.5. It is your responsibility to verify that your program generates the expected results in the submit server.16. You must use execvp (and no other exec* system call).7. Your code must be written in the file shell jr.c.8. You may not use dup2, read, write, nor pipes.9. You may not use system() in order to execute commands.10. You can assume a line of input will have a maximum of 1024 characters.11. Provide a makefile that builds an executable called shell jr. Name the target that builds the executableshell jr . Feel free to add any other targets you need.12. All your C programs in this course should be written using the compiler gcc, with the options definedin the gcc aliases info.txt file. This file can be found in the info folder of the public grace account.13. Your program should be written using good programming style as defined athttp://www.cs.umd.edu/~nelson/classes/resources/cstyleguide/14. Common error: If you get the submit server message ”Execution error, exit code 126” execute ”makeclean” before submitting your code.15. Common error: To forget to return the correct value (e.g., 0) in your code.16. Your C program representing your shell does not take command line arguments. That is, the mainfunction is defined as:int main() { }17. When you see that execvp relies on argv that means it uses an array of strings (argv is not the parameterassociated with command line arguments). Just initialize argv with an array of strings and pass it toexecvp.18. Your shell should exit when end of file is seen. This explains why public tests do not have exit norhastalvista as the last command.19. ShellJr exercise relies on Standard I/O, NOT unix I/O.20. ShellJr takes a maximum of two arguments (e.g., wc location.txt). You can ignore any other valuesprovided after the second argument. For example, if someone enters wc location.txt bla bla will beignored and the command will be processed successfully.21. For exit and hastalavista you can ignore any values provided after the command (just exit the shell).22. For cd you can ignore any values provided after the directory name. For example, cd /tmp bla willchange the current directory to /tmp.23. If an invalid directory is provided to the cd command, your shell should print an error message similarto:Cannot change to directory 24. Do not use signals.26 How to StartYou should start by creating a loop that reads lines and displays them. Then you should begin to processeach command (starting with the exit and cd commands). You are free to process each line any way youwant, however, reading a whole line using fgets and then processing the line using sscanf could make thingssimpler. Keep in mind that if sscanf cannot read a value into a string variable, it will not change the variable.This could help you identify when a command has an argument or not.7 Submitting your assignment1. In the assignment directory execute the command submit.2. Your assignment must be electronically submitted by the date and time above to avoid losing credit. Seethe course syllabus for details.8 Grading CriteriaYour assignment grade will be determined with the following weights:Results of public tests 28%Results of release tests 72%9 Academic integrity statementPlease carefully read the academic honesty section of the course syllabus. Any evidence of impermissiblecooperation on assignments, use of disallowed materials or resources, or unauthorized use of computer accounts,will be submitted to the Student Honor Council, which could result in an XF for the course, or suspensionor expulsion from the University. Be sure you understand what you are and what you are not permittedto do in regards to academic integrity when it comes to assignments. These policies apply to all students, andthe Student Honor Council does not consider lack of knowledge of the policies to be a defense for violatingthem. Full information is found in the course syllabus– please review it at this time.3本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected] 微信:codehelp