summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'libexec')
-rw-r--r--libexec/makewhatis/makewhatis.817
-rw-r--r--libexec/makewhatis/makewhatis.pl25
2 files changed, 39 insertions, 3 deletions
diff --git a/libexec/makewhatis/makewhatis.8 b/libexec/makewhatis/makewhatis.8
index e64302b7dbc..e9c1c26a010 100644
--- a/libexec/makewhatis/makewhatis.8
+++ b/libexec/makewhatis/makewhatis.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: makewhatis.8,v 1.11 2003/06/02 13:59:56 jmc Exp $
+.\" $OpenBSD: makewhatis.8,v 1.12 2003/07/09 10:00:09 espie Exp $
.\" $NetBSD: makewhatis.8,v 1.2.2.1 1997/11/10 19:57:45 thorpej Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -51,6 +51,10 @@
.Ar files ...
.Nm makewhatis
.Op Fl p
+.Fl u Ar manpath
+.Ar files ...
+.Nm makewhatis
+.Op Fl p
.Fl t
.Ar files
.Sh DESCRIPTION
@@ -90,6 +94,17 @@ database in
.Ar manpath .
.Pp
If the
+.Fl u
+option is used,
+.Nm
+removes the description of
+.Ar files
+from an existing
+.Pa whatis.db
+database in
+.Ar manpath .
+.Pp
+If the
.Fl p
option is used,
.Nm
diff --git a/libexec/makewhatis/makewhatis.pl b/libexec/makewhatis/makewhatis.pl
index f30f92359c7..c4b8fcdb10c 100644
--- a/libexec/makewhatis/makewhatis.pl
+++ b/libexec/makewhatis/makewhatis.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# ex:ts=8 sw=4:
-# $OpenBSD: makewhatis.pl,v 1.23 2002/11/07 22:23:04 millert Exp $
+# $OpenBSD: makewhatis.pl,v 1.24 2003/07/09 10:00:09 espie Exp $
#
# Copyright (c) 2000 Marc Espie.
#
@@ -530,7 +530,7 @@ sub build_index
# main code
my %opts;
-getopts('tpd:', \%opts);
+getopts('tpd:u:', \%opts);
if (defined $opts{'p'}) {
$picky = 1;
@@ -561,6 +561,27 @@ if (defined $opts{'d'}) {
write_uniques($subjects, $whatis);
exit 0;
}
+if (defined $opts{'u'}) {
+ my $mandir = $opts{'u'};
+ unless (-d $mandir) {
+ die "$0: $mandir: not a directory"
+ }
+ chdir $mandir;
+
+ my $whatis = "$mandir/whatis.db";
+ open(my $old, '<', $whatis) or
+ die "$0 $whatis to merge with";
+ my $subjects = scan_manpages(\@ARGV);
+ my %remove = map {$_ => 1 } @$subjects;
+ $subjects = [];
+ while (<$old>) {
+ chomp;
+ push(@$subjects, $_) unless defined $remove{$_};
+ }
+ close($old);
+ write_uniques($subjects, $whatis);
+ exit 0;
+}
if ($#ARGV == -1) {
local $_;
@ARGV=();