aboutsummaryrefslogtreecommitdiff
path: root/src/rc-status.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/rc-status.c
parentf5e65274f0f150d6db9f53f87e87eb6d984f8e94 (diff)
start unifying help handling
Diffstat (limited to 'src/rc-status.c')
-rw-r--r--src/rc-status.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/rc-status.c b/src/rc-status.c
index 2cf4ed0c..bf472c1d 100644
--- a/src/rc-status.c
+++ b/src/rc-status.c
@@ -5,6 +5,8 @@
Released under the GPLv2
*/
+#define APPLET "rc-status"
+
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
@@ -51,9 +53,20 @@ static void print_service (char *service)
ebracket (cols, color, status);
}
+#define getoptstring "alsuh"
+const struct option longopts[] = {
+ {"all", 0, NULL, 'a'},
+ {"list", 0, NULL, 'l'},
+ {"servicelist", 0, NULL, 's'},
+ {"unused", 0, NULL, 'u'},
+ {"help", 0, NULL, 'h'},
+ {NULL, 0, NULL, 0}
+};
+#include "_usage.c"
+
int main (int argc, char **argv)
{
- char **levels = NULL;
+ char **levels = NULL;
char **services = NULL;
char *level;
char *service;
@@ -62,15 +75,7 @@ int main (int argc, char **argv)
int i;
int j;
- const struct option longopts[] = {
- {"all", 0, NULL, 'a'},
- {"list", 0, NULL, 'l'},
- {"servicelist", 0, NULL, 's'},
- {"unused", 0, NULL, 'u'},
- {NULL, 0, NULL, 0}
- };
-
- while ((c = getopt_long(argc, argv, "alsu", longopts, &option_index)) != -1)
+ while ((c = getopt_long(argc, argv, getoptstring, longopts, &option_index)) != -1)
switch (c) {
case 'a':
levels = rc_get_runlevels ();
@@ -103,10 +108,8 @@ int main (int argc, char **argv)
rc_strlist_free (levels);
rc_strlist_free (services);
exit (EXIT_SUCCESS);
- case '?':
- exit (EXIT_FAILURE);
- default:
- exit (EXIT_FAILURE);
+
+ case_RC_COMMON_GETOPT
}
while (optind < argc)