summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xopcode.pl17
1 files changed, 10 insertions, 7 deletions
diff --git a/opcode.pl b/opcode.pl
index ffdc93de5f..3c9ae929eb 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -1,8 +1,7 @@
#!/usr/bin/perl
-unlink "opcode.h", "opnames.h";
-open(OC, ">opcode.h") || die "Can't create opcode.h: $!\n";
-open(ON, ">opnames.h") || die "Can't create opnames.h: $!\n";
+open(OC, ">opcode.h.new") || die "Can't create opcode.h.new: $!\n";
+open(ON, ">opnames.h.new") || die "Can't create opnames.h.new: $!\n";
select OC;
# Read data.
@@ -255,10 +254,11 @@ if (keys %OP_IS_FILETEST) {
close OC or die "Error closing opcode.h: $!";
close ON or die "Error closing opnames.h: $!";
-unlink "pp_proto.h";
-unlink "pp.sym";
-open PP, '>pp_proto.h' or die "Error creating pp_proto.h: $!";
-open PPSYM, '>pp.sym' or die "Error creating pp.sym: $!";
+rename 'opcode.h.new', 'opcode.h' or die "renaming opcode.h: $!\n";
+rename 'opnames.h.new', 'opnames.h' or die "renaming opnames.h: $!\n";
+
+open PP, '>pp_proto.h.new' or die "Error creating pp_proto.h.new: $!";
+open PPSYM, '>pp.sym.new' or die "Error creating pp.sym.new: $!";
print PP <<"END";
/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
@@ -295,6 +295,9 @@ for (@ops) {
close PP or die "Error closing pp_proto.h: $!";
close PPSYM or die "Error closing pp.sym: $!";
+rename 'pp_proto.h.new', 'pp_proto.h' or die "rename pp_proto.h: $!\n";
+rename 'pp.sym.new', 'pp.sym' or die "rename pp.sym: $!\n";
+
###########################################################################
sub tab {
local($l, $t) = @_;