diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2008-06-09 12:00:49 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2008-06-09 12:00:49 +0000 |
commit | 1863b6978329ca5f595ba328a4ca50d0b81db3cd (patch) | |
tree | ee3b7c7936f79d9473867e0a2228bf42b273bcc8 /usr.sbin | |
parent | 6073e521a5e744bfb2b795fab6836fa12502fa56 (diff) |
allow direct copy of fh to another
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Subst.pm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Subst.pm b/usr.sbin/pkg_add/OpenBSD/Subst.pm index 6ad52df3b3a..d64f794019d 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.5 2008/04/07 17:56:43 espie Exp $ +# $OpenBSD: Subst.pm,v 1.6 2008/06/09 12:00:48 espie Exp $ # # Copyright (c) 2008 Marc Espie <espie@openbsd.org> # @@ -70,16 +70,22 @@ sub do return $_; } -sub copy_fh +sub copy_fh2 { - my ($self, $srcname, $dest) = @_; - open my $src, '<', $srcname or die "can't open $srcname"; + my ($self, $src, $dest) = @_; local $_; while (<$src>) { print $dest $self->do($_); } } +sub copy_fh +{ + my ($self, $srcname, $dest) = @_; + open my $src, '<', $srcname or die "can't open $srcname"; + $self->copy_fh2($src, $dest); +} + sub copy { my ($self, $srcname, $destname) = @_; |