johnl@esegue.segue.boston.ma.us (John R. Levine) (09/23/90)
I wanted a full-page calendar, but had lost the fine old Fortran program
that Geoff Peck wrote 20 years ago. So, in the finest Unix tradition,
I hacked up the following that uses cal, sed, tbl, and troff to produce
reasonably attractive calendars. It seemed like an excellent abuse of
Unix tools.
#!/bin/sh
# shar: Shell Archiver (v1.22)
#
# Run the following text with /bin/sh to create:
# mkcal
#
sed 's/^X//' << 'SHAR_EOF' > mkcal &&
X: make a large calendar
X
Xmonth()
X{
Xcat << \END
X.TS
Xallbox expand tab(:);
XcfHB s s s s s s
XcfHB cfHB cfHB cfHB cfHB cfHB cfHB
Xc c c c c c c.
XEND
Xcal $1 $2 | sed '1s/^ *//
X 3,$s/ / X /g
X 2,$s/^ *//
X 2,$s/ */:/g
X 2,$s/X//g
X 1a\
X=
X'
Xecho .TE
X}
X
Xcat << 'END'
X.ps 28
X.vs 32
X.ft H
X.de TS
X.sp 1in
X..
X.de TE
X.bp
X..
XEND
X
Xcase "$#" in
X 1) for m in 1 2 3 4 5 6 7 8 9 10 11 12
X do
X month $m $1
X done
X exit
X ;;
X 2) month $1 $2
X exit
X ;;
X *) echo "Syntax: $0 [month] year" >&2
X exit 1
X ;;
Xesac
SHAR_EOF
chmod 0775 mkcal || echo "restore of mkcal fails"
exit 0
--
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|spdcc|world}!esegue!johnl
Atlantic City gamblers lose $8200 per minute. -NY Times