svn commit: trunk/busybox/miscutils

vda at busybox.net vda at busybox.net
Fri Jun 27 22:05:21 UTC 2008


Author: vda
Date: 2008-06-27 15:05:21 -0700 (Fri, 27 Jun 2008)
New Revision: 22541

Log:
man: mimic "no manual entry for 'bogus'" message and exitcode



Modified:
   trunk/busybox/miscutils/man.c


Changeset:
Modified: trunk/busybox/miscutils/man.c
===================================================================
--- trunk/busybox/miscutils/man.c	2008-06-27 21:52:41 UTC (rev 22540)
+++ trunk/busybox/miscutils/man.c	2008-06-27 22:05:21 UTC (rev 22541)
@@ -10,7 +10,7 @@
 	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 @@
 	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 @@
 		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 @@
 								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 @@
 					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;
 }




More information about the busybox-cvs mailing list