+++ /dev/null
-diff -Nur cpio-2.5.orig/copyin.c cpio-2.5/copyin.c
---- cpio-2.5.orig/copyin.c Mon Jan 14 00:44:19 2002
-+++ cpio-2.5/copyin.c Sun Sep 1 00:49:09 2002
-@@ -18,6 +18,13 @@
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
-+#ifdef HAVE_SYS_PARAM_H
-+#include <sys/param.h>
-+#endif
-+#if ((defined(BSD) && (BSD >= 199306)) || defined(__GLIBC__))
-+#define HAVE_STRFTIME
-+#include <ctype.h>
-+#endif
- #include "filetypes.h"
- #include "system.h"
- #include "cpiohdr.h"
-@@ -28,6 +35,9 @@
- #ifndef FNM_PATHNAME
- #include <fnmatch.h>
- #endif
-+#if defined(HAVE_STRFTIME)
-+#include <langinfo.h>
-+#endif
-
- #ifndef HAVE_LCHOWN
- #define lchown chown
-@@ -1146,13 +1156,23 @@
- }
- return;
- }
--
-- res = mknod (file_hdr->c_name, file_hdr->c_mode,
-+
-+#ifdef CP_IFIFO
-+ if ((file_hdr->c_mode & CP_IFMT) == CP_IFIFO)
-+ res = mkfifo (file_hdr->c_name, file_hdr->c_mode);
-+ else
-+#endif
-+ res = mknod (file_hdr->c_name, file_hdr->c_mode,
- makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
- if (res < 0 && create_dir_flag)
- {
- create_all_directories (file_hdr->c_name);
-- res = mknod (file_hdr->c_name, file_hdr->c_mode,
-+#ifdef CP_IFIFO
-+ if ((file_hdr->c_mode & CP_IFMT) == CP_IFIFO)
-+ res = mkfifo (file_hdr->c_name, file_hdr->c_mode);
-+ else
-+#endif
-+ res = mknod (file_hdr->c_name, file_hdr->c_mode,
- makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
- }
- if (res < 0)
-@@ -1238,12 +1258,31 @@
- char mbuf[11];
- char tbuf[40];
- time_t when;
-+ char *ptbuf;
-+#ifdef HAVE_STRFTIME
-+ static int d_first = -1;
-+#endif
-
- mode_string (file_hdr->c_mode, mbuf);
- mbuf[10] = '\0';
-
- /* Get time values ready to print. */
- when = file_hdr->c_mtime;
-+#ifdef HAVE_STRFTIME
-+#ifdef __FreeBSD__
-+ if (d_first < 0)
-+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
-+#else
-+ d_first = 0;
-+#endif
-+ if (current_time - when > 6L * 30L * 24L * 60L * 60L
-+ || current_time - when < 0L)
-+ ptbuf = d_first ? "%e %b %Y" : "%b %e %Y";
-+ else
-+ ptbuf = d_first ? "%e %b %R" : "%b %e %R";
-+ strftime(tbuf, sizeof(tbuf), ptbuf, localtime(&when));
-+ ptbuf = tbuf;
-+#else
- strcpy (tbuf, ctime (&when));
- if (current_time - when > 6L * 30L * 24L * 60L * 60L
- || current_time - when < 0L)
-@@ -1253,8 +1292,10 @@
- strcpy (tbuf + 11, tbuf + 19);
- }
- tbuf[16] = '\0';
-+ ptbuf = tbuf + 4;
-+#endif
-
-- printf ("%s %3u ", mbuf, file_hdr->c_nlink);
-+ printf ("%s %3lu ", mbuf, file_hdr->c_nlink);
-
- #ifndef __MSDOS__
- if (numeric_uid)
-@@ -1268,13 +1309,13 @@
-
- if ((file_hdr->c_mode & CP_IFMT) == CP_IFCHR
- || (file_hdr->c_mode & CP_IFMT) == CP_IFBLK)
-- printf ("%3u, %3u ", file_hdr->c_rdev_maj,
-+ printf ("%3lu, %3lu ", file_hdr->c_rdev_maj,
- file_hdr->c_rdev_min);
- else
- #endif
- printf ("%8lu ", file_hdr->c_filesize);
-
-- printf ("%s ", tbuf + 4);
-+ printf ("%s ", ptbuf);
-
- print_name_with_quoting (file_hdr->c_name);
- if (link_name)
-@@ -1330,6 +1371,9 @@
- break;
-
- default:
-+#if ((defined(BSD) && BSD >= 199306) || defined(__GLIBC__))
-+ if (isprint(c))
-+#else
- if (c > 040 &&
- #ifdef __MSDOS__
- c < 0377 && c != 0177
-@@ -1337,6 +1381,7 @@
- c < 0177
- #endif
- )
-+#endif
- putchar (c);
- else
- printf ("\\%03o", (unsigned int) c);
-diff -Nur cpio-2.5.orig/copyout.c cpio-2.5/copyout.c
---- cpio-2.5.orig/copyout.c Sun Sep 1 00:43:11 2002
-+++ cpio-2.5/copyout.c Sun Sep 1 00:52:25 2002
-@@ -35,6 +35,7 @@
- static void writeout_other_defers ();
- static void writeout_final_defers();
- static void writeout_defered_file ();
-+static int check_rdev ();
-
- /* Write out header FILE_HDR, including the file name, to file
- descriptor OUT_DES. */
-@@ -296,8 +297,32 @@
- file_hdr.c_uid = file_stat.st_uid;
- file_hdr.c_gid = file_stat.st_gid;
- file_hdr.c_nlink = file_stat.st_nlink;
-- file_hdr.c_rdev_maj = major (file_stat.st_rdev);
-- file_hdr.c_rdev_min = minor (file_stat.st_rdev);
-+
-+ /* The rdev is meaningless except for block and character
-+ special files (POSIX standard) and perhaps fifos and
-+ sockets. Clear it for other types of files so that
-+ check_rdev() doesn't reject files just because stat()
-+ put garbage in st_rdev and so that the output doesn't
-+ depend on the garbage. */
-+ switch (file_hdr.c_mode & CP_IFMT)
-+ {
-+ case CP_IFBLK:
-+ case CP_IFCHR:
-+#ifdef CP_IFIFO
-+ case CP_IFIFO:
-+#endif
-+#ifdef CP_IFSOCK
-+ case CP_IFSOCK:
-+#endif
-+ file_hdr.c_rdev_maj = major (file_stat.st_rdev);
-+ file_hdr.c_rdev_min = minor (file_stat.st_rdev);
-+ break;
-+ default:
-+ file_hdr.c_rdev_maj = 0;
-+ file_hdr.c_rdev_min = 0;
-+ break;
-+ }
-+
- file_hdr.c_mtime = file_stat.st_mtime;
- file_hdr.c_filesize = file_stat.st_size;
- file_hdr.c_chksum = 0;
-@@ -341,6 +366,23 @@
- continue;
- }
-
-+ switch (check_rdev (&file_hdr))
-+ {
-+ case 1:
-+ error (0, 0, "%s not dumped: major number would be truncated",
-+ file_hdr.c_name);
-+ continue;
-+ case 2:
-+ error (0, 0, "%s not dumped: minor number would be truncated",
-+ file_hdr.c_name);
-+ continue;
-+ case 4:
-+ error (0, 0, "%s not dumped: device number would be truncated",
-+ file_hdr.c_name);
-+ continue;
-+ }
-+
-+
- /* Copy the named file to the output. */
- switch (file_hdr.c_mode & CP_IFMT)
- {
-@@ -825,3 +867,98 @@
- return;
- }
-
-+
-+static int
-+check_rdev (file_hdr)
-+ struct new_cpio_header *file_hdr;
-+{
-+ if (archive_format == arf_newascii || archive_format == arf_crcascii)
-+ {
-+ if ((file_hdr->c_rdev_maj & 0xFFFFFFFF) != file_hdr->c_rdev_maj)
-+ return 1;
-+ if ((file_hdr->c_rdev_min & 0xFFFFFFFF) != file_hdr->c_rdev_min)
-+ return 2;
-+ }
-+ else if (archive_format == arf_oldascii || archive_format == arf_hpoldascii)
-+ {
-+#ifndef __MSDOS__
-+ dev_t rdev;
-+
-+ rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
-+ if (archive_format == arf_oldascii)
-+ {
-+ if ((rdev & 0xFFFF) != rdev)
-+ return 4;
-+ }
-+ else
-+ {
-+ switch (file_hdr->c_mode & CP_IFMT)
-+ {
-+ case CP_IFCHR:
-+ case CP_IFBLK:
-+#ifdef CP_IFSOCK
-+ case CP_IFSOCK:
-+#endif
-+#ifdef CP_IFIFO
-+ case CP_IFIFO:
-+#endif
-+ /* We could handle one more bit if longs are >= 33 bits. */
-+ if ((rdev & 037777777777) != rdev)
-+ return 4;
-+ break;
-+ default:
-+ if ((rdev & 0xFFFF) != rdev)
-+ return 4;
-+ break;
-+ }
-+ }
-+#endif
-+ }
-+ else if (archive_format == arf_tar || archive_format == arf_ustar)
-+ {
-+ /* The major and minor formats are limited to 7 octal digits in ustar
-+ format, and to_oct () adds a gratuitous trailing blank to further
-+ limit the format to 6 octal digits. */
-+ if ((file_hdr->c_rdev_maj & 0777777) != file_hdr->c_rdev_maj)
-+ return 1;
-+ if ((file_hdr->c_rdev_min & 0777777) != file_hdr->c_rdev_min)
-+ return 2;
-+ }
-+ else
-+ {
-+#ifndef __MSDOS__
-+ dev_t rdev;
-+
-+ rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
-+ if (archive_format != arf_hpbinary)
-+ {
-+ if ((rdev & 0xFFFF) != rdev)
-+ return 4;
-+ }
-+ else
-+ {
-+ switch (file_hdr->c_mode & CP_IFMT)
-+ {
-+ case CP_IFCHR:
-+ case CP_IFBLK:
-+#ifdef CP_IFSOCK
-+ case CP_IFSOCK:
-+#endif
-+#ifdef CP_IFIFO
-+ case CP_IFIFO:
-+#endif
-+ if ((rdev & 0xFFFFFFFF) != rdev)
-+ return 4;
-+ file_hdr->c_filesize = rdev;
-+ rdev = makedev (0, 1);
-+ break;
-+ default:
-+ if ((rdev & 0xFFFF) != rdev)
-+ return 4;
-+ break;
-+ }
-+ }
-+#endif
-+ }
-+ return 0;
-+}
-diff -Nur cpio-2.5.orig/copypass.c cpio-2.5/copypass.c
---- cpio-2.5.orig/copypass.c Fri Dec 7 02:03:34 2001
-+++ cpio-2.5/copypass.c Sun Sep 1 00:53:14 2002
-@@ -317,13 +317,23 @@
-
- if (link_res < 0)
- {
-- res = mknod (output_name.ds_string, in_file_stat.st_mode,
-- in_file_stat.st_rdev);
-+#ifdef S_ISFIFO
-+ if (S_ISFIFO (in_file_stat.st_mode))
-+ res = mkfifo (output_name.ds_string, in_file_stat.st_mode);
-+ else
-+#endif
-+ res = mknod (output_name.ds_string, in_file_stat.st_mode,
-+ in_file_stat.st_rdev);
- if (res < 0 && create_dir_flag)
- {
- create_all_directories (output_name.ds_string);
-- res = mknod (output_name.ds_string, in_file_stat.st_mode,
-- in_file_stat.st_rdev);
-+#ifdef S_ISFIFO
-+ if (S_ISFIFO (in_file_stat.st_mode))
-+ res = mkfifo (output_name.ds_string, in_file_stat.st_mode);
-+ else
-+#endif
-+ res = mknod (output_name.ds_string, in_file_stat.st_mode,
-+ in_file_stat.st_rdev);
- }
- if (res < 0)
- {
-diff -Nur cpio-2.5.orig/main.c cpio-2.5/main.c
---- cpio-2.5.orig/main.c Sun Sep 1 00:43:11 2002
-+++ cpio-2.5/main.c Sun Sep 1 00:54:17 2002
-@@ -23,6 +23,12 @@
- #include <getopt.h>
- #include <sys/types.h>
- #include <sys/stat.h>
-+#ifdef HAVE_SYS_PARAM_H
-+#include <sys/param.h>
-+#endif
-+#if (defined(BSD) && (BSD >= 199306)) || defined(__GLIBC__)
-+#include <locale.h>
-+#endif
- #include "filetypes.h"
- #include "system.h"
- #include "cpiohdr.h"
-@@ -514,7 +520,10 @@
- char *argv[];
- {
- program_name = argv[0];
-- umask (0);
-+
-+#if (defined(BSD) && (BSD >= 199306)) || defined(__GLIBC__)
-+ (void) setlocale (LC_ALL, "");
-+#endif
-
- #ifdef __TURBOC__
- _fmode = O_BINARY; /* Put stdin and stdout in binary mode. */
-@@ -525,6 +534,7 @@
- #endif
-
- process_args (argc, argv);
-+ umask (0);
-
- initialize_buffers ();
-
-diff -Nur cpio-2.5.orig/util.c cpio-2.5/util.c
---- cpio-2.5.orig/util.c Fri Dec 7 02:08:30 2001
-+++ cpio-2.5/util.c Sun Sep 1 00:54:39 2002
-@@ -906,9 +906,9 @@
- fprintf (tty_out, "%s%d%s", new_media_message_with_number, reel_number,
- new_media_message_after_number);
- else if (archive_name)
-- fprintf (tty_out, "Found end of tape. Load next tape and press RETURN. ");
-+ fprintf (tty_out, "Found end of volume. Load next tape and press RETURN. ");
- else
-- fprintf (tty_out, "Found end of tape. To continue, type device/file name when ready.\n");
-+ fprintf (tty_out, "Found end of volume. To continue, type device/file name when ready.\n");
-
- fflush (tty_out);
-