Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!usc!rutgers!att!dptg!lzga!jlw From: jlw@lzga.ATT.COM (Joe Wood) Newsgroups: comp.lang.postscript Subject: PostScript Calendars redux Keywords: calendars annotations Message-ID: <1739@lzga.ATT.COM> Date: 3 Jan 90 15:46:40 GMT Organization: AT&T BL Middletown/Lincroft NJ USA Lines: 593 I've been hacking at the PostScript Calendar maker recently. I've used what I feel is the better looking version with 5 rows of days per month (handles overlapping days as in 24/31 in 12/89) and added banners as well as left justified, centered, and right justified footers. All shamelessly stolen from others. I've found it useful in making up calendars for my kids' sports teams, the scout troop, and for church groups. Alas its a little too late for family calendars for Christmas gifts. Wouldn't want to forget Aunt Minnie's birthday or your anniversary. Joe Wood jlw@lzga.ATT.COM ----------------------8<---CUT HERE--------8<------------------------ #!/bin/sh #+ # # 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 6 # 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. # 12/89 - The holiday checking has been loosened up in that the # following takes place: # 1. The Shell Variable EFILE is used preferentially # 2. Then the file Events in the current directory is used # 3. Finally the $HOME/.holiday file is used. # The whole process can be turned off by setting EFILE=/dev/null. # # OPTIONS: # Any argument whose first character is '-' is passed on to lpr. # The shell variables BANNER, LFOOT, CFOOT, and RFOOT become a # top centered banner, and left, centered, or right justified # footers respectively. As in: # # BANNER="Schedule 1" CFOOT=Preliminary pscal 4 90 # # 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 # @Used the better looking version with 5 rows of days rather than 6 # @ hacked together with holiday and banner/footnotes added # @ by Joe (No Relation) Wood, 12/89, jlw@lzga.ATT.COM # # 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). # # # PostScript program to print calendars. # Doesn't deal well with September 1752 or before. # USAGE="Usage: pscal [ -Rrt ] [ -F hfont ] [ -f font ] [ month [ year ] ]" TFONT=Times-Bold DFONT=Helvetica-Bold EFONT=Times-Roman ROTATE=90 LPR="imprint -Tascii -n" while test $# != 0 do case $1 in -P) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } eval ENVAR="$1$2"; shift 2;; -P*) eval ENVAR=$1; shift 1;; -F) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } TFONT="$2"; shift 2;; -F*) TFONT=`echo $1 | sed -n 1s/-.//p`; shift 1;; -f) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } DFONT="$2"; shift 2;; -f*) DFONT=`echo $1 | sed -n 1s/-.//p`; shift 1;; -t) LPR=cat; shift 1;; -r) ROTATE=90; shift 1;; -R) ROTATE=0; shift 1;; --|-) break;; -*) echo "$USAGE" 1>&2; exit 1;; *) break esac done test $# -gt 2 && { echo "$USAGE" 1>&2; exit 1; } case $# in 0) set `date`; YEAR=$6 MONTH=`case $2 in Jan) echo 1;;Feb) echo 2;;Mar) echo 3;;Apr) echo 4;; May) echo 5;;Jun) echo 6;;Jul) echo 7;;Aug) echo 8;; Sep) echo 9;;Oct) echo 10;;Nov) echo 11;;Dec) echo 12;;esac`;; 1) MONTH=$1; set `date`; YEAR=$6;; 2) MONTH=$1 YEAR=$2;; esac if [ -n "$EFILE" -a -r "$EFILE" ] then Files=$EFILE elif [ -r Events ] then Files=Events elif [ -r $HOME/.holiday ] then Files=$HOME/.holiday else Files=/dev/null fi holidays=`cat $Files | grep \^$MONTH: | awk -F: '{printf("%s ( %s",$2,$3);\ for(i = 4; i <= NF; i++) printf(":%s", $i);printf(")\n"); }'` test $YEAR -lt 100 && YEAR=`expr $YEAR + 1900` $LPR $ENVAR <