svn commit: r204479 - user/edwin/ncal

M. Warner Losh imp at bsdimp.com
Tue Mar 2 05:32:44 UTC 2010


In message: <20100228205005.GA4003 at freebsd.org>
            Roman Divacky <rdivacky at FreeBSD.org> writes:
: On Sun, Feb 28, 2010 at 08:36:25PM +0000, Edwin Groothuis wrote:
: > Author: edwin
: > Date: Sun Feb 28 20:36:24 2010
: > New Revision: 204479
: > URL: http://svn.freebsd.org/changeset/base/204479
: > 
: > Log:
: >   Do some work on ncal while we're at it.
: 
: I have a patch that implementes "cal -3" are you interested in it?

I can finally get of my script then :)

Warner

#!/bin/sh
########
# cal3 - 3-month calendar printer
########

case $# in
0|1)    eval `date "+M=${1:-%m} Y=${2:-%Y}"`;;
2)      M=$1 Y=$2;;
*)      echo "Usage: $0 [month [year]]" >&2; exit 2;;
esac

bc <<! | xargs -n2 cal | pr -3 -t -l8
m=$M; y=$Y
if (m>1) {m-1; y}; if (m==1) {12; y-1}     /* prev month */
m; y                                       /* this month */
if (m<12) {m+1; y}; if (m==12) {1; y+1}    /* next month */
!
exit 0


More information about the svn-src-user mailing list