[net.sources.bugs] PostScript Calendar

ables@mcc-pp.UUCP (03/09/87)

I took the postscript text posted, and added the following
cshell script text to the top of a file containing the postscript
stuff:

#!/bin/csh -f
#
# From: patwood@unirot.UUCP (Patrick Wood)
# Newsgroups: net.sources
# Subject: PostScript Calendar
# Date: 7 Mar 87 18:43:51 GMT
# Organization: Public Access Unix, Piscataway, NJ
# 
# The following is a PostScript program to print calendars.  It doesn't
# work on or before 1752.
# 
# Shell stuff added 3/9/87 by King Ables
#
set printer=""

top:
if ($#argv > 0) then
	switch ("$argv[1]")
		case -*:
			set printer="$argv[1]"
			shift argv
			goto top
		case *:
			if ($?month) then
				set year="$argv[1]"
			else if ($?year) then
				echo "usage: $0 [-Pprinter] month year"
				exit 1
			else
				set month="$argv[1]"
			endif
			shift argv
			goto top
	endsw
endif

if ($?year) then
else 
	echo "usage: $0 [-Pprinter] month year"
	exit 1
endif

lpr $printer <<END-OF-CALENDAR
%!
% PostScript program to draw calendar
% Copyright (C) 1987 by Pipeline Associates, Inc.
% Permission is granted to modify and distribute this free of charge.

% /month should be set to a number from 1 to 12
% /year should be set to the year you want
% you can change the title and date fonts, if you want
% we figure out the rest
% won't produce valid calendars before 1800 (weird stuff happened
% in September of 1752)

/month $month def
/year $year def
/titlefont /Times-Bold def
/dayfont /Helvetica-Bold def
	.
	.
	.
END-OF-CALENDAR


----------
Note also that I have one extra line at the end of the postscript
text and I've substituted shell variables in the text for the month
and year.

This makes this program work like cal(1) except that you can pass
it a printer name if you like.

Now the only problem is I run this program to get 6/1960 and
I run cal(1) on the same month and I get two different answers!

-king
ARPA: ables@mcc.com
UUCP: {gatech,ihnp4,nbires,seismo,ucb-vax}!ut-sally!im4u!milano!mcc-pp!ables
----
"I study Nuclear Science, I love my glasses, I got a crazy teacher, he
wears dark glasses..."