summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/Ustar.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-06-04 14:40:40 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-06-04 14:40:40 +0000
commit8a3fdf46bd93e71794fcec29cb31017529d8ec57 (patch)
tree8721baf5d52b0079af9d143523c9b5d0a8cd2bef /usr.sbin/pkg_add/OpenBSD/Ustar.pm
parentcc4e44748b6a845f1f2d35fc2fe8753cb8b89300 (diff)
some minor systematic changes.
- mark all regexps I can with /o if they can be compiled once. - turn $o->method() into $o->method - remove unneeded prototypes - reduce split /re/ into split "string" where possible.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Ustar.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Ustar.pm24
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
index 483e59a2caf..a11c58399b1 100644
--- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Ustar.pm,v 1.47 2007/05/02 15:05:30 espie Exp $
+# $OpenBSD: Ustar.pm,v 1.48 2007/06/04 14:40:39 espie Exp $
#
# Copyright (c) 2002-2007 Marc Espie <espie@openbsd.org>
#
@@ -104,7 +104,7 @@ sub next
die "Error while reading header"
unless defined $n and $n == 512;
if ($header eq "\0"x512) {
- return $self->next();
+ return $self->next;
}
# decode header
my ($name, $mode, $uid, $gid, $size, $mtime, $chksum, $type,
@@ -120,11 +120,11 @@ sub next
if ($ck2 != oct($chksum)) {
die "Bad archive checksum";
}
- $name =~ s/\0*$//;
+ $name =~ s/\0*$//o;
$mode = oct($mode) & 0xfff;
- $uname =~ s/\0*$//;
- $gname =~ s/\0*$//;
- $linkname =~ s/\0*$//;
+ $uname =~ s/\0*$//o;
+ $gname =~ s/\0*$//o;
+ $linkname =~ s/\0*$//o;
$major = oct($major);
$minor = oct($minor);
$uid = oct($uid);
@@ -132,8 +132,8 @@ sub next
$uid = $uidcache->lookup($uname, $uid);
$gid = $gidcache->lookup($gname, $gid);
$mtime = oct($mtime);
- unless ($prefix =~ m/^\0/) {
- $prefix =~ s/\0*$//;
+ unless ($prefix =~ m/^\0/o) {
+ $prefix =~ s/\0*$//o;
$name = "$prefix/$name";
}
@@ -175,7 +175,7 @@ sub split_name
my $l = length $name;
if ($l > MAXFILENAME && $l <= MAXFILENAME+MAXPREFIX+1) {
while (length($name) > MAXFILENAME &&
- $name =~ m/^(.*?\/)(.*)$/) {
+ $name =~ m/^(.*?\/)(.*)$/o) {
$prefix .= $1;
$name = $2;
}
@@ -215,7 +215,7 @@ sub mkheader
if (defined $entry->{cwd}) {
my $cwd = $entry->{cwd};
- $cwd.='/' unless $cwd =~ m/\/$/;
+ $cwd.='/' unless $cwd =~ m/\/$/o;
$linkname =~ s/^\Q$cwd\E//;
}
if (!defined $linkname) {
@@ -370,7 +370,7 @@ sub write
my $out = $arc->{fh};
$arc->{padout} = 1;
- my $header = OpenBSD::Ustar::mkheader($self, $self->type());
+ my $header = OpenBSD::Ustar::mkheader($self, $self->type);
print $out $header or die "Error writing to archive: $!";
$self->write_contents($arc);
my $k = $self->{key};
@@ -410,7 +410,7 @@ sub copy
my $out = $wrarc->{fh};
$self->resolve_links($wrarc);
$wrarc->{padout} = 1;
- my $header = OpenBSD::Ustar::mkheader($self, $self->type());
+ my $header = OpenBSD::Ustar::mkheader($self, $self->type);
print $out $header or die "Error writing to archive: $!";
$self->copy_contents($wrarc);