diff options
Diffstat (limited to 'usr.sbin')
24 files changed, 117 insertions, 146 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index cad7a6e9ac9..c5b284c1104 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.149 2014/02/10 19:16:19 espie Exp $ +# $OpenBSD: Add.pm,v 1.150 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -669,10 +669,9 @@ sub install my $destdir = $state->{destdir}; # go append to /etc/shells if needed open(my $shells, '<', $destdir.OpenBSD::Paths->shells) or return; - my $_; while(<$shells>) { s/^\#.*//o; - return if $_ =~ m/^\Q$fullname\E\s*$/; + return if m/^\Q$fullname\E\s*$/; } close($shells); open(my $shells2, '>>', $destdir.OpenBSD::Paths->shells) or return; diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index a0ba7cba891..1ec617707d9 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.60 2014/01/30 13:23:51 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.61 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -432,7 +432,6 @@ sub init } open my $fh, "-|", @{$self->{ldconfig}}, "-r"; if (defined $fh) { - my $_; while (<$fh>) { if (m/^\s*search directories:\s*(.*?)\s*$/o) { for my $d (split(/\:/o, $1)) { diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 0b16e2db4f2..764281cbbf5 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.133 2014/02/08 10:43:25 espie Exp $ +# $OpenBSD: Delete.pm,v 1.134 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -601,7 +601,6 @@ sub delete my $fullname = $self->fullname; my @l=(); if (open(my $shells, '<', $destdir.OpenBSD::Paths->shells)) { - my $_; while(<$shells>) { push(@l, $_); s/^\#.*//o; diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm index 2c018f372fd..8b1b23eee1b 100644 --- a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm +++ b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: LibSpec.pm,v 1.15 2010/12/24 09:04:14 espie Exp $ +# $OpenBSD: LibSpec.pm,v 1.16 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2010 Marc Espie <espie@openbsd.org> # @@ -195,8 +195,8 @@ my $cached = {}; sub from_string { - my ($class, $_) = @_; - return $cached->{$_} //= $class->new_from_string($_); + my ($class, $s) = @_; + return $cached->{$s} //= $class->new_from_string($s); } sub new_with_stem diff --git a/usr.sbin/pkg_add/OpenBSD/Log.pm b/usr.sbin/pkg_add/OpenBSD/Log.pm index 399f5f14426..2b8d613ec4d 100644 --- a/usr.sbin/pkg_add/OpenBSD/Log.pm +++ b/usr.sbin/pkg_add/OpenBSD/Log.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Log.pm,v 1.7 2014/02/02 23:10:41 espie Exp $ +# $OpenBSD: Log.pm,v 1.8 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -116,7 +116,6 @@ sub system { my $self = shift; if (open(my $grab, "-|", @_)) { - my $_; while (<$grab>) { $self->{p}->_print($_); } diff --git a/usr.sbin/pkg_add/OpenBSD/Mtree.pm b/usr.sbin/pkg_add/OpenBSD/Mtree.pm index 09eebad080f..552ff1adf70 100644 --- a/usr.sbin/pkg_add/OpenBSD/Mtree.pm +++ b/usr.sbin/pkg_add/OpenBSD/Mtree.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Mtree.pm,v 1.12 2010/12/24 09:04:14 espie Exp $ +# $OpenBSD: Mtree.pm,v 1.13 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2004-2005 Marc Espie <espie@openbsd.org> # @@ -26,7 +26,6 @@ use File::Spec; sub parse_fh { my ($mtree, $basedir, $fh, $h) = @_; - my $_; while(<$fh>) { chomp; s/^\s*//o; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm index dc7941e89b2..90886529a17 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageLocator.pm,v 1.102 2013/05/29 21:58:25 espie Exp $ +# $OpenBSD: PackageLocator.pm,v 1.103 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -68,34 +68,34 @@ sub path_parse sub find { - my ($self, $_, $state) = @_; + my ($self, $url, $state) = @_; my $package; - if (m/[\/\:]/o) { - my ($repository, $pkgname) = $self->path_parse($_, $state); + if ($url =~ m/[\/\:]/o) { + my ($repository, $pkgname) = $self->path_parse($url, $state); $package = $repository->find($pkgname); if (defined $package) { $self->default_path($state)->add($repository); } } else { - $package = $self->default_path($state)->find($_); + $package = $self->default_path($state)->find($url); } return $package; } sub grabPlist { - my ($self, $_, $code, $state) = @_; + my ($self, $url, $code, $state) = @_; my $plist; - if (m/[\/\:]/o) { - my ($repository, $pkgname) = $self->path_parse($_, $state); + if ($url =~ m/[\/\:]/o) { + my ($repository, $pkgname) = $self->path_parse($url, $state); $plist = $repository->grabPlist($pkgname, $code); if (defined $plist) { $self->default_path($state)->add($repository); } } else { - $plist = $self->default_path($state)->grabPlist($_, $code); + $plist = $self->default_path($state)->grabPlist($url, $code); } return $plist; } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index 9e871a5b890..d47b3a30e6f 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageName.pm,v 1.51 2011/08/31 10:11:58 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.52 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -32,14 +32,14 @@ sub url2pkgname($) # see packages-specs(7) sub splitname { - my $_ = shift; - if (/^(.*?)\-(\d.*)$/o) { + my $n = shift; + if ($n =~ /^(.*?)\-(\d.*)$/o) { my $stem = $1; my $rest = $2; my @all = split /\-/o, $rest; return ($stem, @all); } else { - return ($_); + return ($n); } } @@ -47,14 +47,14 @@ my $cached = {}; sub from_string { - my ($class, $_) = @_; - return $cached->{$_} //= $class->new_from_string($_); + my ($class, $s) = @_; + return $cached->{$s} //= $class->new_from_string($s); } sub new_from_string { - my ($class, $_) = @_; - if (/^(.*?)\-(\d.*)$/o) { + my ($class, $n) = @_; + if ($n =~ /^(.*?)\-(\d.*)$/o) { my $stem = $1; my $rest = $2; my @all = split /\-/o, $rest; @@ -66,25 +66,25 @@ sub new_from_string }, "OpenBSD::PackageName::Name"; } else { return bless { - stem => $_, + stem => $n, }, "OpenBSD::PackageName::Stem"; } } sub splitstem { - my $_ = shift; - if (/^(.*?)\-\d/o) { + my $s = shift; + if ($s =~ /^(.*?)\-\d/o) { return $1; } else { - return $_; + return $s; } } sub is_stem { - my $_ = shift; - if (m/\-\d/o || $_ eq '-') { + my $s = shift; + if ($s =~ m/\-\d/o || $s eq '-') { return 0; } else { return 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index 8d0dbb87d01..f841801e1d6 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepository.pm,v 1.109 2014/03/07 09:44:11 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.110 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -99,30 +99,30 @@ sub pipe() { 'OpenBSD::PackageRepository::Local::Pipe' } sub parse { my ($class, $r, $state) = @_; - my $_ = $$r; - return undef if $_ eq ''; + my $u = $$r; + return undef if $u eq ''; - if (m/^ftp\:/io) { + if ($u =~ m/^ftp\:/io) { return $class->ftp->parse_fullurl($r, $state); - } elsif (m/^http\:/io) { + } elsif ($u =~ m/^http\:/io) { # require OpenBSD::PackageRepository::HTTP; return $class->http->parse_fullurl($r, $state); - } elsif (m/^https\:/io) { + } elsif ($u =~ m/^https\:/io) { return $class->https->parse_fullurl($r, $state); - } elsif (m/^scp\:/io) { + } elsif ($u =~ m/^scp\:/io) { require OpenBSD::PackageRepository::SCP; return $class->scp->parse_fullurl($r, $state); - } elsif (m/^src\:/io) { + } elsif ($u =~ m/^src\:/io) { require OpenBSD::PackageRepository::Source; return $class->source->parse_fullurl($r, $state); - } elsif (m/^file\:/io) { + } elsif ($u =~ m/^file\:/io) { return $class->file->parse_fullurl($r, $state); - } elsif (m/^inst\:$/io) { + } elsif ($u =~ m/^inst\:$/io) { return $class->installed->parse_fullurl($r, $state); - } elsif (m/^pipe\:$/io) { + } elsif ($u =~ m/^pipe\:$/io) { return $class->pipe->parse_fullurl($r, $state); } else { return $class->file->parse_fullurl($r, $state); @@ -655,7 +655,6 @@ sub parse_problems if (defined $object) { $url = $object->url; } - my $_; my $notyet = 1; while(<$fh>) { next if m/^(?:200|220|221|226|229|230|227|250|331|500|150)[\s\-]/o; @@ -723,7 +722,6 @@ sub get_http_list my $fullname = $self->url; my $l = []; - my $_; open(my $fh, '-|', OpenBSD::Paths->ftp." -o - $fullname 2>$error") or return; while(<$fh>) { @@ -773,7 +771,6 @@ sub _list { my ($self, $cmd) = @_; my $l =[]; - my $_; open(my $fh, '-|', "$cmd") or return; while(<$fh>) { chomp; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm index 8702e1ece7f..6cfcdea6301 100755 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: HTTP.pm,v 1.10 2011/07/19 18:09:41 espie Exp $ +# $OpenBSD: HTTP.pm,v 1.11 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2011 Marc Espie <espie@openbsd.org> # @@ -104,18 +104,18 @@ sub send_header sub get_header { my $o = shift; - my $_ = $o->getline; - if (!m,^HTTP/1\.1\s+(\d\d\d),) { + my $l = $o->getline; + if ($l !~ m,^HTTP/1\.1\s+(\d\d\d),) { return undef; } my $h = _Proxy::Header->new; $h->{code} = $1; - while ($_ = $o->getline) { - last if m/^$/; - if (m/^([\w\-]+)\:\s*(.*)$/) { + while ($l = $o->getline) { + last if $l =~ m/^$/; + if ($l =~ m/^([\w\-]+)\:\s*(.*)$/) { $h->{$1} = $2; } else { - print STDERR "unknown line: $_\n"; + print STDERR "unknown line: $l\n"; } } if (defined $h->{'Content-Length'}) { @@ -336,7 +336,6 @@ sub get_file sub main { my $self = shift; - my $_; my $o = _Proxy::Connection->new($self->{host}, "www"); while (<STDIN>) { chomp; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Persistant.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Persistant.pm index 3aaeeed153c..dcac9993407 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Persistant.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Persistant.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Persistant.pm,v 1.3 2014/01/09 20:20:01 espie Exp $ +# $OpenBSD: Persistant.pm,v 1.4 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -38,7 +38,6 @@ sub grab_object my $getfh = $self->{getfh}; print $cmdfh "ABORT\n"; - my $_; while (<$getfh>) { last if m/^ABORTED/o; } @@ -98,7 +97,6 @@ sub list my $path = $self->{path}; my $l = []; print $cmdfh "LIST $path\n"; - my $_; $_ = <$getfh>; if (!defined $_) { $self->{state}->fatal("Could not initiate #1 session", diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm index e0aa597a2dd..cf5f7ee6859 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SCP.pm,v 1.27 2011/07/19 17:30:05 espie Exp $ +# $OpenBSD: SCP.pm,v 1.28 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org> # @@ -45,8 +45,6 @@ sub initiate $self->{cmdfh} = $wrfh; $self->{getfh} = $rdfh; $wrfh->autoflush(1); - my $_; - while(<DATA>) { # compress script a bit next if m/^\#/o && !m/^\#!/o; @@ -103,7 +101,6 @@ sub expand_tilde return $dirs->{$arg} //= (getpwnam($arg))[7]."/"; } -my $_; while (<STDIN>) { chomp; if (m/^LIST\s+(.*)$/o) { diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 994c44430d4..8732340a15e 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.233 2014/02/10 19:12:20 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.234 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -1266,24 +1266,24 @@ our @ISA=qw(OpenBSD::PackingElement::Action); sub expand { my ($self, $state) = @_; - my $_ = $self->name; - if (m/\%F/o) { + my $e = $self->name; + if ($e =~ m/\%F/o) { die "Bad expand" unless defined $state->{lastfile}; - s/\%F/$state->{lastfile}->{name}/g; + $e =~ s/\%F/$state->{lastfile}->{name}/g; } - if (m/\%D/o) { + if ($e =~ m/\%D/o) { die "Bad expand" unless defined $state->{cwd}; - s/\%D/$state->cwd/ge; + $e =~ s/\%D/$state->cwd/ge; } - if (m/\%B/o) { + if ($e =~ m/\%B/o) { die "Bad expand" unless defined $state->{lastfile}; - s/\%B/dirname($state->{lastfile}->fullname)/ge; + $e =~ s/\%B/dirname($state->{lastfile}->fullname)/ge; } - if (m/\%f/o) { + if ($e =~ m/\%f/o) { die "Bad expand" unless defined $state->{lastfile}; - s/\%f/basename($state->{lastfile}->fullname)/ge; + $e =~ s/\%f/basename($state->{lastfile}->fullname)/ge; } - return $_; + return $e; } sub destate diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index fa5322562b3..fcc3a0d01b9 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingList.pm,v 1.132 2014/02/08 15:07:12 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.133 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -183,7 +183,6 @@ sub read sub defaultCode { my ($fh, $cont) = @_; - my $_; while (<$fh>) { &$cont($_); } @@ -192,7 +191,6 @@ sub defaultCode sub SharedItemsOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { next unless m/^\@(?:cwd|dir|fontdir|mandir|newuser|newgroup|name)\b/o || m/^\@(?:sample|extra)\b.*\/$/o || m/^[^\@].*\/$/o; &$cont($_); @@ -207,7 +205,6 @@ sub DirrmOnly sub LibraryOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { next unless m/^\@(?:cwd|lib|name|comment\s+subdir\=)\b/o; &$cont($_); @@ -217,7 +214,6 @@ sub LibraryOnly sub FilesOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { next unless m/^\@(?:cwd|name|info|man|file|lib|shell|sample|bin|rcscript)\b/o || !m/^\@/o; &$cont($_); @@ -227,7 +223,6 @@ sub FilesOnly sub PrelinkStuffOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { next unless m/^\@(?:cwd|bin|lib|name|depend|wantlib|comment\s+ubdir\=)\b/o; &$cont($_); @@ -237,7 +232,6 @@ sub PrelinkStuffOnly sub DependOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { if (m/^\@(?:depend|wantlib|define-tag)\b/o) { &$cont($_); @@ -251,7 +245,6 @@ sub DependOnly sub ExtraInfoOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { if (m/^\@(?:name|pkgpath|comment\s+(?:subdir|pkgpath)\=)\b/o) { &$cont($_); @@ -265,7 +258,6 @@ sub ExtraInfoOnly sub UpdateInfoOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { # if alwaysupdate, all info is sig if (m/^\@option\s+always-update\b/o) { @@ -287,7 +279,6 @@ sub UpdateInfoOnly sub ConflictOnly { my ($fh, $cont) = @_; - my $_; while (<$fh>) { if (m/^\@(?:name|conflict|option)\b/o) { &$cont($_); diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm index f4a5538a39c..80110d07a0b 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgAdd.pm,v 1.63 2014/02/13 19:35:00 espie Exp $ +# $OpenBSD: PkgAdd.pm,v 1.64 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -1063,7 +1063,6 @@ sub process_parameters if ($state->{pkglist}) { open my $f, '<', $state->{pkglist} or $state->fatal("bad list #1: #2", $state->{pkglist}, $!); - my $_; while (<$f>) { chomp; s/\s.*//; diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm index e9b0ba84eec..d89f9775ac2 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCheck.pm,v 1.46 2014/02/10 19:40:47 espie Exp $ +# $OpenBSD: PkgCheck.pm,v 1.47 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -293,9 +293,9 @@ sub log sub safe { - my ($self, $_) = @_; - s/[^\w\d\s\+\-\.\>\<\=\/\;\:\,\(\)\[\]]/?/g; - return $_; + my ($self, $string) = @_; + $string =~ s/[^\w\d\s\+\-\.\>\<\=\/\;\:\,\(\)\[\]]/?/g; + return $string; } sub handle_options diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 75e5a300067..affb422a75c 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.102 2014/03/05 22:32:32 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.103 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -1017,19 +1017,19 @@ sub read_fragments sub { my ($stack, $cont) = @_; while(my $file = pop @$stack) { - while (my $_ = $file->readline) { + while (my $l = $file->readline) { $state->progress->working(2048) unless $state->opt('q'); - if (m/^(\@comment\s+\$(?:Open)BSD\$)$/o) { - $_ = '@comment $'.'OpenBSD: '.basename($file->name).',v$'; + if ($l =~m/^(\@comment\s+\$(?:Open)BSD\$)$/o) { + $l = '@comment $'.'OpenBSD: '.basename($file->name).',v$'; } - if (m/^(\!)?\%\%(.*)\%\%$/) { - if (my $f2 = $self->handle_fragment($state, $file, $1, $2, $_, $cont)) { + if ($l =~ m/^(\!)?\%\%(.*)\%\%$/) { + if (my $f2 = $self->handle_fragment($state, $file, $1, $2, $l, $cont)) { push(@$stack, $file); $file = $f2; } next; } - my $s = $subst->do($_); + my $s = $subst->do($l); if ($fast) { next unless $s =~ m/^\@(?:cwd|lib|depend|wantlib)\b/o || $s =~ m/lib.*\.a$/o; } @@ -1037,7 +1037,7 @@ sub read_fragments my $o = &$cont($s); if (defined $o) { $o->check_version($state, $s); - $self->annotate($o, $_, $file); + $self->annotate($o, $l, $file); } } } diff --git a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm index 8319c33a9fe..6f9eb670b3c 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgInfo.pm,v 1.30 2014/01/09 20:20:01 espie Exp $ +# $OpenBSD: PkgInfo.pm,v 1.31 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -106,7 +106,6 @@ sub footer sub printfile { my ($state, $filename) = @_; - my $_; open my $fh, '<', $filename or return; while(<$fh>) { @@ -120,7 +119,6 @@ sub printfile sub print_description { my ($state, $dir) = @_; - my $_; open my $fh, '<', $dir.DESC or return; $_ = <$fh>; # zap COMMENT diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm index 91710037f03..cbe2e24395e 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Term.pm,v 1.22 2014/02/07 11:20:58 espie Exp $ +# $OpenBSD: Term.pm,v 1.23 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org> # @@ -188,18 +188,18 @@ sub set_header sub hmove { my ($self, $v) = @_; - my $_ = $self->{hpa}; - s/\%i// and $v++; - s/\%n// and $v ^= 0140; - s/\%B// and $v = 16 * ($v/10) + $v%10; - s/\%D// and $v = $v - 2*($v%16); - s/\%\./sprintf('%c', $v)/e; - s/\%d/sprintf('%d', $v)/e; - s/\%2/sprintf('%2d', $v)/e; - s/\%3/sprintf('%3d', $v)/e; - s/\%\+(.)/sprintf('%c', $v+ord($1))/e; - s/\%\%/\%/g; - return $_; + my $seq = $self->{hpa}; + $seq =~ s/\%i// and $v++; + $seq =~ s/\%n// and $v ^= 0140; + $seq =~ s/\%B// and $v = 16 * ($v/10) + $v%10; + $seq =~ s/\%D// and $v = $v - 2*($v%16); + $seq =~ s/\%\./sprintf('%c', $v)/e; + $seq =~ s/\%d/sprintf('%d', $v)/e; + $seq =~ s/\%2/sprintf('%2d', $v)/e; + $seq =~ s/\%3/sprintf('%3d', $v)/e; + $seq =~ s/\%\+(.)/sprintf('%c', $v+ord($1))/e; + $seq =~ s/\%\%/\%/g; + return $seq; } sub _show diff --git a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm index 255657df833..9c8bda58073 100644 --- a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm +++ b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: RequiredBy.pm,v 1.25 2010/12/24 09:04:14 espie Exp $ +# $OpenBSD: RequiredBy.pm,v 1.26 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -32,7 +32,6 @@ sub fill_entries open(my $fh, '<', $self->{filename}) or croak ref($self), ": reading $self->{filename}: $!"; - my $_; while(<$fh>) { s/\s+$//o; next if /^$/o; diff --git a/usr.sbin/pkg_add/OpenBSD/State.pm b/usr.sbin/pkg_add/OpenBSD/State.pm index 944a7caeebf..e51d8b8753b 100644 --- a/usr.sbin/pkg_add/OpenBSD/State.pm +++ b/usr.sbin/pkg_add/OpenBSD/State.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: State.pm,v 1.26 2014/03/18 16:42:24 espie Exp $ +# $OpenBSD: State.pm,v 1.27 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie <espie@openbsd.org> # @@ -229,11 +229,11 @@ sub f if (@_ == 0) { return undef; } - my ($_, @l) = @_; + my ($fmt, @l) = @_; # make it so that #0 is # unshift(@l, '#'); - s/\#(\d+)/$l[$1]/ge; - return $_; + $fmt =~ s/\#(\d+)/$l[$1]/ge; + return $fmt; } sub _fatal diff --git a/usr.sbin/pkg_add/OpenBSD/Subst.pm b/usr.sbin/pkg_add/OpenBSD/Subst.pm index d167dd0afcf..5a94cee98c5 100644 --- a/usr.sbin/pkg_add/OpenBSD/Subst.pm +++ b/usr.sbin/pkg_add/OpenBSD/Subst.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Subst.pm,v 1.15 2011/11/13 15:41:57 nigel Exp $ +# $OpenBSD: Subst.pm,v 1.16 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2008 Marc Espie <espie@openbsd.org> # @@ -62,26 +62,26 @@ sub parse_option sub do { my $self = shift; - my $_ = shift; - return $_ unless m/\$/o; # optimization - while ( my $k = (m/\$\{([A-Za-z_][^\}]*)\}/o)[0] ) { + my $s = shift; + return $s unless $s =~ m/\$/o; # optimization + while ( my $k = ($s =~ m/\$\{([A-Za-z_][^\}]*)\}/o)[0] ) { my $v = $self->{$k}; unless ( defined $v ) { $v = "\$\\\{$k\}"; } - s/\$\{\Q$k\E\}/$v/g; + $s =~ s/\$\{\Q$k\E\}/$v/g; } - s/\$\\\{([A-Za-z_])/\$\{$1/go; - return $_; + $s =~ s/\$\\\{([A-Za-z_])/\$\{$1/go; + return $s; } sub copy_fh2 { my ($self, $src, $dest) = @_; - my $_ = do { local $/; <$src> }; + my $contents = do { local $/; <$src> }; while (my ($k, $v) = each %{$self}) { - s/\$\{\Q$k\E\}/$v/g; + $contents =~ s/\$\{\Q$k\E\}/$v/g; } - s/\$\\\{([A-Za-z_])/\$\{$1/go; - print $dest $_; + $contents =~ s/\$\\\{([A-Za-z_])/\$\{$1/go; + print $dest $contents; } sub copy_fh diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index 552dc354979..95e37a834ce 100644 --- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm +++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Vstat.pm,v 1.67 2013/07/08 08:49:57 jasper Exp $ +# $OpenBSD: Vstat.pm,v 1.68 2014/03/18 18:53:29 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -259,7 +259,6 @@ sub run open(my $cmd, "-|", @_) or $state->errsay("Can't run #1", join(' ', @_)) and return; - my $_; while (<$cmd>) { &$code($_); } @@ -278,13 +277,13 @@ sub ask_mount delete $ENV{'BLOCKSIZE'}; run($state, OpenBSD::Paths->mount, sub { - my $_ = shift; - chomp; - if (m/^(.*?)\s+on\s+\/.*?\s+type\s+.*?(?:\s+\((.*?)\))?$/o) { + my $l = shift; + chomp $l; + if ($l =~ m/^(.*?)\s+on\s+\/.*?\s+type\s+.*?(?:\s+\((.*?)\))?$/o) { my ($dev, $opts) = ($1, $2); $class->new($dev, $opts); } else { - $state->errsay("Can't parse mount line: #1", $_); + $state->errsay("Can't parse mount line: #1", $l); } }); } @@ -298,11 +297,11 @@ sub ask_df $class->ask_mount($state) if !defined $devinfo; run($state, OpenBSD::Paths->df, "--", $fname, sub { - my $_ = shift; - chomp; - if (m/^Filesystem\s+(\d+)\-blocks/o) { + my $l = shift; + chomp $l; + if ($l =~ m/^Filesystem\s+(\d+)\-blocks/o) { $blocksize = $1; - } elsif (m/^(.*?)\s+\d+\s+\d+\s+(\-?\d+)\s+\d+\%\s+\/.*?$/o) { + } elsif ($l =~ m/^(.*?)\s+\d+\s+\d+\s+(\-?\d+)\s+\d+\%\s+\/.*?$/o) { my ($dev, $avail) = ($1, $2); $info = $devinfo->{$dev}; if (!defined $info) { diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb index 258f7d74822..1bfb9647def 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb +++ b/usr.sbin/pkg_add/pkg_mklocatedb @@ -1,6 +1,6 @@ #! /usr/bin/perl # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> -# $OpenBSD: pkg_mklocatedb,v 1.40 2014/03/09 09:55:10 espie Exp $ +# $OpenBSD: pkg_mklocatedb,v 1.41 2014/03/18 18:53:29 espie Exp $ # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -248,7 +248,6 @@ sub do_portsdir my $plist = OpenBSD::PackingList->read($in, sub { my ($fh, $cont) = @_; - my $_; while (<$fh>) { return if m/^\=\=\=\> /o; &$cont($_); |