Reference no: EM131099610
Lab Instruction
In this project, you will learn how to design a C program to serve as a shell interface that accepts user commands and then executes each command in a separate process. Your program should parse the command that is entered by a user including arguments of a command by using strtok system call. The strtok() function breaks a string into a sequence of zero or more nonempty tokens. For example, "ls" is the command "-l" is an argument of "ls" command. Separate tokens can be stored in an array of character strings (args in Figure 3.36). You can find the description of this programming project and an extended start code at the bottom of the page if you want to use.
#include <stdio.h>
#include <unistd.h>
#define MAX LINE 80 /* The maximum length command */
int main(void)
{
char *args[MAX LINE/2 + 1]; /* command line arguments */
int should run = 1; /* flag to determine when to exit program */
while (should run) {
printf("osh>");
fflush(stdout);
/**
* After reading user input, the steps are:
* (1) fork a child process using fork()
* (2) the child process will invoke execvp()
* (3) if command included &, parent will invoke wait()
*/
}
return 0;
}
Figure 3.36 Outline of simple shell.
Submission Instruction:
1. Replace osh> prompt illustrated in the textbook with comp322> prompt.
2. Run pwd command after comp322> prompt and take a screenshot.
3. Run ls -l command after comp322> prompt and take a screenshot.
4. Implement a print statement which shows this line after each run of your program. "Program run by userID at currentTime" (Refer to Programming Project 1 for how to retrieve userID and currentTime).
5. Substitute the file name with K200LoginName.c, compile and execute the shell (change the file name in your makefile if you decide to use make).
Upload .c file and the PDF file.
The .c file should be named as K200LoginName.c.
The PDF file comprising your screenshots needs to be named following this format, K200LoginName_YourLastName.pdf
Both files need to be submitted here in Moodle.
Submission failed to meet the submission requirement will not be graded. Grade may be forfeited.
Third evaluation concerns staff scheduling
: The third evaluation concerns staff scheduling. Some of the customers have complained that service is slow. The restaurant is open from 11:00 a.m. to midnight every day of the week. Tony divided the workday into five shifts.
|
How implement and communicate your brand positioning
: MKT10007 Fundamentals of Marketing. Summarize how your recommended Marketing Mix will implement and communicate your Brand Positioning
|
How to compete in individual country markets
: How to compete in individual country markets? The standardization of specific competitive marketing variables (attitudes, etc you introduced) across country markets (Liberia vs. USA).
|
Explain why you used either the cpi data or the gdpd data
: Explain why you used either the CPI data or the GDPD data - Draw a supply/demand diagram of the US Treasury bond market to illustrate the effects on it of the developments cited in part A.
|
How to design a c program to serve as a shell interface
: In this project, you will learn how to design a C program to serve as a shell interface that accepts user commands and then executes each command in a separate process
|
Minimum bid and expected value of the minimum bid
: A government agency is putting a large projector out for low bid. Bids are expected from 10 different contractors and will have a normal distribution with a mean of $3.5 mil and a standard deviation of $250,000. Devise and implement a sampling ex..
|
The management of brinkley corporation
: The management of Brinkley Corporation is interested in using simulation to estimate the profit per unit for a new product. Probability distributions for the purchase cost, the labor cost, and the transportation cost are as follows:
|
Government regulation and standardization
: Do you think that too many limitations and restrictions can be placed on parties in a contract? Should there be more government regulation and standardization of contract terms between private parties? Why or why not?
|
Evaluate the effectiveness of each protection method
: Include smartcards as one solution in your analysis, and evaluate whether or not smartcards alone are a proper security solution for protecting personal credentials. Based on your analysis, evaluate the effectiveness of each protection method and ..
|