[comp.sources.sun] v01i010: Calendar/planning tool: Part 01/09

mcgrew@dartagnan.rutgers.edu (Charles Mcgrew) (05/28/89)

Submitted-by: Bill Randle <bill@saab.cna.tek.com> 
Posting-number: Volume 1, Issue 10
Archive-name: calentool/part01

This posting is up to date as of patch 02 to calentool.  Enjoy!

Charles

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	Bugs
#	CalenTool.d
#	Fixes1_1
#	Fixes1_2
#	Fixes1_3
#	Fixes1_4
#	Fixes2_0
#	Fixes2_1
#	INSTALL
#	MANIFEST
#	Makefile
#	PATCHLOG
#	README
#	README_ORIG
#	ToDo
#	pcal.c
#	month.cursor
# This archive created: Sat May 27 13:44:19 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'Bugs'" '(489 characters)'
if test -f 'Bugs'
then
	echo shar: will not over-write existing file "'Bugs'"
else
sed 's/^	X//' << \SHAR_EOF > 'Bugs'
	XThese aren't major, but I haven't had time to track them down...
	X
	X1) The "Working!" message occasionally lingers on when it shouldn't.
	X   If it bothers you, use the "-w" option to turn off the message
	X   entirely.
	X
	X2) Arrow display messes up on rare occasions.  I haven't duplicated
	X   this often enough to track down.
	X
	X
	XIf you fix any of these, or spot other bugs, please let me know.
	X
	X		Bill Randle
	X		billr@saab.CNA.TEK.COM
	X		{most backbones}!tektronix!saab.CNA.TEK!billr
	X		May 10, 1989
SHAR_EOF
if test 489 -ne "`wc -c < 'Bugs'`"
then
	echo shar: error transmitting "'Bugs'" '(should have been 489 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'CalenTool.d'" '(708 characters)'
if test -f 'CalenTool.d'
then
	echo shar: will not over-write existing file "'CalenTool.d'"
else
sed 's/^	X//' << \SHAR_EOF > 'CalenTool.d'
	XSunDefaults_Version 2
	X; $Header: CalenTool.d,v 2.1 89/05/09 14:29:05 billr Exp $
	X; defaults for calentool program
	X; this can be put in /usr/lib/defaults or appended to ~/.defaults
	X/CalenTool
	X	$Help	"Day-Week-Month-Year-at-a-glance calendar and almanac"
	X//Font		"screen.r.14"
	X	$Help	"Font to use for standard numbers/letters"
	X//BigFont	"gallant.r.10"
	X	$Help	"Font to use for title strings"
	X//Printer	"lw"
	X	$Help	"Postscript (or Raster) printer"
	X//LibDir	"/usr/local/lib/calentool"
	X	$Help	"Directory for standard date/event files"
	X; This entry may be useful where all appointment files are in a
	X; common NFS'd directory
	X;//Appts	"/usr/local/lib/calendars/billr.appts"
	X;	$Help	"File to use for my appointments"
SHAR_EOF
if test 708 -ne "`wc -c < 'CalenTool.d'`"
then
	echo shar: error transmitting "'CalenTool.d'" '(should have been 708 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Fixes1_1'" '(923 characters)'
if test -f 'Fixes1_1'
then
	echo shar: will not over-write existing file "'Fixes1_1'"
else
sed 's/^	X//' << \SHAR_EOF > 'Fixes1_1'
	X# $Header: Fixes1_1,v 1.1 88/04/08 11:27:54 billr Exp $
	X
	XNotes for version 1.1 of calentool:
	X
	X1) Removed hard coded year restriction of 1985-1987; #defined
	X   START_YEAR and NR_YEARS and used them instead.  There are
	X   still a few places where this info is hard coded, mainly in
	X   the year menu display.
	X
	X2) Removed hard coded start time restriction of 9am; #defined
	X   START_HOUR to take care of this.  The ending time is determined
	X   by the number of timeslots (N_TSLOTS).
	X
	X3) Changed time interval from 15 minutes to 30 minutes (this is
	X   hard coded in several places).  This was done to free up some
	X   space on the day/week page for a "notes" section.  The "notes"
	X   section is denoted in the appointments file by hour = "00",
	X   with the minutes field indicating the note number (starting with 1).
	X   E.g., note#1 would be entered as "YY MM DD 00 01 00 my note for the day".
	X
	X	-Bill Randle
	X	billr@tekred.TEK.COM
SHAR_EOF
if test 923 -ne "`wc -c < 'Fixes1_1'`"
then
	echo shar: error transmitting "'Fixes1_1'" '(should have been 923 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Fixes1_2'" '(486 characters)'
if test -f 'Fixes1_2'
then
	echo shar: will not over-write existing file "'Fixes1_2'"
else
sed 's/^	X//' << \SHAR_EOF > 'Fixes1_2'
	X# $Header: Fixes1_2,v 1.1 88/04/08 11:27:56 billr Exp $
	X
	XLate flash for version 1.2 of calentool:
	X
	X1) Removed the remaining hard-coded usage of year strings.  The tool
	X   now works for any period of years starting at or after 1985 and
	X   ending on or before 1999.  More work would have to be done to
	X   get it to work beyond the year 2000.
	X
	X2) Calentool now understands leap years!  Previous versions always
	X   assumed February had 28 days.
	X
	X	-Bill Randle
	X	billr@tekred.TEK.COM
	X	2/2/88
SHAR_EOF
if test 486 -ne "`wc -c < 'Fixes1_2'`"
then
	echo shar: error transmitting "'Fixes1_2'" '(should have been 486 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Fixes1_3'" '(228 characters)'
if test -f 'Fixes1_3'
then
	echo shar: will not over-write existing file "'Fixes1_3'"
else
sed 's/^	X//' << \SHAR_EOF > 'Fixes1_3'
	X# $Header: Fixes1_3,v 1.1 88/04/08 11:27:57 billr Exp $
	X
	XVersion 1.3 update:
	X
	X1) Add code to handle command line arguments (mainly because I
	X   like it to come up iconic and put the icon where I want it).
	X
	X	-Bill Randle
	X	2/3/88
SHAR_EOF
if test 228 -ne "`wc -c < 'Fixes1_3'`"
then
	echo shar: error transmitting "'Fixes1_3'" '(should have been 228 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Fixes1_4'" '(1147 characters)'
if test -f 'Fixes1_4'
then
	echo shar: will not over-write existing file "'Fixes1_4'"
else
sed 's/^	X//' << \SHAR_EOF > 'Fixes1_4'
	X# $Header: Fixes1_4,v 1.1 88/04/08 11:28:00 billr Exp $
	X
	XVersion 1.4 update:
	X
	X1) Add code to include a "Done" button on the selection window to
	X   display todays appointments then close to an icon. This is faster
	X   than selecting "Today", then selecting "close" out of the suntools
	X   window menu. This is especially handy for the reminder service
	X   (see below).
	X
	X2) Add a new reminder feature. The icon will be displayed in reverse
	X   video starting approximately ten minutes prior to an appointment
	X   and all during an appointment. When the appointment is over, the
	X   icon switches back to normal. This is really handy if, like me,
	X   you normally keep calentool in the iconic state and need some
	X   help remembering when to get ready for that next meeting.
	X   (Thanks to Dan Heller and "mushtool" for hints on how to do this.)
	X
	X3) A third icon is displayed if there are no appointments or notes
	X   left for today. This icon is similar to the standard icon except
	X   no lines are displayed and the words "No Appts" displayed instead.
	X
	X4) The rings on the icons were shortened by two pixels to "improve" the
	X   looks.
	X
	X	-Bill Randle
	X	2/19/88
SHAR_EOF
if test 1147 -ne "`wc -c < 'Fixes1_4'`"
then
	echo shar: error transmitting "'Fixes1_4'" '(should have been 1147 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Fixes2_0'" '(4084 characters)'
if test -f 'Fixes2_0'
then
	echo shar: will not over-write existing file "'Fixes2_0'"
else
sed 's/^	X//' << \SHAR_EOF > 'Fixes2_0'
	X# $Header: Fixes2_0,v 1.2 88/05/02 12:53:40 billr Exp $
	X
	XWelcome to Calentool version 2.0
	X
	XBugs fixed in version 2.0:
	X	- Problem running on a Hi-res display; did not accept -Wt option.
	X	:: The tool now parses the suntools options before setting the default
	X	   font, so -Wt will be used. Also checks the suntools defaults file(s)
	X	   for "/CalenTool/Font" and "/CalenTool/BigFont".
	X
	X	- Year menu cycled from 1/87 - 1/88 - 12/88 - 1/90 - 1/91
	X	:: This was due to an error in the way the year_days[] array was
	X	   accessed. It is now fixed.
	X	
	X	- Several problems that occurred when Jan 1 of START_YEAR was not a
	X	  Monday.
	X	:: Proper boundary checking is done in all (I hope) cases. You can no
	X	   longer get before Jan 1, START_YEAR or after Dec 31, END_YEAR.
	X	   == This has been superseeded by the new date handling code, which
	X	      works for any day from 1900 to 1999.
	X	
	X	- If START_YEAR is changed to 88, get_today() returns yesterday.
	X	:: This was related to #2 above and has been fixed.
	X
	X	- When displaying a month where the 1st is on a Sunday, clicking on that
	X	  week will show the previous week.
	X	:: This was a problem in the way the beginning of the current week was
	X	   determined and has been fixed.
	X	
	X	- The week display doesn't show what year it is.
	X	:: Fixed.
	X
	X	- Borders need around Year Menu and Month Menu buttons.
	X	:: Not changed due to new panel layout.
	X
	X	- Don't pay attention to /Menu/Font in .defaults.
	X	:: Fixed in a slightly different fashion (see #1, above).
	X
	X	- Too much right margin in week slots.
	X	:: Margin decreased by one character.
	X
	X	- Too much margin in day slots.
	X	:: Margin decreased by one character.
	X
	X	- Tempfile name not unique - could cause problems in an NFS environment.
	X	:: Tempfile name is now unique with appended pid.
	X
	X	- Option parsing was handled poorly.
	X	:: Improved option parsing (see also, #1 above).
	X
	X	- Button layout inconsistent and hard to use.
	X	:: Re-did panel layout. (See below.)
	X
	X	- Program had a tendency to "hang" when trying to open it.
	X	:: Theory was that open occurred at the same time at the periodic
	X	   update of the icon. Changed to only update when icon is actually
	X	   needs to change.
	X
	XNew features in version 2.0:
	X	:: Completely new button panel layout. Should be easier to use and
	X	   consistant in all display modes.
	X	
	X	:: Added a new year-at-a-glance display that displays an entire year
	X	   at one time. (Before, when selecting year, you got Jan of that
	X	   year.) Reverse-video indictes days with appointments.
	X	
	X	:: Re-occurring and "wild carded" appointments are available
	X	   (see man page).
	X
	X	:: Saturday and Sunday are optionally available on the week
	X	   display by using the -7 option. (Note: selecting this
	X	   option also provides a larger day window for longer
	X	   messages.)
	X
	X	:: Start hour, end hour and start year are all defineable at
	X	   compile time via the ct.h file or the Makefile.
	X	
	X	:: New date handling code allows viewing any year from 1900
	X	   to 1999 without boundary problems at START_YEAR and END_YEAR.
	X
	X	:: Todays calendar can be printed on an ASCII terminal by use
	X	   of the new -p option.
	X
	X	:: Todays calendar can be mailed to as specified user with the
	X	   new -m option. This obviates the need for the seperate
	X	   calenmail program.
	X
	X	:: New beep (-b) option beeps and displays the pending appointment
	X	   on the console.
	X
	X	:: Comments can be included in the appointments file.
	X
	X	:: Display appointments file name on banner stripe.
	X
	X	:: Cleaned-up man page.
	X
	X	:: Cleaned-up Makefile.
	X
	X	:: Prettied-up icons.
	X
	XStill to do:
	X	- Improve text entry handing for appointments messages.
	X
	XThanks to all who reported bugs, and special thanks to:
	X	Casey Leedom for suggesting the new panel layout
	X	Matt Landau for improved option parsing
	X	Rick Rodgers for improved man page and improved icons
	X	Alfred Correira for the console beep feature
	X	David St. Pierre for improved date handling code with offset
	Xand of course to Philip Heller for writing the original code and making it
	Xavailable to the Sun user community.
	X
	X	-Bill Randle
	X	Tektronix, Inc.
	X	billr@saab.CNA.TEK.COM
	X	May 2, 1988
SHAR_EOF
if test 4084 -ne "`wc -c < 'Fixes2_0'`"
then
	echo shar: error transmitting "'Fixes2_0'" '(should have been 4084 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Fixes2_1'" '(12247 characters)'
if test -f 'Fixes2_1'
then
	echo shar: will not over-write existing file "'Fixes2_1'"
else
sed 's/^	X//' << \SHAR_EOF > 'Fixes2_1'
	X# $Header: Fixes2_1,v 2.1 89/05/09 14:26:54 billr Exp $
	XBugs fixed in version 2.1:
	X	- the -m option does not use a default userid
	X	:: fixed to default to userid that started calentool
	X
	X	- problems if no .appointment files exists
	X	:: calentool now prompts the user asking if he wishes to create
	X	:: a new .appointmnet file if it does not exist.
	X
	X	- if there is only one entry in the .appointments file, it
	X	  can not be deleted.
	X	:: this is actually an attempt at safety checking, to avoid
	X	:: copying a zero length file over the original .appointments
	X	:: file (in case of file system full or whatever). A check
	X	:: for zero length file is still made, but due to the new format
	X	:: it should never happen.
	X
	X	- calentool dies if the input file is not in the expected
	X	  format
	X	:: the whole input and output portions of the code have been
	X	:: rewritten with an eye towards making it more robust. Things
	X	:: like this should now print an error message, rather than
	X	:: just dumping core.
	X
	X	- When going from month display to week display, sometimes the
	X	  week displayed is not the one that was selected.
	X	:: fixed.
	X
	X	- Calentool dies on OS 4.x machines when certain panel buttons
	X	  are selected.
	X	:: argument list for some of the notify functions were incorrect.
	X	:: fixed.
	X
	XNew features in version 2.1:
	X	:: The user interface panel layout and button functionality
	X	   has been redesigned (again) based on feedback from beta
	X	   testers of version 2.0.  The new panel layout has the buttons
	X	   grouped closer together (for ease of moving the mouse
	X	   around) and is more consistent.  Most of the buttons also
	X	   have menus accessible by pushing the right mouse button.
	X	   "Current" and "Today" do not have menus.  When
	X	   displaying a day or week, a particular day of that week
	X	   can be displayed by selecting it from the menu under the
	X	   "Day" button.  The "Next" and "Previous" buttons allow
	X	   moving forward and back by days, weeks, months or years.
	X	   The display type stays the same, so some options may be
	X	   disabled, depending on display mode.  E.g., from a day
	X	   display you can go to the same day next week, month or year
	X	   (or the next day); but with a month display you can not
	X	   go to the next week or day, only the next month or year.
	X	   Clicking the left mouse button selects the next <whatever
	X	   is currently displayed>.
	X	   The Week, Month and Year buttons work much as they did in
	X	   the 2.0 version, with the selection of larger timespans
	X	   (e.g. week to month) keeping you in the same time period
	X	   (e.g. same month) as you started.  When going to shorter
	X	   time spans (e.g. month to week) the first event is displayed
	X	   (e.g. first week in the month).  Current selects the
	X	   current <whatever is displayed> that matches today.
	X	   The Done button has been removed.  Use the frame menu
	X	   close or quit options to close to an icon or quit the tool.
	X	   A File button has been added to allow switching appointment
	X	   files while calentool is running.
	X
	X	:: Today is grayed out in the year, month, week and day displays
	X	   as a way to highlight it.
	X	
	X	:: The current date and time is displayed in the control panel.
	X	   The default is to update the time every second.  Optionally,
	X	   one can set the UPDATE_RATE to "minute" in ct.h (or the
	X	   Makefile) to change the update rate to every minute - with
	X	   no seconds field displayed.
	X
	X	:: A future appointment reminder is available to remind you
	X	   every day for n days in advance about an appointment.  A
	X	   popup frame is created to display the future appointments.
	X	   This frame may be removed by selecting the "Done" button.
	X	   Selecting one of the future appointments with the left
	X	   mouse button moves you to that day and displays it.  (This
	X	   can be handy for turning off the reminder, see below.)
	X	
	X	:: The repeating appointment facility has been expanded in
	X	   capability.  In addition to the every year, month, day
	X	   or repeat every n days appointments in 2.0, you can now
	X	   specify a specific day of the week (e.g. every Monday).
	X	   One can also tag that with specific weeks (e.g. 1st & 3rd
	X	   Monday, Last Thursday).
	X
	X	:: In the day display a menu is available with the right
	X	   mouse button to allow cut and paste operations on appointment
	X	   entries, as well as modification of an appointment.
	X	   When Modify is selected, a popup window appears to allow
	X	   setting special attributes, such as repeating appointments
	X	   and future reminders.  This should eliminate the need for
	X	   ever having to manually edit the .appointments file.  Note
	X	   that the cursor has to be in an appointment slot to get the
	X	   menu.
	X	
	X	:: The .appointments file format also supports the use of
	X	   #include files to include *non-editable* appointments
	X	   (such as site specific holidays, etc.).  The format for
	X	   this is:
	X		#include "file"
	X	   or
	X		#include "/somepathname/file"
	X	   Where the '#' *must* start in column 1 of the .appointments
	X	   file.  If the "file" form is used, the file is prepended
	X	   with the pathname used for the initial .appointments file.
	X	   Include files are not nestable.  Using include files is the
	X	   one case where manual editing of the .appointments file is
	X	   still necessary. Included appointments are marked as read-
	X	   only, they can not be deleted or modified. (You can still
	X	   modify it my invoking calentool with the include file as
	X	   the alternate appts file (-f option).)
	X
	X	:: Clicking the left mouse button on an existing appointment
	X	   no longer deletes it.  You must use the "Cut" option of
	X	   the popup menu to delete the appointment.
	X
	X	:: An optional date may be specified on the command line.  This
	X	   will tell calentool to display that day when it starts up.
	X	   The date format is pretty flexible - it will accept day
	X	   names (e.g. Tue, Th, fr, MONDAY) or numeric dates in m/d/y
	X	   format.  Valid forms are: dd (e.g. 27 => 27th of this month),
	X	   mm/dd (e.g. 11/27 => Nov 27th of this year) and mm/dd/yy
	X	   (e.g. 11/27/90 => Nov 27th, 1990).  Preface the date with
	X	   the "-d" flag.
	X
	X	:: In the .appointments file, notes are now indicated by a "99"
	X	   in the hour field, rather than "00".  This is in case
	X	   someone works graveyard or wanted a 24-hour appointment
	X	   display. The minutes field defaults to 00.  A "99" in the
	X	   minutes field marks this note so that it will not show up
	X	   in the month or year display.
	X
	X	:: The .appointments file is now one-based - i.e., months and
	X	   days start at 1, rather than zero. This was an option in
	X	   2.0, but is now standard in 2.1.  Calentool has the built-in
	X	   capability to automatically convert existing .appointment
	X	   files (see the README file).
	X	
	X	:: Support has been added for keeping outdated appointments in
	X	   a seperate file of the form ".appointments.YY", where YY
	X	   is the year.  This is controlled with the "-i" (include
	X	   outdated appointments) and "-o" (save outdated appointments)
	X	   flags.  If "-o" is specified on an appointment file with
	X	   outdated entries, the save file(s) is(are) automatically
	X	   created upon quiting the calentool program.  If "-o" is
	X	   specified on the first time calentool is invoked on a
	X	   version 1 file, the outdated appointment files are created
	X	   when the file format is converted from version 1 to
	X	   version 2.
	X	
	X	:: Calentool now allows you to temporarily delete a recurring
	X	   appointment.  That is, if one has a meeting every Monday,
	X	   except next Monday, then the appointment can be "deleted"
	X	   (or hidden, actually) for that day only.  Recurring
	X	   appointments that are deleted for a single occurance like
	X	   this are the only ones that can be "undeleted".
	X	
	X	:: Calentool finally supports overlapping and mulitple
	X	   appointments for a given time period.  When more than one
	X	   appointment exists during a particular 30 minute timeslot,
	X	   a "More" button appears to the right of the timeslot in
	X	   the day display.  Clicking on this button with the left MB
	X	   will show the next appointment in sequence.  To add another
	X	   appointment on top of an existing appointment, click the
	X	   left MB as normal and enter the new message.
	X	
	X	:: Support for common date directory.  If an included file
	X	   has the form '#include <file>' then "file" is prepended
	X	   with a library directory path determined from the
	X	   /CalenTool//LibDir entry in the suntools
	X	   defaults file (if it exists) or from the compile time
	X	   specified name (DATELIB_DIR), which defaults to
	X	   "/usr/local/lib/calentool".  Several date/event files
	X	   are included in the distribution in the "dates" subdirectory.
	X	
	X	:: Day of year and days remaining in year added to the bottom
	X	   of the day display.
	X	
	X	:: Appointment entries that are longer than the width of the
	X	   display are normally displayed left justified.  When a
	X	   keyboard character is typed into the timeslot the displayed
	X	   message is right justified for editing.  A set of left and
	X	   right arrows are also displayed to allow viewing the entire
	X	   text of the message.
	X	
	X	:: An up-arrow cursor has been added to the currently selected
	X	   day slot to show where text entry/deletion will take place.
	X	
	X	:: A sun and moon image have been added to the main control panel.
	X	   When they are selected, interesting information about the sun
	X	   and/or moon is displayed in a popup window.  Edit the riseset.h
	X	   file to adjust for your specific lattitude and longitude.  This
	X	   code is based on code from the riseset and moontool programs.
	X
	X	:: A "Print" button has been added to the main control panel to
	X	   generate a raster or Postscript image file and send it to
	X	   your printer.  This works for day, week and month displays.
	X	   The day and week printouts are exact copies of what is seen on
	X	   the screen. The month printout is in a different format.
	X	   A menu is available with the Print button to allow changing
	X	   the print command. The default print command is obtained
	X	   from (in order): the suntool defaults file, the PRINTER
	X	   environment variable and the #define for PRINT_CMD.
	X
	X	:: A "File" button has been added to the control panel to
	X	   allow selecting a different appointments file after
	X	   calentool has been started.
	X
	X	:: Calentool tries to auto-size itself based on the font in use.
	X	   This should keep buttons, etc from overlapping when fonts
	X	   other than screen.r.14 (default) are used.
	X	
	X	:: Once the tool is started, error messages are displayed in a
	X	   popup window, rather than the console, if possible.
	X	
	X	:: The action of the middle mouse button in the day display
	X	   has been changed. Point to the selected appt, push the middle
	X	   button, drag the mouse to the termination timeslot and release
	X	   the button.
	X	
	X	:: The "-t" option will display the current time below the icon
	X	   when the tool is closed. The displayed time format and update
	X	   rate is governed by the -u option (or UPDATE_INTERVAL #define).
	X	
	X	:: "-b" also puts a copy of the appt string in $HOME/.msgfile
	X	   (in addition to the console) for use with nlock(1).
	X
	X	:: Today's day and month are now displayed on the bottom of
	X	   the icon's calendar page.
	X	
	X	:: Popup window added to allow direct entry of a date to view.
	X	   Selected by a menu entry under the "Current" button.
	X	
	X	:: Extended "Current" button menu to allow selecting current
	X	   year, month, week or day, along with setting the date as
	X	   noted above.
	X	
	X	:: Add "Save" button to the "File" frame that forces an update
	X	   to the current appointments file.
	X	
	X	:: Change the defaults entry from an appointment directory to
	X	   the actual appointment file.  New name is /CalenTool/Appts.
	X	   This change was made to (hopefully) allow easier use of
	X	   the tool when accessing multiple people's calendars when
	X	   using the "File" frame.  /Lib entry changed to /LibDir.
	X	
	X	:: Create the tmp file in /tmp, with a name /tmp/apptsNNNNN
	X	   where NNNNN is the pid.  The file name used to be
	X	   .tmp.apts.NNNNN created in whatever directory the appointments
	X	   file was found in.
	X
	X	:: Add "-w" option to turn off display of "Working!" message.
	X
	XAs always, bug reports and suggestions for improvements are encouraged.
	X
	X		-Bill Randle
	X		Tektronix, Inc.
	X		billr@saab.CNA.TEK.COM
	X		May 9, 1989
SHAR_EOF
if test 12247 -ne "`wc -c < 'Fixes2_1'`"
then
	echo shar: error transmitting "'Fixes2_1'" '(should have been 12247 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'INSTALL'" '(2808 characters)'
if test -f 'INSTALL'
then
	echo shar: will not over-write existing file "'INSTALL'"
else
sed 's/^	X//' << \SHAR_EOF > 'INSTALL'
	XINSTALLATION NOTES FOR CALENTOOL - Version 2.1, April 1989
	X
	X1) Edit the file "ct.h" to tailor calentool to your site. The only things
	X   that should really need to be "tweeked" are the define statements for:
	X
	X   DATELIB_DIR (directory for date/event files)
	X   PRINT_CMD (command string for sending file to PostScript printer)
	X   NR_WEEKDAYS (for 5-day or 7-day week displays)
	X   START_HOUR (first hour to appear in appointment display)
	X   END_HOUR (last hour to appear in appointment display)
	X   START_YEAR (first year to appear in year menu)
	X   NR_YEARS (total number of years to appear in year menu)
	X   UPDATE_RATE (rate of clock updating)
	X
	X   If you want to make a smaller version of calentool, without certain
	X   features, uncomment the #defines for one or more of the following
	X   (all total they save about 100K bytes in the stripped executable):
	X
	X	   NO_PRINTER (Deletes print raster and print Postscript options)
	X	   NO_HOLIDAYS (Deletes -h and -H options)
	X	   NO_SUN_MOON (Deletes Sun and Moon data frames)
	X
	X   There are other options (described in comments) which should rarely require
	X   modification (all options can be set within the Makefile if you prefer).
	X
	X   Some of these options can be overridden with command line options -
	X   see the man page.
	X
	X2) Edit the Makefile to adjust pathnames.
	X
	X3) Edit the file "riseset.h" file, entering the correct lattitude and longitude
	X   for your location.  These are used to determine local time offset and
	X   rise/set times for the sun and moon.
	X
	X4) make
	X
	X5) make install
	X
	X6) If you modified paths in the Makefile, edit the FILES section of the
	X   installed manual page to reflect the correct locations of files.
	X
	XA NOTE ABOUT APPOINTMENT FILE FORMAT CONVERSION FOR USERS OF OLDER RELEASES:
	X
	X   If you have used previous versions of calentool, you will need to convert
	X   any old .appointment files to the new format.  When calentool is first
	X   started, it looks for a special header line as the first line of the
	X   .appointments file.  If it exists, it assumes that this is a new style file.
	X   If it does not exist, calentool automatically converts your .appointments
	X   file to the new style format and rewrites the file.  When it does this,
	X   it assumes that the appointment entries are zero-based, i.e. Jan 1st,
	X   1988 is 88 00 00.  This was true for all versions of calentool prior
	X   to 2.0 beta and was the default in 2.0 beta.  If you are using 2.0 beta
	X   compiled with OFFSET set to 1, then you *must* use the '-z' switch
	X   when you invoke calentool for the first time.  This tells it to convert
	X   the file, but assume the input is one-based.  Subsequent invocations
	X   of calentool should not use the '-z' switch (although it will be
	X   ignored if it finds a version 2 file header).
	X
	X	Bill Randle
	X	billr@saab.CNA.TEK.COM
	X	May 9, 1989
SHAR_EOF
if test 2808 -ne "`wc -c < 'INSTALL'`"
then
	echo shar: error transmitting "'INSTALL'" '(should have been 2808 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'MANIFEST'" '(2160 characters)'
if test -f 'MANIFEST'
then
	echo shar: will not over-write existing file "'MANIFEST'"
else
sed 's/^	X//' << \SHAR_EOF > 'MANIFEST'
	X   File Name		Archive #	Description
	X-----------------------------------------------------------
	X Bugs                      11	
	X CalenTool.d               11	
	X Fixes1_1                  11	
	X Fixes1_2                  11	
	X Fixes1_3                  11	
	X Fixes1_4                  11	
	X Fixes2_0                   3	
	X Fixes2_1                   8	
	X INSTALL                   10	
	X MANIFEST                   1	This shipping list
	X Makefile                  10	
	X README                     1	
	X README_ORIG                1	
	X ToDo                      11	
	X cal2ct.c                  10	
	X calentool.1                5	
	X calentool.c                8	
	X ct.h                       2	
	X datelib.c                  2	
	X dates                      1	
	X dates/README               1	
	X dates/celtic              11	
	X dates/events               7	
	X dates/lives                4	
	X dates/lotr                10	
	X dates/nature              11	
	X dates/popcult              9	
	X dates/usa_holiday         11	
	X dates/usa_other            8	
	X dates/usa_states          10	
	X dates/world                5	
	X day.cursor                11	
	X devent.c                   6	
	X dpaint.c                   6	
	X event.c                   10	
	X event.h                   11	
	X holidays.c                 1	
	X init.c                     3	
	X month.cursor              11	
	X month.h                   10	
	X month2ct.c                10	
	X moon.c                     7	
	X moony.icon                10	
	X mpaint.c                   9	
	X mt2ct.1                   10	
	X mt2ct.c                    9	
	X nap.icon                  10	
	X notify.c                   3	
	X paint.h                   11	
	X patchlevel.h              11	
	X put_aentry.c              10	
	X ras2ps.c                   9	
	X read_sched.c              10	
	X rev.icon                  10	
	X riseset.c                  8	
	X riseset.h                  4	
	X std.icon                  10	
	X sunny.icon                10	
	X tool.c                     1	
	X utils.c                    4	
	X version.c                  7	
	X week.cursor               11	
	X wevent.c                   4	
	X wpaint.c                   9	
	X year.cursor               11	
	X ypaint.c                   9	
SHAR_EOF
if test 2160 -ne "`wc -c < 'MANIFEST'`"
then
	echo shar: error transmitting "'MANIFEST'" '(should have been 2160 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Makefile'" '(2389 characters)'
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	X# $Header: Makefile,v 2.1 89/05/09 14:29:00 billr Exp $
	X#
	X# make sure LIBDIR here matches DATELIB_DIR in ct.h (or use -D)
	XBINDIR = /usr/local/bin
	XLIBDIR = /usr/local/lib/calentool
	XMANDIR = /usr/man/manl
	XDEFSDIR = /usr/lib/defaults
	XMANEXT = l
	X
	XDEFINES=  #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88
	XCFLAGS=	-O ${DEFINES}
	XLIBS=	-lsuntool -lsunwindow -lpixrect -lm
	X
	XDATEFILES= dates/README dates/celtic dates/events dates/lives\
	X	 dates/lotr dates/nature dates/popcult\
	X	 dates/usa_holiday dates/usa_other dates/usa_states dates/world
	XSRCS=	calentool.c datelib.o devent.c dpaint.c event.c holidays.c\
	X	 init.c moon.c mpaint.c notify.c ras2ps.c riseset.c tool.c utils.c\
	X	 version.c wevent.c wpaint.c ypaint.c pcal.c
	XINCLUDES= ct.h event.h paint.h patchlevel.h riseset.h
	XOBJS=	calentool.o datelib.o devent.o dpaint.o event.o holidays.o\
	X	 init.o moon.o mpaint.o notify.o ras2ps.o riseset.o tool.o utils.o\
	X	 version.o wevent.o wpaint.o ypaint.o pcal.o
	X
	Xall: calentool conv_tools
	X
	X# the main program
	Xcalentool: ${OBJS}
	X	cc ${CFLAGS} -o calentool ${OBJS} ${LIBS}
	X
	Xcalentool.o: calentool.c ct.h std.icon rev.icon nap.icon
	Xdatelib.o: datelib.c
	Xdevent.o: devent.c ct.h event.h
	Xdpaint.o: dpaint.c ct.h paint.h riseset.h
	Xholidays.o: holidays.c
	Xinit.o: init.c ct.h
	Xmoon.o: moon.c
	Xmpaint.o: mpaint.c ct.h paint.h
	Xnotify.o: notify.c ct.h
	Xevent.o: event.c ct.h event.h
	Xras2ps.o: ras2ps.c
	Xriseset.o: riseset.h
	Xtool.o: tool.c ct.h
	Xutils.o: utils.c ct.h
	Xversion.o: version.c
	Xwevent.o: wevent.c ct.h event.h
	Xwpaint.o: wpaint.c ct.h paint.h
	Xypaint.o: ypaint.c ct.h paint.h
	X
	X# conversion utilities
	Xconv_tools: cal2ct month2ct mt2ct
	X
	Xmt2ct:	mt2ct.o put_aentry.o
	X	cc -o mt2ct ${CFLAGS} mt2ct.o put_aentry.o
	X
	Xmonth2ct:	month2ct.o put_aentry.o read_sched.o
	X	cc -o month2ct ${CFLAGS} month2ct.o put_aentry.o read_sched.o
	X
	Xcal2ct:	cal2ct.o put_aentry.o
	X	cc -o cal2ct ${CFLAGS} cal2ct.o put_aentry.o
	X
	Xinstall: all
	X	install -s calentool ${BINDIR}
	X	install -c -m 444 calentool.1 ${MANDIR}/calentool.${MANEXT}
	X	install -c -m 444 CalenTool.d ${DEFSDIR}/CalenTool.d
	X	-mkdir ${LIBDIR}
	X	cp ${DATEFILES} ${LIBDIR}
	X	install -s cal2ct ${LIBDIR}
	X	install -s month2ct ${LIBDIR}
	X	install -s mt2ct ${LIBDIR}
	X	install -c -m 444 mt2ct.1 ${MANDIR}/mt2ct.${MANEXT}
	X	cd ${MANDIR}; ln -s mt2ct.${MANEXT} cal2ct.${MANEXT};
	X	cd ${MANDIR}; ln -s mt2ct.${MANEXT} month2ct.${MANEXT};
	X
	Xclean:
	X	rm -f *.o *.BAK core
	X
SHAR_EOF
if test 2389 -ne "`wc -c < 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 2389 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'PATCHLOG'" '(616 characters)'
if test -f 'PATCHLOG'
then
	echo shar: will not over-write existing file "'PATCHLOG'"
else
sed 's/^	X//' << \SHAR_EOF > 'PATCHLOG'
	X# $Header: PATCHLOG,v 2.3 89/05/16 16:32:23 billr Exp $
	X
	X#$Log:	PATCHLOG,v $
	X# Revision 2.3  89/05/16  16:32:23  billr
	X# Fix bug whereby nfs mounted appointment files were not being
	X# properly updated.  Add support for PostScript pretty printing
	X# of a month's worth of appointments.
	X# 
	X# Revision 2.2  89/05/10  10:15:59  billr
	X# Fix bug relating to arrow count in the notes field.  It showed up when
	X# adding an additional note or pasting an appointment that overran its
	X# available timeslots.  Now at version 2.1, patchlevel 1 (V2.1p1).
	X# 
	X# Revision 2.1  89/05/09  10:13:56  billr
	X# release 2.1, patchlevel 0
	X# 
SHAR_EOF
if test 616 -ne "`wc -c < 'PATCHLOG'`"
then
	echo shar: error transmitting "'PATCHLOG'" '(should have been 616 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'README'" '(1820 characters)'
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
sed 's/^	X//' << \SHAR_EOF > 'README'
	XCALENTOOL - Version 2.1
	X
	X***************************************************************************
	XN.B.: This version of calentool uses a slightly different format
	Xfor the .appointments file.  See the notes in INSTALL concerning how to
	Xautomatically convert from the old format to the new format.
	X***************************************************************************
	X
	XCalentool is a day/week/month/year-at-glance tool for Sun Workstations.
	XThe windowed display interface uses the new style SunView (1.0) functions
	X(as opposed to the original suntool stuff), as it was too hard to figure
	Xout how to make the desired changes using the old suntool stuff.  If
	Xyou're not running SunView, there is an older version with much less
	Xfunctionality (available on request).
	X
	XOne can view a single day's appointments and notes, a weeks worth (with
	Xabbreviated messages), a month at a time (with appointment flags) or a year
	Xat a time (with appointment flags).  Alternate appointment files can be
	Xspecified to allow checking other users' schedules.
	X
	XRecurring appointments (e.g every Monday or every 1st & 3rd Tuesday),
	Xas well as a reminder of future appointments are available.
	X
	XInteresting information about the sun and moon is also available for viewing.
	X
	XSee the man page for all the gory details.  (Also see the FixesX_X files if
	Xinterested in the specific changes from previous versions to this one
	Xand the INSTALL file for installation instructions.)
	X
	XThis program was originally written by Philip Heller of Sun Microsystems,
	Xbut has had numerous bug fixes and enhancements made by Bill Randle of
	XTektronix and other users.  [I'm not sure Phil would recognized it any
	Xmore :-).]
	X
	XIt has been tested on a 3/60 OS 3.5, a 386i OS 4.?, a 3/60 OS 4.0 and
	Xperhaps others.
	X
	X	Bill Randle
	X	billr@saab.CNA.TEK.COM
	X	May 9, 1989
SHAR_EOF
if test 1820 -ne "`wc -c < 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 1820 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'README_ORIG'" '(3767 characters)'
if test -f 'README_ORIG'
then
	echo shar: will not over-write existing file "'README_ORIG'"
else
sed 's/^	X//' << \SHAR_EOF > 'README_ORIG'
	XNote: This is the original README file distributed with version 1.0
	X
	XCALENTOOL
	X
	XThis program is a day/week/month at a glance tool.  The point is that with
	Xa workstation-based calendar, the only time you should have to type is
	Xwhen you enter the specifics of an apointment.
	X
	XThe tool comes up displaying the current day, with 9:00 AM through 5:00 PM
	Xdivided into 15" intervals.  If you click LB in an interval, it toggles
	Xwhite-to-black.  When an interval is black, you can point to it with the
	Xmouse and type in details relevant to that time.  To indicate duration of
	Xan appointment, click MB in the last interval of the appointment (after
	Xyou blacken the first interval).  When displaying a single day, you can
	Xmove backwards or forwards in time by one day or one week by pushing the
	Xappropriate panel buttons.  You can also look at the current week by
	Xpushing the "Week" button, or the current month by pushing the "Month" button.
	XIn all display states you can look at any month of the current year via the
	X"Month Menu" pulldown, or the current month of any year from 1985-1987 via
	Xthe "Year Menu" pulldown.
	X
	XWhen displaying a week, you can "zoom in" on any weekday of that week by
	Xpushing any mouse button in the corresponding region of the display.  You
	Xcan see the previous week or the nest week via panel buttons.  The "Today"
	Xbutton shows you today.  The "Year" and "Month" pulldowns and the "Month"
	Xpushbutton work as before.
	X
	XWhen displaying a month, you can "zoom in" on any day of that month by
	Xpushing any mouse button in the corresponding region of the display.  You
	Xcan see any week of the month by pushing any mouse button in the corresponding
	Xarrow to the left of the display.  The "Year" and "Month" pulldowns work as
	Xbefore.  In the month display, a triangular hatch-mark in the corner of a
	Xday box means that you have an appointment on that day.
	X
	XThe month and week states are read-only.  You can only edit appointments in
	Xthe day state.
	X
	XCalentool keeps your appointments in a file, so if you kill the tool and
	Xrestart it, your appointments are remembered.  Normally this tool resides
	Xin your home directory.  If the environment variable CALENTOOL_DIR is
	Xset, it overrider the home default.  CALENTOOL_DIR should be the full
	Xpathname of a directory.  The intention of CALENTOOL_DIR is to have a
	Xdirectory just for future extensions to calentool - for example a
	X"things to do today" tool.  In any event, calentool should have write
	Xpermission in whatever directory will be used.
	X
	XIf you invoke the tool as "calentool -f pathname", then calentool will
	Xusr pathname as its appointments file.  This is useful for seeing if
	Xother people on the net are free toattend a meeting.  It's a good propaganda
	Xpoint for selling NFS: If everybody exports their appointments file, then
	Xeverybody can plan appointments more effectively.  In Mountain View we
	Xlike to have a file for the demo room schedule on Connie Humphries' machine,
	Xand access that over the net during customer visits.
	X
	XIf you use the -f option, be warned that no file integrity is assured.  If
	Xtwo people try to write to the same appointments file at the same time, the
	Xresult could be tragic.  We recommend that only the person whose schedule is
	Xdescribed by a particular appointments file have write permission for that
	Xfile.  If you try to access a file for which you don't have write permission,
	Xthen you will not be able to edit appointments.  (That's fair ... you don't
	Xwant everybody on the net to be permitted to jerk your schedule around.)
	X
	X[Contributed April 17, 1987 to the Sun User Group tape by:
	X 
	X	Philip Heller
	X	Sun Microsystems, Inc.
	X	2550 Garcia Avenue, Mailstop 10-16
	X	Mountain View, CA, USA  94043
	X	+1 415 960 1300
	X	sun!terrapin!heller
	X 
	XSun Microsystems owns this program.]
SHAR_EOF
if test 3767 -ne "`wc -c < 'README_ORIG'`"
then
	echo shar: error transmitting "'README_ORIG'" '(should have been 3767 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ToDo'" '(281 characters)'
if test -f 'ToDo'
then
	echo shar: will not over-write existing file "'ToDo'"
else
sed 's/^	X//' << \SHAR_EOF > 'ToDo'
	XStill to do someday...
	X
	X1) Do month PostScript printout based on "pscal" with actual
	X   appointment messages added in (I have the pscal source if anyone
	X   would like to do this).
	X
	X2) Convert display code and event handling, etc. to X11.  Using
	X   View2 may be the way to do this.
SHAR_EOF
if test 281 -ne "`wc -c < 'ToDo'`"
then
	echo shar: error transmitting "'ToDo'" '(should have been 281 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'pcal.c'" '(8249 characters)'
if test -f 'pcal.c'
then
	echo shar: will not over-write existing file "'pcal.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'pcal.c'
	X/*
	X * $Header: pcal.c,v 2.1 89/05/16 16:30:00 billr Exp $
	X */
	X/*
	X * pcal - print pretty PostScript image of a month calendar
	X *
	X * Pieces extracted from the pcal program by Ken Keirnan and modified
	X * slightly by Bill Randle, Tektronix, Inc. <billr@saab.CNA.TEK.COM>.
	X * 
	X * "Pcal" is a program to print PostScript calendars for any month and year.
	X * Pcal is the combined effort of several people, most notably Patrick Wood
	X * of Pipeline Associates, Inc. for the original PostScript code and Bill
	X * Vogel of AT&T for the calendar file mechanism.  My part was simple
	X * translation to a "C" program, the addition of a couple options and a more
	X * generalized date searching routine (oh yes, and a manual page :-).
	X * 
	X * The original calendar PostScript was Copyright (c) 1987 by Patrick Wood
	X * and Pipeline Associates, Inc. with permission to modify and redistribute.
	X * 
	X * Ken Keirnan
	X * Pacific Bell
	X * San Ramon, CA.
	X *
	X * Changes and additions Copyright (C) 1989 Tektronix, Inc.
	X *	All Rights Reserved
	X * Permission is hereby granted to use and modify the modifications in source
	X * or binary form as long as they are not sold for profit and this copyright
	X * notice remains intact.
	X */
	X#include "ct.h"		/* for the NO_PRINTER #define */
	X
	X#ifndef NO_PRINTER
	X#include <stdio.h>
	X#include <time.h>
	X
	Xextern struct tm current, First;
	Xextern struct dayslot slots[];
	X
	X/*
	X * pheader - provides the PostScript routines
	X */
	Xchar *pheader[] = {
	X  "%!",
	X  "/titlefont /Times-Bold def",
	X  "/dayfont /Helvetica-Bold def",
	X  "/month_names [ (January) (February) (March) (April) (May) (June) (July)",
	X  "\t\t(August) (September) (October) (November) (December) ] def",
	X  "/prtnum { 3 string cvs show} def",
	X  "/drawgrid {\t\t% draw calendar boxes",
	X  "\tdayfont findfont 10 scalefont setfont",
	X  "\t0 1 6 {",
	X  "\t\tdup dup 100 mul 40 moveto",
	X  "\t\t[ (Sunday) (Monday) (Tuesday) (Wednesday) (Thursday) (Friday) (Saturday) ] exch get",
	X  "\t\t100 center",
	X  "\t\t100 mul 35 moveto",
	X  "\t\t1.0 setlinewidth",
	X  "\t\t0 1 5 {",
	X  "\t\t\tgsave",
	X  "\t\t\t100 0 rlineto ",
	X  "\t\t\t0 -80 rlineto",
	X  "\t\t\t-100 0 rlineto",
	X  "\t\t\tclosepath stroke",
	X  "\t\t\tgrestore",
	X  "\t\t\t0 -80 rmoveto",
	X  "\t\t} for",
	X  "\t} for",
	X  "} def",
	X  "/drawnums {\t\t% place day numbers on calendar",
	X  "\tdayfont findfont 30 scalefont setfont",
	X  "\t/start startday def",
	X  "\t/days ndays def",
	X  "\tstart 100 mul 5 add 10 rmoveto",
	X  "\t1 1 days {",
	X  "\t\t/day exch def",
	X  "\t\tgsave",
	X#ifndef SATBLK
	X  "\t\tday start add 7 mod 0 eq",
	X  "\t\t{",
	X  "\t\t\tsubmonth 0 eq",
	X  "\t\t\t{",
	X  "\t\t\t\t.8 setgray",
	X  "\t\t\t} if",
	X  "\t\t} if",
	X#endif
	X  "\t\tday start add 7 mod 1 eq",
	X  "\t\t{",
	X  "\t\t\tsubmonth 0 eq",
	X  "\t\t\t{",
	X  "\t\t\t\t.8 setgray",
	X  "\t\t\t} if",
	X  "\t\t} if",
	X  "\t\tday prtnum",
	X  "\t\tgrestore",
	X  "\t\tday start add 7 mod 0 eq",
	X  "\t\t{",
	X  "\t\t\tcurrentpoint exch pop 80 sub 5 exch moveto",
	X  "\t\t}",
	X  "\t\t{",
	X  "\t\t\t100 0 rmoveto",
	X  "\t\t} ifelse",
	X  "\t} for",
	X  "} def",
	X  "/drawfill {\t\t% place fill squares on calendar",
	X  "\t/start startday def",
	X  "\t/days ndays def",
	X  "\t0 35 rmoveto",
	X  "\t1.0 setlinewidth",
	X  "\t0 1 start 1 sub {",
	X  "\t\tgsave",
	X  "\t\t.9 setgray",
	X  "\t\t100 0 rlineto ",
	X  "\t\t0 -80 rlineto",
	X  "\t\t-100 0 rlineto",
	X  "\t\tclosepath fill",
	X  "\t\tgrestore",
	X  "\t\t100 0 rmoveto",
	X  "\t} for",
	X  "\tsubmonth 1 eq",
	X  "\t{",
	X  "\t\t/lastday 42 def",
	X  "\t\t600 -365 moveto",
	X  "\t}",
	X  "\t{",
	X  "\t\t/lastday 40 def",
	X  "\t\t400 -365 moveto",
	X  "\t} ifelse",
	X  "\tlastday -1 ndays start 1 add add",
	X  "\t{",
	X  "\t\t/day exch def",
	X  "\t\tgsave",
	X  "\t\t.9 setgray",
	X  "\t\t100 0 rlineto ",
	X  "\t\t0 -80 rlineto",
	X  "\t\t-100 0 rlineto",
	X  "\t\tclosepath fill",
	X  "\t\tgrestore",
	X  "\t\tday 7 mod 1 eq",
	X  "\t\t{",
	X  "\t\t\t600 -365 80 add moveto",
	X  "\t\t}",
	X  "\t\t{",
	X  "\t\t\t-100 0 rmoveto",
	X  "\t\t} ifelse",
	X  "\t} for",
	X  "} def",
	X  "/isleap {\t\t% is this a leap year?",
	X  "\tyear 4 mod 0 eq\t\t% multiple of 4",
	X  "\tyear 100 mod 0 ne \t% not century",
	X  "\tyear 1000 mod 0 eq or and\t% unless it's a millenia",
	X  "} def",
	X  "/days_month [ 31 28 31 30 31 30 31 31 30 31 30 31 ] def",
	X  "/ndays {\t\t% number of days in this month",
	X  "\tdays_month month 1 sub get",
	X  "\tmonth 2 eq\t% Feb",
	X  "\tisleap and",
	X  "\t{",
	X  "\t\t1 add",
	X  "\t} if",
	X  "} def",
	X  "/startday {\t\t% starting day-of-week for this month",
	X  "\t/off year 2000 sub def\t% offset from start of epoch",
	X  "\toff",
	X  "\toff 4 idiv add\t\t% number of leap years",
	X  "\toff 100 idiv sub\t% number of centuries",
	X  "\toff 1000 idiv add\t% number of millenia",
	X  "\t6 add 7 mod 7 add \t% offset from Jan 1 2000",
	X  "\t/off exch def",
	X  "\t1 1 month 1 sub {",
	X  "\t\t/idx exch def",
	X  "\t\tdays_month idx 1 sub get",
	X  "\t\tidx 2 eq",
	X  "\t\tisleap and",
	X  "\t\t{",
	X  "\t\t\t1 add",
	X  "\t\t} if",
	X  "\t\t/off exch off add def",
	X  "\t} for",
	X  "\toff 7 mod\t\t% 0--Sunday, 1--monday, etc.",
	X  "} def",
	X  "/center {\t\t% center string in given width",
	X  "\t/width exch def",
	X  "\t/str exch def width str ",
	X  "\tstringwidth pop sub 2 div 0 rmoveto str show",
	X  "} def",
	X  "/calendar",
	X  "{",
	X  "\ttitlefont findfont 48 scalefont setfont",
	X  "\t0 60 moveto",
	X  "\t/month_name month_names month 1 sub get def",
	X  "\tmonth_name show",
	X  "\t/yearstring year 10 string cvs def",
	X  "\t700 yearstring stringwidth pop sub 60 moveto",
	X  "\tyearstring show",
	X  "\t0 0 moveto",
	X  "\tdrawnums",
	X  "\t0 0 moveto",
	X  "\tdrawfill",
	X  "\t0 0 moveto",
	X  "\tdrawgrid",
	X  "} def",
	X  "/daytext {",
	X  "\t/Helvetica-Narrow findfont 6 scalefont setfont",
	X  "\t/mytext\texch def /myday exch def",
	X  "\tstartday myday 1 sub add dup 7 mod 100 mul 5 add % gives column",
	X  "\texch 7 idiv -80 mul % gives row",
	X  "\tdup /ypos exch def moveto",
	X  "\t/LM currentpoint pop def /RM LM 95 add def",
	X  "        mytext { dup (.p) eq { crlf pop} {prstr ( ) show} ifelse } forall",
	X  "} def",
	X  "/crlf {",
	X  "    ypos 8 sub /ypos exch def LM ypos moveto",
	X  "} def",
	X  "/prstr {",
	X  "    dup stringwidth pop currentpoint pop",
	X  "    add RM gt {crlf} if show",
	X  "} def",
	X  "/printmonth {",
	X  "\t90 rotate",
	X  "\t50 -120 translate",
	X  "\t/submonth 0 def",
	X  "\tcalendar",
	X  "\tmonth 1 sub 0 eq",
	X  "\t{",
	X  "\t\t/lmonth 12 def",
	X  "\t\t/lyear year 1 sub def",
	X  "\t}",
	X  "\t{",
	X  "\t\t/lmonth month 1 sub def",
	X  "\t\t/lyear year def",
	X  "\t} ifelse",
	X  "\tmonth 1 add 13 eq",
	X  "\t{",
	X  "\t\t/nmonth 1 def",
	X  "\t\t/nyear year 1 add def",
	X  "\t} ",
	X  "\t{",
	X  "\t\t/nmonth month 1 add def",
	X  "\t\t/nyear year def",
	X  "\t} ifelse",
	X  "\t/savemonth month def",
	X  "\t/saveyear year def",
	X  "\t/submonth 1 def",
	X  "\t/year lyear def",
	X  "\t/month lmonth def",
	X  "\tgsave",
	X  "\t500 -365 translate",
	X  "\tgsave",
	X  "\t.138 .138 scale",
	X  "\t10 -120 translate",
	X  "\tcalendar",
	X  "\tgrestore",
	X  "\t/submonth 1 def",
	X  "\t/year nyear def",
	X  "\t/month nmonth def",
	X  "\t100 0 translate",
	X  "\tgsave",
	X  "\t.138 .138 scale",
	X  "\t10 -120 translate",
	X  "\tcalendar",
	X  "\tgrestore",
	X  "\t/month savemonth def",
	X  "\t/year saveyear def",
	X  "\t/submonth 0 def",
	X  "\tgrestore",
	X  "} def",
	X  (char *)0,
	X};
	X
	Xprint_month(fp)
	XFILE *fp;
	X{
	X	char **ap;
	X	int i;
	X
	X	/*
	X	 * Write out PostScript prolog
	X	 */
	X	for (ap = pheader; *ap; ap++)
	X		fprintf(fp, "%s\n", *ap);
	X
	X	/*
	X	 * Do the calendar
	X	 */
	X	fprintf(fp, "/year %d def\n", current.tm_year+1900);
	X	fprintf(fp, "/month %d def\n", current.tm_mon+1);
	X	fprintf(fp, "printmonth\n");
	X
	X	First = current;
	X	current.tm_mday = 1;
	X	for (i=0; i<monthlength(current.tm_mon); i++) {
	X		fix_current_day();
	X		get_day_appts();
	X		print_mday(fp);
	X		current.tm_mday++;
	X	}
	X	current = First;
	X
	X	/*
	X	 * Write out PostScript postlog
	X	 */
	X	fprintf(fp, "showpage\n");
	X}
	X
	Xprint_mday(fp)
	XFILE *fp;
	X{
	X	int slotno, did_one=0;
	X	struct appt_entry	*aptr, *optr;
	X
	X	fprintf(fp, "%d [ \n", current.tm_mday);
	X	for (slotno=0; slotno<N_SLOTS; slotno++) {
	X		/* any appts in this timeslot? */
	X		if (slots[slotno].first) {
	X			/* get printable string from each appt */
	X			for (aptr=slots[slotno].first; aptr;) {
	X				if (did_one)
	X					fprintf(fp, "(.p)\n");
	X				fprintf(fp, "(%s)\n", format_appt_nd(aptr));
	X				did_one = 1;
	X				/* free up memory used */
	X				optr = aptr;
	X				aptr = aptr->next;
	X				free(optr);
	X			}
	X		}
	X	}
	X	fprintf(fp, " ] daytext\n");
	X}
	X#endif /* NO_PRINTER */
SHAR_EOF
if test 8249 -ne "`wc -c < 'pcal.c'`"
then
	echo shar: error transmitting "'pcal.c'" '(should have been 8249 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'month.cursor'" '(285 characters)'
if test -f 'month.cursor'
then
	echo shar: will not over-write existing file "'month.cursor'"
else
sed 's/^	X//' << \SHAR_EOF > 'month.cursor'
	X/* $Header: month.cursor,v 2.1 89/05/09 14:31:06 billr Exp $ */
	X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
	X */
	X        0x3FFC, 0x6006, 0xE007, 0x97E9, 0x8811, 0x9429, 0x9249, 0x9189,
	X        0x9189, 0x9249, 0x9429, 0x8811, 0x97E9, 0xE007, 0x6006, 0x3FFC
SHAR_EOF
if test 285 -ne "`wc -c < 'month.cursor'`"
then
	echo shar: error transmitting "'month.cursor'" '(should have been 285 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0