[Fwd: Re: DJGPP patch for fixincludes]

Bruce Korb bkorb@sco.COM
Mon Aug 21 09:28:00 GMT 2000

-------- Original Message --------
Subject: Re: DJGPP patch for fixincludes
Date: Sun, 6 Aug 2000 09:48:23 +0300 (IDT)
From: Eli Zaretskii <eliz@is.elta.co.il>
To: Bruce Korb <bkorb@sco.com>
CC: djgpp-workers@delorie.com

On Sun, 30 Jul 2000, Bruce Korb wrote:

> 3.  check.tpl should be augmented so that after the regular fixincl
>     goes through its paces, the __MSDOS__ flavor is built and run
>     against the one header, "testing.h".  Test that the output is
>     correct.  That should test the operation of the DOS  version.
>     That ought to be enough.

It was enough to find another bug in the DJGPP version of fixincl: the
external fixes didn't work because I failed to consider the
possibility that the input and the output files are the same file.  So
redirection nuked the input before the program got a chance to look at

After correcting this, DJGPP's stdio.h is also fixed (by replacing 
va_list with __gcc_va_list (sp?)).

Here's the patch:

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.

--- fixinc/fixincl.c~	Tue Aug  1 20:44:02 2000
+++ fixinc/fixincl.c	Sat Aug  5 23:22:56 2000
@@ -918,8 +918,11 @@
 	 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";
+	 an extension that is 3 or more characters long.
+	 However, we cannot simply use " %s > %s" because both strings
+	 could be identical, and we will nuke the input file when the
+	 redirection is created.  */
+      tSCC   z_cmd_fmt[] = " %s | cat > %s";
       tCC**  ppArgs = p_fixd->patch_args;
       argsize = sizeof( z_cmd_fmt ) + strlen( pz_temp_file )

More information about the Gcc-patches mailing list