diff options
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/man/apropos/apropos.man | 5 | ||||
-rw-r--r-- | gnu/usr.bin/man/apropos/apropos.sh | 22 |
2 files changed, 24 insertions, 3 deletions
diff --git a/gnu/usr.bin/man/apropos/apropos.man b/gnu/usr.bin/man/apropos/apropos.man index 62b7d7a..9fa779b 100644 --- a/gnu/usr.bin/man/apropos/apropos.man +++ b/gnu/usr.bin/man/apropos/apropos.man @@ -28,6 +28,9 @@ searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output. .B whatis -display only complete word matches. +display only complete word matches. +The +.B apropos +utility exits 0 on success, and 1 if no keyword matched. .SH "SEE ALSO" man(1), makewhatis(1). diff --git a/gnu/usr.bin/man/apropos/apropos.sh b/gnu/usr.bin/man/apropos/apropos.sh index cb26c20..66763dd 100644 --- a/gnu/usr.bin/man/apropos/apropos.sh +++ b/gnu/usr.bin/man/apropos/apropos.sh @@ -16,7 +16,7 @@ # # rewritten by Wolfram Schneider, Berlin, Feb 1996 # -# $Id: $ +# $Id: apropos.sh,v 1.3 1996/03/10 18:52:09 wosch Exp $ PATH=/bin:/usr/bin:$PATH @@ -72,5 +72,23 @@ do else echo "$manpage: nothing appropriate" fi -done | $PAGER +done | +( # start $PAGER only if we find a manual page + while read line + do + case $line in + *": nothing appropriate") line2="$line2$line\n";; + *) break;; + esac + done + + # nothing found, exit + if test -z "$line" -a ! -z "$line2"; then + case X"$line2" in X);; *) printf "$line2";; esac + exit 1 + else + ( case X"$line2" in X);; *) printf "$line2";; esac + echo $line; cat ) | $PAGER + fi +) |