Date: Sun, 21 Mar 2010 21:33:21 +0000 (UTC) From: Edwin Groothuis <edwin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r205427 - in head: tools/regression/usr.bin/ncal usr.bin/ncal Message-ID: <201003212133.o2LLXLbd021840@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: edwin Date: Sun Mar 21 21:33:21 2010 New Revision: 205427 URL: http://svn.freebsd.org/changeset/base/205427 Log: Replace -b with -C and -B (as proposed by Alexander). Add -3, -A and -B to the usage. Update regression test for the new parameters. Modified: head/tools/regression/usr.bin/ncal/regress.sh head/usr.bin/ncal/ncal.1 head/usr.bin/ncal/ncal.c Modified: head/tools/regression/usr.bin/ncal/regress.sh ============================================================================== --- head/tools/regression/usr.bin/ncal/regress.sh Sun Mar 21 21:25:35 2010 (r205426) +++ head/tools/regression/usr.bin/ncal/regress.sh Sun Mar 21 21:33:21 2010 (r205427) @@ -1,7 +1,8 @@ # $FreeBSD$ CAL_BIN="ncal" -CAL="${CAL_BIN}" +CAL="${CAL_BIN} -C" +NCAL="${CAL_BIN} -N" YEARS="2008 2009 2010 2011" ONEYEAR="2009" @@ -18,13 +19,13 @@ echo 1..16 for y in ${YEARS}; do # Regular calendar, Month days, No-highlight - REGRESSION_TEST(`r-y${y}-md-nhl', `$CAL -h ${y}') + REGRESSION_TEST(`r-y${y}-md-nhl', `$NCAL -h ${y}') # Backwards calendar, Month days, No-highlight - REGRESSION_TEST(`b-y${y}-md-nhl', `$CAL -bh ${y}') + REGRESSION_TEST(`b-y${y}-md-nhl', `$CAL -h ${y}') # Regular calendar, Julian days, No-highlight - REGRESSION_TEST(`r-y${y}-jd-nhl', `$CAL -jh ${y}') + REGRESSION_TEST(`r-y${y}-jd-nhl', `$NCAL -jh ${y}') # Backwards calendar, Julian days, No-highlight - REGRESSION_TEST(`b-y${y}-jd-nhl', `$CAL -jbh ${y}') + REGRESSION_TEST(`b-y${y}-jd-nhl', `$CAL -jh ${y}') done # 3 month calendars @@ -33,13 +34,15 @@ echo 17 .. 29 for m in $(jot -w %02d 12); do # Regular calendar, Month days, No-highlight - REGRESSION_TEST(`r-3m${ONEYEAR}${m}-md-nhl', `$CAL -h3 ${m} ${ONEYEAR}') + REGRESSION_TEST(`r-3m${ONEYEAR}${m}-md-nhl', + `$NCAL -h3 ${m} ${ONEYEAR}') # Backwards calendar, Month days, No-highlight - REGRESSION_TEST(`b-3m${ONEYEAR}${m}-md-nhl', `$CAL -bh3 ${m} ${ONEYEAR}') + REGRESSION_TEST(`b-3m${ONEYEAR}${m}-md-nhl', `$CAL -h3 ${m} ${ONEYEAR}') # Regular calendar, Julian days, No-highlight - REGRESSION_TEST(`r-3m${ONEYEAR}${m}-jd-nhl', `$CAL -jh3 ${m} ${ONEYEAR}') + REGRESSION_TEST(`r-3m${ONEYEAR}${m}-jd-nhl', + `$NCAL -jh3 ${m} ${ONEYEAR}') # Backwards calendar, Julian days, No-highlight - REGRESSION_TEST(`b-3m${ONEYEAR}${m}-jd-nhl', `$CAL -jbh3 ${m} ${ONEYEAR}') + REGRESSION_TEST(`b-3m${ONEYEAR}${m}-jd-nhl', `$CAL -jh3 ${m} ${ONEYEAR}') done # @@ -47,33 +50,33 @@ done # # These should fail -REGRESSION_TEST(`f-3y-nhl', `$CAL -3 -y 2>&1') -REGRESSION_TEST(`f-3A-nhl', `$CAL -3 -A 3 2>&1') -REGRESSION_TEST(`f-3B-nhl', `$CAL -3 -B 3 2>&1') -REGRESSION_TEST(`f-3gy-nhl', `$CAL -3 2008 2>&1') -REGRESSION_TEST(`f-3AB-nhl', `$CAL -3 -A 3 -B 3 2>&1') -REGRESSION_TEST(`f-mgm-nhl', `$CAL -m 3 2 2008 2>&1') -REGRESSION_TEST(`f-ym-nhl', `$CAL -y -m 2 2>&1') -REGRESSION_TEST(`f-ygm-nhl', `$CAL -y 2 2008 2>&1') -REGRESSION_TEST(`f-yA-nhl', `$CAL -y -A 3 2>&1') -REGRESSION_TEST(`f-yB-nhl', `$CAL -y -B 3 2>&1') -REGRESSION_TEST(`f-yAB-nhl', `$CAL -y -A 3 -B 3 2>&1') +REGRESSION_TEST(`f-3y-nhl', `$NCAL -3 -y 2>&1') +REGRESSION_TEST(`f-3A-nhl', `$NCAL -3 -A 3 2>&1') +REGRESSION_TEST(`f-3B-nhl', `$NCAL -3 -B 3 2>&1') +REGRESSION_TEST(`f-3gy-nhl', `$NCAL -3 2008 2>&1') +REGRESSION_TEST(`f-3AB-nhl', `$NCAL -3 -A 3 -B 3 2>&1') +REGRESSION_TEST(`f-mgm-nhl', `$NCAL -m 3 2 2008 2>&1') +REGRESSION_TEST(`f-ym-nhl', `$NCAL -y -m 2 2>&1') +REGRESSION_TEST(`f-ygm-nhl', `$NCAL -y 2 2008 2>&1') +REGRESSION_TEST(`f-yA-nhl', `$NCAL -y -A 3 2>&1') +REGRESSION_TEST(`f-yB-nhl', `$NCAL -y -B 3 2>&1') +REGRESSION_TEST(`f-yAB-nhl', `$NCAL -y -A 3 -B 3 2>&1') # These should be successful -REGRESSION_TEST(`s-b-3-nhl', `$CAL -b -d 2008.03 -3') -REGRESSION_TEST(`s-b-A-nhl', `$CAL -b -d 2008.03 -A 1') -REGRESSION_TEST(`s-b-B-nhl', `$CAL -b -d 2008.03 -B 1') -REGRESSION_TEST(`s-b-AB-nhl', `$CAL -b -d 2008.03 -A 1 -B 1') -REGRESSION_TEST(`s-b-m-nhl', `$CAL -b -d 2008.03 -m 1') -REGRESSION_TEST(`s-b-mgy-nhl', `$CAL -b -d 2008.03 -m 1 2007') -REGRESSION_TEST(`s-b-gmgy-nhl', `$CAL -b -d 2008.03 1 2007') -REGRESSION_TEST(`s-r-3-nhl', `$CAL -d 2008.03 -3') -REGRESSION_TEST(`s-r-A-nhl', `$CAL -d 2008.03 -A 1') -REGRESSION_TEST(`s-r-B-nhl', `$CAL -d 2008.03 -B 1') -REGRESSION_TEST(`s-r-AB-nhl', `$CAL -d 2008.03 -A 1 -B 1') -REGRESSION_TEST(`s-r-m-nhl', `$CAL -d 2008.03 -m 1') -REGRESSION_TEST(`s-r-mgy-nhl', `$CAL -d 2008.03 -m 1 2007') -REGRESSION_TEST(`s-r-gmgy-nhl', `$CAL -d 2008.03 1 2007') +REGRESSION_TEST(`s-b-3-nhl', `$CAL -d 2008.03 -3') +REGRESSION_TEST(`s-b-A-nhl', `$CAL -d 2008.03 -A 1') +REGRESSION_TEST(`s-b-B-nhl', `$CAL -d 2008.03 -B 1') +REGRESSION_TEST(`s-b-AB-nhl', `$CAL -d 2008.03 -A 1 -B 1') +REGRESSION_TEST(`s-b-m-nhl', `$CAL -d 2008.03 -m 1') +REGRESSION_TEST(`s-b-mgy-nhl', `$CAL -d 2008.03 -m 1 2007') +REGRESSION_TEST(`s-b-gmgy-nhl', `$CAL -d 2008.03 1 2007') +REGRESSION_TEST(`s-r-3-nhl', `$NCAL -d 2008.03 -3') +REGRESSION_TEST(`s-r-A-nhl', `$NCAL -d 2008.03 -A 1') +REGRESSION_TEST(`s-r-B-nhl', `$NCAL -d 2008.03 -B 1') +REGRESSION_TEST(`s-r-AB-nhl', `$NCAL -d 2008.03 -A 1 -B 1') +REGRESSION_TEST(`s-r-m-nhl', `$NCAL -d 2008.03 -m 1') +REGRESSION_TEST(`s-r-mgy-nhl', `$NCAL -d 2008.03 -m 1 2007') +REGRESSION_TEST(`s-r-gmgy-nhl', `$NCAL -d 2008.03 1 2007') REGRESSION_END() Modified: head/usr.bin/ncal/ncal.1 ============================================================================== --- head/usr.bin/ncal/ncal.1 Sun Mar 21 21:25:35 2010 (r205426) +++ head/usr.bin/ncal/ncal.1 Sun Mar 21 21:33:21 2010 (r205427) @@ -60,6 +60,10 @@ .Op Fl A Ar number .Op Fl B Ar number .Op Ar year +.Nm ncal +.Op Fl CN +.Op Fl H Ar yyyy-mm-dd +.Op Fl d Ar yyyy-mm .Sh DESCRIPTION The .Nm @@ -127,8 +131,14 @@ of months after the current month. Display the .Ar number of months before the current month. -.It Fl b -Switch to backwards compatibility mode (for debugging). +.It Fl C +Switch to +.Nm cal +mode. +.It Fl N +Switch to +.Nm ncal +mode. .It Fl d Ar yyyy-mm Use .Ar yyyy-mm Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Sun Mar 21 21:25:35 2010 (r205426) +++ head/usr.bin/ncal/ncal.c Sun Mar 21 21:33:21 2010 (r205427) @@ -256,7 +256,7 @@ main(int argc, char *argv[]) before = after = -1; - while ((ch = getopt(argc, argv, "A:B:3Jbd:eH:hjm:ops:wy")) != -1) + while ((ch = getopt(argc, argv, "3A:B:Cd:eH:hjJm:Nops:wy")) != -1) switch (ch) { case '3': flag_3months = 1; @@ -283,9 +283,12 @@ main(int argc, char *argv[]) nswitch = ndaysj(&never); flag_julian_cal = 1; break; - case 'b': + case 'C': flag_backward = 1; break; + case 'N': + flag_backward = 0; + break; case 'd': flag_today = optarg; break; @@ -500,11 +503,12 @@ usage(void) { fputs( - "usage: cal [-hjy] [[month] year]\n" - " cal [-hj] [-m month] [year]\n" - " ncal [-hJjpwy] [-s country_code] [[month] year]\n" - " ncal [-hJeo] [year]\n" - "for debug the highlighting: [-b] [-H yyyy-mm-dd] [-d yyyy-mm]\n", +"Usage: cal [general options] [-hjy] [[month] year]\n" +" cal [general options] [-hj] [-m month] [year]\n" +" ncal [general options] [-hJjpwy] [-s country_code] [[month] year]\n" +" ncal [general options] [-hJeo] [year]\n" +"General options: [-NC3] [-A months] [-B months]\n" +"For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]\n", stderr); exit(EX_USAGE); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003212133.o2LLXLbd021840>