[comp.sys.sgi] 'expand.c' diffs for ksh-i under SGI UNIX

jmb@patton.SGI.COM (Jim Barton) (08/08/88)

Several people have asked for what I did to make ksh filename handling
work under IRIX.  Following is a context diff for 'expand.c' in the sh/
directory.  Apply by hand or with 'patch' or other suitable tool.  Note
that this is for KSH-I.  For older versions of ksh, the fix is essentially
identical.  (I've been involved with SIGGRAPH very heavily the last
few weeks, and thus the delay ...).

Also remember to add '-lsun -lbsd' in the link line to insure getting
routines that cooperate with NFS and Yellow Pages.

-- Jim Barton
Silicon Graphics Computing Systems    "UNIX: Live Free Or Die!"
jmb@sgi.sgi.com, sgi!jmb@decwrl.dec.com, ...{decwrl,sun}!sgi!jmb

  "I used to be disgusted, now I'm just amused."
			- Elvis Costello, 'Red Shoes'
--
----------------------- cut here ------------------------------------

*** expand.c	Sun Aug  7 14:35:27 1988
--- Oexpand.c	Sun Aug  7 14:35:38 1988
***************
*** 22,27
  
  #include	<sys/types.h>
  #include	<sys/stat.h>
  #include	"defs.h"
  #include	"brkincr.h"
  #include	"stak.h"

--- 22,28 -----
  
  #include	<sys/types.h>
  #include	<sys/stat.h>
+ #include	<sys/dir.h>
  #include	"defs.h"
  #include	"brkincr.h"
  #include	"stak.h"
***************
*** 28,45
  #include	"sym.h"
  #include	"shtype.h"
  
- #ifdef mips
- #	define	BSD_4_2
- #	include	<dirent.h>
- #else
- # ifdef sgi
- #	define	BSD_4_2
- #	include	<ndir.h>
- # else
- #	include	<sys/dir.h>
- # endif
- #endif
- 
  void	rm_files();
  int	expand();
  

--- 29,34 -----
  #include	"sym.h"
  #include	"shtype.h"
  
  void	rm_files();
  int	expand();
  
***************
*** 83,92
  	/* this union forces enough space for the NULL byte */
  	union Dirent
  	{
- # ifdef mips
- 		struct dirent	entry;
- 		char entrybuf[sizeof(struct dirent)+1]; /* room for null byte */
- # else
  		struct direct	entry;
  		char entrybuf[sizeof(struct direct)+1]; /* room for null byte */
  # endif

--- 72,77 -----
  	/* this union forces enough space for the NULL byte */
  	union Dirent
  	{
  		struct direct	entry;
  		char entrybuf[sizeof(struct direct)+1]; /* room for null byte */
  	};
***************
*** 89,95
  # else
  		struct direct	entry;
  		char entrybuf[sizeof(struct direct)+1]; /* room for null byte */
- # endif
  	};
  	union Dirent dirent;
  # ifdef mips

--- 74,79 -----
  	{
  		struct direct	entry;
  		char entrybuf[sizeof(struct direct)+1]; /* room for null byte */
  	};
  	union Dirent dirent;
  	struct direct	*entry = &dirent.entry;
***************
*** 92,100
  # endif
  	};
  	union Dirent dirent;
- # ifdef mips
- 	struct dirent	*entry = &dirent.entry;
- # else
  	struct direct	*entry = &dirent.entry;
  # endif
  #ifndef BSD_4_2

--- 76,81 -----
  		char entrybuf[sizeof(struct direct)+1]; /* room for null byte */
  	};
  	union Dirent dirent;
  	struct direct	*entry = &dirent.entry;
  #ifndef BSD_4_2
  	char dirbuff[BUFSIZ];
***************
*** 96,102
  	struct dirent	*entry = &dirent.entry;
  # else
  	struct direct	*entry = &dirent.entry;
- # endif
  #ifndef BSD_4_2
  	char dirbuff[BUFSIZ];
  #endif	/* BSD_4_2 */

--- 77,82 -----
  	};
  	union Dirent dirent;
  	struct direct	*entry = &dirent.entry;
  #ifndef BSD_4_2
  	char dirbuff[BUFSIZ];
  #endif	/* BSD_4_2 */