summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorEric Andersen2001-02-14 21:46:30 +0000
committerEric Andersen2001-02-14 21:46:30 +0000
commit3ec8ffb121d69c9027afc8e6a64b649eba834730 (patch)
treeb46af8e1e7bcc057d3240490a6abc264c4ec82cd /utility.c
parent67991cf824f8df27e74c92d754fb507681c69ce6 (diff)
downloadbusybox-3ec8ffb121d69c9027afc8e6a64b649eba834730.zip
busybox-3ec8ffb121d69c9027afc8e6a64b649eba834730.tar.gz
I forgot to add usage.h, so here it is, with a few extra cleanups.
Also update show_usage to handle the updated usage.h. Again, nearly all the work to get usage.h into shape was done by Manuel Novoa III. -Erik
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/utility.c b/utility.c
index 818523c..89b601d 100644
--- a/utility.c
+++ b/utility.c
@@ -84,11 +84,17 @@ extern void show_usage(void)
static const char no_help[] = "No help available.\n";
const char *usage_string = no_help;
+ int i;
if (applet_using->usage_index >= 0) {
- usage_string = usage_messages[applet_using->usage_index];
+ usage_string = usage_messages;
+ for (i=applet_using->usage_index ; i>0 ; ) {
+ if (!*usage_string++) {
+ --i;
+ }
+ }
}
- fprintf(stderr, "%s\n\nUsage: %s %s\n", full_version,
+ fprintf(stderr, "%s\n\nUsage: %s %s\n\n", full_version,
applet_using->name, usage_string);
exit(EXIT_FAILURE);
}