Completate le aggiunte della GPL per i programmi
[gapil.git] / sources / ForkTest.c
index da38629b41892b6be703821222303d4da4073576..09035d5a66b1583d05a41c166c1ae8754864f74f 100644 (file)
@@ -1,3 +1,21 @@
+/* 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: 
@@ -8,7 +26,7 @@
  *
  * Usage: forktest -h give all info's
  *
- * $Id: ForkTest.c,v 1.1 2001/09/09 17:39:15 piccardi Exp $
+ * $Id: ForkTest.c,v 1.2 2001/09/09 22:45:34 piccardi Exp $
  *
  ****************************************************************/
 /* 
@@ -69,15 +87,15 @@ int main(int argc, char *argv[])
     /* loop to fork children */
     for (i=0; i<nchild; i++) {
        if ( (pid = fork()) < 0) {
-           printf("Error on %d child creation, %s\n", i, strerror(errno));
+           printf("Error on %d child creation, %s\n", i+1, strerror(errno));
        }
        if (pid == 0) {   /* child */
-           printf("Child %d successfully executing\n", i++);
+           printf("Child %d successfully executing\n", ++i);
            sleep(2);
            printf("Child %d exiting\n", i);
            exit(0);
        } else {          /* parent */
-           printf("Spawned %d child, pid %d \n", i, pid);
+           printf("Spawned %d child, pid %d \n", i+1, pid);
        }
     }
     /* normal exit */