prevent the deletion of a file before it is read on DOS
authorEli Zaretskii <eliz@is.elta.co.il>
Mon, 21 Aug 2000 16:28:18 +0000 (19:28 +0300)
committerBruce Korb <korbb@gcc.gnu.org>
Mon, 21 Aug 2000 16:28:18 +0000 (16:28 +0000)
From-SVN: r35848

gcc/ChangeLog
gcc/fixinc/fixincl.c

index ef11439..a9f64a4 100644 (file)
@@ -1,3 +1,9 @@
+2000-08-05  Eli Zaretskii  <eliz@is.elta.co.il>
+
+       * fixinc/fixincl.c (fix_with_system): Pipe the output of
+       "external" fixes through `cat', to avoid truncating the input
+       file by redirection.
+
 2000-08-21  Jakub Jelinek  <jakub@redhat.com>
 
        * config/i386/i386.md (lea_general_1): Copy insn condition to split
index 3b13d70..9736537 100644 (file)
@@ -914,10 +914,13 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file)
       /* Don't use the "src > dstX; rm -f dst; mv -f dstX dst" trick:
         dst is a temporary file anyway, so we know there's no other
         file by that name; and DOS's system(3) doesn't mind to
-        clobber existing file in redirection.  Besides, with DOS 8+3
-        limited file namespace, we can easily lose if dst already has
-        an extension that is 3 or more characters long.  */
-      tSCC   z_cmd_fmt[] = " %s > %s";
+         clobber existing file in redirection.  Besides, with DOS 8+3
+         limited file namespace, we can easily lose if dst already has
+         an extension that is 3 or more characters long.
+         The following bizarre use of 'cat' only works on DOS boxes.
+         It is causing the file to be dropped into a temporary file for
+         'cat' to read (pipes do not work on DOS).  */
+      tSCC   z_cmd_fmt[] = " %s | cat > %s";
       tCC**  ppArgs = p_fixd->patch_args;
 
       argsize = sizeof( z_cmd_fmt ) + strlen( pz_temp_file )