Write a small c program called tinyshell that behaves much

Assignment Help Computer Engineering
Reference no: EM132213972

Write a small C program called tinyshell that behaves much like a shell; but your program has to accept and respond to the following four commands only, presented one at a time:

world n - run the command called world and pass the argument n to it

mars n - run the command called mars and pass the argument n to it

newcat file - run the newcat program to display the file on standard output

quit - terminate execution of the tinyshell

The tinyshell program works as follows: puts out a prompt next command> and then reads the command string typed by the user (use scanf).

If the command typed by the user is not one of the above four, it responds with an error message and prompts the user again. If the command typed is quit the program is terminated.

Otherwise, it reads, as a string, the remaining part of the command (i.e., the count n or the file name). Then it executes the command world or mars or newcat as required.

For this, tinyshell forks and the parent process immediately executes wait. The child process executes execlp to overlay itself with the code of world or mars or newcat. On its completion, the parent process resumes execution putting out a new prompt for the next command.

Reference no: EM132213972

Questions Cloud

Report the total payments by date when the total payments : Report the total payments by date when the total payments are greater than $20,000. Which orders have a value greater than $5,000?
Write a single if-statement that is true on the range of i : Write a single if-statement that is true on the range of i values shown and false on all other values.
Write a single sql statement to list all the tracks : Write a single SQL statement to list all the tracks that have the exact word 'time' as part of the name in the Track table.
Write a source code in java nxt legos for this lawn mower : Motor A is the blade which is constantly spinning. Motor B and C are the whelels. The robot has 2 sensors. Touch sensor and light sensor.
Write a small c program called tinyshell that behaves much : The tinyshell program works as follows: puts out a prompt next command> and then reads the command string typed by the user (use scanf).
A code that adds two 32 bit numbers stored : Write a small code in assembly language that adds two 32 bit numbers stored at K1 and M1, and then stores the result in K1+6.
Write statements that assign random integers to the variable : Write statements that assign random integers to the variable n in the following range: -5 =n = 5
Fill the array with random numbers between 1 and 25 : Use a constant to set the size of your array, you should be able to change size in one line and still have a robust program.
Describe trading and available for sale securities : Beginning in 2018 the accounting for investments in stock changed. The former methods used were accounting for stock as trading securities.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What are the components of a communication protocol

What are the components of a communication protocol? Describe frequency modulation, amplitude modulation, phase-shift modulation, and on-off keying.

  Create an interface for automobile mechanics

Imagine you are managing a design project that will create an interface for automobile mechanics. The interface would be used by the mechanics to look.

  Describe any challenges you had

Within the documentation, describe any challenges you had and how you overcame those challenges. Document the server instance names you created.

  Write a program to generate random connected graphs

Write a program to generate random connected graphs with V vertices, then find the minimum spanning tree and shortest path tree for some vertex.

  Delete that element from the array while keeping the other

Write a function called delete_array that takes an array of ints, its length by reference, and the index of an element to delete.

  Write a java program that uses j option pane windows

Write a Java program that uses J Option Pane windows to read in two numbers and print out their sum and product.

  Reports the total number of bearings

Reports the number of valid, invalid, good, bad, and total bearings after reading in each bearing size (e.g. within the loop).

  Why menu-driven interfaces continue to be popular

Evaluate the user dialog strategies used by a menu-driven interface. Determine why menu-driven interfaces continue to be popular in the modern computing age.

  Define the matmatsax function

Modify MatMatSax so that it efficiently handles the case when B is upper triangular.

  Get the name and group from the form and display

Write a function named displayFormValues. The function should get the name and group from the form and display both the values in 1 alert.

  Display the sum of all the single digit numbers in string

Write a python program that asks the user to enter a series of single-digit numbers with nothing separating them.

  Explain where in operating system the instruction would used

A typical hardware architecture provides an instruction called return from interrupt, abbreviated by something like iret. This instruction switches the mode.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd