479 |
|
|
480 |
mygroup=0; |
mygroup=0; |
481 |
|
|
482 |
while((opt= getopt(argc,argv,"c:l:d:g:iIvVh")) != -1) { |
while((opt= getopt(argc,argv,"c:d:g:l:iIvVh")) != -1) { |
483 |
|
|
484 |
switch(opt) { |
switch(opt) { |
485 |
|
|
|
case 'i': |
|
|
Run.validate= TRUE; |
|
|
break; |
|
|
|
|
|
case 'I': |
|
|
Run.Init= TRUE; |
|
|
break; |
|
|
|
|
486 |
case 'c': |
case 'c': |
487 |
Run.controlfile= xstrdup(optarg); |
Run.controlfile= xstrdup(optarg); |
488 |
break; |
break; |
489 |
|
|
|
case 'l': |
|
|
Run.logfile= xstrdup(optarg); |
|
|
if ( is(Run.logfile, "syslog") ) |
|
|
Run.use_syslog= TRUE; |
|
|
Run.dolog= TRUE; |
|
|
break; |
|
|
|
|
|
case 'g': |
|
|
mygroup= xstrdup(optarg); |
|
|
break; |
|
|
|
|
490 |
case 'd': |
case 'd': |
491 |
Run.isdaemon= TRUE; |
Run.isdaemon= TRUE; |
492 |
sscanf(optarg, "%d", &Run.polltime); |
sscanf(optarg, "%d", &Run.polltime); |
496 |
} |
} |
497 |
break; |
break; |
498 |
|
|
499 |
|
case 'g': |
500 |
|
mygroup= xstrdup(optarg); |
501 |
|
break; |
502 |
|
|
503 |
|
case 'l': |
504 |
|
Run.logfile= xstrdup(optarg); |
505 |
|
if ( is(Run.logfile, "syslog") ) |
506 |
|
Run.use_syslog= TRUE; |
507 |
|
Run.dolog= TRUE; |
508 |
|
break; |
509 |
|
|
510 |
|
case 'i': |
511 |
|
Run.validate= TRUE; |
512 |
|
break; |
513 |
|
|
514 |
|
case 'I': |
515 |
|
Run.Init= TRUE; |
516 |
|
break; |
517 |
|
|
518 |
case 'v': |
case 'v': |
519 |
Run.debug= TRUE; |
Run.debug= TRUE; |
520 |
break; |
break; |
533 |
switch ( optopt ) { |
switch ( optopt ) { |
534 |
|
|
535 |
case 'c': |
case 'c': |
536 |
|
case 'd': |
537 |
case 'g': |
case 'g': |
538 |
case 'l': |
case 'l': |
|
case 'd': |
|
539 |
error("%s: option -- %c requires an argument\n", prog, optopt); |
error("%s: option -- %c requires an argument\n", prog, optopt); |
540 |
break; |
break; |
541 |
default: |
default: |
560 |
|
|
561 |
printf("Usage: %s [options] {arguments}\n", prog); |
printf("Usage: %s [options] {arguments}\n", prog); |
562 |
printf("Options are as follows:\n"); |
printf("Options are as follows:\n"); |
563 |
printf(" -c file, Use this control file\n"); |
printf(" -c file Use this control file\n"); |
564 |
printf(" -l logfile, Print log information to this file\n"); |
printf(" -d n Run as a daemon once per n seconds\n"); |
565 |
printf(" -d n, run as a daemon once per n seconds\n"); |
printf(" -g name Set group name for start, stop, restart and status\n"); |
566 |
printf(" -i, Validate mode, startup in validate mode\n"); |
printf(" -l logfile Print log information to this file\n"); |
567 |
printf(" -I, Init mode, run from init\n"); |
printf(" -i Validate mode, startup in validate mode\n"); |
568 |
printf(" -v Verbose mode, work noisy (diagnostic output)\n"); |
printf(" -I Init mode, run from init\n"); |
569 |
printf(" -V Print version number and patchlevel\n"); |
printf(" -v Verbose mode, work noisy (diagnostic output)\n"); |
570 |
printf(" -g Set group name for start, stop, restart and status\n"); |
printf(" -V Print version number and patchlevel\n"); |
571 |
printf(" -h Print this text\n"); |
printf(" -h Print this text\n"); |
572 |
printf("Optional action arguments for non-daemon mode are as follows:\n"); |
printf("Optional action arguments for non-daemon mode are as follows:\n"); |
573 |
printf(" start - Start all programs listed in the control file\n"); |
printf(" start - Start all programs listed in the control file\n"); |
574 |
printf(" start name - Only start the named program in the control file\n"); |
printf(" start name - Only start the named program in the control file\n"); |