diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-03-05 11:02:36 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-03-05 11:02:36 +0000 |
commit | 44bb145d41e4ce9724498acb159e8fa91b9d010d (patch) | |
tree | a2dd406621bc390206b4bfc5d274d03ab4d14b4e /libexec/makewhatis/OpenBSD/Makewhatis | |
parent | f24302530201508f541d4c58c5d29fa459b84204 (diff) |
bit of clean-up, cosmetic, style, comments.
Diffstat (limited to 'libexec/makewhatis/OpenBSD/Makewhatis')
-rw-r--r-- | libexec/makewhatis/OpenBSD/Makewhatis/Check.pm | 4 | ||||
-rw-r--r-- | libexec/makewhatis/OpenBSD/Makewhatis/Find.pm | 16 | ||||
-rw-r--r-- | libexec/makewhatis/OpenBSD/Makewhatis/Formated.pm | 6 | ||||
-rw-r--r-- | libexec/makewhatis/OpenBSD/Makewhatis/Whatis.pm | 11 |
4 files changed, 18 insertions, 19 deletions
diff --git a/libexec/makewhatis/OpenBSD/Makewhatis/Check.pm b/libexec/makewhatis/OpenBSD/Makewhatis/Check.pm index 66ee4ba12e9..96e7a574e76 100644 --- a/libexec/makewhatis/OpenBSD/Makewhatis/Check.pm +++ b/libexec/makewhatis/OpenBSD/Makewhatis/Check.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Check.pm,v 1.1 2004/08/06 12:05:08 espie Exp $ +# $OpenBSD: Check.pm,v 1.2 2005/03/05 11:02:35 espie Exp $ # Copyright (c) 2000-2004 Marc Espie <espie@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any @@ -46,7 +46,7 @@ sub found($$) # # reparse the subject we're about to add, and check whether it makes # sense, e.g., is there a man page around. -sub verify_subject +sub verify_subject($$) { local $_ = shift; my $filename = shift; diff --git a/libexec/makewhatis/OpenBSD/Makewhatis/Find.pm b/libexec/makewhatis/OpenBSD/Makewhatis/Find.pm index 2673b86e9c2..8d38b860637 100644 --- a/libexec/makewhatis/OpenBSD/Makewhatis/Find.pm +++ b/libexec/makewhatis/OpenBSD/Makewhatis/Find.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Find.pm,v 1.1 2004/08/06 12:05:08 espie Exp $ +# $OpenBSD: Find.pm,v 1.2 2005/03/05 11:02:35 espie Exp $ # Copyright (c) 2000-2004 Marc Espie <espie@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any @@ -25,19 +25,19 @@ use File::Find; # # find all manpages under $dir, trim some duplicates. # -sub find_manpages +sub find_manpages($) { my $dir = shift; my ($list, %nodes); $list=[]; find( sub { - return unless /\.[\dln]\w*(?:\.Z|\.gz)?$/; - return unless -f $_; - my $unique = (stat _)[0]."/".(stat _)[1]; - return if defined $nodes{$unique}; - $nodes{$unique} = 1; - push(@$list, $File::Find::name); + return unless m/\.[\dln]\w*(?:\.Z|\.gz)?$/; + return unless -f $_; + my $unique = (stat _)[0]."/".(stat _)[1]; + return if defined $nodes{$unique}; + $nodes{$unique} = 1; + push(@$list, $File::Find::name); }, $dir); return $list; } diff --git a/libexec/makewhatis/OpenBSD/Makewhatis/Formated.pm b/libexec/makewhatis/OpenBSD/Makewhatis/Formated.pm index 127bf9681f6..f909fe08e5c 100644 --- a/libexec/makewhatis/OpenBSD/Makewhatis/Formated.pm +++ b/libexec/makewhatis/OpenBSD/Makewhatis/Formated.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Formated.pm,v 1.2 2004/12/24 00:00:04 espie Exp $ +# $OpenBSD: Formated.pm,v 1.3 2005/03/05 11:02:35 espie Exp $ # Copyright (c) 2000-2004 Marc Espie <espie@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any @@ -18,7 +18,7 @@ use strict; use warnings; package OpenBSD::Makewhatis::Formated; -# add_formated_subject($subjects, $_, $section): +# add_formated_subject($subjects, $_, $section, $filename, $picky): # add subject $_ to the list of current $subjects, in section $section. # sub add_formated_subject @@ -73,7 +73,7 @@ sub handle my $foundname = 0; while (<$file>) { chomp; - if (/^$/) { + if (m/^$/) { # perl aggregates several subjects in one manpage # so we don't stop after we've got one subject add_formated_subject(\@lines, $subject, $section, $filename, $picky) diff --git a/libexec/makewhatis/OpenBSD/Makewhatis/Whatis.pm b/libexec/makewhatis/OpenBSD/Makewhatis/Whatis.pm index 7f5111fb179..308e7c7a9ab 100644 --- a/libexec/makewhatis/OpenBSD/Makewhatis/Whatis.pm +++ b/libexec/makewhatis/OpenBSD/Makewhatis/Whatis.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Whatis.pm,v 1.2 2004/08/24 08:29:30 espie Exp $ +# $OpenBSD: Whatis.pm,v 1.3 2005/03/05 11:02:35 espie Exp $ # Copyright (c) 2000-2004 Marc Espie <espie@openbsd.org> # # Permission to use, copy, modify, and distribute this software for any @@ -33,7 +33,6 @@ sub write { my ($list, $dir) = @_; my $f = "$dir/whatis.db"; - local $_; my ($out, $tempname); ($out, $tempname) = tempfile('/tmp/makewhatis.XXXXXXXXXX') or die "$0: Can't open temporary file"; @@ -41,10 +40,10 @@ sub write my @sorted = sort @$list; my $last; - while ($_ = shift @sorted) { - next if length > MAXLINELEN; - print $out $_, "\n" unless defined $last and $_ eq $last; - $last = $_; + while (my $l = shift @sorted) { + next if length $l > MAXLINELEN; + print $out $l, "\n" unless defined $last and $l eq $last; + $last = $l; } close $out; if (compare($tempname, $f) == 0) { |