X-Git-Url: https://gapil.gnulinux.it/gitweb/?a=blobdiff_plain;f=sources%2FForkTest.c;fp=sources%2FForkTest.c;h=0000000000000000000000000000000000000000;hb=4aa6c51696d2b11c572eccd37238db1691785573;hp=1965ec8f4fd232420869bff4297d95fd3fcbbdac;hpb=fd4e2fd24a218ef56953fd5a58d0b3c0bee8acb7;p=gapil.git diff --git a/sources/ForkTest.c b/sources/ForkTest.c deleted file mode 100644 index 1965ec8..0000000 --- a/sources/ForkTest.c +++ /dev/null @@ -1,138 +0,0 @@ -/* ForkTest.c - * - * Copyright (C) 2001 Simone Piccardi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/**************************************************************** - * - * Program ForkTest.c: - * Program to test process creation - * - * Author: Simone Piccardi - * Sep. 2001 - * - * Usage: forktest -h give all info's - * - ****************************************************************/ -/* - * Include needed headers - */ -#include /* error definitions and routines */ -#include /* C standard library */ -#include /* unix standard library */ -#include /* standard I/O library */ -#include /* C strings library */ - -#include "Gapil.h" -#include "macros.h" - -/* Help printing routine */ -void usage(void); - -int main(int argc, char *argv[]) -{ -/* - * Variables definition - */ - int nchild, i; - pid_t pid; - int wait_child = 0; - int wait_parent = 0; - int wait_end = 0; - /* - * Input section: decode command line parameters - * Use getopt function - */ - opterr = 0; /* don't want writing to stderr */ - while ( (i = getopt(argc, argv, "hsp:c:e:")) != -1) { - switch (i) { - /* - * Handling options - */ - case 'h': /* help option */ - printf("Wrong -h option use\n"); - usage(); - return -1; - break; - case 'c': /* take wait time for childen */ - wait_child = strtol(optarg, NULL, 10); /* convert input */ - break; - case 'p': /* take wait time for childen */ - wait_parent = strtol(optarg, NULL, 10); /* convert input */ - break; - 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(); - default: /* should not reached */ - usage(); - } - } - /* *********************************************************** - * - * Options processing completed - * - * Main code beginning - * - * ***********************************************************/ - /* There must be remaing parameters */ - if (optind == argc) { - usage(); - } - nchild = atoi(argv[optind]); - printf("Process %d: forking %d child\n", getpid(), nchild); - /* loop to fork children */ - for (i=0; i