summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1996-07-08 20:03:18 +0000
committerwosch <wosch@FreeBSD.org>1996-07-08 20:03:18 +0000
commit5bcd6f63c6d112f1023850c7556c52096067863e (patch)
treef1b8bfab2e35502777866d60fb83564c8180b3a6 /gnu
parentf94ea926ede24f1013ce045912c8dcf48b769000 (diff)
downloadFreeBSD-src-5bcd6f63c6d112f1023850c7556c52096067863e.zip
FreeBSD-src-5bcd6f63c6d112f1023850c7556c52096067863e.tar.gz
Exits 0 on success, and 1 if no keyword matched.
Start $PAGER only if we find a manual page.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/man/apropos/apropos.man5
-rw-r--r--gnu/usr.bin/man/apropos/apropos.sh22
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
+)
OpenPOWER on IntegriCloud