From db6f14a03459c15591c4d86e4508618ab6a3c41e Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Sun, 30 Mar 1997 00:23:39 +0000 Subject: [PATCH] Replace ctime by strftime %c to use national representation. Use isprint() for Localization. Submitted by: ache via gnu/usr.bin/cpio v2.3 --- contrib/cpio/Makefile | 5 +++-- contrib/cpio/copyin.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/contrib/cpio/Makefile b/contrib/cpio/Makefile index 68d3f4a1ff32..f9538e20af9c 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 1cc7e4791242..42c2bb3336e6 100644 --- a/contrib/cpio/copyin.c +++ b/contrib/cpio/copyin.c @@ -18,6 +18,13 @@ #include #include #include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#if (defined(BSD) && (BSD >= 199306)) +#define HAVE_STRFTIME +#include +#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);