]> git.pld-linux.org Git - packages/cpio.git/blob - cpio-debian36.patch
6e6324b5a3fb522d1f7eeca95f2a165a7a7bae91
[packages/cpio.git] / cpio-debian36.patch
1 --- cpio-2.4.2/copyin.c.debian  Tue Jun 26 13:51:18 2001
2 +++ cpio-2.4.2/copyin.c Tue Jun 26 13:55:21 2001
3 @@ -29,6 +29,10 @@
4  #include <fnmatch.h>
5  #endif
6  
7 +/* Debian hack to fix a bug in the --sparse option.  This bug has been
8 +   reported to "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
9 +extern int delayed_seek_count;
10 +
11  static void read_pattern_file ();
12  static void tape_skip_padding ();
13  static void defer_copyin ();
14 @@ -490,12 +494,13 @@
15             }
16           else
17             {
18 -             char *non_abs_name;
19 -
20 -             non_abs_name = (char *) xmalloc (strlen (p) + 1);
21 -             strcpy (non_abs_name, p);
22 -             free (file_hdr.c_name);
23 -             file_hdr.c_name = non_abs_name;
24 +              /* Debian hack: file_hrd.c_name is sometimes set to
25 +                 point to static memory by code in tar.c.  This
26 +                 causes a segfault.  Therefore, memmove is used
27 +                 instead of freeing and reallocating.  (Reported by
28 +                 Horst Knobloch.)  This bug has been reported to
29 +                 "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */
30 +             (void)memmove (file_hdr.c_name, p, (size_t)(strlen (p) + 1));
31             }
32         }
33  
34 @@ -546,7 +551,11 @@
35                 long_format (&file_hdr, (char *) 0);
36             }
37           else
38 -           printf ("%s\n", file_hdr.c_name);
39 +           /* Debian hack: Modified to print a list of filenames
40 +               terminiated by a null character when the -t and -0
41 +               flags are used.  This has been submitted as a
42 +               suggestion to "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
43 +           printf ("%s%c", file_hdr.c_name, name_end);
44  
45           crc = 0;
46           tape_toss_input (in_file_des, file_hdr.c_filesize);
47 @@ -586,6 +595,12 @@
48             if (crc != file_hdr.c_chksum)
49               error (0, 0, "%s: checksum error (0x%x, should be 0x%x)",
50                      file_hdr.c_name, crc, file_hdr.c_chksum);
51 +         /* Debian hack: -v and -V now work with --only-verify-crc.
52 +            (99/11/10) -BEM */
53 +           if (verbose_flag)
54 +             fprintf (stderr, "%s\n", file_hdr.c_name);
55 +           if (dot_flag)
56 +             fputc ('.', stderr);
57         }
58        else
59         {
60 @@ -611,7 +626,28 @@
61                   continue;
62                 }
63               else
64 -               file_hdr.c_name = xstrdup (new_name.ds_string);
65 +              /* Debian hack: file_hrd.c_name is sometimes set to
66 +                 point to static memory by code in tar.c.  This
67 +                 causes a segfault.  This has been fixed and an
68 +                 additional check to ensure that the file name
69 +                 is not too long has been added.  (Reported by
70 +                 Horst Knobloch.)  This bug has been reported to
71 +                 "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */
72 +               {
73 +                 if (archive_format != arf_tar && archive_format != arf_ustar)
74 +                   {
75 +                     free (file_hdr.c_name);
76 +                     file_hdr.c_name = xstrdup (new_name.ds_string);
77 +                   }
78 +                 else
79 +                   {
80 +                     if (is_tar_filename_too_long (new_name.ds_string))
81 +                       error (0, 0, "%s: file name too long",
82 +                              new_name.ds_string);
83 +                     else
84 +                       strcpy (file_hdr.c_name, new_name.ds_string);
85 +                   }
86 +               }
87             }
88  
89           /* See if the file already exists.  */
90 @@ -682,8 +718,10 @@
91                      but GNU cpio version 2.0-2.2 didn't do that, so we
92                      still have to check for links here (and also in case
93                      the archive was created and later appeneded to). */
94 +                 /* Debian hack: (97/1/2) This was reported by Ronald
95 +                    F. Guilmette to the upstream maintainers. -BEM */
96                   link_res = link_to_maj_min_ino (file_hdr.c_name, 
97 -                               file_hdr.c_dev_maj, file_hdr.c_dev_maj,
98 +                               file_hdr.c_dev_maj, file_hdr.c_dev_min,
99                                 file_hdr.c_ino);
100                   if (link_res == 0)
101                     {
102 @@ -696,8 +734,10 @@
103                   && archive_format != arf_ustar)
104                 {
105                   int link_res;
106 +                 /* Debian hack: (97/1/2) This was reported by Ronald
107 +                    F. Guilmette to the upstream maintainers. -BEM */
108                   link_res = link_to_maj_min_ino (file_hdr.c_name, 
109 -                               file_hdr.c_dev_maj, file_hdr.c_dev_maj,
110 +                               file_hdr.c_dev_maj, file_hdr.c_dev_min,
111                                 file_hdr.c_ino);
112                   if (link_res == 0)
113                     {
114 @@ -761,6 +801,15 @@
115                     }
116                   copy_files_tape_to_disk (in_file_des, out_file_des, file_hdr.c_filesize);
117                   disk_empty_output_buffer (out_file_des);
118 +                 /* Debian hack to fix a bug in the --sparse option.
119 +                     This bug has been reported to
120 +                     "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
121 +                 if (delayed_seek_count > 0)
122 +                   {
123 +                     lseek (out_file_des, delayed_seek_count-1, SEEK_CUR);
124 +                     write (out_file_des, "", 1);
125 +                     delayed_seek_count = 0;
126 +                   }
127                   if (close (out_file_des) < 0)
128                     error (0, errno, "%s", file_hdr.c_name);
129  
130 @@ -890,8 +939,11 @@
131                   && archive_format != arf_ustar)
132                 {
133                   int link_res;
134 +                  /* Debian hack:  This was reported by Horst
135 +                     Knobloch. This bug has been reported to
136 +                     "bug-gnu-utils@prep.ai.mit.edu". (99/1/6) -BEM */
137                   link_res = link_to_maj_min_ino (file_hdr.c_name, 
138 -                               file_hdr.c_dev_maj, file_hdr.c_dev_maj,
139 +                               file_hdr.c_dev_maj, file_hdr.c_dev_min,
140                                 file_hdr.c_ino);
141                   if (link_res == 0)
142                     break;
143 @@ -1305,7 +1357,7 @@
144    for (d = deferments; d != NULL; d = d->next)
145      {
146        link_res = link_to_maj_min_ino (d->header.c_name, 
147 -                   d->header.c_dev_maj, d->header.c_dev_maj,
148 +                   d->header.c_dev_maj, d->header.c_dev_min,
149                     d->header.c_ino);
150        if (link_res == 0)
151         {
152 --- cpio-2.4.2/copyout.c.debian Tue Jun 26 13:51:18 2001
153 +++ cpio-2.4.2/copyout.c        Tue Jun 26 13:57:04 2001
154 @@ -35,6 +35,7 @@
155  static void writeout_other_defers ();
156  static void writeout_final_defers();
157  static void writeout_defered_file ();
158 +static void check_for_changed_file ();
159  
160  /* Write out header FILE_HDR, including the file name, to file
161     descriptor OUT_DES.  */
162 @@ -112,11 +113,11 @@
163         error (0, 0, "%s: truncating inode number", file_hdr->c_name);
164  
165        sprintf (ascii_header,
166 -              "%06o%06o%06lo%06lo%06lo%06lo%06lo%06o%011lo%06lo%011lo",
167 -              file_hdr->c_magic & 0xFFFF, (int)(dev & 0xFFFF),
168 +              "%06ho%06lo%06lo%06lo%06lo%06lo%06lo%06o%011lo%06lo%011lo",
169 +              file_hdr->c_magic & 0xFFFF, (long)(dev & 0xFFFF),
170                file_hdr->c_ino & 0xFFFF, file_hdr->c_mode & 0xFFFF,
171                file_hdr->c_uid & 0xFFFF, file_hdr->c_gid & 0xFFFF,
172 -              file_hdr->c_nlink & 0xFFFF, (int)(rdev & 0xFFFF),
173 +              file_hdr->c_nlink & 0xFFFF, (long)(rdev & 0xFFFF),
174                file_hdr->c_mtime, file_hdr->c_namesize & 0xFFFF,
175                file_hdr->c_filesize);
176        tape_buffered_write (ascii_header, out_des, 76L);
177 @@ -384,6 +385,7 @@
178  
179               write_out_header (&file_hdr, out_file_des);
180               copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, input_name.ds_string);
181 +             check_for_changed_file(input_name.ds_string, &file_hdr);
182  
183  #ifndef __MSDOS__
184               if (archive_format == arf_tar || archive_format == arf_ustar)
185 @@ -399,7 +401,13 @@
186                 {
187                   times.actime = file_stat.st_atime;
188                   times.modtime = file_stat.st_mtime;
189 -                 if (utime (file_hdr.c_name, &times) < 0)
190 +                 /* Debian hack: Silently ignore EROFS because
191 +                     reading the file won't have upset its timestamp
192 +                     if it's on a read-only filesystem.  This has been
193 +                     submitted as a suggestion to
194 +                     "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
195 +                 if (utime (file_hdr.c_name, &times) < 0
196 +                     && errno != EROFS)
197                     error (0, errno, "%s", file_hdr.c_name);
198                 }
199               break;
200 @@ -562,6 +570,8 @@
201         error (1, errno, "cannot read checksum for %s", file_name);
202        if (bytes_read == 0)
203         break;
204 +      if (bytes_left < bytes_read)
205 +        bytes_read = bytes_left;
206        for (i = 0; i < bytes_read; ++i)
207         crc += buf[i] & 0xff;
208      }
209 @@ -785,6 +795,7 @@
210  
211    write_out_header (&file_hdr, out_file_des);
212    copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, header->c_name);
213 +  check_for_changed_file(header->c_name, &file_hdr);
214  
215  #ifndef __MSDOS__
216    if (archive_format == arf_tar || archive_format == arf_ustar)
217 @@ -800,8 +811,33 @@
218      {
219        times.actime = file_hdr.c_mtime;
220        times.modtime = file_hdr.c_mtime;
221 -      if (utime (file_hdr.c_name, &times) < 0)
222 +      /* Debian hack: Silently ignore EROFS because reading the file
223 +         won't have upset its timestamp if it's on a read-only
224 +         filesystem.  This has been submitted as a suggestion to
225 +         "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
226 +      if (utime (file_hdr.c_name, &times) < 0
227 +         && errno != EROFS)
228         error (0, errno, "%s", file_hdr.c_name);
229      }
230    return;
231  }
232 +
233 +static void
234 +check_for_changed_file (name, header)
235 +     char *name;
236 +     struct new_cpio_header *header;
237 +{
238 +  struct stat new_file_stat;
239 +
240 +  if ((*xstat) (name, &new_file_stat) < 0)
241 +    {
242 +      error (0, errno, "%s", name);
243 +      return;
244 +    }
245 +  if (header->c_filesize != new_file_stat.st_size)
246 +    error (0, 0, "%s: size changed from %ld to %ld during copy-out",
247 +       name, header->c_filesize, new_file_stat.st_size);
248 +  if (header->c_mtime != new_file_stat.st_mtime)
249 +    error (0, 0, "%s: mtime changed during copy-out",
250 +       name, header->c_filesize, new_file_stat.st_size);
251 +}
252 --- cpio-2.4.2/copypass.c.debian        Tue Jun 26 13:51:18 2001
253 +++ cpio-2.4.2/copypass.c       Tue Jun 26 13:51:18 2001
254 @@ -24,6 +24,10 @@
255  #include "dstring.h"
256  #include "extern.h"
257  
258 +/* Debian hack to fix a bug in the --sparse option.  This bug has been
259 +   reported to "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
260 +extern int delayed_seek_count;
261 +
262  /* Copy files listed on the standard input into directory `directory_name'.
263     If `link_flag', link instead of copying.  */
264  
265 @@ -167,6 +171,15 @@
266  
267               copy_files_disk_to_disk (in_file_des, out_file_des, in_file_stat.st_size, input_name.ds_string);
268               disk_empty_output_buffer (out_file_des);
269 +             /* Debian hack to fix a bug in the --sparse option.
270 +                 This bug has been reported to
271 +                 "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
272 +             if (delayed_seek_count > 0)
273 +               {
274 +                 lseek (out_file_des, delayed_seek_count-1, SEEK_CUR);
275 +                 write (out_file_des, "", 1);
276 +                 delayed_seek_count = 0;
277 +               }
278               if (close (in_file_des) < 0)
279                 error (0, errno, "%s", input_name.ds_string);
280               if (close (out_file_des) < 0)
281 @@ -186,9 +199,16 @@
282                 {
283                   times.actime = in_file_stat.st_atime;
284                   times.modtime = in_file_stat.st_mtime;
285 -                 if (utime (input_name.ds_string, &times) < 0)
286 +                 /* Debian hack: Silently ignore EROFS because
287 +                     reading the file won't have upset its timestamp
288 +                     if it's on a read-only filesystem.  This has been
289 +                     submitted as a suggestion to
290 +                     "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
291 +                 if (utime (input_name.ds_string, &times) < 0
292 +                     && errno != EROFS)
293                     error (0, errno, "%s", input_name.ds_string);
294 -                 if (utime (output_name.ds_string, &times) < 0)
295 +                 if (utime (output_name.ds_string, &times) < 0
296 +                     && errno != EROFS)
297                     error (0, errno, "%s", output_name.ds_string);
298                 }
299               if (retain_time_flag)
300 --- cpio-2.4.2/global.c.debian  Wed Nov 30 23:48:12 1994
301 +++ cpio-2.4.2/global.c Tue Jun 26 13:51:18 2001
302 @@ -134,6 +134,9 @@
303  /* Name of file containing the archive, if known; NULL if stdin/out.  */
304  char *archive_name = NULL;
305  
306 +/* Name of the remote shell command, if known; NULL otherwise.  */
307 +char *rsh_command_option = NULL;
308 +
309  /* CRC checksum.  */
310  unsigned long crc;
311  
312 --- cpio-2.4.2/main.c.debian    Tue Jun 26 13:51:18 2001
313 +++ cpio-2.4.2/main.c   Tue Jun 26 13:51:18 2001
314 @@ -59,6 +59,7 @@
315    {"preserve-modification-time", 0, &retain_time_flag, TRUE},
316    {"rename", 0, &rename_flag, TRUE},
317    {"rename-batch-file", 1, 0, 137},
318 +  {"rsh-command", 1, 0, 140},
319    {"quiet", 0, 0, 138},
320    {"sparse", 0, 0, 135},
321    {"swap", 0, 0, 'b'},
322 @@ -87,7 +88,8 @@
323         [--file=[[user@]host:]archive] [--format=format] [--message=message]\n\
324         [--null] [--reset-access-time] [--verbose] [--dot] [--append]\n\
325         [--block-size=blocks] [--dereference] [--io-size=bytes] [--quiet]\n\
326 -       [--force-local] [--help] [--version] < name-list [> archive]\n", program_name);
327 +       [--force-local] [--rsh-command=command] [--help] [--version] < name-list\n\
328 +       [> archive]\n", program_name);
329    fprintf (fp, "\
330         %s {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file] [-H format]\n\
331         [-M message] [-R [user][:.][group]] [-I [[user@]host:]archive]\n\
332 @@ -98,7 +100,8 @@
333         [--io-size=bytes] [--pattern-file=file] [--format=format]\n\
334         [--owner=[user][:.][group]] [--no-preserve-owner] [--message=message]\n\
335         [--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc]\n\
336 -       [--quiet] [--help] [--version] [pattern...] [< archive]\n",
337 +       [--quiet] [--rsh-command=command] [--help] [--version] [pattern...]\n\
338 +       [< archive]\n",
339            program_name);
340    fprintf (fp, "\
341         %s {-p|--pass-through} [-0adlmuvLV] [-R [user][:.][group]]\n\
342 @@ -127,6 +130,7 @@
343    if (argc < 2)
344      usage (stderr, 2);
345  
346 +  rsh_command_option = getenv("CPIO_RSH");
347    xstat = lstat;
348  
349    while ((c = getopt_long (argc, argv,
350 @@ -289,6 +293,10 @@
351           copy_function = process_copy_pass;
352           break;
353  
354 +       case 140:
355 +         rsh_command_option = optarg;
356 +         break;
357 +
358         case 'r':               /* Interactively rename.  */
359           rename_flag = TRUE;
360           break;
361 @@ -377,8 +385,9 @@
362         usage (stderr, 2);
363      }
364  
365 -  if ((!table_flag || !verbose_flag) && numeric_uid)
366 -    usage (stderr, 2);
367 +  /* Debian hack: This version of cpio uses the -n flag also to extract
368 +     tar archives using the numeric UID/GID instead of the user/group
369 +     names in /etc/passwd and /etc/groups.  (98/10/15) -BEM */
370  
371    /* Work around for pcc bug.  */
372    copy_in = process_copy_in;
373 @@ -388,7 +397,9 @@
374      {
375        archive_des = 0;
376        if (link_flag || reset_time_flag || xstat != lstat || append_flag
377 -         || sparse_flag
378 +         /* Debian hack: The sparse option is used with copy-in not
379 +             copy-out.  This bug has been reported to
380 +             "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
381           || output_archive_name
382           || (archive_name && input_archive_name))
383         usage (stderr, 2);
384 @@ -408,6 +419,10 @@
385           || set_group_flag || swap_bytes_flag || swap_halfwords_flag
386           || (append_flag && !(archive_name || output_archive_name))
387           || rename_batch_file || no_abs_paths_flag
388 +         /* Debian hack: The sparse option is used with copy-in not
389 +             copy-out.  This bug has been reported to
390 +             "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
391 +         || sparse_flag
392           || input_archive_name || (archive_name && output_archive_name))
393         usage (stderr, 2);
394        if (archive_format == arf_unknown)
395 --- cpio-2.4.2/tar.c.debian     Fri Feb 25 20:25:33 1994
396 +++ cpio-2.4.2/tar.c    Tue Jun 26 13:51:18 2001
397 @@ -261,15 +261,18 @@
398        file_hdr->c_nlink = 1;
399        otoa (tar_hdr->mode, &file_hdr->c_mode);
400        file_hdr->c_mode = file_hdr->c_mode & 07777;
401 +  /* Debian hack: This version of cpio uses the -n flag also to extract
402 +     tar archives using the numeric UID/GID instead of the user/group
403 +     names in /etc/passwd and /etc/groups.  (98/10/15) -BEM */
404  #ifndef __MSDOS__
405 -      if (archive_format == arf_ustar
406 +      if (archive_format == arf_ustar && !numeric_uid
407           && (uidp = getuidbyname (tar_hdr->uname)))
408         file_hdr->c_uid = *uidp;
409        else
410  #endif
411         otoa (tar_hdr->uid, &file_hdr->c_uid);
412  #ifndef __MSDOS__
413 -      if (archive_format == arf_ustar
414 +      if (archive_format == arf_ustar && !numeric_uid
415           && (gidp = getgidbyname (tar_hdr->gname)))
416         file_hdr->c_gid = *gidp;
417        else
418 --- cpio-2.4.2/util.c.debian    Tue Jan 16 22:40:14 1996
419 +++ cpio-2.4.2/util.c   Tue Jun 26 13:51:18 2001
420 @@ -489,7 +489,9 @@
421    while (num_bytes > 0)
422      {
423        if (input_size == 0)
424 -       if (rc = disk_fill_input_buffer (in_des, DISK_IO_BLOCK_SIZE))
425 +       if (rc = disk_fill_input_buffer (in_des,
426 +         num_bytes < DISK_IO_BLOCK_SIZE ?
427 +         num_bytes : DISK_IO_BLOCK_SIZE))
428           {
429             if (rc > 0)
430               error (0, 0, "File %s shrunk by %ld bytes, padding with zeros",
431 @@ -808,13 +810,14 @@
432    copy_in = process_copy_in;
433  
434    if (copy_function == copy_in)
435 -    fd = rmtopen (file, O_RDONLY | O_BINARY, 0666);
436 +    fd = rmtopen (file, O_RDONLY | O_BINARY, 0666, rsh_command_option);
437    else
438      {
439        if (!append_flag)
440 -       fd = rmtopen (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
441 +       fd = rmtopen (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666,
442 +                       rsh_command_option);
443        else
444 -       fd = rmtopen (file, O_RDWR | O_BINARY, 0666);
445 +       fd = rmtopen (file, O_RDWR | O_BINARY, 0666, rsh_command_option);
446      }
447  
448    return fd;
449 --- cpio-2.4.2/rtapelib.c.debian        Wed Nov 30 23:59:40 1994
450 +++ cpio-2.4.2/rtapelib.c       Tue Jun 26 13:51:18 2001
451 @@ -264,11 +264,12 @@
452     On error, return -1.  */
453  
454  int
455 -__rmt_open (path, oflag, mode, bias)
456 +__rmt_open (path, oflag, mode, bias, remote_shell)
457       char *path;
458       int oflag;
459       int mode;
460       int bias;
461 +     const char *remote_shell;
462  {
463    int i, rc;
464    char buffer[CMDBUFSIZE];     /* Command buffer.  */
465 @@ -372,29 +373,43 @@
466  
467        if (*login)
468         {
469 -         execl ("/usr/ucb/rsh", "rsh", system, "-l", login,
470 +         /* Debian hack: added remote shell command line option.
471 +            (98/5/20) -BEM */
472 +         if (remote_shell) {
473 +           const char *remote_shell_basename;
474 +           remote_shell_basename = strrchr (remote_shell, '/');
475 +           if (remote_shell_basename)
476 +             remote_shell_basename++;
477 +           else
478 +             remote_shell_basename = remote_shell;
479 +           execl (remote_shell, remote_shell_basename, system, "-l", login,
480                  "/etc/rmt", (char *) 0);
481 -         execl ("/usr/bin/remsh", "remsh", system, "-l", login,
482 +         } else {
483 +         execl ("/usr/bin/ssh", "ssh", system, "-l", login,
484                  "/etc/rmt", (char *) 0);
485           execl ("/usr/bin/rsh", "rsh", system, "-l", login,
486                  "/etc/rmt", (char *) 0);
487 -         execl ("/usr/bsd/rsh", "rsh", system, "-l", login,
488 -                "/etc/rmt", (char *) 0);
489 -         execl ("/usr/bin/nsh", "nsh", system, "-l", login,
490 -                "/etc/rmt", (char *) 0);
491 +         }
492         }
493        else
494         {
495 -         execl ("/usr/ucb/rsh", "rsh", system,
496 +         /* Debian hack: added remote shell command line option.
497 +            (98/5/20) -BEM */
498 +         if (remote_shell) {
499 +           const char *remote_shell_basename;
500 +           remote_shell_basename = strrchr (remote_shell, '/');
501 +           if (remote_shell_basename)
502 +             remote_shell_basename++;
503 +           else
504 +             remote_shell_basename = remote_shell;
505 +           execl (remote_shell, remote_shell_basename, system,
506                  "/etc/rmt", (char *) 0);
507 -         execl ("/usr/bin/remsh", "remsh", system,
508 +         } else {
509 +         execl ("/usr/bin/ssh", "ssh", system,
510                  "/etc/rmt", (char *) 0);
511           execl ("/usr/bin/rsh", "rsh", system,
512                  "/etc/rmt", (char *) 0);
513 -         execl ("/usr/bsd/rsh", "rsh", system,
514 -                "/etc/rmt", (char *) 0);
515 -         execl ("/usr/bin/nsh", "nsh", system,
516 -                "/etc/rmt", (char *) 0);
517 +         }
518         }
519  
520        /* Bad problems if we get here.  */
521 --- cpio-2.4.2/extern.h.debian  Tue Jun 26 13:51:18 2001
522 +++ cpio-2.4.2/extern.h Tue Jun 26 13:51:18 2001
523 @@ -57,6 +57,7 @@
524  extern char *new_media_message_after_number;
525  extern int archive_des;
526  extern char *archive_name;
527 +extern char *rsh_command_option;
528  extern unsigned long crc;
529  #ifdef DEBUG_CPIO
530  extern int debug_flag;
531 --- cpio-2.4.2/rmt.h.debian     Thu Dec  1 00:00:32 1994
532 +++ cpio-2.4.2/rmt.h    Tue Jun 26 13:51:18 2001
533 @@ -1,19 +1,19 @@
534  /* Definitions for communicating with a remote tape drive.
535 -   Copyright (C) 1988, 1992 Free Software Foundation, Inc.
536 +Copyright (C) 1988, 1992 Free Software Foundation, Inc.
537  
538 -   This program is free software; you can redistribute it and/or modify
539 -   it under the terms of the GNU General Public License as published by
540 -   the Free Software Foundation; either version 2, or (at your option)
541 -   any later version.
542 -
543 -   This program is distributed in the hope that it will be useful,
544 -   but WITHOUT ANY WARRANTY; without even the implied warranty of
545 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
546 -   GNU General Public License for more details.
547 -
548 -   You should have received a copy of the GNU General Public License
549 -   along with this program; if not, write to the Free Software
550 -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
551 +This program is free software; you can redistribute it and/or modify
552 +it under the terms of the GNU General Public License as published by
553 +the Free Software Foundation; either version 2, or (at your option)
554 +any later version.
555 +
556 +This program is distributed in the hope that it will be useful,
557 +but WITHOUT ANY WARRANTY; without even the implied warranty of
558 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
559 +GNU General Public License for more details.
560 +
561 +You should have received a copy of the GNU General Public License
562 +along with this program; if not, write to the Free Software
563 +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
564  
565  #ifdef HAVE_UNISTD_H
566  #include <unistd.h>
567 @@ -67,10 +67,10 @@
568  #define _remdev(path)  (!f_force_local && (__rmt_path=index(path, ':')))
569  #define _isrmt(fd)             ((fd) >= __REM_BIAS)
570  
571 -#define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS) : open(path, oflag, mode))
572 +#define rmtopen(path,oflag,mode,rsh) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS,rsh) : open(path, oflag, mode))
573  #define rmtaccess(path, amode) (_remdev(path) ? 0 : access(path, amode))
574  #define rmtstat(path, buf)     (_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
575 -#define rmtcreat(path, mode)   (_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS) : creat(path, mode))
576 +#define rmtcreat(path, mode, rsh)      (_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS, rsh) : creat(path, mode))
577  #define rmtlstat(path,buf)     (_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
578  
579  #define rmtread(fd, buf, n)    (_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
580 --- cpio-2.4.2/cpio.1.debian    Tue Jun 26 13:51:18 2001
581 +++ cpio-2.4.2/cpio.1   Tue Jun 26 13:51:18 2001
582 @@ -8,19 +8,21 @@
583  [\-\-file=[[user@]host:]archive] [\-\-format=format] [\-\-message=message]
584  [\-\-null] [\-\-reset-access-time] [\-\-verbose] [\-\-dot] [\-\-append]
585  [\-\-block-size=blocks] [\-\-dereference] [\-\-io-size=bytes] [\-\-quiet]
586 -[\-\-force\-local] [\-\-help] [\-\-version] < name-list [> archive]
587 +[\-\-force\-local] [\-\-rsh-command=command] [\-\-help] [\-\-version]
588 +< name-list [> archive]
589  
590  .B cpio
591  {\-i|\-\-extract} [\-bcdfmnrtsuvBSV] [\-C bytes] [\-E file] [\-H format]
592  [\-M message] [\-R [user][:.][group]] [\-I [[user@]host:]archive]
593  [\-F [[user@]host:]archive] [\-\-file=[[user@]host:]archive]
594  [\-\-make-directories] [\-\-nonmatching] [\-\-preserve-modification-time]
595 -[\-\-numeric-uid-gid] [\-\-rename] [\-\-list] [\-\-swap-bytes] [\-\-swap] [\-\-dot]
596 +[\-\-numeric-uid-gid] [\-\-rename] [\-t|\-\-list] [\-\-swap-bytes] [\-\-swap] [\-\-dot]
597  [\-\-unconditional] [\-\-verbose] [\-\-block-size=blocks] [\-\-swap-halfwords]
598  [\-\-io-size=bytes] [\-\-pattern-file=file] [\-\-format=format]
599  [\-\-owner=[user][:.][group]] [\-\-no-preserve-owner] [\-\-message=message]
600 -[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse] [\-\-only\-verify\-crc]
601 -[\-\-quiet] [\-\-help] [\-\-version] [pattern...] [< archive]
602 +[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse]
603 +[\-\-only\-verify\-crc] [\-\-quiet] [\-\-rsh-command=command] [\-\-help]
604 +[\-\-version] [pattern...] [< archive]
605  
606  .B cpio
607  {\-p|\-\-pass-through} [\-0adlmuvLV] [\-R [user][:.][group]]
608 @@ -249,6 +251,10 @@
609  .I "\-n, \-\-numeric-uid-gid"
610  In the verbose table of contents listing, show numeric UID and GID
611  instead of translating them into names.
612 +Also extracts tar archives using the numeric UID and GID instead of the
613 +user/group names.
614 +.RB ( cpio
615 +archives are always extracted using the numeric UID and GID.)
616  .TP
617  .I " \-\-no-absolute-filenames"
618  In copy-in mode, create all files relative to the current directory,
619 @@ -291,8 +297,17 @@
620  separator is given, use the given user's login group.  Only the
621  super-user can change files' ownership.
622  .TP
623 +.I "\-\-rsh-command=COMMAND"
624 +Notifies
625 +.B mt
626 +that it should use COMMAND to communicate with remote devices instead of
627 +.IR /usr/bin/ssh ,
628 +.IR /usr/bin/rsh ,
629 +or the command specified by the environment variable
630 +.BR MT_RSH .
631 +.TP
632  .I "\-\-sparse"
633 -In copy-out and copy-pass modes, write files with large blocks of zeros
634 +In copy-in and copy-pass modes, write files with large blocks of zeros
635  as sparse files.
636  .TP
637  .I "\-s, \-\-swap-bytes"
638 --- cpio-2.4.2/mt.1.debian      Wed Nov 22 22:31:50 1995
639 +++ cpio-2.4.2/mt.1     Tue Jun 26 13:51:18 2001
640 @@ -3,7 +3,7 @@
641  mt \- control magnetic tape drive operation
642  .SH SYNOPSIS
643  .B mt
644 -[\-V] [\-f device] [\-\-file=device] [\-\-version]
645 +[\-V] [\-f device] [\-\-file=device] [\-\-rsh-command=command] [\-\-version]
646  operation [count]
647  .SH DESCRIPTION
648  This manual page
649 @@ -76,9 +76,6 @@
650  .IR count .
651  Equivalent to rewind followed by fsf
652  .IR count .
653 -.IP seek
654 -Seek to block number
655 -.IR count .
656  .IP eom
657  Space to the end of the recorded media on the tape
658  (for appending files onto tapes).
659 @@ -93,6 +90,69 @@
660  then rewind it again.
661  .IP erase
662  Erase the tape.
663 +.IP fss
664 +(SCSI tapes) Forward space
665 +.I count
666 +setmarks.
667 +.IP bss
668 +(SCSI tapes) Backward space
669 +.I count
670 +setmarks.
671 +.IP "wset"
672 +(SCSI tapes) Write
673 +.I count
674 +setmarks at current position (only SCSI tape).
675 +.IP "eod, seod"
676 +Space to end of valid data.  Used on streamer tape
677 +drives to append data to the logical and of tape.
678 +.IP setblk
679 +(SCSI tapes) Set the block size of the drive to
680 +.I count
681 +bytes per record.
682 +.IP setdensity
683 +(SCSI tapes) Set the tape density code to
684 +.I count.
685 +The proper codes to use with each drive should be looked up from the
686 +drive documentation.
687 +.IP drvbuffer
688 +(SCSI tapes) Set the tape drive buffer code to
689 +.I number.
690 +The proper value for unbuffered operation is zero and "normal" buffered
691 +operation one. The meanings of other values can be found in the drive
692 +documentation or, in case of a SCSI-2 drive, from the SCSI-2 standard.
693 +.IP stoptions
694 +(SCSI tapes) Set the driver options bits to
695 +.I count
696 +for the device.
697 +The bits can be set by oring the following values: 1 to enable write
698 +buffering, 2 to enable asynchronous writes, 4 to enable read ahead,
699 +8 to enable debugging output (if it has been compiled to the driver).
700 +.IP stwrthreshold
701 +(SCSI tapes) The write threshold for the tape device is set to
702 +.I count
703 +kilobytes. The value must be smaller than or equal to the driver
704 +buffer size.
705 +.IP seek
706 +(SCSI tapes) Seek to the
707 +.I count
708 +block on the tape.  This operation is available on some
709 +Tandberg and Wangtek streamers and some SCSI-2 tape drives.
710 +.IP tell
711 +(SCSI tapes) Tell the current block on tape.  This operation is available on some
712 +Tandberg and Wangtek streamers and some SCSI-2 tape drives.
713 +.IP densities
714 +(SCSI tapes) Write explanation of some common density codes to
715 +standard output.
716 +.IP datcompression
717 +(some SCSI-2 DAT tapes) Inquire or set the compression status
718 +(on/off). If the
719 +.I count
720 +is one the compression status is printed. If the
721 +.I count
722 +is zero, compression is disabled. Otherwise, compression is
723 +enabled. The command uses the SCSI ioctl to read and write the Data
724 +Compression Characteristics mode page (15). ONLY ROOT CAN USE THIS
725 +COMMAND.
726  .PP
727  .B mt
728  exits with a status of 0 if the operation succeeded, 1 if the
729 @@ -111,6 +171,17 @@
730  you have permission to do so (typically an entry in that user's
731  `~/.rhosts' file).
732  .TP
733 +.I "\-\-rsh-command=command"
734 +Notifies
735 +.B mt
736 +that it should use
737 +.I command
738 +to communicate with remote devices instead of
739 +.IR /usr/bin/ssh ,
740 +.IR /usr/bin/rsh ,
741 +or the command specified by the environment variable
742 +.BR MT_RSH .
743 +.TP
744  .I "\-V, \-\-version"
745  Print the version number of
746  .BR mt .
747 --- cpio-2.4.2/configure.debian Wed Dec 20 17:34:04 1995
748 +++ cpio-2.4.2/configure        Tue Jun 26 13:51:18 2001
749 @@ -1,4 +1,5 @@
750  #! /bin/sh
751 +set +e
752  
753  # Guess values for system-dependent variables and create Makefiles.
754  # Generated automatically using autoconf version 2.7 
755 --- cpio-2.4.2/mt.c.debian      Wed Nov 22 22:31:49 1995
756 +++ cpio-2.4.2/mt.c     Tue Jun 26 13:51:18 2001
757 @@ -16,6 +16,10 @@
758     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
759     */
760  
761 +/* Modified for the Linux SCSI tape driver by Brian Mays from code
762 +   written by Kai Makisara.
763 +   Last Modified: Tue Apr 23 15:37:54 EDT 1996
764 +*/
765  
766  /* If -f is not given, the environment variable TAPE is used;
767     if that is not set, a default device defined in sys/mtio.h is used.
768 @@ -50,6 +54,46 @@
769     retension   Rewind the tape, then wind it to the end of the reel,
770                 then rewind it again.
771     erase       Erase the tape.
772 +   fss         (SCSI tapes) Forward space COUNT setmarks.
773 +   bss         (SCSI tapes) Backward space COUNT setmarks.
774 +   wset                (SCSI tapes) Write COUNT setmarks at current position
775 +               (only SCSI tape).
776 +   eod, seod   Space to end of valid data.  Used on streamer tape
777 +               drives to append data to the logical and of tape.
778 +   setblk      (SCSI tapes) Set the block size of the drive to COUNT
779 +               bytes per record.
780 +   setdensity  (SCSI tapes) Set the tape density code to COUNT.  The
781 +               proper codes to use with each drive should be looked
782 +               up from the drive documentation.
783 +   drvbuffer   (SCSI tapes) Set the tape drive buffer code to
784 +               NUMBER.  The proper value for unbuffered operation is
785 +               zero and "normal" buffered operation one. The meanings
786 +               of other values can be found in the drive
787 +               documentation or, in case of a SCSI-2 drive, from the
788 +               SCSI-2 standard.
789 +   stoptions   (SCSI tapes) Set the driver options bits to COUNT for
790 +               the device.  The bits can be set by oring the
791 +               following values: 1 to enable write buffering, 2 to
792 +               enable asynchronous writes, 4 to enable read ahead, 8
793 +               to enable debugging output (if it has been compiled to
794 +               the driver).
795 +   stwrthreshold 
796 +               (SCSI tapes) The write threshold for the tape device
797 +               is set to COUNT kilobytes.  The value must be smaller
798 +               than or equal to the driver buffer size.
799 +   seek                (SCSI tapes) Seek to the COUNT block on the tape.
800 +               This operation is available on some Tandberg and
801 +               Wangtek streamers and some SCSI-2 tape drives.
802 +   tell                (SCSI tapes) Tell the current block on tape.  This
803 +               operation is available on some Tandberg and Wangtek
804 +               streamers and some SCSI-2 tape drives.
805 +   densities   (SCSI tapes) Write explanation of some common density
806 +               codes to standard output.
807 +   datcompression
808 +               (some SCSI-2 DAT tapes) Inquire or set the compression
809 +               status (on/off).  If the COUNT is one the compression
810 +               status is printed.  If the COUNT is zero, compression
811 +               is disabled.  Otherwise, compression is enabled.
812  
813     David MacKenzie <djm@gnu.ai.mit.edu> */
814  
815 @@ -97,6 +141,48 @@
816  void perform_operation ();
817  void print_status ();
818  void usage ();
819 +#ifdef MTTELL
820 +void print_position ();
821 +#endif
822 +
823 +int do_dat_compression(char *dev, int fn, int count);
824 +
825 +#if defined(linux) || defined(__linux)
826 +#define MTDATCOMP 1000         /* Random unused number.  */
827 +#define MTDENS 1001            /* Random unused number.  */
828 +
829 +struct densities {
830 +  int code;
831 +  char *name;
832 +} density_tbl[] = {
833 +  {0x00, "default"},
834 +  {0x01, "NRZI (800 bpi)"},
835 +  {0x02, "PE (1600 bpi)"},
836 +  {0x03, "GCR (6250 bpi)"},
837 +  {0x05, "QIC-45/60 (GCR, 8000 bpi)"},
838 +  {0x06, "PE (3200 bpi)"},
839 +  {0x07, "IMFM (6400 bpi)"},
840 +  {0x08, "GCR (8000 bpi)"},
841 +  {0x09, "GCR (37871 bpi)"},
842 +  {0x0a, "MFM (6667 bpi)"},
843 +  {0x0b, "PE (1600 bpi)"},
844 +  {0x0c, "GCR (12960 bpi)"},
845 +  {0x0d, "GCR (25380 bpi)"},
846 +  {0x0f, "QIC-120 (GCR 10000 bpi)"},
847 +  {0x10, "QIC-150/250 (GCR 10000 bpi)"},
848 +  {0x11, "QIC-320/525 (GCR 16000 bpi)"},
849 +  {0x12, "QIC-1350 (RLL 51667 bpi)"},
850 +  {0x13, "DDS (61000 bpi)"},
851 +  {0x14, "EXB-8200 (RLL 43245 bpi)"},
852 +  {0x15, "EXB-8500 (RLL 45434 bpi)"},
853 +  {0x16, "MFM 10000 bpi"},
854 +  {0x17, "MFM 42500 bpi"},
855 +  {0x22, "SLR4DC"},
856 +  {0x24, "DDS-2"},
857 +  {140, "EXB-8505 compressed"},
858 +  {144, "EXB-8205 compressed"},
859 +  {-1, NULL}};
860 +#endif
861  
862  char *opnames[] =
863  {
864 @@ -107,6 +193,8 @@
865  #endif
866  #ifdef MTEOM
867    "eom",
868 +  "eod",
869 +  "seod",
870  #endif
871  #ifdef MTRETEN
872    "retension",
873 @@ -121,6 +209,39 @@
874  #ifdef MTSEEK
875    "seek",
876  #endif
877 +#ifdef MTTELL
878 +  "tell",
879 +#endif
880 +#ifdef MTFSS
881 +  "fss",
882 +#endif
883 +#ifdef MTBSS
884 +  "bss",
885 +#endif
886 +#ifdef MTWSM
887 +  "wset",
888 +#endif
889 +#ifdef MTSETBLK
890 +  "setblk",
891 +#endif
892 +#ifdef MTSETDENSITY
893 +  "setdensity",
894 +#endif
895 +#ifdef MTSETDRVBUFFER
896 +  "drvbuffer",
897 +#ifdef MT_ST_BOOLEANS
898 +  "stoptions",
899 +#endif
900 +#ifdef MT_ST_WRITE_THRESHOLD
901 +  "stwrthreshold",
902 +#endif
903 +#endif
904 +#ifdef MTDATCOMP
905 +  "datcompression",
906 +#endif
907 +#ifdef MTDENS
908 +  "densities",
909 +#endif
910    NULL
911  };
912  
913 @@ -134,6 +255,8 @@
914  #endif
915  #ifdef MTEOM
916    MTEOM,
917 +  MTEOM,
918 +  MTEOM,
919  #endif
920  #ifdef MTRETEN
921    MTRETEN,
922 @@ -148,9 +271,68 @@
923  #ifdef MTSEEK
924    MTSEEK,
925  #endif
926 +#ifdef MTTELL
927 +  MTTELL,
928 +#endif
929 +#ifdef MTFSS
930 +  MTFSS,
931 +#endif
932 +#ifdef MTBSS
933 +  MTBSS,
934 +#endif
935 +#ifdef MTWSM
936 +  MTWSM,
937 +#endif
938 +#ifdef MTSETBLK
939 +  MTSETBLK,
940 +#endif
941 +#ifdef MTSETDENSITY
942 +  MTSETDENSITY,
943 +#endif
944 +#ifdef MTSETDRVBUFFER
945 +  MTSETDRVBUFFER,
946 +#ifdef MT_ST_BOOLEANS
947 +  MTSETDRVBUFFER,
948 +#endif
949 +#ifdef MT_ST_WRITE_THRESHOLD
950 +  MTSETDRVBUFFER,
951 +#endif
952 +#endif
953 +#ifdef MTDATCOMP
954 +  MTDATCOMP,
955 +#endif
956 +#ifdef MTDENS
957 +  MTDENS,
958 +#endif
959    0
960  };
961  
962 +char *cbnames[] =
963 +{
964 +#ifdef MT_ST_BOOLEANS
965 +  "stoptions",
966 +#endif
967 +#ifdef MT_ST_WRITE_THRESHOLD
968 +  "stwrthreshold",
969 +#endif
970 +  NULL
971 +};
972 +
973 +int count_bits[] =
974 +{
975 +#ifdef MT_ST_BOOLEANS
976 +  MT_ST_BOOLEANS,
977 +#endif
978 +#ifdef MT_ST_WRITE_THRESHOLD
979 +  MT_ST_WRITE_THRESHOLD,
980 +#endif
981 +  0
982 +};
983 +
984 +#ifdef MT_TAPE_INFO
985 +  struct mt_tape_info tapes[] = MT_TAPE_INFO;
986 +#endif
987 +
988  /* If nonzero, don't consider file names that contain a `:' to be
989     on remote hosts; all files are local.  Always zero for mt;
990     since when do local device names contain colons?  */
991 @@ -159,6 +341,7 @@
992  struct option longopts[] =
993  {
994    {"file", 1, NULL, 'f'},
995 +  {"rsh-command", 1, NULL, 1},
996    {"version", 0, NULL, 'V'},
997    {"help", 0, NULL, 'H'},
998    {NULL, 0, NULL, 0}
999 @@ -178,12 +361,15 @@
1000    char *tapedev;
1001    int tapedesc;
1002    int i;
1003 +  char *rsh_command_option = getenv("MT_RSH");
1004  
1005    program_name = argv[0];
1006    tapedev = NULL;
1007    count = 1;
1008  
1009 -  while ((i = getopt_long (argc, argv, "f:t:V:H", longopts, (int *) 0)) != -1)
1010 +  /* Debian hack: Fixed a bug in the -V flag.  This bug has been
1011 +     reported to "bug-gnu-utils@prep.ai.mit.edu".  -BEM */
1012 +  while ((i = getopt_long (argc, argv, "f:t:VH", longopts, (int *) 0)) != -1)
1013      {
1014        switch (i)
1015         {
1016 @@ -192,6 +378,10 @@
1017           tapedev = optarg;
1018           break;
1019  
1020 +       case 1:
1021 +         rsh_command_option = optarg;
1022 +         break;
1023 +
1024         case 'V':
1025           printf ("GNU mt %s", version_string);
1026           exit (0);
1027 @@ -214,10 +404,22 @@
1028      }
1029    operation = operations[i];
1030  
1031 +  i = argmatch (argv[optind], cbnames);
1032 +
1033    if (++optind < argc)
1034 +    /* Debian hack: Replaced the atoi function call with strtol so
1035 +       that hexidecimal values can be used for the count parameter.
1036 +       This bug has been reported to "bug-gnu-utils@prep.ai.mit.edu".
1037 +       (97/12/5) -BEM */
1038 +#if defined(STDC_HEADERS)
1039 +    count = (int) strtol (argv[optind], NULL, 0);
1040 +#else
1041      count = atoi (argv[optind]);
1042 +#endif
1043    if (++optind < argc)
1044      usage (stderr, 1);
1045 +  if (i >= 0)
1046 +    count |= count_bits[i];
1047  
1048    if (tapedev == NULL)
1049      {
1050 @@ -230,27 +432,58 @@
1051  #endif
1052      }
1053  
1054 +#ifdef MTDENS
1055 +  if (operation == MTDENS)
1056 +    {
1057 +      printf("Some SCSI tape density codes:\ncode   explanation\n");
1058 +      for (i=0; density_tbl[i].code >= 0; i++)
1059 +       printf("0x%02x   %s\n", density_tbl[i].code, density_tbl[i].name);
1060 +      exit (0);
1061 +    }
1062 +#endif
1063 +
1064    if ( (operation == MTWEOF)
1065  #ifdef MTERASE
1066         || (operation == MTERASE)
1067  #endif
1068 +#ifdef MTWSM
1069 +       || (operation == MTWSM)
1070 +#endif
1071 +#ifdef MTSETDRVBUFFER
1072 +       || (operation == MTSETDRVBUFFER)
1073 +#endif
1074 +#ifdef MTDATCOMP
1075 +       || (operation == MTDATCOMP)
1076 +#endif
1077         )
1078 -    tapedesc = rmtopen (tapedev, O_WRONLY, 0);
1079 +    tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
1080    else
1081 -    tapedesc = rmtopen (tapedev, O_RDONLY, 0);
1082 +    tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option);
1083    if (tapedesc == -1)
1084      error (1, errno, "%s", tapedev);
1085    check_type (tapedev, tapedesc);
1086  
1087 -  if (operation == MTASF)
1088 -    {
1089 -      perform_operation (tapedev, tapedesc, MTREW, 1);
1090 -      operation = MTFSF;
1091 -    }
1092 -  perform_operation (tapedev, tapedesc, operation, count);
1093 -  if (operation == MTNOP)
1094 -    print_status (tapedev, tapedesc);
1095 -
1096 +#ifdef MTDATCOMP
1097 +  if (operation == MTDATCOMP)
1098 +    do_dat_compression(tapedev, tapedesc, count);
1099 +  else
1100 +#endif
1101 +#ifdef MTTELL
1102 +  if (operation == MTTELL)
1103 +    print_position (tapedev, tapedesc);
1104 +  else
1105 +#endif
1106 +  {
1107 +    if (operation == MTASF)
1108 +      {
1109 +       perform_operation (tapedev, tapedesc, MTREW, 1);
1110 +       operation = MTFSF;
1111 +      }
1112 +    perform_operation (tapedev, tapedesc, operation, count);
1113 +    if (operation == MTNOP)
1114 +      print_status (tapedev, tapedesc);
1115 +  }
1116 +  
1117    if (rmtclose (tapedesc) == -1)
1118      error (2, errno, "%s", tapedev);
1119  
1120 @@ -283,10 +516,28 @@
1121  
1122    control.mt_op = op;
1123    control.mt_count = count;
1124 -  if (rmtioctl (desc, MTIOCTOP, &control))
1125 +  /* Debian hack: The rmtioctl function returns -1 in case of an
1126 +     error, not 0.  This bug has been reported to
1127 +     "bug-gnu-utils@prep.ai.mit.edu".  (96/7/10) -BEM */
1128 +  if (rmtioctl (desc, MTIOCTOP, &control) == -1)
1129      error (2, errno, "%s", dev);
1130  }
1131  
1132 +#ifdef MTTELL
1133 +void
1134 +print_position (dev, desc)
1135 +     char *dev;
1136 +     int desc;
1137 +{
1138 +  struct mtpos position;
1139 +
1140 +  if (rmtioctl (desc, MTIOCPOS, &position) == -1)
1141 +    error (2, errno, "%s", dev);
1142 +  printf("At block %d.\n", (int) position.mt_blkno);
1143 +
1144 +}
1145 +#endif
1146 +
1147  void
1148  print_status (dev, desc)
1149       char *dev;
1150 @@ -297,7 +548,35 @@
1151    if (rmtioctl (desc, MTIOCGET, &status))
1152      error (2, errno, "%s", dev);
1153  
1154 -  printf ("drive type = %d\n", (int) status.mt_type);
1155 +#ifdef MT_ISFTAPE_FLAG
1156 +  if ((int) status.mt_type & MT_ISFTAPE_FLAG)
1157 +    {
1158 +      printf ("qic-117 drive type = 0x%05x, ", (int) status.mt_type & 0x1ffff);
1159 +      if (GMT_DR_OPEN( (long) status.mt_gstat))
1160 +       {
1161 +         printf ("no tape or door open\n");
1162 +       }
1163 +      else
1164 +       {
1165 +         printf ("%s-line%s\n",
1166 +                 GMT_ONLINE( (long) status.mt_gstat) ? "on" : "off",
1167 +                 GMT_WR_PROT( (long) status.mt_gstat) ?
1168 +                 " and write-protected" : "");
1169 +       }
1170 +    }
1171 +  else
1172 +#endif
1173 +    {
1174 +#ifdef MT_TAPE_INFO
1175 +      struct mt_tape_info *mt;
1176 +      for (mt = tapes; mt->t_type; mt++)
1177 +       if (mt->t_type == status.mt_type) break;
1178 +      if (mt->t_type != 0)
1179 +       printf ("drive type = %s\n", mt->t_name);
1180 +      else
1181 +#endif
1182 +       printf ("drive type = %d\n", (int) status.mt_type);
1183 +    }
1184  #if defined(hpux) || defined(__hpux)
1185    printf ("drive status (high) = %d\n", (int) status.mt_dsreg1);
1186    printf ("drive status (low) = %d\n", (int) status.mt_dsreg2);
1187 @@ -310,6 +589,60 @@
1188    printf ("file number = %d\n", (int) status.mt_fileno);
1189    printf ("block number = %d\n", (int) status.mt_blkno);
1190  #endif
1191 +#if defined(linux) || defined(__linux)
1192 +  if (status.mt_type == MT_ISSCSI1 ||
1193 +      status.mt_type == MT_ISSCSI2)
1194 +    {
1195 +      int dens, i;
1196 +      char *density;
1197 +      dens = (status.mt_dsreg & MT_ST_DENSITY_MASK) >> MT_ST_DENSITY_SHIFT;
1198 +      density = "unknown";
1199 +      for (i=0; density_tbl[i].code >= 0; i++)
1200 +       if (density_tbl[i].code == dens)
1201 +         {
1202 +           density = density_tbl[i].name;
1203 +           break;
1204 +         }
1205 +      printf("Tape block size %d bytes. Density code 0x%x (%s).\n",
1206 +            (int)((status.mt_dsreg & MT_ST_BLKSIZE_MASK) >>
1207 +                  MT_ST_BLKSIZE_SHIFT),
1208 +            dens, density);
1209 +
1210 +      printf("Soft error count since last status=%d\n",
1211 +            (int)(status.mt_erreg & MT_ST_SOFTERR_MASK) >>
1212 +            MT_ST_SOFTERR_SHIFT);
1213 +      printf("General status bits on (%x):\n", (unsigned)status.mt_gstat);
1214 +      if (GMT_EOF(status.mt_gstat))
1215 +       printf(" EOF");
1216 +      if (GMT_BOT(status.mt_gstat))
1217 +       printf(" BOT");
1218 +      if (GMT_EOT(status.mt_gstat))
1219 +       printf(" EOT");
1220 +      if (GMT_SM(status.mt_gstat))
1221 +       printf(" SM");
1222 +      if (GMT_EOD(status.mt_gstat))
1223 +       printf(" EOD");
1224 +      if (GMT_WR_PROT(status.mt_gstat))
1225 +       printf(" WR_PROT");
1226 +      if (GMT_ONLINE(status.mt_gstat))
1227 +       printf(" ONLINE");
1228 +      if (GMT_D_6250(status.mt_gstat))
1229 +       printf(" D_6250");
1230 +      if (GMT_D_1600(status.mt_gstat))
1231 +       printf(" D_1600");
1232 +      if (GMT_D_800(status.mt_gstat))
1233 +       printf(" D_800");
1234 +      if (GMT_DR_OPEN(status.mt_gstat))
1235 +       printf(" DR_OPEN");       
1236 +      if (GMT_IM_REP_EN(status.mt_gstat))
1237 +       printf(" IM_REP_EN");
1238 +      printf("\n");
1239 +    }
1240 +  else
1241 +    {
1242 +      printf("gstat = %0x\n", (unsigned)status.mt_gstat);
1243 +    }
1244 +#endif
1245  }
1246  
1247  void
1248 @@ -318,7 +651,122 @@
1249    int status;
1250  {
1251    fprintf (fp, "\
1252 -Usage: %s [-V] [-f device] [--file=device] [--help] [--version] operation [count]\n",
1253 +Usage: %s [-V] [-f device] [--file=device] [--rsh-command=command]\n\
1254 +\t[--help] [--version] operation [count]\n",
1255            program_name);
1256    exit (status);
1257  }
1258 +
1259 +#if defined(linux) || defined(__linux)
1260 +/*** Get and set the DAT compression (Mode Page 15) ***/
1261 +
1262 +#define MODE_SENSE 0x1a
1263 +#define MODE_SELECT 0x15
1264 +
1265 +int
1266 +read_mode_page(int fn, int page, int length, unsigned char *buffer,
1267 +              int do_mask)
1268 +{
1269 +  int result, *ip;
1270 +  unsigned char tmpbuffer[30], *cmd;
1271 +
1272 +  memset(tmpbuffer, 0, 14);
1273 +  ip = (int *)&(tmpbuffer[0]);
1274 +  *ip = 0;
1275 +  *(ip+1) = length + 4;
1276 +
1277 +  cmd = &(tmpbuffer[8]);
1278 +  cmd[0] = MODE_SENSE;
1279 +  cmd[1] = 8;
1280 +  cmd[2] = page;
1281 +  if (do_mask)
1282 +    cmd[2] |= 0x40;  /* Get changeable parameter mask */
1283 +  cmd[4] = length + 4;
1284 +
1285 +  result = ioctl(fn, 1, tmpbuffer);
1286 +  if (result) {
1287 +    fprintf(stderr, "Can't read mode page. Are you sure you are root?\n");
1288 +    return 0;
1289 +  }
1290 +  memcpy(buffer, tmpbuffer + 8, length + 4);
1291 +  return 1;
1292 +}
1293 +
1294 +
1295 +int
1296 +write_mode_page(int fn, int page, int length, unsigned char *buffer)
1297 +{
1298 +  int result, *ip;
1299 +  unsigned char tmpbuffer[40], *cmd;
1300 +
1301 +  memset(tmpbuffer, 0, 14);
1302 +  ip = (int *)&(tmpbuffer[0]);
1303 +  *ip = length + 4;
1304 +  *(ip+1) = 0;
1305 +
1306 +  cmd = &(tmpbuffer[8]);
1307 +  cmd[0] = MODE_SELECT;
1308 +  cmd[1] = 0x10;
1309 +  cmd[4] = length + 4;
1310 +
1311 +  memcpy(tmpbuffer + 14, buffer, length + 4);
1312 +  tmpbuffer[14] = 0;  /* reserved data length */
1313 +  tmpbuffer[18] &= 0x3f;  /* reserved bits in page code byte */
1314 +
1315 +  result = ioctl(fn, 1, tmpbuffer);
1316 +  if (result) {
1317 +    fprintf(stderr, "Can't write mode page.\n");
1318 +    return 0;
1319 +  }
1320 +  return 1;
1321 +}
1322 +
1323 +
1324 +int
1325 +do_dat_compression(char *dev, int fn, int count)
1326 +{
1327 +  int i;
1328 +  unsigned char buffer[30], mask[30];
1329 +
1330 +  if (!read_mode_page(fn, 0x0f, 16, buffer, 0)) {
1331 +    error (2, errno, "%s", dev);
1332 +  }
1333 +
1334 +  if (count != 1) {
1335 +    if (read_mode_page(fn, 0x0f, 16, mask, 1))
1336 +      if (mask[4+2] & 0x80 == 0)
1337 +        fprintf(stderr, "Device does not allow setting this parameter.\n");
1338 +    if (count == 0)
1339 +      buffer[4+2] &= 0x7f;
1340 +    else {
1341 +      buffer[4+2] |= 0x80;
1342 +      if (buffer[4+2+1] & 0x80 == 0) {
1343 +        fprintf(stderr, "Warning: Decompression is disabled.  Enabling.\n");
1344 +        buffer[4+2+1] |= 0x80;
1345 +      }
1346 +    }
1347 +      buffer[1] = 0;
1348 +    if (!write_mode_page(fn, 0x0f, 16, buffer)) {
1349 +      error (2, errno, "%s", dev);
1350 +    }
1351 +    if (!read_mode_page(fn, 0x0f, 16, buffer, 0)) {  /* Re-read to check */
1352 +      error (2, errno, "%s", dev);
1353 +    }
1354 +  }
1355 +
1356 +  if (buffer[4+2] & 0x80)
1357 +    printf("Compression on.\n");
1358 +  else
1359 +    printf("Compression off.\n");
1360 +  if (buffer[4+2] & 0x40)
1361 +    printf("Compression capable.\n");
1362 +  else
1363 +    printf("Compression not capable.\n");
1364 +  if (buffer[4+2+1] & 0x80)
1365 +    printf("Decompression capable.\n");
1366 +  else
1367 +    printf("Decompression not capable.\n");
1368 +
1369 +  return 1;
1370 +}
1371 +#endif
1372 --- cpio-2.4.2/rmt.c.debian     Tue Jun 26 13:51:18 2001
1373 +++ cpio-2.4.2/rmt.c    Tue Jun 26 13:59:12 2001
1374 @@ -45,9 +45,9 @@
1375  #endif
1376  #include <errno.h>
1377  
1378 -#if defined (_I386) && defined (_AIX)
1379 +/* Debian hack: gcc has exhibited problems loading fcntl.h.  Therefore,
1380 +   I removed the preprocessor conditionals here - BEM */
1381  #include <fcntl.h>
1382 -#endif
1383  
1384  #ifdef HAVE_UNISTD_H
1385  #include <unistd.h>
1386 @@ -78,7 +78,23 @@
1387  #include <errno.h>
1388  #else
1389  extern errno;
1390 -extern char *sys_errlist[];
1391 +extern const char *const _sys_errlist[];
1392 +#if HAVE_STRERROR || _LIBC
1393 +#ifndef strerror
1394 +char *strerror();
1395 +#endif
1396 +#else
1397 +static char *private_strerror(errnum)
1398 +       int errnum;
1399 +{
1400 +       extern char *sys_errlist[];
1401 +       extern int sys_nerr;
1402 +       if(errnum>0 && errnum<=sys_nerr)
1403 +               return sys_errlist[errnum];
1404 +       return "Unknown system error";
1405 +}
1406 +#define strerror private_strerror
1407 +#endif
1408  #endif
1409  char resp[BUFSIZ];
1410  
1411 @@ -87,6 +103,30 @@
1412  #define        DEBUG1(f,a)     if (debug) fprintf(debug, f, a)
1413  #define        DEBUG2(f,a1,a2) if (debug) fprintf(debug, f, a1, a2)
1414  
1415 +/*
1416 + * Support for Sun's extended RMT protocol
1417 + */
1418 +#define RMTI_VERSION   -1
1419 +#define RMT_VERSION    1
1420 +
1421 +/* Extended 'i' commands */
1422 +#define RMTI_CACHE     0
1423 +#define RMTI_NOCACHE   1
1424 +#define RMTI_RETEN     2
1425 +#define RMTI_ERASE     3
1426 +#define RMTI_EOM       4
1427 +#define RMTI_NBSF      5
1428 +
1429 +/* Extended 's' comands */
1430 +#define MTS_TYPE       'T'
1431 +#define MTS_DSREG      'D'
1432 +#define MTS_ERREG      'E'
1433 +#define MTS_RESID      'R'
1434 +#define MTS_FILENO     'F'
1435 +#define MTS_BLKNO      'B'
1436 +#define MTS_FLAGS      'f'
1437 +#define MTS_BF         'b'
1438 +
1439  int
1440  main (argc, argv)
1441       int argc;
1442 @@ -200,7 +240,12 @@
1443        getstring (op);
1444        getstring (count);
1445        DEBUG2 ("rmtd: I %s %s\n", op, count);
1446 +      if (atoi(op) == RMTI_VERSION)
1447 +      {
1448 +         rval = RMT_VERSION;
1449 +      }
1450  #ifdef MTIOCTOP
1451 +      else
1452        {
1453         struct mtop mtop;
1454         mtop.mt_op = atoi (op);
1455 @@ -212,6 +257,58 @@
1456  #endif
1457        goto respond;
1458  
1459 +    case 'i':
1460 +      {
1461 +       struct mtop mtop;
1462 +       
1463 +       getstring (op);
1464 +       getstring (count);
1465 +       DEBUG2 ("rmtd: i %s %s\n", op, count);
1466 +       switch (atoi(op))
1467 +       {
1468 +#ifdef MTCACHE
1469 +         case RMTI_CACHE:
1470 +           mtop.mt_op = MTCACHE;
1471 +           break;
1472 +#endif
1473 +#ifdef MTNOCACHE
1474 +         case RMTI_NOCACHE:
1475 +           mtop.mt_op = MTNOCACHE;
1476 +           break;
1477 +#endif
1478 +#ifdef MTRETEN
1479 +         case RMTI_RETEN:
1480 +           mtop.mt_op = MTRETEN;
1481 +           break;
1482 +#endif
1483 +#ifdef MTERASE
1484 +         case RMTI_ERASE:
1485 +           mtop.mt_op = MTERASE;
1486 +           break;
1487 +#endif
1488 +#ifdef MTEOM
1489 +         case RMTI_EOM:
1490 +           mtop.mt_op = MTEOM;
1491 +           break;
1492 +#endif
1493 +#ifdef MTNBSF
1494 +         case RMTI_NBSF:
1495 +           mtop.mt_op = MTNBSF;
1496 +           break;
1497 +#endif
1498 +         default:
1499 +           errno = EINVAL;
1500 +           goto ioerror;
1501 +       }
1502 +#ifdef MTIOCTOP
1503 +       mtop.mt_count = atoi (count);
1504 +       if (ioctl (tape, MTIOCTOP, (char *) &mtop) < 0)
1505 +         goto ioerror;
1506 +       rval = mtop.mt_count;
1507 +      }
1508 +#endif
1509 +      goto respond;
1510 +
1511      case 'S':                  /* status */
1512        DEBUG ("rmtd: S\n");
1513        {
1514 @@ -227,6 +324,59 @@
1515         goto top;
1516        }
1517  
1518 +    case 's':
1519 +      {
1520 +       char s;
1521 +       struct mtget mtget;
1522 +
1523 +       if (read (0, &s, 1) != 1)
1524 +         goto top;
1525 +       
1526 +#ifdef MTIOCGET
1527 +       if (ioctl (tape, MTIOCGET, (char *) &mtget) < 0)
1528 +         goto ioerror;
1529 +#endif
1530 +       switch (s)
1531 +       {
1532 +         case MTS_TYPE:
1533 +           rval = mtget.mt_type;
1534 +           break;
1535 +
1536 +         case MTS_DSREG:
1537 +           rval = mtget.mt_dsreg;
1538 +           break;
1539 +
1540 +         case MTS_ERREG:
1541 +           rval = mtget.mt_erreg;
1542 +           break;
1543 +
1544 +         case MTS_RESID:
1545 +           rval = mtget.mt_resid;
1546 +           break;
1547 +
1548 +         case MTS_FILENO:
1549 +           rval = mtget.mt_fileno;
1550 +           break;
1551 +
1552 +         case MTS_BLKNO:
1553 +           rval = mtget.mt_blkno;
1554 +           break;
1555 +
1556 +         case MTS_FLAGS:
1557 +           rval = mtget.mt_gstat;
1558 +           break;
1559 +
1560 +         case MTS_BF:
1561 +           rval = 0;
1562 +           break;
1563 +
1564 +         default:
1565 +           errno = EINVAL;
1566 +           goto ioerror;
1567 +       }
1568 +       goto respond;
1569 +      }
1570 +
1571      default:
1572        DEBUG1 ("rmtd: garbage command %c\n", c);
1573        exit (3);
1574 @@ -289,7 +439,11 @@
1575       int num;
1576  {
1577  
1578 -  DEBUG2 ("rmtd: E %d (%s)\n", num, sys_errlist[num]);
1579 -  (void) sprintf (resp, "E%d\n%s\n", num, sys_errlist[num]);
1580 +/* Debian hack: rmt has problems on systems (such as the Hurd) where
1581 +   sys_errlist is not available therefore I borrowed some code from
1582 +   error.c to fix this problem.  This has been reported to the upstream
1583 +   maintainers.  (7/22/99) - BEM */
1584 +  DEBUG2 ("rmtd: E %d (%s)\n", num, strerror (num));
1585 +  (void) sprintf (resp, "E%d\n%s\n", num, strerror (num));
1586    (void) write (1, resp, strlen (resp));
1587  }
1588 --- cpio-2.4.2/cpio.texi.debian Wed Dec 20 17:29:34 1995
1589 +++ cpio-2.4.2/cpio.texi        Tue Jun 26 13:51:18 2001
1590 @@ -257,10 +257,11 @@
1591  @example
1592  cpio @{-o|--create@} [-0acvABLV] [-C bytes] [-H format]
1593  [-M message] [-O [[user@@]host:]archive] [-F [[user@@]host:]archive]
1594 -[--file=[[user@@]host:]archive] [--format=format] [--sparse]
1595 +[--file=[[user@@]host:]archive] [--format=format]
1596  [--message=message][--null] [--reset-access-time] [--verbose]
1597  [--dot] [--append] [--block-size=blocks] [--dereference]
1598 -[--io-size=bytes] [--help] [--version] < name-list [> archive]
1599 +[--io-size=bytes] [--rsh-command=command] [--help] [--version]
1600 +< name-list [> archive]
1601  @end example
1602  
1603  @node Copy-in mode, Copy-pass mode, Copy-out mode, Invoking `cpio'
1604 @@ -286,9 +287,9 @@
1605  [--dot] [--unconditional] [--verbose] [--block-size=blocks]
1606  [--swap-halfwords] [--io-size=bytes] [--pattern-file=file]
1607  [--format=format] [--owner=[user][:.][group]]
1608 -[--no- preserve-owner] [--message=message] [--help] [--version]
1609 -[-no-abosolute-filenames] [-only-verify-crc] [-quiet]
1610 -[pattern...] [< archive]
1611 +[--no-preserve-owner] [--message=message] [--help] [--version]
1612 +[-no-abosolute-filenames] [--sparse] [-only-verify-crc] [-quiet]
1613 +[--rsh-command=command] [pattern...] [< archive]
1614  @end example
1615  
1616  @node Copy-pass mode, Options, Copy-in mode, Invoking `cpio'
1617 @@ -492,6 +493,10 @@
1618  separator is given, use the given user's login group.  Only the
1619  super-user can change files' ownership.
1620  
1621 +@item --rsh-command=COMMAND
1622 +Notifies cpio that is should use COMMAND to communicate with remote
1623 +devices.
1624 +
1625  @item -s, --swap-bytes
1626  Swap the bytes of each halfword (pair of bytes) in the files.This option
1627  can be used in copy-in mode.
1628 @@ -502,7 +507,7 @@
1629  
1630  @item --sparse
1631  Write files with large blocks of zeros as sparse files.  This option is
1632 -used in copy-out and copy-pass modes.
1633 +used in copy-in and copy-pass modes.
1634  
1635  @item -t, --list
1636  Print a table of contents of the input.
1637 --- cpio-2.4.2/rmt.sh.debian    Tue Jun 26 13:51:18 2001
1638 +++ cpio-2.4.2/rmt.sh   Tue Jun 26 13:51:18 2001
1639 @@ -0,0 +1,8 @@
1640 +#!/bin/sh
1641 +#
1642 +# This is not a mistake.  This shell script (/etc/rmt) has been provided
1643 +# for compatibility with other Unix-like systems, some of which have
1644 +# utilities that expect to find (and execute) rmt in the /etc directory
1645 +# on remote systems.
1646 +#
1647 +exec /usr/sbin/rmt
1648 --- cpio-2.4.2/debian/prerm.debian      Tue Jun 26 13:51:18 2001
1649 +++ cpio-2.4.2/debian/prerm     Tue Jun 26 13:51:18 2001
1650 @@ -0,0 +1,20 @@
1651 +#!/bin/sh -e
1652 +
1653 +# movedoc - function to make the transition /usr/doc -> /usr/share/doc
1654 +movedoc()
1655 +{
1656 +    PKG=cpio
1657 +    OLD=/usr/doc/$PKG
1658 +    if test -h $OLD; then
1659 +       rm -f $OLD
1660 +    fi
1661 +}
1662 +
1663 +if [ "$1" = remove ]; then 
1664 +    update-alternatives --remove mt /bin/mt-gnu
1665 +    install-info --quiet --remove /usr/info/cpio.info
1666 +    if test -L /sbin/rmt -a /sbin/rmt -ef /usr/sbin/rmt; then
1667 +       rm -f /sbin/rmt
1668 +    fi
1669 +    movedoc
1670 +fi
1671 --- cpio-2.4.2/debian/changelog.debian  Tue Jun 26 13:51:18 2001
1672 +++ cpio-2.4.2/debian/changelog Tue Jun 26 13:51:18 2001
1673 @@ -0,0 +1,217 @@
1674 +cpio (2.4.2-36) unstable; urgency=low
1675 +
1676 +  * Fixed error with mt alternatives.  (Closes: Bug#84476)
1677 +
1678 + -- Brian Mays <brian@debian.org>  Fri,  2 Feb 2001 15:05:22 -0500
1679 +
1680 +cpio (2.4.2-35) unstable; urgency=low
1681 +
1682 +  * Renamed gmt to mt-gnu.  (Closes: Bug#84118)
1683 +
1684 + -- Brian Mays <brian@debian.org>  Tue, 30 Jan 2001 19:42:28 -0500
1685 +
1686 +cpio (2.4.2-34) unstable; urgency=low
1687 +
1688 +  * Added an environment variable to cpio and mt to specify the remote
1689 +    command.  (Closes: Bug#71048)
1690 +  * Added compatibility with the mt-st package.  (Closes: Bug#83813)
1691 +
1692 + -- Brian Mays <brian@debian.org>  Sun, 28 Jan 2001 16:15:44 -0500
1693 +
1694 +cpio (2.4.2-33) unstable; urgency=low
1695 +
1696 +  * Added density code 0x22 (SLR4DC) to mt.  (Closes: Bug#67424)
1697 +
1698 + -- Brian Mays <brian@debian.org>  Thu, 27 Jul 2000 17:49:56 -0400
1699 +
1700 +cpio (2.4.2-32) frozen unstable; urgency=low
1701 +
1702 +  * Added patch by Fred Long <flong@sea.com> and Marc SCHAEFER
1703 +    <schaefer@alphanet.ch> to fix file corruption when a file changes
1704 +    during the backup.  (Closes: Bug#53056)
1705 +  * Added patch from Anders Hammarquist <iko@dd.chalmers.se> to make
1706 +    rmt work with Solaris ufsdump/ufsrestore.  (Closes: Bug#58323)
1707 +
1708 + -- Brian Mays <brian@debian.org>  Thu, 17 Feb 2000 12:43:01 -0500
1709 +
1710 +cpio (2.4.2-31) frozen unstable; urgency=low
1711 +
1712 +  * Fixed missing element from manpage.  (Closes: Bug#56904)
1713 +
1714 + -- Brian Mays <brian@debian.org>  Thu,  3 Feb 2000 13:39:55 -0500
1715 +
1716 +cpio (2.4.2-30) frozen unstable; urgency=low
1717 +
1718 +  * Added build-time dependencies.
1719 +
1720 + -- Brian Mays <brian@debian.org>  Mon, 17 Jan 2000 13:32:18 -0500
1721 +
1722 +cpio (2.4.2-29) unstable; urgency=low
1723 +
1724 +  * Added patch from Mark Eichin to fix mt's datcompression.  (Closes:
1725 +    Bug#52755)
1726 +
1727 + -- Brian Mays <brian@debian.org>  Fri, 17 Dec 1999 14:14:40 -0500
1728 +
1729 +cpio (2.4.2-28) unstable; urgency=low
1730 +
1731 +  * Modified cpio so that the -v and -V flags work with
1732 +    --only-verify-crc.  (Closes: Bug#49791)
1733 +
1734 + -- Brian Mays <brian@debian.org>  Wed, 10 Nov 1999 08:42:34 -0500
1735 +
1736 +cpio (2.4.2-27) unstable; urgency=low
1737 +
1738 +  * Fixed FHS /usr/doc -> /usr/share/doc transition scheme.
1739 +
1740 + -- Brian Mays <brian@debian.org>  Fri,  1 Oct 1999 12:43:24 -0400
1741 +
1742 +cpio (2.4.2-26) unstable; urgency=low
1743 +
1744 +  * Added symbolic link /usr/doc/cpio -> /usr/share/doc/cpio.
1745 +
1746 + -- Brian Mays <brian@debian.org>  Thu, 16 Sep 1999 13:45:04 -0400
1747 +
1748 +cpio (2.4.2-25) unstable; urgency=low
1749 +
1750 +  * Changed section to "utils".
1751 +  * Made /etc/rmt a wrapper script (with comments detailing its purpose)
1752 +    instead of a symlink.
1753 +  * Removed tar from cpio man page.  (Closes: Bug#38043)
1754 +  * Moved doc, man, and info to /usr/share as per the FHS.
1755 +  * Fixed bug in rmt causing problems on systems (such as the Hurd)
1756 +    where sys_errlist is not available.  (Closes: Bug#37164)
1757 +
1758 + -- Brian Mays <brian@debian.org>  Thu, 22 Jul 1999 12:04:32 -0400
1759 +
1760 +cpio (2.4.2-24) unstable; urgency=low
1761 +
1762 +  * Made Debian scripts create and remove the symbolic links to rmt.
1763 +    (Closes: Bug#33670)
1764 +
1765 + -- Brian Mays <brian@debian.org>  Mon, 22 Feb 1999 17:24:21 -0500
1766 +
1767 +cpio (2.4.2-23) frozen unstable; urgency=low
1768 +
1769 +  * Fixed a bug causing cpio to segfault when the tar format is used.
1770 +  * Fixed bugs causing cpio to use the wrong minor device numbers.
1771 +
1772 + -- Brian Mays <brian@debian.org>  Wed,  6 Jan 1999 09:59:24 -0500
1773 +
1774 +cpio (2.4.2-22) unstable frozen; urgency=low
1775 +
1776 +  * Fixed "Lwhence\noffset\n" error in rmt manual page.  (Fixes:
1777 +    Bug#28960)
1778 +
1779 + -- Brian Mays <brian@debian.org>  Fri,  6 Nov 1998 11:01:57 -0500
1780 +
1781 +cpio (2.4.2-21) unstable; urgency=low
1782 +
1783 +  * Modified cpio to use the -n flag also to extract tar archives using
1784 +    the numeric UID/GID instead of the user/group names in /etc/passwd
1785 +    and /etc/groups.
1786 +
1787 + -- Brian Mays <brian@debian.org>  Thu, 15 Oct 1998 15:20:34 -0400
1788 +
1789 +cpio (2.4.2-20) unstable; urgency=low
1790 +
1791 +  * Fixed bug in --sparse feature.
1792 +
1793 + -- Brian Mays <brian@debian.org>  Mon,  5 Oct 1998 12:51:47 -0400
1794 +
1795 +cpio (2.4.2-19) unstable; urgency=low
1796 +
1797 +  * Added NEWS and README to /usr/doc/cpio.  (Fixes: Bug#26338)
1798 +
1799 + -- Brian Mays <brian@debian.org>  Wed,  2 Sep 1998 13:32:18 -0400
1800 +
1801 +cpio (2.4.2-18) unstable; urgency=low
1802 +
1803 +  * Added patch from Evan Harris to fix mt's datcompression.  (Fixes:
1804 +    Bug#23980)
1805 +
1806 + -- Brian Mays <brian@debian.org>  Mon, 29 Jun 1998 11:35:57 -0400
1807 +
1808 +cpio (2.4.2-17) unstable; urgency=low
1809 +
1810 +  * Added patch necessary to build cpio in glibc_2.1.  (Provided by
1811 +    Juan Cespedes <cespedes@debian.org>.)  (Fixes: Bug#22643)
1812 +  * Added a --rsh-command command line option (similar to tar's) to
1813 +    cpio and mt.
1814 +  * Made ssh the default remote command.
1815 +
1816 + -- Brian Mays <brian@debian.org>  Tue, 26 May 1998 13:01:27 -0400
1817 +
1818 +cpio (2.4.2-16) unstable frozen; urgency=low
1819 +
1820 +  * Fixed problem causing corruption of old style ascii cpio archives.
1821 +    Problem caused by a change in the dev_t type used by glibc.
1822 +    (Fixes: Bug#22857)
1823 +
1824 + -- Brian Mays <brian@debian.org>  Tue, 26 May 1998 13:01:19 -0400
1825 +
1826 +cpio (2.4.2-15) frozen unstable; urgency=low
1827 +
1828 +  * Added a patch required for cpio to compile on a PowerPC.  Fixes:
1829 +    Bug#21411.
1830 +  * Removed bashisms from the debian/rules makefile.
1831 +
1832 + -- Brian Mays <brian@debian.org>  Mon, 20 Apr 1998 14:20:36 -0400
1833 +
1834 +cpio (2.4.2-14) unstable; urgency=low
1835 +
1836 +  * Removed old FSF address from copyright file.
1837 +
1838 + -- Brian Mays <brian@debian.org>  Thu, 12 Feb 1998 17:45:29 -0500
1839 +
1840 +cpio (2.4.2-13) unstable; urgency=low
1841 +
1842 +  * Changed the function responsible for processing the count parameter
1843 +    from atoi() to strtol().  This will allow entries such as 0x24 to be
1844 +    used.
1845 +
1846 + -- Brian Mays <brian@debian.org>  Fri,  5 Dec 1997 17:21:08 -0500
1847 +
1848 +cpio (2.4.2-12) unstable; urgency=low
1849 +
1850 +  * Added patch to report more information on FTAPE drives.
1851 +  * Made several miscellaneous fixes to source.
1852 +
1853 + -- Brian Mays <brian@debian.org>  Sun, 26 Oct 1997 15:47:59 -0500
1854 +
1855 +cpio (2.4.2-11) unstable; urgency=low
1856 +
1857 +  * Libc6 release.
1858 +
1859 + -- Brian Mays <brian@debian.org>  Tue,  5 Aug 1997 16:53:14 -0400
1860 +
1861 +cpio (2.4.2-10) unstable; urgency=low
1862 +
1863 +  * Added CR at end of `mt status' output (fixed Bug#7632).
1864 +
1865 + -- Brian Mays <brian@debian.org>  Tue, 25 Feb 1997 12:15:09 -0500
1866 +
1867 +cpio (2.4.2-9) unstable; urgency=low
1868 +
1869 +  * Fixed a couple of bugs.
1870 +  * Moved /usr/doc/cpio/ChangeLog.gz to /usr/doc/cpio/changelog.gz.
1871 +
1872 + -- Brian Mays <brian@debian.org>  Thu, 2 Jan 1997 12:18:39 -0500
1873 +
1874 +cpio (2.4.2-8) unstable; urgency=low
1875 +
1876 +  * Fixed bug #4427, wrong syscall used to print position of tape.
1877 +
1878 + -- Brian Mays <brian@debian.org>  Thu, 12 Sep 1996 09:55:21 -0400
1879 +
1880 +cpio (2.4.2-7) unstable; urgency=low
1881 +
1882 +  * New upstream source.
1883 +  * Added an rmt manpage (from BSD).
1884 +  * First release with the new source format.
1885 +
1886 + -- Brian Mays <brian@debian.org>  Fri, 23 Aug 1996 23:27:40 -0400
1887 +
1888 +Local variables:
1889 +mode: debian-changelog
1890 +End:
1891 --- cpio-2.4.2/debian/rules.debian      Tue Jun 26 13:51:18 2001
1892 +++ cpio-2.4.2/debian/rules     Tue Jun 26 13:51:18 2001
1893 @@ -0,0 +1,89 @@
1894 +#!/usr/bin/make -f
1895 +# -*- makefile -*-
1896 +# debian/rules file - for cpio
1897 +# Copyright 1996-99 by Brian Mays
1898 +# Patterned after the hello package by Ian Jackson.
1899 +
1900 +package=cpio
1901 +
1902 +Makefile:
1903 +       $(checkdir)
1904 +       ./configure --prefix=/usr/share --exec_prefix=
1905 +
1906 +build: Makefile
1907 +       $(checkdir)
1908 +       $(MAKE) CFLAGS='-O2 -g -Wall' all rmt info
1909 +       touch build
1910 +
1911 +clean:
1912 +       $(checkdir)
1913 +       $(RM) build
1914 +       $(MAKE) -i distclean || $(MAKE) -f Makefile.in distclean
1915 +       $(RM) config.cache
1916 +       $(RM) -r *~ debian/tmp debian/*~ debian/files*
1917 +
1918 +binary-indep:  checkroot build
1919 +       $(checkdir)
1920 +
1921 +binary-arch:   checkroot build
1922 +       $(chechdir)
1923 +       $(RM) -r debian/tmp
1924 +       install -d debian/tmp debian/tmp/DEBIAN
1925 +       install -d debian/tmp/usr/share/doc/$(package)
1926 +# Install Debian package control information files
1927 +       install debian/postinst \
1928 +               debian/prerm debian/tmp/DEBIAN/.
1929 +# Install directories
1930 +       install -d      \
1931 +               debian/tmp/etc  \
1932 +               debian/tmp/sbin \
1933 +               debian/tmp/bin  \
1934 +               debian/tmp/usr/sbin     \
1935 +               debian/tmp/usr/share/man/man1   \
1936 +               debian/tmp/usr/share/man/man8   \
1937 +               debian/tmp/usr/share/info
1938 +# Install files
1939 +       $(MAKE) install prefix=debian/tmp/usr/share exec_prefix=debian/tmp \
1940 +         libexecdir=debian/tmp/usr/sbin
1941 +       mv debian/tmp/bin/mt debian/tmp/bin/mt-gnu 
1942 +       mv debian/tmp/usr/share/man/man1/mt.1 \
1943 +         debian/tmp/usr/share/man/man1/mt-gnu.1
1944 +# Strip binaries
1945 +       strip debian/tmp/bin/*
1946 +       strip debian/tmp/usr/sbin/*
1947 +# Install documentation
1948 +       install -m 644 ChangeLog debian/tmp/usr/share/doc/$(package)/changelog
1949 +       install -m 644 NEWS README debian/tmp/usr/share/doc/$(package)/.
1950 +# Install changelog & copyright
1951 +       install -m 644 debian/changelog \
1952 +         debian/tmp/usr/share/doc/$(package)/changelog.Debian
1953 +       install -m 644 rmt.8 debian/tmp/usr/share/man/man8/.
1954 +       install rmt.sh debian/tmp/etc/rmt
1955 +       gzip -9v debian/tmp/usr/share/doc/$(package)/*
1956 +       gzip -9v debian/tmp/usr/share/man/*/*
1957 +       gzip -9v debian/tmp/usr/share/info/*
1958 +       install -m 644 debian/copyright debian/tmp/usr/share/doc/$(package)/.
1959 +# Determine shared library dependencies
1960 +       dpkg-shlibdeps cpio mt rmt
1961 +# Genereate deb file
1962 +       dpkg-gencontrol
1963 +       chown -R root.root debian/tmp
1964 +       chmod -R g-ws debian/tmp
1965 +       dpkg-deb --build debian/tmp ..
1966 +
1967 +define checkdir
1968 +       test -f $(package).h -a -f debian/rules
1969 +endef
1970 +
1971 +# Below here is fairly generic really
1972 +
1973 +binary:                binary-indep binary-arch
1974 +
1975 +source diff:
1976 +       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
1977 +
1978 +checkroot:
1979 +       $(checkdir)
1980 +       test root = "`whoami`"
1981 +
1982 +.PHONY: binary binary-arch binary-indep clean checkroot
1983 --- cpio-2.4.2/debian/postinst.debian   Tue Jun 26 13:51:18 2001
1984 +++ cpio-2.4.2/debian/postinst  Tue Jun 26 13:51:18 2001
1985 @@ -0,0 +1,34 @@
1986 +#!/bin/sh -e
1987 +
1988 +# movedoc - function to make the transition /usr/doc -> /usr/share/doc
1989 +movedoc()
1990 +{
1991 +    PKG=cpio
1992 +    OLD=/usr/doc/$PKG
1993 +    NEW=/usr/share/doc/$PKG
1994 +    if test -d $OLD -a ! -h $OLD -a ! $OLD -ef $NEW; then
1995 +       rm -f $OLD/.dhelp
1996 +       if test -e $OLD && ! rmdir $OLD 2>/dev/null; then
1997 +           VERSION_CONTROL=t \
1998 +           cp -ab $OLD $NEW/..
1999 +           rm -rf $OLD
2000 +       fi
2001 +    fi
2002 +    if test -d /usr/doc -a ! -e $OLD -a -d $NEW; then
2003 +       ln -s $NEW $OLD
2004 +    fi
2005 +}
2006 +
2007 +if [ "$1" = configure ]; then
2008 +    # Fix some screwup in old package
2009 +    case "$2" in
2010 +    2.4.2-3[45]) update-alternatives --remove mt /bin/gmt; esac
2011 +    update-alternatives --install /bin/mt mt /bin/mt-gnu 10 \
2012 +      --slave \
2013 +       /usr/share/man/man1/mt.1.gz mt.1.gz /usr/share/man/man1/mt-gnu.1.gz
2014 +    install-info --quiet \
2015 +      --description="A program to manage archives of files." \
2016 +      --section "General Commands" "General Commands" /usr/info/cpio.info
2017 +    test -f /sbin/rmt || ln -s ../usr/sbin/rmt /sbin/rmt
2018 +    movedoc
2019 +fi
2020 --- cpio-2.4.2/debian/copyright.debian  Tue Jun 26 13:51:18 2001
2021 +++ cpio-2.4.2/debian/copyright Tue Jun 26 13:51:18 2001
2022 @@ -0,0 +1,69 @@
2023 +This is the Debian GNU/Linux prepackaged version of GNU cpio
2024 +(including mt).
2025 +
2026 +This package was put together by Ian Murdock <imurdock@debian.org>,
2027 +from sources obtained from:
2028 + prep.ai.mit.edu:/pub/gnu
2029 +
2030 +This package has been modified by Brian Mays <brian@debian.org>.
2031 +Modifications of cpio package for Debian GNU/Linux Copyright (C) 1996-99
2032 +Brian Mays and are released under the GPL (on Debian systems see
2033 +`/usr/doc/copyright/GPL').
2034 +
2035 +Changes:
2036 + * added Debian GNU/Linux package maintenance system files
2037 + * moved rmt from /etc to /usr/sbin and installed a symbolic link to
2038 +   /usr/sbin/rmt
2039 + * split cpio and mt into two separate Debian binary packages
2040 + * fixed 'mt -V' bug
2041 + * modified cpio to print a list of filenames terminated by a null
2042 +   character when the -t and -0 flags are used
2043 + * eliminated a spurious error message printed when the -a flag is
2044 +   used on a read-only filesystem
2045 + * fixed a remote ioctl bug in mt that caused spurious error messages
2046 +   when commands were sent to a remote tape device
2047 + * added SCSI support to mt
2048 + * fixed 'cpio --sparse' bug
2049 + * added an rmt man page (from BSD).
2050 + * fixed a bug that could cause an endless loop
2051 + * fixed a bug that can occur when restoring a whole filesystem
2052 + * fixed problem causing corruption of old style ascii cpio archives
2053 + * fixed a bug that prevents cpio from being compiled with glibc 2.1
2054 + * added an rsh-command option to cpio and mt
2055 + * made ssh the default remote command (instead of rsh)
2056 + * fixed bug causing cpio to segfault when the tar format is used
2057 + * fixed bugs causing cpio to use the wrong minor device numbers
2058 + * fixed bug in rmt causing problems on systems (such as the Hurd)
2059 +   where sys_errlist is not available
2060 + * modified cpio so that the -v and -V flags work with
2061 +   --only-verify-crc
2062 +
2063 +GNU cpio is Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
2064 +
2065 +   This program is free software; you can redistribute it and/or modify
2066 +   it under the terms of the GNU General Public License as published by
2067 +   the Free Software Foundation; version 2 dated June, 1991.
2068 +
2069 +   This program is distributed in the hope that it will be useful,
2070 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2071 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2072 +   GNU General Public License for more details.
2073 +
2074 +On Debian GNU/Linux systems, the complete text of the GNU General
2075 +Public License can be found in `/usr/doc/copyright/GPL'.
2076 +
2077 +rmt.c is Copyright (C) 1983 Regents of the University of California.
2078 +
2079 +   All rights reserved.
2080 +
2081 +   Redistribution and use in source and binary forms are permitted
2082 +   provided that the above copyright notice and this paragraph are
2083 +   duplicated in all such forms and that any documentation,
2084 +   advertising materials, and other materials related to such
2085 +   distribution and use acknowledge that the software was developed
2086 +   by the University of California, Berkeley.  The name of the
2087 +   University may not be used to endorse or promote products derived
2088 +   from this software without specific prior written permission.
2089 +   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
2090 +   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
2091 +   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2092 --- cpio-2.4.2/debian/control.debian    Tue Jun 26 13:51:18 2001
2093 +++ cpio-2.4.2/debian/control   Tue Jun 26 13:51:18 2001
2094 @@ -0,0 +1,21 @@
2095 +Source: cpio
2096 +Section: utils
2097 +Priority: important
2098 +Maintainer: Brian Mays <brian@debian.org>
2099 +Build-Depends: texinfo
2100 +Standards-Version: 3.2.1.0
2101 +
2102 +Package: cpio
2103 +Architecture: any
2104 +Depends: ${shlibs:Depends}
2105 +Replaces: cpio-mt
2106 +Conflicts: mt-st(<<0.6), cpio-mt
2107 +Description: GNU cpio -- a program to manage archives of files.
2108 + GNU cpio is a tool for creating and extracting archives, or copying
2109 + files from one place to another.  It handles a number of cpio formats
2110 + as well as reading and writing tar files.
2111 + .
2112 + This package also includes rmt, the remote tape server, and GNU mt, a
2113 + tape drive control program.  The mt program is essential for magnetic
2114 + tape drive users.  Debian's version of GNU mt supports SCSI tape
2115 + drives.
2116 --- cpio-2.4.2/debian/substvars.debian  Tue Jun 26 13:51:18 2001
2117 +++ cpio-2.4.2/debian/substvars Tue Jun 26 13:51:18 2001
2118 @@ -0,0 +1 @@
2119 +shlibs:Depends=libc6 (>= 2.1.97)
2120 --- cpio-2.4.2/rmt.8.debian     Tue Jun 26 13:51:18 2001
2121 +++ cpio-2.4.2/rmt.8    Tue Jun 26 13:51:18 2001
2122 @@ -0,0 +1,223 @@
2123 +.\" Copyright (c) 1983, 1991, 1993
2124 +.\"    The Regents of the University of California.  All rights reserved.
2125 +.\"
2126 +.\" Redistribution and use in source and binary forms, with or without
2127 +.\" modification, are permitted provided that the following conditions
2128 +.\" are met:
2129 +.\" 1. Redistributions of source code must retain the above copyright
2130 +.\"    notice, this list of conditions and the following disclaimer.
2131 +.\" 2. Redistributions in binary form must reproduce the above copyright
2132 +.\"    notice, this list of conditions and the following disclaimer in the
2133 +.\"    documentation and/or other materials provided with the distribution.
2134 +.\" 3. All advertising materials mentioning features or use of this software
2135 +.\"    must display the following acknowledgement:
2136 +.\"    This product includes software developed by the University of
2137 +.\"    California, Berkeley and its contributors.
2138 +.\" 4. Neither the name of the University nor the names of its contributors
2139 +.\"    may be used to endorse or promote products derived from this software
2140 +.\"    without specific prior written permission.
2141 +.\"
2142 +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2143 +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2144 +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2145 +.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2146 +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2147 +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2148 +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2149 +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2150 +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2151 +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2152 +.\" SUCH DAMAGE.
2153 +.\"
2154 +.\"     @(#)rmt.8      8.2 (Berkeley) 12/11/93
2155 +.\"
2156 +.Dd December 11, 1993
2157 +.Dt RMT 8
2158 +.Os BSD 4.2
2159 +.Sh NAME
2160 +.Nm rmt
2161 +.Nd remote magtape protocol module
2162 +.Sh SYNOPSIS
2163 +.Nm rmt
2164 +.Sh DESCRIPTION
2165 +.Nm Rmt
2166 +is a program used by tar, cpio, mt, and the remote dump and restore
2167 +programs in manipulating a magnetic tape drive through an interprocess
2168 +communication connection.
2169 +.Nm Rmt
2170 +is normally started up with an
2171 +.Xr rexec 3
2172 +or
2173 +.Xr rcmd 3
2174 +call or the
2175 +.Xr rsh 1
2176 +command.
2177 +.Pp
2178 +The 
2179 +.Nm rmt
2180 +program accepts requests specific to the manipulation of
2181 +magnetic tapes, performs the commands, then responds with
2182 +a status indication.  All responses are in
2183 +.Tn ASCII
2184 +and in
2185 +one of two forms. 
2186 +Successful commands have responses of:
2187 +.Bd -filled -offset indent
2188 +.Sm off
2189 +.Sy A Ar number No \en
2190 +.Sm on
2191 +.Ed
2192 +.Pp
2193 +.Ar Number
2194 +is an
2195 +.Tn ASCII
2196 +representation of a decimal number.
2197 +Unsuccessful commands are responded to with:
2198 +.Bd -filled -offset indent
2199 +.Sm off
2200 +.Xo Sy E Ar error-number
2201 +.No \en Ar error-message
2202 +.No \en
2203 +.Xc
2204 +.Sm on
2205 +.Ed
2206 +.Pp
2207 +.Ar Error-number
2208 +is one of the possible error
2209 +numbers described in
2210 +.Xr intro 2
2211 +and
2212 +.Ar error-message
2213 +is the corresponding error string as printed
2214 +from a call to
2215 +.Xr perror 3 .
2216 +The protocol is comprised of the
2217 +following commands, which are sent as indicated - no spaces are supplied
2218 +between the command and its arguments, or between its arguments, and
2219 +.Ql \en
2220 +indicates that a newline should be supplied:
2221 +.Bl -tag -width Ds
2222 +.Sm off
2223 +.It Xo Sy \&O Ar device
2224 +.No \en Ar mode No \en
2225 +.Xc
2226 +Open the specified 
2227 +.Ar device
2228 +using the indicated
2229 +.Ar mode .
2230 +.Ar Device
2231 +is a full pathname and
2232 +.Ar mode
2233 +is an
2234 +.Tn ASCII
2235 +representation of a decimal
2236 +number suitable for passing to
2237 +.Xr open 2 .
2238 +If a device had already been opened, it is
2239 +closed before a new open is performed.
2240 +.It Xo Sy C Ar device No \en
2241 +.Xc
2242 +Close the currently open device.  The
2243 +.Ar device
2244 +specified is ignored.
2245 +.It Xo Sy L
2246 +.Ar offset No \en
2247 +.Ar whence No \en
2248 +.Xc
2249 +.Sm on
2250 +Perform an
2251 +.Xr lseek 2
2252 +operation using the specified parameters.
2253 +The response value is that returned from the
2254 +.Xr lseek
2255 +call.
2256 +.Sm off
2257 +.It Sy W Ar count No \en
2258 +.Sm on
2259 +Write data onto the open device.
2260 +.Nm Rmt
2261 +reads
2262 +.Ar count
2263 +bytes from the connection, aborting if
2264 +a premature end-of-file is encountered.
2265 +The response value is that returned from
2266 +the
2267 +.Xr write 2
2268 +call.
2269 +.Sm off
2270 +.It Sy R Ar count No \en
2271 +.Sm on
2272 +Read
2273 +.Ar count
2274 +bytes of data from the open device.
2275 +If
2276 +.Ar count
2277 +exceeds the size of the data buffer (10 kilobytes), it is
2278 +truncated to the data buffer size.
2279 +.Nm rmt
2280 +then performs the requested 
2281 +.Xr read 2
2282 +and responds with 
2283 +.Sm off
2284 +.Sy A Ar count-read No \en
2285 +.Sm on
2286 +if the read was
2287 +successful; otherwise an error in the
2288 +standard format is returned.  If the read
2289 +was successful, the data read is then sent.
2290 +.Sm off
2291 +.It Xo Sy I Ar operation
2292 +.No \en Ar count No \en
2293 +.Xc
2294 +.Sm on
2295 +Perform a
2296 +.Dv MTIOCOP
2297 +.Xr ioctl 2
2298 +command using the specified parameters.
2299 +The parameters are interpreted as the
2300 +.Tn ASCII
2301 +representations of the decimal values
2302 +to place in the 
2303 +.Ar mt_op
2304 +and
2305 +.Ar mt_count
2306 +fields of the structure used in the
2307 +.Xr ioctl
2308 +call.  The return value is the
2309 +.Ar count
2310 +parameter when the operation is successful.
2311 +.It Sy S
2312 +Return the status of the open device, as
2313 +obtained with a
2314 +.Dv MTIOCGET
2315 +.Xr ioctl
2316 +call.  If the operation was successful,
2317 +an ``ack'' is sent with the size of the
2318 +status buffer, then the status buffer is
2319 +sent (in binary).
2320 +.El
2321 +.Sm on
2322 +.Pp
2323 +Any other command causes 
2324 +.Nm rmt
2325 +to exit.
2326 +.Sh DIAGNOSTICS
2327 +All responses are of the form described above.
2328 +.Sh SEE ALSO
2329 +.Xr tar 1 ,
2330 +.Xr cpio 1 ,
2331 +.Xr mt 1 ,
2332 +.Xr rsh 1 ,
2333 +.Xr rcmd 3 ,
2334 +.Xr rexec 3 ,
2335 +.Xr mtio 4 ,
2336 +.Xr rdump 8 ,
2337 +.Xr rrestore 8
2338 +.Sh BUGS
2339 +People should be discouraged from using this for a remote
2340 +file access protocol.
2341 +.Sh HISTORY
2342 +The
2343 +.Nm
2344 +command appeared in
2345 +.Bx 4.2 .
This page took 0.212588 seconds and 3 git commands to generate.