Path: utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!sun-barr!newstop!exodus!hillside.co.uk From: pc@hillside.co.uk (Peter Collinson) Newsgroups: comp.sources.x Subject: v10i099: xcal, Part01/03 Message-ID: Date: 29 Dec 90 22:54:22 GMT Sender: news@exodus.Eng.Sun.COM Lines: 2103 Approved: argv@sun.com Submitted-by: Peter Collinson Posting-number: Volume 10, Issue 99 Archive-name: xcal/part01 This unpacks into the current directory. For details see the README and CHANGES files - just discernable below.. #! /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: # README # CHANGES # Imakefile # Makefile # XCal.ad # mouse.bm # mouseaway.bm # patchlevel.h # pscal # version.c # xcal.h # scott_brim # This archive created: Tue Dec 18 21:16:13 1990 export PATH; PATH=/bin:$PATH echo shar: extracting "'README'" '(1983 characters)' if test -f 'README' then echo shar: will not over-write existing file "'README'" else sed 's/^ X//' << \SHAR_EOF > 'README' XXcal is a calendar program. It generally sits on your screen Xdisplaying todays date - the format of this can be tailored to your Xtaste. X XHitting the left button in the date window gives you a `strip' showing Xthe current month with one line per day. Daily details can be stored Xin files (like xcalendar - from where I stole the code). The daily Xdetails will be displayed in the strip - so you can see what you have Xto do. The X11R4 multi-line widget makes this rather nice. X XDaily details can be edited by poking at the appropriate day and Xgetting an edit window. Daily details can contain times and can Xbe used to trigger screen alarms. X XEach strip has `next' and `previous' button, so you can do the common Xactions quickly - alternatively you can hit the middle button in the Xdate window to get a dialogue box which you can use to enter the date Xof the month which you want to display. X XA top level button on the date strip gives you access to a memo pad Xwhere you can store things that you should be doing. This panel also Xshows todays information so a single button click can be used to see Xtodays appointments. X XI have also stolen pscal from the net and modified it to work with the Xprogram. So you can generate pretty printed calendars whenever you Xlike - assuming that you have a PostScript printer. X XThis is release 3.2. XThe history is: X Release 1.1 posted to comp.sources.x X + two patches X Release 2.1 circulated privately X Release 3.1 circulated privately X XCaveats X XYes this IS another - `I need something real to find out about X exercise'. XSo, it demonstrates all those faults. X XPeter Collinson XHillside Systems X61 Hillside Avenue XCanterbury XKent, CT2 8HA X XPhone: +44 227 761824 XFax: +44 227 762554 XEmail: pc@hillside.co.uk X X18/December/1990 X XFixes/enhancements welcomed.... X XThis is free... however, if you are going to make some profit from Xthis, then perhaps you should consider passing something back to me Xsince I am freelance and mostly don't get paid everyday. SHAR_EOF if test 1983 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 1983 characters)' fi fi # end of overwriting check echo shar: extracting "'CHANGES'" '(1800 characters)' if test -f 'CHANGES' then echo shar: will not over-write existing file "'CHANGES'" else sed 's/^ X//' << \SHAR_EOF > 'CHANGES' XChanges: CHANGES 2.2 12/5/90 X XXcal - Version 3.1 Issued to comp.sources.x X X Adds the memo functionality and the Stick/Unpin feature X for alarms. X X---------------------------- 2.1 X XXcal - Version 2.1 Issued privately X X Two main differences between version 1.1 and version 2.1 X a) Version 2.1 has alarms so that xcal can poll you X during the day - idea contributed by Mark Majhor, Sequent X and then unashame-edly hacked by me. X b) Version 2.1 has a support program supplied by Ed Gould X from Mt Xinu allowing you to set up a file suitable for X driving UNIX's calendar program. X X---------------------------- 1.6 X Xpscal/pscal.sh Fix to make sed work better to truncate the calendar file X when printing. X From Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia X Internet: gnb@melba.bby.oz.au non-MX: gnb%melba.bby.oz@uunet.uu.net X X---------------------------- 1.5 X Xxcal.h Add initialCalendar/initialEdit switches X Support for better start-up options... from X From: Rod Whitby X Xxcal.c Add hooks and code to perform startuo X XImakefile Corrected X Xxcal.man Add new lines supporting initialCalendar/initialEdit X X---------------------------- 1.4 Xxcal_edit.c Fix bug where colour mapping on days failed to change when X data is deleted or added. X Xxcal.h/xcal.c/xcal_strip.c X Add a new resource minStripWidth intended to allow X users to widen the strip to some value which seems X sensible. If zero the resource is unused. X XXCal.ad Add colour map from wade@cs.utk.edu X Xxcal_edit.c Changes to XBell calls due to typo X Steve Alexander, Software Technologies Group X INTERACTIVE Systems Corporation, Naperville, IL X ...!{sun,ico}!laidbak!stevea X stevea@i88.isc.com X X X XXcal - Version 1.1 Issued to the net comp.sources.x. X xcal: Volume 7, Issue 1-2 X SHAR_EOF if test 1800 -ne "`wc -c < 'CHANGES'`" then echo shar: error transmitting "'CHANGES'" '(should have been 1800 characters)' fi fi # end of overwriting check echo shar: extracting "'Imakefile'" '(784 characters)' if test -f 'Imakefile' then echo shar: will not over-write existing file "'Imakefile'" else sed 's/^ X//' << \SHAR_EOF > 'Imakefile' XLOCAL_LIBRARIES = XawClientLibs X INCS = xcal.h X SRCS = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c version.c X OBJS = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o version.o X OSMAJORVERSION = OSMajorVersion X OSMINORVERSION = OSMinorVersion X DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) -DVER_VEC X X XAllTarget(xcal) XNormalProgramTarget(xcal,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES), /**/) X XAllTarget(xcal_cal) XNormalProgramTarget(xcal_cal, xcal_cal.o,/**/,/**/,/**/); X XInstallProgram(xcal, $(BINDIR)) XInstallManPage(xcal, $(MANDIR)) XInstallProgram(xcal_cal, $(BINDIR)) XInstallManPage(xcal_cal, $(MANDIR)) XInstallAppDefaults(XCal) X XDependTarget() SHAR_EOF if test 784 -ne "`wc -c < 'Imakefile'`" then echo shar: error transmitting "'Imakefile'" '(should have been 784 characters)' fi fi # end of overwriting check echo shar: extracting "'Makefile'" '(9218 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else sed 's/^ X//' << \SHAR_EOF > 'Makefile' X# Makefile generated by imake - do not edit! X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ X# X# The cpp used on this machine replaces all newlines and multiple tabs and X# spaces in a macro expansion with a single space. Imake tries to compensate X# for this, but is not always successful. X# X X########################################################################### X# Makefile generated from "Imake.tmpl" and X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ X# X# Platform-specific parameters may be set in the appropriate .cf X# configuration files. Site-wide parameters may be set in the file X# site.def. Full rebuilds are recommended if any parameters are changed. X# X# If your C preprocessor doesn't define any unique symbols, you'll need X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing X# "make Makefile", "make Makefiles", or "make World"). X# X# If you absolutely can't get imake to work, you'll need to set the X# variables at the top of each Makefile as well as the dependencies at the X# bottom (makedepend will do this automatically). X# X X########################################################################### X# platform-specific configuration parameters - edit sun.cf to change X X# platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ X# operating system: SunOS 4.1 X X########################################################################### X# site-specific configuration parameters - edit site.def to change X X# site: $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $ X X SHELL = /bin/sh X X TOP = /s/X11/mit X CURRENT_DIR = . X X AR = ar cq X BOOTSTRAPCFLAGS = X CC = gcc X X COMPRESS = compress X CPP = /lib/cpp $(STD_CPP_DEFINES) X PREPROCESSCMD = gcc -E $(STD_CPP_DEFINES) X INSTALL = install X LD = ld X LINT = lint X LINTLIBFLAG = -C X LINTOPTS = -axz X LN = ln -s X MAKE = make X MV = mv X CP = cp X RANLIB = ranlib X RANLIBINSTFLAGS = X RM = rm -f X STD_INCLUDES = X STD_CPP_DEFINES = X STD_DEFINES = X EXTRA_LOAD_FLAGS = X EXTRA_LIBRARIES = X TAGS = ctags X X SHAREDCODEDEF = -DSHAREDCODE X SHLIBDEF = -DSUNSHLIB X X PROTO_DEFINES = X X INSTPGMFLAGS = X X INSTBINFLAGS = -m 0755 X INSTUIDFLAGS = -m 4755 X INSTLIBFLAGS = -m 0664 X INSTINCFLAGS = -m 0444 X INSTMANFLAGS = -m 0444 X INSTDATFLAGS = -m 0444 X INSTKMEMFLAGS = -m 4755 X X DESTDIR = X X TOP_INCLUDES = -I$(INCROOT) X X CDEBUGFLAGS = -O X CCOPTIONS = X COMPATFLAGS = -DXAW_BC X X ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) X LDCOMBINEFLAGS = -X -r X X MACROFILE = sun.cf X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut X X IMAKE_DEFINES = X X IRULESRC = $(CONFIGDIR) X IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) X X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) X X########################################################################### X# X Window System Build Parameters X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X X########################################################################### X# X Window System make variables; this need to be coordinated with rules X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X X PATHSEP = / X USRLIBDIR = $(DESTDIR)/usr/local/lib X BINDIR = $(DESTDIR)/usr/local/wbin/X11 X INCROOT = $(DESTDIR)/usr/local/include X BUILDINCROOT = $(TOP) X BUILDINCDIR = $(BUILDINCROOT)/X11 X BUILDINCTOP = .. X INCDIR = $(INCROOT)/X11 X ADMDIR = $(DESTDIR)/usr/adm X LIBDIR = $(USRLIBDIR)/X11 X CONFIGDIR = $(LIBDIR)/config X LINTLIBDIR = $(USRLIBDIR)/lint X X FONTDIR = $(LIBDIR)/fonts X XINITDIR = $(LIBDIR)/xinit X XDMDIR = $(LIBDIR)/xdm X AWMDIR = $(LIBDIR)/awm X TWMDIR = $(LIBDIR)/twm X GWMDIR = $(LIBDIR)/gwm X MANPATH = $(DESTDIR)/usr/man X MANSOURCEPATH = $(MANPATH)/man X MANDIR = $(MANSOURCEPATH)n X LIBMANDIR = $(MANSOURCEPATH)3 X XAPPLOADDIR = $(LIBDIR)/app-defaults X X SOXLIBREV = 4.2 X SOXTREV = 4.0 X SOXAWREV = 4.0 X SOOLDXREV = 4.0 X SOXMUREV = 4.0 X SOXEXTREV = 4.0 X X FONTCFLAGS = -t X X INSTAPPFLAGS = $(INSTDATFLAGS) X X IMAKE = imake X DEPEND = makedepend X RGB = rgb X FONTC = bdftosnf X MKFONTDIR = mkfontdir X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh X X CONFIGSRC = $(TOP)/config X CLIENTSRC = $(TOP)/clients X DEMOSRC = $(TOP)/demos X LIBSRC = $(TOP)/lib X FONTSRC = $(TOP)/fonts X INCLUDESRC = $(TOP)/X11 X SERVERSRC = $(TOP)/server X UTILSRC = $(TOP)/util X SCRIPTSRC = $(UTILSRC)/scripts X EXAMPLESRC = $(TOP)/examples X CONTRIBSRC = $(TOP)/../contrib X DOCSRC = $(TOP)/doc X RGBSRC = $(TOP)/rgb X DEPENDSRC = $(UTILSRC)/makedepend X IMAKESRC = $(CONFIGSRC) X XAUTHSRC = $(LIBSRC)/Xau X XLIBSRC = $(LIBSRC)/X X XMUSRC = $(LIBSRC)/Xmu X TOOLKITSRC = $(LIBSRC)/Xt X AWIDGETSRC = $(LIBSRC)/Xaw X OLDXLIBSRC = $(LIBSRC)/oldX X XDMCPLIBSRC = $(LIBSRC)/Xdmcp X BDFTOSNFSRC = $(FONTSRC)/bdftosnf X MKFONTDIRSRC = $(FONTSRC)/mkfontdir X EXTENSIONSRC = $(TOP)/extensions X X DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a X EXTENSIONLIB = -lXext X X DEPXLIB = $(DEPEXTENSIONLIB) X XLIB = $(EXTENSIONLIB) -lX11 X X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a X XAUTHLIB = -lXau X X DEPXMULIB = X XMULIB = -lXmu X X DEPOLDXLIB = X OLDXLIB = -loldX X X DEPXTOOLLIB = X XTOOLLIB = -lXt X X DEPXAWLIB = X XAWLIB = -lXaw X X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln X LINTXLIB = $(USRLIBDIR)/llib-lX11.ln X LINTXMU = $(USRLIBDIR)/llib-lXmu.ln X LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln X LINTXAW = $(USRLIBDIR)/llib-lXaw.ln X X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) X X DEPLIBS1 = $(DEPLIBS) X DEPLIBS2 = $(DEPLIBS) X DEPLIBS3 = $(DEPLIBS) X X########################################################################### X# Imake rules for building libraries, programs, scripts, and data files X# rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ X X########################################################################### X# start of Imakefile X XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) X INCS = xcal.h X SRCS = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c version.c X OBJS = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o version.o X OSMAJORVERSION = 4 X OSMINORVERSION = 1 X DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) -DVER_VEC X Xall:: xcal X Xxcal: $(OBJS) $(DEPLIBS) X $(RM) $@ X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) X Xclean:: X $(RM) xcal X Xall:: xcal_cal X Xxcal_cal: xcal_cal.o X $(RM) $@ X $(CC) -o $@ xcal_cal.o $(LDOPTIONS) $(LDLIBS) $(EXTRA_LOAD_FLAGS) X Xclean:: X $(RM) xcal_cal; X Xinstall:: xcal X $(INSTALL) -c $(INSTPGMFLAGS) xcal $(BINDIR) X Xinstall.man:: xcal.man X $(INSTALL) -c $(INSTMANFLAGS) xcal.man $(MANDIR)/xcal.n X Xinstall:: xcal_cal X $(INSTALL) -c $(INSTPGMFLAGS) xcal_cal $(BINDIR) X Xinstall.man:: xcal_cal.man X $(INSTALL) -c $(INSTMANFLAGS) xcal_cal.man $(MANDIR)/xcal_cal.n X Xinstall:: XCal.ad X $(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(XAPPLOADDIR)/XCal X Xdepend:: X $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) X X########################################################################### X# common rules for all Makefiles - do not edit X Xemptyrule:: X Xclean:: X $(RM_CMD) \#* X XMakefile:: X -@if [ -f Makefile ]; then \ X echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ X else exit 0; fi X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) X Xtags:: X $(TAGS) -w *.[ch] X $(TAGS) -xw *.[ch] > TAGS X X########################################################################### X# empty rules for directories that do not have SUBDIRS - do not edit X Xinstall:: X @echo "install in $(CURRENT_DIR) done" X Xinstall.man:: X @echo "install.man in $(CURRENT_DIR) done" X XMakefiles:: X Xincludes:: X X########################################################################### X# dependencies generated by makedepend X SHAR_EOF if test 9218 -ne "`wc -c < 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 9218 characters)' fi fi # end of overwriting check echo shar: extracting "'XCal.ad'" '(1927 characters)' if test -f 'XCal.ad' then echo shar: will not over-write existing file "'XCal.ad'" else sed 's/^ X//' << \SHAR_EOF > 'XCal.ad' XXCal.MarkForeground: Black XXCal.MarkBackground: White XXCal.edit.geometry: 300x150 XXCal.memo.geometry: 300x300 XXCal.alarm.geometry: 300x100+0+150 XXCal*help.geometry: 600x300 XXCal.fontToday: lucidasanstypewriter-12 XXCal*Font: lucidasanstypewriter-12 XXCal*info.Font: lucidasans-10 XXCal*alarmText*Font: 12x24 XXCal*alarmText*scrollVertical: WhenNeeded XXCal*alarmText*wrap: word XXCal*display.scrollVertical: WhenNeeded XXCal*display.scrollHorizontal: WhenNeeded XXCal*display.cursor: dot XXCal*text.scrollVertical: WhenNeeded XXCal*text.scrollHorizontal: WhenNeeded XXCal*text.autoFill: True XXCal*helpText.scrollVertical: Always XXCal*helpText.scrollHorizontal: WhenNeeded XXCal*helpText.autoFill: True XXCal*back.Label: < XXCal*quit.Label: Quit XXCal*next.Label: > XXCal*help.Label: Help XXCal*newdate.Label: Enter mmm yyyy? XXCal*newdate.ok.Label: ok XXCal*newdate.cancel.Label: cancel XXCal*exit.Label: Really exit? XXCal*exit.yes.Label: yes XXCal*exit.no.Label: no XXCal*noedit.ok.Label: ok XXCal*edit.quit.Label: Quit XXCal*edit.save.Label: Save XXCal*edit.help.Label: Help XXCal*check.Label: Save file? XXCal*check.yes.Label: yes XXCal*check.no.Label: no XXCal*help*helpQuit.Label: quit XXCal*alarmQuit.Label: Unpin XXCal*alarmHold.Label: Stick XXCal*memoTitle.Label: Edit the memo file X! X! Colours from reed wade@cs.utk.edu X! X!XCal*background: LightSteelBlue X!XCal*foreground: SaddleBrown X!XCal.MarkForeground: Black X!XCal.MarkBackground: CornflowerBlue X!XCal.edit.background: CornflowerBlue X!XCal.edit.foreground: OliveGreen X!XCal*exit.background: MediumTurquoise X!XCal*exit.foreground: SlateGrey X!XCal*check.background: lavender X!XCal*help*background: wheat X!XCal*help*foreground: blue X!XCal*newdate*background: plum X!XCal*newdate*foreground: red X!XCal*quit.background: SteelBlue X!XCal*quit.background: green X!XCal*back.background: yellow X!XCal*next.background: yellow X!XCal*no.background: DarkKhaki X!XCal*yes.background: PapayaWhip SHAR_EOF if test 1927 -ne "`wc -c < 'XCal.ad'`" then echo shar: error transmitting "'XCal.ad'" '(should have been 1927 characters)' fi fi # end of overwriting check echo shar: extracting "'mouse.bm'" '(242 characters)' if test -f 'mouse.bm' then echo shar: will not over-write existing file "'mouse.bm'" else sed 's/^ X//' << \SHAR_EOF > 'mouse.bm' X#define mouse_width 16 X#define mouse_height 13 Xstatic char mouse_bits[] = { X 0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, X 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff, X 0xff, 0xff}; SHAR_EOF if test 242 -ne "`wc -c < 'mouse.bm'`" then echo shar: error transmitting "'mouse.bm'" '(should have been 242 characters)' fi fi # end of overwriting check echo shar: extracting "'mouseaway.bm'" '(254 characters)' if test -f 'mouseaway.bm' then echo shar: will not over-write existing file "'mouseaway.bm'" else sed 's/^ X//' << \SHAR_EOF > 'mouseaway.bm' X#define mouseaway_width 16 X#define mouseaway_height 13 Xstatic char mouseaway_bits[] = { X 0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, X 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff, X 0xff, 0xff}; SHAR_EOF if test 254 -ne "`wc -c < 'mouseaway.bm'`" then echo shar: error transmitting "'mouseaway.bm'" '(should have been 254 characters)' fi fi # end of overwriting check echo shar: extracting "'patchlevel.h'" '(21 characters)' if test -f 'patchlevel.h' then echo shar: will not over-write existing file "'patchlevel.h'" else sed 's/^ X//' << \SHAR_EOF > 'patchlevel.h' X#define PATCHLEVEL 0 SHAR_EOF if test 21 -ne "`wc -c < 'patchlevel.h'`" then echo shar: error transmitting "'patchlevel.h'" '(should have been 21 characters)' fi fi # end of overwriting check if test ! -d 'pscal' then echo shar: creating directory "'pscal'" mkdir 'pscal' fi echo shar: entering directory "'pscal'" cd 'pscal' echo shar: extracting "'Makefile'" '(190 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else sed 's/^ X//' << \SHAR_EOF > 'Makefile' Xall: pscal.sh pscal.1 X X Xpscal.sh: X get pscal.sh X Xpscal.1: X get pscal.1 X Xinstall: pscal.sh pscal.1 X install -c -m 755 pscal.sh /usr/local/bin/pscal X install -c pscal.1 /usr/man/manl/pscal.l SHAR_EOF if test 190 -ne "`wc -c < 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 190 characters)' fi fi # end of overwriting check echo shar: extracting "'pscal.1'" '(3399 characters)' if test -f 'pscal.1' then echo shar: will not over-write existing file "'pscal.1'" else sed 's/^ X//' << \SHAR_EOF > 'pscal.1' X.TH PSCAL 1 "8/January/1990" X.SH NAME Xpscal X.SH SYNOPSIS: X.B pscal X[ X.B \-Pprinter X] [ X.B \-R X] [ X.B \-r X] [ X.B \-t X] [ X.B other printer flags X] [ month [ year ] ] X.SH DESCRIPTION: X.I Pscal Xgenerates the Postscript showing a calendar for the specified month and year. XThe year, if omitted, defaults Xto the current year. XIf both month and year are omitted, the current month is printed. X.I Year Xcan be between 1753 Xand 9999. XThe X.I month Xis a number between 1 and 12. XI can also be a three letter month abbreviation. X.LP XThe calendar can be loaded with information from the user. XThe information either comes in an `Event' file or can be Xderived from files under the user's Calendar directory should this exist. XThe search for this data is as follows, if any of these succeeds the data Xfor the calendar is taken from that source. X.IP 1) XThe shell variable EFILE may be set to the name of an Event file. X.IP 2) XAn event file called `Event' may exist in the current directory. X.IP 3) XThe file $HOME/.holiday may exist and contain a list of events. X.IP 4) XThe directory $HOME/Calendar Xmay exist containing XCal files. X.LP XAn event file should consist of lines of the form X.IP Xmonth:day:message string X.LP XMessages should be 20 characters or less, with no more than 6 Xmessages per day. XNo spaces should appear from the beginning Xof a line until after the second colon. XMonth and day should be numbers in the obvious ranges. X.SH OPTIONS X.IP "\-P\fIprinter\fR" 1i XThe printer may be specified with the usual \-P\fIprinter\fR syntax. X.IP "\-r" 1i XThe calendar page is printed in ``landscape'' orientation (the default). X.IP "\-R" 1i XThe calendar page is printed in ``portrait'' orientation; this Xyields a slightly smaller image and may be more suitable for Xembedding into other documents. X.IP "\-t" 1i XCauses the PostScript to be sent to the standard output, rather Xthan to the printer. This is useful if you wish to save the Xoutput in a file, or if you want to use options with the X.IR lpr (1) Xcommand. X.IP "\-F\fIfont\fR" 1i XSets the font family for the title text (the month and year). X.IP "\-f\fIfont\fR" 1i XSets the font family for the day-of-month numbers. X.PP XOther arguments starting with `\-' are passed through to X.IR lpr (1). X.PP XAny argument whose first character is '-' is passed on to lpr. XThe shell variables BANNER, LFOOT, CFOOT, and RFOOT become a Xtop centered banner, and left, centered, or right justified Xfooters respectively. As in: X.IP XBANNER="Schedule 1" CFOOT=Preliminary pscal 4 90 X.SH AUTHOR XPatrick Wood X.br XCopyright (C) 1987 by Pipeline Associates, Inc. X.br XPermission is granted to modify and distribute this free of charge. X.SH HISTORY XOriginal From: patwood@unirot.UUCP (Patrick Wood) X.br XShell stuff added 3/9/87 by King Ables X.br XMade pretty by tjt 1988 X.br XHoliday and printer flag passing hacks added Dec 1988 Xby smann@june.cs.washington.edu X.br XUsed the better looking version with 5 rows of days rather than 6 Xhacked together with holiday and banner/footnotes added Xby Joe (No Relation) Wood, 12/89, jlw@lzga.ATT.COM X.SH BUGS X`Pscal' doesn't work for months before 1753 (weird stuff happened Xin September, 1752). X.PP XA better format for the dates of holidays would be nice. XAn escape to allow holiday messages to be raw PostScript would Xalso be nice. X.PP XThe holiday messages should be handled more intelligently (ie, Xthe messages should be clipped to the day). X SHAR_EOF if test 3399 -ne "`wc -c < 'pscal.1'`" then echo shar: error transmitting "'pscal.1'" '(should have been 3399 characters)' fi fi # end of overwriting check echo shar: extracting "'pscal.sh'" '(13136 characters)' if test -f 'pscal.sh' then echo shar: will not over-write existing file "'pscal.sh'" else sed 's/^ X//' << \SHAR_EOF > 'pscal.sh' X#!/bin/sh X#+ X# X# NAME: X# pscal X# X# SYNOPSIS: X# pscal [-Pprinter] [other printer flags] month year X# X# DESCRIPTION: X# `Pscal' is a PostScript program to print calendars. X# X# The file $HOME/.holiday is read and used to print short messages X# on specified days. The .holiday file should consist of lines of X# the form X# month:day:message string X# Messages should be 20 characters or less, with no more than 6 X# messages per day. No spaces should appear from the beginning X# of a line until after the second colon. X# Month and day should be numbers in the obvious ranges. X# 12/89 - The holiday checking has been loosened up in that the X# following takes place: X# 1. The Shell Variable EFILE is used preferentially X# 2. Then the file Events in the current directory is used X# 3. Finally the $HOME/.holiday file is used. X# The whole process can be turned off by setting EFILE=/dev/null. X# X# OPTIONS: X# Any argument whose first character is '-' is passed on to lpr. X# The shell variables BANNER, LFOOT, CFOOT, and RFOOT become a X# top centered banner, and left, centered, or right justified X# footers respectively. As in: X# X# BANNER="Schedule 1" CFOOT=Preliminary pscal 4 90 X# X# AUTHOR: X# Patrick Wood X# Copyright (C) 1987 by Pipeline Associates, Inc. X# Permission is granted to modify and distribute this free of charge. X# X# HISTORY: X# @Original From: patwood@unirot.UUCP (Patrick Wood) X# @Shell stuff added 3/9/87 by King Ables X# @Made pretty by tjt 1988 X# @Holiday and printer flag passing hacks added Dec 1988 X# @ by smann@june.cs.washington.edu X# @Used the better looking version with 5 rows of days rather than 6 X# @ hacked together with holiday and banner/footnotes added X# @ by Joe (No Relation) Wood, 12/89, jlw@lzga.ATT.COM X# @Fixed "-R" (didn't work at all; now it at least works on 8.5x11) X# @Also fixed handling of unrecognized arguments X# @ by Jeff Mogul, 1/90, mogul@decwrl.dec.com X# X# BUGS: X# `Pscal' doesn't work for months before 1753 (weird stuff happened X# in September, 1752). X# X# A better format for the dates of holidays would be nice. X# An escape to allow holiday messages to be raw PostScript would X# also be nice. X# The holiday messages should be handled more intelligently (ie, X# the messages should be clipped to the day). X# X X# X# PostScript program to print calendars. X# Doesn't deal well with September 1752 or before. X# X XUSAGE="Usage: pscal [ -Rrt ] [ -F hfont ] [ -f font ] [ month [ year ] ]" X XTFONT=Times-Bold XDFONT=Helvetica-Bold XEFONT=Times-Roman X XCalendar=$HOME/Calendar X XROTATE=90 XSCALE="1.0 1.0" X# Was 50 -120 - changed to 71 -120 for A4 Use XTRANSLATE="71 -120" X XLPR="lpr" X Xwhile test $# != 0 Xdo X case $1 in X -P) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } X eval ENVAR="$1$2"; shift 2;; X -P*) eval ENVAR=$1; shift 1;; X -F) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } X TFONT="$2"; shift 2;; X -F*) TFONT=`echo $1 | sed -n 1s/-.//p`; shift 1;; X -f) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } X DFONT="$2"; shift 2;; X -f*) DFONT=`echo $1 | sed -n 1s/-.//p`; shift 1;; X -t) LPR=cat; shift 1;; X -r) ROTATE=90; shift 1;; X -R) ROTATE=0; SCALE="0.75 0.75"; TRANSLATE="50 900"; shift 1;; X --|-) break;; X -*) eval ENVAR=\"$ENVAR $1\"; shift 1;; X *) break X esac Xdone X Xtest $# -gt 2 && { echo "$USAGE" 1>&2; exit 1; } X Xcase $# in X 0) set `date`; YEAR=$6; MONTH=$2;; X 1) MONTH=$1; set `date`; YEAR=$6;; X 2) MONTH=$1 YEAR=$2;; Xesac X XMONTH=`case $MONTH in Jan|jan) echo 1;;Feb|feb) echo 2;;Mar|mar) echo 3;;Apr|apr) echo 4;; X May|may) echo 5;;Jun|jun) echo 6;;Jul|jul) echo 7;;Aug|aug) echo 8;; X Sep|sep) echo 9;;Oct|oct) echo 10;;Nov|nov) echo 11;;Dec|dec) echo 12;; X 1|2|3|4|5|6|7|8|9|10|11|12) echo $MONTH;;esac` X Xtest $YEAR -lt 100 && YEAR=`expr $YEAR + 1900` X Xif [ -n "$EFILE" -a -r "$EFILE" ] Xthen X Files=$EFILE X monthday=yes Xelif [ -r Events ] Xthen X Files=Events X monthday=yes Xelif [ -r $HOME/.holiday ] Xthen X Files=$HOME/.holiday X monthday=yes Xelif [ -d $Calendar ] Xthen X cd $Calendar X if [ -d xy$YEAR ] X then X cd xy$YEAR X fi X set 'dummy' 'Jan' 'Feb' 'Mar' 'Apr' 'May' 'Jun' 'Jul' 'Aug' 'Sep' 'Oct' 'Nov' 'Dec' X shift $MONTH X list=`echo xc*$1$YEAR` X case "$list" in X xc\*$1$YEAR) X ;; X *) X for file in $list X do X day=`expr $file : 'xc\([0-9]*\)'` X (cat $file;echo) | sed '/^$/d X s/^/./' | fmt -25 | X sed -n "7q X s/^\.// X s/^/$day ( / X s/\$/ )/ X p" X done > /tmp/pscal$$ X holidays=`cat /tmp/pscal$$` X rm -f /tmp/pscal$$ X esac Xfi X Xcase "$monthday" in Xyes) X holidays=`cat $Files | grep \^$MONTH: | awk -F: '{printf("%s ( %s",$2,$3);\ X for(i = 4; i <= NF; i++) printf(":%s", $i);printf(")\n"); }'` Xesac X X X$LPR $ENVAR < 'version.c' X#ifndef lint Xstatic char *sccsid = "@(#)version.c 3.2 (Hillside Systems) 12/18/90"; X#endif /* lint */ X/* X * Version control file X * version.c 3.2 12/18/90 X * Automatically created on Tue Dec 18 21:15:55 GMT 1990 X * X * Hand edit none of this if you want freeze to continue to work X */ X#ifdef VER_PROG X#define PROGNAME XCal X#endif X#ifdef VER_VEC Xchar version[] = "XCal Version 3.2, released Tue Dec 18 21:15:55 GMT 1990"; X#endif X#ifdef VER_DEF X#define VERSION "XCal Version 3.2, released Tue Dec 18 21:15:55 GMT 1990" X#endif X X/* SCCS files X * X+1.7 Imakefile X+3.5 xcal_help.c X+1.4 xcal_cal.c X+1.12 xcal.man X+1.5 xcal_memo.c X+1.10 XCal.ad X+1.10 xcal_alarm.c X+3.9 xcal_edit.c X+1.4 README X+2.1 patchlevel.h X+3.6 xcal_strip.c X+1.2 xcal_cal.man X+1.8 Makefile X+3.4 xcal_popup.c X+3.13 xcal.c X+3.8 xcal.h X+2.2 CHANGES X+1.1 mouse.bm X+1.1 mouseaway.bm X * X */ SHAR_EOF if test 848 -ne "`wc -c < 'version.c'`" then echo shar: error transmitting "'version.c'" '(should have been 848 characters)' fi fi # end of overwriting check echo shar: extracting "'xcal.h'" '(5058 characters)' if test -f 'xcal.h' then echo shar: will not over-write existing file "'xcal.h'" else sed 's/^ X//' << \SHAR_EOF > 'xcal.h' X/* X * xcal.h 3.8 12/12/90 X * X * Header file for the xcal program X */ X X/* X * On 32 bit machines we can pack the date into one word X * if not we have to use two callbacks X * so undef if not true X * and fiddle with the definitions below X */ X#define LONG_IS_32_BITS X X/* pack year and month into Cardinals */ X#ifdef LONG_IS_32_BITS X#define DatePack(d, m, y) ((((d)&0x1f)<<16) | (((m)&0xf)<<12) | ((y)&0xfff)) X#define YrUnpack(v) ((v)&0xfff) X#define MoUnpack(v) (((v)>>12)&0xf) X#define DyUnpack(v) (((v)>>16)&0x1f) X#else LONG_IS_32_BITS X#define DatePack(m, y) ((((m)&0xf)<<12) | ((y)&0xfff)) X#define YrUnpack(v) ((v)&0xfff) X#define MoUnpack(v) (((v)>>12)&0xf) X#endif LONG_IS_32_BITS X X/* X * Foreground/Background colours X */ Xtypedef struct X{ Pixel bg; X Pixel fg; X} Colour; X X/* X * resources used by xcal.c X */ Xstruct resources X{ Boolean debug; /* Debug switch - currently used to fast fwd */ X /* the date */ X Boolean alarmScan; /* Debug switch for alarm system */ X Boolean reverseVideo; /* Display in Reverse video */ X Boolean useWmTitle; /* When displaying strips do not include a */ X /* month - year value */ X Boolean markToday; /* Mark today with today's colours */ X Boolean calCompat; /* True if handle files like xcalendar */ X Boolean giveHelp; /* True if help is needed (default) */ X Boolean initialCalendar;/* Pop up Calendar on startup if True */ X Boolean initialEdit; /* Pop up today's Edit on startup if True */ X String mon[12]; /* Long month names */ X String smon[12]; /* Short month names */ X String day[7]; /* day names */ X String opfmt; /* format for main box */ X String order; /* Orders are dmy/ymd/mdy/ydm */ X int val_order; /* The selected order */ X Colour marked; /* Marked entry colour */ X Colour today; /* What to mark today with */ X XFontStruct *fontToday; /* We can also do Today in a different font */ X String directory; /* Directory under home where Calendar files */ X /* can be found */ X int textbufsz; /* Text buffer size for editing */ X Dimension minstripwidth; /* Minimum strip width */ X Boolean alarms; /* false - no alarms, true - alarms */ X XtIntervalId interval_id;/* store XtAddTimeOut value */ X int update; /* interval between peeks (60 secs) */ X int volume; /* how loud to beep the alarm 0-100 */ X int nbeeps; /* how many beeps for an alarm ? */ X long last_size; /* save the last time size */ X long last_time; /* save the last time file accessed */ X int autoquit; /* Automatically delete message boxes */ X String countdown; /* Comma separated countdown string for alarms */ X String cmd; /* command to execute for every alarm */ X String alarmleft; /* string containing a message - %d mins left */ X String alarmnow; /* string containing a message - Now! */ X Boolean useMemo; /* true use top-level memo button, false - don't */ X Boolean memoLeft; /* True if on left of date, false otherwise */ X String memoFile; /* name of the file where the memo data is stored */ X int maxDisplayLines;/* maximum number of lines that we want to */ X /* allow the top half of a memo window to */ X /* stretch to */ X}; X Xextern struct resources appResources; X X/* X * Order coding inserted into val_order X */ X#define O_DMY 0 /* default */ X#define O_YMD 1 /* Year/Month/Day */ X#define O_MDY 2 /* Month/Day/Year */ X#define O_YDM 3 /* Year/Day/Month */ X X/* X * Date structure X */ Xtypedef struct X{ Cardinal day; X Cardinal month; X Cardinal year; X} Date; X X/* X * A month entry X */ Xtypedef struct me X{ X Cardinal me_year; /* map year */ X Cardinal me_month; /* which month */ X String me_have[32]; /* if a file present for the day */ X /* then will have a non-zero entry */ X} MonthEntry; X X/* X * An instance of the strip X */ Xtypedef struct instance X{ struct instance *i_next; /* next object */ X Widget i_w; /* the widget top level */ X Widget i_day_label[32]; /* the handle to the label on each day */ X /* so we can change dates at night */ X Widget i_day_info[32]; /* The info field for this date - so */ X /* we can sensitise/desensitise on editing */ X Colour i_col; /* what the fg/bg colours used to be */ X XFontStruct *i_font; /* what the font was */ X} Instance; X XInstance *RegisterMonth(); XInstance *FindInstanceList(); X X/* X * Alarm structure X * one of these exists for each event in the timeout queue X * the list is sorted in event order X */ Xtypedef struct _alarm X{ struct _alarm *next; /* pointer to next alarm */ X String alarm; /* alarm string */ X String what; /* what is message */ X int alarm_mm; /* hour*60 + min */ X int alarm_state; /* what time left to `real' timeout */ X Boolean isAction; /* more than alarm */ X} Alarm; X X/* X * We occasionally need these X */ Xextern Widget toplevel; Xextern Date today; X X/* X * Global routines X */ Xvoid Leave(); Xvoid SetDate(); Xvoid AskLeave(); Xvoid DialogPopup(); Xvoid SetDate(); Xvoid TextCal(); Xvoid DoCalendar(); Xvoid DoMemo(); Xvoid MemoPoll(); Xvoid NewMonthStrip(); Xvoid InitMonthEntries(); Xvoid ChangeHighlight(); Xvoid NoEditIsPossible(); Xvoid StartEditing(); XMonthEntry *GetMonthEntry(); Xvoid AlarmFilePoll(); XString ReadCalendarFile(); Xvoid UpdateMemo(); Xvoid PlaceStr(); SHAR_EOF if test 5058 -ne "`wc -c < 'xcal.h'`" then echo shar: error transmitting "'xcal.h'" '(should have been 5058 characters)' fi fi # end of overwriting check if test ! -d 'scott_brim' then echo shar: creating directory "'scott_brim'" mkdir 'scott_brim' fi echo shar: entering directory "'scott_brim'" cd 'scott_brim' echo shar: extracting "'README'" '(64 characters)' if test -f 'README' then echo shar: will not over-write existing file "'README'" else sed 's/^ X//' << \SHAR_EOF > 'README' XThis code sent in by Scott Brim X X X SHAR_EOF if test 64 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 64 characters)' fi fi # end of overwriting check echo shar: extracting "'xcshow.c'" '(7326 characters)' if test -f 'xcshow.c' then echo shar: will not over-write existing file "'xcshow.c'" else sed 's/^ X//' << \SHAR_EOF > 'xcshow.c' X/* X * Announce xcal appointment entries. Typical use is to announce a few X * days' worth. Also possible to dump every entry in "calendar" format. X * X * Options: - date to start at - mm/dd[/yy[yy]] X * -d - of diary (default ~/Calendar) X * -n - where is number of days to display X * -c - dump everything in "calendar" format; X * ignores and -n. X */ X X X#include X#include X#include X#include X#include X#include X#include X#include X X#define FALSE 0 X#define TRUE 1 X Xvoid usage(); X Xstruct tm *tm; /* hold times */ Xchar rootdir[256]; /* build directory name here */ XFILE *fd; /* read file descriptor */ Xchar filename[256]; /* to build filename in */ Xchar *months[] = { X "Jan", "Feb", "Mar", "Apr", X "May", "Jun", "Jul", "Aug", X "Sep", "Oct", "Nov", "Dec" X }; Xint days_in_months[] = { X 31, 28, 31, 30, X 31, 30, 31, 31, X 30, 31, 30, 31, X}; X X Xmain(argc, argv) Xunsigned int argc; Xchar **argv; X{ X int ndays; /* number of days to announce */ X char c, *s; /* reading and writing */ X char *dirname; /* root directory name */ X struct passwd *pwd; X long ti; X int cdump = 0; /* dump into calendar? */ X int i; X X X /* defaults */ X ti = time(0); /* default to today */ X tm = localtime(&ti); X tm->tm_year += 1900; X X ndays = 1; /* and to printing just one day */ X X if ((pwd = getpwuid(getuid())) == NULL) { X fprintf(stderr, "Who are you?\n"); X exit(42); X }; X strcpy(rootdir, pwd->pw_dir); /* default to home directory */ X endpwent(); X strcat(rootdir, "/Calendar"); X dirname = rootdir; X X X /* check options */ X argc--, argv++; X while (argc > 0) { X X if (isdigit(argv[0][0])) { X if ((sscanf(argv[0], "%d/%d/%d", &tm->tm_mon, X &tm->tm_mday, &tm->tm_year)) < 2) { X usage(); X exit(1); X } X else { X tm->tm_mon--; /* internal month # is 0-11 */ X if (valid_date() != 0) { /* user-supplied date */ X /* must make sense */ X usage(); X exit(2); X } X } X X } /* end if first character is digit */ X else if (argv[0][0] == '-') { X switch(argv[0][1]) { X case 'd': /* dirname */ X if (--argc <=0) { X usage(); /* nothing there */ X exit(3); X } X dirname = (++argv)[0]; X break; X case 'n': /* number of days */ X if (--argc <= 0) { X usage(); /* nothing there */ X exit(4); X } X if ((sscanf((++argv)[0], "%d", &ndays)) != 1) { X usage(); /* nothing there */ X exit(5); X } X break; X case 'c': X cdump = 1; X break; X default: X usage(); X exit(6); X } X } X argc--, argv++; X } X X if (cdump) { /* a dump? */ X return(dumpit(dirname)); /* go do so */ X } X X while (ndays--) { /* otherwise loop, for each day requested */ X X valid_date(); /* Make current m, d, y make sense */ X X /* build filename -- e.g. "/mu/swb/Calendar/xy1990/xc1Oct1990" */ X sprintf(filename, "%s/xy%04d/xc%d%s%d", X dirname, tm->tm_year, tm->tm_mday, X months[tm->tm_mon], tm->tm_year); X X /* Read from file, if it exists, and print. */ X if (fd = fopen(filename, "r")) { X fprintf(stdout, "%02d %s %d:\n------------\n", X tm->tm_mday, months[tm->tm_mon], tm->tm_year); X while ((c = getc(fd)) != EOF) putc(c, stdout); X fclose(fd); X fprintf(stdout, "\n"); X } X X tm->tm_mday++; /* do the next day */ X } X exit(0); X} X X/* X * valid_date takes the (external) date and makes it reasonable. First X * it increments the month until the day given is within a month (as X * opposed to, say, 3/47/91). Then it increments the year until the X * month is valid. Right now it doesn't know anything about leap X * years. X */ X Xvalid_date() X{ X int rc; X X rc = 0; X days_in_months[1] = 28; /* default */ X if (leap_year(tm->tm_year)) days_in_months[1] = 29; X X while (tm->tm_mday > days_in_months[tm->tm_mon]) { X tm->tm_mday -= days_in_months[tm->tm_mon]; X tm->tm_mon++; X rc++; X } X X while (tm->tm_mon >= 12) { /* month should be 0-11 */ X tm->tm_mon -= 12; X tm->tm_year++; X rc++; X } X X return(rc); X} X X/* X * leap year? X */ Xint leap_year(year) Xint year; X{ X X if (year%4000 == 0) return FALSE; X else if (year%400 == 0) return TRUE; X else if (year%100 == 0) return FALSE; X else if (year%4 == 0) return TRUE; X else return FALSE; X X} X X X X/* X * explain usage X */ Xvoid Xusage() X{ X fprintf(stderr, "Usage: [date] [-d directory] [-n ndays] [-c]\n"); X fprintf(stderr, " -c dumps all entries in calendar(1) format.\n"); X} X X/* X * dumpit dumps every single xcal entry pre-ambled with monthname, X * day, and year. X */ Xdumpit(dirname) X char *dirname; X{ X DIR *Cdirp, *ydirp; X struct dirent *Centp, *yentp; X struct stat statbuf; X char *Cpathend, *ypathend; /* loc for fname in filepath */ X char *year; /* ascii year */ X char prebuf[14]; /* "calendar" preamble space */ X char inbuf[1024]; X int i; X X if ((Cdirp = opendir(dirname)) == NULL) { /* top xcal dir */ X perror(dirname); X return(errno); X } X X strcpy(filename, dirname); /* initialize file path */ X strcat(filename, "/"); X Cpathend = filename + strlen(filename); /* put year dir here */ X X X /* for each year directory */ X while ((Centp = readdir(Cdirp)) != NULL) { /* foreach year dir */ X X if (Centp->d_name[0] == '.') continue; /* no ., .. */ X X /* check each year directory */ X strcpy(Cpathend, Centp->d_name); /* build filename */ X if ((i = stat(filename, &statbuf)) != 0) { X perror(filename); X return(errno); X } X if (!S_ISDIR(statbuf.st_mode)) { X/* fprintf(stderr, "%s not a directory, ignoring ... \n", */ X/* filename); */ X continue; X } X X if ((ydirp = opendir(filename)) == NULL) { X perror(filename); X return(errno); X } X strcat(filename, "/"); /* path to open data files */ X year = Centp->d_name + 2; /* use year in preamble */ X ypathend = filename + strlen(filename); /* where to put fnames */ X X X /* for each day file in year dir */ X while ((yentp = readdir(ydirp)) != NULL) { X X if (yentp->d_name[0] == '.') continue; X strcpy(ypathend, yentp->d_name); X if ((i = stat(filename, &statbuf)) != 0) { X perror(filename); X return(errno); X } X if (!S_ISREG(statbuf.st_mode)) { X/* fprintf(stderr, */ X/* "%s not a regular file, ignoring ... \n", */ X/* filename); */ X continue; X } X X /* build what to dump in front of info */ X sscanf( &(yentp->d_name[2]), "%d%3c", &i, prebuf); X *(prebuf+3) = '.'; sprintf(prebuf+4, " %02d ", i); X strncpy(prebuf+8, year, 4); X *(prebuf+12) = '\0'; X X /* open file and put each line in stdout, prepended */ X /* with the contents of prebuf and a tab. */ X X if (!(fd = fopen(filename, "r"))) { X fprintf(stderr, X "Error %d opening %s, ignoring ... \n", errno, X filename); X continue; /* the foreach file loop */ X } X X while (fgets(inbuf, sizeof(inbuf), fd)) { X printf("%s\t%s", prebuf, inbuf); X if (*(inbuf + strlen(inbuf) - 1) != '\n') X printf("\n"); X } X fclose(fd); X X } /* end for each day file */ X X if ((closedir(ydirp)) != 0) { X *(ypathend-1) = '\0'; /* reinit to just dirname */ X perror(filename); X } X } /* end for each year */ X X if ((closedir(Cdirp)) != 0) { X perror(dirname); X return(errno); X } X X return(0); X} SHAR_EOF if test 7326 -ne "`wc -c < 'xcshow.c'`" then echo shar: error transmitting "'xcshow.c'" '(should have been 7326 characters)' fi fi # end of overwriting check echo shar: extracting "'vixc.csh'" '(687 characters)' if test -f 'vixc.csh' then echo shar: will not over-write existing file "'vixc.csh'" else sed 's/^ X//' << \SHAR_EOF > 'vixc.csh' X#!/bin/csh X# X# edit with vi an xcal daily diary file, with date defaulting to today. X# From: Scott Brim X X# constants Xset months = \ X{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"} X X# default to today Xset thedate = `date +%m/%d/%y` Xif ($1 != "") set thedate = $1 X Xset month = `echo $thedate | cut -d/ -f1` Xset monthname = $months[$month] Xset day = `echo $thedate | cut -d/ -f2` Xset year = `echo $thedate | cut -d/ -f3` Xif ( $year < 100 ) @ year = $year + 1900 X X# build filename Xset filename = "~/Calendar/xy"${year}"/xc"${day}${monthname}${year} X Xif ($?VISUAL) then X $VISUAL $filename Xelse X /usr/ucb/vi $filename Xendif X Xexit $status SHAR_EOF if test 687 -ne "`wc -c < 'vixc.csh'`" then echo shar: error transmitting "'vixc.csh'" '(should have been 687 characters)' fi fi # end of overwriting check echo shar: extracting "'makefile'" '(242 characters)' if test -f 'makefile' then echo shar: will not over-write existing file "'makefile'" else sed 's/^ X//' << \SHAR_EOF > 'makefile' X# X# Rough makefile X# XCC = gcc XCFLAGS = -g -O X Xxcshow: xcshow.c X $(CC) $(CFLAGS) -o xcshow xcshow.c X Xinstall: xcshow X install -s -m 755 xcshow /usr/local/bin X install -c -m 755 vixc.sh /usr/local/bin/vixc X Xclean: X -rm -f *.o xcshow errs core X SHAR_EOF if test 242 -ne "`wc -c < 'makefile'`" then echo shar: error transmitting "'makefile'" '(should have been 242 characters)' fi fi # end of overwriting check echo shar: done with directory "'scott_brim'" cd .. # End of shell archive exit 0 -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.