diff --git a/rc/bin/man b/rc/bin/man --- a/rc/bin/man +++ b/rc/bin/man @@ -57,6 +57,7 @@ fn page { search=yes +fpath=no while(~ $d 0) { if(~ $#* 0) { echo 'Usage: man [-bntpPSw] [0-9] [0-9] ... name1 name2 ...' >[1=2] @@ -69,6 +70,7 @@ while(~ $d 0) { if not switch($1) { case -b ; cmd=b ; shift + case -f ; fpath=yes ; shift case -n ; cmd=n ; shift case -P ; cmd=P ; shift case -p ; cmd=p ; shift @@ -85,7 +87,7 @@ ix=$S/$sec/INDEX if(~ $#* 1) pat='^'^$1^' ' if not pat='^('^`{echo $* | sed 's/ /|/g'}^') ' fils=() -if(~ $search yes) +if(~ $search yes && ~ $fpath no) for(i in $S/$sec){ if(/bin/test -f $i/INDEX){ try=`{grep -i $pat $i/INDEX | sed 's/^[^ ]* //' | sort -u} @@ -94,7 +96,7 @@ for(i in $S/$sec){ } } # bug: should also do following loop if not all pages found -if(~ $#fils 0) { +if(~ $#fils 0 && ~ $fpath no) { # nothing in INDEX. try for file of given name for(i) { if(~ $i intro) i=0intro @@ -104,10 +106,14 @@ if(~ $#fils 0) { fils=($fils $try) } } - if(~ $#fils 0) { - echo 'man: no manual page' >[1=2] - exit 'no man' - } +} +if(~ $fpath yes) + for(i) + if(/bin/test -f $i) + fils=($fils $i) +if(~ $#fils 0) { + echo 'man: no manual page' >[1=2] + exit 'no man' } switch($cmd) { case p; out=proof