Репозитории ALT
5.1: | 1.6f-alt11 |
4.1: | 1.6f-alt1 |
4.0: | 1.5m2-alt4 |
+backports: | 1.6f-alt5.M40.1 |
3.0: | 1.5m2-alt3 |
Группа :: Система/Основа
Пакет: man
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: man-1.5m2-alt-apropos.patch
Скачать
Скачать
--- man-1.5m2/src/apropos.sh.vns 2003-09-05 13:48:13 +0400
+++ man-1.5m2/src/apropos.sh 2004-05-26 16:53:20 +0400
@@ -14,33 +14,37 @@
#
# keep old PATH - 000323 - Bryan Henderson
# also look in /var/cache/man - 030801 - aeb
+# Modified for ALT Linux by Dmitry V. Levin <ldv@altlinux.org>
-program=`basename $0`
+PATH=/bin:/usr/bin
+export PATH
+
+PROG="${0##*/}"
# When man pages in your favorite locale look to grep like binary files
# (and you use GNU grep) you may want to add the 'a' option to *grepopt1.
-aproposgrepopt1='i'
+aproposgrepopt1='ia'
aproposgrepopt2=''
-whatisgrepopt1='iw'
+whatisgrepopt1='iwa'
whatisgrepopt2='^'
grepopt1=$%apropos_or_whatis%grepopt1
grepopt2=$%apropos_or_whatis%grepopt2
if [ $# = 0 ]
then
- echo "usage: $program keyword ..."
+ echo "usage: $PROG keyword ..."
exit 1
fi
-manpath=`man %manpathoption% | tr : '\040'`
+manpath=`man %manpathoption% | tr : \ `
-if [ "$manpath" = "" ]
+if [ -z "$manpath" ]
then
- echo "$program: manpath is null"
+ echo "$PROG: manpath is null" >&2
exit 1
fi
-if [ "$PAGER" = "" ]
+if [ -z "$PAGER" ]
then
PAGER="%pager%"
fi
@@ -49,15 +53,15 @@
for arg in $*; do
case $arg in
--version|-V|-v)
- echo "$program from %version%"
+ echo "$PROG from %version%"
exit 0
;;
--help|-h)
- echo "usage: $program keyword ..."
+ echo "usage: $PROG keyword ..."
exit 0
;;
-*)
- echo "$program: $arg: unknown option"
+ echo "$PROG: $arg: unknown option" >&2
exit 1
;;
*)
@@ -70,11 +74,22 @@
found=0
while [ $found = 0 -a -n "$1" ]
do
- for d in /var/cache/man $manpath /usr/lib
+ for d in $manpath
do
- if [ -f $d/whatis ]
+ if [ -z "${d##/usr/share/man*}" ]; then
+ d="${d/\/usr\/share\/man//var/cache/man}"
+ elif [ "$d" == /usr/X11R6/man ]; then
+ d=/var/cache/man/X11R6
+ elif [ "$d" == /usr/lib/perl5/man ]; then
+ d=/var/cache/man/perl
+ elif [ "$d" == /usr/local/man ]; then
+ d=/var/cache/man/local
+ else
+ continue
+ fi
+ if [ -f "$d/whatis" ]
then
- if grep -"$grepopt1"%grepsilent% "$grepopt2""$1" $d/whatis > /dev/null
+ if grep -qs"$grepopt1" "$grepopt2""$1" "$d/whatis"
then
found=1
fi
@@ -104,11 +119,22 @@
done
nothing=
found=0
- for d in /var/cache/man $manpath /usr/lib
+ for d in $manpath
do
- if [ -f $d/whatis ]
+ if [ -z "${d##/usr/share/man*}" ]; then
+ d="${d/\/usr\/share\/man//var/cache/man}"
+ elif [ "$d" == /usr/X11R6/man ]; then
+ d=/var/cache/man/X11R6
+ elif [ "$d" == /usr/lib/perl5/man ]; then
+ d=/var/cache/man/perl
+ elif [ "$d" == /usr/local/man ]; then
+ d=/var/cache/man/local
+ else
+ continue
+ fi
+ if [ -f "$d/whatis" ]
then
- if grep -"$grepopt1" "$grepopt2""$1" $d/whatis
+ if grep -"$grepopt1" "$grepopt2""$1" "$d/whatis"
then
found=1
fi
@@ -121,8 +147,4 @@
fi
shift
-done
-# Maybe don't use a pager
-# | $PAGER
-
-exit
+done | $PAGER