/[baselayout]/trunk/src/runscript.c
Gentoo

Diff of /trunk/src/runscript.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2582 Revision 2618
3 * Handle launching of Gentoo init scripts. 3 * Handle launching of Gentoo init scripts.
4 * 4 *
5 * Copyright 1999-2007 Gentoo Foundation 5 * Copyright 1999-2007 Gentoo Foundation
6 * Distributed under the terms of the GNU General Public License v2 6 * Distributed under the terms of the GNU General Public License v2
7 */ 7 */
8
9#define APPLET "runscript"
8 10
9#include <sys/types.h> 11#include <sys/types.h>
10#include <sys/signal.h> 12#include <sys/signal.h>
11#include <sys/stat.h> 13#include <sys/stat.h>
12#include <sys/wait.h> 14#include <sys/wait.h>
806 } 808 }
807 } 809 }
808 } 810 }
809} 811}
810 812
813#define getoptstring "dCDNqvh"
814static struct option longopts[] = {
815 { "debug", 0, NULL, 'd'},
816 { "nocolor", 0, NULL, 'C'},
817 { "nocolour", 0, NULL, 'C'},
818 { "nodeps", 0, NULL, 'D'},
819 { "quiet", 0, NULL, 'q'},
820 { "verbose", 0, NULL, 'v'},
821 { "help", 0, NULL, 'h'},
822 { NULL, 0, NULL, 0}
823};
824#include "_usage.c"
825
811int main (int argc, char **argv) 826int main (int argc, char **argv)
812{ 827{
813 const char *service = argv[1]; 828 const char *service = argv[1];
814 int i; 829 int i;
815 bool deps = true; 830 bool deps = true;
816 bool doneone = false; 831 bool doneone = false;
817 char pid[16]; 832 char pid[16];
818 int retval; 833 int retval;
819 char c; 834 char c;
820
821 static struct option longopts[] = {
822 { "debug", 0, NULL, 'd'},
823 { "help", 0, NULL, 'h'},
824 { "nocolor", 0, NULL, 'C'},
825 { "nocolour", 0, NULL, 'C'},
826 { "nodeps", 0, NULL, 'D'},
827 { "quiet", 0, NULL, 'q'},
828 { "verbose", 0, NULL, 'v'},
829 { NULL, 0, NULL, 0}
830 };
831 835
832 /* Show help if insufficient args */ 836 /* Show help if insufficient args */
833 if (argc < 3) { 837 if (argc < 3) {
834 execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL); 838 execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL);
835 eerrorx ("%s: failed to exec `" RCSCRIPT_HELP "': %s", 839 eerrorx ("%s: failed to exec `" RCSCRIPT_HELP "': %s",
920 /* Punt the first arg as it's our service name */ 924 /* Punt the first arg as it's our service name */
921 argc--; 925 argc--;
922 argv++; 926 argv++;
923 927
924 /* Right then, parse any options there may be */ 928 /* Right then, parse any options there may be */
925 while ((c = getopt_long (argc, argv, "dhCDNqv", 929 while ((c = getopt_long (argc, argv, getoptstring,
926 longopts, (int *) 0)) != -1) 930 longopts, (int *) 0)) != -1)
927 switch (c) { 931 switch (c) {
928 case 'd': 932 case 'd':
929 setenv ("RC_DEBUG", "yes", 1); 933 setenv ("RC_DEBUG", "yes", 1);
930 break; 934 break;

Legend:
Removed from v.2582  
changed lines
  Added in v.2618

  ViewVC Help
Powered by ViewVC 1.1.20