[gnu.bash.bug] Bash 1.04 patch: readdir

chip@ateng.ateng.com (Chip Salzenberg) (01/23/90)

These patches make Bash compile with SCO Xenix 2.3 directory reading routines,
which use <sys/ndir.h> to declare BSD-compatible opendir(), readdir(), etc.

Index: glob.c
***************
*** 22,39 ****
  #include <sys/types.h>
  
! #if	defined(USGr3) || defined(DIRENT)
  #include <dirent.h>
  #define direct dirent
  #define	D_NAMLEN(d) strlen((d)->d_name)
! #else	/* Not USGr3 and not DIRENT.  */
  #define D_NAMLEN(d) ((d)->d_namlen)
! #	ifdef	USG
  #include "ndir.h"   /* Get ndir.h from the Emacs distribution.  */
! #	else	/* Not USG.  */
  #include <sys/dir.h>
! #	endif	/* USG.  */
! #endif	/* USGr3 or DIRENT.  */
  
! #ifdef USG
  #include <memory.h>
  #include <string.h>
--- 22,43 ----
  #include <sys/types.h>
  
! #if     defined(SYSVR3) || defined(DIRENT)
  #include <dirent.h>
  #define direct dirent
  #define	D_NAMLEN(d) strlen((d)->d_name)
! #else   /* Not SYSVR3 and not DIRENT.  */
  #define D_NAMLEN(d) ((d)->d_namlen)
! #       ifdef   M_XENIX
! #include <sys/ndir.h>
! #       else    /* Not Xenix. */
! #       ifdef   SYSV
  #include "ndir.h"   /* Get ndir.h from the Emacs distribution.  */
! #       else    /* Not SYSV.  */
  #include <sys/dir.h>
! #       endif   /* SYSV.  */
! #       endif   /* Xenix. */
! #endif  /* SYSVR3 or DIRENT.  */
  
! #ifdef SYSV
  #include <memory.h>
  #include <string.h>
***************
*** 41,49 ****
  #define rindex	strrchr
  
! #else /* not USG */
  #include <strings.h>
  
  extern void bcopy ();
! #endif /* not USG */
  
  #ifdef	__GNUC__
--- 45,53 ----
  #define rindex	strrchr
  
! #else /* not SYSV */
  #include <strings.h>
  
  extern void bcopy ();
! #endif /* not SYSV */
  
  #ifdef	__GNUC__

Index: readline/readline.c
***************
*** 72,78 ****
  #include <sys/dir.h>
  #else  /* SYSV */
  #ifdef hpux
  #include <ndir.h>
! #else
  #include <dirent.h>
  #define direct dirent
--- 72,81 ----
  #include <sys/dir.h>
  #else  /* SYSV */
+ #ifdef   M_XENIX
+ #include <sys/ndir.h>
+ #else    /* not Xenix */
  #ifdef hpux
  #include <ndir.h>
! #else    /* not hpux */
  #include <dirent.h>
  #define direct dirent
***************
*** 79,82 ****
--- 82,86 ----
  #define d_namlen d_reclen
  #endif  /* hpux */
+ #endif  /* Xenix */
  #endif  /* SYSV */