Patches for GNU diff 1.15 under AIX 3.1

Chip Salzenberg chip at tct.com
Tue Apr 23 00:35:31 AEST 1991


The port of gdiff 1.15 to AIX 3.1 wasn't too hard.  IBM's compiler is
quirky, but it's mostly quite cool.  Oddities include:

 1. The system <limits.h> is just fine; don't use the one provided
    with gdiff.

 2. System headers already define TRUE and FALSE.

 3. In the extended (ANSI plus more) mode, __STDC__ is *not* defined.
    So features like prototypes need an additional define of ANSI.

 4. Each module that uses alloca() needs "#pragma alloca" at the
    _very_top_ of that module.

Here are the patches.  Shar and enjoy.

Index: diff.h
***************
*** 72,77 ****
  
  #define	EOS		(0)
! #define	FALSE		(0)
  #define TRUE		1
  
  #define min(a,b) ((a) <= (b) ? (a) : (b))
--- 72,84 ----
  
  #define	EOS		(0)
! 
! #ifdef TRUE
! #undef TRUE
! #endif
! #ifdef FALSE
! #undef FALSE
! #endif
  #define TRUE		1
+ #define	FALSE		0
  
  #define min(a,b) ((a) <= (b) ? (a) : (b))
***************
*** 83,87 ****
  
  /* Support old-fashioned C compilers.  */
! #if defined (__STDC__) || defined (__GNUC__)
  #include "limits.h"
  #else
--- 90,98 ----
  
  /* Support old-fashioned C compilers.  */
! #if defined (__STDC__) || defined (__GNUC__) || defined(_AIX)
! # define ANSI 1
! #endif
! 
! #if ANSI
  #include "limits.h"
  #else
***************
*** 91,95 ****
  
  /* Support old-fashioned C compilers.  */
! #if !defined (__STDC__) && !defined (__GNUC__)
  #define const
  #endif
--- 102,106 ----
  
  /* Support old-fashioned C compilers.  */
! #if !ANSI
  #define const
  #endif
***************
*** 346,350 ****
  /* Declare various functions.  */
  
! #ifdef __STDC__
  #define VOID void
  #else
--- 357,361 ----
  /* Declare various functions.  */
  
! #if ANSI
  #define VOID void
  #else

Index: diff3.c
***************
*** 19,23 ****
  /* Written by Randy Smith */
  
! #ifdef __STDC__
  #define VOID void
  #else
--- 19,23 ----
  /* Written by Randy Smith */
  
! #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX)
  #define VOID void
  #else

Index: getopt.c
***************
*** 16,20 ****
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
! #ifdef __STDC__
  #define CONST const
  #else
--- 16,25 ----
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
! 
! #ifdef _AIX
! #pragma alloca
! #endif
! 
! #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX)
  #define CONST const
  #else
***************
*** 45,49 ****
--- 50,56 ----
  #include <alloca.h>
  #else
+ #ifndef _AIX
  char *alloca ();
+ #endif
  #endif
  #endif /* not __GNUC__ */

Index: getopt1.c
***************
*** 18,22 ****
  #include "getopt.h"
  
! #ifdef __STDC__
  #define CONST const
  #else
--- 18,22 ----
  #include "getopt.h"
  
! #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX)
  #define CONST const
  #else

Index: regex.c
***************
*** 24,27 ****
--- 24,30 ----
     can run some tests we've already thought of.  */
  
+ #ifdef _AIX
+ #pragma alloca
+ #endif
  
  #ifdef emacs
***************
*** 60,64 ****
--- 63,69 ----
  #include <alloca.h>
  #else
+ #ifndef _AIX
  char *alloca ();
+ #endif
  #endif
  #endif
-- 
Brand X Industries Custodial, Refurbishing and Containment Service:
         When You Never, Ever Want To See It Again [tm]
     Chip Salzenberg   <chip at tct.com>, <uunet!pdn!tct!chip>



More information about the Comp.unix.aix mailing list