pkgsrc/graphics/magicpoint/patches/patch-mgpembed.pl.in
wiz 95a3b5d685 Fix mgpembed.pl.
Patch from Marc Espie <espie@nerim.net> on tech-pkg.

Bump PKGREVISION.
2013-06-23 14:58:27 +00:00

74 lines
1.9 KiB
Perl

$NetBSD: patch-mgpembed.pl.in,v 1.1 2013/06/23 14:58:27 wiz Exp $
Adapt usage for perl-5.18.
From Marc Espie <espie@nerim.net>.
--- mgpembed.pl.in.orig 2002-07-28 11:52:19.000000000 +0000
+++ mgpembed.pl.in
@@ -16,15 +16,16 @@ if (! -x $gzip || ! -x $uuencode) {
die "external program not found. manual configuration required.\n"
}
-require 'getopts.pl';
+use Getopt::Std;
+use subs (qw(usage readfile));
# specify suffixes we should gzip files before uuencoding
@gzipsuffix = (".ps", ".xbm");
-do Getopts('o:');
+getopts('o:');
if ($#ARGV != 0) {
- do usage();
+ usage();
# NOTREACHED
}
@@ -37,14 +38,14 @@ if (defined($opt_o)) {
die "$outfname already exists\n" if -f $outfname;
die "$outfname is specified for both input/output\n"
if ($outfname eq $infname);
- open(OUT, "> $outfname") || die "Can not open $outfname: $!";
+ open(OUT, ">", $outfname) || die "Can not open $outfname: $!";
} else {
open(OUT, ">& STDOUT");
}
# read the file, process %include directives
-do readfile($infname, 'INPUT000');
+readfile($infname, 'INPUT000');
# append embedded files using %embed/%endembed directives
@@ -76,10 +77,10 @@ foreach $efile (keys %files) {
close(OUT);
sub readfile {
- local($filename, $input) = @_;
- local($fname, $fname0);
+ my($filename, $input) = @_;
+ my($fname, $fname0);
$input++;
- open($input, $filename) || die "Can not open $filename: $!\n";
+ open($input, '<', $filename) || die "Can not open $filename: $!\n";
while (<$input>) {
if (/^%%/) {
print OUT;
@@ -116,7 +117,7 @@ sub readfile {
$incfname = $1;
}
print OUT "\%\%\%\%\%\%\%\%\%\%INCLUDE $incfname\n";
- do readfile($incfname, $input);
+ readfile($incfname, $input);
print OUT "\%\%\%\%\%\%\%\%\%\%INCLUDE-END $incfname\n";
} else {
print OUT;
@@ -128,5 +129,5 @@ sub readfile {
sub usage {
print STDERR "usage: mgpembed [-o outfile ] mgpfile\n";
- exit -1;
+ exit 1;
}