summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>1996-06-23 20:35:22 +0000
committerWolfram Schneider <wosch@FreeBSD.org>1996-06-23 20:35:22 +0000
commitb18b803f335c3ca564f5ccaa5c275475b8428ab9 (patch)
tree83a1dda7ca8916bcdd8212725fda222bd4b7aa83 /gnu/usr.bin
parente451e0819236371c474fa36f8a77c394b078fd18 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/man/catman/catman.19
-rw-r--r--gnu/usr.bin/man/catman/catman.perl6
-rw-r--r--gnu/usr.bin/man/makewhatis/Makefile9
-rw-r--r--gnu/usr.bin/man/makewhatis/makewhatis.178
-rw-r--r--gnu/usr.bin/man/makewhatis/makewhatis.perl89
5 files changed, 136 insertions, 55 deletions
diff --git a/gnu/usr.bin/man/catman/catman.1 b/gnu/usr.bin/man/catman/catman.1
index 9731974d77e5..c7d22ef8c83f 100644
--- a/gnu/usr.bin/man/catman/catman.1
+++ b/gnu/usr.bin/man/catman/catman.1
@@ -30,7 +30,7 @@
.\"
.\" E-mail: Wolfram Schneider <wosch@cs.tu-berlin.de>
.\"
-.\" $Id: catman.1,v 1.5 1995/05/06 19:04:06 joerg Exp $
+.\" $Id: catman.1,v 1.7 1996/01/23 21:27:39 joerg Exp $
.\"
.Dd Mar 12, 1995
@@ -125,6 +125,13 @@ or
.Sh FEATURES
Very fast if all man pages already formatted.
+Does not support the
+.Fl w
+option as some other systems do. Use
+.Xr makewhatis 1
+to rebuild the
+.Ql whatis
+database.
.Sh BUGS
.Xr man 1
is a setuid program. Be careful that user
diff --git a/gnu/usr.bin/man/catman/catman.perl b/gnu/usr.bin/man/catman/catman.perl
index cc6dc7628d6d..77ca3a670398 100644
--- a/gnu/usr.bin/man/catman/catman.perl
+++ b/gnu/usr.bin/man/catman/catman.perl
@@ -35,7 +35,7 @@
#
# Email: Wolfram Schneider <wosch@cs.tu-berlin.de>
#
-# $Id: catman.perl,v 1.6 1995/05/20 19:02:53 ache Exp $
+# $Id: catman.perl,v 1.7 1996/03/21 18:17:41 wosch Exp $
sub usage {
@@ -237,7 +237,7 @@ sub parse_subdir {
next if $file eq "." || $file eq "..";
# fo_09-o.bar0
- if ($file !~ /^[\w\-\[\.]+\.\w+$/) {
+ if ($file !~ /^[\w\-\+\[\.]+\.\w+$/) {
&garbage("$mandir/$file", "Assume garbage")
unless -d "$mandir/$file";
next;
@@ -294,7 +294,7 @@ sub parse_subdir {
foreach $file (readdir(D)) {
next if $file =~ /^(\.|\.\.)$/; # skip current and parent directory
- if ($file !~ /^[\w\-\[\.]+\.\w+$/) {
+ if ($file !~ /^[\w\-\+\[\.]+\.\w+$/) {
&garbage("$catdir/$file", "Assume garbage")
unless -d "$catdir/$file";
next;
diff --git a/gnu/usr.bin/man/makewhatis/Makefile b/gnu/usr.bin/man/makewhatis/Makefile
index 644a3a59b6ed..7849d739de10 100644
--- a/gnu/usr.bin/man/makewhatis/Makefile
+++ b/gnu/usr.bin/man/makewhatis/Makefile
@@ -1,7 +1,16 @@
MAN1= makewhatis.1
+MAN8= makewhatis.local.8
+MLINKS= makewhatis.local.8 catman.local.8
+
+libexecdir=/usr/libexec
+LINKS=${libexecdir}/makewhatis.local ${libexecdir}/catman.local
beforeinstall:
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${.CURDIR}/makewhatis.perl ${DESTDIR}${BINDIR}/makewhatis
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ ${.CURDIR}/makewhatis.local.sh \
+ ${DESTDIR}${libexecdir}/makewhatis.local
+
.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.1 b/gnu/usr.bin/man/makewhatis/makewhatis.1
index ec48e1a534cc..143522a4e9f1 100644
--- a/gnu/usr.bin/man/makewhatis/makewhatis.1
+++ b/gnu/usr.bin/man/makewhatis/makewhatis.1
@@ -1,5 +1,5 @@
.\"
-.\" (c) Copyright 1995 Wolfram Schneider. All rights reserved.
+.\" (c) Copyright 1995 Wolfram Schneider, Berlin. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -26,12 +26,11 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" /usr/bin/makewhatis - create whatis database
+.\" makewhatis -- update the whatis database in the man directories.
.\"
-.\" Email: Wolfram Schneider <wosch@cs.tu-berlin.de>
-.\"
-.\" $Id: makewhatis.1,v 1.2 1995/03/31 04:00:51 joerg Exp $
.\"
+.\" $Id: makewhatis.1,v 1.4 1996/05/22 00:57:39 wosch Exp $
+
.Dd Jan, 12, 1995
.Dt MAKEWHATIS 1
@@ -41,26 +40,27 @@
.Nd create whatis database
.Sh SYNOPSIS
-.Nm makewhatis
+.Nm
+.Op Fl a | Fl append
+.Op Fl h | Fl help
.Op Fl i | Fl indent Ar column
.Op Fl n | Fl name Ar name
.Op Fl o | Fl outfile Ar file
.Op Fl v | Fl verbose
-.Op Fl h | Fl help
.Op Ar directories ...
.Sh DESCRIPTION
-.Nm Makewhatis
+.Nm
extracts the name and a short description from unformatted manpages
and creates the
.Xr whatis 1
database.
-.Nm Makewhatis
+.Nm
can read gzip'ed manpages.
.Ar Directory
names a directory containing manpage subdirectories
-.Pq named Pa man[0-8] .
+.Pq named Pa man.+ .
Colons are treated as spaces, hence
.Ic makewhatis $MANPATH
or
@@ -69,34 +69,43 @@ are allowed.
.Sh OPTIONS
.Bl -tag -width Ds
+.It Fl a , Fl append
+Append mode. Don't delete old entries in whatis database. Note:
+the new database will be sorted without repeated lines and
+.Nm
+does not check if old entries are valid.
+
.It Fl h , Fl help
Print options and exit.
-.It Fl v, Fl verbose
-Issue more warnings
-.Pq to stderr .
-For every parsed man page write a single char:
-.Ql \&.
-for an uncompressed page,
-.Ql *
-for a compressed page, and
-.Ql +
-for a link.
.It Fl i , Fl indent Ar column
Justify description strings to
.Ar column Pq default 24 .
+.It Fl n , Fl name Ar name
+Use
+.Ar name
+instead of
+.Pa whatis Ns .
+
.It Fl o , Fl outfile Ar file
Write all output to
.Ar file
instead of
.Pa dirname/whatis Ns .
-.It Fl n , Fl name Ar name
-Use
-.Ar name
-instead of
-.Pa whatis Ns .
+.It Fl v, Fl verbose
+Issue more warnings
+.Pq to stderr .
+For every parsed man page write a single char:
+.Ql \&.
+for an uncompressed page,
+.Ql *
+for a compressed page, and
+.Ql +
+for a link.
+.El
+
.Sh EXAMPLES
.Pp
@@ -108,8 +117,7 @@ Create whatis database for all directories in your
.Ic makewhatis -outfile /tmp/mywhatis /usr/local/man $HOME/man
.Pp
Create whatis database
-.Pa /tmp/mywhatis
-\&.
+.Pa /tmp/mywhatis .
Traverse directories
.Pa /usr/local/man
and
@@ -133,16 +141,19 @@ May be useful for Solaris.
whatis database
.It Pa /etc/weekly
run
-.Nm
+.Nm makewhatis.local
every week
.El
.Sh SEE ALSO
-.Xr man 1 ,
-.Xr whatis 1 ,
.Xr apropos 1 ,
+.Xr catman 1 ,
+.Xr sort 1 ,
+.Xr makewhatis.local 1 ,
+.Xr man 1 ,
.Xr manpath 1 ,
-.Xr catman 1 .
+.Xr uniq 1 ,
+.Xr whatis 1 .
.Sh HISTORY
This
@@ -150,6 +161,5 @@ This
command appeared in FreeBSD 2.1.
.Sh AUTHOR
-Wolfram Schneider
-.Aq wosch@cs.tu-berlin.de ,
-Germany
+Wolfram Schneider, Berlin.
+
diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.perl b/gnu/usr.bin/man/makewhatis/makewhatis.perl
index c0fa966bb931..1740368e10f4 100644
--- a/gnu/usr.bin/man/makewhatis/makewhatis.perl
+++ b/gnu/usr.bin/man/makewhatis/makewhatis.perl
@@ -29,20 +29,18 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-
#
# makewhatis -- update the whatis database in the man directories.
#
-# E-Mail: Wolfram Schneider <wosch@cs.tu-berlin.de>
-#
-# $Id: makewhatis.perl,v 1.6 1995/04/01 11:43:09 joerg Exp $
-#
+# $Id: makewhatis.perl,v 1.10 1996/05/22 00:57:42 wosch Exp $
+
sub usage {
warn <<EOF;
-usage: makewhatis [-v|-verbose] [-h|-help] [-i|-indent colum]
- [-n|-name name] [-o|-outfile file] [directories ...]
+usage: makewhatis [-a|-append ] [-h|-help] [-i|-indent colum]
+ [-n|-name name] [-o|-outfile file] [-v|-verbose]
+ [directories ...]
EOF
exit 1;
}
@@ -61,14 +59,38 @@ sub open_output {
}
$tmp = $whatisdb; # for signals
- if (!open(A, "> $whatisdb")) {
- die "$whatisdb: $!\n" if $outfile;
- warn "$whatisdb: $!\n"; $err++; return 0;
- }
+ # Array of all entries
@a = ();
+
+ # Append mode
+ if ($append) {
+ local($file) = $whatisdb;
+ $file =~ s/\.tmp$// if !$outfile;
+
+ if (open(A, "$file")) {
+ warn "Open $file for append mode\n" if $verbose;
+ while(<A>) {
+ push(@a, $_);
+ }
+ close A;
+ }
+
+ else {
+ warn "$whatisdb: $!\n" if lstat($file) && $verbose; #
+ }
+ undef $file;
+ }
+
+
warn "Open $whatisdb\n" if $verbose;
+ if (!open(A, "> $whatisdb")) {
+ die "$whatisdb: $!\n" if $outfile;
+
+ warn "$whatisdb: $!\n"; $err++; return 0;
+ }
+
select A;
return 1;
}
@@ -83,21 +105,21 @@ sub close_output {
if ($success) { # success
# uniq
- @b = ();
warn "\n" if $verbose && $pointflag;
warn "sort -u > $whatisdb\n" if $verbose;
foreach $i (sort @a) {
if ($i ne $last) {
push(@b, $i);
- $counter++;
}
$last =$i;
}
+
+ $counter = $#b + 1;
print @b; close A; select STDOUT;
if (!$outfile) {
- rename($whatisdb, $w);
warn "Rename $whatisdb to $w\n" if $verbose;
+ rename($whatisdb, $w) || warn "rename $whatisdb $w\n";
$counter_all += $counter;
warn "$counter entries in $w\n" if $verbose;
} else {
@@ -220,8 +242,9 @@ sub ext {
sub name {
local($name) = @_;
- $name =~ s/.*\///g;
- $name =~ s/\.[^.]*$//;
+ $name =~ s=.*/==;
+ $name =~ s=$ext$==o;
+ $name =~ s=\.[^\.]+$==;
return "$name";
}
@@ -250,6 +273,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 +288,33 @@ sub out {
}
}
+# The filename of manual page is not a keyword.
+# This is bad, 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 $_;
+ }
+
+ local($f) = $file; $f =~ s%/*[^/]+$%%; # dirname
+ local($e) = $file; $e =~ s/$ext$//; $e =~ s%.*(\.[^.]+)$%$1%; # .1
+
+ foreach (split(/,\s+/, $man)) {
+ s/\(.+//;
+
+ # a keyword exist as file
+ return if -e "$f/$_$e" || -e "$f/$_$e$ext";
+ }
+
+ $man = "$name($extension), $man";
+}
+
# looking for NAME
sub manual {
local($file) = @_;
@@ -380,11 +433,12 @@ sub variables {
$indent = 24; # indent for description
$outfile = 0; # Don't write to ./whatis
$whatis_name = "whatis"; # Default name for DB
+ $append = 0; # Don't delete old entries
# if no argument for directories given
@defaultmanpath = ( '/usr/share/man' );
- $ext = ".gz"; # extension
+ $ext = '.gz'; # extension
umask(022);
$err = 0; # exit code
@@ -422,6 +476,7 @@ sub parse {
elsif (/^--?(o|outfile)$/) { $outfile = $argv[0]; shift @argv }
elsif (/^--?(f|format|i|indent)$/) { $i = $argv[0]; shift @argv }
elsif (/^--?(n|name)$/) { $whatis_name = $argv[0];shift @argv }
+ elsif (/^--?(a|append)$/) { $append = 1 }
else { &usage }
}