stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r661075 - /stdcxx/branches/4.2.x/bin/genxviews
Date Wed, 28 May 2008 20:42:53 GMT
Author: sebor
Date: Wed May 28 13:42:53 2008
New Revision: 661075

URL: http://svn.apache.org/viewvc?rev=661075&view=rev
Log:
2008-05-28  Martin Sebor  <sebor@roguewave.com>

	* bin/genxviews (tmpout): New name of a temporary file to replace
	the final output file with at the end of execution.
	(output): Used tmpout instead of outfile.
	Replaced the final output file only at the end of execution of
	the script.

Modified:
    stdcxx/branches/4.2.x/bin/genxviews

Modified: stdcxx/branches/4.2.x/bin/genxviews
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/bin/genxviews?rev=661075&r1=661074&r2=661075&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/bin/genxviews (original)
+++ stdcxx/branches/4.2.x/bin/genxviews Wed May 28 13:42:53 2008
@@ -73,6 +73,9 @@
 
         o)  # argument is the name of output file (stdout by default)
             outfile=$OPTARG
+
+            # temporary output file (will replace outfile when done)
+            tmpout=$outfile.$$
             ;;
 
         V)  # specify stdcxx branch/version to generate cross-build
@@ -152,16 +155,16 @@
 output ()
 {
     if [ $# -eq 0 ]; then
-        # no arguments provided, copy its own stdin to outfile
-        if [ -z $outfile ]; then
+        # no arguments provided, copy its own stdin to tmpout
+        if [ -z $tmpout ]; then
             cat
         else
-            cat >>$outfile
+            cat >>$tmpout
         fi
-    elif [ -z $outfile ]; then
+    elif [ -z $tmpout ]; then
         echo "$*"
     else
-        echo "$*" >>$outfile
+        echo "$*" >>$tmpout
     fi
 }
 
@@ -644,3 +647,9 @@
   </body>
 </html>
 EOF
+
+# rerame the temporary output file to $outfile, possibly replacing
+# the original $outfile if it exists
+if [ -f "$tmpout" ]; then
+    mv $tmpout $outfile
+fi



Mime
View raw message