mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-22 16:44:32 +01:00
New option -append: teach makewhatis to only add records, instead
of clobbering the entire database. sort options in alphabetic order. install manpage makewhatis.local.8
This commit is contained in:
parent
33d9c4e18e
commit
d1c1415248
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15857
@ -1,5 +1,6 @@
|
|||||||
MAN1= makewhatis.1
|
MAN1= makewhatis.1
|
||||||
# MAN8= makewhatis.local.8
|
MAN8= makewhatis.local.8
|
||||||
|
MLINKS= makewhatis.local.8 catman.local.8
|
||||||
|
|
||||||
libexecdir=/usr/libexec
|
libexecdir=/usr/libexec
|
||||||
LINKS=${libexecdir}/makewhatis.local ${libexecdir}/catman.local
|
LINKS=${libexecdir}/makewhatis.local ${libexecdir}/catman.local
|
||||||
|
@ -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
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
.\" modification, are permitted provided that the following conditions
|
.\" 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
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" 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.3 1996/04/08 04:17:48 mpp Exp $
|
||||||
|
|
||||||
|
|
||||||
.Dd Jan, 12, 1995
|
.Dd Jan, 12, 1995
|
||||||
.Dt MAKEWHATIS 1
|
.Dt MAKEWHATIS 1
|
||||||
@ -41,26 +40,27 @@
|
|||||||
.Nd create whatis database
|
.Nd create whatis database
|
||||||
|
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm makewhatis
|
.Nm
|
||||||
|
.Op Fl a | Fl append
|
||||||
|
.Op Fl h | Fl help
|
||||||
.Op Fl i | Fl indent Ar column
|
.Op Fl i | Fl indent Ar column
|
||||||
.Op Fl n | Fl name Ar name
|
.Op Fl n | Fl name Ar name
|
||||||
.Op Fl o | Fl outfile Ar file
|
.Op Fl o | Fl outfile Ar file
|
||||||
.Op Fl v | Fl verbose
|
.Op Fl v | Fl verbose
|
||||||
.Op Fl h | Fl help
|
|
||||||
.Op Ar directories ...
|
.Op Ar directories ...
|
||||||
|
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm Makewhatis
|
.Nm
|
||||||
extracts the name and a short description from unformatted manpages
|
extracts the name and a short description from unformatted manpages
|
||||||
and creates the
|
and creates the
|
||||||
.Xr whatis 1
|
.Xr whatis 1
|
||||||
database.
|
database.
|
||||||
.Nm Makewhatis
|
.Nm
|
||||||
can read gzip'ed manpages.
|
can read gzip'ed manpages.
|
||||||
|
|
||||||
.Ar Directory
|
.Ar Directory
|
||||||
names a directory containing manpage subdirectories
|
names a directory containing manpage subdirectories
|
||||||
.Pq named Pa man[0-8] .
|
.Pq named Pa man.+ .
|
||||||
Colons are treated as spaces, hence
|
Colons are treated as spaces, hence
|
||||||
.Ic makewhatis $MANPATH
|
.Ic makewhatis $MANPATH
|
||||||
or
|
or
|
||||||
@ -69,8 +69,31 @@ are allowed.
|
|||||||
|
|
||||||
.Sh OPTIONS
|
.Sh OPTIONS
|
||||||
.Bl -tag -width Ds
|
.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
|
.It Fl h , Fl help
|
||||||
Print options and exit.
|
Print options and exit.
|
||||||
|
|
||||||
|
.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 v, Fl verbose
|
.It Fl v, Fl verbose
|
||||||
Issue more warnings
|
Issue more warnings
|
||||||
.Pq to stderr .
|
.Pq to stderr .
|
||||||
@ -81,22 +104,8 @@ for an uncompressed page,
|
|||||||
for a compressed page, and
|
for a compressed page, and
|
||||||
.Ql +
|
.Ql +
|
||||||
for a link.
|
for a link.
|
||||||
|
.El
|
||||||
|
|
||||||
.It Fl i , Fl indent Ar column
|
|
||||||
Justify description strings to
|
|
||||||
.Ar column Pq default 24 .
|
|
||||||
|
|
||||||
.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 .
|
|
||||||
|
|
||||||
.Sh EXAMPLES
|
.Sh EXAMPLES
|
||||||
.Pp
|
.Pp
|
||||||
@ -132,16 +141,19 @@ May be useful for Solaris.
|
|||||||
whatis database
|
whatis database
|
||||||
.It Pa /etc/weekly
|
.It Pa /etc/weekly
|
||||||
run
|
run
|
||||||
.Nm
|
.Nm makewhatis.local
|
||||||
every week
|
every week
|
||||||
.El
|
.El
|
||||||
|
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr man 1 ,
|
|
||||||
.Xr whatis 1 ,
|
|
||||||
.Xr apropos 1 ,
|
.Xr apropos 1 ,
|
||||||
|
.Xr catman 1 ,
|
||||||
|
.Xr sort 1 ,
|
||||||
|
.Xr makewhatis.local 1 ,
|
||||||
|
.Xr man 1 ,
|
||||||
.Xr manpath 1 ,
|
.Xr manpath 1 ,
|
||||||
.Xr catman 1 .
|
.Xr uniq 1 ,
|
||||||
|
.Xr whatis 1 .
|
||||||
|
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
This
|
This
|
||||||
@ -149,6 +161,5 @@ This
|
|||||||
command appeared in FreeBSD 2.1.
|
command appeared in FreeBSD 2.1.
|
||||||
|
|
||||||
.Sh AUTHOR
|
.Sh AUTHOR
|
||||||
Wolfram Schneider
|
Wolfram Schneider, Berlin.
|
||||||
.Aq wosch@cs.tu-berlin.de ,
|
|
||||||
Germany
|
|
||||||
|
55
gnu/usr.bin/man/makewhatis/makewhatis.local.8
Normal file
55
gnu/usr.bin/man/makewhatis/makewhatis.local.8
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
.\" (c) Wolfram Schneider, Berlin. April 1996. Public Domain.
|
||||||
|
.\"
|
||||||
|
.\" $Id: makewhatis.local.8,v 1.1 1996/05/14 10:27:26 wosch Exp $
|
||||||
|
|
||||||
|
.Dd April, 26, 1996
|
||||||
|
.Dt MAKEWHATIS.LOCAL 8
|
||||||
|
.Os FreeBSD 2.2
|
||||||
|
|
||||||
|
.Sh NAME
|
||||||
|
.Nm makewhatis.local , catman.local
|
||||||
|
.Nd start makewhatis for local file systems
|
||||||
|
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm /usr/libexec/makewhatis.local
|
||||||
|
.Op options
|
||||||
|
.Ar directories ...
|
||||||
|
.Nm /usr/libexec/catman.local
|
||||||
|
.Op options
|
||||||
|
.Ar directories ...
|
||||||
|
|
||||||
|
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
start
|
||||||
|
.Xr makewhatis 1
|
||||||
|
only for file systems physically mounted on the system
|
||||||
|
where the
|
||||||
|
.Nm
|
||||||
|
is being executed. Running makewhatis
|
||||||
|
from
|
||||||
|
.Pa /etc/weekly
|
||||||
|
for rw nfs-mounted /usr may kill
|
||||||
|
your NFS server -- all NFS clients start makewhatis at the same time!
|
||||||
|
So use this wrapper for
|
||||||
|
.Xr cron 8
|
||||||
|
instead calling makewhatis directly.
|
||||||
|
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width /etc/weekly.XXX -compact
|
||||||
|
.It Pa /etc/weekly
|
||||||
|
run
|
||||||
|
.Nm
|
||||||
|
every week
|
||||||
|
.El
|
||||||
|
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr makewhatis 1 ,
|
||||||
|
.Xr catman 1 ,
|
||||||
|
.Xr find 1 ,
|
||||||
|
.Xr cron 8 .
|
||||||
|
|
||||||
|
.Sh HISTORY
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
command appeared in FreeBSD 2.2.
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# PS: this wrapper works also for catman(1)
|
# PS: this wrapper works also for catman(1)
|
||||||
#
|
#
|
||||||
# $Id: makewhatis.local.sh,v 1.2 1996/04/27 12:17:01 wosch Exp $
|
# $Id: makewhatis.local.sh,v 1.1 1996/05/14 10:27:27 wosch Exp $
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:$PATH; export PATH
|
PATH=/bin:/usr/bin:$PATH; export PATH
|
||||||
opt= dirs= localdirs=
|
opt= dirs= localdirs=
|
||||||
|
@ -29,20 +29,18 @@
|
|||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
# SUCH DAMAGE.
|
# SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# makewhatis -- update the whatis database in the man directories.
|
# makewhatis -- update the whatis database in the man directories.
|
||||||
#
|
#
|
||||||
# E-Mail: Wolfram Schneider <wosch@cs.tu-berlin.de>
|
# $Id: makewhatis.perl,v 1.9 1996/05/14 14:38:12 wosch Exp $
|
||||||
#
|
|
||||||
# $Id: makewhatis.perl,v 1.8 1996/05/12 21:02:04 wosch Exp $
|
|
||||||
#
|
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
|
|
||||||
warn <<EOF;
|
warn <<EOF;
|
||||||
usage: makewhatis [-v|-verbose] [-h|-help] [-i|-indent colum]
|
usage: makewhatis [-a|-append ] [-h|-help] [-i|-indent colum]
|
||||||
[-n|-name name] [-o|-outfile file] [directories ...]
|
[-n|-name name] [-o|-outfile file] [-v|-verbose]
|
||||||
|
[directories ...]
|
||||||
EOF
|
EOF
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
@ -61,14 +59,38 @@ sub open_output {
|
|||||||
}
|
}
|
||||||
$tmp = $whatisdb; # for signals
|
$tmp = $whatisdb; # for signals
|
||||||
|
|
||||||
if (!open(A, "> $whatisdb")) {
|
|
||||||
die "$whatisdb: $!\n" if $outfile;
|
|
||||||
|
|
||||||
warn "$whatisdb: $!\n"; $err++; return 0;
|
# Array of all entries
|
||||||
}
|
|
||||||
@a = ();
|
@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;
|
warn "Open $whatisdb\n" if $verbose;
|
||||||
|
if (!open(A, "> $whatisdb")) {
|
||||||
|
die "$whatisdb: $!\n" if $outfile;
|
||||||
|
|
||||||
|
warn "$whatisdb: $!\n"; $err++; return 0;
|
||||||
|
}
|
||||||
|
|
||||||
select A;
|
select A;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -83,21 +105,21 @@ sub close_output {
|
|||||||
if ($success) { # success
|
if ($success) { # success
|
||||||
|
|
||||||
# uniq
|
# uniq
|
||||||
@b = ();
|
|
||||||
warn "\n" if $verbose && $pointflag;
|
warn "\n" if $verbose && $pointflag;
|
||||||
warn "sort -u > $whatisdb\n" if $verbose;
|
warn "sort -u > $whatisdb\n" if $verbose;
|
||||||
foreach $i (sort @a) {
|
foreach $i (sort @a) {
|
||||||
if ($i ne $last) {
|
if ($i ne $last) {
|
||||||
push(@b, $i);
|
push(@b, $i);
|
||||||
$counter++;
|
|
||||||
}
|
}
|
||||||
$last =$i;
|
$last =$i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$counter = $#b + 1;
|
||||||
print @b; close A; select STDOUT;
|
print @b; close A; select STDOUT;
|
||||||
|
|
||||||
if (!$outfile) {
|
if (!$outfile) {
|
||||||
rename($whatisdb, $w);
|
|
||||||
warn "Rename $whatisdb to $w\n" if $verbose;
|
warn "Rename $whatisdb to $w\n" if $verbose;
|
||||||
|
rename($whatisdb, $w) || warn "rename $whatisdb $w\n";
|
||||||
$counter_all += $counter;
|
$counter_all += $counter;
|
||||||
warn "$counter entries in $w\n" if $verbose;
|
warn "$counter entries in $w\n" if $verbose;
|
||||||
} else {
|
} else {
|
||||||
@ -411,6 +433,7 @@ sub variables {
|
|||||||
$indent = 24; # indent for description
|
$indent = 24; # indent for description
|
||||||
$outfile = 0; # Don't write to ./whatis
|
$outfile = 0; # Don't write to ./whatis
|
||||||
$whatis_name = "whatis"; # Default name for DB
|
$whatis_name = "whatis"; # Default name for DB
|
||||||
|
$append = 0; # Don't delete old entries
|
||||||
|
|
||||||
# if no argument for directories given
|
# if no argument for directories given
|
||||||
@defaultmanpath = ( '/usr/share/man' );
|
@defaultmanpath = ( '/usr/share/man' );
|
||||||
@ -453,6 +476,7 @@ sub parse {
|
|||||||
elsif (/^--?(o|outfile)$/) { $outfile = $argv[0]; shift @argv }
|
elsif (/^--?(o|outfile)$/) { $outfile = $argv[0]; shift @argv }
|
||||||
elsif (/^--?(f|format|i|indent)$/) { $i = $argv[0]; shift @argv }
|
elsif (/^--?(f|format|i|indent)$/) { $i = $argv[0]; shift @argv }
|
||||||
elsif (/^--?(n|name)$/) { $whatis_name = $argv[0];shift @argv }
|
elsif (/^--?(n|name)$/) { $whatis_name = $argv[0];shift @argv }
|
||||||
|
elsif (/^--?(a|append)$/) { $append = 1 }
|
||||||
else { &usage }
|
else { &usage }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
55
usr.bin/makewhatis/makewhatis.local.8
Normal file
55
usr.bin/makewhatis/makewhatis.local.8
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
.\" (c) Wolfram Schneider, Berlin. April 1996. Public Domain.
|
||||||
|
.\"
|
||||||
|
.\" $Id: makewhatis.local.8,v 1.1 1996/05/14 10:27:26 wosch Exp $
|
||||||
|
|
||||||
|
.Dd April, 26, 1996
|
||||||
|
.Dt MAKEWHATIS.LOCAL 8
|
||||||
|
.Os FreeBSD 2.2
|
||||||
|
|
||||||
|
.Sh NAME
|
||||||
|
.Nm makewhatis.local , catman.local
|
||||||
|
.Nd start makewhatis for local file systems
|
||||||
|
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm /usr/libexec/makewhatis.local
|
||||||
|
.Op options
|
||||||
|
.Ar directories ...
|
||||||
|
.Nm /usr/libexec/catman.local
|
||||||
|
.Op options
|
||||||
|
.Ar directories ...
|
||||||
|
|
||||||
|
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
start
|
||||||
|
.Xr makewhatis 1
|
||||||
|
only for file systems physically mounted on the system
|
||||||
|
where the
|
||||||
|
.Nm
|
||||||
|
is being executed. Running makewhatis
|
||||||
|
from
|
||||||
|
.Pa /etc/weekly
|
||||||
|
for rw nfs-mounted /usr may kill
|
||||||
|
your NFS server -- all NFS clients start makewhatis at the same time!
|
||||||
|
So use this wrapper for
|
||||||
|
.Xr cron 8
|
||||||
|
instead calling makewhatis directly.
|
||||||
|
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width /etc/weekly.XXX -compact
|
||||||
|
.It Pa /etc/weekly
|
||||||
|
run
|
||||||
|
.Nm
|
||||||
|
every week
|
||||||
|
.El
|
||||||
|
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr makewhatis 1 ,
|
||||||
|
.Xr catman 1 ,
|
||||||
|
.Xr find 1 ,
|
||||||
|
.Xr cron 8 .
|
||||||
|
|
||||||
|
.Sh HISTORY
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
command appeared in FreeBSD 2.2.
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# PS: this wrapper works also for catman(1)
|
# PS: this wrapper works also for catman(1)
|
||||||
#
|
#
|
||||||
# $Id: makewhatis.local.sh,v 1.2 1996/04/27 12:17:01 wosch Exp $
|
# $Id: makewhatis.local.sh,v 1.1 1996/05/14 10:27:27 wosch Exp $
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:$PATH; export PATH
|
PATH=/bin:/usr/bin:$PATH; export PATH
|
||||||
opt= dirs= localdirs=
|
opt= dirs= localdirs=
|
||||||
|
Loading…
Reference in New Issue
Block a user