Article View: net.sources.bugs
Article #958Re: PostScript Calendar
From: ables
Date: Mon, 09 Mar 1987 17:26
Date: Mon, 09 Mar 1987 17:26
86 lines
2653 bytes
2653 bytes
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..."
Technical Details
Message-ID:
<2743@mcc-pp.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!im4u!milano!mcc-pp!ablesReferences:
<388@unirot.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!im4u!milano!mcc-pp!ables From: ables@mcc-pp.UUCP Newsgroups: net.sources.bugs Subject: Re: PostScript Calendar Message-ID: <2743@mcc-pp.UUCP> Date: Mon, 9-Mar-87 12:26:55 EST Article-I.D.: mcc-pp.2743 Posted: Mon Mar 9 12:26:55 1987 Date-Received: Tue, 10-Mar-87 05:49:24 EST References: <388@unirot.UUCP> Organization: MCC, Austin, TX Lines: 86 Keywords: PostScript Summary: shell script