Lines 773-783
handle_bad_signal(int sig)
Link Here
|
773 |
#endif |
773 |
#endif |
774 |
|
774 |
|
775 |
#include "_usage.h" |
775 |
#include "_usage.h" |
776 |
#define getoptstring "o:s:S" getoptstring_COMMON |
776 |
#define getoptstring "o:s:S:a" getoptstring_COMMON |
777 |
static const struct option longopts[] = { |
777 |
static const struct option longopts[] = { |
778 |
{ "override", 1, NULL, 'o' }, |
778 |
{ "override", 1, NULL, 'o' }, |
779 |
{ "service", 1, NULL, 's' }, |
779 |
{ "service", 1, NULL, 's' }, |
780 |
{ "sys", 0, NULL, 'S' }, |
780 |
{ "sys", 0, NULL, 'S' }, |
|
|
781 |
{ "applet", 1, NULL, 'a' }, |
781 |
longopts_COMMON |
782 |
longopts_COMMON |
782 |
}; |
783 |
}; |
783 |
static const char * const longopts_help[] = { |
784 |
static const char * const longopts_help[] = { |
Lines 785-790
static const char * const longopts_help[
Link Here
|
785 |
"when leaving single user or boot runlevels", |
786 |
"when leaving single user or boot runlevels", |
786 |
"runs the service specified with the rest\nof the arguments", |
787 |
"runs the service specified with the rest\nof the arguments", |
787 |
"output the RC system type, if any", |
788 |
"output the RC system type, if any", |
|
|
789 |
"runs the applet specified by the next argument", |
788 |
longopts_help_COMMON |
790 |
longopts_help_COMMON |
789 |
}; |
791 |
}; |
790 |
#include "_usage.c" |
792 |
#include "_usage.c" |
Lines 835-841
main(int argc, char **argv)
Link Here
|
835 |
} |
837 |
} |
836 |
|
838 |
|
837 |
/* Run our built in applets. If we ran one, we don't return. */ |
839 |
/* Run our built in applets. If we ran one, we don't return. */ |
838 |
run_applets(argc, argv); |
840 |
{ |
|
|
841 |
//make these local vars |
842 |
int localargc = argc; |
843 |
char **localargv = argv; |
844 |
if(-1 != (opt = getopt_long(argc, argv, getoptstring, longopts, |
845 |
(int *)0))) { |
846 |
if(opt == 'a' && argc >= 3) { |
847 |
//pass modified argc,argv, because the applets |
848 |
//expect their arguments starting at argv[1] |
849 |
localargv = argv + 2; |
850 |
localargc = argc - 2; |
851 |
applet = argv[2]; |
852 |
} |
853 |
} |
854 |
|
855 |
optind = 0; //reset getopt_long |
856 |
run_applets(localargc, localargv); |
857 |
} |
839 |
|
858 |
|
840 |
argc--; |
859 |
argc--; |
841 |
argv++; |
860 |
argv++; |
Lines 890-897
main(int argc, char **argv)
Link Here
|
890 |
} |
909 |
} |
891 |
exit(EXIT_SUCCESS); |
910 |
exit(EXIT_SUCCESS); |
892 |
/* NOTREACHED */ |
911 |
/* NOTREACHED */ |
893 |
case_RC_COMMON_GETOPT |
912 |
case 'a': |
894 |
} |
913 |
/* Do nothing, actual logic in run_applets, this |
|
|
914 |
is a placeholder */ |
915 |
case_RC_COMMON_GETOPT |
916 |
} |
895 |
} |
917 |
} |
896 |
|
918 |
|
897 |
newlevel = argv[optind++]; |
919 |
newlevel = argv[optind++]; |