--- cpio-2.4.2/copyin.c.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/copyin.c	Tue Jun 26 13:55:21 2001
@@ -29,6 +29,10 @@
 #include <fnmatch.h>
 #endif
 
+/* Debian hack to fix a bug in the --sparse option.  This bug has been
+   reported to "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
+extern int delayed_seek_count;
+
 static void read_pattern_file ();
 static void tape_skip_padding ();
 static void defer_copyin ();
@@ -490,12 +494,13 @@
 	    }
 	  else
 	    {
-	      char *non_abs_name;
-
-	      non_abs_name = (char *) xmalloc (strlen (p) + 1);
-	      strcpy (non_abs_name, p);
-	      free (file_hdr.c_name);
-	      file_hdr.c_name = non_abs_name;
+              /* Debian hack: file_hrd.c_name is sometimes set to
+                 point to static memory by code in tar.c.  This
+                 causes a segfault.  Therefore, memmove is used
+                 instead of freeing and reallocating.  (Reported by
+                 Horst Knobloch.)  This bug has been reported to
+                 "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */
+	      (void)memmove (file_hdr.c_name, p, (size_t)(strlen (p) + 1));
 	    }
 	}
 
@@ -546,7 +551,11 @@
 		long_format (&file_hdr, (char *) 0);
 	    }
 	  else
-	    printf ("%s\n", file_hdr.c_name);
+	    /* Debian hack: Modified to print a list of filenames
+               terminiated by a null character when the -t and -0
+               flags are used.  This has been submitted as a
+               suggestion to "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
+	    printf ("%s%c", file_hdr.c_name, name_end);
 
 	  crc = 0;
 	  tape_toss_input (in_file_des, file_hdr.c_filesize);
@@ -586,6 +595,12 @@
 	    if (crc != file_hdr.c_chksum)
 	      error (0, 0, "%s: checksum error (0x%x, should be 0x%x)",
 		     file_hdr.c_name, crc, file_hdr.c_chksum);
+         /* Debian hack: -v and -V now work with --only-verify-crc.
+            (99/11/10) -BEM */
+	    if (verbose_flag)
+	      fprintf (stderr, "%s\n", file_hdr.c_name);
+	    if (dot_flag)
+	      fputc ('.', stderr);
 	}
       else
 	{
@@ -611,7 +626,28 @@
 		  continue;
 		}
 	      else
-		file_hdr.c_name = xstrdup (new_name.ds_string);
+              /* Debian hack: file_hrd.c_name is sometimes set to
+                 point to static memory by code in tar.c.  This
+                 causes a segfault.  This has been fixed and an
+                 additional check to ensure that the file name
+                 is not too long has been added.  (Reported by
+                 Horst Knobloch.)  This bug has been reported to
+                 "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */
+		{
+		  if (archive_format != arf_tar && archive_format != arf_ustar)
+		    {
+		      free (file_hdr.c_name);
+		      file_hdr.c_name = xstrdup (new_name.ds_string);
+		    }
+		  else
+		    {
+		      if (is_tar_filename_too_long (new_name.ds_string))
+			error (0, 0, "%s: file name too long",
+			       new_name.ds_string);
+		      else
+			strcpy (file_hdr.c_name, new_name.ds_string);
+		    }
+		}
 	    }
 
 	  /* See if the file already exists.  */
@@ -682,8 +718,10 @@
 		     but GNU cpio version 2.0-2.2 didn't do that, so we
 		     still have to check for links here (and also in case
 		     the archive was created and later appeneded to). */
+		  /* Debian hack: (97/1/2) This was reported by Ronald
+		     F. Guilmette to the upstream maintainers. -BEM */
 		  link_res = link_to_maj_min_ino (file_hdr.c_name, 
-				file_hdr.c_dev_maj, file_hdr.c_dev_maj,
+				file_hdr.c_dev_maj, file_hdr.c_dev_min,
 				file_hdr.c_ino);
 		  if (link_res == 0)
 		    {
@@ -696,8 +734,10 @@
 		  && archive_format != arf_ustar)
 		{
 		  int link_res;
+		  /* Debian hack: (97/1/2) This was reported by Ronald
+		     F. Guilmette to the upstream maintainers. -BEM */
 		  link_res = link_to_maj_min_ino (file_hdr.c_name, 
-				file_hdr.c_dev_maj, file_hdr.c_dev_maj,
+				file_hdr.c_dev_maj, file_hdr.c_dev_min,
 				file_hdr.c_ino);
 		  if (link_res == 0)
 		    {
@@ -761,6 +801,15 @@
 		    }
 		  copy_files_tape_to_disk (in_file_des, out_file_des, file_hdr.c_filesize);
 		  disk_empty_output_buffer (out_file_des);
+		  /* Debian hack to fix a bug in the --sparse option.
+                     This bug has been reported to
+                     "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
+		  if (delayed_seek_count > 0)
+		    {
+		      lseek (out_file_des, delayed_seek_count-1, SEEK_CUR);
+		      write (out_file_des, "", 1);
+		      delayed_seek_count = 0;
+		    }
 		  if (close (out_file_des) < 0)
 		    error (0, errno, "%s", file_hdr.c_name);
 
@@ -890,8 +939,11 @@
 		  && archive_format != arf_ustar)
 		{
 		  int link_res;
+                  /* Debian hack:  This was reported by Horst
+                     Knobloch. This bug has been reported to
+                     "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */
 		  link_res = link_to_maj_min_ino (file_hdr.c_name, 
-				file_hdr.c_dev_maj, file_hdr.c_dev_maj,
+				file_hdr.c_dev_maj, file_hdr.c_dev_min,
 				file_hdr.c_ino);
 		  if (link_res == 0)
 		    break;
@@ -1305,7 +1357,7 @@
   for (d = deferments; d != NULL; d = d->next)
     {
       link_res = link_to_maj_min_ino (d->header.c_name, 
-		    d->header.c_dev_maj, d->header.c_dev_maj,
+		    d->header.c_dev_maj, d->header.c_dev_min,
 		    d->header.c_ino);
       if (link_res == 0)
 	{
--- cpio-2.4.2/copyout.c.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/copyout.c	Tue Jun 26 13:57:04 2001
@@ -35,6 +35,7 @@
 static void writeout_other_defers ();
 static void writeout_final_defers();
 static void writeout_defered_file ();
+static void check_for_changed_file ();
 
 /* Write out header FILE_HDR, including the file name, to file
    descriptor OUT_DES.  */
@@ -112,11 +113,11 @@
 	error (0, 0, "%s: truncating inode number", file_hdr->c_name);
 
       sprintf (ascii_header,
-	       "%06o%06o%06lo%06lo%06lo%06lo%06lo%06o%011lo%06lo%011lo",
-	       file_hdr->c_magic & 0xFFFF, (int)(dev & 0xFFFF),
+	       "%06ho%06lo%06lo%06lo%06lo%06lo%06lo%06o%011lo%06lo%011lo",
+	       file_hdr->c_magic & 0xFFFF, (long)(dev & 0xFFFF),
 	       file_hdr->c_ino & 0xFFFF, file_hdr->c_mode & 0xFFFF,
 	       file_hdr->c_uid & 0xFFFF, file_hdr->c_gid & 0xFFFF,
-	       file_hdr->c_nlink & 0xFFFF, (int)(rdev & 0xFFFF),
+	       file_hdr->c_nlink & 0xFFFF, (long)(rdev & 0xFFFF),
 	       file_hdr->c_mtime, file_hdr->c_namesize & 0xFFFF,
 	       file_hdr->c_filesize);
       tape_buffered_write (ascii_header, out_des, 76L);
@@ -384,6 +385,7 @@
 
 	      write_out_header (&file_hdr, out_file_des);
 	      copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, input_name.ds_string);
+	      check_for_changed_file(input_name.ds_string, &file_hdr);
 
 #ifndef __MSDOS__
 	      if (archive_format == arf_tar || archive_format == arf_ustar)
@@ -399,7 +401,13 @@
 		{
 		  times.actime = file_stat.st_atime;
 		  times.modtime = file_stat.st_mtime;
-		  if (utime (file_hdr.c_name, &times) < 0)
+		  /* Debian hack: Silently ignore EROFS because
+                     reading the file won't have upset its timestamp
+                     if it's on a read-only filesystem.  This has been
+                     submitted as a suggestion to
+                     "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
+		  if (utime (file_hdr.c_name, &times) < 0
+		      && errno != EROFS)
 		    error (0, errno, "%s", file_hdr.c_name);
 		}
 	      break;
@@ -562,6 +570,8 @@
 	error (1, errno, "cannot read checksum for %s", file_name);
       if (bytes_read == 0)
 	break;
+      if (bytes_left < bytes_read)
+        bytes_read = bytes_left;
       for (i = 0; i < bytes_read; ++i)
 	crc += buf[i] & 0xff;
     }
@@ -785,6 +795,7 @@
 
   write_out_header (&file_hdr, out_file_des);
   copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, header->c_name);
+  check_for_changed_file(header->c_name, &file_hdr);
 
 #ifndef __MSDOS__
   if (archive_format == arf_tar || archive_format == arf_ustar)
@@ -800,8 +811,33 @@
     {
       times.actime = file_hdr.c_mtime;
       times.modtime = file_hdr.c_mtime;
-      if (utime (file_hdr.c_name, &times) < 0)
+      /* Debian hack: Silently ignore EROFS because reading the file
+         won't have upset its timestamp if it's on a read-only
+         filesystem.  This has been submitted as a suggestion to
+         "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
+      if (utime (file_hdr.c_name, &times) < 0
+	  && errno != EROFS)
 	error (0, errno, "%s", file_hdr.c_name);
     }
   return;
 }
+
+static void
+check_for_changed_file (name, header)
+     char *name;
+     struct new_cpio_header *header;
+{
+  struct stat new_file_stat;
+
+  if ((*xstat) (name, &new_file_stat) < 0)
+    {
+      error (0, errno, "%s", name);
+      return;
+    }
+  if (header->c_filesize != new_file_stat.st_size)
+    error (0, 0, "%s: size changed from %ld to %ld during copy-out",
+	name, header->c_filesize, new_file_stat.st_size);
+  if (header->c_mtime != new_file_stat.st_mtime)
+    error (0, 0, "%s: mtime changed during copy-out",
+	name, header->c_filesize, new_file_stat.st_size);
+}
--- cpio-2.4.2/copypass.c.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/copypass.c	Tue Jun 26 13:51:18 2001
@@ -24,6 +24,10 @@
 #include "dstring.h"
 #include "extern.h"
 
+/* Debian hack to fix a bug in the --sparse option.  This bug has been
+   reported to "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
+extern int delayed_seek_count;
+
 /* Copy files listed on the standard input into directory `directory_name'.
    If `link_flag', link instead of copying.  */
 
@@ -167,6 +171,15 @@
 
 	      copy_files_disk_to_disk (in_file_des, out_file_des, in_file_stat.st_size, input_name.ds_string);
 	      disk_empty_output_buffer (out_file_des);
+	      /* Debian hack to fix a bug in the --sparse option.
+                 This bug has been reported to
+                 "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
+	      if (delayed_seek_count > 0)
+		{
+		  lseek (out_file_des, delayed_seek_count-1, SEEK_CUR);
+		  write (out_file_des, "", 1);
+		  delayed_seek_count = 0;
+		}
 	      if (close (in_file_des) < 0)
 		error (0, errno, "%s", input_name.ds_string);
 	      if (close (out_file_des) < 0)
@@ -186,9 +199,16 @@
 		{
 		  times.actime = in_file_stat.st_atime;
 		  times.modtime = in_file_stat.st_mtime;
-		  if (utime (input_name.ds_string, &times) < 0)
+		  /* Debian hack: Silently ignore EROFS because
+                     reading the file won't have upset its timestamp
+                     if it's on a read-only filesystem.  This has been
+                     submitted as a suggestion to
+                     "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
+		  if (utime (input_name.ds_string, &times) < 0
+		      && errno != EROFS)
 		    error (0, errno, "%s", input_name.ds_string);
-		  if (utime (output_name.ds_string, &times) < 0)
+		  if (utime (output_name.ds_string, &times) < 0
+		      && errno != EROFS)
 		    error (0, errno, "%s", output_name.ds_string);
 		}
 	      if (retain_time_flag)
--- cpio-2.4.2/global.c.debian	Wed Nov 30 23:48:12 1994
+++ cpio-2.4.2/global.c	Tue Jun 26 13:51:18 2001
@@ -134,6 +134,9 @@
 /* Name of file containing the archive, if known; NULL if stdin/out.  */
 char *archive_name = NULL;
 
+/* Name of the remote shell command, if known; NULL otherwise.  */
+char *rsh_command_option = NULL;
+
 /* CRC checksum.  */
 unsigned long crc;
 
--- cpio-2.4.2/main.c.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/main.c	Tue Jun 26 13:51:18 2001
@@ -59,6 +59,7 @@
   {"preserve-modification-time", 0, &retain_time_flag, TRUE},
   {"rename", 0, &rename_flag, TRUE},
   {"rename-batch-file", 1, 0, 137},
+  {"rsh-command", 1, 0, 140},
   {"quiet", 0, 0, 138},
   {"sparse", 0, 0, 135},
   {"swap", 0, 0, 'b'},
@@ -87,7 +88,8 @@
        [--file=[[user@]host:]archive] [--format=format] [--message=message]\n\
        [--null] [--reset-access-time] [--verbose] [--dot] [--append]\n\
        [--block-size=blocks] [--dereference] [--io-size=bytes] [--quiet]\n\
-       [--force-local] [--help] [--version] < name-list [> archive]\n", program_name);
+       [--force-local] [--rsh-command=command] [--help] [--version] < name-list\n\
+       [> archive]\n", program_name);
   fprintf (fp, "\
        %s {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file] [-H format]\n\
        [-M message] [-R [user][:.][group]] [-I [[user@]host:]archive]\n\
@@ -98,7 +100,8 @@
        [--io-size=bytes] [--pattern-file=file] [--format=format]\n\
        [--owner=[user][:.][group]] [--no-preserve-owner] [--message=message]\n\
        [--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc]\n\
-       [--quiet] [--help] [--version] [pattern...] [< archive]\n",
+       [--quiet] [--rsh-command=command] [--help] [--version] [pattern...]\n\
+       [< archive]\n",
 	   program_name);
   fprintf (fp, "\
        %s {-p|--pass-through} [-0adlmuvLV] [-R [user][:.][group]]\n\
@@ -127,6 +130,7 @@
   if (argc < 2)
     usage (stderr, 2);
 
+  rsh_command_option = getenv("CPIO_RSH");
   xstat = lstat;
 
   while ((c = getopt_long (argc, argv,
@@ -289,6 +293,10 @@
 	  copy_function = process_copy_pass;
 	  break;
 
+	case 140:
+	  rsh_command_option = optarg;
+	  break;
+
 	case 'r':		/* Interactively rename.  */
 	  rename_flag = TRUE;
 	  break;
@@ -377,8 +385,9 @@
 	usage (stderr, 2);
     }
 
-  if ((!table_flag || !verbose_flag) && numeric_uid)
-    usage (stderr, 2);
+  /* Debian hack: This version of cpio uses the -n flag also to extract
+     tar archives using the numeric UID/GID instead of the user/group
+     names in /etc/passwd and /etc/groups.  (98/10/15) -BEM */
 
   /* Work around for pcc bug.  */
   copy_in = process_copy_in;
@@ -388,7 +397,9 @@
     {
       archive_des = 0;
       if (link_flag || reset_time_flag || xstat != lstat || append_flag
-	  || sparse_flag
+	  /* Debian hack: The sparse option is used with copy-in not
+             copy-out.  This bug has been reported to
+             "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
 	  || output_archive_name
 	  || (archive_name && input_archive_name))
 	usage (stderr, 2);
@@ -408,6 +419,10 @@
 	  || set_group_flag || swap_bytes_flag || swap_halfwords_flag
 	  || (append_flag && !(archive_name || output_archive_name))
 	  || rename_batch_file || no_abs_paths_flag
+	  /* Debian hack: The sparse option is used with copy-in not
+             copy-out.  This bug has been reported to
+             "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
+	  || sparse_flag
 	  || input_archive_name || (archive_name && output_archive_name))
 	usage (stderr, 2);
       if (archive_format == arf_unknown)
--- cpio-2.4.2/tar.c.debian	Fri Feb 25 20:25:33 1994
+++ cpio-2.4.2/tar.c	Tue Jun 26 13:51:18 2001
@@ -261,15 +261,18 @@
       file_hdr->c_nlink = 1;
       otoa (tar_hdr->mode, &file_hdr->c_mode);
       file_hdr->c_mode = file_hdr->c_mode & 07777;
+  /* Debian hack: This version of cpio uses the -n flag also to extract
+     tar archives using the numeric UID/GID instead of the user/group
+     names in /etc/passwd and /etc/groups.  (98/10/15) -BEM */
 #ifndef __MSDOS__
-      if (archive_format == arf_ustar
+      if (archive_format == arf_ustar && !numeric_uid
 	  && (uidp = getuidbyname (tar_hdr->uname)))
 	file_hdr->c_uid = *uidp;
       else
 #endif
 	otoa (tar_hdr->uid, &file_hdr->c_uid);
 #ifndef __MSDOS__
-      if (archive_format == arf_ustar
+      if (archive_format == arf_ustar && !numeric_uid
 	  && (gidp = getgidbyname (tar_hdr->gname)))
 	file_hdr->c_gid = *gidp;
       else
--- cpio-2.4.2/util.c.debian	Tue Jan 16 22:40:14 1996
+++ cpio-2.4.2/util.c	Tue Jun 26 13:51:18 2001
@@ -489,7 +489,9 @@
   while (num_bytes > 0)
     {
       if (input_size == 0)
-	if (rc = disk_fill_input_buffer (in_des, DISK_IO_BLOCK_SIZE))
+	if (rc = disk_fill_input_buffer (in_des,
+	  num_bytes < DISK_IO_BLOCK_SIZE ?
+	  num_bytes : DISK_IO_BLOCK_SIZE))
 	  {
 	    if (rc > 0)
 	      error (0, 0, "File %s shrunk by %ld bytes, padding with zeros",
@@ -808,13 +810,14 @@
   copy_in = process_copy_in;
 
   if (copy_function == copy_in)
-    fd = rmtopen (file, O_RDONLY | O_BINARY, 0666);
+    fd = rmtopen (file, O_RDONLY | O_BINARY, 0666, rsh_command_option);
   else
     {
       if (!append_flag)
-	fd = rmtopen (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
+	fd = rmtopen (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666,
+			rsh_command_option);
       else
-	fd = rmtopen (file, O_RDWR | O_BINARY, 0666);
+	fd = rmtopen (file, O_RDWR | O_BINARY, 0666, rsh_command_option);
     }
 
   return fd;
--- cpio-2.4.2/rtapelib.c.debian	Wed Nov 30 23:59:40 1994
+++ cpio-2.4.2/rtapelib.c	Tue Jun 26 13:51:18 2001
@@ -264,11 +264,12 @@
    On error, return -1.  */
 
 int
-__rmt_open (path, oflag, mode, bias)
+__rmt_open (path, oflag, mode, bias, remote_shell)
      char *path;
      int oflag;
      int mode;
      int bias;
+     const char *remote_shell;
 {
   int i, rc;
   char buffer[CMDBUFSIZE];	/* Command buffer.  */
@@ -372,29 +373,43 @@
 
       if (*login)
 	{
-	  execl ("/usr/ucb/rsh", "rsh", system, "-l", login,
+	  /* Debian hack: added remote shell command line option.
+	     (98/5/20) -BEM */
+	  if (remote_shell) {
+	    const char *remote_shell_basename;
+	    remote_shell_basename = strrchr (remote_shell, '/');
+	    if (remote_shell_basename)
+	      remote_shell_basename++;
+	    else
+	      remote_shell_basename = remote_shell;
+	    execl (remote_shell, remote_shell_basename, system, "-l", login,
 		 "/etc/rmt", (char *) 0);
-	  execl ("/usr/bin/remsh", "remsh", system, "-l", login,
+	  } else {
+	  execl ("/usr/bin/ssh", "ssh", 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,
+	  /* Debian hack: added remote shell command line option.
+	     (98/5/20) -BEM */
+	  if (remote_shell) {
+	    const char *remote_shell_basename;
+	    remote_shell_basename = strrchr (remote_shell, '/');
+	    if (remote_shell_basename)
+	      remote_shell_basename++;
+	    else
+	      remote_shell_basename = remote_shell;
+	    execl (remote_shell, remote_shell_basename, system,
 		 "/etc/rmt", (char *) 0);
-	  execl ("/usr/bin/remsh", "remsh", system,
+	  } else {
+	  execl ("/usr/bin/ssh", "ssh", 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.  */
--- cpio-2.4.2/extern.h.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/extern.h	Tue Jun 26 13:51:18 2001
@@ -57,6 +57,7 @@
 extern char *new_media_message_after_number;
 extern int archive_des;
 extern char *archive_name;
+extern char *rsh_command_option;
 extern unsigned long crc;
 #ifdef DEBUG_CPIO
 extern int debug_flag;
--- cpio-2.4.2/rmt.h.debian	Thu Dec  1 00:00:32 1994
+++ cpio-2.4.2/rmt.h	Tue Jun 26 13:51:18 2001
@@ -1,19 +1,19 @@
 /* Definitions for communicating with a remote tape drive.
-   Copyright (C) 1988, 1992 Free Software Foundation, Inc.
+Copyright (C) 1988, 1992 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   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.  */
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+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_UNISTD_H
 #include <unistd.h>
@@ -67,10 +67,10 @@
 #define _remdev(path)	(!f_force_local && (__rmt_path=index(path, ':')))
 #define _isrmt(fd)		((fd) >= __REM_BIAS)
 
-#define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS) : open(path, oflag, mode))
+#define rmtopen(path,oflag,mode,rsh) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS,rsh) : open(path, oflag, mode))
 #define rmtaccess(path, amode)	(_remdev(path) ? 0 : access(path, amode))
 #define rmtstat(path, buf)	(_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
-#define rmtcreat(path, mode)	(_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS) : creat(path, mode))
+#define rmtcreat(path, mode, rsh)	(_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS, rsh) : creat(path, mode))
 #define rmtlstat(path,buf)	(_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
 
 #define rmtread(fd, buf, n)	(_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
--- cpio-2.4.2/cpio.1.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/cpio.1	Tue Jun 26 13:51:18 2001
@@ -8,19 +8,21 @@
 [\-\-file=[[user@]host:]archive] [\-\-format=format] [\-\-message=message]
 [\-\-null] [\-\-reset-access-time] [\-\-verbose] [\-\-dot] [\-\-append]
 [\-\-block-size=blocks] [\-\-dereference] [\-\-io-size=bytes] [\-\-quiet]
-[\-\-force\-local] [\-\-help] [\-\-version] < name-list [> archive]
+[\-\-force\-local] [\-\-rsh-command=command] [\-\-help] [\-\-version]
+< name-list [> archive]
 
 .B cpio
 {\-i|\-\-extract} [\-bcdfmnrtsuvBSV] [\-C bytes] [\-E file] [\-H format]
 [\-M message] [\-R [user][:.][group]] [\-I [[user@]host:]archive]
 [\-F [[user@]host:]archive] [\-\-file=[[user@]host:]archive]
 [\-\-make-directories] [\-\-nonmatching] [\-\-preserve-modification-time]
-[\-\-numeric-uid-gid] [\-\-rename] [\-\-list] [\-\-swap-bytes] [\-\-swap] [\-\-dot]
+[\-\-numeric-uid-gid] [\-\-rename] [\-t|\-\-list] [\-\-swap-bytes] [\-\-swap] [\-\-dot]
 [\-\-unconditional] [\-\-verbose] [\-\-block-size=blocks] [\-\-swap-halfwords]
 [\-\-io-size=bytes] [\-\-pattern-file=file] [\-\-format=format]
 [\-\-owner=[user][:.][group]] [\-\-no-preserve-owner] [\-\-message=message]
-[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse] [\-\-only\-verify\-crc]
-[\-\-quiet] [\-\-help] [\-\-version] [pattern...] [< archive]
+[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse]
+[\-\-only\-verify\-crc] [\-\-quiet] [\-\-rsh-command=command] [\-\-help]
+[\-\-version] [pattern...] [< archive]
 
 .B cpio
 {\-p|\-\-pass-through} [\-0adlmuvLV] [\-R [user][:.][group]]
@@ -249,6 +251,10 @@
 .I "\-n, \-\-numeric-uid-gid"
 In the verbose table of contents listing, show numeric UID and GID
 instead of translating them into names.
+Also extracts tar archives using the numeric UID and GID instead of the
+user/group names.
+.RB ( cpio
+archives are always extracted using the numeric UID and GID.)
 .TP
 .I " \-\-no-absolute-filenames"
 In copy-in mode, create all files relative to the current directory,
@@ -291,8 +297,17 @@
 separator is given, use the given user's login group.  Only the
 super-user can change files' ownership.
 .TP
+.I "\-\-rsh-command=COMMAND"
+Notifies
+.B mt
+that it should use COMMAND to communicate with remote devices instead of
+.IR /usr/bin/ssh ,
+.IR /usr/bin/rsh ,
+or the command specified by the environment variable
+.BR MT_RSH .
+.TP
 .I "\-\-sparse"
-In copy-out and copy-pass modes, write files with large blocks of zeros
+In copy-in and copy-pass modes, write files with large blocks of zeros
 as sparse files.
 .TP
 .I "\-s, \-\-swap-bytes"
--- cpio-2.4.2/mt.1.debian	Wed Nov 22 22:31:50 1995
+++ cpio-2.4.2/mt.1	Tue Jun 26 13:51:18 2001
@@ -3,7 +3,7 @@
 mt \- control magnetic tape drive operation
 .SH SYNOPSIS
 .B mt
-[\-V] [\-f device] [\-\-file=device] [\-\-version]
+[\-V] [\-f device] [\-\-file=device] [\-\-rsh-command=command] [\-\-version]
 operation [count]
 .SH DESCRIPTION
 This manual page
@@ -76,9 +76,6 @@
 .IR count .
 Equivalent to rewind followed by fsf
 .IR count .
-.IP seek
-Seek to block number
-.IR count .
 .IP eom
 Space to the end of the recorded media on the tape
 (for appending files onto tapes).
@@ -93,6 +90,69 @@
 then rewind it again.
 .IP erase
 Erase the tape.
+.IP fss
+(SCSI tapes) Forward space
+.I count
+setmarks.
+.IP bss
+(SCSI tapes) Backward space
+.I count
+setmarks.
+.IP "wset"
+(SCSI tapes) Write
+.I count
+setmarks at current position (only SCSI tape).
+.IP "eod, seod"
+Space to end of valid data.  Used on streamer tape
+drives to append data to the logical and of tape.
+.IP setblk
+(SCSI tapes) Set the block size of the drive to
+.I count
+bytes per record.
+.IP setdensity
+(SCSI tapes) Set the tape density code to
+.I count.
+The proper codes to use with each drive should be looked up from the
+drive documentation.
+.IP drvbuffer
+(SCSI tapes) Set the tape drive buffer code to
+.I number.
+The proper value for unbuffered operation is zero and "normal" buffered
+operation one. The meanings of other values can be found in the drive
+documentation or, in case of a SCSI-2 drive, from the SCSI-2 standard.
+.IP stoptions
+(SCSI tapes) Set the driver options bits to
+.I count
+for the device.
+The bits can be set by oring the following values: 1 to enable write
+buffering, 2 to enable asynchronous writes, 4 to enable read ahead,
+8 to enable debugging output (if it has been compiled to the driver).
+.IP stwrthreshold
+(SCSI tapes) The write threshold for the tape device is set to
+.I count
+kilobytes. The value must be smaller than or equal to the driver
+buffer size.
+.IP seek
+(SCSI tapes) Seek to the
+.I count
+block on the tape.  This operation is available on some
+Tandberg and Wangtek streamers and some SCSI-2 tape drives.
+.IP tell
+(SCSI tapes) Tell the current block on tape.  This operation is available on some
+Tandberg and Wangtek streamers and some SCSI-2 tape drives.
+.IP densities
+(SCSI tapes) Write explanation of some common density codes to
+standard output.
+.IP datcompression
+(some SCSI-2 DAT tapes) Inquire or set the compression status
+(on/off). If the
+.I count
+is one the compression status is printed. If the
+.I count
+is zero, compression is disabled. Otherwise, compression is
+enabled. The command uses the SCSI ioctl to read and write the Data
+Compression Characteristics mode page (15). ONLY ROOT CAN USE THIS
+COMMAND.
 .PP
 .B mt
 exits with a status of 0 if the operation succeeded, 1 if the
@@ -111,6 +171,17 @@
 you have permission to do so (typically an entry in that user's
 `~/.rhosts' file).
 .TP
+.I "\-\-rsh-command=command"
+Notifies
+.B mt
+that it should use
+.I command
+to communicate with remote devices instead of
+.IR /usr/bin/ssh ,
+.IR /usr/bin/rsh ,
+or the command specified by the environment variable
+.BR MT_RSH .
+.TP
 .I "\-V, \-\-version"
 Print the version number of
 .BR mt .
--- cpio-2.4.2/configure.debian	Wed Dec 20 17:34:04 1995
+++ cpio-2.4.2/configure	Tue Jun 26 13:51:18 2001
@@ -1,4 +1,5 @@
 #! /bin/sh
+set +e
 
 # Guess values for system-dependent variables and create Makefiles.
 # Generated automatically using autoconf version 2.7 
--- cpio-2.4.2/mt.c.debian	Wed Nov 22 22:31:49 1995
+++ cpio-2.4.2/mt.c	Tue Jun 26 13:51:18 2001
@@ -16,6 +16,10 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
    */
 
+/* Modified for the Linux SCSI tape driver by Brian Mays from code
+   written by Kai Makisara.
+   Last Modified: Tue Apr 23 15:37:54 EDT 1996
+*/
 
 /* If -f is not given, the environment variable TAPE is used;
    if that is not set, a default device defined in sys/mtio.h is used.
@@ -50,6 +54,46 @@
    retension	Rewind the tape, then wind it to the end of the reel,
 		then rewind it again.
    erase	Erase the tape.
+   fss		(SCSI tapes) Forward space COUNT setmarks.
+   bss		(SCSI tapes) Backward space COUNT setmarks.
+   wset		(SCSI tapes) Write COUNT setmarks at current position
+		(only SCSI tape).
+   eod, seod	Space to end of valid data.  Used on streamer tape
+		drives to append data to the logical and of tape.
+   setblk	(SCSI tapes) Set the block size of the drive to COUNT
+		bytes per record.
+   setdensity	(SCSI tapes) Set the tape density code to COUNT.  The
+		proper codes to use with each drive should be looked
+		up from the drive documentation.
+   drvbuffer	(SCSI tapes) Set the tape drive buffer code to
+		NUMBER.  The proper value for unbuffered operation is
+		zero and "normal" buffered operation one. The meanings
+		of other values can be found in the drive
+		documentation or, in case of a SCSI-2 drive, from the
+		SCSI-2 standard.
+   stoptions	(SCSI tapes) Set the driver options bits to COUNT for
+		the device.  The bits can be set by oring the
+		following values: 1 to enable write buffering, 2 to
+		enable asynchronous writes, 4 to enable read ahead, 8
+		to enable debugging output (if it has been compiled to
+		the driver).
+   stwrthreshold 
+		(SCSI tapes) The write threshold for the tape device
+		is set to COUNT kilobytes.  The value must be smaller
+		than or equal to the driver buffer size.
+   seek		(SCSI tapes) Seek to the COUNT block on the tape.
+		This operation is available on some Tandberg and
+		Wangtek streamers and some SCSI-2 tape drives.
+   tell		(SCSI tapes) Tell the current block on tape.  This
+		operation is available on some Tandberg and Wangtek
+		streamers and some SCSI-2 tape drives.
+   densities	(SCSI tapes) Write explanation of some common density
+		codes to standard output.
+   datcompression
+		(some SCSI-2 DAT tapes) Inquire or set the compression
+		status (on/off).  If the COUNT is one the compression
+		status is printed.  If the COUNT is zero, compression
+		is disabled.  Otherwise, compression is enabled.
 
    David MacKenzie <djm@gnu.ai.mit.edu> */
 
@@ -97,6 +141,48 @@
 void perform_operation ();
 void print_status ();
 void usage ();
+#ifdef MTTELL
+void print_position ();
+#endif
+
+int do_dat_compression(char *dev, int fn, int count);
+
+#if defined(linux) || defined(__linux)
+#define MTDATCOMP 1000		/* Random unused number.  */
+#define MTDENS 1001		/* Random unused number.  */
+
+struct densities {
+  int code;
+  char *name;
+} density_tbl[] = {
+  {0x00, "default"},
+  {0x01, "NRZI (800 bpi)"},
+  {0x02, "PE (1600 bpi)"},
+  {0x03, "GCR (6250 bpi)"},
+  {0x05, "QIC-45/60 (GCR, 8000 bpi)"},
+  {0x06, "PE (3200 bpi)"},
+  {0x07, "IMFM (6400 bpi)"},
+  {0x08, "GCR (8000 bpi)"},
+  {0x09, "GCR (37871 bpi)"},
+  {0x0a, "MFM (6667 bpi)"},
+  {0x0b, "PE (1600 bpi)"},
+  {0x0c, "GCR (12960 bpi)"},
+  {0x0d, "GCR (25380 bpi)"},
+  {0x0f, "QIC-120 (GCR 10000 bpi)"},
+  {0x10, "QIC-150/250 (GCR 10000 bpi)"},
+  {0x11, "QIC-320/525 (GCR 16000 bpi)"},
+  {0x12, "QIC-1350 (RLL 51667 bpi)"},
+  {0x13, "DDS (61000 bpi)"},
+  {0x14, "EXB-8200 (RLL 43245 bpi)"},
+  {0x15, "EXB-8500 (RLL 45434 bpi)"},
+  {0x16, "MFM 10000 bpi"},
+  {0x17, "MFM 42500 bpi"},
+  {0x22, "SLR4DC"},
+  {0x24, "DDS-2"},
+  {140, "EXB-8505 compressed"},
+  {144, "EXB-8205 compressed"},
+  {-1, NULL}};
+#endif
 
 char *opnames[] =
 {
@@ -107,6 +193,8 @@
 #endif
 #ifdef MTEOM
   "eom",
+  "eod",
+  "seod",
 #endif
 #ifdef MTRETEN
   "retension",
@@ -121,6 +209,39 @@
 #ifdef MTSEEK
   "seek",
 #endif
+#ifdef MTTELL
+  "tell",
+#endif
+#ifdef MTFSS
+  "fss",
+#endif
+#ifdef MTBSS
+  "bss",
+#endif
+#ifdef MTWSM
+  "wset",
+#endif
+#ifdef MTSETBLK
+  "setblk",
+#endif
+#ifdef MTSETDENSITY
+  "setdensity",
+#endif
+#ifdef MTSETDRVBUFFER
+  "drvbuffer",
+#ifdef MT_ST_BOOLEANS
+  "stoptions",
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+  "stwrthreshold",
+#endif
+#endif
+#ifdef MTDATCOMP
+  "datcompression",
+#endif
+#ifdef MTDENS
+  "densities",
+#endif
   NULL
 };
 
@@ -134,6 +255,8 @@
 #endif
 #ifdef MTEOM
   MTEOM,
+  MTEOM,
+  MTEOM,
 #endif
 #ifdef MTRETEN
   MTRETEN,
@@ -148,9 +271,68 @@
 #ifdef MTSEEK
   MTSEEK,
 #endif
+#ifdef MTTELL
+  MTTELL,
+#endif
+#ifdef MTFSS
+  MTFSS,
+#endif
+#ifdef MTBSS
+  MTBSS,
+#endif
+#ifdef MTWSM
+  MTWSM,
+#endif
+#ifdef MTSETBLK
+  MTSETBLK,
+#endif
+#ifdef MTSETDENSITY
+  MTSETDENSITY,
+#endif
+#ifdef MTSETDRVBUFFER
+  MTSETDRVBUFFER,
+#ifdef MT_ST_BOOLEANS
+  MTSETDRVBUFFER,
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+  MTSETDRVBUFFER,
+#endif
+#endif
+#ifdef MTDATCOMP
+  MTDATCOMP,
+#endif
+#ifdef MTDENS
+  MTDENS,
+#endif
   0
 };
 
+char *cbnames[] =
+{
+#ifdef MT_ST_BOOLEANS
+  "stoptions",
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+  "stwrthreshold",
+#endif
+  NULL
+};
+
+int count_bits[] =
+{
+#ifdef MT_ST_BOOLEANS
+  MT_ST_BOOLEANS,
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+  MT_ST_WRITE_THRESHOLD,
+#endif
+  0
+};
+
+#ifdef MT_TAPE_INFO
+  struct mt_tape_info tapes[] = MT_TAPE_INFO;
+#endif
+
 /* If nonzero, don't consider file names that contain a `:' to be
    on remote hosts; all files are local.  Always zero for mt;
    since when do local device names contain colons?  */
@@ -159,6 +341,7 @@
 struct option longopts[] =
 {
   {"file", 1, NULL, 'f'},
+  {"rsh-command", 1, NULL, 1},
   {"version", 0, NULL, 'V'},
   {"help", 0, NULL, 'H'},
   {NULL, 0, NULL, 0}
@@ -178,12 +361,15 @@
   char *tapedev;
   int tapedesc;
   int i;
+  char *rsh_command_option = getenv("MT_RSH");
 
   program_name = argv[0];
   tapedev = NULL;
   count = 1;
 
-  while ((i = getopt_long (argc, argv, "f:t:V:H", longopts, (int *) 0)) != -1)
+  /* Debian hack: Fixed a bug in the -V flag.  This bug has been
+     reported to "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
+  while ((i = getopt_long (argc, argv, "f:t:VH", longopts, (int *) 0)) != -1)
     {
       switch (i)
 	{
@@ -192,6 +378,10 @@
 	  tapedev = optarg;
 	  break;
 
+	case 1:
+	  rsh_command_option = optarg;
+	  break;
+
 	case 'V':
 	  printf ("GNU mt %s", version_string);
 	  exit (0);
@@ -214,10 +404,22 @@
     }
   operation = operations[i];
 
+  i = argmatch (argv[optind], cbnames);
+
   if (++optind < argc)
+    /* Debian hack: Replaced the atoi function call with strtol so
+       that hexidecimal values can be used for the count parameter.
+       This bug has been reported to "bug-gnu-utils@prep.ai.mit.edu".
+       (97/12/5) -BEM */
+#if defined(STDC_HEADERS)
+    count = (int) strtol (argv[optind], NULL, 0);
+#else
     count = atoi (argv[optind]);
+#endif
   if (++optind < argc)
     usage (stderr, 1);
+  if (i >= 0)
+    count |= count_bits[i];
 
   if (tapedev == NULL)
     {
@@ -230,27 +432,58 @@
 #endif
     }
 
+#ifdef MTDENS
+  if (operation == MTDENS)
+    {
+      printf("Some SCSI tape density codes:\ncode   explanation\n");
+      for (i=0; density_tbl[i].code >= 0; i++)
+	printf("0x%02x   %s\n", density_tbl[i].code, density_tbl[i].name);
+      exit (0);
+    }
+#endif
+
   if ( (operation == MTWEOF)
 #ifdef MTERASE
        || (operation == MTERASE)
 #endif
+#ifdef MTWSM
+       || (operation == MTWSM)
+#endif
+#ifdef MTSETDRVBUFFER
+       || (operation == MTSETDRVBUFFER)
+#endif
+#ifdef MTDATCOMP
+       || (operation == MTDATCOMP)
+#endif
 	)
-    tapedesc = rmtopen (tapedev, O_WRONLY, 0);
+    tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
   else
-    tapedesc = rmtopen (tapedev, O_RDONLY, 0);
+    tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option);
   if (tapedesc == -1)
     error (1, errno, "%s", tapedev);
   check_type (tapedev, tapedesc);
 
-  if (operation == MTASF)
-    {
-      perform_operation (tapedev, tapedesc, MTREW, 1);
-      operation = MTFSF;
-    }
-  perform_operation (tapedev, tapedesc, operation, count);
-  if (operation == MTNOP)
-    print_status (tapedev, tapedesc);
-
+#ifdef MTDATCOMP
+  if (operation == MTDATCOMP)
+    do_dat_compression(tapedev, tapedesc, count);
+  else
+#endif
+#ifdef MTTELL
+  if (operation == MTTELL)
+    print_position (tapedev, tapedesc);
+  else
+#endif
+  {
+    if (operation == MTASF)
+      {
+	perform_operation (tapedev, tapedesc, MTREW, 1);
+	operation = MTFSF;
+      }
+    perform_operation (tapedev, tapedesc, operation, count);
+    if (operation == MTNOP)
+      print_status (tapedev, tapedesc);
+  }
+  
   if (rmtclose (tapedesc) == -1)
     error (2, errno, "%s", tapedev);
 
@@ -283,10 +516,28 @@
 
   control.mt_op = op;
   control.mt_count = count;
-  if (rmtioctl (desc, MTIOCTOP, &control))
+  /* Debian hack: The rmtioctl function returns -1 in case of an
+     error, not 0.  This bug has been reported to
+     "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
+  if (rmtioctl (desc, MTIOCTOP, &control) == -1)
     error (2, errno, "%s", dev);
 }
 
+#ifdef MTTELL
+void
+print_position (dev, desc)
+     char *dev;
+     int desc;
+{
+  struct mtpos position;
+
+  if (rmtioctl (desc, MTIOCPOS, &position) == -1)
+    error (2, errno, "%s", dev);
+  printf("At block %d.\n", (int) position.mt_blkno);
+
+}
+#endif
+
 void
 print_status (dev, desc)
      char *dev;
@@ -297,7 +548,35 @@
   if (rmtioctl (desc, MTIOCGET, &status))
     error (2, errno, "%s", dev);
 
-  printf ("drive type = %d\n", (int) status.mt_type);
+#ifdef MT_ISFTAPE_FLAG
+  if ((int) status.mt_type & MT_ISFTAPE_FLAG)
+    {
+      printf ("qic-117 drive type = 0x%05x, ", (int) status.mt_type & 0x1ffff);
+      if (GMT_DR_OPEN( (long) status.mt_gstat))
+	{
+	  printf ("no tape or door open\n");
+	}
+      else
+	{
+	  printf ("%s-line%s\n",
+		  GMT_ONLINE( (long) status.mt_gstat) ? "on" : "off",
+		  GMT_WR_PROT( (long) status.mt_gstat) ?
+		  " and write-protected" : "");
+	}
+    }
+  else
+#endif
+    {
+#ifdef MT_TAPE_INFO
+      struct mt_tape_info *mt;
+      for (mt = tapes; mt->t_type; mt++)
+	if (mt->t_type == status.mt_type) break;
+      if (mt->t_type != 0)
+	printf ("drive type = %s\n", mt->t_name);
+      else
+#endif
+	printf ("drive type = %d\n", (int) status.mt_type);
+    }
 #if defined(hpux) || defined(__hpux)
   printf ("drive status (high) = %d\n", (int) status.mt_dsreg1);
   printf ("drive status (low) = %d\n", (int) status.mt_dsreg2);
@@ -310,6 +589,60 @@
   printf ("file number = %d\n", (int) status.mt_fileno);
   printf ("block number = %d\n", (int) status.mt_blkno);
 #endif
+#if defined(linux) || defined(__linux)
+  if (status.mt_type == MT_ISSCSI1 ||
+      status.mt_type == MT_ISSCSI2)
+    {
+      int dens, i;
+      char *density;
+      dens = (status.mt_dsreg & MT_ST_DENSITY_MASK) >> MT_ST_DENSITY_SHIFT;
+      density = "unknown";
+      for (i=0; density_tbl[i].code >= 0; i++)
+	if (density_tbl[i].code == dens)
+	  {
+	    density = density_tbl[i].name;
+	    break;
+	  }
+      printf("Tape block size %d bytes. Density code 0x%x (%s).\n",
+	     (int)((status.mt_dsreg & MT_ST_BLKSIZE_MASK) >>
+		   MT_ST_BLKSIZE_SHIFT),
+	     dens, density);
+
+      printf("Soft error count since last status=%d\n",
+	     (int)(status.mt_erreg & MT_ST_SOFTERR_MASK) >>
+	     MT_ST_SOFTERR_SHIFT);
+      printf("General status bits on (%x):\n", (unsigned)status.mt_gstat);
+      if (GMT_EOF(status.mt_gstat))
+	printf(" EOF");
+      if (GMT_BOT(status.mt_gstat))
+	printf(" BOT");
+      if (GMT_EOT(status.mt_gstat))
+	printf(" EOT");
+      if (GMT_SM(status.mt_gstat))
+	printf(" SM");
+      if (GMT_EOD(status.mt_gstat))
+	printf(" EOD");
+      if (GMT_WR_PROT(status.mt_gstat))
+	printf(" WR_PROT");
+      if (GMT_ONLINE(status.mt_gstat))
+	printf(" ONLINE");
+      if (GMT_D_6250(status.mt_gstat))
+	printf(" D_6250");
+      if (GMT_D_1600(status.mt_gstat))
+	printf(" D_1600");
+      if (GMT_D_800(status.mt_gstat))
+	printf(" D_800");
+      if (GMT_DR_OPEN(status.mt_gstat))
+	printf(" DR_OPEN");	  
+      if (GMT_IM_REP_EN(status.mt_gstat))
+	printf(" IM_REP_EN");
+      printf("\n");
+    }
+  else
+    {
+      printf("gstat = %0x\n", (unsigned)status.mt_gstat);
+    }
+#endif
 }
 
 void
@@ -318,7 +651,122 @@
   int status;
 {
   fprintf (fp, "\
-Usage: %s [-V] [-f device] [--file=device] [--help] [--version] operation [count]\n",
+Usage: %s [-V] [-f device] [--file=device] [--rsh-command=command]\n\
+\t[--help] [--version] operation [count]\n",
 	   program_name);
   exit (status);
 }
+
+#if defined(linux) || defined(__linux)
+/*** Get and set the DAT compression (Mode Page 15) ***/
+
+#define MODE_SENSE 0x1a
+#define MODE_SELECT 0x15
+
+int
+read_mode_page(int fn, int page, int length, unsigned char *buffer,
+	       int do_mask)
+{
+  int result, *ip;
+  unsigned char tmpbuffer[30], *cmd;
+
+  memset(tmpbuffer, 0, 14);
+  ip = (int *)&(tmpbuffer[0]);
+  *ip = 0;
+  *(ip+1) = length + 4;
+
+  cmd = &(tmpbuffer[8]);
+  cmd[0] = MODE_SENSE;
+  cmd[1] = 8;
+  cmd[2] = page;
+  if (do_mask)
+    cmd[2] |= 0x40;  /* Get changeable parameter mask */
+  cmd[4] = length + 4;
+
+  result = ioctl(fn, 1, tmpbuffer);
+  if (result) {
+    fprintf(stderr, "Can't read mode page. Are you sure you are root?\n");
+    return 0;
+  }
+  memcpy(buffer, tmpbuffer + 8, length + 4);
+  return 1;
+}
+
+
+int
+write_mode_page(int fn, int page, int length, unsigned char *buffer)
+{
+  int result, *ip;
+  unsigned char tmpbuffer[40], *cmd;
+
+  memset(tmpbuffer, 0, 14);
+  ip = (int *)&(tmpbuffer[0]);
+  *ip = length + 4;
+  *(ip+1) = 0;
+
+  cmd = &(tmpbuffer[8]);
+  cmd[0] = MODE_SELECT;
+  cmd[1] = 0x10;
+  cmd[4] = length + 4;
+
+  memcpy(tmpbuffer + 14, buffer, length + 4);
+  tmpbuffer[14] = 0;  /* reserved data length */
+  tmpbuffer[18] &= 0x3f;  /* reserved bits in page code byte */
+
+  result = ioctl(fn, 1, tmpbuffer);
+  if (result) {
+    fprintf(stderr, "Can't write mode page.\n");
+    return 0;
+  }
+  return 1;
+}
+
+
+int
+do_dat_compression(char *dev, int fn, int count)
+{
+  int i;
+  unsigned char buffer[30], mask[30];
+
+  if (!read_mode_page(fn, 0x0f, 16, buffer, 0)) {
+    error (2, errno, "%s", dev);
+  }
+
+  if (count != 1) {
+    if (read_mode_page(fn, 0x0f, 16, mask, 1))
+      if (mask[4+2] & 0x80 == 0)
+        fprintf(stderr, "Device does not allow setting this parameter.\n");
+    if (count == 0)
+      buffer[4+2] &= 0x7f;
+    else {
+      buffer[4+2] |= 0x80;
+      if (buffer[4+2+1] & 0x80 == 0) {
+        fprintf(stderr, "Warning: Decompression is disabled.  Enabling.\n");
+        buffer[4+2+1] |= 0x80;
+      }
+    }
+      buffer[1] = 0;
+    if (!write_mode_page(fn, 0x0f, 16, buffer)) {
+      error (2, errno, "%s", dev);
+    }
+    if (!read_mode_page(fn, 0x0f, 16, buffer, 0)) {  /* Re-read to check */
+      error (2, errno, "%s", dev);
+    }
+  }
+
+  if (buffer[4+2] & 0x80)
+    printf("Compression on.\n");
+  else
+    printf("Compression off.\n");
+  if (buffer[4+2] & 0x40)
+    printf("Compression capable.\n");
+  else
+    printf("Compression not capable.\n");
+  if (buffer[4+2+1] & 0x80)
+    printf("Decompression capable.\n");
+  else
+    printf("Decompression not capable.\n");
+
+  return 1;
+}
+#endif
--- cpio-2.4.2/rmt.c.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/rmt.c	Tue Jun 26 13:59:12 2001
@@ -45,9 +45,9 @@
 #endif
 #include <errno.h>
 
-#if defined (_I386) && defined (_AIX)
+/* Debian hack: gcc has exhibited problems loading fcntl.h.  Therefore,
+   I removed the preprocessor conditionals here - BEM */
 #include <fcntl.h>
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -78,7 +78,23 @@
 #include <errno.h>
 #else
 extern errno;
-extern char *sys_errlist[];
+extern const char *const _sys_errlist[];
+#if HAVE_STRERROR || _LIBC
+#ifndef strerror
+char *strerror();
+#endif
+#else
+static char *private_strerror(errnum)
+	int errnum;
+{
+	extern char *sys_errlist[];
+	extern int sys_nerr;
+	if(errnum>0 && errnum<=sys_nerr)
+		return sys_errlist[errnum];
+	return "Unknown system error";
+}
+#define strerror private_strerror
+#endif
 #endif
 char resp[BUFSIZ];
 
@@ -87,6 +103,30 @@
 #define	DEBUG1(f,a)	if (debug) fprintf(debug, f, a)
 #define	DEBUG2(f,a1,a2)	if (debug) fprintf(debug, f, a1, a2)
 
+/*
+ * Support for Sun's extended RMT protocol
+ */
+#define RMTI_VERSION	-1
+#define RMT_VERSION	1
+
+/* Extended 'i' commands */
+#define RMTI_CACHE	0
+#define RMTI_NOCACHE	1
+#define RMTI_RETEN	2
+#define RMTI_ERASE	3
+#define RMTI_EOM	4
+#define RMTI_NBSF	5
+
+/* Extended 's' comands */
+#define MTS_TYPE	'T'
+#define MTS_DSREG	'D'
+#define MTS_ERREG	'E'
+#define MTS_RESID	'R'
+#define MTS_FILENO	'F'
+#define MTS_BLKNO	'B'
+#define MTS_FLAGS	'f'
+#define MTS_BF		'b'
+
 int
 main (argc, argv)
      int argc;
@@ -200,7 +240,12 @@
       getstring (op);
       getstring (count);
       DEBUG2 ("rmtd: I %s %s\n", op, count);
+      if (atoi(op) == RMTI_VERSION)
+      {
+	  rval = RMT_VERSION;
+      }
 #ifdef MTIOCTOP
+      else
       {
 	struct mtop mtop;
 	mtop.mt_op = atoi (op);
@@ -212,6 +257,58 @@
 #endif
       goto respond;
 
+    case 'i':
+      {
+	struct mtop mtop;
+	
+	getstring (op);
+	getstring (count);
+	DEBUG2 ("rmtd: i %s %s\n", op, count);
+	switch (atoi(op))
+	{
+#ifdef MTCACHE
+	  case RMTI_CACHE:
+	    mtop.mt_op = MTCACHE;
+	    break;
+#endif
+#ifdef MTNOCACHE
+	  case RMTI_NOCACHE:
+	    mtop.mt_op = MTNOCACHE;
+	    break;
+#endif
+#ifdef MTRETEN
+	  case RMTI_RETEN:
+	    mtop.mt_op = MTRETEN;
+	    break;
+#endif
+#ifdef MTERASE
+	  case RMTI_ERASE:
+	    mtop.mt_op = MTERASE;
+	    break;
+#endif
+#ifdef MTEOM
+	  case RMTI_EOM:
+	    mtop.mt_op = MTEOM;
+	    break;
+#endif
+#ifdef MTNBSF
+	  case RMTI_NBSF:
+	    mtop.mt_op = MTNBSF;
+	    break;
+#endif
+	  default:
+	    errno = EINVAL;
+	    goto ioerror;
+	}
+#ifdef MTIOCTOP
+	mtop.mt_count = atoi (count);
+	if (ioctl (tape, MTIOCTOP, (char *) &mtop) < 0)
+	  goto ioerror;
+	rval = mtop.mt_count;
+      }
+#endif
+      goto respond;
+
     case 'S':			/* status */
       DEBUG ("rmtd: S\n");
       {
@@ -227,6 +324,59 @@
 	goto top;
       }
 
+    case 's':
+      {
+	char s;
+	struct mtget mtget;
+
+	if (read (0, &s, 1) != 1)
+	  goto top;
+	
+#ifdef MTIOCGET
+	if (ioctl (tape, MTIOCGET, (char *) &mtget) < 0)
+	  goto ioerror;
+#endif
+	switch (s)
+	{
+	  case MTS_TYPE:
+	    rval = mtget.mt_type;
+	    break;
+
+	  case MTS_DSREG:
+	    rval = mtget.mt_dsreg;
+	    break;
+
+	  case MTS_ERREG:
+	    rval = mtget.mt_erreg;
+	    break;
+
+	  case MTS_RESID:
+	    rval = mtget.mt_resid;
+	    break;
+
+	  case MTS_FILENO:
+	    rval = mtget.mt_fileno;
+	    break;
+
+	  case MTS_BLKNO:
+	    rval = mtget.mt_blkno;
+	    break;
+
+	  case MTS_FLAGS:
+	    rval = mtget.mt_gstat;
+	    break;
+
+	  case MTS_BF:
+	    rval = 0;
+	    break;
+
+	  default:
+	    errno = EINVAL;
+	    goto ioerror;
+	}
+	goto respond;
+      }
+
     default:
       DEBUG1 ("rmtd: garbage command %c\n", c);
       exit (3);
@@ -289,7 +439,11 @@
      int num;
 {
 
-  DEBUG2 ("rmtd: E %d (%s)\n", num, sys_errlist[num]);
-  (void) sprintf (resp, "E%d\n%s\n", num, sys_errlist[num]);
+/* Debian hack: rmt has problems on systems (such as the Hurd) where
+   sys_errlist is not available therefore I borrowed some code from
+   error.c to fix this problem.  This has been reported to the upstream
+   maintainers.  (7/22/99) - BEM */
+  DEBUG2 ("rmtd: E %d (%s)\n", num, strerror (num));
+  (void) sprintf (resp, "E%d\n%s\n", num, strerror (num));
   (void) write (1, resp, strlen (resp));
 }
--- cpio-2.4.2/cpio.texi.debian	Wed Dec 20 17:29:34 1995
+++ cpio-2.4.2/cpio.texi	Tue Jun 26 13:51:18 2001
@@ -257,10 +257,11 @@
 @example
 cpio @{-o|--create@} [-0acvABLV] [-C bytes] [-H format]
 [-M message] [-O [[user@@]host:]archive] [-F [[user@@]host:]archive]
-[--file=[[user@@]host:]archive] [--format=format] [--sparse]
+[--file=[[user@@]host:]archive] [--format=format]
 [--message=message][--null] [--reset-access-time] [--verbose]
 [--dot] [--append] [--block-size=blocks] [--dereference]
-[--io-size=bytes] [--help] [--version] < name-list [> archive]
+[--io-size=bytes] [--rsh-command=command] [--help] [--version]
+< name-list [> archive]
 @end example
 
 @node Copy-in mode, Copy-pass mode, Copy-out mode, Invoking `cpio'
@@ -286,9 +287,9 @@
 [--dot] [--unconditional] [--verbose] [--block-size=blocks]
 [--swap-halfwords] [--io-size=bytes] [--pattern-file=file]
 [--format=format] [--owner=[user][:.][group]]
-[--no- preserve-owner] [--message=message] [--help] [--version]
-[-no-abosolute-filenames] [-only-verify-crc] [-quiet]
-[pattern...] [< archive]
+[--no-preserve-owner] [--message=message] [--help] [--version]
+[-no-abosolute-filenames] [--sparse] [-only-verify-crc] [-quiet]
+[--rsh-command=command] [pattern...] [< archive]
 @end example
 
 @node Copy-pass mode, Options, Copy-in mode, Invoking `cpio'
@@ -492,6 +493,10 @@
 separator is given, use the given user's login group.  Only the
 super-user can change files' ownership.
 
+@item --rsh-command=COMMAND
+Notifies cpio that is should use COMMAND to communicate with remote
+devices.
+
 @item -s, --swap-bytes
 Swap the bytes of each halfword (pair of bytes) in the files.This option
 can be used in copy-in mode.
@@ -502,7 +507,7 @@
 
 @item --sparse
 Write files with large blocks of zeros as sparse files.  This option is
-used in copy-out and copy-pass modes.
+used in copy-in and copy-pass modes.
 
 @item -t, --list
 Print a table of contents of the input.
--- cpio-2.4.2/rmt.sh.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/rmt.sh	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# This is not a mistake.  This shell script (/etc/rmt) has been provided
+# for compatibility with other Unix-like systems, some of which have
+# utilities that expect to find (and execute) rmt in the /etc directory
+# on remote systems.
+#
+exec /usr/sbin/rmt
--- cpio-2.4.2/debian/prerm.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/debian/prerm	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+
+# movedoc - function to make the transition /usr/doc -> /usr/share/doc
+movedoc()
+{
+    PKG=cpio
+    OLD=/usr/doc/$PKG
+    if test -h $OLD; then
+	rm -f $OLD
+    fi
+}
+
+if [ "$1" = remove ]; then 
+    update-alternatives --remove mt /bin/mt-gnu
+    install-info --quiet --remove /usr/info/cpio.info
+    if test -L /sbin/rmt -a /sbin/rmt -ef /usr/sbin/rmt; then
+	rm -f /sbin/rmt
+    fi
+    movedoc
+fi
--- cpio-2.4.2/debian/changelog.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/debian/changelog	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,217 @@
+cpio (2.4.2-36) unstable; urgency=low
+
+  * Fixed error with mt alternatives.  (Closes: Bug#84476)
+
+ -- Brian Mays <brian@debian.org>  Fri,  2 Feb 2001 15:05:22 -0500
+
+cpio (2.4.2-35) unstable; urgency=low
+
+  * Renamed gmt to mt-gnu.  (Closes: Bug#84118)
+
+ -- Brian Mays <brian@debian.org>  Tue, 30 Jan 2001 19:42:28 -0500
+
+cpio (2.4.2-34) unstable; urgency=low
+
+  * Added an environment variable to cpio and mt to specify the remote
+    command.  (Closes: Bug#71048)
+  * Added compatibility with the mt-st package.  (Closes: Bug#83813)
+
+ -- Brian Mays <brian@debian.org>  Sun, 28 Jan 2001 16:15:44 -0500
+
+cpio (2.4.2-33) unstable; urgency=low
+
+  * Added density code 0x22 (SLR4DC) to mt.  (Closes: Bug#67424)
+
+ -- Brian Mays <brian@debian.org>  Thu, 27 Jul 2000 17:49:56 -0400
+
+cpio (2.4.2-32) frozen unstable; urgency=low
+
+  * Added patch by Fred Long <flong@sea.com> and Marc SCHAEFER
+    <schaefer@alphanet.ch> to fix file corruption when a file changes
+    during the backup.  (Closes: Bug#53056)
+  * Added patch from Anders Hammarquist <iko@dd.chalmers.se> to make
+    rmt work with Solaris ufsdump/ufsrestore.  (Closes: Bug#58323)
+
+ -- Brian Mays <brian@debian.org>  Thu, 17 Feb 2000 12:43:01 -0500
+
+cpio (2.4.2-31) frozen unstable; urgency=low
+
+  * Fixed missing element from manpage.  (Closes: Bug#56904)
+
+ -- Brian Mays <brian@debian.org>  Thu,  3 Feb 2000 13:39:55 -0500
+
+cpio (2.4.2-30) frozen unstable; urgency=low
+
+  * Added build-time dependencies.
+
+ -- Brian Mays <brian@debian.org>  Mon, 17 Jan 2000 13:32:18 -0500
+
+cpio (2.4.2-29) unstable; urgency=low
+
+  * Added patch from Mark Eichin to fix mt's datcompression.  (Closes:
+    Bug#52755)
+
+ -- Brian Mays <brian@debian.org>  Fri, 17 Dec 1999 14:14:40 -0500
+
+cpio (2.4.2-28) unstable; urgency=low
+
+  * Modified cpio so that the -v and -V flags work with
+    --only-verify-crc.  (Closes: Bug#49791)
+
+ -- Brian Mays <brian@debian.org>  Wed, 10 Nov 1999 08:42:34 -0500
+
+cpio (2.4.2-27) unstable; urgency=low
+
+  * Fixed FHS /usr/doc -> /usr/share/doc transition scheme.
+
+ -- Brian Mays <brian@debian.org>  Fri,  1 Oct 1999 12:43:24 -0400
+
+cpio (2.4.2-26) unstable; urgency=low
+
+  * Added symbolic link /usr/doc/cpio -> /usr/share/doc/cpio.
+
+ -- Brian Mays <brian@debian.org>  Thu, 16 Sep 1999 13:45:04 -0400
+
+cpio (2.4.2-25) unstable; urgency=low
+
+  * Changed section to "utils".
+  * Made /etc/rmt a wrapper script (with comments detailing its purpose)
+    instead of a symlink.
+  * Removed tar from cpio man page.  (Closes: Bug#38043)
+  * Moved doc, man, and info to /usr/share as per the FHS.
+  * Fixed bug in rmt causing problems on systems (such as the Hurd)
+    where sys_errlist is not available.  (Closes: Bug#37164)
+
+ -- Brian Mays <brian@debian.org>  Thu, 22 Jul 1999 12:04:32 -0400
+
+cpio (2.4.2-24) unstable; urgency=low
+
+  * Made Debian scripts create and remove the symbolic links to rmt.
+    (Closes: Bug#33670)
+
+ -- Brian Mays <brian@debian.org>  Mon, 22 Feb 1999 17:24:21 -0500
+
+cpio (2.4.2-23) frozen unstable; urgency=low
+
+  * Fixed a bug causing cpio to segfault when the tar format is used.
+  * Fixed bugs causing cpio to use the wrong minor device numbers.
+
+ -- Brian Mays <brian@debian.org>  Wed,  6 Jan 1999 09:59:24 -0500
+
+cpio (2.4.2-22) unstable frozen; urgency=low
+
+  * Fixed "Lwhence\noffset\n" error in rmt manual page.  (Fixes:
+    Bug#28960)
+
+ -- Brian Mays <brian@debian.org>  Fri,  6 Nov 1998 11:01:57 -0500
+
+cpio (2.4.2-21) unstable; urgency=low
+
+  * Modified cpio to use the -n flag also to extract tar archives using
+    the numeric UID/GID instead of the user/group names in /etc/passwd
+    and /etc/groups.
+
+ -- Brian Mays <brian@debian.org>  Thu, 15 Oct 1998 15:20:34 -0400
+
+cpio (2.4.2-20) unstable; urgency=low
+
+  * Fixed bug in --sparse feature.
+
+ -- Brian Mays <brian@debian.org>  Mon,  5 Oct 1998 12:51:47 -0400
+
+cpio (2.4.2-19) unstable; urgency=low
+
+  * Added NEWS and README to /usr/doc/cpio.  (Fixes: Bug#26338)
+
+ -- Brian Mays <brian@debian.org>  Wed,  2 Sep 1998 13:32:18 -0400
+
+cpio (2.4.2-18) unstable; urgency=low
+
+  * Added patch from Evan Harris to fix mt's datcompression.  (Fixes:
+    Bug#23980)
+
+ -- Brian Mays <brian@debian.org>  Mon, 29 Jun 1998 11:35:57 -0400
+
+cpio (2.4.2-17) unstable; urgency=low
+
+  * Added patch necessary to build cpio in glibc_2.1.  (Provided by
+    Juan Cespedes <cespedes@debian.org>.)  (Fixes: Bug#22643)
+  * Added a --rsh-command command line option (similar to tar's) to
+    cpio and mt.
+  * Made ssh the default remote command.
+
+ -- Brian Mays <brian@debian.org>  Tue, 26 May 1998 13:01:27 -0400
+
+cpio (2.4.2-16) unstable frozen; urgency=low
+
+  * Fixed problem causing corruption of old style ascii cpio archives.
+    Problem caused by a change in the dev_t type used by glibc.
+    (Fixes: Bug#22857)
+
+ -- Brian Mays <brian@debian.org>  Tue, 26 May 1998 13:01:19 -0400
+
+cpio (2.4.2-15) frozen unstable; urgency=low
+
+  * Added a patch required for cpio to compile on a PowerPC.  Fixes:
+    Bug#21411.
+  * Removed bashisms from the debian/rules makefile.
+
+ -- Brian Mays <brian@debian.org>  Mon, 20 Apr 1998 14:20:36 -0400
+
+cpio (2.4.2-14) unstable; urgency=low
+
+  * Removed old FSF address from copyright file.
+
+ -- Brian Mays <brian@debian.org>  Thu, 12 Feb 1998 17:45:29 -0500
+
+cpio (2.4.2-13) unstable; urgency=low
+
+  * Changed the function responsible for processing the count parameter
+    from atoi() to strtol().  This will allow entries such as 0x24 to be
+    used.
+
+ -- Brian Mays <brian@debian.org>  Fri,  5 Dec 1997 17:21:08 -0500
+
+cpio (2.4.2-12) unstable; urgency=low
+
+  * Added patch to report more information on FTAPE drives.
+  * Made several miscellaneous fixes to source.
+
+ -- Brian Mays <brian@debian.org>  Sun, 26 Oct 1997 15:47:59 -0500
+
+cpio (2.4.2-11) unstable; urgency=low
+
+  * Libc6 release.
+
+ -- Brian Mays <brian@debian.org>  Tue,  5 Aug 1997 16:53:14 -0400
+
+cpio (2.4.2-10) unstable; urgency=low
+
+  * Added CR at end of `mt status' output (fixed Bug#7632).
+
+ -- Brian Mays <brian@debian.org>  Tue, 25 Feb 1997 12:15:09 -0500
+
+cpio (2.4.2-9) unstable; urgency=low
+
+  * Fixed a couple of bugs.
+  * Moved /usr/doc/cpio/ChangeLog.gz to /usr/doc/cpio/changelog.gz.
+
+ -- Brian Mays <brian@debian.org>  Thu, 2 Jan 1997 12:18:39 -0500
+
+cpio (2.4.2-8) unstable; urgency=low
+
+  * Fixed bug #4427, wrong syscall used to print position of tape.
+
+ -- Brian Mays <brian@debian.org>  Thu, 12 Sep 1996 09:55:21 -0400
+
+cpio (2.4.2-7) unstable; urgency=low
+
+  * New upstream source.
+  * Added an rmt manpage (from BSD).
+  * First release with the new source format.
+
+ -- Brian Mays <brian@debian.org>  Fri, 23 Aug 1996 23:27:40 -0400
+
+Local variables:
+mode: debian-changelog
+End:
--- cpio-2.4.2/debian/rules.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/debian/rules	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,89 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# debian/rules file - for cpio
+# Copyright 1996-99 by Brian Mays
+# Patterned after the hello package by Ian Jackson.
+
+package=cpio
+
+Makefile:
+	$(checkdir)
+	./configure --prefix=/usr/share --exec_prefix=
+
+build:	Makefile
+	$(checkdir)
+	$(MAKE) CFLAGS='-O2 -g -Wall' all rmt info
+	touch build
+
+clean:
+	$(checkdir)
+	$(RM) build
+	$(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
+	$(RM) config.cache
+	$(RM) -r *~ debian/tmp debian/*~ debian/files*
+
+binary-indep:	checkroot build
+	$(checkdir)
+
+binary-arch:	checkroot build
+	$(chechdir)
+	$(RM) -r debian/tmp
+	install -d debian/tmp debian/tmp/DEBIAN
+	install -d debian/tmp/usr/share/doc/$(package)
+# Install Debian package control information files
+	install debian/postinst \
+		debian/prerm debian/tmp/DEBIAN/.
+# Install directories
+	install -d	\
+		debian/tmp/etc	\
+		debian/tmp/sbin	\
+		debian/tmp/bin	\
+		debian/tmp/usr/sbin	\
+		debian/tmp/usr/share/man/man1	\
+		debian/tmp/usr/share/man/man8	\
+		debian/tmp/usr/share/info
+# Install files
+	$(MAKE) install prefix=debian/tmp/usr/share exec_prefix=debian/tmp \
+	  libexecdir=debian/tmp/usr/sbin
+	mv debian/tmp/bin/mt debian/tmp/bin/mt-gnu 
+	mv debian/tmp/usr/share/man/man1/mt.1 \
+	  debian/tmp/usr/share/man/man1/mt-gnu.1
+# Strip binaries
+	strip debian/tmp/bin/*
+	strip debian/tmp/usr/sbin/*
+# Install documentation
+	install -m 644 ChangeLog debian/tmp/usr/share/doc/$(package)/changelog
+	install -m 644 NEWS README debian/tmp/usr/share/doc/$(package)/.
+# Install changelog & copyright
+	install -m 644 debian/changelog \
+	  debian/tmp/usr/share/doc/$(package)/changelog.Debian
+	install -m 644 rmt.8 debian/tmp/usr/share/man/man8/.
+	install rmt.sh debian/tmp/etc/rmt
+	gzip -9v debian/tmp/usr/share/doc/$(package)/*
+	gzip -9v debian/tmp/usr/share/man/*/*
+	gzip -9v debian/tmp/usr/share/info/*
+	install -m 644 debian/copyright debian/tmp/usr/share/doc/$(package)/.
+# Determine shared library dependencies
+	dpkg-shlibdeps cpio mt rmt
+# Genereate deb file
+	dpkg-gencontrol
+	chown -R root.root debian/tmp
+	chmod -R g-ws debian/tmp
+	dpkg-deb --build debian/tmp ..
+
+define checkdir
+	test -f $(package).h -a -f debian/rules
+endef
+
+# Below here is fairly generic really
+
+binary:		binary-indep binary-arch
+
+source diff:
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+checkroot:
+	$(checkdir)
+	test root = "`whoami`"
+
+.PHONY: binary binary-arch binary-indep clean checkroot
--- cpio-2.4.2/debian/postinst.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/debian/postinst	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,34 @@
+#!/bin/sh -e
+
+# movedoc - function to make the transition /usr/doc -> /usr/share/doc
+movedoc()
+{
+    PKG=cpio
+    OLD=/usr/doc/$PKG
+    NEW=/usr/share/doc/$PKG
+    if test -d $OLD -a ! -h $OLD -a ! $OLD -ef $NEW; then
+	rm -f $OLD/.dhelp
+	if test -e $OLD && ! rmdir $OLD 2>/dev/null; then
+	    VERSION_CONTROL=t \
+	    cp -ab $OLD $NEW/..
+	    rm -rf $OLD
+	fi
+    fi
+    if test -d /usr/doc -a ! -e $OLD -a -d $NEW; then
+	ln -s $NEW $OLD
+    fi
+}
+
+if [ "$1" = configure ]; then
+    # Fix some screwup in old package
+    case "$2" in
+    2.4.2-3[45]) update-alternatives --remove mt /bin/gmt; esac
+    update-alternatives --install /bin/mt mt /bin/mt-gnu 10 \
+      --slave \
+	/usr/share/man/man1/mt.1.gz mt.1.gz /usr/share/man/man1/mt-gnu.1.gz
+    install-info --quiet \
+      --description="A program to manage archives of files." \
+      --section "General Commands" "General Commands" /usr/info/cpio.info
+    test -f /sbin/rmt || ln -s ../usr/sbin/rmt /sbin/rmt
+    movedoc
+fi
--- cpio-2.4.2/debian/copyright.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/debian/copyright	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,69 @@
+This is the Debian GNU/Linux prepackaged version of GNU cpio
+(including mt).
+
+This package was put together by Ian Murdock <imurdock@debian.org>,
+from sources obtained from:
+ prep.ai.mit.edu:/pub/gnu
+
+This package has been modified by Brian Mays <brian@debian.org>.
+Modifications of cpio package for Debian GNU/Linux Copyright (C) 1996-99
+Brian Mays and are released under the GPL (on Debian systems see
+`/usr/doc/copyright/GPL').
+
+Changes:
+ * added Debian GNU/Linux package maintenance system files
+ * moved rmt from /etc to /usr/sbin and installed a symbolic link to
+   /usr/sbin/rmt
+ * split cpio and mt into two separate Debian binary packages
+ * fixed 'mt -V' bug
+ * modified cpio to print a list of filenames terminated by a null
+   character when the -t and -0 flags are used
+ * eliminated a spurious error message printed when the -a flag is
+   used on a read-only filesystem
+ * fixed a remote ioctl bug in mt that caused spurious error messages
+   when commands were sent to a remote tape device
+ * added SCSI support to mt
+ * fixed 'cpio --sparse' bug
+ * added an rmt man page (from BSD).
+ * fixed a bug that could cause an endless loop
+ * fixed a bug that can occur when restoring a whole filesystem
+ * fixed problem causing corruption of old style ascii cpio archives
+ * fixed a bug that prevents cpio from being compiled with glibc 2.1
+ * added an rsh-command option to cpio and mt
+ * made ssh the default remote command (instead of rsh)
+ * fixed bug causing cpio to segfault when the tar format is used
+ * fixed bugs causing cpio to use the wrong minor device numbers
+ * fixed bug in rmt causing problems on systems (such as the Hurd)
+   where sys_errlist is not available
+ * modified cpio so that the -v and -V flags work with
+   --only-verify-crc
+
+GNU cpio is Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 dated June, 1991.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/doc/copyright/GPL'.
+
+rmt.c is Copyright (C) 1983 Regents of the University of California.
+
+   All rights reserved.
+
+   Redistribution and use in source and binary forms are permitted
+   provided that the above copyright notice and this paragraph are
+   duplicated in all such forms and that any documentation,
+   advertising materials, and other materials related to such
+   distribution and use acknowledge that the software was developed
+   by the University of California, Berkeley.  The name of the
+   University may not be used to endorse or promote products derived
+   from this software without specific prior written permission.
+   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
--- cpio-2.4.2/debian/control.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/debian/control	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,21 @@
+Source: cpio
+Section: utils
+Priority: important
+Maintainer: Brian Mays <brian@debian.org>
+Build-Depends: texinfo
+Standards-Version: 3.2.1.0
+
+Package: cpio
+Architecture: any
+Depends: ${shlibs:Depends}
+Replaces: cpio-mt
+Conflicts: mt-st(<<0.6), cpio-mt
+Description: GNU cpio -- a program to manage archives of files.
+ GNU cpio is a tool for creating and extracting archives, or copying
+ files from one place to another.  It handles a number of cpio formats
+ as well as reading and writing tar files.
+ .
+ This package also includes rmt, the remote tape server, and GNU mt, a
+ tape drive control program.  The mt program is essential for magnetic
+ tape drive users.  Debian's version of GNU mt supports SCSI tape
+ drives.
--- cpio-2.4.2/debian/substvars.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/debian/substvars	Tue Jun 26 13:51:18 2001
@@ -0,0 +1 @@
+shlibs:Depends=libc6 (>= 2.1.97)
--- cpio-2.4.2/rmt.8.debian	Tue Jun 26 13:51:18 2001
+++ cpio-2.4.2/rmt.8	Tue Jun 26 13:51:18 2001
@@ -0,0 +1,223 @@
+.\" Copyright (c) 1983, 1991, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"	This product includes software developed by the University of
+.\"	California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"     @(#)rmt.8	8.2 (Berkeley) 12/11/93
+.\"
+.Dd December 11, 1993
+.Dt RMT 8
+.Os BSD 4.2
+.Sh NAME
+.Nm rmt
+.Nd remote magtape protocol module
+.Sh SYNOPSIS
+.Nm rmt
+.Sh DESCRIPTION
+.Nm Rmt
+is a program used by tar, cpio, mt, and the remote dump and restore
+programs in manipulating a magnetic tape drive through an interprocess
+communication connection.
+.Nm Rmt
+is normally started up with an
+.Xr rexec 3
+or
+.Xr rcmd 3
+call or the
+.Xr rsh 1
+command.
+.Pp
+The 
+.Nm rmt
+program accepts requests specific to the manipulation of
+magnetic tapes, performs the commands, then responds with
+a status indication.  All responses are in
+.Tn ASCII
+and in
+one of two forms. 
+Successful commands have responses of:
+.Bd -filled -offset indent
+.Sm off
+.Sy A Ar number No \en
+.Sm on
+.Ed
+.Pp
+.Ar Number
+is an
+.Tn ASCII
+representation of a decimal number.
+Unsuccessful commands are responded to with:
+.Bd -filled -offset indent
+.Sm off
+.Xo Sy E Ar error-number
+.No \en Ar error-message
+.No \en
+.Xc
+.Sm on
+.Ed
+.Pp
+.Ar Error-number
+is one of the possible error
+numbers described in
+.Xr intro 2
+and
+.Ar error-message
+is the corresponding error string as printed
+from a call to
+.Xr perror 3 .
+The protocol is comprised of the
+following commands, which are sent as indicated - no spaces are supplied
+between the command and its arguments, or between its arguments, and
+.Ql \en
+indicates that a newline should be supplied:
+.Bl -tag -width Ds
+.Sm off
+.It Xo Sy \&O Ar device
+.No \en Ar mode No \en
+.Xc
+Open the specified 
+.Ar device
+using the indicated
+.Ar mode .
+.Ar Device
+is a full pathname and
+.Ar mode
+is an
+.Tn ASCII
+representation of a decimal
+number suitable for passing to
+.Xr open 2 .
+If a device had already been opened, it is
+closed before a new open is performed.
+.It Xo Sy C Ar device No \en
+.Xc
+Close the currently open device.  The
+.Ar device
+specified is ignored.
+.It Xo Sy L
+.Ar offset No \en
+.Ar whence No \en
+.Xc
+.Sm on
+Perform an
+.Xr lseek 2
+operation using the specified parameters.
+The response value is that returned from the
+.Xr lseek
+call.
+.Sm off
+.It Sy W Ar count No \en
+.Sm on
+Write data onto the open device.
+.Nm Rmt
+reads
+.Ar count
+bytes from the connection, aborting if
+a premature end-of-file is encountered.
+The response value is that returned from
+the
+.Xr write 2
+call.
+.Sm off
+.It Sy R Ar count No \en
+.Sm on
+Read
+.Ar count
+bytes of data from the open device.
+If
+.Ar count
+exceeds the size of the data buffer (10 kilobytes), it is
+truncated to the data buffer size.
+.Nm rmt
+then performs the requested 
+.Xr read 2
+and responds with 
+.Sm off
+.Sy A Ar count-read No \en
+.Sm on
+if the read was
+successful; otherwise an error in the
+standard format is returned.  If the read
+was successful, the data read is then sent.
+.Sm off
+.It Xo Sy I Ar operation
+.No \en Ar count No \en
+.Xc
+.Sm on
+Perform a
+.Dv MTIOCOP
+.Xr ioctl 2
+command using the specified parameters.
+The parameters are interpreted as the
+.Tn ASCII
+representations of the decimal values
+to place in the 
+.Ar mt_op
+and
+.Ar mt_count
+fields of the structure used in the
+.Xr ioctl
+call.  The return value is the
+.Ar count
+parameter when the operation is successful.
+.It Sy S
+Return the status of the open device, as
+obtained with a
+.Dv MTIOCGET
+.Xr ioctl
+call.  If the operation was successful,
+an ``ack'' is sent with the size of the
+status buffer, then the status buffer is
+sent (in binary).
+.El
+.Sm on
+.Pp
+Any other command causes 
+.Nm rmt
+to exit.
+.Sh DIAGNOSTICS
+All responses are of the form described above.
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr cpio 1 ,
+.Xr mt 1 ,
+.Xr rsh 1 ,
+.Xr rcmd 3 ,
+.Xr rexec 3 ,
+.Xr mtio 4 ,
+.Xr rdump 8 ,
+.Xr rrestore 8
+.Sh BUGS
+People should be discouraged from using this for a remote
+file access protocol.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
