Subject: Re: TexInfo3.1
To: Peter Seebach <seebs@solutions.solon.com>
From: David Carrel <carrel@cisco.com>
List: current-users
Date: 10/12/1994 23:50:50
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"

texinfo 3.1 has off_t problems due to a lack of prototypes and yes, did
have problems with malloc.  The following diff will get you going.  I sent
this in a while ago, but it doesn't appear that any maintenance is being
done on texinfo.

Dave


------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-Description: texinfo-3.1.diff

diff -r -c texinfo-3.1.orig/info/dir.c texinfo-3.1/info/dir.c
*** texinfo-3.1.orig/info/dir.c	Sat Apr 17 14:25:27 1993
--- texinfo-3.1/info/dir.c	Sun May  8 18:00:01 1994
***************
*** 30,35 ****
--- 30,39 ----
  #include "filesys.h"
  #include "tilde.h"
  
+ #if defined(HAVE_UNISTD_H)
+ #include <unistd.h>
+ #endif
+ 
  /* The "dir" node can be built from the contents of a file called "dir",
     with the addition of the menus of every file called "localdir" found in
     INFOPATH. */
diff -r -c texinfo-3.1.orig/info/filesys.c texinfo-3.1/info/filesys.c
*** texinfo-3.1.orig/info/filesys.c	Fri May 21 13:51:43 1993
--- texinfo-3.1/info/filesys.c	Sun May  8 18:09:47 1994
***************
*** 30,35 ****
--- 30,39 ----
  #include "tilde.h"
  #include "filesys.h"
  
+ #if defined(HAVE_UNISTD_H)
+ #include <unistd.h>
+ #endif
+ 
  #if !defined (O_RDONLY)
  #if defined (HAVE_SYS_FCNTL_H)
  #include <sys/fcntl.h>
***************
*** 582,589 ****
--- 586,595 ----
  int filesys_error_number = 0;
  
  #if !defined (HAVE_STRERROR)
+ #ifndef __NetBSD__
  extern char *sys_errlist[];
  extern int sys_nerr;
+ #endif /* __NetBSD__ */
  
  char *
  strerror (num)
diff -r -c texinfo-3.1.orig/info/general.h texinfo-3.1/info/general.h
*** texinfo-3.1.orig/info/general.h	Mon Feb  1 10:44:09 1993
--- texinfo-3.1/info/general.h	Sun May  8 18:19:06 1994
***************
*** 24,30 ****
--- 24,34 ----
  #if !defined (_GENERAL_H_)
  #define _GENERAL_H_
  
+ #ifdef __STDC__
+ extern void *xmalloc(int), *xrealloc(void *, int);
+ #else /* __STDC__ */
  extern void *xmalloc (), *xrealloc ();
+ #endif /* __STDC__ */
  
  #if defined (HAVE_UNISTD_H)
  #  include <unistd.h>
diff -r -c texinfo-3.1.orig/info/makedoc.c texinfo-3.1/info/makedoc.c
*** texinfo-3.1.orig/info/makedoc.c	Fri May 21 13:50:53 1993
--- texinfo-3.1/info/makedoc.c	Sun May  8 17:59:10 1994
***************
*** 33,38 ****
--- 33,42 ----
  #include <sys/stat.h>
  #include "general.h"
  
+ #if defined(HAVE_UNISTD_H)
+ #include <unistd.h>
+ #endif
+ 
  #if !defined (O_RDONLY)
  #if defined (HAVE_SYS_FCNTL_H)
  #include <sys/fcntl.h>
diff -r -c texinfo-3.1.orig/info/nodes.c texinfo-3.1/info/nodes.c
*** texinfo-3.1.orig/info/nodes.c	Fri May 21 13:50:25 1993
--- texinfo-3.1/info/nodes.c	Sun May  8 17:59:30 1994
***************
*** 32,37 ****
--- 32,41 ----
  #include "filesys.h"
  #include "info-utils.h"
  
+ #if defined(HAVE_UNISTD_H)
+ #include <unistd.h>
+ #endif
+ 
  #if !defined (O_RDONLY)
  #if defined (HAVE_SYS_FCNTL_H)
  #include <sys/fcntl.h>
diff -r -c texinfo-3.1.orig/info/tilde.c texinfo-3.1/info/tilde.c
*** texinfo-3.1.orig/info/tilde.c	Mon Feb  1 10:40:20 1993
--- texinfo-3.1/info/tilde.c	Sun May  8 18:34:00 1994
***************
*** 49,58 ****
  #endif
  
  #if defined (TEST) || defined (STATIC_MALLOC)
! static char *xmalloc (), *xrealloc ();
  #else
! extern char *xmalloc (), *xrealloc ();
  #endif /* TEST || STATIC_MALLOC */
  
  /* The default value of tilde_additional_prefixes.  This is set to
     whitespace preceding a tilde so that simple programs which do not
--- 49,63 ----
  #endif
  
  #if defined (TEST) || defined (STATIC_MALLOC)
! static
  #else
! extern
  #endif /* TEST || STATIC_MALLOC */
+ #ifdef __STDC__
+ void *xmalloc (int), *xrealloc (void *, int);
+ #else /* __STDC__ */
+ void *xmalloc (), *xrealloc ();
+ #endif /* __STDC__ */
  
  /* The default value of tilde_additional_prefixes.  This is set to
     whitespace preceding a tilde so that simple programs which do not
***************
*** 334,342 ****
  
  static void memory_error_and_abort ();
  
! static char *
  xmalloc (bytes)
       int bytes;
  {
    char *temp = (char *)malloc (bytes);
  
--- 339,351 ----
  
  static void memory_error_and_abort ();
  
! static void *
! #ifdef __STDC__
! xmalloc (int bytes)
! #else /* __STDC__ */
  xmalloc (bytes)
       int bytes;
+ #endif /* __STDC__ */
  {
    char *temp = (char *)malloc (bytes);
  
***************
*** 345,354 ****
    return (temp);
  }
  
! static char *
  xrealloc (pointer, bytes)
       char *pointer;
       int bytes;
  {
    char *temp;
  
--- 354,367 ----
    return (temp);
  }
  
! static void *
! #ifdef __STDC__
! xrealloc (void *pointer, int bytes)
! #else /* __STDC__ */
  xrealloc (pointer, bytes)
       char *pointer;
       int bytes;
+ #endif /* __STDC__ */
  {
    char *temp;
  
diff -r -c texinfo-3.1.orig/info/xmalloc.c texinfo-3.1/info/xmalloc.c
*** texinfo-3.1.orig/info/xmalloc.c	Mon Feb  1 10:40:42 1993
--- texinfo-3.1/info/xmalloc.c	Sun May  8 18:18:30 1994
***************
*** 40,47 ****
--- 40,51 ----
     to hold BYTES number of bytes.  If the memory cannot be allocated,
     print an error message and abort. */
  void *
+ #ifdef __STDC__
+ xmalloc (int bytes)
+ #else /* __STDC__ */
  xmalloc (bytes)
       int bytes;
+ #endif /* __STDC__ */
  {
    void *temp = (void *)malloc (bytes);
  
***************
*** 51,59 ****
--- 55,67 ----
  }
  
  void *
+ #ifdef __STDC__
+ xrealloc (void *pointer, int bytes)
+ #else /* __STDC__ */
  xrealloc (pointer, bytes)
       void *pointer;
       int bytes;
+ #endif /* __STDC__ */
  {
    void *temp;
  
diff -r -c texinfo-3.1.orig/makeinfo/makeinfo.c texinfo-3.1/makeinfo/makeinfo.c
*** texinfo-3.1.orig/makeinfo/makeinfo.c	Sat May 22 16:29:46 1993
--- texinfo-3.1/makeinfo/makeinfo.c	Sun May  8 18:25:39 1994
***************
*** 103,108 ****
--- 103,112 ----
  
  #include <sys/file.h>
  
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif /* HAVE_UNISTD_H */
+ 
  #if defined (__GNUC__)
  #define alloca __builtin_alloca
  #else
***************
*** 115,121 ****
--- 119,129 ----
  #endif /* !HAVE_ALLOCA_H */
  #endif /* !__GNUC__ */
  
+ #ifdef __STDC__
+ void *xmalloc (int), *xrealloc(void *, int);
+ #else /* __STDC__ */
  void *xmalloc (), *xrealloc ();
+ #endif /* __STDC__ */
  static void isolate_nodename ();
  
  /* Non-zero means that we are currently hacking the insides of an
***************
*** 901,908 ****
--- 909,920 ----
  
  /* Just like malloc, but kills the program in case of fatal error. */
  void *
+ #ifdef __STDC__
+ xmalloc (int nbytes)
+ #else /* __STDC__ */
  xmalloc (nbytes)
       int nbytes;
+ #endif /* __STDC__ */
  {
    void *temp = (void *) malloc (nbytes);
  
***************
*** 914,922 ****
--- 926,938 ----
  
  /* Like realloc (), but barfs if there isn't enough memory. */
  void *
+ #ifdef __STDC__
+ xrealloc (void *pointer, int nbytes)
+ #else /* __STDC__ */
  xrealloc (pointer, nbytes)
       void *pointer;
       int nbytes;
+ #endif /* __STDC__ */
  {
    void *temp;
  
***************
*** 6388,6395 ****
--- 6404,6413 ----
  
    if (!find_and_load (filename))
      {
+ #ifndef __NetBSD__
        extern char *sys_errlist[];
        extern int errno, sys_nerr;
+ #endif
        popfile ();
  
        /* Cannot "@include foo", in line 5 of "/wh/bar". */
diff -r -c texinfo-3.1.orig/util/texindex.c texinfo-3.1/util/texindex.c
*** texinfo-3.1.orig/util/texindex.c	Fri Dec 11 08:19:49 1992
--- texinfo-3.1/util/texindex.c	Sun May  8 18:26:34 1994
***************
*** 49,56 ****
--- 49,59 ----
  #    define noshare
  #  endif /* !VAX11C */
  #  include <perror.h>
+ 
+ #ifndef __NetBSD__
  extern noshare int sys_nerr;
  extern noshare char *sys_errlist[];
+ #endif /* __NetBSD__ */
  
  #  include <file.h>
  
***************
*** 60,67 ****
--- 63,72 ----
  
  #else /* !VMS */
  
+ #ifndef __NetBSD__
  extern int sys_nerr;
  extern char *sys_errlist[];
+ #endif /* __NetBSD__ */
  
  #  if defined (HAVE_SYS_FCNTL_H)
  #    include <sys/types.h>
***************
*** 179,185 ****
--- 184,194 ----
  void pfatal_with_name ();
  void fatal ();
  void error ();
+ #ifdef __STDC__
+ void *xmalloc (int), *xrealloc (void *, int);
+ #else /* __STDC__ */
  void *xmalloc (), *xrealloc ();
+ #endif /* __STDC__ */
  char *concat ();
  char *maketempname ();
  void flush_tempfiles ();
***************
*** 1631,1638 ****
--- 1640,1651 ----
  
  /* Just like malloc, but kills the program in case of fatal error. */
  void *
+ #ifdef __STDC__
+ xmalloc (int nbytes)
+ #else /* __STDC__ */
  xmalloc (nbytes)
       int nbytes;
+ #endif /* __STDC__ */
  {
    void *temp = (void *) malloc (nbytes);
  
***************
*** 1644,1652 ****
--- 1657,1669 ----
  
  /* Like realloc (), but barfs if there isn't enough memory. */
  void *
+ #ifdef __STDC__
+ xrealloc (void *pointer, int nbytes)
+ #else /* __STDC__ */
  xrealloc (pointer, nbytes)
       void *pointer;
       int nbytes;
+ #endif /* __STDC__ */
  {
    void *temp;
  

------- =_aaaaaaaaaa0--