Re: Possible precedence problem on bitwise ^ operator
[p5sagit/p5-mst-13.2.git] / utils / c2ph.PL
index 9f80bc0..655ae29 100644 (file)
@@ -2,6 +2,29 @@
 
 use Config;
 use File::Basename qw(&basename &dirname);
+use Cwd;
+use subs qw(link);
+
+sub link { # This is a cut-down version of installperl:link().
+    my($from,$to) = @_;
+    my($success) = 0;
+
+    eval {
+       CORE::link($from, $to)
+           ? $success++
+           : ($from =~ m#^/afs/# || $to =~ m#^/afs/#)
+             ? die "AFS"  # okay inside eval {}
+             : die "Couldn't link $from to $to: $!\n";
+    };
+    if ($@) {
+       warn $@;
+       require File::Copy;
+       File::Copy::copy($from, $to)
+           ? $success++
+           : warn "Couldn't copy $from to $to: $!\n";
+    }
+    $success;
+}
 
 # List explicitly here the variables you want Configure to
 # generate.  Metaconfig only looks for shell variables, so you
@@ -12,8 +35,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.
+$origdir = cwd;
 chdir dirname($0);
 $file = basename($0, '.PL');
+$file .= '.com' if $^O eq 'VMS';
 
 open OUT,">$file" or die "Can't create $file: $!";
 
@@ -159,9 +184,9 @@ declarations at least, but that's quite a bit.
 
 Prior to this point, anyone programming in perl who wanted to interact
 with C programs, like the kernel, was forced to guess the layouts of
-the C strutures, and then hardwire these into his program.  Of course,
+the C structures, and then hardwire these into his program.  Of course,
 when you took your wonderfully crafted program to a system where the
-sgtty structure was laid out differently, you program broke.  Which is
+sgtty structure was laid out differently, your program broke.  Which is
 a shame.
 
 We've had Larry's h2ph translator, which helped, but that only works on
@@ -1250,7 +1275,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
@@ -1397,3 +1422,4 @@ if (defined $Config{d_link}) {
   File::Copy::syscopy('c2ph', 'pstruct');
 }
 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
+chdir $origdir;