aboutsummaryrefslogtreecommitdiff
path: root/src/runscript.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-04-17 12:44:32 +0000
committerMike Frysinger <vapier@gentoo.org>2007-04-17 12:44:32 +0000
commit9d50d4cb258ad0e63ca85467817bccf9765d8326 (patch)
tree437f66d62899212562a74879c52bfd842bacfe2b /src/runscript.c
parentf5e65274f0f150d6db9f53f87e87eb6d984f8e94 (diff)
start unifying help handling
Diffstat (limited to 'src/runscript.c')
-rw-r--r--src/runscript.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/runscript.c b/src/runscript.c
index 98b26889..6f372270 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -6,6 +6,8 @@
* Distributed under the terms of the GNU General Public License v2
*/
+#define APPLET "runscript"
+
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/stat.h>
@@ -808,6 +810,19 @@ static void svc_restart (const char *service, bool deps)
}
}
+#define getoptstring "dCDNqvh"
+static struct option longopts[] = {
+ { "debug", 0, NULL, 'd'},
+ { "nocolor", 0, NULL, 'C'},
+ { "nocolour", 0, NULL, 'C'},
+ { "nodeps", 0, NULL, 'D'},
+ { "quiet", 0, NULL, 'q'},
+ { "verbose", 0, NULL, 'v'},
+ { "help", 0, NULL, 'h'},
+ { NULL, 0, NULL, 0}
+};
+#include "_usage.c"
+
int main (int argc, char **argv)
{
const char *service = argv[1];
@@ -818,17 +833,6 @@ int main (int argc, char **argv)
int retval;
char c;
- static struct option longopts[] = {
- { "debug", 0, NULL, 'd'},
- { "help", 0, NULL, 'h'},
- { "nocolor", 0, NULL, 'C'},
- { "nocolour", 0, NULL, 'C'},
- { "nodeps", 0, NULL, 'D'},
- { "quiet", 0, NULL, 'q'},
- { "verbose", 0, NULL, 'v'},
- { NULL, 0, NULL, 0}
- };
-
/* Show help if insufficient args */
if (argc < 3) {
execl (RCSCRIPT_HELP, RCSCRIPT_HELP, service, (char *) NULL);
@@ -922,7 +926,7 @@ int main (int argc, char **argv)
argv++;
/* Right then, parse any options there may be */
- while ((c = getopt_long (argc, argv, "dhCDNqv",
+ while ((c = getopt_long (argc, argv, getoptstring,
longopts, (int *) 0)) != -1)
switch (c) {
case 'd':