Browse Source

Fin TP13 exercice 3

master
Elias Leinenweber 3 months ago
parent
commit
36a995ee61
  1. 10
      TP13/TP13_ign_all.c

10
TP13/TP13_ign_all.c

@ -4,6 +4,8 @@
#include <stdlib.h>
#include <unistd.h>
void on_signal_reception(int);
int
main(int argc, char *argv[])
{
@ -13,7 +15,7 @@ main(int argc, char *argv[])
sleep(3);
for (Nb_Sig = 1; Nb_Sig < NSIG; ++Nb_Sig)
if (signal(Nb_Sig, SIG_IGN) == SIG_ERR)
if (signal(Nb_Sig, on_signal_reception) == SIG_ERR)
warn("signal: %d", Nb_Sig);
while(1)
@ -21,3 +23,9 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
void
on_signal_reception(int sig_number)
{
printf("Here we go, signal %d received!\n", sig_number);
}

Loading…
Cancel
Save