www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/01/15:31:16

Message-Id: <200008011929.PAA03676@delorie.com>
Date: Tue, 01 Aug 2000 22:28:12 +0200
To: bkorb AT sco DOT COM
X-Mailer: Emacs 20.6 (via feedmail 8.2.emacs20_6 I) and Blat ver 1.8.5b
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
CC: djgpp-workers AT delorie DOT com
In-reply-to: <39849CAA.58977AD5@sco.com> (message from Bruce Korb on Sun, 30
Jul 2000 14:22:50 -0700)
Subject: Re: DJGPP patch for fixincludes
References: <397DCC3F DOT 32D9BB7C AT sco DOT com> <200007281731 DOT UAA10498 AT mailgw1 DOT netvision DOT net DOT il> <200007281738 DOT NAA09572 AT envy DOT delorie DOT com> <200007290638 DOT JAA27818 AT mailgw3 DOT netvision DOT net DOT il> <39849CAA DOT 58977AD5 AT sco DOT com>
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

> Date: Sun, 30 Jul 2000 14:22:50 -0700
> From: Bruce Korb <bkorb AT sco DOT COM>
> 
>   fix = {
>     hackname  = undefine_null;
>     select    = "^#[ \t]*define[ \t]+NULL[ \t]";
>     bypass    = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
> 
>     c_fix     = format;
>     c_fix_arg = "#ifndef NULL%2\n#define NULL%1%2\n#endif%2\n";
>     c_fix_arg = "^#[ \t]*define[ \t]*[ \t]NULL([^\r\n]+)([\r]*)\n";
> 
>     test_text = "#define NULL 0UL\r\n#define NULL\t((void*)0)\n";
>   };
> 
> Most likely, the "bypass" clause is triggered on all
> your headers that define NULL.  If it should not have triggered,
> then there is a bug.

Bug squashed.  The problem was that output was closed with `close'
rather than `fclose', so buffered output never made it to the file.

With the patch below, the headers locale.h and stddef.h get fixed for
NULL (they define it unconditionally), and math.h gets fixed for the
exception thingy (which is not really required, since our math.h is
already protected against C++).  testing.h winds up identical to
itself, as it should, I think.

(The second patch below has nothing to do with the bug, it just gets
in my way when I'm trying to run the program outside the shell script
or under GDB, and forget to define $VERBOSE.)

2000-08-01  Eli Zaretskii  <eliz AT is DOT elta DOT co DOT il>

	* fixinc/fixfixes.c (main): Close standard streams with fclose
	rather than close, to flush any buffered output.

	* fixinc/fixincl.c (initialize): Don't crash if $VERBOSE is
	undefined.

--- fixinc/fixfixes.c~2	Fri Jul 28 19:05:18 2000
+++ fixinc/fixfixes.c	Tue Aug  1 20:34:42 2000
@@ -792,8 +792,8 @@ main( argc, argv )
     }
 
   apply_fix( pFix, argv[1] );
-  close( STDOUT_FILENO );
-  close( STDIN_FILENO );
+  fclose( stdout );
+  fclose( stdin );
   unlink( argv[4] );
   if (rename( pz_tmptmp, argv[4] ) != 0)
     {
--- fixinc/fixincl.c~2	Fri Jul 28 19:26:08 2000
+++ fixinc/fixincl.c	Tue Aug  1 20:44:02 2000
@@ -259,7 +259,9 @@ ENV_TABLE
 
 #undef _ENV_
 
-  if (isdigit( *pz_verbose ))
+  if (pz_verbose == NULL)
+    ;	/* use default value */
+  else if (isdigit( *pz_verbose ))
     verbose_level = (te_verbose)atoi( pz_verbose );
   else
     switch (*pz_verbose) {

- Raw text -


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