Integrate mainline
[p5sagit/p5-mst-13.2.git] / utils / c2ph.PL
index 5f4523a..38b259f 100644 (file)
@@ -2,6 +2,7 @@
 
 use Config;
 use File::Basename qw(&basename &dirname);
+use Cwd;
 
 # List explicitly here the variables you want Configure to
 # generate.  Metaconfig only looks for shell variables, so you
@@ -12,10 +13,10 @@ use File::Basename qw(&basename &dirname);
 
 # This forces PL files to create target in same directory as PL file.
 # This is so that make depend always knows where to find PL derivatives.
-chdir(dirname($0));
-($file = basename($0)) =~ s/\.PL$//;
-$file =~ s/\.pl$//
-       if ($^O eq 'VMS' or $^O eq 'os2');  # "case-forgiving"
+$origdir = cwd;
+chdir dirname($0);
+$file = basename($0, '.PL');
+$file .= '.com' if $^O eq 'VMS';
 
 open OUT,">$file" or die "Can't create $file: $!";
 
@@ -1252,7 +1253,7 @@ main() {
 EOF
 
     for $type (@intrinsics) {
-       next if !type || $type eq 'void' || $type =~ /complex/; # sun stuff
+       next if !$type || $type eq 'void' || $type =~ /complex/; # sun stuff
        print <<"EOF";
     printf(mask,sizeof($type), "$type");
 EOF
@@ -1399,3 +1400,4 @@ if (defined $Config{d_link}) {
   File::Copy::syscopy('c2ph', 'pstruct');
 }
 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
+chdir $origdir;