Re: [perl #33892] Add Interix support
[p5sagit/p5-mst-13.2.git] / regcomp.pl
index 6ae8478..97403ba 100644 (file)
@@ -1,3 +1,7 @@
+BEGIN {
+    # Get function prototypes
+    require 'regen_lib.pl';
+}
 #use Fatal qw(open close rename chmod unlink);
 open DESC, 'regcomp.sym';
 $ind = 0;
@@ -18,6 +22,7 @@ $tmp_h = 'tmp_reg.h';
 unlink $tmp_h if -f $tmp_h;
 
 open OUT, ">$tmp_h";
+binmode OUT;
 
 print OUT <<EOP;
 /* !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
@@ -112,8 +117,6 @@ static const int reg_num = $tot;
 
 EOP
 
-close OUT;
+close OUT or die "close $tmp_h: $!";
 
-chmod 0666, 'regnodes.h';
-unlink 'regnodes.h';
-rename $tmp_h, 'regnodes.h';
+safer_rename $tmp_h, 'regnodes.h';