04-07-2005
1,
0
Join Date: Apr 2005
Last Activity: 23 September 2007, 1:24 PM EDT
Posts: 1
Thanks Given: 0
Thanked 0 Times in 0 Posts
helpp!
hello
i am new at the UNIX programin thing
and i have this assignment, which would look so easy for many of u
the shell must do the followin thing:
exec parameter < input > output
and another 1
exec parameter < input | exec2 parameter > output
the teacher started it wiz the followin codin:
int main(int argc,char **argv){
pid_t pid; int status,nc;
char *buf; char **args;
buf=(char *)malloc(1024);
while (1){
printf("myShell$");fflush(stdout);
nc=read(0,buf,1024); args=parse(buf);
buf[nc-1]=0;pid=fork();
if(pid==0){
execvp(args[0],args);
printf("execvp failed\n");
}
else {
wait(&status);free(args);
}}}
can any one plzz help me to continue it?
usin simple codin,plz