Replace ctime by strftime %c to use national representation.

Use isprint() for Localization.

Submitted by:	ache via gnu/usr.bin/cpio v2.3
This commit is contained in:
David E. O'Brien 1997-03-30 00:23:39 +00:00
parent 28d8514012
commit db6f14a034
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24405
2 changed files with 18 additions and 2 deletions

View file

@ -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 \

View file

@ -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);