delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/06/03:46:11

Date: Sun, 6 Aug 2000 09:48:23 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Bruce Korb <bkorb AT sco DOT COM>
cc: djgpp-workers AT delorie DOT com
Subject: Re: DJGPP patch for fixincludes
In-Reply-To: <39849CAA.58977AD5@sco.com>
Message-ID: <Pine.SUN.3.91.1000806094650.14058C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT 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
it.

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 AT is DOT elta DOT co DOT 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 )

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019