diff options
author | Denis Vlasenko | 2008-06-27 22:05:21 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-06-27 22:05:21 +0000 |
commit | ce02b157beff1a8031595364c2fb654034e608b5 (patch) | |
tree | 1f989f643708cf37a4e86f3b02ceaa3c7be29bc3 /miscutils/man.c | |
parent | 55da0be405bf4246ceb644b17b91d2686a9f1399 (diff) | |
download | busybox-ce02b157beff1a8031595364c2fb654034e608b5.zip busybox-ce02b157beff1a8031595364c2fb654034e608b5.tar.gz |
man: mimic "no manual entry for 'bogus'" message and exitcode
Diffstat (limited to 'miscutils/man.c')
-rw-r--r-- | miscutils/man.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/miscutils/man.c b/miscutils/man.c index 278e5a3..0203106 100644 --- a/miscutils/man.c +++ b/miscutils/man.c @@ -10,7 +10,7 @@ enum { OPT_w = 2, /* print path */ }; -/* This is what I see on my desktop system deing executed: +/* This is what I see on my desktop system being executed: ( echo ".ll 12.4i" @@ -74,7 +74,7 @@ int man_main(int argc ATTRIBUTE_UNUSED, char **argv) char *cur_path, *cur_sect; char *line, *value; int count_mp, alloc_mp, cur_mp; - int opt; + int opt, not_found; opt_complementary = "-1"; /* at least one argument */ opt = getopt32(argv, "+aw"); @@ -123,7 +123,9 @@ int man_main(int argc ATTRIBUTE_UNUSED, char **argv) fclose(cf); } + not_found = 0; do { /* for each argv[] */ + int found = 0; cur_mp = 0; while ((cur_path = man_path_list[cur_mp++]) != NULL) { /* for each MANPATH */ @@ -140,7 +142,7 @@ int man_main(int argc ATTRIBUTE_UNUSED, char **argv) sect_len, cur_sect, *argv, sect_len, cur_sect); - int found = show_manpage(pager, man_filename); + found |= show_manpage(pager, man_filename); free(man_filename); if (found && !(opt & OPT_a)) goto next_arg; @@ -153,9 +155,13 @@ int man_main(int argc ATTRIBUTE_UNUSED, char **argv) cur_path++; } while (*cur_path); } + if (!found) { + bb_error_msg("no manual entry for '%s'", *argv); + not_found = 1; + } next_arg: argv++; } while (*argv); - return EXIT_SUCCESS; + return not_found; } |