save avant suppression des jumps
This commit is contained in:
parent
6dfbc2f055
commit
13273c5d4f
26
minishell.c
26
minishell.c
|
@ -56,6 +56,11 @@ void handler_sigchld(int sig_num)
|
|||
printf("[%d] %d done: %s\n", job->id, job->pid, job->cmd);
|
||||
supprimer(&jobs, job->pid);
|
||||
}
|
||||
else if (wait_code == 9) // SIGKILL
|
||||
{
|
||||
printf("[%d] %d killed: %s\n", job->id, job->pid, job->cmd);
|
||||
supprimer(&jobs, job->pid);
|
||||
}
|
||||
|
||||
if (prompting)
|
||||
{
|
||||
|
@ -170,13 +175,14 @@ int main(int argc, char *argv[])
|
|||
cell *job;
|
||||
if (cmd->seq[0][1] == NULL)
|
||||
{ // no id
|
||||
fprintf(stderr, "ERROR: fg id error\n");
|
||||
fprintf(stderr, "ERROR: id missing\n");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ // id specified
|
||||
job = trouver_id(&jobs, atoi(cmd->seq[0][1]));
|
||||
}
|
||||
//if (job->state == 1) // créer state bidule
|
||||
kill(job->pid, SIGCONT);
|
||||
pause();
|
||||
continue;
|
||||
|
@ -186,7 +192,7 @@ int main(int argc, char *argv[])
|
|||
cell *job;
|
||||
if (cmd->seq[0][1] == NULL)
|
||||
{ // no id
|
||||
fprintf(stderr, "ERROR: fg id error\n");
|
||||
fprintf(stderr, "ERROR: id missing\n");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
@ -198,6 +204,22 @@ int main(int argc, char *argv[])
|
|||
attendre(job->pid);
|
||||
continue;
|
||||
}
|
||||
else if (!strcmp(cmd->seq[0][0], "stop"))
|
||||
{ // "stop"
|
||||
cell *job;
|
||||
if (cmd->seq[0][1] == NULL)
|
||||
{ // no id
|
||||
fprintf(stderr, "ERROR: id missing\n");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ // id specified
|
||||
job = trouver_id(&jobs, atoi(cmd->seq[0][1]));
|
||||
}
|
||||
kill(job->pid, SIGSTOP);
|
||||
pause();
|
||||
continue;
|
||||
}
|
||||
else if (!strcmp(cmd->seq[0][0], "pid"))
|
||||
{ // "pid"
|
||||
printf("pid=%d\n", getpid());
|
||||
|
|
Loading…
Reference in a new issue