Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!smann From: smann@june.cs.washington.edu (Stephen Mann) Newsgroups: comp.lang.postscript Subject: Pscal Keywords: holidays Message-ID: <8193@june.cs.washington.edu> Date: 12 May 89 03:02:10 GMT Distribution: na Organization: U of Washington, Computer Science, Seattle Lines: 371 Here's a version of Pscal that has holidays hacked in. The program is a Unix C-shell script that sends PostScript directly to a printer. Documentation appears in the header comments of the script. Steve -------- #!/bin/csh -f #+ # # NAME: # pscal # # SYNOPSIS: # pscal [-Pprinter] [other printer flags] month year # # DESCRIPTION: # `Pscal' is a PostScript program to print calendars. # # The file $home/.holiday is read and used to print short messages # on specified days. The .holiday file should consist of lines of # the form # month:day:message string # Messages should be 20 characters or less, with no more than 4 # messages per day. No spaces should appear from the beginning # of a line until after the second colon. # Month and day should be numbers in the obvious ranges. # # OPTIONS: # Any argument whose first character is '-' is passed on to lpr. # # AUTHOR: # Patrick Wood # Copyright (C) 1987 by Pipeline Associates, Inc. # Permission is granted to modify and distribute this free of charge. # # HISTORY: # @Original From: patwood@unirot.UUCP (Patrick Wood) # @Shell stuff added 3/9/87 by King Ables # @Made pretty by tjt 1988 # @Holiday and printer flag passing hacks added Dec 1988 # @ by smann@june.cs.washington.edu # # BUGS: # `Pscal' doesn't work for months before 1753 (weird stuff happened # in September, 1752). # # A better format for the dates of holidays would be nice. # An escape to allow holiday messages to be raw PostScript would # also be nice. # The holiday messages should be handled more intelligently (ie, # the messages should be clipped to the day). # set printer="-Pps" # set default printer set flags top: if ($#argv > 0) then switch ("$argv[1]") case -P*: set printer="$argv[1]" shift argv goto top case -*: set flags = ($flags $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] [-flag1 -flag2 ...] month year" exit 1 endif if ( -e $home/.holiday ) then set noglob set holidays = \ ( \[ `grep ^$month\: $home/.holiday | awk -F: '{print $2,"(",$3,")" }'` ] ) else set noglob set holidays = (\[ ] ) endif lpr $printer $flags <