*
* 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.10 2003/05/02 09:55:13 piccardi Exp $
*
****************************************************************/
/*
#include <stdio.h> /* standard I/O library */
#include <string.h> /* string functions */
+#include "Gapil.h"
+#include "macros.h"
+
/* Help printing routine */
void usage(void);
* 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
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();
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");