summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1997-03-30 00:23:39 +0000
committerobrien <obrien@FreeBSD.org>1997-03-30 00:23:39 +0000
commit6718192ec94a6ee754d020e7aa6dc908f2d62f28 (patch)
tree10b11510b433484d1b1b86de6cdd768c3e5217de
parent8d4a60ff51049ee35081778e0b0e3911e8c8f35b (diff)
downloadFreeBSD-src-6718192ec94a6ee754d020e7aa6dc908f2d62f28.zip
FreeBSD-src-6718192ec94a6ee754d020e7aa6dc908f2d62f28.tar.gz
Replace ctime by strftime %c to use national representation.
Use isprint() for Localization. Submitted by: ache via gnu/usr.bin/cpio v2.3
-rw-r--r--contrib/cpio/Makefile5
-rw-r--r--contrib/cpio/copyin.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/contrib/cpio/Makefile b/contrib/cpio/Makefile
index 68d3f4a..f9538e2 100644
--- a/contrib/cpio/Makefile
+++ b/contrib/cpio/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile-bison,v 1.3 1997/02/22 15:44:42 peter Exp $
+# $Id: Makefile,v 1.2 1997/03/30 00:10:07 obrien Exp $
.PATH: ${.CURDIR}/../../../contrib/cpio
@@ -7,7 +7,8 @@ MAN1= cpio.1
CFLAGS+= -I${.CURDIR} -DRETSIGTYPE=void -DHAVE_SYS_MTIO_H=1 -DSTDC_HEADERS=1 \
-DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 -DHAVE_UTIME_H=1 \
- -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDIRENT=1 -DHAVE_LCHOWN
+ -DHAVE_STRERROR=1 -DHAVE_VPRINTF=1 -DDIRENT=1 -DHAVE_LCHOWN \
+ -DHAVE_SYS_PARAM_H=1
SRCS = copyin.c copyout.c copypass.c defer.c dirname.c dstring.c error.c \
filemode.c getopt.c getopt1.c global.c idcache.c main.c makepath.c \
diff --git a/contrib/cpio/copyin.c b/contrib/cpio/copyin.c
index 1cc7e47..42c2bb3 100644
--- a/contrib/cpio/copyin.c
+++ b/contrib/cpio/copyin.c
@@ -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))
+#define HAVE_STRFTIME
+#include <ctype.h>
+#endif
#include "filetypes.h"
#include "system.h"
#include "cpiohdr.h"
@@ -1043,7 +1050,11 @@ long_format (file_hdr, link_name)
/* Get time values ready to print. */
when = file_hdr->c_mtime;
+#if HAVE_STRFTIME
+ strftime(tbuf, sizeof(tbuf), "%c", localtime(&when));
+#else
strcpy (tbuf, ctime (&when));
+#endif
if (current_time - when > 6L * 30L * 24L * 60L * 60L
|| current_time - when < 0L)
{
@@ -1129,6 +1140,9 @@ print_name_with_quoting (p)
break;
default:
+#if (defined(BSD) && (BSD >= 199306))
+ if (isprint(c))
+#else
if (c > 040 &&
#ifdef __MSDOS__
c < 0377 && c != 0177
@@ -1136,6 +1150,7 @@ print_name_with_quoting (p)
c < 0177
#endif
)
+#endif
putchar (c);
else
printf ("\\%03o", (unsigned int) c);
OpenPOWER on IntegriCloud