SCO UNIX 3.2v2 header patches for use with GCC/G++

Chip Salzenberg chip at tct.uucp
Tue Mar 5 00:34:38 AEST 1991


When SCO UNIX users compile programs with a Real ANSI Compiler like
GCC, or even with the AT&T compiler "rcc", inconsistencies in the
SCO-provided header files often cause spurious warnings that clutter
the output of the compiler.

The patches below are for the headers provided with SCO UNIX 3.2v2 and
the 3.2v2 Development System.  They cut down on those unnecessary
warnings by making all definitions of NULL consistent and fixing other
quirks of the SCO headers.

Shar and enjoy.

Index: curses.h
***************
*** 49,53 ****
  
  #if defined( M_TERMINFO ) && defined( M_TERMCAP )
! #error Only one of "M_TERMCAP" or "M_TERMINFO" should be #define'd.
  #endif
  
--- 49,54 ----
  
  #if defined( M_TERMINFO ) && defined( M_TERMCAP )
! /* Remove bare apostrophe.  --Chip */
! #error Only one of "M_TERMCAP" or "M_TERMINFO" should be #defined.
  #endif
  

Index: limits.h
***************
*** 23,27 ****
  
  /* Not implemented yet: */
! /* #define	MB_LEN_MAX	1 /* max number of bytes in a multibyte char */
  
  #define	CHAR_BIT	8		/* # of bits in a "char" */
--- 23,28 ----
  
  /* Not implemented yet: */
! /* Closed nested comment.  --Chip */
! /* #define  MB_LEN_MAX  1 */	/* max number of bytes in a multibyte char */
  
  #define	CHAR_BIT	8		/* # of bits in a "char" */
***************
*** 29,39 ****
  #define	SCHAR_MAX	127		/* max integer value of a "signed char" */
  #define	UCHAR_MAX	255		/* max integer value of a "unsigned char" */
! #	ifdef	_CHAR_UNSIGNED		/* defined with -J to msc */
  #define	CHAR_MAX	255		/* max integer value of a "char" */
  #define	CHAR_MIN	0		/* min integer value of a "char" */
! #	else
  #define	CHAR_MAX	127		/* max integer value of a "char" */
  #define	CHAR_MIN	-128		/* min integer value of a "char" */
! #	endif	/* _CHAR_UNSIGNED */
  #define	SHRT_MAX	32767		/* max decimal value of a "short" */
  #define	SHRT_MIN	-32768		/* min decimal value of a "short" */
--- 30,41 ----
  #define	SCHAR_MAX	127		/* max integer value of a "signed char" */
  #define	UCHAR_MAX	255		/* max integer value of a "unsigned char" */
! /* Handle unsigned char for cc and gcc. --Chip */
! #	if	defined(_CHAR_UNSIGNED) || defined(__CHAR_UNSIGNED__)
  #define	CHAR_MAX	255		/* max integer value of a "char" */
  #define	CHAR_MIN	0		/* min integer value of a "char" */
! #	else	/* signed */
  #define	CHAR_MAX	127		/* max integer value of a "char" */
  #define	CHAR_MIN	-128		/* min integer value of a "char" */
! #	endif	/* signed */
  #define	SHRT_MAX	32767		/* max decimal value of a "short" */
  #define	SHRT_MIN	-32768		/* min decimal value of a "short" */
***************
*** 84,88 ****
  #define         _POSIX_NGROUPS_MAX 0    /* minimum value ofr NGROUPS_MAX */
  #define         _POSIX_OPEN_MAX 16      /* minimum value for OPEN_MAX */
! #define         _POSIX_PATH_MAX 255     /* minimum value for PATH_MAX */
  #define         _POSIX_PIPE_BUF 512     /* minimum value for PIPE_BUF */
  
--- 86,91 ----
  #define         _POSIX_NGROUPS_MAX 0    /* minimum value ofr NGROUPS_MAX */
  #define         _POSIX_OPEN_MAX 16      /* minimum value for OPEN_MAX */
! /* Increase _POSIX_PATH_MAX as suggested by SCO dev sys v2 doc.  --Chip */
! #define         _POSIX_PATH_MAX 1024    /* minimum value for PATH_MAX */
  #define         _POSIX_PIPE_BUF 512     /* minimum value for PIPE_BUF */
  

Index: signal.h
***************
*** 27,33 ****
--- 27,39 ----
  #endif
  
+ /* Added sigaction(), sigprocmask(), sigpending(), sigsuspend().  --Chip */
+ 
  #	if defined( __STDC__ ) && !defined( NO_PROTOTYPE )
  extern	void ( *signal( int, void(*)() ) )();
  extern  void ( *sigset( int, void(*)() ) )();
+ extern	int sigaction( int, struct sigaction *, struct sigaction * );
+ extern	int sigprocmask( int, const sigset_t *, sigset_t * );
+ extern	int sigpending( sigset_t * );
+ extern	int sigsuspend( const sigset_t * );
  extern  int ( *ssignal( int, int(*)() ) )();
  #	else
***************
*** 34,37 ****
--- 40,47 ----
  extern	void (*signal())();
  extern  void (*sigset())();
+ extern	int sigaction();
+ extern	int sigprocmask();
+ extern	int sigpending();
+ extern	int sigsuspend();
  extern  int ( *ssignal())();
  #	endif

Index: stddef.h
***************
*** 40,50 ****
  
  #	ifndef	NULL
! #		ifdef	__STDC__
! #			define	NULL	(void *)0
! #		else
! #			define	NULL	(char *)0
! #		endif	/* __STDC__ */
  #	endif	/* NULL */
! #	define	offsetof(type, member)	(&(((type *)0)->member))
  #endif	/* _STDDEF_H */
  
--- 40,48 ----
  
  #	ifndef	NULL
! /* Correct definition of NULL.  --Chip */
! #		define	NULL	0
  #	endif	/* NULL */
! /* offsetof() definition must evaluate to an integral type.  --Chip */
! #	define	offsetof(type, member)	(int)(&(((type *)0)->member))
  #endif	/* _STDDEF_H */
  

Index: stdio.h
***************
*** 74,78 ****
  
  #	ifndef NULL
! #		define NULL		((void*)0)
  #	endif
  
--- 74,79 ----
  
  #	ifndef NULL
! /* Correct definition of NULL.  --Chip */
! #		define NULL		0
  #	endif
  
***************
*** 148,154 ****
  extern char	*cuserid(char *s);
  
! extern int	rename(const char *old, const char *new);
  extern int	fsetpos(FILE *, const fpos_t *);
  extern int	fgetpos(FILE *, fpos_t *);
  #	else
  extern FILE	*fopen(), *fdopen(), *freopen(), *popen(), *tmpfile();
--- 149,159 ----
  extern char	*cuserid(char *s);
  
! /* Deconflict rename() prototype and C++ keyword "new".  --Chip */
! extern int	rename(const char *oldname, const char *newname);
  extern int	fsetpos(FILE *, const fpos_t *);
  extern int	fgetpos(FILE *, fpos_t *);
+ /* Prototype _filbuf and _flsbuf.  --Chip */
+ extern int	_filbuf(FILE *);
+ extern int	_flsbuf(int, FILE *);
  #	else
  extern FILE	*fopen(), *fdopen(), *freopen(), *popen(), *tmpfile();
***************
*** 166,170 ****
  extern size_t	fread(), fwrite();
  #endif
! 
  #	endif	/* if expr */
  extern unsigned char *_bufendtab[];
--- 171,176 ----
  extern size_t	fread(), fwrite();
  #endif
! /* Declare _filbuf and _flsbuf.  --Chip */
! extern int	_filbuf(), _flsbuf();
  #	endif	/* if expr */
  extern unsigned char *_bufendtab[];

Index: stdlib.h
***************
*** 36,40 ****
  #	define EXIT_SUCCESS	0
  #	define RAND_MAX	077777
! /* #	define	MB_CUR_MAX ????	/* huh??? */
  
  
--- 36,41 ----
  #	define EXIT_SUCCESS	0
  #	define RAND_MAX	077777
! /* Un-nest nested comments.  --Chip */
! /* #	define	MB_CUR_MAX ???? */ /* huh??? */
  
  
***************
*** 53,57 ****
  extern void 	free( void * );
  extern void	abort(void);
! /* extern int	atexit (void (*)(void)); */
  extern void	exit( int );
  extern char	*getenv( const char * );
--- 54,59 ----
  extern void 	free( void * );
  extern void	abort(void);
! /* Prototype atexit().  --Chip */
! extern int	atexit( void (*)(void) );
  extern void	exit( int );
  extern char	*getenv( const char * );
***************
*** 80,84 ****
  extern void 	free();
  extern void	abort();
! /* extern int	atexit (); */
  extern void	exit();
  extern char	*getenv();
--- 82,87 ----
  extern void 	free();
  extern void	abort();
! /* Declare atexit().  --Chip */
! extern int	atexit();
  extern void	exit();
  extern char	*getenv();

Index: string.h
***************
*** 18,22 ****
  #	include	<memory.h>
  #	ifndef	NULL
! #		define	NULL	(void *)0
  #	endif	/* NULL */
  
--- 18,23 ----
  #	include	<memory.h>
  #	ifndef	NULL
! /* Correct definition of NULL.  --Chip */
! #		define	NULL	0
  #	endif	/* NULL */
  

Index: unistd.h
***************
*** 12,16 ****
  
  #ifndef NULL
! #	define	NULL	((void *)0)
  #endif /* NULL defined */
  
--- 12,17 ----
  
  #ifndef NULL
! /* Correct definition of NULL.  --Chip */
! #	define	NULL	0
  #endif /* NULL defined */
  
-- 
Chip Salzenberg at Teltronics/TCT     <chip at tct.uucp>, <uunet!pdn!tct!chip>
   "All this is conjecture of course, since I *only* post in the nude.
    Nothing comes between me and my t.b.  Nothing."   -- Bill Coderre



More information about the Comp.sources.bugs mailing list