Aggiunte i listati per poter usare le modifiche di Mirko, con la generazione
[gapil.git] / listati / option_code.c
1     opterr = 0;  /* don't want writing to stderr */
2     while ( (i = getopt(argc, argv, "hp:c:e:")) != -1) {
3         switch (i) {
4         /* 
5          * Handling options 
6          */ 
7         case 'h':   /* help option */
8             printf("Wrong -h option use\n");
9             usage();
10             return -1;
11             break;
12         case 'c':   /* take wait time for children */
13             wait_child = strtol(optarg, NULL, 10);    /* convert input */
14             break;
15         case 'p':   /* take wait time for children */
16             wait_parent = strtol(optarg, NULL, 10);   /* convert input */
17             break;
18         case 'e':   /* take wait before parent exit */
19             wait_end = strtol(optarg, NULL, 10);      /* convert input */
20             break;
21         case '?':   /* unrecognized options */
22             printf("Unrecognized options -%c\n",optopt);
23             usage();
24         default:    /* should not reached */
25             usage();
26         }
27     }
28     debug("Optind %d, argc %d\n",optind,argc);