X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FForkTest.c;h=edec00ef1612cf68f1c5346856318969b52d116a;hp=5401e319be20b79d721225d8bd340cafbe060f62;hb=2e096eb5d1df57ce4b887630bdc81526c455b45b;hpb=35a74444a2fac699a43daefd96369aa984f91870 diff --git a/sources/ForkTest.c b/sources/ForkTest.c index 5401e31..edec00e 100644 --- a/sources/ForkTest.c +++ b/sources/ForkTest.c @@ -26,7 +26,7 @@ * * Usage: forktest -h give all info's * - * $Id: ForkTest.c,v 1.5 2001/09/19 17:10:49 piccardi Exp $ + * $Id: ForkTest.c,v 1.8 2002/12/03 11:06:05 piccardi Exp $ * ****************************************************************/ /* @@ -38,6 +38,9 @@ #include /* standard I/O library */ #include /* string functions */ +#include "Gapil.h" +#include "macros.h" + /* Help printing routine */ void usage(void); @@ -56,7 +59,7 @@ int main(int argc, char *argv[]) * Use getopt function */ opterr = 0; /* don't want writing to stderr */ - while ( (i = getopt(argc, argv, "hp:c:e:")) != -1) { + while ( (i = getopt(argc, argv, "hsp:c:e:")) != -1) { switch (i) { /* * Handling options @@ -75,6 +78,9 @@ int main(int argc, char *argv[]) case 'e': /* take wait before parent exit */ wait_end = strtol(optarg, NULL, 10); /* convert input */ break; + case 's': + Signal(SIGCHLD, HandSigCHLD); + break; case '?': /* unrecognized options */ printf("Unrecognized options -%c\n",optopt); usage(); @@ -94,7 +100,7 @@ int main(int argc, char *argv[]) usage(); } nchild = atoi(argv[optind]); - printf("Test for forking %d child\n", nchild); + printf("Process %d: forking %d child\n", getpid(), nchild); /* loop to fork children */ for (i=0; i