summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorEric Andersen2001-02-22 01:15:47 +0000
committerEric Andersen2001-02-22 01:15:47 +0000
commit7e9276b50a7aa948b2b4fe093e4049bbece4699c (patch)
treed20a5e4a07ec079ffd40ee587b12a0b65fdf2eb4 /utility.c
parent8fc300976f5a06d98f8be3e1798b5bc8da868e02 (diff)
downloadbusybox-7e9276b50a7aa948b2b4fe093e4049bbece4699c.zip
busybox-7e9276b50a7aa948b2b4fe093e4049bbece4699c.tar.gz
Another update to the way usage messages are done by Evin Robertson
<nitfol@my-deja.com>, which makes things just a little bit smaller, but makes usage.h more readable/maintainable IMHO. -Erik
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/utility.c b/utility.c
index cf0aecc..f96cab5 100644
--- a/utility.c
+++ b/utility.c
@@ -54,7 +54,6 @@
#define bb_need_full_version
#define BB_DECLARE_EXTERN
#include "messages.c"
-#include "usage.h"
#include "pwd_grp/pwd.h"
#include "pwd_grp/grp.h"
@@ -81,21 +80,20 @@ static struct BB_applet *applet_using;
extern void show_usage(void)
{
- static const char no_help[] = "No help available.\n";
-
- const char *usage_string = no_help;
+ const char *format_string;
+ const char *usage_string = usage_messages;
int i;
- if (applet_using->usage_index >= 0) {
- usage_string = usage_messages;
- for (i=applet_using->usage_index ; i>0 ; ) {
- if (!*usage_string++) {
- --i;
- }
+ for (i = applet_using - applets; i > 0; ) {
+ if (!*usage_string++) {
+ --i;
}
}
- fprintf(stderr, "%s\n\nUsage: %s %s\n\n", full_version,
- applet_using->name, usage_string);
+ format_string = "%s\n\nUsage: %s %s\n\n";
+ if(*usage_string == 0)
+ format_string = "%s\n\nNo help available.\n\n";
+ fprintf(stderr, format_string,
+ full_version, applet_using->name, usage_string);
exit(EXIT_FAILURE);
}