X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FForkTest.c;h=a4f0296848ec65564e30bad20005fa5337c5d8df;hp=03ddf75eadfe4c37ab7536cbe7d4e0401a0fcc1b;hb=6c8d59152cff88b5835eeb749445148bb3546a5b;hpb=7463fc5258c5afb139286c2509f5161bc0d76290 diff --git a/sources/ForkTest.c b/sources/ForkTest.c index 03ddf75..a4f0296 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.6 2001/09/21 17:10:51 piccardi Exp $ + * $Id: ForkTest.c,v 1.7 2002/08/18 23:24:44 piccardi Exp $ * ****************************************************************/ /* @@ -38,6 +38,9 @@ #include /* standard I/O library */ #include /* string functions */ +#include "wrappers.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(); @@ -125,6 +131,7 @@ void usage(void) { printf("Usage:\n"); printf(" forktest [-h] [-p sec] [-c sec] [-e sec] child to fork \n"); printf(" -h print this help\n"); + printf(" -s install signal handler\n"); printf(" -p sec wait sec seconds before next fork\n"); printf(" -c sec wait sec seconds before child termination\n"); printf(" -e sec wait sec seconds before parent return\n");