mcgrew@dartagnan.rutgers.edu (Charles Mcgrew) (10/20/89)
Submitted-by: Bill Randle <billr@saab.cna.tek.com> Posting-number: Volume 1, Issue 74 Archive-name: calentool/patch4c #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 4)." # Contents: patches04c pcal.c # Wrapped by billr@saab on Tue Sep 19 06:30:14 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'patches04c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patches04c'\" else echo shar: Extracting \"'patches04c'\" \(26414 characters\) sed "s/^X//" >'patches04c' <<'END_OF_FILE' X*** /tmp/,RCSt1a05582 Wed Jul 19 20:46:15 1989 X--- ras2ps.c Wed Jul 19 20:31:04 1989 X*************** X*** 1,5 X /* X! * $Header: ras2ps.c,v 2.1 89/05/09 14:19:40 billr Exp $ X */ X /* X * ras2ps - convert Sun raster file to RLL Postscript file X X--- 1,5 ----- X /* X! * $Header: ras2ps.c,v 2.2 89/07/19 20:30:25 billr Exp $ X */ X /* X * ras2ps - convert Sun raster file to RLL Postscript file X*************** X*** 91,96 X sizey = 10.0; X transx = transy = 0.5; X inv = 0; X ofile = outfile; X X if (pr_load_header(infile, &rh) != 0) X X--- 91,97 ----- X sizey = 10.0; X transx = transy = 0.5; X inv = 0; X+ rotate = 90.0; X ofile = outfile; X X if (pr_load_header(infile, &rh) != 0) X*** /tmp/,RCSt1a05587 Wed Jul 19 20:46:18 1989 X--- riseset.c Wed Jul 19 20:31:30 1989 X*************** X*** 1,5 X /* X! * $Header: riseset.c,v 2.1 89/05/09 14:19:49 billr Exp $ X */ X /* X * riseset.c X X--- 1,5 ----- X /* X! * $Header: riseset.c,v 2.2 89/07/19 20:31:05 billr Exp $ X */ X /* X * riseset.c X*************** X*** 117,123 X #ifdef LONG_DEGREES X Local = - Longitude/15.; /* Local apparent time correction */ X #else X! Local = (double)(-tzp.minuteswest * 60.); X #endif X X sprintf(riseset_buf[B_GMT], "%.24s GMT", gmctime(&UTC)); X X--- 117,123 ----- X #ifdef LONG_DEGREES X Local = - Longitude/15.; /* Local apparent time correction */ X #else X! Local = (double)(-tzp.tz_minuteswest * 60.); X #endif X X sprintf(riseset_buf[B_GMT], "%.24s GMT", gmctime(&UTC)); X*** /tmp/,RCSt1a05592 Wed Jul 19 20:46:21 1989 X--- tool.c Wed Jul 19 20:31:39 1989 X*************** X*** 1,5 X /* X! * $Header: tool.c,v 2.1 89/05/09 14:23:08 billr Exp $ X */ X /* X * tool.c X X--- 1,5 ----- X /* X! * $Header: tool.c,v 2.2 89/07/19 20:31:31 billr Exp $ X */ X /* X * tool.c X*************** X*** 29,34 X #include <sys/file.h> X #include "ct.h" X X extern struct tm current; X extern Frame frame; X extern int working_msg; X X--- 29,41 ----- X #include <sys/file.h> X #include "ct.h" X X+ /* X+ * define standard B/W monochrome colors as defaults in case we're running X+ * on a color system with the monochrome colors set differently X+ */ X+ #define FG_DEFAULT { 0, 0, 0 } /* black */ X+ #define BG_DEFAULT { 255, 255, 255 } /* white */ X+ X extern struct tm current; X extern Frame frame; X extern int working_msg; X*************** X*** 74,79 X #ifndef NO_SUN_MOON X Canvas scanvas, mcanvas; X Panel_item sdate_pi, mdate_pi; X #endif X Frame prompt_frame = 0; X Pixrect *morebutton; X X--- 81,88 ----- X #ifndef NO_SUN_MOON X Canvas scanvas, mcanvas; X Panel_item sdate_pi, mdate_pi; X+ static struct singlecolor fg_default = FG_DEFAULT; X+ static struct singlecolor bg_default = BG_DEFAULT; X #endif X Frame prompt_frame = 0; X Pixrect *morebutton; X*************** X*** 264,271 X PANEL_ITEM_Y, ATTR_ROW(2)-2, X 0); X X! next_menu = menu_create(MENU_STRINGS, X! "Tommorow", "Next Week", "Next Month", "Next Year", 0, X 0); X X next_pi = panel_create_item(panel, PANEL_BUTTON, X X--- 273,280 ----- X PANEL_ITEM_Y, ATTR_ROW(2)-2, X 0); X X! next_menu = menu_create(MENU_STRINGS, "Tomorrow", X! "Next Week", "Next Month", "Next Year", 0, X 0); X X next_pi = panel_create_item(panel, PANEL_BUTTON, X*************** X*** 445,451 X } X } else X bigfont = pf_open("/usr/lib/fonts/fixedwidthfonts/gallant.r.10"); X! /* font for displaying time under the icon */ X sfont = pf_open("/usr/lib/fonts/fixedwidthfonts/screen.r.7"); X } X X X--- 454,466 ----- X } X } else X bigfont = pf_open("/usr/lib/fonts/fixedwidthfonts/gallant.r.10"); X! /* double check */ X! if (bigfont == NULL) { X! err_rpt("unable to open large size font", NON_FATAL); X! bigfont = pw_pfsysopen(); X! } X! X! /* font for displaying time under the icon and days under moon */ X sfont = pf_open("/usr/lib/fonts/fixedwidthfonts/screen.r.7"); X } X X*************** X*** 761,766 X WIN_SHOW, TRUE, WIN_X, ATTR_COL(12), X FRAME_LABEL, "Lunar Data", X FRAME_SHOW_LABEL, TRUE, X FRAME_DONE_PROC, mframe_done, X WIN_ERROR_MSG, "Can't create moon data frame.", X 0); X X--- 776,784 ----- X WIN_SHOW, TRUE, WIN_X, ATTR_COL(12), X FRAME_LABEL, "Lunar Data", X FRAME_SHOW_LABEL, TRUE, X+ FRAME_INHERIT_COLORS, TRUE, X+ FRAME_FOREGROUND_COLOR, &fg_default, X+ FRAME_BACKGROUND_COLOR, &bg_default, X FRAME_DONE_PROC, mframe_done, X WIN_ERROR_MSG, "Can't create moon data frame.", X 0); X*** /tmp/,RCSt1a05597 Wed Jul 19 20:46:26 1989 X--- utils.c Wed Jul 19 20:32:25 1989 X*************** X*** 1,5 X /* X! * $Header: utils.c,v 2.2 89/05/16 16:30:18 billr Exp $ X */ X /* X * utils.c X X--- 1,5 ----- X /* X! * $Header: utils.c,v 2.3 89/07/19 20:31:40 billr Exp $ X */ X /* X * utils.c X*************** X*** 729,734 X /* X * Print today's appointments to stdout or mail (useful if we only have an ASCII X * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options. X */ X print_apts(level) X int level; X X--- 729,735 ----- X /* X * Print today's appointments to stdout or mail (useful if we only have an ASCII X * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options. X+ * Month information is only printed as PostScript output. X */ X print_apts(which, dest) X int which, dest; X*************** X*** 730,737 X * Print today's appointments to stdout or mail (useful if we only have an ASCII X * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options. X */ X! print_apts(level) X! int level; X { X int i; X FILE *output, *popen(); X X--- 731,738 ----- X * terminal connected to our Sun). Invoked by the "-p", "-P" or "-m" options. X * Month information is only printed as PostScript output. X */ X! print_apts(which, dest) X! int which, dest; X { X int i; X FILE *output, *pfp, *popen(); X*************** X*** 734,742 X int level; X { X int i; X! FILE *output, *popen(); X! char cmd[80], *name, *cuserid(), *format_appt(); X! struct appt_entry tmp_apt, *sptr; X X fix_current_day(); X get_day_appts(); X X--- 735,742 ----- X int which, dest; X { X int i; X! FILE *output, *pfp, *popen(); X! char cmd[80], *name, *cuserid(); X X if (dest == DST_MAIL) X /* only mail one day's appts */ X*************** X*** 738,743 X char cmd[80], *name, *cuserid(), *format_appt(); X struct appt_entry tmp_apt, *sptr; X X fix_current_day(); X get_day_appts(); X if (level == 2) { X X--- 738,746 ----- X FILE *output, *pfp, *popen(); X char cmd[80], *name, *cuserid(); X X+ if (dest == DST_MAIL) X+ /* only mail one day's appts */ X+ which = PRI_DAY; X fix_current_day(); X if ((which == PRI_DAY) && !get_day_appts()) X return; /* nothing to show */ X*************** X*** 739,746 X struct appt_entry tmp_apt, *sptr; X X fix_current_day(); X! get_day_appts(); X! if (level == 2) { X if (mailto != NULL) { X name = mailto; X } else if ((name = cuserid(NULL)) == NULL) { X X--- 742,750 ----- X /* only mail one day's appts */ X which = PRI_DAY; X fix_current_day(); X! if ((which == PRI_DAY) && !get_day_appts()) X! return; /* nothing to show */ X! if (dest == DST_MAIL) { X if (mailto != NULL) { X name = mailto; X } else if ((name = cuserid(NULL)) == NULL) { X*************** X*** 753,759 X output = stdout; X } X X! fprintf(output,"\n\t*** Appointments for %s %s %d, 19%02d ***\n\n", X daynames[current.tm_wday], monthnames[current.tm_mon], X current.tm_mday, current.tm_year); X X X--- 757,794 ----- X output = stdout; X } X X! if (which == PRI_DAY || which == PRI_DAY_XNOTES) { X! print_one_day(which, output); X! } else if (which == PRI_WEEK || which == PRI_WEEK_XNOTES) { X! current.tm_mday -= current.tm_wday; /* Sunday of this week */ X! fix_current_day(); X! if (nr_weekdays < 7) { X! current.tm_mday++; X! fix_current_day(); X! } X! for (i=0;i<nr_weekdays;i++) { X! if (get_day_appts()) X! print_one_day(which, output); X! current.tm_mday++; X! fix_current_day(); X! } X! } else if (which == PRI_MONTH || which == PRI_MONTH_XNOTES) { X! print_month(output, (which == PRI_MONTH_XNOTES ? TRUE : FALSE)); X! } X! fflush(output); X! if (dest == DST_MAIL) X! pclose(output); X! } X! X! print_one_day(which, output) X! int which; X! FILE *output; X! { X! int i; X! struct appt_entry tmp_apt; X! char *format_appt(); X! X! fprintf(output,"\n\t*** Appointments for %s %s %d, %d ***\n\n", X daynames[current.tm_wday], monthnames[current.tm_mon], X current.tm_mday, current.tm_year+1900); X X*************** X*** 755,762 X X fprintf(output,"\n\t*** Appointments for %s %s %d, 19%02d ***\n\n", X daynames[current.tm_wday], monthnames[current.tm_mon], X! current.tm_mday, current.tm_year); X! X for (i=0; i<N_SLOTS; i++) { X if (i == n_tslots) X /* start of notes section */ X X--- 790,797 ----- X X fprintf(output,"\n\t*** Appointments for %s %s %d, %d ***\n\n", X daynames[current.tm_wday], monthnames[current.tm_mon], X! current.tm_mday, current.tm_year+1900); X! X for (i=0; i<N_SLOTS; i++) { X if (i == n_tslots) X /* start of notes section */ X*************** X*** 765,771 X /* at least one appt here */ X slots[i].cur_appt = slots[i].first; X do { X! if (level == 3 && ((slots[i].cur_appt->flags & MARKED_NOTE) == MARKED_NOTE)) X continue; X if (chk_deleted(i)) X continue; X X--- 800,806 ----- X /* at least one appt here */ X slots[i].cur_appt = slots[i].first; X do { X! if ((which & PRI_XNOTES) && ((slots[i].cur_appt->flags & MARKED_NOTE) == MARKED_NOTE)) X continue; X if (chk_deleted(i)) X continue; X*************** X*** 783,791 X for (i=0; i<findex; i++) X fprintf(output, "%s\n", format_appt(&future[i])); X } X- fflush(output); X- if (level == 2) X- pclose(output); X } X X /* X X--- 818,823 ----- X for (i=0; i<findex; i++) X fprintf(output, "%s\n", format_appt(&future[i])); X } X } X X /* X*************** X*** 989,994 X X /* X * convert appt entry to ASCII string for display with time and msg X */ X char * X format_appt_nd(appt) X X--- 1021,1027 ----- X X /* X * convert appt entry to ASCII string for display with time and msg X+ * if <esc_parens> is true then put '\' in front of parens (for Ps) X */ X char * X format_appt_nd(appt, esc_parens) X*************** X*** 991,997 X * convert appt entry to ASCII string for display with time and msg X */ X char * X! format_appt_nd(appt) X struct appt_entry *appt; X { X int e_hour, e_minutes, duration; X X--- 1024,1030 ----- X * if <esc_parens> is true then put '\' in front of parens (for Ps) X */ X char * X! format_appt_nd(appt, esc_parens) X struct appt_entry *appt; X int esc_parens; X { X*************** X*** 993,998 X char * X format_appt_nd(appt) X struct appt_entry *appt; X { X int e_hour, e_minutes, duration; X struct tm Save; X X--- 1026,1032 ----- X char * X format_appt_nd(appt, esc_parens) X struct appt_entry *appt; X+ int esc_parens; X { X int e_hour, e_minutes, duration; X char *p, *q; X*************** X*** 995,1000 X struct appt_entry *appt; X { X int e_hour, e_minutes, duration; X struct tm Save; X X if (appt->arrows > 0) { X X--- 1029,1035 ----- X int esc_parens; X { X int e_hour, e_minutes, duration; X+ char *p, *q; X struct tm Save; X X if (appt->arrows > 0) { X*************** X*** 1010,1019 X ++e_hour; X } X X! if (appt->flags & A_NOTE) { X! /* note */ X! sprintf(strbuf,"%s", appt->str); X! } else X /* standard appointment */ X sprintf(strbuf,"%2d:%02d to %2d:%02d %s", X appt->hour, appt->minute, e_hour, e_minutes, appt->str); X X--- 1045,1052 ----- X ++e_hour; X } X X! strbuf[0] = '\0'; X! if (!(appt->flags & A_NOTE)) X /* standard appointment */ X sprintf(strbuf,"%2d:%02d to %2d:%02d ", X appt->hour, appt->minute, e_hour, e_minutes); X*************** X*** 1015,1022 X sprintf(strbuf,"%s", appt->str); X } else X /* standard appointment */ X! sprintf(strbuf,"%2d:%02d to %2d:%02d %s", X! appt->hour, appt->minute, e_hour, e_minutes, appt->str); X X return(strbuf); X } X X--- 1048,1077 ----- X strbuf[0] = '\0'; X if (!(appt->flags & A_NOTE)) X /* standard appointment */ X! sprintf(strbuf,"%2d:%02d to %2d:%02d ", X! appt->hour, appt->minute, e_hour, e_minutes); X! p = appt->str; X! q = strbuf + strlen(strbuf); X! while (*p) { X! if (esc_parens) X! switch (*p) { X! /* ignore these */ X! case '\b': X! case '\f': X! case '\n': X! case '\r': X! case '\t': X! break; X! /* escape these for PostScript */ X! case '\\': X! case '(': X! case ')': X! *q++ = '\\'; X! break; X! } X! *q++ = *p++; X! } X! *q = '\0'; X X return(strbuf); X } X*************** X*** 1150,1156 X } else X err_rpt("can't open tmp ps file", NON_FATAL); X } else { X! sprintf(prntcmd, "%s %s", printer, rasfile); X system(prntcmd); X } X pr_destroy(save_pr); X X--- 1205,1211 ----- X } else X err_rpt("can't open tmp ps file", NON_FATAL); X } else { X! sprintf(prntcmd, "%s -v %s", printer, rasfile); X system(prntcmd); X } X pr_destroy(save_pr); X*************** X*** 1162,1168 X err_rpt("only PostScript output available for month printout", NON_FATAL); X } else { X if ((pfp = fopen(psfile, "w")) != NULL) { X! print_month(pfp); X fclose(pfp); X sprintf(prntcmd, "%s %s", printer, psfile); X system(prntcmd); X X--- 1217,1223 ----- X err_rpt("only PostScript output available for month printout", NON_FATAL); X } else { X if ((pfp = fopen(psfile, "w")) != NULL) { X! print_month(pfp, FALSE); X fclose(pfp); X sprintf(prntcmd, "%s %s", printer, psfile); X system(prntcmd); X*** /tmp/,RCSt1a06124 Tue Sep 19 06:10:02 1989 X--- version.c Tue Sep 19 06:09:35 1989 X*************** X*** 1,5 X /* X! * $Header: version.c,v 2.3 89/05/16 16:31:58 billr Exp $ X */ X /* X * version.c - current version of calentool program X X--- 1,5 ----- X /* X! * $Header: version.c,v 2.5 89/09/19 06:09:07 billr Exp $ X */ X /* X * version.c - current version of calentool program X*************** X*** 24,27 X * notice remains intact. X */ X X! char version[] = "Calendar Tool V2.1p2"; X X--- 24,27 ----- X * notice remains intact. X */ X X! char version[] = "Calendar Tool V2.1p4"; X*** /tmp/,RCSt1a05609 Wed Jul 19 20:46:32 1989 X--- wpaint.c Wed Jul 19 20:32:47 1989 X*************** X*** 1,5 X /* X! * $Header: wpaint.c,v 2.1 89/05/09 14:20:03 billr Exp $ X */ X /* X * wpaint.c X X--- 1,5 ----- X /* X! * $Header: wpaint.c,v 2.2 89/07/19 20:32:38 billr Exp $ X */ X /* X * wpaint.c X*************** X*** 69,75 X draw_week_appts(); X pw_batch_off(main_pixwin); X current = Save; X! get_day_appts(); X working(FALSE); X unlock_cursors(); X } X X--- 69,75 ----- X draw_week_appts(); X pw_batch_off(main_pixwin); X current = Save; X! (void)get_day_appts(); X working(FALSE); X unlock_cursors(); X } X*** /tmp/,RCSt1a05614 Wed Jul 19 20:46:33 1989 X--- Makefile Wed Jul 19 20:33:12 1989 X*************** X*** 1,4 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) X BINDIR = /usr/local/bin X X--- 1,4 ----- X! # $Header: Makefile,v 2.2 89/07/19 20:32:48 billr Exp $ X # X #DATELIB_DIR Directory containing the Date Library X #PRINT_CMD Command to send postscript to appropriate printer X*************** X*** 1,5 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) X BINDIR = /usr/local/bin X LIBDIR = /usr/local/lib/calentool X X--- 1,25 ----- X # $Header: Makefile,v 2.2 89/07/19 20:32:48 billr Exp $ X # X+ #DATELIB_DIR Directory containing the Date Library X+ #PRINT_CMD Command to send postscript to appropriate printer X+ #NR_WEEKDAYS Define to number of days in week to display (5-7) X+ #START_HOUR What is first hour of day to display X+ #END_HOUR What is last hour of day to display X+ #START_YEAR What is first year of calendar to display X+ #NR_YEARS How many years to display. X+ #UPDATE_RATE How often to perform updates (second or minute)? X+ #APPT_CHECK_LIMIT What limits to check for appointments (see ct.h) X+ # X+ #NO_PRINTER No printing is supported X+ #RASTER_ONLY Define if no PostScript printer available. X+ #NO_HOLIDAYS No holiday display is supported X+ #NO_SUN_MOON No sun and moon phase info is supported X+ # X+ #BINDIR Where to install binaries X+ #LIBDIR Where to install date files and utility binaries X+ #MANDIR Where to install man pages X+ #DEFSDIR Where to install calentool default values X+ # X # make sure LIBDIR here matches DATELIB_DIR in ct.h (or use -D) X BINDIR = /usr/local/bin X LIBDIR = /usr/local/lib/calentool X*************** X*** 7,12 X DEFSDIR = /usr/lib/defaults X MANEXT = l X X DEFINES= #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88 X CFLAGS= -O ${DEFINES} X LIBS= -lsuntool -lsunwindow -lpixrect -lm X X--- 27,33 ----- X DEFSDIR = /usr/lib/defaults X MANEXT = l X X+ CC = cc X DEFINES= #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88 X CFLAGS= -g ${DEFINES} X LIBS= -lsuntool -lsunwindow -lpixrect -lm X*************** X*** 8,14 X MANEXT = l X X DEFINES= #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88 X! CFLAGS= -O ${DEFINES} X LIBS= -lsuntool -lsunwindow -lpixrect -lm X X DATEFILES= dates/README dates/celtic dates/events dates/lives\ X X--- 29,35 ----- X X CC = cc X DEFINES= #-DDATELIB_DIR=\"./dates\" -DSTART_HOUR=7 -DEND_HOUR=19 -DSTART_YEAR=88 X! CFLAGS= -g ${DEFINES} X LIBS= -lsuntool -lsunwindow -lpixrect -lm X X DATEFILES= dates/README dates/celtic dates/computing dates/events\ X*************** X*** 11,19 X CFLAGS= -O ${DEFINES} X LIBS= -lsuntool -lsunwindow -lpixrect -lm X X! DATEFILES= 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 X SRCS= 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 X X--- 32,41 ----- X CFLAGS= -g ${DEFINES} X LIBS= -lsuntool -lsunwindow -lpixrect -lm X X! DATEFILES= dates/README dates/celtic dates/computing dates/events\ X! dates/lives dates/lotr dates/nature dates/popcult\ X! dates/usa_holiday dates/usa_other dates/usa_states dates/world\ X! dates/gdead dates/space X SRCS= calentool.c datelib.o devent.c dpaint.c event.c holidays.c\ X init.c moon.c mpaint.c notify.c pcal.c ras2ps.c riseset.c tool.c utils.c\ X version.c wevent.c wpaint.c ypaint.c X*************** X*** 15,21 X dates/lotr dates/nature dates/popcult\ X dates/usa_holiday dates/usa_other dates/usa_states dates/world X SRCS= 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 X INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h X OBJS= calentool.o datelib.o devent.o dpaint.o event.o holidays.o\ X X--- 37,43 ----- X dates/usa_holiday dates/usa_other dates/usa_states dates/world\ X dates/gdead dates/space X SRCS= calentool.c datelib.o devent.c dpaint.c event.c holidays.c\ X! init.c moon.c mpaint.c notify.c pcal.c ras2ps.c riseset.c tool.c utils.c\ X version.c wevent.c wpaint.c ypaint.c X INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h X OBJS= calentool.o datelib.o devent.o dpaint.o event.o holidays.o\ X*************** X*** 19,25 X version.c wevent.c wpaint.c ypaint.c X INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h X OBJS= 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 X X all: calentool conv_tools X X--- 41,47 ----- X version.c wevent.c wpaint.c ypaint.c X INCLUDES= ct.h event.h paint.h patchlevel.h riseset.h X OBJS= calentool.o datelib.o devent.o dpaint.o event.o holidays.o\ X! init.o moon.o mpaint.o notify.o pcal.o ras2ps.o riseset.o tool.o utils.o\ X version.o wevent.o wpaint.o ypaint.o X X all: calentool conv_tools X*************** X*** 26,32 X X # the main program X calentool: ${OBJS} X! cc ${CFLAGS} -o calentool ${OBJS} ${LIBS} X X calentool.o: calentool.c ct.h std.icon rev.icon nap.icon X datelib.o: datelib.c X X--- 48,54 ----- X X # the main program X calentool: ${OBJS} X! ${CC} ${CFLAGS} -o calentool ${OBJS} ${LIBS} X X calentool.o: calentool.c ct.h std.icon rev.icon nap.icon X datelib.o: datelib.c X*************** X*** 38,43 X mpaint.o: mpaint.c ct.h paint.h X notify.o: notify.c ct.h X event.o: event.c ct.h event.h X ras2ps.o: ras2ps.c X riseset.o: riseset.h X tool.o: tool.c ct.h X X--- 60,66 ----- X mpaint.o: mpaint.c ct.h paint.h X notify.o: notify.c ct.h X event.o: event.c ct.h event.h X+ pcal.o: pcal.c ct.h X ras2ps.o: ras2ps.c X riseset.o: riseset.h X tool.o: tool.c ct.h X*************** X*** 69,76 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 X clean: X rm -f *.o *.BAK core X X--- 92,103 ----- X install -s month2ct ${LIBDIR} X install -s mt2ct ${LIBDIR} X install -c -m 444 mt2ct.1 ${MANDIR}/mt2ct.${MANEXT} X! cd ${MANDIR}; \ X! rm -f cal2ct.${MANEXT}; \ X! ln -s mt2ct.${MANEXT} cal2ct.${MANEXT}; X! cd ${MANDIR}; \ X! rm -f month2ct.${MANEXT}; \ X! ln -s mt2ct.${MANEXT} month2ct.${MANEXT}; X X clean: X rm -f *.o *.BAK core *~ #*# X*************** X*** 73,77 X cd ${MANDIR}; ln -s mt2ct.${MANEXT} month2ct.${MANEXT}; X X clean: X! rm -f *.o *.BAK core X X X--- 100,106 ----- X ln -s mt2ct.${MANEXT} month2ct.${MANEXT}; X X clean: X! rm -f *.o *.BAK core *~ #*# X X veryclean: X rm -f calentool cal2ct month2ct mt2ct *.o *.BAK core *~ #*# X*************** X*** 75,77 X clean: X rm -f *.o *.BAK core X X X--- 102,112 ----- X clean: X rm -f *.o *.BAK core *~ #*# X X+ veryclean: X+ rm -f calentool cal2ct month2ct mt2ct *.o *.BAK core *~ #*# X+ X+ # If you are using GNU make, the following statement will cause it to X+ # ignore any (bogus) files named `clean', `all', etc.; if you are using X+ # the standard Sun or bsd make, it won't hurt anything... X+ # X+ .PHONY: clean veryclean install all X*** /tmp/,RCSt1a18697 Fri Aug 11 07:44:25 1989 X--- Bugs Fri Aug 11 07:42:31 1989 X*************** X*** 7,12 X 2) Arrow display messes up on rare occasions. I haven't duplicated X this often enough to track down. X X X If you fix any of these, or spot other bugs, please let me know. X X X--- 7,15 ----- X 2) Arrow display messes up on rare occasions. I haven't duplicated X this often enough to track down. X X+ The following bugs have been reported by various users, but I haven't X+ been able to fix them, since I haven't been able to duplicate them X+ (usually due to hardware/os combinations I don't have access to). X X *Calentool dies (seg fault) after running overnight with lockscreen <mfeblowitz@ge.com> X *Core dump when clicking MS-MIDDLE button on note section on 386i <jmc@ptsfa.pacbell.com> X*************** X*** 8,13 X this often enough to track down. X X X If you fix any of these, or spot other bugs, please let me know. X X Bill Randle X X--- 11,23 ----- X been able to fix them, since I haven't been able to duplicate them X (usually due to hardware/os combinations I don't have access to). X X+ *Calentool dies (seg fault) after running overnight with lockscreen <mfeblowitz@ge.com> X+ *Core dump when clicking MS-MIDDLE button on note section on 386i <jmc@ptsfa.pacbell.com> X+ *Memory leakage <vicorp!sparky!scott@uunet.uu.net> X+ *Popup error window only gets partially displayed (OS 4.0.3/Sun3) <rohit@sun.com> X+ ?Deleting single occurrance of multiple meeting doesn't really delete it <ecm@aloft.uucp> X+ ?Running calentool forces icon gravity change on 386i <lwv27%chemabs@cis.ohio-state.edu> X+ X If you fix any of these, or spot other bugs, please let me know. X X Bill Randle X*************** X*** 13,16 X Bill Randle X billr@saab.CNA.TEK.COM X {most backbones}!tektronix!saab.CNA.TEK!billr X! May 10, 1989 X X--- 23,26 ----- X Bill Randle X billr@saab.CNA.TEK.COM X {most backbones}!tektronix!saab.CNA.TEK!billr X! August 11, 1989 X*** /tmp/,RCSt1a18717 Fri Aug 11 07:48:18 1989 X--- ToDo Fri Aug 11 07:42:50 1989 X*************** X*** 4,6 X View2 may be the way to do this. X X 2) Add Lunar based (e.g. Chinese, Japanese) holidays. X X--- 4,39 ----- X View2 may be the way to do this. X X 2) Add Lunar based (e.g. Chinese, Japanese) holidays. X+ X+ 3) Add calculations for more astronomical events. X+ X+ 4) Convert display canvas to scrollable canvas to allow longer X+ time periods. X+ X+ 5) Extend next and previous menus. X+ X+ 3, 4 and 5, at least, will be in version 2.2.... X+ X+ The following feature enhancements have been suggested by various X+ users. Some of these may appear in version 2.2, some may not. Feel X+ free to send me your suggestions, or to vote on the ones listed X+ here. X+ X+ =Add menu to Filename: option, add flags to #include directive to X+ indicate a)if name should appear in Filename: menu, b) read/write X+ default, c) string to appear in Filename: menu; <jcn@neptune.uucp> X+ =Long months don't fit on year listing <mcneill%eplrx7@uunet.uu.net>, <rwolff@noao.edu> X+ =Want Next and Previous menus to display multiple date selections < X+ =Want Quit and Close buttons <phil@grumpy.cgrg.ohio-state.edu>, <mcneill%eplrx7@uunet.uu.net>, <rohit@sun.com> X+ =Want command line option to set start and end time <brooks@ge-dab.ge.com> X+ =Want easy switch between different users appts <ptraynor@bbn.com> X+ =Want long days (really scrollable day) <syd@dsi.com> X+ =Want range of dates for printing <ian@sq.com> X+ =Want to be able to set START_HOUR > END_HOUR <sga@dip.eecs.umich.edu> X+ =Want to come up in week display <bob@boulder.colorado.edu> X+ =Want to order the notes (i.e. pick which is displayed first) <dna@emmy.umd.edu> X+ =Want to see two days at a time <rohit@sun.com> X+ =Want to set duration of an appointment (e.g. gone for 4 days) <jeremy@kheops.cmi.no> X+ =Want to start arbitrary process at appt time <wyle@inf.ethz.ch> X+ =Want week display to show current day at left, then next 5-7 days <bob@boulder.colorado.edu> X+ =Want window to open when appt time approaches <rohit@sun.com> END_OF_FILE if test 26414 -ne `wc -c <'patches04c'`; then echo shar: \"'patches04c'\" unpacked with wrong size! fi # end of 'patches04c' fi if test -f 'pcal.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'pcal.c'\" else echo shar: Extracting \"'pcal.c'\" \(14965 characters\) sed "s/^X//" >'pcal.c' <<'END_OF_FILE' X/* X * $Header: pcal.c,v 2.3 89/09/19 05:59:27 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 * Modified by PM Lashley, KLA Instruments, Inc. X * Fixes and extentions: 1..2 June, 1989 X * 1. Notes were extending beyond the right and bottom edges of the day. X * They are now line-wrapped with indentation. X * 3. Bottom justify notes for each day. Truncate if there are too many X * to fit. X * 3. If month starts on a Wednesday or later, put the previous/next X * month inserts in the first two day boxes instead of the last two. X * 4. Center the month inserts vertically in the day box. X * 5. When possible, draw the calendar in a 5x7 grid instead of a 6x7 X * grid. Each day will be taller, and accomodate more note text. X * 6. Added various comments to the Postscript code array. X * 7. If a periodic event was removed for given occurance, that event X * would be printed twice when it should not be printed at all. X * 8. Replaced the constant "Helvetica-Narrow" with PS_NOTE_FONT for X * sites which do not have the Helvetica-Narrow font but do have X * some preference other than the default. X * X * Left to do: X * 1. If a 31 day month starts on Tuesday, the previous month should X * be in the upper left, and the next month in the lower right. X * This may be more trouble than it is worth. X * X * Notes: X * 1. The Postscript code layout is a compromise between readability X * and compaction. All comments and vertical spacing are in the X * c source only to keep the output file size small. X * X * Further changes and additions Copyright (C) 1989 PM Lashley 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 */ X#include "ct.h" X X#include <stdio.h> X#include <time.h> X Xextern struct tm current, First; Xextern struct dayslot slots[]; Xextern int get_day_appts(); X X/* X * pheader - provides the PostScript routines X */ Xchar *pheader[] = { X "%!", X "%%Creator: Pipeline Associates", X "%%Title: calentool's month-at-a-glance", X "%%Modifed: Ken Keirnan, Bill Randle, PM Lashley and Richard Wolff", X "%%DocumentFonts: Times-Bold Helvetica-Bold Helvetica-Narrow", X "%%Pages: 1", X "%%EndComments", X "/titlefont /Times-Bold def", X "/dayfont /Helvetica-Bold def", X "/month_names [ (January) (February) (March) (April) (May) (June) (July)", X " (August) (September) (October) (November) (December) ] def", X "/prtnum { 3 string cvs show} def", X /* X * - -weeks- int X * X * Pushes the number of week lines (rows) necessary for the current month. X */ X "/weeks {", X " startday ndays add 35 gt { 6 } { 5 } ifelse", X "} def", X X /* X * - -monthHeight- int X * X * Pushes the height of an individual day box for the current month. X */ X "/monthHeight { weeks 5 eq { 96 } { 80 } ifelse } def", X X /* X * Draw the day names and the grid for the current month X */ X "/drawgrid {", X " dayfont findfont 10 scalefont setfont", X " 0 1 6 {", X " dup dup 100 mul 40 moveto", X " [ (Sunday) (Monday) (Tuesday) (Wednesday)", X " (Thursday) (Friday) (Saturday) ]", X " exch get", X " 100 center", X " 100 mul 35 moveto", X " 1.0 setlinewidth", X " 0 1 weeks 1 sub {", X " gsave", X " 100 0 rlineto", X " 0 monthHeight neg rlineto", X " -100 0 rlineto", X " closepath stroke", X " grestore", X " 0 monthHeight neg rmoveto", X " } for", X " } for", X "} def", X X /* X * Draw in the day numbers for each day of the current month. X * X * Sunday (and possibly Saturday) will be gray. X */ X "/drawnums {", X " dayfont findfont 30 scalefont setfont", X " /start startday def", X " /days ndays def", X " start 100 mul 5 add 10 rmoveto", X " 1 1 days {", X " /day exch def", X " gsave", X#ifndef SATBLK X " day start add 7 mod 0 eq {", X " submonth 0 eq { .8 setgray } if", X " } if", X#endif X " day start add 7 mod 1 eq {", X " submonth 0 eq { .8 setgray } if", X " } if", X " day prtnum", X " grestore", X " day start add 7 mod 0 eq", X " { currentpoint exch pop monthHeight sub 5 exch moveto }", X " { 100 0 rmoveto }", X " ifelse", X " } for", X "} def", X X /* X * Gray out the day boxes before the first day of the month and after X * the last day of the month. If this is not a submonth, leave two X * blank for the previous and next month miniature calendars. X */ X "/drawfill {", X " /start startday def", X " 1.0 setlinewidth", X " submonth 1 eq {", X " 0 35 rmoveto", X " /grayWidth start 100 mul def", X " /lastday 7 def", X " } {", X " start 3 ge {", X " 200 35 rmoveto", X " /grayWidth start 2 sub 100 mul def", X " /lastday 7 def", X " } {", X " 0 35 rmoveto", X " /grayWidth start 100 mul def", X " /lastday 5 def", X " } ifelse", X " } ifelse", X " grayWidth 0 gt {", X " gsave", X " .9 setgray", X " grayWidth 0 rlineto", X " 0 monthHeight neg rlineto", X " grayWidth neg 0 rlineto", X " closepath fill", X " grestore", X " } if", X " /endday startday ndays add 7 mod def", X " endday 0 ne {", X " ndays startday add 7 mod 100 mul", X " weeks 1 sub neg monthHeight mul 35 add moveto", X " /grayWidth lastday 100 mul currentpoint pop sub def", X " grayWidth 0 gt {", X " gsave", X " .9 setgray", X " grayWidth 0 rlineto", X " 0 monthHeight neg rlineto", X " grayWidth neg 0 rlineto", X " closepath fill", X " grestore", X " } if", X " } if", X "} def", X X "/isleap {", X " year 4 mod 0 eq", X " year 100 mod 0 ne", X " year 1000 mod 0 eq or and", X "} def", X X "/days_month [ 31 28 31 30 31 30 31 31 30 31 30 31 ] def", X X /* X * - -ndays- int X * X * Push number of days in current month. Account for leap February. X */ X "/ndays {", X " days_month month 1 sub get", X " month 2 eq", X " isleap and { 1 add } if", X "} def", X X /* X * - -startday- int X * X * Push the day of the week on which the first of the current month falls. X */ X "/startday {", X " /off year 2000 sub def", X " off", X " off 4 idiv add", X " off 100 idiv sub", X " off 1000 idiv add", X " 6 add 7 mod 7 add", X " /off exch def", X " 1 1 month 1 sub {", X " /idx exch def", X " days_month idx 1 sub get", X " idx 2 eq", X " isleap and", X " { 1 add } if", X " /off exch off add def", X " } for", X " off 7 mod", X "} def", X X "/center {", X " /width exch def", X " /str exch def width str ", X " stringwidth pop sub 2 div 0 rmoveto str show", X "} def", X X /* X * Draw an entire month calendar. X * (Without any previous/next subcalendars.) X */ X "/calendar", X "{", X " titlefont findfont 48 scalefont setfont", X " 0 60 moveto", X " /month_name month_names month 1 sub get def", X " month_name show", X " /yearstring year 10 string cvs def", X " 700 yearstring stringwidth pop sub 60 moveto", X " yearstring show", X " 0 0 moveto", X " drawnums", X " 0 0 moveto", X " drawfill", X " 0 0 moveto", X " drawgrid", X "} def", X X /* X * array-of-notes -daytext- - X */ X "/daytext {", X " /mytext exch def /myday exch def", X " /bottom monthHeight 30 sub def", X " startday myday 1 sub add dup", X " 7 mod 100 mul 5 add /LM exch def", X " 7 idiv monthHeight neg mul /ylimit exch def", X " ylimit bottom sub /ypos exch def", X " /RM LM 95 add def /ystart ypos def", X " mytext {", X " 95 90 { pop pop /ystart ystart 8 add def } breakIntoLines", X " ystart ylimit le { /ypos ystart def } if", X " } forall", X " /ylimit ylimit bottom sub def", X " mytext { 95 90 { prstr } breakIntoLines } forall", X "} def", X X /* X * string maxwidth -prstr- - X */ X "/prstr {", X " ypos ylimit gt {", X " RM exch sub ypos moveto show", X " /ypos ypos 8 sub def", X " } {", X " pop pop", X " } ifelse", X "} def", X X /* X * Word break string for breakIntoLines. X */ X "/space ( ) def", X X /* X * string first-width next-width proc -breakIntoLines- - X * X * Break the string into lines. The first line will fit within X * first-width. Later lines will fit within next-width. For each X * line, push the string and current width then execute proc. X * X * This is a modification of the function listed in the Blue book X * (Postscript Language Tutorial and Cookbook, Adobe Systems, Inc.). X * The modifications are: X * 1. The addition of the next-width parameter to handle indentation. X * 2. The original would not break the line if only the last word X * extended beyond the limit. X */ X "/breakIntoLines {", X " /proc exch def", X " /nextlinewidth exch def", X " /linewidth exch def", X " /textstring exch def", X " /breakwidth space stringwidth pop def", X " /curwidth 0 def", X " /lastwordbreak 0 def", X " /startchar 0 def", X " /restoftext textstring def", X " {", X " restoftext space search {", X " /nextword exch def pop", X " /restoftext exch def", X " /wordwidth nextword stringwidth pop def", X " curwidth wordwidth add linewidth gt {", X " textstring startchar", X " lastwordbreak startchar sub", X " getinterval linewidth proc", X " /startchar lastwordbreak def", X " /curwidth wordwidth breakwidth add def", X " /linewidth nextlinewidth def", X " } {", X " /curwidth curwidth wordwidth add breakwidth add def", X " } ifelse", X " /lastwordbreak lastwordbreak nextword length add 1 add def", X " } {", X " stringwidth pop curwidth add linewidth gt {", X " textstring startchar", X " lastwordbreak startchar sub", X " getinterval linewidth proc", X " /startchar lastwordbreak def", X " /linewidth nextlinewidth def", X " } if", X " exit", X " }", X " ifelse", X " } loop", X " /lastchar textstring length def", X " textstring startchar lastchar startchar sub getinterval linewidth proc", X "} def", X X "/printmonth {", X " 90 rotate", X " 50 -120 translate", X " /submonth 0 def", X " calendar", X " month 1 sub 0 eq {", X " /lmonth 12 def", X " /lyear year 1 sub def", X " } {", X " /lmonth month 1 sub def", X " /lyear year def", X " } ifelse", X " month 1 add 13 eq {", X " /nmonth 1 def", X " /nyear year 1 add def", X " } {", X " /nmonth month 1 add def", X " /nyear year def", X " } ifelse", X " /savemonth month def", X " /saveyear year def", X " /submonth 1 def", X " gsave", X " /offset monthHeight 80 sub 2 div neg 35 add def", X " startday 3 lt", X " { 500 weeks 1 sub neg monthHeight mul offset add translate }", X " { 0 offset translate }", X " ifelse", X " /year lyear def", X " /month lmonth def", X " gsave", X " .138 .138 scale", X " 10 -120 translate", X " calendar", X " grestore", X " /submonth 1 def", X " /year nyear def", X " /month nmonth def", X " 100 0 translate", X " gsave", X " .138 .138 scale", X " 10 -120 translate", X " calendar", X " grestore", X " /month savemonth def", X " /year saveyear def", X " /submonth 0 def", X " grestore", X "} def", X (char *)0, X}; X Xprint_month(fp, noteflag) XFILE *fp; Xint noteflag; X{ X char **ap; X int i; X 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 /* X * Set the font here to reduce the number of complainings if X * it is not found. X */ X fprintf (fp, "/%s findfont 6 scalefont setfont\n", PS_NOTE_FONT); X X First = current; X current.tm_mday = 1; X for (i=0; i<monthlength(current.tm_mon); i++) { X fix_current_day(); X (void)get_day_appts(); X print_mday(fp, noteflag); 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, noteflag) XFILE *fp; Xint noteflag; X{ X int slotno; X struct appt_entry *aptr, *optr; X X fprintf(fp, "%d [\n", current.tm_mday); X X for (slotno=0; slotno<N_SLOTS; slotno++) { X /* any appts in this timeslot? */ X if ((slots[slotno].active == ACTIVE) && slots[slotno].first) { X /* get printable string from each appt */ X for (aptr=slots[slotno].first; aptr;) { X if (!deleted(aptr, slotno) && X (!noteflag || ((aptr->flags & MARKED_NOTE) != MARKED_NOTE))) X fprintf(fp, " (%s)\n", format_appt_nd(aptr, TRUE)); 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 X/* check to see if appt pointed to by ap has been deleted */ Xint Xdeleted(ap, bi) Xstruct appt_entry *ap; Xint bi; X{ X int found = 0; X struct appt_entry *a; X X if (ap->flags & DELETED) X return(1); X X /* run through the list to see if there are any deleted */ X for (a=slots[bi].first; a; a=a->next) X if (a->flags & DELETED) { X /* now see if the current one matches */ X if (!strcmp(a->str, ap->str)) X return(1); X } X X return(0); X} END_OF_FILE if test 14965 -ne `wc -c <'pcal.c'`; then echo shar: \"'pcal.c'\" unpacked with wrong size! fi # end of 'pcal.c' fi echo shar: End of archive 3 \(of 4\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0