Abstract: Design, implement, explain, test, and debug a simple, but complete command-line interpreter named cli. Cli...
Fantastic news! We've Found the answer you've been seeking!
Question:
![Abstract: Design, implement, explain, test, and debug a simple, but complete command-line interpreter named](https://dsd5zvtm8ll6.cloudfront.net/questions/2023/12/657d13cbe9ced_1702695883735.jpg)
![Here the output of another sample run, also with a single cli command: herbertmayer$ ./cli ls hgm cli](https://dsd5zvtm8ll6.cloudfront.net/questions/2023/12/657d13e422a14_1702695906288.jpg)
Transcribed Image Text:
Abstract: Design, implement, explain, test, and debug a simple, but complete command-line interpreter named cli. Cli executes any or the Unix commands: cd, exec, exit, gcc, Is, man, more, mv, rm, pwd, sh, touch, which, and $path. Hints: Refer to the wwweb or lecture notes for this class to implement a correctly working SW solution. Be concise, complete, and precise. Read the man page for the system () function in C++ (or C), and consider using it to complete this homework. Detail: Design, implement, document, test, debug, and run a simple shell, known here as a command-line interpreter (cli). This tool is invoked via the cli command plus possible arguments. Commands are OS commands to be executed. Multiple commands are separated from one another by commas, and some commands may in turn require further arguments. Cli 'knows' the defined list of commands a-priori. When invoked, cli checks, whether the first argument is an included command. If so, cli confirms this via a brief message. If not, cli displays that this is not one the predefined commands. After the message, cli executes all commands in the order listed. After executing the last command, cli prints the current working directory, i.e. it acts as if the pwd command had been issued; then cli terminates. Sample runs below. Multiple arguments of one cli command must be separated from one another by commas. Possible parameters of any one command are separated from the command itself (and from possible further parameters) by white space. White space consists of blanks, tabs, or any combination, but at least 1 blank space. Here are 4 sample runs with single and multiple commands: ./cli pwd ./cli rm -f temp, mv temp../templ ./cli ls -la ./cli rm a.out, gcc sys.c, cp a.out cli Cli starts out identifying itself, also naming you the author, and the release date. Then cli prints the list of all predefine commands. Finally, cli executes all commands input after the cli invocation. For your own debug effort, test your solution with numerous correct and also wrong inputs, including commas omitted, multiple commas, leading commas, illegals commands, other symbols instead of commas etc. No need to hand-in your test and debug work. The output of the cli command "cli pwd" or "./cli pwd" should be as shown below, assuming your current working directory is ./classes_Sac_State/csc139. Here is the output of a sample run with a single command line argument: herbertmayer$ ./cli pwd hgm cli 4/12/2020 Legal commands: looks like Unix pwd; but is your SW ditto: this is your running homework 5 another "single unix command" with args cd exec exit gcc ls man more mv rm pwd sh touch which Spath 2 strings passed to argv[] next string is 'pwd' T new string is 'pwd 1st cmd 'pwd' is one of predefined. /Users/herbertmayer/herb/academia/classes_Sac_State/csc139 Here the output of another sample run, also with a single cli command: herbertmayer$ ./cli ls hgm cli 4/12/2020 Legal commands: 2 strings passed to argv[] next string is 'ls'. new string is 'ls 1st cmd '1s' is one of predefined. admin cli.c docs. grades 1 notes. backup_1_24_2020 backup_3_9_2020 cli }; cd exec exit gcc 1s man more mv rm pwd sh touch which Spath "exec", "exit", "gcc", "18", "man", "more", "mv", "rm" /Users/herbertmayer/herb/academia/classes_Sac_State/cac139 A strong hint: Interpretation (i.e. real execution) of commands that c/i handles can proceed through system(), executed from inside your C/C++ program cli. List of all commands supported by your cli: char cmds [ ] { "cd", "pwd", "sh", "touch", "which", "Spath" T sac_state_yyy sac_state_hw sac_state_xxx What you turn in: 1. The source program of your homework solution; well commented, preferably one single source file. 2. Four progressively more complex executions of your correctly working cli program, showing all user inputs and corresponding output responses. Abstract: Design, implement, explain, test, and debug a simple, but complete command-line interpreter named cli. Cli executes any or the Unix commands: cd, exec, exit, gcc, Is, man, more, mv, rm, pwd, sh, touch, which, and $path. Hints: Refer to the wwweb or lecture notes for this class to implement a correctly working SW solution. Be concise, complete, and precise. Read the man page for the system () function in C++ (or C), and consider using it to complete this homework. Detail: Design, implement, document, test, debug, and run a simple shell, known here as a command-line interpreter (cli). This tool is invoked via the cli command plus possible arguments. Commands are OS commands to be executed. Multiple commands are separated from one another by commas, and some commands may in turn require further arguments. Cli 'knows' the defined list of commands a-priori. When invoked, cli checks, whether the first argument is an included command. If so, cli confirms this via a brief message. If not, cli displays that this is not one the predefined commands. After the message, cli executes all commands in the order listed. After executing the last command, cli prints the current working directory, i.e. it acts as if the pwd command had been issued; then cli terminates. Sample runs below. Multiple arguments of one cli command must be separated from one another by commas. Possible parameters of any one command are separated from the command itself (and from possible further parameters) by white space. White space consists of blanks, tabs, or any combination, but at least 1 blank space. Here are 4 sample runs with single and multiple commands: ./cli pwd ./cli rm -f temp, mv temp../templ ./cli ls -la ./cli rm a.out, gcc sys.c, cp a.out cli Cli starts out identifying itself, also naming you the author, and the release date. Then cli prints the list of all predefine commands. Finally, cli executes all commands input after the cli invocation. For your own debug effort, test your solution with numerous correct and also wrong inputs, including commas omitted, multiple commas, leading commas, illegals commands, other symbols instead of commas etc. No need to hand-in your test and debug work. The output of the cli command "cli pwd" or "./cli pwd" should be as shown below, assuming your current working directory is ./classes_Sac_State/csc139. Here is the output of a sample run with a single command line argument: herbertmayer$ ./cli pwd hgm cli 4/12/2020 Legal commands: looks like Unix pwd; but is your SW ditto: this is your running homework 5 another "single unix command" with args cd exec exit gcc ls man more mv rm pwd sh touch which Spath 2 strings passed to argv[] next string is 'pwd' T new string is 'pwd 1st cmd 'pwd' is one of predefined. /Users/herbertmayer/herb/academia/classes_Sac_State/csc139 Here the output of another sample run, also with a single cli command: herbertmayer$ ./cli ls hgm cli 4/12/2020 Legal commands: 2 strings passed to argv[] next string is 'ls'. new string is 'ls 1st cmd '1s' is one of predefined. admin cli.c docs. grades 1 notes. backup_1_24_2020 backup_3_9_2020 cli }; cd exec exit gcc 1s man more mv rm pwd sh touch which Spath "exec", "exit", "gcc", "18", "man", "more", "mv", "rm" /Users/herbertmayer/herb/academia/classes_Sac_State/cac139 A strong hint: Interpretation (i.e. real execution) of commands that c/i handles can proceed through system(), executed from inside your C/C++ program cli. List of all commands supported by your cli: char cmds [ ] { "cd", "pwd", "sh", "touch", "which", "Spath" T sac_state_yyy sac_state_hw sac_state_xxx What you turn in: 1. The source program of your homework solution; well commented, preferably one single source file. 2. Four progressively more complex executions of your correctly working cli program, showing all user inputs and corresponding output responses.
Expert Answer:
Answer rating: 100% (QA)
The simple implementation of the commandline interpreter cli in C The code follows the requirements ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these operating system questions
-
There are many ways to forecast the future. In many companies (especially small ones), the entire process is subjective, involving improvised methods, intuition, and years of experience. There are...
-
= Suppose that the current one-year interest rate is 1R 2%. Assume that the expected one-year Treasury bond rates over the following three years (i.e., years 2, 3, and 4, respec- tively) as follows:...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
To load and register a JDBC driver, two popular methods can be used: either using the Class.forName() method or creating a new instance of the Driver class.(True/False)
-
The graph in Figure CR5.3 appeared in the report Testing the Waters 2009 (Natural Resources Defense Council). Spend a few minutes looking at the graph and reading the caption that appears with the...
-
Consider the probability distribution shown here: x -4 -3 -2 -1 0 1 2 3 4 p1x2 0.2 0.7 .10 .15 .30 .18 .10 .06 .02 a. Calculate m, s2 , and s. b. Graph p1x2. Locate m, m - 2s, and m + 2s on the...
-
What is the lowest score that would still place a student in the top 5% of the scores?
-
Suppose you know that a companys stock currently sells for $75 per share and the required return on the stock is 11 percent. You also know that the total return on the stock is evenly dividends...
-
An airline wants to know the lowest likely proportion of satisfied customers. The airline surveys a random sample of customers. The results of the sample are shown below. What is the population...
-
A month has elapsed since Precision Computer Centres year-end. Tony Freedman will use four specialized journals for recording business transactions in the month of Septemberyou will find two in...
-
Find the five stationary points of the function f(x, y) = x + 2y + e-3x-3y and classify each using the second derivative test.
-
Please provide a reflection on interimsof a C-Level Leader of a start-up technology company, how/what strategy you will consider to grow your business.
-
Using a ruler, completing the following schematics based on the information provided. 19. Draw a wiring diagram of a PSC compressor with a current start relay and a start capacitor.com 20. Draw a...
-
You observe the below command output. *?What is wrong connection timed out; no servers could be reached arya@arya:~$
-
Evaluate your strengths a supervisor and leader using the preferred leadership profile, the key performance motivators scale, the seven domains for inspiration, and other concepts from your course...
-
3) A spider crawls with constant speed vo on a phonograph turntable rotating with constant angular speed w in the xy plane on a radially outward path, relative to the centre of the turntable. The...
-
"Data are simply raw facts that describe the characteristics of an event ..... information is defined as being data organized in a meaningful way to be useful to the user" (Richardson et. al. p. 6)....
-
Below is a sample of the data in the file NFLAttendance which contains the 32 teams in the National Football League, their conference affiliation, their division, and their average home attendance....
-
Robert Ramos (age 36) is a single taxpayer, living at 8765 Bay Dr., Monterey, CA 93940. His Social Security number is 976-23-5132. Robert's earnings and income tax withholding as the manager of a...
-
While preparing Massie Miller's 2012 Schedule A, you review the following list of possible charitable deductions provided by Massie: Cash contribution to a family whose house burned...
-
Clarita is a single taxpayer with two dependent children, ages 10 and 12. Clarita pays $3,000 in qualified child care expenses during the year. If her adjusted gross income (all from wages) for the...
-
53. A city starts a public library that has separate incorporation and gets some of its money from the state and some from private donations. Indicate whether each of the following independent state...
-
RESEARCH CASE 1 The City ofAbernethy has three large bridges built in the later part of the 1980s that were not capitalized at the time. The citys accountant is interested in receiving suggestions as...
-
51. Use the same information as in problem 50 except that, by the end ofYear 3, the landfill is 40 per cent filled. The city realizes that the total closure costs will be $3 million. Indicate whether...
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App