Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by Tania ( 16 years ago )
void execute(struct cmd *mycmd) //выполнение
{
if (!strcmp(mycmd->args[0],"cd")) cd(mycmd->args);
else execvp(mycmd->args[0],mycmd->args);
}
int main()
{
struct cmd *mycmd;
int status;
for (;;)
{
signal(SIGINT,SIG_DFL);
printf("%s",NEWINPUT);
mycmd=get_command();
if (mycmd==NULL) { printf("%s",errmes); continue;}
if (mycmd->bckgrnd) signal(SIGINT,SIG_IGN);
if (fork()==0) { //child
execute(mycmd);
}
else { //parent
wait(&status;);
if (mycmd->bckgrnd) if (WIFEXITED(status)) printf("Команда, выполнявшаяся в фоновом режиме, завершена с кодом %dn",WEXITSTATUS(status));
}
}
return 0;
}
Revise this Paste
Children: 26220