Don't be silly and try to read an strftime() format string from the LC_TIME

environment variable; since there isn't a standard format provided by the
C library that corresponds to pr's default header format, add a new option
'-T' to take a strftime() format string if desired.
This commit is contained in:
kleink 2000-10-22 15:06:52 +00:00
parent ccbcb60028
commit 9ff4b1c139
2 changed files with 19 additions and 9 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pr.1,v 1.9 1999/11/19 22:29:26 kristerw Exp $
.\" $NetBSD: pr.1,v 1.10 2000/10/22 15:06:52 kleink Exp $
.\"
.\" Copyright (c) 1991 Keith Muller.
.\" Copyright (c) 1993
@ -36,7 +36,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)pr.1 8.1 (Berkeley) 6/6/93
.\" $NetBSD: pr.1,v 1.9 1999/11/19 22:29:26 kristerw Exp $
.\" $NetBSD: pr.1,v 1.10 2000/10/22 15:06:52 kleink Exp $
.\"
.Dd June 6, 1993
.Dt PR 1
@ -83,6 +83,9 @@
.Oc
.Ek
.Bk -words
.Op Fl T Ar timefmt
.Ek
.Bk -words
.Oo
.Op Fl n
.Op Ar char
@ -277,6 +280,11 @@ instead of by the appropriate number of
is the
.Em <tab>
character).
.It Fl T
Specify an
.Xr strftime 3
format string to be used to format the date and time information in the page
header.
.It Fl t
Print neither the five-line identifying
header nor the five-line trailer usually supplied for each page.
@ -340,7 +348,8 @@ process (if output is redirected) or after all successful
file printing is complete (when printing to a terminal).
.Sh SEE ALSO
.Xr cat 1 ,
.Xr more 1
.Xr more 1 ,
.Xr strftime 3
.Sh STANDARDS
The
.Nm

View File

@ -1,4 +1,4 @@
/* $NetBSD: pr.c,v 1.8 2000/07/13 02:07:53 simonb Exp $ */
/* $NetBSD: pr.c,v 1.9 2000/10/22 15:06:52 kleink Exp $ */
/*-
* Copyright (c) 1991 Keith Muller.
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
#if 0
from: static char sccsid[] = "@(#)pr.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: pr.c,v 1.8 2000/07/13 02:07:53 simonb Exp $");
__RCSID("$NetBSD: pr.c,v 1.9 2000/10/22 15:06:52 kleink Exp $");
#endif
#endif /* not lint */
@ -101,7 +101,7 @@ char schar; /* text column separation character */
int sflag; /* -s option for multiple columns */
int nohead; /* do not write head and trailer */
int pgwd; /* page width with multiple col output */
char *timefrmt; /* time conversion string */
char *timefrmt = TIMEFMT; /* time conversion string */
/*
* misc globals
@ -1605,7 +1605,7 @@ setup(argc, argv)
}
} else
err = stderr;
while ((c = egetopt(argc, argv, "#adFmrte?h:i?l:n?o:s?w:")) != -1) {
while ((c = egetopt(argc, argv, "#adFmrte?h:i?l:n?o:s?T:w:")) != -1) {
switch (c) {
case '+':
if ((pgnm = atoi(eoptarg)) < 1) {
@ -1734,6 +1734,9 @@ setup(argc, argv)
return(1);
}
break;
case 'T':
timefrmt = eoptarg;
break;
case 't':
++nohead;
break;
@ -1834,7 +1837,5 @@ setup(argc, argv)
}
}
if ((timefrmt = getenv("LC_TIME")) == NULL)
timefrmt = TIMEFMT;
return(0);
}