Show Bid Request
unix shell in C
Bid Request Id: 2923
|
|
|
Description:
Your program should prompt for input from its standard input. (Use the prompt "##" to avoid confusions.) Every line of input will represent a single command. It will consist of a sequence of arguments separated by an arbitrary number of spaces. The first of these arguments will either be the keyword background or the name of a program to be executed.
All other arguments are to be passed to that program according to the standard UNIX conventions. An error message should be returned every time that an inaccessible program file has been specified in the input line.
Your shell should be able to handle background processes and pipes:
· Background processes: Any process whose command line starts with the keyword background as in
background gcc bigprogram.c
should be executed in the background; that is, its standard input and standard output should be closed and the shell should not wait for its completion.
· Pipes: If a command line includes a “|“ then it will contain two commands: the output of the command before the “|” should become the input of the command after the “|” as in an UNIX pipe:
ls -alg | more who|wc -l grep = bigprogram.c |more
Your shell should handle internally three process control commands:
1. history n, which lists the last n executed commands: if your shell executed less than n commands, history should just prints these commands. Your list should have each line numbered starting with one as in:
1. ls -alg 2. date 3. who 4. …
2. repeat, which prints on the screen and executes the previous command,
3. exit, which kills all background processes your shell has forked and terminates it.
NOTES 1. With the exception of the pipe symbol (|) there is no need to treat the special characters and metacharacters of /bin/sh and /bin/csh in any special way.
2. Do not worry about signals.
3. You are required to use execvp().
4. Note that the pipe symbol will not be always surrounded by spaces.
HINTS 1. Before you start your assignment, familiarize yourself with the UNIX functions fork(), wait(). execvp(), dup(), exit(), _exit() and kill(). Use the man command for that purpose.
2. You will find that the command cd will not work properly (but the fix is very simple). Remember that UNIX functions normally return a zero value when they are successful
Deliverables: Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$50 (USD)
|
Sep 25, 2001 7:46:25 PM EDT
|
9.88
(Excellent)
|
|
|
I got your private message. I will get started immediately, just accept my bid so I can get it to you before sept 29th.
|
|
|
|
|
|