Do My Homework / Homework Help Answers / Computer Science Homework Help / Interactive shell command line interpreter (C++)

Interactive shell command line interpreter (C++)

Online tutoring services

Need help with this question or any other Computer Science assignment help task? Click on the button below to to hire an expert cheap.

The assignment must be done in C++ language.


Below are the assignment's instructions, please follow them:


Homework is to be completed individually. Send your zipped source code and executable file to me via Canvas named like this:  cs351_assignment2_firstName_lastName.zip.  Or you may also upload two files, your source code (cs351_assignment2_firstName_lastName.cpp) and your executable file (cs351_assignment2_firstName_lastName.exe).

Be sure to include your name at the top of each source file submitted. For example:

 // ConsoleApplication1.cpp : Simple Command Line Interpreter.

// Copyright (c) John Oates 8/26/2016

//


Interactive Shell:

Write a C/C++ program to implement an interactive shell in which users can execute commands. Call this program myShell. Create an infinite loop (while(1)) that repeatedly prompts the user to enter a command (see example output and input below). Before executing the command entered by the user, the command must be compared against the list of supported commands shown here:


dir

help

vol

path

tasklist

notepad

echo

color

ping


Since some commands require more than one argument (e.g. echo, color, ping), you will need to parse the user input into its arguments. Consider using the strtok() function.


For example:


COMMAND TYPED BY THE USER:

ping 192.168.1.1


ARGUMENT 0: "ping"

ARGUMENT 1: "192.168.1.1"


If the command in argument[0] is in the list above, your program must execute the command in a child thread via CreateThread(). In other words, create a child thread that executes the command.  You do not need to actually write code to execute each command.  Simply pass the command into the system call, system() and let the operating system handle the processing for you.  The parent thread waits for the child to terminate. If the user types exit or quit, your shell should simply terminate. Sample output and input are shown below:


Welcome to myShell


==> dir


Volume in drive C is Windows

Volume Serial Number is 301D-8616


Directory of c:\Projects\ConsoleApplication1\ConsoleApplication1


08/27/2016 08:59 AM     <DIR>             .

08/27/2016 08:59 AM     <DIR>               ..

08/27/2016 08:59 AM                    1,686 ConsoleApplication1.cpp

08/25/2016 05:42 PM                    8,060 ConsoleApplication1.vcxproj

08/25/2016 05:42 PM                    1,346 ConsoleApplication1.vcxproj.filters

08/27/2016 09:00 AM     <DIR>              Debug

08/25/2016 05:42 PM                    1,799 ReadMe.txt

08/25/2016 05:42 PM                       306 stdafx.cpp

08/25/2016 05:42 PM                       320 stdafx.h

08/25/2016 05:42 PM                       314 targetver.h

                     7 File(s) 13,831 bytes

                     3 Dir(s) 526,080,049,152 bytes free


==> ping 192.168.1.1


Pinging 192.168.1.1 with 32 bytes of data:

Reply from 192.168.1.1: bytes=32 time=2ms TTL=64

Reply from 192.168.1.1: bytes=32 time=1ms TTL=64

Reply from 192.168.1.1: bytes=32 time=3ms TTL=64

Reply from 192.168.1.1: bytes=32 time=4ms TTL=64


Ping statistics for 192.168.1.1:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 1ms, Maximum = 4ms, Average = 2ms


==> exit


Thanks for using myShell!


Assumptions: Assume arguments within myShell do not contain spaces. In other words, don't worry about parsing out quoted strings in your argument list (e.g.cat a.txt "some file.txt"). You may assume that no more than four arguments will be used on the command line (i.e. similar to argv[0], argv[1], argv[2], and argv[3]).

Get Help With a similar task to - Interactive shell command line interpreter (C++)

Login to view and/or buy answers.. or post an answer

Related Questions

Similar orders to Interactive shell command line interpreter (C++)
3
Views
0
Answers
I need a pass on a project for my studies - API
I need a pass on a project for my studies. Everything is in the API Project Brief. Data already created ready to implement. Javascript - MongoDB - Mongoose...
15
Views
0
Answers
TCP Json server. Your program will use the sockets interface to send and receive TCP data in C
The zip file has the project description pdf and my problematic attempt at the code. It has another zip file that has a sample json server executable and a wdribble executable to test the program but wdribble only works on school server so I will have to test the program. It has the makefile to compile it as well. Since the code will be tested on school server, I will have to test it there...
31
Views
0
Answers
I have attached the homework question(Homework.pdf) as well as the materials required to answer the question.
(16 points) Consider the following change in the rules associated with each (object, verb) pair in Miller and Baldwin’s model (see Section 2.2.1): name rules recipes write: ‘creative’ in subject.group and ‘chef’ in subject.role overpass write: ‘artist’ in subject.role and ‘creative’ in subject.group .shellrct write: ‘hack’ in subject.group and (time.hour < 4 or time.hour > 20) and time.hour > 0 oven.dev temp_ctl: ‘kitchen’ in subject.program and ‘chef’ in subject.role How does this change the access control matrices shown at the end of that section? (24 points) Consider the set of rights { r, w, n }. Using the syntax in Section 2.3, write a command delete_all_rights(p, q, o). This command causes p to delete all rights the subject q has over an object o. Modify your command so that the deletion can occur only if p has w rights over o. Modify your command so that the deletion can occur only if p has r rights over o and q does not have n rights over o. (30 points) Theorem 3.1, used in the proof of Theorem 3.1, states: “Suppose two subjects s1 and s2 are created and the rights in A[s1, o1] and A[s2, o2] are tested. The same test for...
105
Views
0
Answers
Python Code (Classes, Dictionaries) Create a Stand
See Attached File (better readability) [70 pts] You will be writing code for recording the menu items and daily sales of a lemonade stand. It will have these classes: MenuItem, SalesForDay, and LemonadeStand. All data members of each class should be marked as private (a leading underscore in the name). Since they're private, if you need to access them from outside the class, you should do so via get or set methods. Here are the method descriptions for the three classes: MenuItem: A MenuItem object represents a menu item to be offered for sale at the lemonade stand. init method - takes as parameters three values with which to initialize the MenuItem: its name, its wholesale cost, and its selling price get methods for each of the data members: get_name(), get_wholesale_cost(), and get_selling_price() SalesForDay: A SalesForDay object represents the sales for a particular day. init method - takes as parameters two values with which to initialize the SalesForDay: the day (an integer for the number of days the stand has been open so far), and a dictionary whose keys are the names of the items sold, and whose values are the numbers of those items sold that day get...