#!/bin/csh -f #+ # # NAME: # pscal # # SYNOPSIS: # pscal [[month] year] # # DESCRIPTION: # `Pscal' is a PostScript program to generate calendars. # There are multiple ways of invoking the program. # If no arguments are given, then the calendar for the # current month/year is generated. # If one argument is given, then it is assumed to be a year, # and the calendar for the entire year is printed. # If two arguments are given, then the first is taken to # be the month, and the second the year. # # The month may be in one of two formats: first, it can be # a number from 0 to 12. The numbers correspond to the # obvious month; '0' is special, and will indicates that # the calendar for the entire year should be generated. # The second format for the month is as a string of three # characters. The format is the same one that the Unix 'date' # program uses: first three letters of the month, first # letter capitalized. # # 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. The message string # should not contain '\', ':', or ')'. # Messages will be clipped so that they don't overflow their # day box. # # The month can either be a number from 1 to 12, or it can be the # name of the month, with the first letter capitalized. Note # that only the first three characters of the month's name are # looked at. The day should be a number in the obvious range. # # Note that Easter Sunday is automatically placed on the calendar. # If you do not want it to appear, set the variable 'Easter' # in the beginning of the program to 0. # # The day of the year is printed in the top center of each day. # If you do not wish for that to appear, set the variable # 'doy' to 0 (zero). # # Also, you may have a ~/.holiday.moon. file. # This is a real ugly hack to put pictures of the full # and new moon on the calendar. Form of the lines # should be # month day full # (or new, if it is a new moon). If there are two full (new) # moons in a month, an entry should be made for each. # Here, the month and day must both be numbers. # Like I said, a real ugly hack. # # If invoked with the single argument '-man', pscal will # print this man page. # # NOTES: # This version differs from previous versions! The calendar # is printed on standard output. It is up to the user # to redirect the output to a printer. # # # 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@cs.washington.edu # @Command line processing changed; character string months # @ added; printing of entire year added; phase of moon # @ hacked in; corrections to isleap and startday (noted # @ elsewhere) made; added -man switch; # @ fixed memory leaks in drawgrid and drawfill; # @ added clipping of holidays to day box; # @ automatic calculation of Easter; # @ by smann@cs.washington.edu Jan 1990 # @Day of Year added Nov 1990, by smann@cs.washington.edu # # BUGS: # `Pscal' doesn't work for months before 1753 (weird stuff happened # in September, 1752). # # An escape to allow holiday messages to be raw PostScript would # also be nice. # # END-OF-MAN set dmon = (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) set flags set date = (`date`) set Easter = 1 switch ($#argv) case 0: set month = $date[2] set i = 1 foreach m ($dmon) if ( $m == $month ) then set month = $i break endif @ i++ end set year = $date[6] breaksw case 1: switch ($1) case -man: cat $0 | awk '{if ($2 == "END-OF-MAN") exit;else print}' | more exit case -*: echo "usage: $0 [[month] year]" exit 1 endsw set month = 0 set year = $argv[1] breaksw case 2: set month = $argv[1] set i = 1 foreach m ($dmon) if ( $m == $month ) then set month = $i break endif @ i++ end set year = $argv[2] breaksw default: echo "usage: $0 [[month] year]" exit 1 breaksw endsw if ( $month != 0 ) then set monthlist = ($month) else set monthlist = (12 11 10 9 8 7 6 5 4 3 2 1) endif cat <