Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/pr Don't be silly and try to read an strftime() form...



details:   https://anonhg.NetBSD.org/src/rev/5897deb3b186
branches:  trunk
changeset: 498396:5897deb3b186
user:      kleink <kleink%NetBSD.org@localhost>
date:      Sun Oct 22 15:06:52 2000 +0000

description:
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.

diffstat:

 usr.bin/pr/pr.1 |  15 ++++++++++++---
 usr.bin/pr/pr.c |  13 +++++++------
 2 files changed, 19 insertions(+), 9 deletions(-)

diffs (104 lines):

diff -r 0e77a4dce664 -r 5897deb3b186 usr.bin/pr/pr.1
--- a/usr.bin/pr/pr.1   Sun Oct 22 14:22:08 2000 +0000
+++ b/usr.bin/pr/pr.1   Sun Oct 22 15:06:52 2000 +0000
@@ -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 @@
 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 @@
 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
diff -r 0e77a4dce664 -r 5897deb3b186 usr.bin/pr/pr.c
--- a/usr.bin/pr/pr.c   Sun Oct 22 14:22:08 2000 +0000
+++ b/usr.bin/pr/pr.c   Sun Oct 22 15:06:52 2000 +0000
@@ -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 @@
 #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 @@
 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 @@
                }
        } 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 @@
                                return(1);
                        }
                        break;
+               case 'T':
+                       timefrmt = eoptarg;
+                       break;
                case 't':
                        ++nohead;
                        break;
@@ -1834,7 +1837,5 @@
                }
        }
 
-       if ((timefrmt = getenv("LC_TIME")) == NULL)
-               timefrmt = TIMEFMT;
        return(0);
 }



Home | Main Index | Thread Index | Old Index