bug in cal(1)

Craig Bevins craigb at ipso.OZ
Sun Mar 15 16:07:43 AEST 1987


In article <143 at quacky.mips.UUCP> dce at quacky.UUCP (David Elliott) writes:

>   Well folks, I guess it's time to add code to cal ...
>   	 ...
>   I guess we'd also need a -f option to say "I know what I'm doing, so don't
>   give me that line about what year you are giving me the calendar for".

Hear, hear.  Or you could use this script that I've had floating around
for yonks.  Can't remember where it came from ...


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by craigb at ipso.OZ on Sun Mar 15 16:03:18 AEST 1987
# Contents:  cal
 
echo x - cal.sh
sed 's/^@//' > "cal.sh" <<'@//E*O*F cal.sh//'

# cal: nicer interface to /usr/bin/cal

echo

case $# in
	0)	set `date`; m=$2; y=$6;;	# no args - use today
	1)	m=$1; set `date`; y=$6;;	# 1 arg - use this year
	*)	m=$1; y=$2;;			# 2 args - month and year
esac

case $m in
	ja*|Ja*)	m=1;;
	f*|F*)		m=2;;
	mar*|Mar*)	m=3;;
	ap*|Ap*)	m=4;;
	may*|May*)	m=5;;
	jun*|Jun*)	m=6;;
	jul*|Jul*)	m=7;;
	au*|Au*)	m=8;;
	s*|S*)		m=9;;
	o*|O*)		m=10;;
	n*|N*)		m=11;;
	d*|D*)		m=12;;
	[1-9]|10|11|12)	;;		# numeric month
	*)		y=$m; m="";;	# plain year
esac

/usr/bin/cal $m $y			# run the real one

@//E*O*F cal.sh//
chmod u=rwx,g=rx,o=rx cal.sh
 
exit 0
-- 

Craig Bevins.
IPS Radio and Space Services.  Sydney, Australia.

ACSnet: craigb at ipso			CSNET:	craigb at ipso.oz
ARPA:	craigb%ipso.oz at seismo.css.gov	JANET:  ipso.oz!craigb at ukc
UUCP:	{enea,hplabs,mcvax,prlb2,seismo,ubc-vision,ukc}!munnari!ipso.oz!craigb



More information about the Comp.bugs.4bsd.ucb-fixes mailing list