Show Bid Request
C programming
Bid Request Id: 48595
|
|
|
Posted by: |
tamireac (1 ratings)
(Software buyer rating 10)
|
Non-action Ratio: |
Above Average - 40.00%
|
Buyer Security Verifications: |
Good
|
Approved on: |
Feb 17, 2003 9:40:51 AM EDT
|
Bidding Closes: |
Feb 19, 2003 EDT
|
Viewed (by coders): |
77 times
|
Deadline: |
2/19/2003
TIME EXPIRED
|
|
|
|
Description:
Introduction: The exec system call overlays a new program into a process. The fork and exec combination is used very frequently in UNIX to spawn a new process and to overlay a new program. A common example is trying a shell command at a shell prompt. The shell forks a new process which starts with a shell image, then makes an exec call to overlay the shell image the shell command.
Complete the following skeleton C program for spawning a process and starting a new program.
/*This program reads a command line from the terminal and executes it*/
#include<stdio.h>
/*declare functionm protocols here*/
/*the main fuction is given as follows
main()
{
char*line [132];
char*command;
char**argv;
int pid;
while(1) {
if(gets(line)==0)exit(0);
if(strlen(line)==0)continue;
parse_command(line, command, &argv);
pid = start_command(command, argv);
if(pid>0)wait(0);
}
}
/*Your job is to complete two functions: parse_command, start_command, and child*/
/*1. write a function to parse command*/
void parse_command (char[] line,char*command, char**argv)
{
}
/*2. complete the start_command function*/
int start_command(char*command, char**argv)
{
int pid; /*return value of fork call
//Create child process
.......
if(pid==0){
/* invoke the child function here*/
}
else if (pid<0){
/*print out fork error message*/
}
return pid;
}
/*3. Complete child function*/
void child(char*command, char**argv){
int status;
/*status will store the return value of an execvp system call*/
/*EXEC new command in child process by invoking execvp system call*/
......
/*If exec was successful, this code will not be executed.*/
if(status<0){
/*print error message: a wrong command*/
}
exit(0);
}
Deliverables: 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bi request.
3) Complete ownership and distribution copyrights to all work purchased.
Platform:
C programming only
Must be 100% finished and received by buyer on:
Feb 19, 2003 EDT
Deadline legal notes: All times are expressed in the time zone of the site EDT (UT - 5). If the buyer omitted a time, then the deadline is 11:59:59 PM EDT on the indicated date.
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)
|
|