Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/cal Provide -C == -A + -B like fgrep, from Anon Ymous



details:   https://anonhg.NetBSD.org/src/rev/a0b9c65438af
branches:  trunk
changeset: 335470:a0b9c65438af
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 08 03:56:33 2015 +0000

description:
Provide -C == -A + -B like fgrep, from Anon Ymous

diffstat:

 usr.bin/cal/cal.1 |   9 +++++++--
 usr.bin/cal/cal.c |  15 ++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)

diffs (94 lines):

diff -r 45c8d3d12b7a -r a0b9c65438af usr.bin/cal/cal.1
--- a/usr.bin/cal/cal.1 Thu Jan 08 03:50:56 2015 +0000
+++ b/usr.bin/cal/cal.1 Thu Jan 08 03:56:33 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: cal.1,v 1.20 2007/12/24 13:56:00 wiz Exp $
+.\"    $NetBSD: cal.1,v 1.21 2015/01/08 03:56:33 christos Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"     @(#)cal.1      8.2 (Berkeley) 4/28/95
 .\"
-.Dd December 21, 2007
+.Dd January 7, 2015
 .Dt CAL 1
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@
 .Op Fl 3hjry
 .Op Fl A Ar after
 .Op Fl B Ar before
+.Op Fl C Ar context
 .Op Fl d Ar day-of-week
 .Op Fl R Ar reform-spec
 .Op Oo Ar month Oc Ar year
@@ -64,6 +65,10 @@
 Display
 .Ar before
 months before the specified month.
+.It Fl C Ar context
+Display
+.Ar context
+months before and after the specified month.
 .It Fl d Ar day-of-week
 Specifies the day of the week on which the calendar should start.
 Valid values are 0 through 6, presenting Sunday through Saturday,
diff -r 45c8d3d12b7a -r a0b9c65438af usr.bin/cal/cal.c
--- a/usr.bin/cal/cal.c Thu Jan 08 03:50:56 2015 +0000
+++ b/usr.bin/cal/cal.c Thu Jan 08 03:56:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cal.c,v 1.27 2011/08/29 13:55:22 joerg Exp $   */
+/*     $NetBSD: cal.c,v 1.28 2015/01/08 03:56:33 christos Exp $        */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)cal.c      8.4 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: cal.c,v 1.27 2011/08/29 13:55:22 joerg Exp $");
+__RCSID("$NetBSD: cal.c,v 1.28 2015/01/08 03:56:33 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -227,7 +227,7 @@
        before = after = 0;
        use_reform = yflag = year = 0;
        when = NULL;
-       while ((ch = getopt(argc, argv, "A:B:d:hjR:ry3")) != -1) {
+       while ((ch = getopt(argc, argv, "A:B:C:d:hjR:ry3")) != -1) {
                switch (ch) {
                case 'A':
                        after = getnum(optarg);
@@ -239,6 +239,11 @@
                        if (before < 0)
                                errx(1, "Argument to -B must be positive");
                        break;
+               case 'C':
+                       after = before = getnum(optarg);
+                       if (after < 0)
+                               errx(1, "Argument to -C must be positive");
+                       break;
                case 'd':
                        dow = getnum(optarg);
                        if (dow < 0 || dow > 6)
@@ -764,7 +769,7 @@
                errx(1, "reform name %s invalid", p);
 
        /*
-        * 
+        *
         */
        reform->missing_days =
                j_leap_days(reform->year, reform->month, reform->date) -
@@ -913,7 +918,7 @@
 {
 
        (void)fprintf(stderr,
-           "usage: cal [-3hjry] [-A after] [-B before] [-d day-of-week] "
+           "usage: cal [-3hjry] [-A after] [-B before] [-C context] [-d day-of-week] "
            "[-R reform-spec]\n           [[month] year]\n");
        exit(1);
 }



Home | Main Index | Thread Index | Old Index