From 5ff251c82de8165191ae852c7e3ca551c345c924 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 30 Nov 1999 09:41:01 +0000 Subject: Localize it --- usr.bin/pr/pr.1 | 4 +++- usr.bin/pr/pr.c | 32 +++++++++++++++++++++----------- usr.bin/pr/pr.h | 3 ++- 3 files changed, 26 insertions(+), 13 deletions(-) (limited to 'usr.bin/pr') diff --git a/usr.bin/pr/pr.1 b/usr.bin/pr/pr.1 index d6afef3..bbe41f5 100644 --- a/usr.bin/pr/pr.1 +++ b/usr.bin/pr/pr.1 @@ -50,7 +50,7 @@ .Bk -words .Op Fl Ar column .Ek -.Op Fl adFmrt +.Op Fl adFLmrt .Bk -words .Oo .Op Fl e @@ -218,6 +218,8 @@ If any nondigit character, is specified, it is used as the output .Em character. +.It Fl L +Do not use time locale for header. .It Fl l Ar lines Override the 66 line default and reset the page length to .Ar lines . diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c index c4fac42..aaaf389 100644 --- a/usr.bin/pr/pr.c +++ b/usr.bin/pr/pr.c @@ -33,6 +33,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #ifndef lint @@ -51,6 +53,7 @@ static char sccsid[] = "@(#)pr.c 8.2 (Berkeley) 4/16/94"; #include #include +#include #include #include #include @@ -1557,7 +1560,7 @@ void usage() { (void)fputs( - "usage: pr [+page] [-col] [-adFmrt] [-e[ch][gap]] [-h header]\n",err); + "usage: pr [+page] [-col] [-adFLmrt] [-e[ch][gap]] [-h header]\n",err); (void)fputs( " [-i[ch][gap]] [-l line] [-n[ch][width]] [-o offset]\n",err); (void)fputs( @@ -1578,6 +1581,7 @@ setup(argc, argv) int iflag = 0; int wflag = 0; int cflag = 0; + int Lflag = 0; if (isatty(fileno(stdout))) { /* @@ -1589,7 +1593,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?Ll:n?o:s?w:")) != -1) { switch (c) { case '+': if ((pgnm = atoi(eoptarg)) < 1) { @@ -1614,11 +1618,11 @@ setup(argc, argv) break; case 'e': ++eflag; - if ((eoptarg != NULL) && !isdigit(*eoptarg)) + if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg)) inchar = *eoptarg++; else inchar = INCHAR; - if ((eoptarg != NULL) && isdigit(*eoptarg)) { + if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) { if ((ingap = atoi(eoptarg)) < 0) { (void)fputs( "pr: -e gap must be 0 or more\n", err); @@ -1641,11 +1645,11 @@ setup(argc, argv) break; case 'i': ++iflag; - if ((eoptarg != NULL) && !isdigit(*eoptarg)) + if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg)) ochar = *eoptarg++; else ochar = OCHAR; - if ((eoptarg != NULL) && isdigit(*eoptarg)) { + if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) { if ((ogap = atoi(eoptarg)) < 0) { (void)fputs( "pr: -i gap must be 0 or more\n", err); @@ -1660,8 +1664,11 @@ setup(argc, argv) } else ogap = OGAP; break; + case 'L': + Lflag++; + break; case 'l': - if (!isdigit(*eoptarg) || ((lines=atoi(eoptarg)) < 1)) { + if (!isdigit((unsigned char)*eoptarg) || ((lines=atoi(eoptarg)) < 1)) { (void)fputs( "pr: Number of lines must be 1 or more\n",err); return(1); @@ -1671,11 +1678,11 @@ setup(argc, argv) ++merge; break; case 'n': - if ((eoptarg != NULL) && !isdigit(*eoptarg)) + if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg)) nmchar = *eoptarg++; else nmchar = NMCHAR; - if ((eoptarg != NULL) && isdigit(*eoptarg)) { + if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) { if ((nmwd = atoi(eoptarg)) < 1) { (void)fputs( "pr: -n width must be 1 or more\n",err); @@ -1689,7 +1696,7 @@ setup(argc, argv) nmwd = NMWD; break; case 'o': - if (!isdigit(*eoptarg) || ((offst = atoi(eoptarg))< 1)){ + if (!isdigit((unsigned char)*eoptarg) || ((offst = atoi(eoptarg))< 1)){ (void)fputs("pr: -o offset must be 1 or more\n", err); return(1); @@ -1715,7 +1722,7 @@ setup(argc, argv) break; case 'w': ++wflag; - if (!isdigit(*eoptarg) || ((pgwd = atoi(eoptarg)) < 1)){ + if (!isdigit((unsigned char)*eoptarg) || ((pgwd = atoi(eoptarg)) < 1)){ (void)fputs( "pr: -w width must be 1 or more \n",err); return(1); @@ -1810,5 +1817,8 @@ setup(argc, argv) } timefrmt = TIMEFMT; + if (!Lflag) + (void) setlocale(LC_TIME, ""); + return(0); } diff --git a/usr.bin/pr/pr.h b/usr.bin/pr/pr.h index d020e9f..05f691c 100644 --- a/usr.bin/pr/pr.h +++ b/usr.bin/pr/pr.h @@ -35,6 +35,7 @@ * SUCH DAMAGE. * * @(#)pr.h 8.1 (Berkeley) 6/6/93 + * $FreeBSD$ */ /* @@ -58,7 +59,7 @@ #define HDFMT "%s %s Page %d\n\n\n" #define HEADLEN 5 #define TAILLEN 5 -#define TIMEFMT "%b %e %H:%M %Y" +#define TIMEFMT "%Ex %H:%M %Y" #define FNAME "" #define LBUF 8192 #define HDBUF 512 -- cgit v1.1