From: Adam Dickmeiss Date: Mon, 2 Mar 2009 04:18:58 +0000 (+0100) Subject: Output file generated at very end rather than at beginning. X-Git-Tag: v3.0.45~19 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=1fb26db29805d4822763c205358f394725b0f02c Output file generated at very end rather than at beginning. Output is produced to a temporary file (.tmp) and then renamed at very end if operation is succesful. --- diff --git a/src/charconv.tcl b/src/charconv.tcl index 4412c2a..f09b82e 100644 --- a/src/charconv.tcl +++ b/src/charconv.tcl @@ -414,7 +414,7 @@ if {![info exists ifiles]} { usage } -set ofilehandle [open $ofile w] +set ofilehandle [open ${ofile}.tmp w] preamble_trie $ofilehandle $ifiles $ofile foreach ifile $ifiles { @@ -422,4 +422,6 @@ foreach ifile $ifiles { } close $ofilehandle +file rename -force ${ofile}.tmp ${ofile} +