[gnu.utils.bug] GNU tar 1.07 diffs for USG systems and use of alloca

jkp@SAUNA.HUT.FI (Jyrki Kuoppala) (05/18/89)

Here are diffs to GNU tar 1.07 for se with USG systems.  They address
the following problems:

- on some systems, the ndir include file is <ndir.h> instead of <dirent.h>
- on some systems, the structure for directories is named direct, while
  on others it's dirent
- alloca() in libPW.a often has bugs; these diffs make tar use the gcc
  builtin alloca if compiled with gcc.  This is useful also for other than
  USG systems.
- USG has getcwd() instead of getwd()

Enjoy,

//Jyrki

diff -cr tar-dist/Makefile tar-dist.a/Makefile
*** tar-dist/Makefile	Wed May 17 21:22:37 1989
--- tar-dist.a/Makefile	Thu May 18 02:24:03 1989
***************
*** 26,36 ****
  O = o
  
  # USG version
  #DEFS = -DUSG
  #LOCAL_SRC =  getdate.y rtape_lib.c
  #LOCAL_OBJ =  getdate.$O rtape_lib.$O
  #LDFLAGS =
! #LIBS = -lndir -lPW
  #LINT = lint
  #LINTFLAGS = -p
  #DEF_AR_FILE = \"/dev/rmt8\"
--- 26,42 ----
  O = o
  
  # USG version
+ # Add -DNDIR to DEFS if your system used ndir.h instead of dirent.h
+ # Add -DDIRECT to DEFS if your system uses 'struct direct' instead of
+ # 'struct dirent' (this is the case at least with one add-on ndir 
+ # library)
+ # Add -lndir to LIBS if your ndir routines aren't in libc.a
+ # Add -lPW to LIBS if you don't compile with gcc (to get alloca)
  #DEFS = -DUSG
  #LOCAL_SRC =  getdate.y rtape_lib.c
  #LOCAL_OBJ =  getdate.$O rtape_lib.$O
  #LDFLAGS =
! #LIBS =
  #LINT = lint
  #LINTFLAGS = -p
  #DEF_AR_FILE = \"/dev/rmt8\"
diff -cr tar-dist/create.c tar-dist.a/create.c
*** tar-dist/create.c	Fri Mar 24 01:01:22 1989
--- tar-dist.a/create.c	Thu May 18 01:53:14 1989
***************
*** 47,54 ****
  #include <sys/dir.h>
  #else
  #ifdef USG
! #include "dirent.h"
  #define direct dirent
  #define DP_NAMELEN(x) strlen((x)->d_name)
  #else
  /*
--- 47,60 ----
  #include <sys/dir.h>
  #else
  #ifdef USG
! #ifdef NDIR
! #include <ndir.h>
! #else
! #include <dirent.h>
! #endif
! #ifndef DIRECT
  #define direct dirent
+ #endif
  #define DP_NAMELEN(x) strlen((x)->d_name)
  #else
  /*
diff -cr tar-dist/getdate.y tar-dist.a/getdate.y
*** tar-dist/getdate.y	Thu Mar  2 20:02:16 1989
--- tar-dist.a/getdate.y	Thu May 18 02:09:20 1989
***************
*** 26,31 ****
--- 26,39 ----
  #include <time.h>
  #endif /* sane */
  
+ #ifdef __GNUC__
+ #define alloca __builtin_alloca
+ #else
+ #ifdef sparc
+ #include <alloca.h>
+ #endif
+ #endif
+ 
  #define	NULL	0
  #define daysec (24L*60L*60L)
  	static int timeflag, zoneflag, dateflag, dayflag, relflag;
diff -cr tar-dist/port.c tar-dist.a/port.c
*** tar-dist/port.c	Wed Mar 29 17:24:55 1989
--- tar-dist.a/port.c	Thu May 18 02:08:32 1989
***************
*** 850,857 ****
  }
  
  #include <ctype.h>
  #ifdef sparc
! #include "alloca.h"
  #endif
  
  /* Quote_copy_string is like quote_string, but instead of modifying the
--- 850,861 ----
  }
  
  #include <ctype.h>
+ #ifdef __GNUC__
+ #define alloca __builtin_alloca
+ #else
  #ifdef sparc
! #include <alloca.h>
! #endif
  #endif
  
  /* Quote_copy_string is like quote_string, but instead of modifying the
diff -cr tar-dist/rtape_lib.c tar-dist.a/rtape_lib.c
*** tar-dist/rtape_lib.c	Thu Mar 23 22:27:40 1989
--- tar-dist.a/rtape_lib.c	Thu May 18 01:58:14 1989
***************
*** 387,392 ****
--- 387,394 ----
  				"/etc/rmt", (char *) 0);
  			execl("/usr/bin/remsh", "remsh", system, "-l", login,
  				"/etc/rmt", (char *) 0);
+ 			execl("/usr/bin/rsh", "rsh", system, "-l", login,
+ 				"/etc/rmt", (char *) 0);
  		}
  		else
  		{
***************
*** 393,398 ****
--- 395,402 ----
  			execl("/usr/ucb/rsh", "rsh", system,
  				"/etc/rmt", (char *) 0);
  			execl("/usr/bin/remsh", "remsh", system,
+ 				"/etc/rmt", (char *) 0);
+ 			execl("/usr/bin/rsh", "rsh", system,
  				"/etc/rmt", (char *) 0);
  		}
  
diff -cr tar-dist/tar.c tar-dist.a/tar.c
*** tar-dist/tar.c	Tue May 16 21:06:53 1989
--- tar-dist.a/tar.c	Thu May 18 02:10:04 1989
***************
*** 42,49 ****
--- 42,55 ----
  #include <sys/dir.h>
  #else
  #ifdef USG
+ #ifdef NDIR
+ #include <ndir.h>
+ #else
  #include <dirent.h>
+ #endif
+ #ifndef DIRECT
  #define direct dirent
+ #endif
  #define DP_NAMELEN(x) strlen((x)->d_name)
  #else
  /*
***************
*** 663,669 ****
  		}
  		if(chdir_name[0]!='/') {
  			char path[MAXPATHLEN];
! #ifdef MSDOS
  			int getcwd();
  
  			if(!getcwd(path,MAXPATHLEN))
--- 669,675 ----
  		}
  		if(chdir_name[0]!='/') {
  			char path[MAXPATHLEN];
! #if defined(MSDOS) || defined(USG)
  			int getcwd();
  
  			if(!getcwd(path,MAXPATHLEN))
diff -cr tar-dist/tar.h tar-dist.a/tar.h
*** tar-dist/tar.h	Fri Mar 24 01:01:20 1989
--- tar-dist.a/tar.h	Thu May 18 01:45:25 1989
***************
*** 37,42 ****
--- 37,45 ----
  #define TAR_EXTERN extern
  #endif
  
+ #ifdef USG
+ typedef int size_t;
+ #endif
  /*
   * Header block on tape.
   *