diff options
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -54,7 +54,6 @@ | |||
54 | #define bb_need_full_version | 54 | #define bb_need_full_version |
55 | #define BB_DECLARE_EXTERN | 55 | #define BB_DECLARE_EXTERN |
56 | #include "messages.c" | 56 | #include "messages.c" |
57 | #include "usage.h" | ||
58 | 57 | ||
59 | #include "pwd_grp/pwd.h" | 58 | #include "pwd_grp/pwd.h" |
60 | #include "pwd_grp/grp.h" | 59 | #include "pwd_grp/grp.h" |
@@ -81,21 +80,20 @@ static struct BB_applet *applet_using; | |||
81 | 80 | ||
82 | extern void show_usage(void) | 81 | extern void show_usage(void) |
83 | { | 82 | { |
84 | static const char no_help[] = "No help available.\n"; | 83 | const char *format_string; |
85 | 84 | const char *usage_string = usage_messages; | |
86 | const char *usage_string = no_help; | ||
87 | int i; | 85 | int i; |
88 | 86 | ||
89 | if (applet_using->usage_index >= 0) { | 87 | for (i = applet_using - applets; i > 0; ) { |
90 | usage_string = usage_messages; | 88 | if (!*usage_string++) { |
91 | for (i=applet_using->usage_index ; i>0 ; ) { | 89 | --i; |
92 | if (!*usage_string++) { | ||
93 | --i; | ||
94 | } | ||
95 | } | 90 | } |
96 | } | 91 | } |
97 | fprintf(stderr, "%s\n\nUsage: %s %s\n\n", full_version, | 92 | format_string = "%s\n\nUsage: %s %s\n\n"; |
98 | applet_using->name, usage_string); | 93 | if(*usage_string == 0) |
94 | format_string = "%s\n\nNo help available.\n\n"; | ||
95 | fprintf(stderr, format_string, | ||
96 | full_version, applet_using->name, usage_string); | ||
99 | exit(EXIT_FAILURE); | 97 | exit(EXIT_FAILURE); |
100 | } | 98 | } |
101 | 99 | ||