chiark / gitweb /
Use .tmp for temporary files and write-then-rename
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 15:42:12 +0000 (16:42 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 15:42:12 +0000 (16:42 +0100)
pctb/Makefile
pctb/README
pctb/commod-results-processor
pctb/dictionary-manager

index 9daeddb796d0ed2354ade4b21ef42d89ed1015f8..af0901b1e682a7cafcab507c4343fe392befe34f 100644 (file)
@@ -44,7 +44,9 @@ $(CONVERT_OBJS): ocr.h convert.h structure.h common.h
 
 clean:
        rm -f *.o core core.* *~ vgcore.*
 
 clean:
        rm -f *.o core core.* *~ vgcore.*
-       rm -f t t.* u u.* v v.*
+       rm -f t t.* u u.* v v.* *.tmp
 
 realclean: clean
 
 realclean: clean
-       rm -f $(TARGETS) ./#pages#.ppm 
+       rm -f $(TARGETS)
+       rm -f ./#pages#.ppm ./#upload-*#.txt ./#commodmap#.tsv
+       rm -f ./#master-*#.txt ./#local-*#.txt
index 4f56fd8ab0d0d9a53e773f804ed8c24386d00548..96914335c7351132b7c955df238de53344d81e37 100644 (file)
@@ -126,10 +126,10 @@ The program reads and writes the following files:
    HTML returned from the upload server is left in these dropping
    files for debugging etc.
 
    HTML returned from the upload server is left in these dropping
    files for debugging etc.
 
- * <file>.new
+ * <file>.tmp
 
    When any of these tools overwrite one of the persistent dictionary
 
    When any of these tools overwrite one of the persistent dictionary
-   files, they temporarily write to <file>.new.
+   files, they temporarily write to <file>.tmp.
 
 These files are all in the current working directory.  There is not
 yet any feature to have them be somewhere else.  The helper programs
 
 These files are all in the current working directory.  There is not
 yet any feature to have them be somewhere else.  The helper programs
index cea64e5190318e437c5ad55ff6368cfe0f8a68ed..3ea53be79f49b73a36b9be2f592a307a05b2833e 100755 (executable)
@@ -244,7 +244,7 @@ sub refresh_commodmap() {
     my $incommodmap=0;
     my $intag='';
     my %got;
     my $incommodmap=0;
     my $intag='';
     my %got;
-    my $o= new IO::File "#commodmap#.tsv.new",'w' or die $!;
+    my $o= new IO::File "#commodmap#.tsv.tmp",'w' or die $!;
     undef %commodmap;
 
     my $xp= new XML::Parser
     undef %commodmap;
 
     my $xp= new XML::Parser
@@ -292,7 +292,7 @@ sub refresh_commodmap() {
 #    print STDERR "[[[$content]]]\n";
     $xp->parse($content);
     close $o or die $!;
 #    print STDERR "[[[$content]]]\n";
     $xp->parse($content);
     close $o or die $!;
-    rename "#commodmap#.tsv.new","#commodmap#.tsv" or die $!;
+    rename "#commodmap#.tsv.tmp","#commodmap#.tsv" or die $!;
 }
 
 our %newcommods;
 }
 
 our %newcommods;
index 9cbdb78f4984cb003c2d79e288b190521f1cf57e..5079defd1d00abfbc9995a6f439f21efe95758ba 100755 (executable)
@@ -225,7 +225,7 @@ proc write_database {} {
     global reqkind database_fn database
     upvar #0 database_magic/$reqkind magic
     
     global reqkind database_fn database
     upvar #0 database_magic/$reqkind magic
     
-    set f [open $database_fn.new w]
+    set f [open $database_fn.tmp w]
     puts $f $magic
 
     write_database_header/$reqkind $f
     puts $f $magic
 
     write_database_header/$reqkind $f
@@ -239,7 +239,7 @@ proc write_database {} {
     }
     puts $f "."
     close $f
     }
     puts $f "."
     close $f
-    file rename -force $database_fn.new $database_fn
+    file rename -force $database_fn.tmp $database_fn
 }
 
 proc select_database {dbname_spec} {
 }
 
 proc select_database {dbname_spec} {