Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!oliveb!mintaka!daemon From: map@gaak.LCS.MIT.Edu (Michael A. Patton) Newsgroups: alt.sources Subject: Re: Postscript Calendar Program Message-ID: Date: 19 Sep 89 19:14:21 GMT References: <1979@diamond.warwick.ac.uk> Sender: daemon@mintaka.lcs.mit.edu (Lucifer Maleficius) Organization: MIT Laboratory for Computer Science Lines: 305 In-reply-to: rolf@warwick.UUCP's message of 17 Sep 89 20:33:30 GMT After receiving Rolf's post, I added a few "features" to the script. It now has defaults for everything on the command line (these defaults are, of course, the ones I like, your mileage may vary). Hack away. -Mike ---------------------------------------------------------------- #!/bin/csh -f # pscal - Postscript year calendar # # Originally... # 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 # Leap year bug fixed Dec. 4th, 1987 by Neil Crellin (neilc@dmscanb.dms.oz.au) # # Modified to produce calendar for whole year Aug 1988 - Rolf # Twelve months from any month - 17/9/89 Rolf Howarth (rolf@flame.warwick.ac.uk) # # Modified to add defaults Sep 1989 - MAP@LCS.MIT.Edu # printer defaults to your "default" printer # title defaults to "user's calendar" # month defaults to January # year defaults to this year # Note: if there is a message and you wish to default the month or year, # the first word of the message cannot begin with a digit. # # # Usage: pscal [-Pprinter] [[month] year] [message ...] , eg. # pscal -Ppsc 9 1989 "Rolf's Calendar" # will produce a twelve month calendar from Sept 89 to Aug 90. # printer defaults to the default (i.e. we say nothing, lpr figures it out) set printer="" top: if ($#argv > 0) then switch ("$argv[1]") case -P*: set printer="$argv[1]" shift argv goto top case -*: echo "usage: $0 [-Pprinter] [[month] year] [title ...]" exit 1 case [0-9]*: if ($?name) then set name="$name $argv[1]" else if ($?month) then if ($?year) then set name="$argv[1]" else set year="$argv[1]" endif else set month="$argv[1]" endif endif shift argv goto top case *: if ($?name) then set name="$name $argv[1]" else set name="$argv[1]" endif shift argv goto top endsw endif if ($?year) then else if ($?month) then set year=$month else set year=`date|awk '{print $6}'` endif set month=1 endif if ($?name) then else set name="$user's calendar" endif lpr $printer <