diff options
author | joerg <joerg@FreeBSD.org> | 1995-09-10 13:05:52 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1995-09-10 13:05:52 +0000 |
commit | fa1e84085a6073041ad315c65c287ad37e687ef3 (patch) | |
tree | 157bf1a25e3f94425d73280ce753b9168e1365e9 /gnu/usr.bin/man | |
parent | 13c37952a163fb4d87ca1e09903643163f912c1f (diff) | |
download | FreeBSD-src-fa1e84085a6073041ad315c65c287ad37e687ef3.zip FreeBSD-src-fa1e84085a6073041ad315c65c287ad37e687ef3.tar.gz |
Fix a few minor bugs in makewhatis.
Submitted by: wosch@cs.tu-berlin.de (Wolfram Schneider)
Diffstat (limited to 'gnu/usr.bin/man')
-rw-r--r-- | gnu/usr.bin/man/makewhatis/makewhatis.perl | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.perl b/gnu/usr.bin/man/makewhatis/makewhatis.perl index af2fc5d..02f11a3 100644 --- a/gnu/usr.bin/man/makewhatis/makewhatis.perl +++ b/gnu/usr.bin/man/makewhatis/makewhatis.perl @@ -35,7 +35,7 @@ # # E-Mail: Wolfram Schneider <wosch@cs.tu-berlin.de> # -# $Id: makewhatis.perl,v 1.5 1995/03/31 04:00:53 joerg Exp $ +# $Id: makewhatis.perl,v 1.6 1995/04/01 11:43:09 joerg Exp $ # sub usage { @@ -220,8 +220,9 @@ sub ext { sub name { local($name) = @_; - $name =~ s/.*\///g; - $name =~ s/\.[^.]*$//; + $name =~ s=.*/==; + $name =~ s=$ext$==o; + $name =~ s=\.[^\.]+$==; return "$name"; } @@ -250,6 +251,9 @@ sub out { $man =~ s/[,. ]+$//; $man =~ s/,/($extension),/g; $man .= "($extension)"; + + &manpagename; + $desc =~ s/^[ \t]+//; for($i = length($man); $i < $indent && $desc; $i++) { @@ -262,6 +266,31 @@ sub out { } } +# The filename of manual page is not a keyword. +# This may be dangerous, because you don't find the manpage +# whith: $ man <section> <keyword> +# +# Add filename if a) filename is not a keyword and b) no keyword(s) +# exist as file in same mansection +# +sub manpagename { + foreach (split(/,\s+/, $man)) { + s/\(.+//; + # filename is keyword + return if $name eq $_; + } + + $name =~ s=\[=\\\[=g; # shit '[' + foreach (split(/,\s+/, $man)) { + s/\(.+//; + ($f = $file) =~ s/$name/$_/; + # a keyword exist as file + return if -e "$f"; + } + + $man .= ", $name($extension)"; +} + # looking for NAME sub manual { local($file) = @_; @@ -384,7 +413,7 @@ sub variables { # if no argument for directories given @defaultmanpath = ( '/usr/share/man' ); - $ext = ".gz"; # extension + $ext = '.gz'; # extension umask(022); $err = 0; # exit code |