diff options
author | Rob Landley <rob@landley.net> | 2020-01-03 03:10:17 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-01-03 03:10:17 -0600 |
commit | a2cd46a5f342553c05ae6ef4e7a73069df0e1be1 (patch) | |
tree | 55c7f84b31d94aa578616a04ec92480ced1553f3 /lib/help.c | |
parent | 53090cd6c1343954d953625223b50e73abb6b9f3 (diff) | |
download | toybox-a2cd46a5f342553c05ae6ef4e7a73069df0e1be1.tar.gz |
Add MAYFORK to "help", teach it to behave differently when called as a
builtin, and add -u.
Diffstat (limited to 'lib/help.c')
-rw-r--r-- | lib/help.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -16,10 +16,10 @@ static char *help_data = #include "generated/newtoys.h" ; -void show_help(FILE *out) +void show_help(FILE *out, int full) { int i = toys.which-toy_list; - char *s; + char *s, *ss; if (CFG_TOYBOX_HELP) { for (;;) { @@ -30,6 +30,11 @@ void show_help(FILE *out) i = toy_find(++s)-toy_list; } - fprintf(out, "%s\n", s); + if (full) fprintf(out, "%s\n", s); + else { + strstart(&s, "usage: "); + for (ss = s; *ss && *ss!='\n'; ss++); + fprintf(out, "%.*s\n", (int)(ss-s), s); + } } } |