diff -crN orig/README new/README
*** orig/README	Mon Jul  5 13:41:50 1993
--- new/README	Wed Nov  1 22:03:22 2000
***************
*** 7,21 ****
  your system supports remote command execution, and tape drive control
  operations, respectively.
  
! See the file INSTALL for compilation and installation instructions for Unix.
! 
! For non-Unix systems:
! 
! makefile.pc is a makefile for Turbo C or C++ or Borland C++ on MS-DOS.
! 
! makefile.os2 is a makefile for MS C and GNU C (emx/gcc) on OS/2.
! cpio.def is a linker definition file for the MS C OS/2 version.
! 
  
  The main advantages of GNU cpio over Unix versions are:
  
--- 7,15 ----
  your system supports remote command execution, and tape drive control
  operations, respectively.
  
! This DOS build is supported by Dosius.  Try compiling in the Turbo C++
! 1.01 IDE using the cpio.prj file I created.  If you have any questions,
! contact me at steve@dosius.zzn.com
  
  The main advantages of GNU cpio over Unix versions are:
  
***************
*** 69,71 ****
--- 63,68 ----
  
  Mail suggestions and bug reports for GNU cpio to
  bug-gnu-utils@prep.ai.mit.edu.
+ 
+ Mail bug reports for GNU cpio under 16-bit DOS to
+ steve@dosius.zzn.com .
diff -crN orig/copyin.c new/copyin.c
*** orig/copyin.c	Wed Nov 30 16:49:06 1994
--- new/copyin.c	Tue Oct 31 21:59:42 2000
***************
*** 18,23 ****
--- 18,30 ----
  #include <stdio.h>
  #include <sys/types.h>
  #include <sys/stat.h>
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ #if (defined(BSD) && (BSD >= 199306))
+ #define HAVE_STRFTIME
+ #include <ctype.h>
+ #endif
  #include "filetypes.h"
  #include "system.h"
  #include "cpiohdr.h"
***************
*** 25,33 ****
  #include "extern.h"
  #include "defer.h"
  #include "rmt.h"
! #ifndef	FNM_PATHNAME
! #include <fnmatch.h>
! #endif
  
  #ifndef HAVE_LCHOWN
  #define lchown chown
--- 32,40 ----
  #include "extern.h"
  #include "defer.h"
  #include "rmt.h"
! //#ifndef	FNM_PATHNAME
! //#include <fnmatch.h>
! //#endif
  
  #ifndef HAVE_LCHOWN
  #define lchown chown
***************
*** 512,518 ****
  	  for (i = 0; i < num_patterns
  	       && skip_file == copy_matching_files; i++)
  	    {
! 	      if (fnmatch (save_patterns[i], file_hdr.c_name, 0) == 0)
  		skip_file = !copy_matching_files;
  	    }
  	}
--- 519,525 ----
  	  for (i = 0; i < num_patterns
  	       && skip_file == copy_matching_files; i++)
  	    {
! //	      if (fnmatch (save_patterns[i], file_hdr.c_name, 0) == 0)
  		skip_file = !copy_matching_files;
  	    }
  	}
***************
*** 921,933 ****
  		  break;
  		}
  	      
! 	      res = mknod (file_hdr.c_name, file_hdr.c_mode,
! 			makedev (file_hdr.c_rdev_maj, file_hdr.c_rdev_min));
  	      if (res < 0 && create_dir_flag)
  		{
  		  create_all_directories (file_hdr.c_name);
! 		  res = mknod (file_hdr.c_name, file_hdr.c_mode,
! 			makedev (file_hdr.c_rdev_maj, file_hdr.c_rdev_min));
  		}
  	      if (res < 0)
  		{
--- 928,951 ----
  		  break;
  		}
  	      
! #ifdef CP_IFIFO
! 	      if ((file_hdr.c_mode & CP_IFMT) == CP_IFIFO)
! 		res = mkfifo (file_hdr.c_name, file_hdr.c_mode);
! 	      else
! #endif
! 		res = mknod (file_hdr.c_name, file_hdr.c_mode,
! 		      makedev (file_hdr.c_rdev_maj, file_hdr.c_rdev_min));
  	      if (res < 0 && create_dir_flag)
  		{
  		  create_all_directories (file_hdr.c_name);
! #ifdef CP_IFIFO
! 		  if ((file_hdr.c_mode & CP_IFMT) == CP_IFIFO)
! 		    res = mkfifo (file_hdr.c_name, file_hdr.c_mode);
! 		  else
! #endif
! 		    res = mknod (file_hdr.c_name, file_hdr.c_mode,
! 				 makedev (file_hdr.c_rdev_maj,
! 					  file_hdr.c_rdev_min));
  		}
  	      if (res < 0)
  		{
***************
*** 1043,1049 ****
--- 1061,1071 ----
  
    /* Get time values ready to print.  */
    when = file_hdr->c_mtime;
+ #ifdef HAVE_STRFTIME
+   strftime(tbuf, sizeof(tbuf), "%c", localtime(&when));
+ #else
    strcpy (tbuf, ctime (&when));
+ #endif
    if (current_time - when > 6L * 30L * 24L * 60L * 60L
        || current_time - when < 0L)
      {
***************
*** 1053,1059 ****
      }
    tbuf[16] = '\0';
  
!   printf ("%s %3u ", mbuf, file_hdr->c_nlink);
  
  #ifndef __MSDOS__
    if (numeric_uid)
--- 1075,1081 ----
      }
    tbuf[16] = '\0';
  
!   printf ("%s %3lu ", mbuf, file_hdr->c_nlink);
  
  #ifndef __MSDOS__
    if (numeric_uid)
***************
*** 1067,1074 ****
  
    if ((file_hdr->c_mode & CP_IFMT) == CP_IFCHR
        || (file_hdr->c_mode & CP_IFMT) == CP_IFBLK)
!     printf ("%3u, %3u ", file_hdr->c_rdev_maj,
! 	    file_hdr->c_rdev_min);
    else
  #endif
      printf ("%8lu ", file_hdr->c_filesize);
--- 1089,1095 ----
  
    if ((file_hdr->c_mode & CP_IFMT) == CP_IFCHR
        || (file_hdr->c_mode & CP_IFMT) == CP_IFBLK)
!     printf ("%3lu, %3lu ", file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
    else
  #endif
      printf ("%8lu ", file_hdr->c_filesize);
***************
*** 1129,1134 ****
--- 1150,1158 ----
  	  break;
  
  	default:
+ #if (defined(BSD) && (BSD >= 199306))
+ 	  if (isprint(c))
+ #else
  	  if (c > 040 &&
  #ifdef __MSDOS__
  	      c < 0377 && c != 0177
***************
*** 1136,1141 ****
--- 1160,1166 ----
  	      c < 0177
  #endif
  	    )
+ #endif
  	    putchar (c);
  	  else
  	    printf ("\\%03o", (unsigned int) c);
***************
*** 1306,1312 ****
    
    for (d = deferments; d != NULL; d = d->next)
      {
-       d = deferments;
        link_res = link_to_maj_min_ino (d->header.c_name, 
  		    d->header.c_dev_maj, d->header.c_dev_maj,
  		    d->header.c_ino);
--- 1331,1336 ----
diff -crN orig/copyout.c new/copyout.c
*** orig/copyout.c	Wed Jan 10 10:10:45 1996
--- new/copyout.c	Sun Mar 30 10:34:16 1997
***************
*** 35,40 ****
--- 35,41 ----
  static void writeout_other_defers ();
  static void writeout_final_defers();
  static void writeout_defered_file ();
+ static int check_rdev ();
  
  /* Write out header FILE_HDR, including the file name, to file
     descriptor OUT_DES.  */
***************
*** 293,300 ****
  	  file_hdr.c_uid = file_stat.st_uid;
  	  file_hdr.c_gid = file_stat.st_gid;
  	  file_hdr.c_nlink = file_stat.st_nlink;
! 	  file_hdr.c_rdev_maj = major (file_stat.st_rdev);
! 	  file_hdr.c_rdev_min = minor (file_stat.st_rdev);
  	  file_hdr.c_mtime = file_stat.st_mtime;
  	  file_hdr.c_filesize = file_stat.st_size;
  	  file_hdr.c_chksum = 0;
--- 294,325 ----
  	  file_hdr.c_uid = file_stat.st_uid;
  	  file_hdr.c_gid = file_stat.st_gid;
  	  file_hdr.c_nlink = file_stat.st_nlink;
! 
! 	  /* The rdev is meaningless except for block and character
! 	     special files (POSIX standard) and perhaps fifos and
! 	     sockets.  Clear it for other types of files so that
! 	     check_rdev() doesn't reject files just because stat()
! 	     put garbage in st_rdev and so that the output doesn't
! 	     depend on the garbage.  */
! 	  switch (file_hdr.c_mode & CP_IFMT)
! 	    {
! 	      case CP_IFBLK:
! 	      case CP_IFCHR:
! #ifdef CP_IFIFO
! 	      case CP_IFIFO:
! #endif
! #ifdef CP_IFSOCK
! 	      case CP_IFSOCK:
! #endif
! 		file_hdr.c_rdev_maj = major (file_stat.st_rdev);
! 		file_hdr.c_rdev_min = minor (file_stat.st_rdev);
! 		break;
! 	      default:
! 	      	file_hdr.c_rdev_maj = 0;
! 		file_hdr.c_rdev_min = 0;
! 		break;
! 	    }
! 
  	  file_hdr.c_mtime = file_stat.st_mtime;
  	  file_hdr.c_filesize = file_stat.st_size;
  	  file_hdr.c_chksum = 0;
***************
*** 338,343 ****
--- 363,385 ----
  	      continue;
  	    }
  
+ 	  switch (check_rdev (&file_hdr))
+ 	    {
+ 	      case 1:
+ 		error (0, 0, "%s not dumped: major number would be truncated",
+ 		       file_hdr.c_name);
+ 		continue;
+ 	      case 2:
+ 		error (0, 0, "%s not dumped: minor number would be truncated",
+ 		       file_hdr.c_name);
+ 		continue;
+ 	      case 4:
+ 		error (0, 0, "%s not dumped: device number would be truncated",
+ 		       file_hdr.c_name);
+ 		continue;
+ 	    }
+ 
+ 
  	  /* Copy the named file to the output.  */
  	  switch (file_hdr.c_mode & CP_IFMT)
  	    {
***************
*** 804,807 ****
--- 846,945 ----
  	error (0, errno, "%s", file_hdr.c_name);
      }
    return;
+ }
+ 
+ 
+ static int
+ check_rdev (file_hdr)
+      struct new_cpio_header *file_hdr;
+ {
+   if (archive_format == arf_newascii || archive_format == arf_crcascii)
+     {
+       if ((file_hdr->c_rdev_maj & 0xFFFFFFFF) != file_hdr->c_rdev_maj)
+         return 1;
+       if ((file_hdr->c_rdev_min & 0xFFFFFFFF) != file_hdr->c_rdev_min)
+         return 2;
+     }
+   else if (archive_format == arf_oldascii || archive_format == arf_hpoldascii)
+     {
+ #ifndef __MSDOS__
+       dev_t rdev;
+ 
+       rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
+       if (archive_format == arf_oldascii)
+ 	{
+ 	  if ((rdev & 0xFFFF) != rdev)
+ 	    return 4;
+ 	}
+       else
+ 	{
+ 	  switch (file_hdr->c_mode & CP_IFMT)
+ 	    {
+ 	      case CP_IFCHR:
+ 	      case CP_IFBLK:
+ #ifdef CP_IFSOCK
+ 	      case CP_IFSOCK:
+ #endif
+ #ifdef CP_IFIFO
+ 	      case CP_IFIFO:
+ #endif
+ 		/* We could handle one more bit if longs are >= 33 bits.  */
+ 		if ((rdev & 037777777777) != rdev)
+ 		  return 4;
+ 		break;
+ 	      default:
+ 		if ((rdev & 0xFFFF) != rdev)
+ 		  return 4;
+ 		break;
+ 	    }
+ 	}
+ #endif
+     }
+   else if (archive_format == arf_tar || archive_format == arf_ustar)
+     {
+       /* The major and minor formats are limited to 7 octal digits in ustar
+ 	 format, and to_oct () adds a gratuitous trailing blank to further
+ 	 limit the format to 6 octal digits.  */
+       if ((file_hdr->c_rdev_maj & 0777777) != file_hdr->c_rdev_maj)
+         return 1;
+       if ((file_hdr->c_rdev_min & 0777777) != file_hdr->c_rdev_min)
+         return 2;
+     }
+   else
+     {
+ #ifndef __MSDOS__
+       dev_t rdev;
+ 
+       rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
+       if (archive_format != arf_hpbinary)
+ 	{
+ 	  if ((rdev & 0xFFFF) != rdev)
+ 	return 4;
+     }
+   else
+     {
+       switch (file_hdr->c_mode & CP_IFMT)
+ 	{
+ 	  case CP_IFCHR:
+ 	  case CP_IFBLK:
+ #ifdef CP_IFSOCK
+ 	  case CP_IFSOCK:
+ #endif
+ #ifdef CP_IFIFO
+ 	  case CP_IFIFO:
+ #endif
+ 	    if ((rdev & 0xFFFFFFFF) != rdev)
+ 	      return 4;
+ 	    file_hdr->c_filesize = rdev;
+ 	    rdev = makedev (0, 1);
+ 	    break;
+ 	  default:
+ 	    if ((rdev & 0xFFFF) != rdev)
+ 	      return 4;
+ 	    break;
+ 	}
+     }
+ #endif
+   }
+   return 0;
  }
diff -crN orig/copypass.c new/copypass.c
*** orig/copypass.c	Mon Jan  8 15:59:05 1996
--- new/copypass.c	Sun Jul 13 14:07:48 1997
***************
*** 295,307 ****
  
  	  if (link_res < 0)
  	    {
! 	      res = mknod (output_name.ds_string, in_file_stat.st_mode,
! 			   in_file_stat.st_rdev);
  	      if (res < 0 && create_dir_flag)
  		{
  		  create_all_directories (output_name.ds_string);
! 		  res = mknod (output_name.ds_string, in_file_stat.st_mode,
! 			       in_file_stat.st_rdev);
  		}
  	      if (res < 0)
  		{
--- 295,317 ----
  
  	  if (link_res < 0)
  	    {
! #ifdef S_ISFIFO
! 	      if (S_ISFIFO (in_file_stat.st_mode))
! 		res = mkfifo (output_name.ds_string, in_file_stat.st_mode);
! 	      else
! #endif
! 		res = mknod (output_name.ds_string, in_file_stat.st_mode,
! 			     in_file_stat.st_rdev);
  	      if (res < 0 && create_dir_flag)
  		{
  		  create_all_directories (output_name.ds_string);
! #ifdef S_ISFIFO
! 		  if (S_ISFIFO (in_file_stat.st_mode))
! 		    res = mkfifo (output_name.ds_string, in_file_stat.st_mode);
! 		  else
! #endif
! 		    res = mknod (output_name.ds_string, in_file_stat.st_mode,
! 				 in_file_stat.st_rdev);
  		}
  	      if (res < 0)
  		{
diff -crN orig/dirname.c new/dirname.c
*** orig/dirname.c	Fri Oct  7 12:21:31 1994
--- new/dirname.c	Tue Oct 31 21:42:56 2000
***************
*** 18,24 ****
  #ifdef HAVE_CONFIG_H
  #include <config.h>
  #endif
! 
  #ifdef STDC_HEADERS
  #include <stdlib.h>
  #else
--- 18,24 ----
  #ifdef HAVE_CONFIG_H
  #include <config.h>
  #endif
! #include "system.h"
  #ifdef STDC_HEADERS
  #include <stdlib.h>
  #else
diff -crN orig/dstring.c new/dstring.c
*** orig/dstring.c	Tue Nov 24 07:40:34 1992
--- new/dstring.c	Tue Oct 31 21:43:10 2000
***************
*** 14,20 ****
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
! 
  #include <stdio.h>
  #if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
  #include <string.h>
--- 14,20 ----
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
! #include "system.h"
  #include <stdio.h>
  #if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
  #include <string.h>
diff -crN orig/extern.h new/extern.h
*** orig/extern.h	Wed Nov 30 16:48:28 1994
--- new/extern.h	Sun Mar 30 10:45:44 1997
***************
*** 128,133 ****
--- 128,138 ----
  gid_t *getgidbyname ();
  #endif
  
+ /* lchown.c */
+ #ifdef HAVE_LCHOWN
+ int lchown P_((const char *path, uid_t owner, gid_t group));
+ #endif
+ 
  /* main.c */
  void process_args P_((int argc, char *argv[]));
  void initialize_buffers P_((void));
diff -crN orig/idcache.c new/idcache.c
*** orig/idcache.c	Fri Jun 23 22:57:25 1995
--- new/idcache.c	Tue Oct 31 22:00:20 2000
***************
*** 21,29 ****
  
  #include <stdio.h>
  #include <sys/types.h>
! #include <pwd.h>
! #include <grp.h>
! 
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #else
--- 21,27 ----
  
  #include <stdio.h>
  #include <sys/types.h>
! #include "system.h"
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #else
***************
*** 33,44 ****
  #ifdef HAVE_UNISTD_H
  #include <unistd.h>
  #endif
- #ifndef _POSIX_VERSION
- struct passwd *getpwuid ();
- struct passwd *getpwnam ();
- struct group *getgrgid ();
- struct group *getgrnam ();
- #endif
  
  char *xmalloc ();
  char *xstrdup ();
--- 31,36 ----
***************
*** 66,72 ****
  getuser (uid)
       uid_t uid;
  {
!   register struct userid *tail;
    struct passwd *pwent;
    char usernum_string[20];
  
--- 58,66 ----
  getuser (uid)
       uid_t uid;
  {
! /* For DOS, just return "root" */
! return "root";
! /*  register struct userid *tail;
    struct passwd *pwent;
    char usernum_string[20];
  
***************
*** 85,94 ****
    else
      tail->name = xstrdup (pwent->pw_name);
  
-   /* Add to the head of the list, so most recently used is first.  */
    tail->next = user_alist;
    user_alist = tail;
!   return tail->name;
  }
  
  /* Translate USER to a UID, with cache.
--- 79,87 ----
    else
      tail->name = xstrdup (pwent->pw_name);
  
    tail->next = user_alist;
    user_alist = tail;
!   return tail->name; */
  }
  
  /* Translate USER to a UID, with cache.
***************
*** 100,135 ****
  getuidbyname (user)
       char *user;
  {
!   register struct userid *tail;
!   struct passwd *pwent;
! 
!   for (tail = user_alist; tail; tail = tail->next)
!     /* Avoid a function call for the most common case.  */
!     if (*tail->name == *user && !strcmp (tail->name, user))
!       return &tail->id.u;
! 
!   for (tail = nouser_alist; tail; tail = tail->next)
!     /* Avoid a function call for the most common case.  */
!     if (*tail->name == *user && !strcmp (tail->name, user))
!       return 0;
! 
!   pwent = getpwnam (user);
! 
!   tail = (struct userid *) xmalloc (sizeof (struct userid));
!   tail->name = xstrdup (user);
! 
!   /* Add to the head of the list, so most recently used is first.  */
!   if (pwent)
!     {
!       tail->id.u = pwent->pw_uid;
!       tail->next = user_alist;
!       user_alist = tail;
!       return &tail->id.u;
!     }
! 
!   tail->next = nouser_alist;
!   nouser_alist = tail;
!   return 0;
  }
  
  /* Use the same struct as for userids.  */
--- 93,99 ----
  getuidbyname (user)
       char *user;
  {
! return NULL;
  }
  
  /* Use the same struct as for userids.  */
***************
*** 143,171 ****
  getgroup (gid)
       gid_t gid;
  {
!   register struct userid *tail;
!   struct group *grent;
!   char groupnum_string[20];
! 
!   for (tail = group_alist; tail; tail = tail->next)
!     if (tail->id.g == gid)
!       return tail->name;
! 
!   grent = getgrgid (gid);
!   tail = (struct userid *) xmalloc (sizeof (struct userid));
!   tail->id.g = gid;
!   if (grent == 0)
!     {
!       sprintf (groupnum_string, "%u", (unsigned int) gid);
!       tail->name = xstrdup (groupnum_string);
!     }
!   else
!     tail->name = xstrdup (grent->gr_name);
! 
!   /* Add to the head of the list, so most recently used is first.  */
!   tail->next = group_alist;
!   group_alist = tail;
!   return tail->name;
  }
  
  /* Translate GROUP to a UID, with cache.
--- 107,113 ----
  getgroup (gid)
       gid_t gid;
  {
! return "wheel";
  }
  
  /* Translate GROUP to a UID, with cache.
***************
*** 177,210 ****
  getgidbyname (group)
       char *group;
  {
!   register struct userid *tail;
!   struct group *grent;
! 
!   for (tail = group_alist; tail; tail = tail->next)
!     /* Avoid a function call for the most common case.  */
!     if (*tail->name == *group && !strcmp (tail->name, group))
!       return &tail->id.g;
! 
!   for (tail = nogroup_alist; tail; tail = tail->next)
!     /* Avoid a function call for the most common case.  */
!     if (*tail->name == *group && !strcmp (tail->name, group))
!       return 0;
! 
!   grent = getgrnam (group);
! 
!   tail = (struct userid *) xmalloc (sizeof (struct userid));
!   tail->name = xstrdup (group);
! 
!   /* Add to the head of the list, so most recently used is first.  */
!   if (grent)
!     {
!       tail->id.g = grent->gr_gid;
!       tail->next = group_alist;
!       group_alist = tail;
!       return &tail->id.g;
!     }
! 
!   tail->next = nogroup_alist;
!   nogroup_alist = tail;
!   return 0;
  }
--- 119,123 ----
  getgidbyname (group)
       char *group;
  {
! return NULL;
  }
diff -crN orig/main.c new/main.c
*** orig/main.c	Wed Nov 30 18:24:21 1994
--- new/main.c	Tue Oct 31 21:42:04 2000
***************
*** 19,28 ****
--- 19,35 ----
     David MacKenzie <djm@gnu.ai.mit.edu>,
     and John Oleynick <juo@klinzhai.rutgers.edu>.  */
  
+ /* $FreeBSD: src/contrib/cpio/main.c,v 1.3 1999/09/15 01:47:13 peter Exp $ */
  #include <stdio.h>
  #include <getopt.h>
  #include <sys/types.h>
  #include <sys/stat.h>
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ #if (defined(BSD) && (BSD >= 199306))
+ #include <locale.h>
+ #endif
  #include "filetypes.h"
  #include "system.h"
  #include "cpiohdr.h"
***************
*** 492,504 ****
    bzero (zeros_512, 512);
  }
  
! void
  main (argc, argv)
       int argc;
       char *argv[];
  {
    program_name = argv[0];
!   umask (0);
  
  #ifdef __TURBOC__
    _fmode = O_BINARY;		/* Put stdin and stdout in binary mode.  */
--- 499,514 ----
    bzero (zeros_512, 512);
  }
  
! int
  main (argc, argv)
       int argc;
       char *argv[];
  {
    program_name = argv[0];
! 
! #if (defined(BSD) && (BSD >= 199306))
!   (void) setlocale (LC_ALL, "");
! #endif
  
  #ifdef __TURBOC__
    _fmode = O_BINARY;		/* Put stdin and stdout in binary mode.  */
***************
*** 509,514 ****
--- 519,525 ----
  #endif
  
    process_args (argc, argv);
+   umask (0);
  
    initialize_buffers ();
  
diff -crN orig/makepath.c new/makepath.c
*** orig/makepath.c	Wed Nov 30 16:50:10 1994
--- new/makepath.c	Tue Oct 31 21:46:44 2000
***************
*** 21,27 ****
  /* This copy of makepath is almost like the fileutils one, but has
     changes for HPUX CDF's.  Maybe the 2 versions of makepath can
     come together again in the future.  */
! 
  #ifdef __GNUC__
  #define alloca __builtin_alloca
  #else
--- 21,27 ----
  /* This copy of makepath is almost like the fileutils one, but has
     changes for HPUX CDF's.  Maybe the 2 versions of makepath can
     come together again in the future.  */
! #include "system.h"
  #ifdef __GNUC__
  #define alloca __builtin_alloca
  #else
***************
*** 60,70 ****
  #endif
  #else
  #include <strings.h>
- #endif
- 
- #if defined(__MSDOS__) && !defined(__GNUC__)
- typedef int uid_t;
- typedef int gid_t;
  #endif
  
  void error ();
--- 60,65 ----
diff -crN orig/rtapelib.c new/rtapelib.c
*** orig/rtapelib.c	Wed Nov 30 16:59:40 1994
--- new/rtapelib.c	Tue Oct 31 22:05:34 2000
***************
*** 118,134 ****
  
    /* Save the current pipe handler and try to make the request.  */
  
-   pipe_handler = signal (SIGPIPE, SIG_IGN);
    buflen = strlen (buf);
    if (write (WRITE (fildes), buf, buflen) == buflen)
      {
!       signal (SIGPIPE, pipe_handler);
        return 0;
      }
  
    /* Something went wrong.  Close down and go home.  */
  
-   signal (SIGPIPE, pipe_handler);
    _rmt_shutdown (fildes);
    errno = EIO;
    return -1;
--- 118,132 ----
  
    /* Save the current pipe handler and try to make the request.  */
  
    buflen = strlen (buf);
    if (write (WRITE (fildes), buf, buflen) == buflen)
      {
! 
        return 0;
      }
  
    /* Something went wrong.  Close down and go home.  */
  
    _rmt_shutdown (fildes);
    errno = EIO;
    return -1;
***************
*** 347,356 ****
  #else /* !HAVE_NETDB_H */
    /* Set up the pipes for the `rsh' command, and fork.  */
  
!   if (pipe (to_rmt[i]) == -1 || pipe (from_rmt[i]) == -1)
      return -1;
  
!   rc = fork ();
    if (rc == -1)
      return -1;
  
--- 345,354 ----
  #else /* !HAVE_NETDB_H */
    /* Set up the pipes for the `rsh' command, and fork.  */
  
! //  if (pipe (to_rmt[i]) == -1 || pipe (from_rmt[i]) == -1)
      return -1;
  
!   rc = -1;//fork ();
    if (rc == -1)
      return -1;
  
***************
*** 367,400 ****
        close (from_rmt[i][0]);
        close (from_rmt[i][1]);
  
-       setuid (getuid ());
-       setgid (getgid ());
  
        if (*login)
  	{
! 	  execl ("/usr/ucb/rsh", "rsh", system, "-l", login,
! 		 "/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);
! 	  execl ("/usr/bsd/rsh", "rsh", system, "-l", login,
! 		 "/etc/rmt", (char *) 0);
! 	  execl ("/usr/bin/nsh", "nsh", system, "-l", login,
  		 "/etc/rmt", (char *) 0);
  	}
        else
  	{
- 	  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);
- 	  execl ("/usr/bsd/rsh", "rsh", system,
- 		 "/etc/rmt", (char *) 0);
- 	  execl ("/usr/bin/nsh", "nsh", system,
- 		 "/etc/rmt", (char *) 0);
  	}
  
        /* Bad problems if we get here.  */
--- 365,380 ----
        close (from_rmt[i][0]);
        close (from_rmt[i][1]);
  
  
        if (*login)
  	{
! 	  execl ("/usr/bin/rsh", "rsh", "-l", login, system,
  		 "/etc/rmt", (char *) 0);
  	}
        else
  	{
  	  execl ("/usr/bin/rsh", "rsh", system,
  		 "/etc/rmt", (char *) 0);
  	}
  
        /* Bad problems if we get here.  */
***************
*** 480,494 ****
    if (command (fildes, buffer) == -1)
      return -1;
  
-   pipe_handler = signal (SIGPIPE, SIG_IGN);
    if (write (WRITE (fildes), buf, nbyte) == nbyte)
      {
-       signal (SIGPIPE, pipe_handler);
        return status (fildes);
      }
  
    /* Write error.  */
-   signal (SIGPIPE, pipe_handler);
    _rmt_shutdown (fildes);
    errno = EIO;
    return -1;
--- 460,471 ----
diff -crN orig/stripslash.c new/stripslash.c
*** orig/stripslash.c	Mon Sep 26 16:42:18 1994
--- new/stripslash.c	Tue Oct 31 21:48:08 2000
***************
*** 18,24 ****
  #ifdef HAVE_CONFIG_H
  #include <config.h>
  #endif
! 
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #else
--- 18,24 ----
  #ifdef HAVE_CONFIG_H
  #include <config.h>
  #endif
! #include "system.h"
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #else
diff -crN orig/system.h new/system.h
*** orig/system.h	Wed Nov 30 16:50:01 1994
--- new/system.h	Tue Oct 31 21:59:22 2000
***************
*** 14,20 ****
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
! 
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #ifndef index
--- 14,35 ----
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
! #define HAVE_STRING_H 1
! #define STDC_HEADERS 1
! /********************/
! #define fnmatch()  (0)
! #define setgid()   (0)
! #define getgid()   (0)
! #define setuid()   (0)
! #define getuid()   (0)
! #define fork()     (0)
! #define pipe()     (0)
! #define endgrent() (0)
! #define getgrnam() (0)
! #define endpwent() (0)
! #define getgrgid() (0)
! #define getpwnam() (0)
! /********************/
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #ifndef index
***************
*** 22,27 ****
--- 37,45 ----
  #endif
  #ifndef rindex
  #define rindex	strrchr
+ #endif
+ #ifndef bcopy
+ #define bcopy(from, to, len) memcpy ((to), (from), (len))
  #endif
  #ifndef bcmp
  #define bcmp(s1, s2, n)	memcmp ((s1), (s2), (n))
diff -crN orig/userspec.c new/userspec.c
*** orig/userspec.c	Mon Sep 26 16:42:09 1994
--- new/userspec.c	Tue Oct 31 22:03:04 2000
***************
*** 37,45 ****
  
  #include <stdio.h>
  #include <sys/types.h>
! #include <pwd.h>
! #include <grp.h>
! 
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #ifndef index
--- 37,43 ----
  
  #include <stdio.h>
  #include <sys/types.h>
! #include "system.h"
  #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  #include <string.h>
  #ifndef index
***************
*** 57,67 ****
  #include <unistd.h>
  #endif
  
- #ifndef _POSIX_VERSION
- struct passwd *getpwnam ();
- struct group *getgrnam ();
- struct group *getgrgid ();
- #endif
  
  #ifdef _POSIX_SOURCE
  #define endpwent()
--- 55,60 ----
***************
*** 152,194 ****
  
    if (u != NULL)
      {
-       pwd = getpwnam (u);
-       if (pwd == NULL)
- 	{
- 
- 	  if (!isnumber (u))
- 	    error_msg = "invalid user";
- 	  else
- 	    {
- 	      int use_login_group;
- 	      use_login_group = (separator != NULL && g == NULL);
- 	      if (use_login_group)
- 		error_msg = "cannot get the login group of a numeric UID";
- 	      else
- 		*uid = atoi (u);
- 	    }
- 	}
-       else
  	{
! 	  *uid = pwd->pw_uid;
  	  if (g == NULL && separator != NULL)
  	    {
  	      /* A separator was given, but a group was not specified,
  	         so get the login group.  */
! 	      *gid = pwd->pw_gid;
! 	      grp = getgrgid (pwd->pw_gid);
  	      if (grp == NULL)
  		{
  		  /* This is enough room to hold the unsigned decimal
  		     representation of any 32-bit quantity and the trailing
  		     zero byte.  */
  		  char uint_buf[21];
! 		  sprintf (uint_buf, "%u", (unsigned) (pwd->pw_gid));
  		  V_STRDUP (groupname, uint_buf);
  		}
  	      else
  		{
! 		  V_STRDUP (groupname, grp->gr_name);
  		}
  	      endgrent ();
  	    }
--- 145,170 ----
  
    if (u != NULL)
      {
  	{
! 	  *uid = NULL;
  	  if (g == NULL && separator != NULL)
  	    {
  	      /* A separator was given, but a group was not specified,
  	         so get the login group.  */
! 	      *gid = NULL;
! 	      grp = (NULL);
  	      if (grp == NULL)
  		{
  		  /* This is enough room to hold the unsigned decimal
  		     representation of any 32-bit quantity and the trailing
  		     zero byte.  */
  		  char uint_buf[21];
! 		  sprintf (uint_buf, "%u", (unsigned) (0));
  		  V_STRDUP (groupname, uint_buf);
  		}
  	      else
  		{
! 		  V_STRDUP (groupname, "wheel");
  		}
  	      endgrent ();
  	    }
***************
*** 199,218 ****
    if (g != NULL && error_msg == NULL)
      {
        /* Explicit group.  */
!       grp = getgrnam (g);
        if (grp == NULL)
  	{
- 	  if (!isnumber (g))
- 	    error_msg = "invalid group";
- 	  else
  	    *gid = atoi (g);
  	}
        else
! 	*gid = grp->gr_gid;
        endgrent ();		/* Save a file descriptor.  */
  
        if (error_msg == NULL)
! 	V_STRDUP (groupname, g);
      }
  
    if (error_msg == NULL)
--- 175,191 ----
    if (g != NULL && error_msg == NULL)
      {
        /* Explicit group.  */
!       grp = NULL;
        if (grp == NULL)
  	{
  	    *gid = atoi (g);
  	}
        else
! 	*gid = NULL;
        endgrent ();		/* Save a file descriptor.  */
  
        if (error_msg == NULL)
! 	V_STRDUP (groupname, "wheel");
      }
  
    if (error_msg == NULL)
diff -crN orig/util.c new/util.c
*** orig/util.c	Tue Jan 16 15:40:14 1996
--- new/util.c	Sun Mar 30 11:01:42 1997
***************
*** 880,888 ****
      fprintf (tty_out, "%s%d%s", new_media_message_with_number, reel_number,
  	     new_media_message_after_number);
    else if (archive_name)
!     fprintf (tty_out, "Found end of tape.  Load next tape and press RETURN. ");
    else
!     fprintf (tty_out, "Found end of tape.  To continue, type device/file name when ready.\n");
  
    fflush (tty_out);
  
--- 880,888 ----
      fprintf (tty_out, "%s%d%s", new_media_message_with_number, reel_number,
  	     new_media_message_after_number);
    else if (archive_name)
!     fprintf (tty_out, "Found end of volume.  Load next volume and press RETURN. ");
    else
!     fprintf (tty_out, "Found end of volume.  To continue, type device/file name when ready.\n");
  
    fflush (tty_out);
  
diff -crN orig/wgdmake.bat new/wgdmake.bat
*** orig/wgdmake.bat	Wed Dec 31 18:00:00 1969
--- new/wgdmake.bat	Wed Nov  1 22:07:56 2000
***************
*** 0 ****
--- 1,4 ----
+ @echo off
+ tcc -I. -w- *.c
+ ren *.exe cpio.exe
+ del *.obj
diff -crN orig/xmalloc.c new/xmalloc.c
*** orig/xmalloc.c	Fri Jun 23 22:45:31 1995
--- new/xmalloc.c	Tue Oct 31 21:51:20 2000
***************
*** 56,62 ****
  #else
  void error ();
  #endif
! 
  static VOID *
  fixup_null_alloc (n)
       size_t n;
--- 56,62 ----
  #else
  void error ();
  #endif
! #include <stdio.h> /* for size_t */
  static VOID *
  fixup_null_alloc (n)
       size_t n;
diff -crN orig/xstrdup.c new/xstrdup.c
*** orig/xstrdup.c	Sat Dec  9 13:14:06 1995
--- new/xstrdup.c	Tue Oct 31 21:51:30 2000
***************
*** 14,20 ****
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
! 
  #ifdef HAVE_CONFIG_H
  #include <config.h>
  #endif
--- 14,20 ----
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
! #include "system.h"
  #ifdef HAVE_CONFIG_H
  #include <config.h>
  #endif
