xcal-4.1.orig/ 40755 13560 13560 0 6353237230 11627 5ustar and1000and1000xcal-4.1.orig/C_from_ad.sh100644 13560 13560 327 6037000346 14106 0ustar and1000and1000#!/bin/sh # Turn the help text file into something that C can deal with SRC=XCal.ad DST=xcal_ad.h ( echo 'static String fallbackResources[] = {' sed -e ' /^!/d s/^/"/ s/$/",/' $SRC echo 'NULL, };' ) > $DST xcal-4.1.orig/C_from_help.sh100644 13560 13560 266 6037000346 14454 0ustar and1000and1000#!/bin/sh # Turn the help text file into something that C can deal with SRC=XCal.help DST=xcal_help.h ( echo 'char helpdata[] = "\' sed -e 's/$/\\n\\/' $SRC echo '";' ) > $DST xcal-4.1.orig/Imakefile100644 13560 13560 2133 6037000346 13527 0ustar and1000and1000/* * Define InstallPsCal if you want to have pscal compiled and installed as * part of the xcal compilation and installation. */ #define InstallPsCal DEFINES = -DLONG_IS_32_BITS -DVER_VEC SRCS1 = xcal.c xcal_alarm.c xcal_buts.c xcal_days.c xcal_edit.c \ xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c strfdate.c version.c OBJS1 = xcal.o xcal_alarm.o xcal_buts.o xcal_days.o xcal_edit.o \ xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o strfdate.o version.o PROGRAMS = derived xcal INSTPGMFLAGS = $(INSTBINFLAGS) BINDIR = /usr/local/bin ComplexProgramTarget_1(xcal, XawClientLibs, -lm) InstallAppDefaults(XCal) InstallNonExec(XCal.help, $(XAPPLOADDIR)/XCal.help) derived: xcal_help.h xcal_ad.h clean:: $(RM) xcal_help.h xcal_ad.h xcal_help.h: XCal.help sh C_from_help.sh xcal_ad.h: XCal.ad sh C_from_ad.sh #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' #define IHaveSubdirs #ifdef InstallPsCal SUBDIRS = xcalpr xcalev xcal_cal pscal #else SUBDIRS = xcalpr xcalev xcal_cal #endif MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) xcal-4.1.orig/MANIFEST100644 13560 13560 6201 6037000347 13050 0ustar and1000and1000 File Name Archive # Description ----------------------------------------------------------- CHANGES 4 A large list of changes made to xcal C_from_ad.sh 1 A script to generate xcal_ad.h C_from_help.sh 1 A script to generate xcal_help.h Imakefile 1 The Imakefile MANIFEST 1 This shipping list Makefile.bsdi 6 A makefile generated on BSD/386 Makefile.sunos 5 A makefile generated on SunOS 4.1.3 Openwindow README 1 General README README.contents 1 Brief note on the contents README.install 1 How to install the whole system README.sunos 1 A caution about SunOS TODO 1 What should happen next XCal.ad 1 Default resources XCal.help 2 Default help calendar.bm 1 Bitmap help.bm 1 Bitmap help_press.bm 1 Bitmap mouse.bm 1 Bitmap mouseaway.bm 1 Bitmap patchlevel.h 1 usual patchlevel file pscal 1 PostScript directory pscal/Imakefile 1 pscal/README 1 pscal/pscal.man 1 pscal/pscal.script 5 run_xmkmf 1 script to run mkmf on all subdirs sample.regular 1 Sample regular file strfdate.c 1 Convert internal dates from a format strftime 1 BSD source of strftime just in case strftime/README 1 strftime/ptime.c 1 Small program used to test the strftime routine strftime/strftime.c 2 strftime/tzfile.h 2 version.c 1 My versioning control file xcal.c 7 Main part of program xcal.h 2 Header xcal.man 8 Manual page xcal_alarm.c 7 Source handling alarms xcal_buts.c 1 Makes buttons insensitive when pressed xcal_cal 1 xcal_cal directory xcal_cal/Imakefile 1 xcal_cal/Makefile.bsdi 4 xcal_cal/Makefile.sunos 3 xcal_cal/README 1 xcal_cal/xcal_cal.c 2 xcal_cal/xcal_cal.man 1 xcal_days.c 2 Code derived from BSD NetII tape xcal_edit.c 8 Handle edit boxes xcal_help.c 2 Handle help xcal_memo.c 6 Handle the memo box xcal_mmap.h 1 mmap control file. Edit if you don't have mmap xcal_popup.c 4 Handle all popups xcal_strip.c 6 Handle the main strip xcalev 1 xcalev directory xcalev/Imakefile 1 xcalev/Makefile.bsdi 3 xcalev/Makefile.sunos 3 xcalev/version.h 1 xcalev/xcalev.c 5 xcalev/xcalev.man 1 xcalpr 1 xcalpr directory xcalpr/Imakefile 1 xcalpr/Makefile.bsdi 3 xcalpr/Makefile.sunos 3 xcalpr/README 1 A short note xcalpr/version.h 1 xcalpr/xcal_days.c 2 Symlink to ../xcal_days.c xcalpr/xcalpr.c 4 xcalpr/xcalpr.man 1 xcal-4.1.orig/README100644 13560 13560 4332 6037000347 12602 0ustar and1000and1000Xcal is a calendar program. It generally sits on your screen displaying todays date - the format of this can be tailored to your taste. Hitting the left button in the date window gives you a `strip' showing the current month with one line per day. Daily details can be stored in files (like xcalendar - from where I stole some code). The daily details will be displayed in the strip - so you can see what you have to do. The X11 multi-line widget makes this rather nice. Daily details can be edited by poking at the appropriate day and getting an edit window. Daily details can contain times and can be used to trigger screen alarms. Each strip has `next' and `previous' button, so you can do the common actions quickly - alternatively you can hit the middle button in the date window to get a dialogue box which you can use to enter the date of the month which you want to display. A top level button on the date strip gives you access to a memo pad where you can store things that you should be doing. This panel also shows todays information so a single button click can be used to see todays appointments. I have also stolen pscal from the net and modified it to work with the program. So you can generate pretty printed calendars whenever you like - assuming that you have a PostScript printer.There are also some other support programs, xcal_cal, xcalpr and xcalev. See README.contents for more details on these. See README.install for some installation hints and pitfalls. This is release 4.1 The history is: Release 1.1 posted to comp.sources.x + two patches Release 2.1 circulated privately Release 3.1 posted unintentionally to comp.sources.x Release 3.2 posted to comp.sources.x Release 3.3 posted to comp.sources.x in 1990 Caveats Yes this IS another - `I need something real to find out about X exercise'. So, it demonstrates all those faults. Peter Collinson Hillside Systems 61 Hillside Avenue Canterbury Kent, CT2 8HA Phone: +44 227 761824 Fax: +44 227 762554 Email: pc@hillside.co.uk 7/November/1993 Fixes/enhancements welcomed.... This is free... however, if you are going to make some profit from this, then perhaps you should consider passing something back to me since I am freelance and mostly don't get paid everyday. xcal-4.1.orig/README.contents100644 13560 13560 1450 6037000347 14434 0ustar and1000and1000Here's what you get.. On this level is the source for the xcal program. If you install it by hand make sure you put XCal.ad in app_defaults. There is also in sub-directories: a) pscal An `old' program that generates calendars in PostScript. Make you calendar look nice on the wall. There's a README file in this directory that you should look at before installing. b) xcal_cal A program written by Ed Gould. It takes you calendar entries and makes a file for the standard UNIX calendar program to send you mail. c) xcalev A program that is used to pre-load your calendar with all those birthdays that you are prone to forget. d) xcalpr A program that prints calendar files out to a terminal. Nice if you have no X screen. This also can be used to generate a file for the UNIX calendar program. xcal-4.1.orig/README.install100644 13560 13560 3665 6037000347 14257 0ustar and1000and1000Well - theoretically... First identify if your system supports the mmap() system call. If not then edit the file xal_mmap.h to add #define NO_MMAP We have found that it's best to do this for Ultrix, whose mmap() call is somewhat old and limited. This only affects help file loading in xcal itself. Then make the makefiles xmkmf make Makefiles then type make derived - this makes xcal_help.h and xcal_ad.h from XCal.help and XCal.ad. You may not need to do this step if the Makefile evaluates things in the correct order type make depend type make If that appears to compile (and if you are on a Sun see README.sunos), then make install make install.man and type xcal Of course, it's won't be as easy as that - because it never is. Note on bitmaps: Some systems emit a warning when they compile the bitmaps. They object to having 8-bit values in a char array. You can ignore this, or change the define in xcal.c to permit the bitmaps to be unsigned char. Note on date formats: The code uses your system's strftime(3) routine to generate some dates. I have found that the arguments to this routine are not standard and have picked a set that seems portable. This prints dates like: Saturday 06 November 1993 and I prefer Saturday 6 November 1993 On SunOS and Solaris, you can make the routine suppress the leading zero by using `%e' is place of `%d'. If your system supports this, uncomment the relevant lines in XCal.ad before installing. This file also acts as a default fallback set of resources, so if you uncomment the lines, it's a good idea to rebuild xcal. If you are unsure what your system supports, compile the program strftime/ptime and see what is generated by different formats. Note on help installation: To regenerate the help that is loaded into the program, run sh C_from_help.sh this makes xcal_help.h from XCal.help. To have NO help strings built in, change xcal_help.h to read char helpdata[1]; xcal-4.1.orig/README.sunos100644 13560 13560 1604 6037000350 13741 0ustar and1000and1000On my 4.1.3 system running OpenWindows III. I get an apparent problem when xcal is loaded, it says: cc -o xcal -O xcal.o xcal_alarm.o xcal_buts.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o strfdate.o version.o -lXaw -lXmu -lXt -lXext -lX11 -lm ld: Undefined symbol _get_wmShellWidgetClass _get_applicationShellWidgetClass collect: /usr/bin/ld returned 2 exit status *** Error code 1 make: Fatal error: Command failed for target `xcal' This is something to do with shared libraries and -lXmu. EVEN with this message, xcal runs happily. So - ignore the message above - OR change the Makefile from $(CC) -o $@ $(LDOPTIONS) $(OBJS1) $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(LDLIBS) -lm $(EXTRA_LOAD_FLAGS) to $(CC) -o $@ $(LDOPTIONS) $(OBJS1) $(XAWLIB) -Bstatic $(XMULIB) -Bdynamic $(XTOOLLIB) $(XLIB) $(LDLIBS) -lm $(EXTRA_LOAD_FLAGS) and things will be OK. xcal-4.1.orig/TODO100644 13560 13560 614 6037000350 12363 0ustar and1000and10001) Some people would like a way to deal with annual/monthly events and to integrate that with the current strip. Not sure that this will happen. 2) There should be better support for group Calendar files. 3) It should be in ANSI C Thanks to the many people who have mailed to say thanks and added ideas to xcal. Sorry to the people who I refused to listen to or whose ideas I haven't used. xcal-4.1.orig/XCal.ad100644 13560 13560 6752 6037000350 13061 0ustar and1000and1000! XCal.ad 1.21 11/6/93 ! ! Help filename if not using internal text !XCal.helpFile: /usr/X11/lib/X11/app-defaults/XCal.help ! ! Data format strings ! I use these on my Sun - uncomment if your system supports ! %e in strftime formats !XCal.format: %A %e %B %Y !XCal.editFmt: %A %e %B %Y !XCal.already: Already editing %e %B %Y ! ! Geometry XCal.edit.geometry: 325x150 XCal.memo.geometry: 325x300 XCal.alarm.geometry: 325x100+0+150 XCal*help.geometry: 600x300 ! ! Fonts XCal.fontToday: lucidasanstypewriter-12 XCal*Font: lucidasanstypewriter-12 XCal*info.Font: lucidasans-10 XCal*alarmText*Font: 12x24 ! ! Top level dialogs XCal*newdate.Label: Enter mmm yyyy? XCal*newdate.ok.Label: OK XCal*newdate.cancel.Label: Cancel XCal*exit.Label: Really exit? XCal*exit.yes.Label: Yes XCal*exit.no.Label: No XCal*noedit.ok.Label: OK ! ! Strips & edit windows XCal*back.Label: < XCal*quit.Label: Quit XCal*next.Label: > XCal*help.Label: Help XCal*save.Label: Save XCal*edit.quit.Label: Quit XCal*edit.help.Label: Help XCal*text.scrollVertical: WhenNeeded XCal*text.scrollHorizontal: WhenNeeded XCal*text.autoFill: True ! Popups from the edit windows XCal*check.Label: Save file? XCal*check.yes.Label: Yes XCal*check.no.Label: No ! Alarms XCal*alarmText*scrollVertical: WhenNeeded XCal*alarmText*wrap: word XCal*alarmQuit.Label: Unpin XCal*alarmHold.Label: Stick ! Memo box XCal*display.scrollVertical: WhenNeeded XCal*display.scrollHorizontal: WhenNeeded XCal*display.cursor: dot XCal*memoTitle.Label: Edit the memo file XCal*weeklyEdit.Label: Edit XCal*weeklyTitle.Label: Today's regular events XCal*edit.Label: Edit XCal*memocheck.Label: Save memo file? XCal*memocheck.yes.Label: Yes XCal*memocheck.no.Label: No XCal*memoText.scrollVertical: WhenNeeded XCal*memoText.scrollHorizontal: WhenNeeded ! Help XCal*helpText.scrollVertical: Always XCal*helpText.scrollHorizontal: WhenNeeded XCal*helpText.autoFill: True XCal*help*helpQuit.Label: Quit ! ! Colours from pc - not convinced about this, I need to live with a ! colour screen for a bit to see what should be done ! !XCal.MarkBackground: wheat1 !XCal*background: wheat1 !XCal*foreground: black !XCal*quit.foreground: black !XCal*quit.background: wheat2 !XCal*edit.foreground: black !XCal*edit.background: wheat2 !XCal*weeklyEdit.foreground: black !XCal*weeklyEdit.background: wheat2 !XCal*next.foreground: black !XCal*next.background: wheat2 !XCal*back.foreground: black !XCal*back.background: wheat2 !XCal*help.foreground: black !XCal*help.background: wheat2 !XCal*save.foreground: black !XCal*save.background: wheat2 !XCal*yes.foreground: black !XCal*yes.background: wheat2 !XCal*no.foreground: black !XCal*no.background: wheat2 !XCal*helpQuit.foreground: black !XCal*helpQuit.background: wheat2 !XCal*header.foreground: black !XCal*header.background: wheat2 !XCal*Sun*Label*background: wheat2 !XCal*Sat*Label*background: wheat2 ! ! Colours from reed wade@cs.utk.edu ! !XCal*background: LightSteelBlue !XCal*foreground: SaddleBrown !XCal.MarkForeground: Black !XCal.MarkBackground: CornflowerBlue !XCal.edit.background: CornflowerBlue !XCal.edit.foreground: OliveGreen !XCal*exit.background: MediumTurquoise !XCal*exit.foreground: SlateGrey !XCal*check.background: lavender !XCal*help*background: wheat !XCal*help*foreground: blue !XCal*newdate*background: plum !XCal*newdate*foreground: red !XCal*quit.background: SteelBlue !XCal*quit.background: green !XCal*back.background: yellow !XCal*next.background: yellow !XCal*no.background: DarkKhaki !XCal*yes.background: PapayaWhip xcal-4.1.orig/calendar.bm100644 13560 13560 3530 6037000350 14004 0ustar and1000and1000#define cal_width 48 #define cal_height 48 static UNSIGNED char cal_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x01, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x01, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0xf8, 0x07, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x15, 0xaa, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x2a, 0x54, 0x01, 0xaa, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; xcal-4.1.orig/help.bm100644 13560 13560 370 6037000351 13143 0ustar and1000and1000#define help_width 16 #define help_height 13 static UNSIGNED char help_bits[] = { 0x00, 0x00, 0xc0, 0x03, 0xe0, 0x07, 0x60, 0x06, 0x00, 0x06, 0x00, 0x06, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00}; xcal-4.1.orig/help_press.bm100644 13560 13560 412 6037000351 14354 0ustar and1000and1000#define help_press_width 16 #define help_press_height 13 static UNSIGNED char help_press_bits[] = { 0x00, 0x00, 0xb0, 0x06, 0xa4, 0x12, 0x08, 0x08, 0xc2, 0x21, 0x24, 0x12, 0x10, 0x04, 0xd6, 0x35, 0x90, 0x04, 0xa4, 0x12, 0xca, 0x29, 0xc8, 0x09, 0xc0, 0x01}; xcal-4.1.orig/mouse.bm100644 13560 13560 373 6037000351 13346 0ustar and1000and1000#define mouse_width 16 #define mouse_height 13 static UNSIGNED char mouse_bits[] = { 0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; xcal-4.1.orig/mouseaway.bm100644 13560 13560 407 6037000351 14226 0ustar and1000and1000#define mouseaway_width 16 #define mouseaway_height 13 static UNSIGNED char mouseaway_bits[] = { 0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; xcal-4.1.orig/patchlevel.h100644 13560 13560 25 6037000351 14150 0ustar and1000and1000#define PATCHLEVEL 0 xcal-4.1.orig/pscal/ 40755 13560 13560 0 6134736703 12737 5ustar and1000and1000xcal-4.1.orig/pscal/Imakefile100644 13560 13560 215 6037000351 14604 0ustar and1000and1000BINDIR=/usr/local/bin AllTarget(pscal.script) InstallScript(pscal,$(BINDIR)) InstallManPage(pscal,$(MANDIR)) depend:: lint:: install.ln:: xcal-4.1.orig/pscal/README100644 13560 13560 755 6037000352 13665 0ustar and1000and1000This is a version of the pscal program that pretty prints calendars. I have modified it to work from xcal data files stored in ~/Calendar. If you are in the USA - you might like to edit pscal.script to revert page translation back to your paper size: Change: TRANSLATE="71 -120" to TRANSLATE="50 -120" This has also been worked on by David Kotz who added the -d feature and made it work on an old version of the Bourne shell that doesn't grok shell statements like: shift 5 xcal-4.1.orig/pscal/pscal.man100644 13560 13560 6746 6037000352 14632 0ustar and1000and1000.TH PSCAL 1 "8/January/1990" .SH NAME pscal .SH SYNOPSIS: .B pscal [ .B \-Pprinter ] [ .B \-R ] [ .B \-r ] [ .B \-t ] [ .B \-d directory ] [ .B other printer flags ] [ month [ year ] ] .SH DESCRIPTION: .I Pscal generates the Postscript showing a calendar for the specified month and year. The year, if omitted, defaults to the current year. If both month and year are omitted, the current month is printed. .I Year can be between 1753 and 9999. The .I month is a number between 1 and 12. I can also be a three letter month abbreviation. .LP The calendar can be loaded with information from the user. The information either comes in an `Event' file or can be derived from files under the user's Calendar directory should this exist. The search for this data is as follows, if any of these succeeds the data for the calendar is taken from that source. .IP 1) The shell variable EFILE may be set to the name of an Event file. .IP 2) An event file called `Event' may exist in the current directory. .IP 3) The file $HOME/.holiday may exist and contain a list of events. .IP 4) The directory $HOME/Calendar (or a different directory specified with the \-d option) may exist containing XCal files. .LP An event file should consist of lines of the form .IP month:day:message string .LP Messages should be 20 characters or less, with no more than 6 messages per day. No spaces should appear from the beginning of a line until after the second colon. Month and day should be numbers in the obvious ranges. .SH OPTIONS .IP "\-P\fIprinter\fR" 1i The printer may be specified with the usual \-P\fIprinter\fR syntax. .IP "\-r" 1i The calendar page is printed in ``landscape'' orientation (the default). .IP "\-R" 1i The calendar page is printed in ``portrait'' orientation; this yields a slightly smaller image and may be more suitable for embedding into other documents. .IP "\-d \fIdirectory\fR" 1i Use the given directory instead of $HOME/Calendar. .IP "\-t" 1i Causes the PostScript to be sent to the standard output, rather than to the printer. This is useful if you wish to save the output in a file, or if you want to use options with the .IR lpr (1) command. .IP "\-F\fIfont\fR" 1i Sets the font family for the title text (the month and year). .IP "\-f\fIfont\fR" 1i Sets the font family for the day-of-month numbers. .PP Other arguments starting with `\-' are passed through to .IR lpr (1). .PP Any argument whose first character is '-' is passed on to lpr. The shell variables BANNER, LFOOT, CFOOT, and RFOOT become a top centered banner, and left, centered, or right justified footers respectively. As in: .IP BANNER="Schedule 1" CFOOT=Preliminary pscal 4 90 .SH AUTHOR Patrick Wood .br Copyright (C) 1987 by Pipeline Associates, Inc. .br Permission is granted to modify and distribute this free of charge. .SH HISTORY Original From: patwood@unirot.UUCP (Patrick Wood) .br Shell stuff added 3/9/87 by King Ables .br Made pretty by tjt 1988 .br Holiday and printer flag passing hacks added Dec 1988 by smann@june.cs.washington.edu .br Used the better looking version with 5 rows of days rather than 6 hacked together with holiday and banner/footnotes added by Joe (No Relation) Wood, 12/89, jlw@lzga.ATT.COM .SH BUGS `Pscal' doesn't work for months before 1753 (weird stuff happened in September, 1752). .PP A better format for the dates of holidays would be nice. An escape to allow holiday messages to be raw PostScript would also be nice. .PP The holiday messages should be handled more intelligently (ie, the messages should be clipped to the day). xcal-4.1.orig/pscal/pscal.script100644 13560 13560 31721 6037000376 15400 0ustar and1000and1000#!/bin/sh #+ # # NAME: # pscal # # SYNOPSIS: # pscal [-Pprinter] [other printer flags] month year # # DESCRIPTION: # `Pscal' is a PostScript program to print calendars. # # The file $HOME/.holiday is read and used to print short messages # on specified days. The .holiday file should consist of lines of # the form # month:day:message string # Messages should be 20 characters or less, with no more than 6 # messages per day. No spaces should appear from the beginning # of a line until after the second colon. # Month and day should be numbers in the obvious ranges. # 12/89 - The holiday checking has been loosened up in that the # following takes place: # 1. The Shell Variable EFILE is used preferentially # 2. Then the file Events in the current directory is used # 3. Finally the $HOME/.holiday file is used. # The whole process can be turned off by setting EFILE=/dev/null. # # OPTIONS: # Any argument whose first character is '-' is passed on to lpr. # The shell variables BANNER, LFOOT, CFOOT, and RFOOT become a # top centered banner, and left, centered, or right justified # footers respectively. As in: # # BANNER="Schedule 1" CFOOT=Preliminary pscal 4 90 # # AUTHOR: # Patrick Wood # Copyright (C) 1987 by Pipeline Associates, Inc. # Permission is granted to modify and distribute this free of charge. # # HISTORY: # @Original From: patwood@unirot.UUCP (Patrick Wood) # @Shell stuff added 3/9/87 by King Ables # @Made pretty by tjt 1988 # @Holiday and printer flag passing hacks added Dec 1988 # @ by smann@june.cs.washington.edu # @Used the better looking version with 5 rows of days rather than 6 # @ hacked together with holiday and banner/footnotes added # @ by Joe (No Relation) Wood, 12/89, jlw@lzga.ATT.COM # @Fixed "-R" (didn't work at all; now it at least works on 8.5x11) # @Also fixed handling of unrecognized arguments # @ by Jeff Mogul, 1/90, mogul@decwrl.dec.com # # BUGS: # `Pscal' doesn't work for months before 1753 (weird stuff happened # in September, 1752). # # A better format for the dates of holidays would be nice. # An escape to allow holiday messages to be raw PostScript would # also be nice. # The holiday messages should be handled more intelligently (ie, # the messages should be clipped to the day). # # # PostScript program to print calendars. # Doesn't deal well with September 1752 or before. # USAGE="Usage: pscal [ -Rrt ] [ -F hfont ] [ -f font ] [-d directory] [ month [ year ] ]" TFONT=Times-Bold DFONT=Helvetica-Bold EFONT=Times-Roman Calendar=$HOME/Calendar ROTATE=90 SCALE="1.0 1.0" # Was 50 -120 - changed to 71 -120 for A4 Use TRANSLATE="71 -120" LPR="lpr" while test $# != 0 do case $1 in -P) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } eval ENVAR="$1$2"; shift; shift;; -P*) eval ENVAR=$1; shift;; -F) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } TFONT="$2"; shift; shift;; -F*) TFONT=`echo $1 | sed -n 1s/-.//p`; shift;; -f) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } DFONT="$2"; shift; shift;; -f*) DFONT=`echo $1 | sed -n 1s/-.//p`; shift;; -t) LPR=cat; shift;; -r) ROTATE=90; shift;; -R) ROTATE=0; SCALE="0.75 0.75"; TRANSLATE="50 900"; shift;; -d) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; } Calendar="$2"; shift; shift;; --|-) break;; -*) eval ENVAR=\"$ENVAR $1\"; shift;; *) break esac done test $# -gt 2 && { echo "$USAGE" 1>&2; exit 1; } case $# in 0) set `date`; YEAR=$6; MONTH=$2;; 1) MONTH=$1; set `date`; YEAR=$6;; 2) MONTH=$1 YEAR=$2;; esac MONTH=`case $MONTH in Jan|jan) echo 1;;Feb|feb) echo 2;;Mar|mar) echo 3;;Apr|apr) echo 4;; May|may) echo 5;;Jun|jun) echo 6;;Jul|jul) echo 7;;Aug|aug) echo 8;; Sep|sep) echo 9;;Oct|oct) echo 10;;Nov|nov) echo 11;;Dec|dec) echo 12;; 1|2|3|4|5|6|7|8|9|10|11|12) echo $MONTH;;esac` MONTHNAME=`sed -n ${MONTH}p < /tmp/pscal$$ holidays=`cat /tmp/pscal$$` rm -f /tmp/pscal$$ esac fi case "$monthday" in yes) holidays=`cat $Files | grep \^$MONTH: | awk -F: '{printf("%s ( %s",$2,$3);\ for(i = 4; i <= NF; i++) printf(":%s", $i);printf(")\n"); }'` esac $LPR $ENVAR < #include #include #include #include #include #include "xcal.h" static char **afmt = appResources.sday; static char **Afmt = appResources.day; static char **bfmt = appResources.smon; static char **Bfmt = appResources.mon; static size_t gsize; static char *pt; static int _add(), _conv(); static size_t _fmt(); size_t strfdate(s, maxsize, format, d) char *s; size_t maxsize; char *format; Date *d; { pt = s; if ((gsize = maxsize) < 1) return(0); if (_fmt(format, d)) { *pt = '\0'; return(maxsize - gsize); } return(0); } static size_t _fmt(format, d) register char *format; Date *d; { for (; *format; ++format) { if (*format == '%') switch(*++format) { case '\0': --format; break; case 'A': if (d->wday < 0 || d->wday > 6) return(0); if (!_add(Afmt[d->wday])) return(0); continue; case 'a': if (d->wday < 0 || d->wday > 6) return(0); if (!_add(afmt[d->wday])) return(0); continue; case 'B': if (d->month < 0 || d->month > 11) return(0); if (!_add(Bfmt[d->month])) return(0); continue; case 'b': case 'h': if (d->month < 0 || d->month > 11) return(0); if (!_add(bfmt[d->month])) return(0); continue; case 'D': if (!_fmt("%m/%d/%y", d)) return(0); continue; case 'd': if (!_conv(d->day, 2, '0')) return(0); continue; case 'e': if (!_conv(d->day, 2, ' ')) return(0); continue; case 'm': if (!_conv(d->month + 1, 2, '0')) return(0); continue; case 'n': if (!_add("\n")) return(0); continue; case 't': if (!_add("\t")) return(0); continue; case 'x': if (!_fmt("%m/%d/%y", d)) return(0); continue; case 'y': if (!_conv((d->year) % 100, 2, '0')) return(0); continue; case 'Y': if (!_conv(d->year, 4, '0')) return(0); continue; case '%': /* * X311J/88-090 (4.12.3.5): if conversion char is * undefined, behavior is undefined. Print out the * character itself as printf(3) does. */ default: break; } if (!gsize--) return(0); *pt++ = *format; } return(gsize); } static _conv(n, digits, pad) int n, digits; char pad; { static char buf[10]; register char *p; for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits) *p-- = n % 10 + '0'; while (p > buf && digits-- > 0) *p-- = pad; return(_add(++p)); } static _add(str) register char *str; { for (;; ++pt, --gsize) { if (!gsize) return(0); if (!(*pt = *str++)) return(1); } } xcal-4.1.orig/strftime/ 40755 13560 13560 0 6037000361 13454 5ustar and1000and1000xcal-4.1.orig/strftime/README100644 13560 13560 536 6037000354 14417 0ustar and1000and1000The xcal program now uses strftime to create dates and time strings. I include the Net II version here, just in case you don't have it on your system. I would guess that it will need some work to make it compile in a non BSD environment. The program `ptime' here is a test bed for the strftime routine. See ../README.install for more information. xcal-4.1.orig/strftime/ptime.c100644 13560 13560 1554 6037000354 15042 0ustar and1000and1000#ifndef lint static char *sccsid = "%W% (Hillside Systems) %G%"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * program name: ptime.c * function: diagnostic program for strftime. When given a number of strings, eg ptime "%x X" will invoke the strftime routine to print the result. * libraries used: standard * compile time parameters: cc -o ptime -O ptime.c * history: Written November 1993 Peter Collinson Hillside Systems * (C) Copyright: 1993 Hillside Systems/Peter Collinson ***/ #include #include #include char buf[512]; main(argc, argv) int argc; char **argv; { time_t ti; struct tm *tm; time(&ti); tm = localtime(&ti); while (--argc) { argv++; strftime(buf, sizeof buf, *argv, tm); printf("%s - %s\n", *argv, buf); } exit(0); } xcal-4.1.orig/strftime/strftime.c100644 13560 13560 15316 6037000361 15600 0ustar and1000and1000/* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strftime.c 5.11 (Berkeley) 2/24/91"; #endif /* LIBC_SCCS and not lint */ #include #include #include #include static char *afmt[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", }; static char *Afmt[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", }; static char *bfmt[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; static char *Bfmt[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }; static size_t gsize; static char *pt; static int _add(), _conv(), _secs(); size_t strftime(s, maxsize, format, t) char *s; size_t maxsize; const char *format; const struct tm *t; { static size_t _fmt(); pt = s; if ((gsize = maxsize) < 1) return(0); if (_fmt(format, t)) { *pt = '\0'; return(maxsize - gsize); } return(0); } static size_t _fmt(format, t) register char *format; struct tm *t; { for (; *format; ++format) { if (*format == '%') switch(*++format) { case '\0': --format; break; case 'A': if (t->tm_wday < 0 || t->tm_wday > 6) return(0); if (!_add(Afmt[t->tm_wday])) return(0); continue; case 'a': if (t->tm_wday < 0 || t->tm_wday > 6) return(0); if (!_add(afmt[t->tm_wday])) return(0); continue; case 'B': if (t->tm_mon < 0 || t->tm_mon > 11) return(0); if (!_add(Bfmt[t->tm_mon])) return(0); continue; case 'b': case 'h': if (t->tm_mon < 0 || t->tm_mon > 11) return(0); if (!_add(bfmt[t->tm_mon])) return(0); continue; case 'C': if (!_fmt("%a %b %e %H:%M:%S %Y", t)) return(0); continue; case 'c': if (!_fmt("%m/%d/%y %H:%M:%S", t)) return(0); continue; case 'D': if (!_fmt("%m/%d/%y", t)) return(0); continue; case 'd': if (!_conv(t->tm_mday, 2, '0')) return(0); continue; case 'e': if (!_conv(t->tm_mday, 2, ' ')) return(0); continue; case 'H': if (!_conv(t->tm_hour, 2, '0')) return(0); continue; case 'I': if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, '0')) return(0); continue; case 'j': if (!_conv(t->tm_yday + 1, 3, '0')) return(0); continue; case 'k': if (!_conv(t->tm_hour, 2, ' ')) return(0); continue; case 'l': if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, ' ')) return(0); continue; case 'M': if (!_conv(t->tm_min, 2, '0')) return(0); continue; case 'm': if (!_conv(t->tm_mon + 1, 2, '0')) return(0); continue; case 'n': if (!_add("\n")) return(0); continue; case 'p': if (!_add(t->tm_hour >= 12 ? "PM" : "AM")) return(0); continue; case 'R': if (!_fmt("%H:%M", t)) return(0); continue; case 'r': if (!_fmt("%I:%M:%S %p", t)) return(0); continue; case 'S': if (!_conv(t->tm_sec, 2, '0')) return(0); continue; case 's': if (!_secs(t)) return(0); continue; case 'T': case 'X': if (!_fmt("%H:%M:%S", t)) return(0); continue; case 't': if (!_add("\t")) return(0); continue; case 'U': if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, 2, '0')) return(0); continue; case 'W': if (!_conv((t->tm_yday + 7 - (t->tm_wday ? (t->tm_wday - 1) : 6)) / 7, 2, '0')) return(0); continue; case 'w': if (!_conv(t->tm_wday, 1, '0')) return(0); continue; case 'x': if (!_fmt("%m/%d/%y", t)) return(0); continue; case 'y': if (!_conv((t->tm_year + TM_YEAR_BASE) % 100, 2, '0')) return(0); continue; case 'Y': if (!_conv(t->tm_year + TM_YEAR_BASE, 4, '0')) return(0); continue; case 'Z': if (!t->tm_zone || !_add(t->tm_zone)) return(0); continue; case '%': /* * X311J/88-090 (4.12.3.5): if conversion char is * undefined, behavior is undefined. Print out the * character itself as printf(3) does. */ default: break; } if (!gsize--) return(0); *pt++ = *format; } return(gsize); } static _secs(t) struct tm *t; { static char buf[15]; register time_t s; register char *p; struct tm tmp; /* Make a copy, mktime(3) modifies the tm struct. */ tmp = *t; s = mktime(&tmp); for (p = buf + sizeof(buf) - 2; s > 0 && p > buf; s /= 10) *p-- = s % 10 + '0'; return(_add(++p)); } static _conv(n, digits, pad) int n, digits; char pad; { static char buf[10]; register char *p; for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits) *p-- = n % 10 + '0'; while (p > buf && digits-- > 0) *p-- = pad; return(_add(++p)); } static _add(str) register char *str; { for (;; ++pt, --gsize) { if (!gsize) return(0); if (!(*pt = *str++)) return(1); } } xcal-4.1.orig/strftime/tzfile.h100644 13560 13560 12000 6037000361 15230 0ustar and1000and1000/* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Arthur David Olson of the National Cancer Institute. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)tzfile.h 5.10 (Berkeley) 4/3/91 */ #ifndef _TZFILE_H_ #define _TZFILE_H_ /* * Information about time zone files. */ /* Time zone object file directory */ #define TZDIR "/usr/share/zoneinfo" #define TZDEFAULT "/etc/localtime" #define TZDEFRULES "posixrules" /* ** Each file begins with. . . */ struct tzhead { char tzh_reserved[24]; /* reserved for future use */ char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ char tzh_leapcnt[4]; /* coded number of leap seconds */ char tzh_timecnt[4]; /* coded number of transition times */ char tzh_typecnt[4]; /* coded number of local time types */ char tzh_charcnt[4]; /* coded number of abbr. chars */ }; /* ** . . .followed by. . . ** ** tzh_timecnt (char [4])s coded transition times a la time(2) ** tzh_timecnt (unsigned char)s types of local time starting at above ** tzh_typecnt repetitions of ** one (char [4]) coded GMT offset in seconds ** one (unsigned char) used to set tm_isdst ** one (unsigned char) that's an abbreviation list index ** tzh_charcnt (char)s '\0'-terminated zone abbreviations ** tzh_leapcnt repetitions of ** one (char [4]) coded leap second transition times ** one (char [4]) total correction after above ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition ** time is standard time, if FALSE, ** transition time is wall clock time ** if absent, transition times are ** assumed to be wall clock time */ /* ** In the current implementation, "tzset()" refuses to deal with files that ** exceed any of the limits below. */ /* ** The TZ_MAX_TIMES value below is enough to handle a bit more than a ** year's worth of solar time (corrected daily to the nearest second) or ** 138 years of Pacific Presidential Election time ** (where there are three time zone transitions every fourth year). */ #define TZ_MAX_TIMES 370 #define NOSOLAR /* 4BSD doesn't currently handle solar time */ #ifndef NOSOLAR #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ #else #define TZ_MAX_TYPES 10 /* Maximum number of local time types */ #endif #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ #define SECSPERMIN 60 #define MINSPERHOUR 60 #define HOURSPERDAY 24 #define DAYSPERWEEK 7 #define DAYSPERNYEAR 365 #define DAYSPERLYEAR 366 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) #define MONSPERYEAR 12 #define TM_SUNDAY 0 #define TM_MONDAY 1 #define TM_TUESDAY 2 #define TM_WEDNESDAY 3 #define TM_THURSDAY 4 #define TM_FRIDAY 5 #define TM_SATURDAY 6 #define TM_JANUARY 0 #define TM_FEBRUARY 1 #define TM_MARCH 2 #define TM_APRIL 3 #define TM_MAY 4 #define TM_JUNE 5 #define TM_JULY 6 #define TM_AUGUST 7 #define TM_SEPTEMBER 8 #define TM_OCTOBER 9 #define TM_NOVEMBER 10 #define TM_DECEMBER 11 #define TM_YEAR_BASE 1900 #define EPOCH_YEAR 1970 #define EPOCH_WDAY TM_THURSDAY /* ** Accurate only for the past couple of centuries; ** that will probably do. */ #define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) #endif /* !_TZFILE_H_ */ xcal-4.1.orig/version.c100644 13560 13560 1645 6037000354 13555 0ustar and1000and1000/* * Version control file * version.c 4.1 11/17/93 * Automatically created on Wed Nov 17 11:23:44 GMT 1993 * * Hand edit none of this if you want freeze to continue to work */ #ifdef VER_PROG #define PROGNAME XCal #endif #ifdef VER_VEC char version[] = "XCal Version 4.1, released Wed Nov 17 11:23:44 GMT 1993"; #endif #ifdef VER_DEF #define VERSION "XCal Version 4.1, released Wed Nov 17 11:23:44 GMT 1993" #endif /* SCCS files * +1.26 Imakefile +3.19 xcal_help.c +1.3 calendar.bm +1.26 xcal.man +1.22 xcal_memo.c +1.21 XCal.ad +1.24 xcal_alarm.c +3.37 xcal_edit.c +1.8 README +2.3 patchlevel.h +3.27 xcal_strip.c +1.3 help_press.bm +3.13 xcal_popup.c +3.50 xcal.c +3.32 xcal.h +2.38 CHANGES +1.3 mouse.bm +1.3 mouseaway.bm +1.2 XCal.help +1.3 help.bm +1.2 README.sunos +1.2 xcal_days.c +1.3 xcal_buts.c +1.2 C_from_help.sh +1.3 strfdate.c +1.1 C_from_ad.sh +1.2 README.install +1.1 README.contents +1.1 xcal_mmap.h * */ xcal-4.1.orig/xcal_buts.c100644 13560 13560 7137 6037000355 14057 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_buts.c 1.3 (Hillside Systems) 10/25/93"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_buts.c * function: Deal with callback management for sensitive buttons When a button is pressed we make it insensitive. In general a button starts a popup - when the popup dies we reset the button. Problem is when the button dies before the popup. * history: Written October 1993 Peter Collinson Hillside Systems * (C) Copyright: 1989 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include #include #include #include #include #include #include #include "xcal.h" typedef struct active { struct active *next; Widget button; Widget popup; } Active; static Active *act; /* * Local routines */ static void AddToActive(); static Active *LookActive(); static Active *LookPopup(); static void DeleteFromActive(); static void PopupIsDead(); static void ButtonIsDead(); /* * Here's the global entry point * given a button and a popup * make the button insensitive * add a destroy callback to the popup to turn the button on again when * the popup dies - assuming the button is in the list * add a destroy callback to the button to remove the button from the list */ void ButtonOff(but, popup) Widget but; Widget popup; { XtSetSensitive(but, False); XtAddCallback(popup, XtNdestroyCallback, PopupIsDead, but); XtAddCallback(but, XtNdestroyCallback, ButtonIsDead, but); AddToActive(but, popup); } /* * Turn a button on */ void ButtonOn(but) Widget but; { Active *ap; if (ap = LookActive(but)) { XtRemoveCallback(but, XtNdestroyCallback, ButtonIsDead, but); XtSetSensitive(but, True); DeleteFromActive(but); } } /* * Turn a help button on */ void HelpButtonOn(popup) Widget popup; { Active *ap; while (ap = LookPopup(popup)) ButtonOn(ap->button); } /* * Callbacks * 1) called from popup when it dies */ /* ARGSUSED */ static void PopupIsDead(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { ButtonOn((Widget) closure); } /* * Callbacks * 2) called when button is dead */ /* ARGSUSED */ static void ButtonIsDead(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { Active *ap; Widget but = (Widget)closure; if (ap = LookActive(but)) { XtRemoveCallback(ap->popup, XtNdestroyCallback, PopupIsDead, but); DeleteFromActive(but); } } /* * Add a button to the active list */ static void AddToActive(but, popup) Widget but; Widget popup; { Active *ap; if (LookActive(but) == NULL) { ap = (Active *) XtMalloc(sizeof (Active)); ap->button = but; ap->popup = popup; ap->next = act; act = ap; } /* not convinced that the else arm here is a never happen */ } static Active * LookActive(but) Widget but; { Active *ap; for (ap = act; ap; ap = ap->next) { if (ap->button == but) return ap; } return NULL; } static Active * LookPopup(popup) Widget popup; { Active *ap; for (ap = act; ap; ap = ap->next) { if (ap->popup == popup) return ap; } return NULL; } /* * remove an active entry */ static void DeleteFromActive(but) Widget but; { Active *ap; Active *lp = NULL; for (ap = act; ap; ap = ap->next) { if (ap->button == but) { if (lp == NULL) act = ap->next; else lp->next = ap->next; XtFree((char *)ap); return; } lp = ap; } } xcal-4.1.orig/xcal_cal/ 40755 13560 13560 0 6134736703 13403 5ustar and1000and1000xcal-4.1.orig/xcal_cal/Imakefile100644 13560 13560 167 6037000355 15262 0ustar and1000and1000BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) AllTarget(xcal_cal) SimpleProgramTarget(xcal_cal) DependTarget() xcal-4.1.orig/xcal_cal/README100644 13560 13560 163 6037000355 14325 0ustar and1000and1000This program was contributed by Ed Gould, then of Mt Xinu, now of DEC. I suspect that it is superseded by xcalpr. xcal-4.1.orig/xcal_cal/xcal_cal.man100644 13560 13560 2165 6037000356 15735 0ustar and1000and1000.TH XCAL_CAL (1) .SH NAME xcal_cal \- interface to calendar(1) for xcal .SH SYNOPSIS .B xcal_cal [ .B \-d directory ] [ .B \-f file ] [ .B \-m ] [ .B \-# ] .SH DESCRIPTION .I Xcal_cal reads through the files created by .IR xcal (1) and creates a file suitable for use by .IR calendar (1). By default, the files are found in a directory named ``Calendar'' in the user's home directory; an alternate directory may be specified with the .B \-d flag. .LP Output goes by default into a file named ``.xcal'' in the user's home directory; it may be overridden with the .B \-f flag. In both cases, if the argument given begins with a slash (`/'), then it will be taken as a full path name, not as a path relative to the user's home directory. If the argument begins with the two character sequence `./' then it will be taken relative to the current directory. This last form is primarily intended for use while debugging. .LP The .B \-m flag directs that multi-line entries in .I xcal files be collected in their entirety. By default, only the first line is copied. .SH "SEE ALSO xcal(1),xcalev(1),xcalpr(1) .SH AUTHOR Ed Gould, Mt.Xinu. Thanks Ed. xcal-4.1.orig/xcal_cal/xcal_cal.c100644 13560 13560 12155 6037000362 15421 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_cal.c 1.1+ (Hillside Systems) 7/14/90"; #endif /* lint */ /*** * program name: xcal_cal.c * function: read files generated by xcal and produce a file compatible with the standard "calendar" utility * switches: -d dir use "dir" instead of "Calendar" -f file use "file" instead of .xcal -m copy all of multi-line entries * history: Written July, 1990 Ed Gould mt Xinu, Inc. * (C) Copyright: 1990 mt Xinu, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose is hereby granted to anyone, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Ed Gould and mt Xinu, Inc. not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. mt Xinu, Inc. makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Ed Gould and mt Xinu, Inc. DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Ed Gould or mt Xinu, Inc. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***/ #include #include #include #include #if defined(NeXT) # include # include # include #else # include #endif #include #include char *directory = "Calendar"; char *file = ".xcal"; char *home; #ifndef MAXPATHLEN # define MAXPATHLEN 256 #endif char usedir[MAXPATHLEN]; char usefile[MAXPATHLEN]; char line[BUFSIZ]; char *months[] = {"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"}; int debug; int mflag; FILE *out; void main(argc, argv) char **argv; { register int c; time_t now; register struct tm *lt; char *getenv(); while((c = getopt(argc, argv, "d:f:m#")) != EOF) { extern char *optarg; switch (c) { case 'd': directory = optarg; break; case 'f': file = optarg; break; case 'm': mflag++; break; case '#': debug++; break; case '?': default: fprintf(stderr, "usage: %s [-d dir] [-f file]\n", argv[0]); exit(1); } } home = getenv("HOME"); /* * For both directory and output file, * * /... is absolute path * ./... is relative to current directory * * otherwise, relative to $HOME, if available */ if(file[0] == '/' || (file[0] == '.' && file[1] == '/') || home == NULL) strcpy(usefile, file); else sprintf(usefile, "%s/%s", home, file); if(debug) fprintf(stderr, "output to %s\n", usefile); if((out = fopen(usefile, "w")) == NULL) { perror(usefile); exit(1); } now = time((time_t *)NULL); lt = localtime(&now); calfiles(directory, lt->tm_year + 1900, lt->tm_mon, lt->tm_mday); if(lt->tm_mday >= 25 ) { /* * close to end of month: include next month, too */ if(lt->tm_mon == 11) calfiles(directory, lt->tm_year + 1900 + 1, 0, 1); else calfiles(directory, lt->tm_year + 1900, lt->tm_mon + 1, 1); } } calfiles(dir, year, thismonth, today) register char *dir; { register DIR *dp; register char *to; register char *from; register struct dirent *d; char day[3]; char month[4]; if(dir[0] == '/' || (dir[0] == '.' && dir[1] == '/') || home == NULL) sprintf(usedir, "%s/xy%4d", dir, year); else sprintf(usedir, "%s/%s/xy%4d", home, dir, year); if(debug) fprintf(stderr, "looking in directory %s\n", usedir); if((dp = opendir(usedir)) == NULL) { perror(usedir); exit(1); } while((d = readdir(dp)) != NULL) { register FILE *in; if(d->d_name[0] != 'x' || d->d_name[1] != 'c' || !isascii(d->d_name[2]) || !isdigit(d->d_name[2])) continue; sprintf(usefile, "%s/%s", usedir, d->d_name); if(debug) fprintf(stderr, "looking in file %s\n", usefile); if((in = fopen(usefile, "r")) == NULL) { if(debug) perror(usefile); continue; } from = &d->d_name[2]; to = day; while(isascii(*from) && isdigit(*from)) *to++ = *from++; *to = '\0'; to = month; while(isascii(*from) && !isdigit(*from)) { if(isupper(*from)) *from = tolower(*from); *to++ = *from++; } *to = '\0'; if(strcmp(month, months[thismonth]) != 0 || atoi(day) < today) { if(debug) fprintf(stderr, "\tskipped - date\n"); fclose(in); continue; } while(fgets(line, sizeof(line), in) != NULL) { char *cp; if((to = strchr(line, '\n')) != NULL) *to = '\0'; cp = line; while(isspace(*cp)) cp++; if(*cp == '\0') { if(debug) fprintf(stderr, "\tskipped - empty\n"); continue; } if(debug) fprintf(stderr, "==>\t%s %s\t%s\n", month, day, cp); fprintf(out, "%s %s\t%s\n", month, day, cp); if(mflag == 0) break; } fclose(in); } } xcal-4.1.orig/xcal_cal/Makefile.sunos100644 13560 13560 21241 6037000365 16314 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ # # The cpp used on this machine replaces all newlines and multiple tabs and # spaces in a macro expansion with a single space. Imake tries to compensate # for this, but is not always successful. # ########################################################################### # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-wide parameters may be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor doesn't define any unique symbols, you'll need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make Makefile", "make Makefiles", or "make World"). # # If you absolutely can't get imake to work, you'll need to set the # variables at the top of each Makefile as well as the dependencies at the # bottom (makedepend will do this automatically). # ########################################################################### # platform-specific configuration parameters - edit sun.cf to change # platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ # operating system: SunOS 4.0.3 ########################################################################### # site-specific configuration parameters - edit site.def to change SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc COMPRESS = compress CPP = /lib/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags SHAREDCODEDEF = -DSHAREDCODE SHLIBDEF = -DSUNSHLIB PROTO_DEFINES = INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0664 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 DESTDIR = TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = COMPATFLAGS = ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) LDCOMBINEFLAGS = -X -r MACROFILE = sun.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) ########################################################################### # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ ########################################################################### # X Window System make variables; this need to be coordinated with rules # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ PATHSEP = / USRLIBDIR = $(DESTDIR)/usr/lib BINDIR = $(DESTDIR)/usr/bin/X11 INCROOT = $(DESTDIR)/usr/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = $(DESTDIR)/usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm AWMDIR = $(LIBDIR)/awm TWMDIR = $(LIBDIR)/twm GWMDIR = $(LIBDIR)/gwm MANPATH = $(DESTDIR)/usr/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)n LIBMANDIR = $(MANSOURCEPATH)3 XAPPLOADDIR = $(LIBDIR)/app-defaults SOXLIBREV = 4.2 SOXTREV = 4.0 SOXAWREV = 4.0 SOOLDXREV = 4.0 SOXMUREV = 4.0 SOXEXTREV = 4.0 FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftosnf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh CONFIGSRC = $(TOP)/config CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf MKFONTDIRSRC = $(FONTSRC)/mkfontdir EXTENSIONSRC = $(TOP)/extensions DEPEXTENSIONLIB = EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXMULIB = XMULIB = -lXmu DEPOLDXLIB = OLDXLIB = -loldX DEPXTOOLLIB = XTOOLLIB = -lXt DEPXAWLIB = XAWLIB = -lXaw LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln LINTXLIB = $(USRLIBDIR)/llib-lX11.ln LINTXMU = $(USRLIBDIR)/llib-lXmu.ln LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln LINTXAW = $(USRLIBDIR)/llib-lXaw.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) ########################################################################### # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ ########################################################################### # start of Imakefile BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) all:: xcal_cal OBJS = xcal_cal.o SRCS = xcal_cal.c PROGRAM = xcal_cal all:: xcal_cal xcal_cal: $(OBJS) $(DEPLIBS) $(RM) $@ $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) saber_xcal_cal: #load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) osaber_xcal_cal: #load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) install:: xcal_cal $(INSTALL) -c $(INSTPGMFLAGS) xcal_cal $(BINDIR) install.man:: xcal_cal.man $(INSTALL) -c $(INSTMANFLAGS) xcal_cal.man $(MANDIR)/xcal_cal.n depend:: $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) $(PROGRAM) depend:: $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) ########################################################################### # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) \#* Makefile:: -@if [ -f Makefile ]; then \ echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS saber: #load $(ALLDEFINES) $(SRCS) osaber: #load $(ALLDEFINES) $(OBJS) ########################################################################### # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" Makefiles:: includes:: ########################################################################### # dependencies generated by makedepend xcal-4.1.orig/xcal_cal/Makefile.bsdi100644 13560 13560 23062 6037000372 16067 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $ # ------------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-specific parameters should be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor does not define any unique symbols, you will need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make World" the first time). # # ------------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ # ------------------------------------------------------------------------- # platform-specific configuration parameters - edit bsd.cf to change # platform: $XConsortium: bsd.cf,v 1.18 91/07/30 12:10:52 rws Exp $ # operating system: 4.3bsd # ------------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc AS = as COMPRESS = compress CPP = /usr/bin/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f TROFF = groff -Tps MSMACROS = -ms TBL = tbl EQN = eqn STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags PROTO_DEFINES = INSTPGMFLAGS = -s INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 PROJECTROOT = /usr/X11 TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR) LDCOMBINEFLAGS = -X -r DEPENDFLAGS = MACROFILE = bsd.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) # ------------------------------------------------------------------------- # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.138.1.1 92/11/11 09:49:19 rws Exp $ # ------------------------------------------------------------------------- # X Window System make variables; this need to be coordinated with rules PATHSEP = / USRLIBDIR = /usr/X11/lib BINDIR = /usr/X11/bin INCROOT = /usr/X11/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm TWMDIR = $(LIBDIR)/twm MANPATH = /usr/X11/man MANSOURCEPATH = $(MANPATH)/man MANSUFFIX = n LIBMANSUFFIX = 3 MANDIR = $(MANSOURCEPATH)$(MANSUFFIX) LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX) NLSDIR = $(LIBDIR)/nls PEXAPIDIR = $(LIBDIR)/PEX XAPPLOADDIR = $(LIBDIR)/app-defaults FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftopcf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier CONFIGSRC = $(TOP)/config DOCUTILSRC = $(TOP)/doc/util CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir FSLIBSRC = $(FONTSRC)/lib/fs FONTSERVERSRC = $(FONTSRC)/server EXTENSIONSRC = $(TOP)/extensions XILIBSRC = $(EXTENSIONSRC)/lib/xinput PEXLIBSRC = $(EXTENSIONSRC)/lib/PEXlib PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a XDMCPLIB = -lXdmcp DEPXMULIB = $(USRLIBDIR)/libXmu.a XMULIB = -lXmu DEPOLDXLIB = $(USRLIBDIR)/liboldX.a OLDXLIB = -loldX DEPXTOOLLIB = $(USRLIBDIR)/libXt.a XTOOLLIB = -lXt DEPXAWLIB = $(USRLIBDIR)/libXaw.a XAWLIB = -lXaw DEPXILIB = $(USRLIBDIR)/libXi.a XILIB = -lXi DEPPEXLIB = $(USRLIBDIR)/libPEX5.a PEXLIB = -lPEX5 DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a PHIGSLIB = -lphigs DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a XBSDLIB = -lXbsd LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln LINTXI = $(LINTLIBDIR)/llib-lXi.ln LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) # ------------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $ # ------------------------------------------------------------------------- # start of Imakefile BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) all:: xcal_cal OBJS = xcal_cal.o SRCS = xcal_cal.c PROGRAM = xcal_cal all:: xcal_cal xcal_cal: $(OBJS) $(DEPLIBS) $(RM) $@ $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) install:: xcal_cal -@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi $(INSTALL) -c $(INSTPGMFLAGS) xcal_cal $(DESTDIR)$(BINDIR) install.man:: xcal_cal.man -@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi $(INSTALL) -c $(INSTMANFLAGS) xcal_cal.man $(DESTDIR)$(MANDIR)/xcal_cal.$(MANSUFFIX) depend:: $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) $(PROGRAM) depend:: $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) # ------------------------------------------------------------------------- # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS # ------------------------------------------------------------------------- # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" Makefiles:: includes:: # ------------------------------------------------------------------------- # dependencies generated by makedepend xcal-4.1.orig/xcal_mmap.h100644 13560 13560 356 6037000356 14016 0ustar and1000and1000/* * xcal_mmap.h 1.1 11/6/93 * * mmap control file * All programs that use mmap include this file * if your system does not have mmap or it gives errors, * #define NO_MMAP in this file. */ /* #define NO_MMAP */ xcal-4.1.orig/xcalev/ 40755 13560 13560 0 6134736703 13117 5ustar and1000and1000xcal-4.1.orig/xcalev/Imakefile100644 13560 13560 206 6037000356 14771 0ustar and1000and1000DEFINES=-DVER_VEC BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) AllTarget(xcalev) SimpleProgramTarget(xcalev) DependTarget() xcal-4.1.orig/xcalev/version.h100644 13560 13560 763 6037000356 15026 0ustar and1000and1000/* * Version control file * version.h 1.5 11/15/93 * Automatically created on Mon Nov 15 23:57:53 GMT 1993 * * Hand edit none of this if you want freeze to continue to work */ #ifdef VER_PROG #define PROGNAME xcalev #endif #ifdef VER_VEC char version[] = "xcalev Version 1.5, released Mon Nov 15 23:57:53 GMT 1993"; #endif #ifdef VER_DEF #define VERSION "xcalev Version 1.5, released Mon Nov 15 23:57:53 GMT 1993" #endif /* SCCS files * +1.15 xcalev.c +1.2 xcalev.man +1.6 Imakefile * */ xcal-4.1.orig/xcalev/xcalev.man100644 13560 13560 5405 6037000357 15166 0ustar and1000and1000.TH XCALEV 1 "October 1993" "X Version 11 R5" .SH NAME xcalev \- load xcal calendar files with regular dates .SH SYNTAX .B xcalev [ .B \-r ][ .B \-x ][ .B \-f file ][ .B \-d .I dir ][ .I year ] .SH DESCRIPTION .I Xcalev is used to preload the calendar files for the .I xcal program with regular events in your life. It reads lines from a file (usually called .B regular stored in your .B Calendar directory. Each line in the file contains three fields separated by spaces or tabs, these are: a month name, a day in the month and some text. For example: .br .nf December 25 Christmas Dec 31 New Year's Eve .fi .LP The order of the month and the day are optional, the program deduces the day by looking whether the string contains an initial numeric character or not. The year defaults to the current year unless the program is given a year number as an argument. This year cannot be abbreviated to two digits because .I xcal deals with years from year zero. There's a rough validity check on this. .LP The string from the data line is inserted in the appropriate file and will appear in your .I xcal date strip. Nothing will happen if the string already exists in the file for that day. This means that it's safe to run .I xcalev at any time, only the strings that have altered in the .B regular file will be updated. .LP To help with entering the same event for a number of days in one month, you can give a day range with a hyphen .br .nf Jan 16-21 Usenix SF .fi .LP If you supply the .I \-r option, .I xcalev will delete all the matching strings that it finds in the appropriate daily file. So, if you want to make radical changes to the .B regular file, you should run .I xcalev with the .I \-r option to remove all the current entries from one year, edit the .B regular file and run .I xcalev to reload things. .SH OPTIONS .LP The .I \-r option makes .I xcalev delete rather than append entries. .LP The .I \-x option makes .I xcalev operate with Calendar files that are compatible with the .I xcalendar program. .LP The .I \-f switch is followed by a filename gives an alternative name for the .B regular file. If the filename does not start with a slash or a dot, then the name of your Calendar directory will be prepended to it. .LP The .I \-d switch is followed by a directory name and specifies an alterative location for your Calendar directory. Your home directory is prepended if the name doesn't start with a slash or a dot. .SH FILES .PP $HOME/Calendar/\(** .LP .TP "\w'xc
'u" xc
A data file is day, Month in three letter format and the year. .TP xy A year directory. .TP xw A data file for the weekly code, one per day. .SH SEE ALSO xcal(1), xcalpr(1), xcal_cal(1) .SH AUTHOR .LP Copyright 1993 by Peter Collinson, Hillside Systems All rights reserved. xcal-4.1.orig/xcalev/Makefile.bsdi100644 13560 13560 23056 6037000366 15611 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $ # ------------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-specific parameters should be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor does not define any unique symbols, you will need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make World" the first time). # # ------------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ # ------------------------------------------------------------------------- # platform-specific configuration parameters - edit bsd.cf to change # platform: $XConsortium: bsd.cf,v 1.18 91/07/30 12:10:52 rws Exp $ # operating system: 4.3bsd # ------------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc AS = as COMPRESS = compress CPP = /usr/bin/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f TROFF = groff -Tps MSMACROS = -ms TBL = tbl EQN = eqn STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags PROTO_DEFINES = INSTPGMFLAGS = -s INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 PROJECTROOT = /usr/X11 TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR) LDCOMBINEFLAGS = -X -r DEPENDFLAGS = MACROFILE = bsd.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) # ------------------------------------------------------------------------- # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.138.1.1 92/11/11 09:49:19 rws Exp $ # ------------------------------------------------------------------------- # X Window System make variables; this need to be coordinated with rules PATHSEP = / USRLIBDIR = /usr/X11/lib BINDIR = /usr/X11/bin INCROOT = /usr/X11/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm TWMDIR = $(LIBDIR)/twm MANPATH = /usr/X11/man MANSOURCEPATH = $(MANPATH)/man MANSUFFIX = n LIBMANSUFFIX = 3 MANDIR = $(MANSOURCEPATH)$(MANSUFFIX) LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX) NLSDIR = $(LIBDIR)/nls PEXAPIDIR = $(LIBDIR)/PEX XAPPLOADDIR = $(LIBDIR)/app-defaults FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftopcf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier CONFIGSRC = $(TOP)/config DOCUTILSRC = $(TOP)/doc/util CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir FSLIBSRC = $(FONTSRC)/lib/fs FONTSERVERSRC = $(FONTSRC)/server EXTENSIONSRC = $(TOP)/extensions XILIBSRC = $(EXTENSIONSRC)/lib/xinput PEXLIBSRC = $(EXTENSIONSRC)/lib/PEXlib PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a XDMCPLIB = -lXdmcp DEPXMULIB = $(USRLIBDIR)/libXmu.a XMULIB = -lXmu DEPOLDXLIB = $(USRLIBDIR)/liboldX.a OLDXLIB = -loldX DEPXTOOLLIB = $(USRLIBDIR)/libXt.a XTOOLLIB = -lXt DEPXAWLIB = $(USRLIBDIR)/libXaw.a XAWLIB = -lXaw DEPXILIB = $(USRLIBDIR)/libXi.a XILIB = -lXi DEPPEXLIB = $(USRLIBDIR)/libPEX5.a PEXLIB = -lPEX5 DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a PHIGSLIB = -lphigs DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a XBSDLIB = -lXbsd LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln LINTXI = $(LINTLIBDIR)/llib-lXi.ln LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) # ------------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $ # ------------------------------------------------------------------------- # start of Imakefile DEFINES=-DVER_VEC BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) all:: xcalev OBJS = xcalev.o SRCS = xcalev.c PROGRAM = xcalev all:: xcalev xcalev: $(OBJS) $(DEPLIBS) $(RM) $@ $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) install:: xcalev -@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi $(INSTALL) -c $(INSTPGMFLAGS) xcalev $(DESTDIR)$(BINDIR) install.man:: xcalev.man -@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi $(INSTALL) -c $(INSTMANFLAGS) xcalev.man $(DESTDIR)$(MANDIR)/xcalev.$(MANSUFFIX) depend:: $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) $(PROGRAM) depend:: $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) # ------------------------------------------------------------------------- # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS # ------------------------------------------------------------------------- # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" Makefiles:: includes:: # ------------------------------------------------------------------------- # dependencies generated by makedepend xcal-4.1.orig/xcalev/Makefile.sunos100644 13560 13560 21231 6037000366 16030 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ # # The cpp used on this machine replaces all newlines and multiple tabs and # spaces in a macro expansion with a single space. Imake tries to compensate # for this, but is not always successful. # ########################################################################### # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-wide parameters may be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor doesn't define any unique symbols, you'll need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make Makefile", "make Makefiles", or "make World"). # # If you absolutely can't get imake to work, you'll need to set the # variables at the top of each Makefile as well as the dependencies at the # bottom (makedepend will do this automatically). # ########################################################################### # platform-specific configuration parameters - edit sun.cf to change # platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ # operating system: SunOS 4.0.3 ########################################################################### # site-specific configuration parameters - edit site.def to change SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc COMPRESS = compress CPP = /lib/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags SHAREDCODEDEF = -DSHAREDCODE SHLIBDEF = -DSUNSHLIB PROTO_DEFINES = INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0664 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 DESTDIR = TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = COMPATFLAGS = ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) LDCOMBINEFLAGS = -X -r MACROFILE = sun.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) ########################################################################### # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ ########################################################################### # X Window System make variables; this need to be coordinated with rules # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ PATHSEP = / USRLIBDIR = $(DESTDIR)/usr/lib BINDIR = $(DESTDIR)/usr/bin/X11 INCROOT = $(DESTDIR)/usr/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = $(DESTDIR)/usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm AWMDIR = $(LIBDIR)/awm TWMDIR = $(LIBDIR)/twm GWMDIR = $(LIBDIR)/gwm MANPATH = $(DESTDIR)/usr/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)n LIBMANDIR = $(MANSOURCEPATH)3 XAPPLOADDIR = $(LIBDIR)/app-defaults SOXLIBREV = 4.2 SOXTREV = 4.0 SOXAWREV = 4.0 SOOLDXREV = 4.0 SOXMUREV = 4.0 SOXEXTREV = 4.0 FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftosnf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh CONFIGSRC = $(TOP)/config CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf MKFONTDIRSRC = $(FONTSRC)/mkfontdir EXTENSIONSRC = $(TOP)/extensions DEPEXTENSIONLIB = EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXMULIB = XMULIB = -lXmu DEPOLDXLIB = OLDXLIB = -loldX DEPXTOOLLIB = XTOOLLIB = -lXt DEPXAWLIB = XAWLIB = -lXaw LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln LINTXLIB = $(USRLIBDIR)/llib-lX11.ln LINTXMU = $(USRLIBDIR)/llib-lXmu.ln LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln LINTXAW = $(USRLIBDIR)/llib-lXaw.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) ########################################################################### # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ ########################################################################### # start of Imakefile DEFINES=-DVER_VEC BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) all:: xcalev OBJS = xcalev.o SRCS = xcalev.c PROGRAM = xcalev all:: xcalev xcalev: $(OBJS) $(DEPLIBS) $(RM) $@ $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) saber_xcalev: #load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) osaber_xcalev: #load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) install:: xcalev $(INSTALL) -c $(INSTPGMFLAGS) xcalev $(BINDIR) install.man:: xcalev.man $(INSTALL) -c $(INSTMANFLAGS) xcalev.man $(MANDIR)/xcalev.n depend:: $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) $(PROGRAM) depend:: $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) ########################################################################### # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) \#* Makefile:: -@if [ -f Makefile ]; then \ echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS saber: #load $(ALLDEFINES) $(SRCS) osaber: #load $(ALLDEFINES) $(OBJS) ########################################################################### # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" Makefiles:: includes:: ########################################################################### # dependencies generated by makedepend xcal-4.1.orig/xcalev/xcalev.c100644 13560 13560 30750 6037000377 14660 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcalev.c 1.15 (Hillside Systems) 11/15/93"; static char *copyright = "@(#)Copyright 1993 Peter Collinson, Hillside Systems"; #endif /* lint */ #include "version.h" /*** * program name: xcalev.c * function: Load's xcal data files from a `calendar' like data file called regular stored in the standard Calendar directory * switches: -v print version and exit -f name of regular file -d dir Use "dir" instead of Calendar -x be compatible with the X calendar program (ie flat structure in the Calendar directory) -r remove entries from the files followed by an optional year * libraries used: standard * compile time parameters: standard * history: Written October 1993 Peter Collinson Hillside Systems * (C) Copyright: 1993 Hillside Systems/Peter Collinson Permission to use, copy, modify, and distribute this software and its documentation for any purpose is hereby granted to anyone, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Peter Collinson not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Hillside Systems makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Peter Collinson DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Peter Collinson BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***/ #include #include #include #include #include #include #if defined(NeXT) #include #endif #include static char *progname = "xcalev"; /* name of program */ static char *regular = "regular"; /* name of regular file */ static char *calendar = "Calendar"; /* name of calendar directory */ static int compat; /* if non-zero use calendar compatible files */ static int expunge; /* remove entries rather than add them */ static char *calfmt; /* printf format of a calendar file */ static char *caldir; /* name of a calendar directory */ static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; static int days_in_months[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, }; static int year; /* year to do the work for */ /* * various strings */ static char *memerr = "No more memory\n"; static char *usage = "Usage: xcalev [-f srcfile] [-d dir][-x][-r] [year]\n"; char *malloc(); /* * routines */ static void filenames(); static void lineprocess(); static int monthmatch(); static void fileupdate(); static char *connect_file(); static void disconnect_file(); static char *delstr(); static void rewrite_file(); static char *Strdup(); static void fatal(); static void error(); static char *readbfile(); main(argc, argv) int argc; char *argv[]; { register int c; extern char *optarg; extern int optind; FILE *fin; char line[BUFSIZ]; while ((c = getopt(argc, argv, "d:f:crv")) != EOF) { switch (c) { case 'd': calendar = optarg; break; case 'f': regular = optarg; break; case 'x': compat = 1; break; case 'r': expunge = 1; break; case 'v': fprintf(stderr, "%s\n", version); exit(0); default: fatal(usage); } } if (optind < argc) { year = atoi(argv[optind]); if (year < 1993 && year > 2100) fatal("Year %s should be > 1993\n", argv[optind]); } filenames(); /* * open the regular file */ if ((fin = fopen(regular, "r")) == NULL) { fatal("Cannot open: %s\n", regular); } while (fgets(line, sizeof line, fin) != NULL) { lineprocess(line); } fclose(fin); exit(0); } /* * organise filenames */ static void filenames() { struct passwd *pw; char buf[256]; time_t ti; struct tm *tm; pw = getpwuid(getuid()); if (pw == NULL) fatal("Cannot get password information\n"); /* * get filename of Calendar directory */ if (*calendar != '.' && *calendar != '/') { /* need to prepend the home directory */ (void) sprintf(buf, "%s/%s", pw->pw_dir, calendar); calendar = Strdup(buf); } /* * and the source file */ if (*regular != '.' && *regular != '/') { (void) sprintf(buf, "%s/%s", calendar, regular); regular = Strdup(buf); } /* * get the year sorted */ if (year == 0) { time(&ti); tm = localtime(&ti); year = tm->tm_year + 1900; } /* * xcalendar files are all * xc * or * xc
* * where d or dd is the day (%02d would have been better) * is a capitalised first three letters of the * English month name. If you need compatibility * don't redefine the short names in the resources * for this program. * is the full numeric year. * * We will follow this BUT we will also make this program * create subdirectories for new years * xy * to speed up file access */ if (compat) (void) sprintf(buf, "%s/xc%%d%%s%d", calendar, year); else (void) sprintf(buf, "%s/xy%d/xc%%d%%s%d", calendar, year, year); calfmt = Strdup(buf); if (compat) caldir = calendar; else { (void) sprintf(buf, "%s/xy%d", calendar, year); caldir = Strdup(buf); } /* * See if we have a calendar directory */ if (access(calendar, F_OK) < 0) { printf("%s does not exist, creating it\n", calendar); if (mkdir(calendar, 0755) < 0) { perror("mkdir"); fatal("Cannot create: %s\n", calendar); } } /* * and an annual one */ if (access(caldir, F_OK) < 0) { printf("%s does not exist, creating it\n", caldir); if (mkdir(caldir, 0755) < 0) { perror("mkdir"); fatal("Cannot create: %s\n", caldir); } } } /* * Process a single line from the regular file * format is * Month day text * or * day Month text * Month is always a text string * day can be a range with no spaces * eg 5-11 * Lines starting with # are ignored */ static void lineprocess(line) char *line; { char *p1, *p2, *rest; char *ds; char *ms; int day, dayend, i, mon; static int lineno; lineno++; /* comment */ if (*line == '#') return; /* parse line into three sections */ p1 = strtok(line, " \t"); if (p1 == NULL) { error("Cannot find month or day on line %d of %s\n", lineno, regular); return; } p2 = strtok(NULL, " \t"); if (p2 == NULL) { error("Cannot find month or day on line %d of %s\n", lineno, regular); return; } rest = strtok(NULL, "\n"); if (rest == NULL) { error("No associated text with date on line %d of %s\n", lineno, regular); return; } /* is p1 or p2 the day? */ if (isdigit(*p1)) { ds = p1; ms = p2; } else { ds = p2; ms = p1; } /* see if we have a range */ p1 = strchr(ds, '-'); if (p1) { *p1++ = '\0'; day = atoi(ds); dayend = atoi(p1); if (dayend < day) { error("Illegal day range: %d should be <= than %d\n", day, dayend); return; } } else { day = dayend = atoi(ds); } mon = monthmatch(ms); if (mon == -1) { if (isdigit(*ms)) error("Months must be given as names, line %d of %s\n", lineno, regular); else error("Cannot recognise %s as a month name, line %d of %s\n", ms, lineno, regular); return; } if (day < 1 || day > days_in_months[mon]) { error("%s does not have a day numbered %d, line %d of %s\n", months[mon], day, lineno, regular); return; } if (dayend < 1 || dayend > days_in_months[mon]) { error("%s does not have a day numbered %d, line %d of %s\n", months[mon], dayend, lineno, regular); return; } /* lose leading space before the text */ while (isspace(*rest)) rest++; if (*rest == '\0') return; for (i = day; i <= dayend; i++) fileupdate(i, mon, rest); } /* * Attempt to recognise a month string * return a month (0-11) if OK * else -1 */ static int monthmatch(str) char *str; { register int i; for (i = 0; i < 12; i++) { if (strncasecmp(str, months[i], 3) == 0) return i; } return -1; } /* * update a file from the data */ static void fileupdate(day, mon, txt) int day; int mon; char *txt; { char filename[256]; char *contents; char *substr; int flen; int addnl = 0; FILE *newf; (void) sprintf(filename, calfmt, day, months[mon]); if (access(filename, F_OK) == 0) { /* file exists */ /* connect in memory and look for the text string */ contents = connect_file(filename, &flen); if (flen) { substr = strstr(contents, txt); if (substr) { /* message already exists */ if (expunge) { /* * we need to delete the string and * rewrite the file */ contents = delstr(contents, flen, txt, substr); rewrite_file(filename, contents); /* all done - exit */ } /* adding to file */ /* but already there - so exit */ disconnect_file(contents, flen); return; } /* add the string at the end of the file */ /* check if we need to add a leading newline */ if (contents[flen-1] != '\n') addnl = 1; disconnect_file(contents, flen); } } if (expunge) return; newf = fopen(filename, "a"); if (newf == NULL) { error("Cannot open %s for appending\n", filename); return; } if (addnl) putc('\n', newf); fputs(txt, newf); fclose(newf); } static char * connect_file(filename, bytes) char *filename; int *bytes; { int fd; struct stat statb; char *fibase; if ((fd = open(filename, 0)) < 0) { error("Cannot open calendar file: %s\n", filename); return NULL; } if (fstat(fd, &statb) < 0) fatal("Cannot fstat %s (shouldn't happen)\n", filename); if (statb.st_size == 0) { *bytes = 0; return; } fibase = readbfile(fd, statb.st_size); if ((int)fibase == -1) fatal("Cannot read %s into memory\n", filename); close(fd); /* we have it now */ fibase[statb.st_size] = '\0'; /* add a terminating NULL */ *bytes = statb.st_size; return(fibase); } static void disconnect_file(base, len) char *base; int len; { free(base); } /* * delete a text string from a file */ static char * delstr(contents, len, txt, posn) char *contents; int len; char *txt; char *posn; { int len_of_txt; int len_to_move; register char *s, *d; len_of_txt = strlen(txt); if (*(posn + len_of_txt) == '\n') len_of_txt++; len_to_move = strlen(posn) - len_of_txt; /* do this by steam */ d = posn; s = posn + len_of_txt; if (*s == '\0') { *d = '\0'; /* eat any newline at the end of the file */ for(;;) { if (d == contents) break; d--; if (*d == '\n') *d = '\0'; else break; } return contents; } while(len_to_move--) *d++ = *s++; *d = '\0'; return contents; } /* * rewrite a file from a new contents string */ static void rewrite_file(filename, new) char *filename; char *new; { int len; int fd; unlink(filename); if (*new == '\0') { /* nothing there - delete the file */ return; } len = strlen(new); if ((fd = creat(filename, 0666)) < 0) { error("Cannot create: %s\n", filename); return; } if (write(fd, new, len) != len) error("Problem writing %s\n", filename); close(fd); } /* * private strdup this used to call the system strdup() * and fail on an error, but it seems that some systems don't a strdup() */ static char * Strdup(str) char *str; { int len; char *ret; len = strlen(str) + 1; ret = malloc(len); if (ret == NULL) fatal(memerr); (void) memcpy(ret, str, len); return ret; } /* * fatal routine * print an error message and exit * should use vprintf I guess */ static void fatal(fmt, a, b, c) char *fmt; { fprintf(stderr, "%s: ", progname); fprintf(stderr, fmt, a, b, c); exit(1); } /* * error routine */ static void error(fmt, a, b, c, d) char *fmt; { fprintf(stderr, "%s: ", progname); fprintf(stderr, fmt, a, b, c, d); } /* * malloc some memory and * read the file into it */ static char * readbfile(fd, len) int fd; int len; { char *base; base = malloc(len+1); if (base == NULL) return ((char *)-1); if (read(fd, base, len) != len) return ((char *)-1); return base; } xcal-4.1.orig/xcalpr/ 40755 13560 13560 0 6134736703 13126 5ustar and1000and1000xcal-4.1.orig/xcalpr/Imakefile100644 13560 13560 354 6037000357 15005 0ustar and1000and1000DEFINES=-DVER_VEC BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) AllTarget(xcalpr) NormalProgramTarget(xcalpr, xcalpr.o xcal_days.o,/**/,/**/,/**/) InstallProgram(xcalpr,$(BINDIR)) InstallManPage(xcalpr,$(MANDIR)) DependTarget() xcal-4.1.orig/xcalpr/README100644 13560 13560 236 6037000357 14053 0ustar and1000and1000This is xcalpr - a program to print calendars out in text forms The program needs access to ../xcal_days.c. I have a symlink to that file in this directory. xcal-4.1.orig/xcalpr/version.h100644 13560 13560 763 6037000357 15036 0ustar and1000and1000/* * Version control file * version.h 1.6 11/15/93 * Automatically created on Mon Nov 15 23:58:03 GMT 1993 * * Hand edit none of this if you want freeze to continue to work */ #ifdef VER_PROG #define PROGNAME xcalpr #endif #ifdef VER_VEC char version[] = "xcalpr Version 1.6, released Mon Nov 15 23:58:03 GMT 1993"; #endif #ifdef VER_DEF #define VERSION "xcalpr Version 1.6, released Mon Nov 15 23:58:03 GMT 1993" #endif /* SCCS files * +1.11 xcalpr.c +1.2 xcalpr.man +1.5 Imakefile * */ xcal-4.1.orig/xcalpr/xcalpr.man100644 13560 13560 5734 6037000357 15211 0ustar and1000and1000.TH XCALPR 1 "October 1993" "X Version 11 R5" .SH NAME xcalpr \- print xcal calendar entries .SH SYNTAX .B xcalpr [ .B \-c ][ .B \-x ][ .B \-f file ][ .B \-d .I dir ][ .B \-u .I user ][ .I date-spec ] .SH DESCRIPTION .I Xcalpr prints the contents of the .I xcal files. It is intended to be used in situations when you have no access to an X screen. It can also be used to generate entries for the standard UNIX .I calendar program. .LP With no arguments, it prints any entries that exist for the next seven days. The program also reads the contents of the seven daily files and prints them at the appropriate point in the output stream. Each line in the output is preceded by the day of the week, the day of the month, the month and the year. .LP .I Xcalpr can be given a date specification to select months and years. If the date spec consists of just a year number, then all the data for that year is printed. For example: .br xcalpr 1994 .br will print all the data for 1994. Several years can be specified. .LP If you give the name of a month, then the data for that month in the current year will be printed. If the month is in the past, then the data for that month next year will be printed. For example, if .br xcalpr oct jan .br is typed in August, .I xcalpr will print October in the current year and January next year. .LP You can select a particular year by adding the number after any months that you need printing: .br xcalpr oct nov 1994 .br will print October and November in 1994. .LP There are a couple of special `month' names. The name .B rest will print the data for the rest of the month, starting tomorrow. The \fBrest\fP argument is not recognised if you give a year as a parameter. If tomorrow happens to be the first day of the next month, then all the data for next month will be printed. The name .B next prints all the data for next month. .SH OPTIONS .LP The .I \-c option causes .I xcalpr to output lines suitable for input to the standard UNIX .I calendar program. .LP The .I \-d switch is followed by a directory name and specifies an alterative location for your Calendar directory. Your home directory is prepended if the name doesn't start with a slash or a dot. .LP The .I \-f option is followed by a file name and .I xcalpr will write it's output to that file, rather than standard output. .LP The .I \-u option is followed by a user name and dumps their calendar files rather than yours. .LP The .I \-x option makes \fIxcalev\fP operate with Calendar files that are compatible with the \fIxcalendar\fP program. .SH FILES .PP $HOME/Calendar/\(** .LP .TP "\w'xc
'u" xc
A data file is day, Month in three letter format and the year. .TP xy A year directory. .TP xw A data file for the weekly code, one per day. .SH SEE ALSO xcal(1), xcalev(1), xcal_cal(1) .SH AUTHOR .LP Copyright 1993 by Peter Collinson, Hillside Systems All rights reserved. .LP This product includes software developed by the University of California, Berkeley and its contributors. xcal-4.1.orig/xcalpr/xcal_days.c100644 13560 13560 12102 6037000364 15337 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_days.c 1.2 (Hillside Systems) 10/28/93"; static char *copyright = "@(#)Copyright 1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_days.c.c * function: Provide two routines NumberOfDays(month, year) the number of days in a Month and Year FirstDay(month, year) the day a month starts on * history: Adapted from UCB NetII cal.c October 1993 Peter Collinson Hillside Systems * (C) Copyright: 1993 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include /* * This notice and the string below must not be removed from this code */ /* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Kim Letkeman. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef lint char bsdcopyright[] = "@(#) Copyright (c) 1989 The Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char bsdsccsid[] = "@(#)cal.c 5.2 (Berkeley) 4/19/91"; #endif /* not lint */ #define THURSDAY 4 /* for reformation */ #define SATURDAY 6 /* 1 Jan 1 was a Saturday */ #define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */ #define NUMBER_MISSING_DAYS 11 /* 11 day correction */ static int days_in_month[2][13] = { {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, }; /* leap year -- account for gregorian reformation in 1752 */ #define leap_year(yr) \ ((yr) <= 1752 ? !((yr) % 4) : \ !((yr) % 4) && ((yr) % 100) || !((yr) % 400)) /* number of centuries since 1700, not inclusive */ #define centuries_since_1700(yr) \ ((yr) > 1700 ? (yr) / 100 - 17 : 0) /* number of centuries since 1700 whose modulo of 400 is 0 */ #define quad_centuries_since_1700(yr) \ ((yr) > 1600 ? ((yr) - 1600) / 400 : 0) /* number of leap years between year 1 and this year, not inclusive */ #define leap_years_since_year_1(yr) \ ((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr)) static int day_in_year(); static int day_in_week(); Cardinal FirstDay(month, year) int month; int year; { /* Months in xcal are 0 - 11 */ if (month == 8 && year == 1752) /* this should work but doesn't */ return 2; return day_in_week(1, month, year); } Cardinal NumberOfDays(month, year) int month; int year; { /* Months in xcal are 0 - 11 */ if (month == 8 && year == 1752) return 19; return days_in_month[leap_year(year)][month]; } /* * day_in_year -- * return the 1 based day number within the year */ static int day_in_year(day, month, year) register int day, month; int year; { register int i, leap; leap = leap_year(year); for (i = 0; i < month; i++) day += days_in_month[leap][i]; return(day); } /* * day_in_week * return the 0 based day number for any date from 1 Jan. 1 to * 31 Dec. 9999. Assumes the Gregorian reformation eliminates * 3 Sep. 1752 through 13 Sep. 1752. Returns Thursday for all * missing days. */ static int day_in_week(day, month, year) int day, month, year; { long temp; temp = (long)(year - 1) * 365 + leap_years_since_year_1(year - 1) + day_in_year(day, month, year); if (temp < FIRST_MISSING_DAY) return((temp - 1 + SATURDAY) % 7); if (temp >= (FIRST_MISSING_DAY + NUMBER_MISSING_DAYS)) return(((temp - 1 + SATURDAY) - NUMBER_MISSING_DAYS) % 7); return(THURSDAY); } xcal-4.1.orig/xcalpr/Makefile.bsdi100644 13560 13560 22456 6037000367 15624 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $ # ------------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-specific parameters should be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor does not define any unique symbols, you will need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make World" the first time). # # ------------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ # ------------------------------------------------------------------------- # platform-specific configuration parameters - edit bsd.cf to change # platform: $XConsortium: bsd.cf,v 1.18 91/07/30 12:10:52 rws Exp $ # operating system: 4.3bsd # ------------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc AS = as COMPRESS = compress CPP = /usr/bin/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f TROFF = groff -Tps MSMACROS = -ms TBL = tbl EQN = eqn STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags PROTO_DEFINES = INSTPGMFLAGS = -s INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 PROJECTROOT = /usr/X11 TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR) LDCOMBINEFLAGS = -X -r DEPENDFLAGS = MACROFILE = bsd.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) # ------------------------------------------------------------------------- # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.138.1.1 92/11/11 09:49:19 rws Exp $ # ------------------------------------------------------------------------- # X Window System make variables; this need to be coordinated with rules PATHSEP = / USRLIBDIR = /usr/X11/lib BINDIR = /usr/X11/bin INCROOT = /usr/X11/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm TWMDIR = $(LIBDIR)/twm MANPATH = /usr/X11/man MANSOURCEPATH = $(MANPATH)/man MANSUFFIX = n LIBMANSUFFIX = 3 MANDIR = $(MANSOURCEPATH)$(MANSUFFIX) LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX) NLSDIR = $(LIBDIR)/nls PEXAPIDIR = $(LIBDIR)/PEX XAPPLOADDIR = $(LIBDIR)/app-defaults FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftopcf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier CONFIGSRC = $(TOP)/config DOCUTILSRC = $(TOP)/doc/util CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir FSLIBSRC = $(FONTSRC)/lib/fs FONTSERVERSRC = $(FONTSRC)/server EXTENSIONSRC = $(TOP)/extensions XILIBSRC = $(EXTENSIONSRC)/lib/xinput PEXLIBSRC = $(EXTENSIONSRC)/lib/PEXlib PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a XDMCPLIB = -lXdmcp DEPXMULIB = $(USRLIBDIR)/libXmu.a XMULIB = -lXmu DEPOLDXLIB = $(USRLIBDIR)/liboldX.a OLDXLIB = -loldX DEPXTOOLLIB = $(USRLIBDIR)/libXt.a XTOOLLIB = -lXt DEPXAWLIB = $(USRLIBDIR)/libXaw.a XAWLIB = -lXaw DEPXILIB = $(USRLIBDIR)/libXi.a XILIB = -lXi DEPPEXLIB = $(USRLIBDIR)/libPEX5.a PEXLIB = -lPEX5 DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a PHIGSLIB = -lphigs DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a XBSDLIB = -lXbsd LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln LINTXI = $(LINTLIBDIR)/llib-lXi.ln LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) # ------------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $ # ------------------------------------------------------------------------- # start of Imakefile DEFINES=-DVER_VEC BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) all:: xcalpr xcalpr: xcalpr.o xcal_days.o $(RM) $@ $(CC) -o $@ xcalpr.o xcal_days.o $(LDOPTIONS) $(LDLIBS) $(EXTRA_LOAD_FLAGS) clean:: $(RM) xcalpr install:: xcalpr -@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi $(INSTALL) -c $(INSTPGMFLAGS) xcalpr $(DESTDIR)$(BINDIR) install.man:: xcalpr.man -@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi $(INSTALL) -c $(INSTMANFLAGS) xcalpr.man $(DESTDIR)$(MANDIR)/xcalpr.$(MANSUFFIX) depend:: $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) # ------------------------------------------------------------------------- # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS # ------------------------------------------------------------------------- # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" Makefiles:: includes:: # ------------------------------------------------------------------------- # dependencies generated by makedepend xcal-4.1.orig/xcalpr/Makefile.sunos100644 13560 13560 20341 6037000370 16033 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ # # The cpp used on this machine replaces all newlines and multiple tabs and # spaces in a macro expansion with a single space. Imake tries to compensate # for this, but is not always successful. # ########################################################################### # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-wide parameters may be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor doesn't define any unique symbols, you'll need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make Makefile", "make Makefiles", or "make World"). # # If you absolutely can't get imake to work, you'll need to set the # variables at the top of each Makefile as well as the dependencies at the # bottom (makedepend will do this automatically). # ########################################################################### # platform-specific configuration parameters - edit sun.cf to change # platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ # operating system: SunOS 4.0.3 ########################################################################### # site-specific configuration parameters - edit site.def to change SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc COMPRESS = compress CPP = /lib/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags SHAREDCODEDEF = -DSHAREDCODE SHLIBDEF = -DSUNSHLIB PROTO_DEFINES = INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0664 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 DESTDIR = TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = COMPATFLAGS = ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) LDCOMBINEFLAGS = -X -r MACROFILE = sun.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) ########################################################################### # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ ########################################################################### # X Window System make variables; this need to be coordinated with rules # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ PATHSEP = / USRLIBDIR = $(DESTDIR)/usr/lib BINDIR = $(DESTDIR)/usr/bin/X11 INCROOT = $(DESTDIR)/usr/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = $(DESTDIR)/usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm AWMDIR = $(LIBDIR)/awm TWMDIR = $(LIBDIR)/twm GWMDIR = $(LIBDIR)/gwm MANPATH = $(DESTDIR)/usr/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)n LIBMANDIR = $(MANSOURCEPATH)3 XAPPLOADDIR = $(LIBDIR)/app-defaults SOXLIBREV = 4.2 SOXTREV = 4.0 SOXAWREV = 4.0 SOOLDXREV = 4.0 SOXMUREV = 4.0 SOXEXTREV = 4.0 FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftosnf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh CONFIGSRC = $(TOP)/config CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf MKFONTDIRSRC = $(FONTSRC)/mkfontdir EXTENSIONSRC = $(TOP)/extensions DEPEXTENSIONLIB = EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXMULIB = XMULIB = -lXmu DEPOLDXLIB = OLDXLIB = -loldX DEPXTOOLLIB = XTOOLLIB = -lXt DEPXAWLIB = XAWLIB = -lXaw LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln LINTXLIB = $(USRLIBDIR)/llib-lX11.ln LINTXMU = $(USRLIBDIR)/llib-lXmu.ln LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln LINTXAW = $(USRLIBDIR)/llib-lXaw.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) ########################################################################### # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ ########################################################################### # start of Imakefile DEFINES=-DVER_VEC BINDIR=/usr/local/bin INSTPGMFLAGS=$(INSTBINFLAGS) all:: xcalpr xcalpr: xcalpr.o xcal_days.o $(RM) $@ $(CC) -o $@ xcalpr.o xcal_days.o $(LDOPTIONS) $(LDLIBS) $(EXTRA_LOAD_FLAGS) clean:: $(RM) xcalpr install:: xcalpr $(INSTALL) -c $(INSTPGMFLAGS) xcalpr $(BINDIR) install.man:: xcalpr.man $(INSTALL) -c $(INSTMANFLAGS) xcalpr.man $(MANDIR)/xcalpr.n depend:: $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) ########################################################################### # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) \#* Makefile:: -@if [ -f Makefile ]; then \ echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS saber: #load $(ALLDEFINES) $(SRCS) osaber: #load $(ALLDEFINES) $(OBJS) ########################################################################### # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" Makefiles:: includes:: ########################################################################### # dependencies generated by makedepend xcal-4.1.orig/xcalpr/xcalpr.c100644 13560 13560 27073 6052205423 14676 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcalpr.c 1.12 (Hillside Systems) 1/3/95"; static char *copyright = "@(#)Copyright 1993 Peter Collinson, Hillside Systems"; #endif /* lint */ #include "version.h" /*** * program name: xcalpr.c * function: Prints xcal calendar entries * switches: -v print version number, then exit -f name of output file -d dir Use "dir" instead of Calendar -c be compatible with the X calendar program (ie flat structure in the Calendar directory) -u user Look at the calendar for that user followed by a date spec. If no date spec then do this week If date spec is just a number of month names, then print those months If month is `next' do the next month If the months are followed by a year, then do those months in that year If the argument is just a year then do that year. * libraries used: standard * compile time parameters: standard * history: Written October 1993 Peter Collinson Hillside Systems * (C) Copyright: 1993 Hillside Systems/Peter Collinson Permission to use, copy, modify, and distribute this software and its documentation for any purpose is hereby granted to anyone, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Peter Collinson not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Hillside Systems makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Peter Collinson DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Peter Collinson BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***/ #include #include #include #include #include #include #if defined(NeXT) #include #endif #include static char *progname = "xcalpr"; /* name of program */ static char *calendar = "Calendar"; /* name of calendar directory */ static int compat; /* if non-zero use calendar */ /* compatible files */ static int calcompat; /* write calendar format output */ static char *calfmt; /* printf format of a calendar file */ static char *caldir; /* name of a calendar directory */ static char *user; /* name of a user */ static char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; static char *daynames[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; static char *dayfiles[7]; /* connected contents of any dayfiles */ static FILE *fout = stdout; static int mon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, }; /* * various strings */ static char *memerr = "No more memory\n"; static char *usage = "Usage: xcalpr [-d dir][-x][-c][-u user][-f file] [month list]\n"; char *malloc(); /* * Routines */ static void thisweek(); static void showmonth(); static void showyear(); static void filenames(); static void connectdaily(); static void yearformat(); static void outputday(); static void outputdaily(); static char *connect_file(); static int monthmatch(); static char *Strdup(); static void fatal(); static void error(); static char *readbfile(); main(argc, argv) int argc; char *argv[]; { register int c; extern char *optarg; extern int optind; int i; char **av; int ac; int yr; while ((c = getopt(argc, argv, "d:u:f:cxv")) != EOF) { switch (c) { case 'c': calcompat = 1; break; case 'd': calendar = optarg; break; case 'f': fout = fopen(optarg, "w"); if (fout == NULL) fatal("Cannot open %s for writing\n", optarg); break; case 'u': user = optarg; break; case 'v': fprintf(stderr, "%s\n", version); exit(0); case 'x': compat = 1; break; default: fatal(usage); } } filenames(); connectdaily(); if (optind == argc) thisweek(); else { /* * this is a little complicated * the idea is to allow * xcalcat month * xcalcat month year * xcalcat year * the strategy is to scan forward for a year, storing any * months, if we find a year then output the months for * that year. */ av = (char **)calloc(argc, sizeof (char *)); if (av == NULL) fatal(memerr); ac = 0; for (; optind < argc; optind++) { if (!isdigit(*argv[optind])) { av[ac++] = argv[optind]; } else { yr = atoi(argv[optind]); if (ac == 0) showyear(yr); else { for (i = 0; i < ac; i++) showmonth(av[i], yr, 0); ac = 0; } } } if (ac) { for (i = 0; i < ac; i++) showmonth(av[i], 0, 1); } } exit(0); } /* * Do this week */ static void thisweek() { time_t ti; struct tm *tm; int yr; int i; time(&ti); for (i = 0; i < 7; i++) { tm = localtime(&ti); yr = tm->tm_year + 1900; yearformat(yr); outputday(yr, tm->tm_mon, tm->tm_mday, tm->tm_wday); ti += 86400; } } /* * Do a month */ static void showmonth(mstr, yrval, autoinc) char *mstr; int yrval; int autoinc; { time_t ti; struct tm *tm; int yr; int mn; int i; int wday; int startday = 1; time(&ti); tm = localtime(&ti); yr = yrval ? yrval : tm->tm_year + 1900; if (strcasecmp(mstr, "next") == 0) { mn = tm->tm_mon+1; if (mn == 12) { mn = 0; yr++; } } else if (yrval == 0 && strcasecmp(mstr, "rest") == 0) { mn = tm->tm_mon; wday = FirstDay(mn, yr); /* get number of days in month */ startday = tm->tm_mday+1; if (startday > mon[mn]) { startday = 1; mn++; if (mn == 12) { mn = 0; yr++; } } } else { mn = monthmatch(mstr); if (mn == -1) fatal("Cannot recognise month: %s\n", mstr); if (autoinc && mn < tm->tm_mon) yr++; } wday = FirstDay(mn, yr); wday = wday + startday - 1; wday %= 7; yearformat(yr); for (i = startday; i <= mon[mn]; i++) { outputday(yr, mn, i, wday); wday++; wday %= 7; } } /* * do a year */ static void showyear(yr) int yr; { int m; for (m = 0; m < 12; m++) showmonth(months[m], yr, 0); } /* * organise filenames */ static void filenames() { struct passwd *pw; char buf[256]; time_t ti; struct tm *tm; if (user) { pw = getpwnam(user); if (pw == NULL) fatal("Cannot get password information for %s\n", user); } else { pw = getpwuid(getuid()); if (pw == NULL) fatal("Cannot get password information\n"); } /* * get filename of Calendar directory */ if (*calendar != '.' && *calendar != '/') { /* need to prepend the home directory */ (void) sprintf(buf, "%s/%s", pw->pw_dir, calendar); calendar = Strdup(buf); } /* * See if we have a calendar directory */ if (access(calendar, F_OK) < 0) fatal("%s does not exist\n", calendar); } /* * Connect any daily files in memory */ static void connectdaily() { int i; char filename[256]; int len; for (i = 0; i < 7; i++) { (void) sprintf(filename, "%s/xw%s", calendar, daynames[i]); dayfiles[i] = connect_file(filename, &len); } } /* * Make file formats from a year * * xcalendar files are all * xc * or * xc
* * where d or dd is the day (%02d would have been better) * is a capitalised first three letters of the * English month name. If you need compatibility * don't redefine the short names in the resources * for this program. * is the full numeric year. * * We will follow this BUT we will also make this program * create subdirectories for new years * xy * to speed up file access */ static void yearformat(year) int year; { char buf[256]; if (compat) (void) sprintf(buf, "%s/xc%%d%%s%d", calendar, year); else (void) sprintf(buf, "%s/xy%d/xc%%d%%s%d", calendar, year, year); if (calfmt) free(calfmt); calfmt = Strdup(buf); if (compat) caldir = calendar; else { (void) sprintf(buf, "%s/xy%d", calendar, year); if (caldir) free(caldir); caldir = Strdup(buf); } } /* * Print data for one day */ static void outputday(year, mn, day, wday) int year; int mn; int day; int wday; { char filename[256]; char line[BUFSIZ]; char *p; FILE *fin; (void) sprintf(filename, calfmt, day, months[mn]); if (fin = fopen(filename, "r")) { while (fgets(line, sizeof line, fin) != NULL) { p = strchr(line, '\n'); if (p) *p = '\0'; for (p = line; isspace(*p); p++); if (*p == '\0') continue; if (calcompat) fprintf(fout, "%s %02d\t%s\n", months[mn], day, p); else fprintf(fout, "%s %02d %s %4d\t%s\n", daynames[wday], day, months[mn], year, p); } fclose(fin); } /* check on daily file */ if (p = dayfiles[wday]) outputdaily(year, mn, day, wday, p); } /* * Output a daily file */ static void outputdaily(year, mn, day, wday, txt) int year; int mn; int day; int wday; char *txt; { char prefix[256]; char *sol; char *eol; if (calcompat) (void) sprintf(prefix, "%s %02d\t", months[mn], day); else (void) sprintf(prefix, "%s %02d %s %4d\t", daynames[wday], day, months[mn], year); while (*txt) { sol = txt; while (*txt != '\n' && *txt != '\0') txt++; eol = txt; while (*sol == ' ' || *sol == '\t') sol++; if (sol != eol) { fputs(prefix, fout); while (sol != eol) { putc(*sol, fout); sol++; } putc('\n', fout); } if (*eol == '\n') txt++; } } static char * connect_file(filename, bytes) char *filename; int *bytes; { int fd; struct stat statb; char *fibase; if ((fd = open(filename, 0)) < 0) { return NULL; } if (fstat(fd, &statb) < 0) fatal("Cannot fstat %s (shouldn't happen)\n", filename); if (statb.st_size == 0) { *bytes = 0; return; } fibase = readbfile(fd, statb.st_size); if ((int)fibase == -1) fatal("Cannot map %s into memory\n", filename); close(fd); /* we have it now */ fibase[statb.st_size] = '\0'; *bytes = statb.st_size; return(fibase); } /* * Attempt to recognise a month string * return a month (0-11) if OK * else -1 */ static int monthmatch(str) char *str; { register int i; for (i = 0; i < 12; i++) { if (strncasecmp(str, months[i], 3) == 0) return i; } return -1; } /* * private strdup this used to call the system strdup() * and fail on an error, but it seems that some systems don't a strdup() */ static char * Strdup(str) char *str; { int len; char *ret; len = strlen(str) + 1; ret = malloc(len); if (ret == NULL) fatal(memerr); (void) memcpy(ret, str, len); return ret; } /* * fatal routine * print an error message and exit * should use vprintf I guess */ static void fatal(fmt, a, b, c) char *fmt; { fprintf(stderr, "%s: ", progname); fprintf(stderr, fmt, a, b, c); exit(1); } /* * error routine */ static void error(fmt, a, b, c, d) char *fmt; { fprintf(stderr, "%s: ", progname); fprintf(stderr, fmt, a, b, c, d); } /* * malloc some memory and * read the file into it */ static char * readbfile(fd, len) int fd; int len; { char *base; base = (char *) malloc(len+1); if (read(fd, base, len) != len) return ((char *)-1); return base; } xcal-4.1.orig/XCal.help100644 13560 13560 11555 6037000360 13443 0ustar and1000and1000XCal.Help XCal.help 1.2 93/10/23 {strip The date strip consists of a number of lines of text. Line 1: The Month and the Year of the strip. The information may be duplicated in the window manager title line. In this case the line may be omitted by setting the resource `useWmTitle' to False. Line 2: The main control buttons for the strip actioned by the left mouse button. < Generates last month's strip in a separate window Quit Close this script > Generates next month's strip in a separate window Line 3: The Help button. Help can be suppressed by setting the resource `giveHelp' to False. Then - A line for each day in the month. Each line is two areas: The left hand side shows the day in the month and the name of the day of the week. `Today' may be highlighted specially in this region. The right hand side is an active button. When pressed it starts up an editor for the day. This will create a file for the day in the user's Calendar directory. The label on the button will be the first few characters of the file, if there are any. You can paste selected characters into a day. Sweep out the characters that you want to load and click with the middle mouse button in the day of your choice. This is just like normal pasting of text. You will get a complaint if the day is already being edited. XCal was written by Peter Collinson (pc@hillside.co.uk) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } {edit This editing window will create or delete a day file for the day shown in the title. The file is stored in a directory specified by the resource `directory', this is usually `Calendar' in your home directory. Calendar will usually contain directories, one for each year, and the day file will be stored in one of these directories. However, this makes xcal incompatible with xcalendar - so if the resource xcalendarCompat is True then the use of subdirectories is suppressed. The large area in the edit window is a normal text input area. Text is simply be typed into it, the text is saved by hitting the save button which is set to sensitive when the text is changed. Saving an empty buffer will delete the file. The Quit button will exit. Some more questions will be asked if leaving will result in losing information. XCal was written by Peter Collinson (pc@hillside.co.uk) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } {memo The memo window is intended to do three things. First, it allows a single button click to display today's actions from your diary. Second, it provides a way of displaying regular weekly events. Third, it provides an editable window whose contents can be saved in a file. The idea is that this file will contain reminders and other notes. The file is usually called `memo' and is stored in a directory specified by the resource `directory', usually `Calendar' in your home directory. The window is split into three areas. The top section shows the current diary entry and cannot be altered by editing. Hit the edit button to start a standard day editor window on today's date. The middle section shows the weekly entry. Again the edit button allows you to edit these The bottom section contains the memo file text area. Text is simply typed into it and is stored saved by hitting the save button. This will go black when the text is changed. Saving an empty buffer will delete the file. The Quit button will exit. Some more questions will be asked if leaving will result in losing information. XCal was written by Peter Collinson (pc@hillside.co.uk) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } {main The command box contains a number of buttons. Move the mouse into the area showing the date and use the mouse buttons to select further actions: - Left mouse button pops up this month's calendar strip - Middle mouse button permits date selection - Right mouse button allows exit Click with the left mouse button in the small box holding the mouse icon to edit a memo file. The Question Mark button shows this information, as you have already discovered. XCal was written by Peter Collinson (pc@hillside.co.uk) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } {weekly The weekly strip consists of a number of lines of text. Line 1: The title Line 2: The Quit button that removes the strip from the screen Line 3: The Help Button. Help can be suppressed by setting `giveHelp' to False. Then - A line for each day in the week. Each line is two areas: The left hand side shows the day in the week The right hand side is an active button. When pressed it starts up an editor for the day. This will create a file for the day in the user's Calendar directory. The label on the button will be the first few characters of the file, if there are any. XCal was written by Peter Collinson +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } xcal-4.1.orig/xcal.h100644 13560 13560 16201 6052205617 13044 0ustar and1000and1000/* * xcal.h 3.33 9/13/95 * * Header file for the xcal program */ /* #define ALLOW_OTHER_WRITE */ /* Normally, a user can look at someone else's Calendar files with the */ /* -u flag. For safety, they are prohibited by xcal from writing. Define */ /* ALLOW_OTHER_WRITE to allow anyone to write to anyone else's files */ /* except, of course, they will be protected by normal file permissions */ /* * On 32 bit machines we can pack the date into one word * if not we have to use two callbacks * so undef if not true * and fiddle with the definitions below */ /* #define LONG_IS_32_BITS */ /* pack year and month into Cardinals */ #ifdef LONG_IS_32_BITS #define DatePack(w, d, m, y) ((((w)&0x7)<<21) | (((d)&0x1f)<<16) | (((m)&0xf)<<12) | ((y)&0xfff)) #define YrUnpack(v) ((v)&0xfff) #define MoUnpack(v) (((v)>>12)&0xf) #define DyUnpack(v) (((v)>>16)&0x1f) #define WdUnpack(v) (((v)>>21)&0x7) #else /* LONG_IS_32_BITS */ #define DatePack(m, y) ((((m)&0xf)<<12) | ((y)&0xfff)) #define DayPack(w, d) ((((w)&0x7)<<5) | ((d)&0x1f)) #define YrUnpack(v) ((v)&0xfff) #define MoUnpack(v) (((v)>>12)&0xf) #define DyUnpack(v) ((v)&0x1f) #define WdUnpack(v) (((v)>>5)&0xf) #endif /* LONG_IS_32_BITS */ /* * Foreground/Background colours */ typedef struct { Pixel bg; Pixel fg; } Colour; /* * Time structure */ typedef struct tm Tm; /* * resources used by xcal.c */ struct resources { Boolean debug; /* Debug switch - currently used to fast fwd */ /* the date */ Boolean alarmScan; /* Debug switch for alarm system */ Boolean reverseVideo; /* Display in Reverse video */ Boolean useWmTitle; /* When displaying strips do not include a */ /* month - year value */ Boolean markToday; /* Mark today with today's colours */ Boolean calCompat; /* True if handle files like xcalendar */ Boolean giveHelp; /* True if help is needed (default) */ Boolean helpFromFile; /* True if read help text from a file */ String helpfile; /* Where to find the help file */ Boolean initialCalendar;/* Pop up Calendar on startup if True */ Boolean initialEdit; /* Pop up today's Edit on startup if True */ Boolean initialMemo; /* Pop up memo box on start */ String format; /* Date format string to use in the main box */ String stripfmt; /* Date format to use at the top of strips */ String editfmt; /* Date format in edit windows */ String mon[12]; /* Long month names */ String smon[12]; /* Short month names */ String day[7]; /* Day names - full */ String sday[7]; /* Short day names */ String weekly; /* Title of weekly edit strip */ Colour today; /* What to mark today with */ XFontStruct *fontToday; /* We can also do Today in a different font */ String directory; /* Directory under home where Calendar files */ /* can be found */ int textbufsz; /* Text buffer size for editing */ Dimension minstripwidth; /* Minimum strip width */ Dimension maxstripheight; /* Maximum strip height */ Boolean alarms; /* false - no alarms, true - alarms */ Boolean execalarms; /* false - no exec alarms, true - exec alarms */ XtIntervalId interval_id;/* store XtAddTimeOut value */ int clocktick; /* how often the toplevel widget is polled */ int update; /* interval between peeks (60 secs) */ int volume; /* how loud to beep the alarm 0-100 */ int nbeeps; /* how many beeps for an alarm ? */ int autoquit; /* Automatically delete message boxes */ String countdown; /* Comma separated countdown string for alarms */ String cmd; /* command to execute for every alarm */ String alarmleft; /* string containing a message - %d mins left */ String alarmnow; /* string containing a message - Now! */ Boolean alarmWarp; /* whether to take times from 0:XX - */ /* minAlarmWarp:XX as PM */ int minAlarmWarp; /* time threshold for alarmWarp */ String private; /* string containing the word - Private */ String already; /* date format for "Already editing day month year" */ String alreadyWeekly; /* date format for "Already editing day" */ Boolean useMemo; /* true use top-level memo button, false - don't */ Boolean memoLeft; /* True if on left of date, false otherwise */ String memoFile; /* name of the file where the memo data is stored */ int maxDisplayLines;/* maximum number of lines that we want to */ /* allow the top half of a memo window to */ /* stretch to */ char *otheruser; /* the name of another user */ }; #ifndef ALLOW_OTHER_WRITE #define MyCalendar (appResources.otheruser == NULL) #else #define MyCalendar (1) #endif extern struct resources appResources; /* * Application context for the program - set in xcal.c */ extern XtAppContext appContext; /* * Date structure */ typedef struct { Cardinal day; Cardinal month; Cardinal year; Cardinal wday; } Date; /* * A month entry */ typedef struct me { Cardinal me_year; /* map year */ Cardinal me_month; /* which month */ String me_have[32]; /* if a file present for the day */ /* then will have a non-zero entry */ int me_type; /* type of displayed strip */ } MonthEntry; #define ME_MONTHLY 1 /* `Normal' monthly strip */ #define ME_WEEKLY 2 /* Weekly strip */ /* * An instance of the strip */ typedef struct instance { struct instance *i_next; /* next object */ Widget i_w; /* the widget top level */ Widget i_day_label[32]; /* the handle to the label on each day */ /* so we can change dates at night */ Widget i_day_info[32]; /* The info field for this date - so */ /* we can sensitise/desensitise on editing */ Colour i_col; /* what the fg/bg colours used to be */ XFontStruct *i_font; /* what the font was */ } Instance; Instance *RegisterMonth(); Instance *FindInstanceList(); /* * Alarm structure * one of these exists for each event in the timeout queue * the list is sorted in event order */ typedef struct _alarm { struct _alarm *next; /* pointer to next alarm */ String alarm; /* alarm string */ String what; /* what is message */ int alarm_mm; /* hour*60 + min */ int alarm_state; /* what time left to `real' timeout */ Boolean isAction; /* more than alarm */ } Alarm; /* * We occasionally need these */ extern Widget toplevel; extern Date today; extern char date_area[]; extern Boolean FoundCalendarDir; extern char *MapStem; /* pointer to the string which is */ /* where the map data is stored */ extern Boolean FoundCalendarDir; /* whether the Calendar directory */ /* exists */ /* * Global routines */ void HelpShow(); void InitAlarms(); void DoTemplate(); void FmtTime(); void MouseShow(); void Leave(); void Fatal(); Dimension wHeight(); void SetWidgetHeightMax(); void SetDate(); void AskLeave(); void DialogPopup(); void TextCal(); void LoadDateStrip(); void DoCalendar(); void DoMemo(); void DoWeekly(); void MemoPoll(); void NewMonthStrip(); void InitMonthEntries(); void ChangeHighlight(); void NoEditIsPossible(); void NoDayEditIsPossible(); void StartEditing(); MonthEntry *GetMonthEntry(); MonthEntry *GetWeeklyEntry(); void AlarmFilePoll(); String ReadCalendarFile(); void UpdateMemo(); String MakeWeeklyName(); String GetWeeklyFile(); Boolean NeedTop(); void AppendText(); void ButtonOff(); void ButtonOn(); void FmtDate(); long ClockSync(); Cardinal NumberOfDays(); Cardinal FirstDay(); time_t time(); xcal-4.1.orig/xcal_days.c100644 13560 13560 12102 6037000363 14045 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_days.c 1.2 (Hillside Systems) 10/28/93"; static char *copyright = "@(#)Copyright 1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_days.c.c * function: Provide two routines NumberOfDays(month, year) the number of days in a Month and Year FirstDay(month, year) the day a month starts on * history: Adapted from UCB NetII cal.c October 1993 Peter Collinson Hillside Systems * (C) Copyright: 1993 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include /* * This notice and the string below must not be removed from this code */ /* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Kim Letkeman. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef lint char bsdcopyright[] = "@(#) Copyright (c) 1989 The Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char bsdsccsid[] = "@(#)cal.c 5.2 (Berkeley) 4/19/91"; #endif /* not lint */ #define THURSDAY 4 /* for reformation */ #define SATURDAY 6 /* 1 Jan 1 was a Saturday */ #define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */ #define NUMBER_MISSING_DAYS 11 /* 11 day correction */ static int days_in_month[2][13] = { {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, }; /* leap year -- account for gregorian reformation in 1752 */ #define leap_year(yr) \ ((yr) <= 1752 ? !((yr) % 4) : \ !((yr) % 4) && ((yr) % 100) || !((yr) % 400)) /* number of centuries since 1700, not inclusive */ #define centuries_since_1700(yr) \ ((yr) > 1700 ? (yr) / 100 - 17 : 0) /* number of centuries since 1700 whose modulo of 400 is 0 */ #define quad_centuries_since_1700(yr) \ ((yr) > 1600 ? ((yr) - 1600) / 400 : 0) /* number of leap years between year 1 and this year, not inclusive */ #define leap_years_since_year_1(yr) \ ((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr)) static int day_in_year(); static int day_in_week(); Cardinal FirstDay(month, year) int month; int year; { /* Months in xcal are 0 - 11 */ if (month == 8 && year == 1752) /* this should work but doesn't */ return 2; return day_in_week(1, month, year); } Cardinal NumberOfDays(month, year) int month; int year; { /* Months in xcal are 0 - 11 */ if (month == 8 && year == 1752) return 19; return days_in_month[leap_year(year)][month]; } /* * day_in_year -- * return the 1 based day number within the year */ static int day_in_year(day, month, year) register int day, month; int year; { register int i, leap; leap = leap_year(year); for (i = 0; i < month; i++) day += days_in_month[leap][i]; return(day); } /* * day_in_week * return the 0 based day number for any date from 1 Jan. 1 to * 31 Dec. 9999. Assumes the Gregorian reformation eliminates * 3 Sep. 1752 through 13 Sep. 1752. Returns Thursday for all * missing days. */ static int day_in_week(day, month, year) int day, month, year; { long temp; temp = (long)(year - 1) * 365 + leap_years_since_year_1(year - 1) + day_in_year(day, month, year); if (temp < FIRST_MISSING_DAY) return((temp - 1 + SATURDAY) % 7); if (temp >= (FIRST_MISSING_DAY + NUMBER_MISSING_DAYS)) return(((temp - 1 + SATURDAY) - NUMBER_MISSING_DAYS) % 7); return(THURSDAY); } xcal-4.1.orig/xcal_help.c100644 13560 13560 17107 6037000364 14050 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_help.c 3.19 (Hillside Systems) 11/6/93"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_help.c * function: Generate help screens in separate popup windows * history: Written December 1989 Completelt redone October 1993 Peter Collinson Hillside Systems * (C) Copyright: 1989,1990,1993 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include #include "xcal_mmap.h" #ifndef NO_MMAP #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include "xcal.h" #define argLD(N,V) { XtSetArg(args[nargs], N, V); nargs++; } static XtCallbackRec callbacks[] = { {NULL, NULL}, {NULL, NULL} }; static Boolean helpRead = False; typedef struct helpdata { String name; /* Help name */ String text; /* the text we are showing */ Widget popup; /* Widget value */ } Help; static Help help[] = { { "nohelp", "Sadly, Xcal help has not been installed correctly\nSee your sysadmin\n",}, { "main", }, /* don't move from here - see PopdownHelp */ { "edit", }, { "memo", }, { "weekly", }, { "strip", }, { NULL, } }; static Help *findHelp(); static void initHelp(); static char *connectHelp(); static Widget DisplayHelpWindow(); static void PopdownHelp(); static void makeHelpPopup(); #ifdef NO_MMAP static char *readbfile(); #endif /* * Initialise the help system * Two methods - from a help file * compiled in */ char *helpText; /* defines helpdata[] */ #include "xcal_help.h" /* * Search the help structure looking for a name */ static Help * findHelp(name) String name; { Help *h; for (h = help; h->name; h++) if (strcmp(name, h->name) == 0) return h; return NULL; } /* * Initialise help data */ static void initHelp() { Help *he; char *h; char *name; char *text; char *vers; int lastc; register int vlen; extern char version[]; /* * Find the text for the help data * If take from a file - then connect the file in memory * If that fails, then use the text compiled into the program */ if (appResources.helpFromFile == True) { helpText = connectHelp(); if (helpText == NULL) helpText = helpdata; } else helpText = helpdata; /* * Allow you to compile NO text into the program */ if (*helpText == '\0') helpText = NULL; /* * helpRead says - I have TRIED to find the data */ helpRead = True; if (helpText == NULL) return; vlen = strlen(version); for (h = helpText; *h; ) { if ((h = strchr(h, '{')) == NULL) break; h++; /* h points to name */ name = h; /* look for the end of the name */ while (!isspace(*h)) /* name is terminated by white space */ h++; /* or a newline */ lastc = *h; *h++ = '\0'; if (lastc != '\n') { while(isspace(*h)) h++; } text = h; /* that's the start of the text */ /* find the place to insert the version */ do { if ((h = strchr(h, '+')) == NULL) Fatal("Missing +++ lines in help text - %s\n", name); } while (h[1] != '+' && h[2] != '+'); vers = h; /* and the end of the text */ h = strchr(h, '}'); if (h == NULL) Fatal("Missing } in help text - %s\n", name); *h++ = '\0'; /* Insert version */ memcpy(vers, version, vlen); vers[vlen] = '\n'; vers[vlen + 1] = '\0'; /* * That was a bit scrappy.. * insert the details in the structure */ if (he = findHelp(name)) he->text = text; } } /* * If we are getting help from a file then the name is in the * resources. The trick here is to map the file into memory privately * so that it is just like one compiled in vector */ static char * connectHelp() { int fd; struct stat statb; char *fibase; if ((fd = open(appResources.helpfile, 0)) < 0) return NULL; if (fstat(fd, &statb) < 0) { printf("Cannot fstat %s (shouldn't happen)\n", appResources.helpfile); close(fd); return NULL; } if (statb.st_size == 0) { printf("Zero length file? (%s)\n", appResources.helpfile); close(fd); return NULL; } #ifdef NO_MMAP fibase = readbfile(fd, statb.st_size); #else fibase = (char *) mmap(0, statb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); #endif if ((int)fibase == -1) { printf("Cannot map %s into memory\n", appResources.helpfile); return NULL; } close(fd); /* we have it now */ fibase[statb.st_size] = '\0'; /* we don't mind losing the last char */ return(fibase); } static Widget DisplayHelpWindow(str) String str; { Widget shell, form, title; Arg args[10]; Cardinal nargs; shell = XtCreatePopupShell("help", topLevelShellWidgetClass, toplevel, NULL, 0); form = XtCreateManagedWidget("helpPanel", panedWidgetClass, shell, NULL, 0); nargs = 0; argLD(XtNshowGrip, False); argLD(XtNdefaultDistance, 2); title = XtCreateManagedWidget("helpForm", formWidgetClass, form, args, nargs); /* * Exit button Take "Quit" from resources */ callbacks[0].callback = PopdownHelp; callbacks[0].closure = (caddr_t) shell; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); (void) XtCreateManagedWidget("helpQuit", commandWidgetClass, title, args, nargs); /* * Now the text which is the remainder of the panel */ nargs = 0; argLD(XtNshowGrip, False); argLD(XtNstring, str); argLD(XtNdisplayCaret, False); (void) XtCreateManagedWidget("helpText", asciiTextWidgetClass, form, args, nargs); XtPopup(shell, XtGrabNone); return shell; } /* ARGSUSED */ static void PopdownHelp(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { extern Widget mHelp; if (help[1].popup == (Widget)closure) HelpShow(mHelp, False); XtPopdown((Widget) closure); HelpButtonOn((Widget) closure); } /* * Create a Help Popup */ static void makeHelpPopup(w, name) Widget w; char *name; { Help *he; if (helpRead == False) initHelp(); he = findHelp(name); if (he == NULL || he->text == NULL) he->text = help[0].text; if (he->popup) XtPopup(he->popup, XtGrabNone); else he->popup = DisplayHelpWindow(he->text); ButtonOff(w, he->popup); } /* ARGSUSED */ void StripHelp(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { makeHelpPopup(w, "strip"); } /* ARGSUSED */ void EditHelp(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { makeHelpPopup(w, "edit"); } /* ARGSUSED */ void MemoHelp(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { makeHelpPopup(w, "memo"); } /* ARGSUSED */ void MainHelp(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { extern Widget mHelp; HelpShow(mHelp, True); makeHelpPopup(w, "main"); } /* ARGSUSED */ void WeeklyHelp(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { makeHelpPopup(w, "weekly"); } #ifdef NO_MMAP /* * If the system as no mmap malloc some memory and * read the file into it */ static char * readbfile(fd, len) int fd; int len; { char *base; base = XtMalloc(len+1); if (read(fd, base, len) != len) return ((char *)-1); return base; } #endif xcal-4.1.orig/CHANGES100644 13560 13560 27605 6052205617 12751 0ustar and1000and1000Changes: CHANGES 2.42 95/09/13 Add new #define in xcal.h that permits users of the -u option to write to the files. This is a compilation define some people may NOT like the idea that their calendar files are writeable. Fix some places which allowed editing of other people's files and then made xcal crash. Correct the weekly file selection in AlarmFilePoll. It used today and not the argument that was given to it Initialise tm structure in CycleDays and CycleMonths (xcal.c) Apparently linux barfed on this. It's probably accident that this works OK on the other machines. --------------------------- 4.1 Remove the `marked' resource. First, it was broken anyway and second it got in the way of having different colours for each day. Add a lot of code to cope with different systems. Remove mmap from most programs except xcal_help.c. Some systems that purport to support mmap would do well to remove it (Ultrix seems one). Grateful thanks to the several people who worked on the beta releases for me. --------------------------- 4.1 (beta version of new features) Add in a scroll bar for the date strip, so if it doesn't fit on the screen (or is larger than a named resource maxStripHeight) then you get a scroll bar appearing. This uses a viewport widget and has changed the widget structure of the date strip. I am a little dubious of the height arithmetic here. A nice thing to do would be to ensure that `today' was always in the centre of the viewport. This doesn't seem possible. ------- Alter the NAME of the form widget in the strip to be the Short name of the day. This allows resources to be used to change fonts and colours for days of the week, eg: XCal*Sat*Label*font: lucidasans-typewriterbold-12 ------- Regularise the use of dirent rather than the old 4.2 names. This may need some changes for SYSV based systems, I am unsure. However, let's start with clean code. ------- Radically alter the way that date formats are done. The toplevel widget is now driven by strftime() - and a user defined resource using standard time formats is used to set it. This is replicated for the memo window. The dates at the top of edit windows and strips are set by a modified version of strftime() - this one just deals in days, months and years. Again a resource is used to set it. ------- Add the ability to insert a clock in the top level widget. Using the date format string to decide the format that is needed. The code also adapts the polling frequency depending on the clock that is needed. If the string does not mention seconds, then the clock will be pinged every minute. If you want the clock to tick every 30 secs, then the resource clockTick can be set. ------- Add limited support for group usage. If called with -u user then it looks for the user's directory and reads files from it. I found that some sites are sharing calendars by using `cat', this is just a better interface than that. I don't want to make it setuid, so if there is no access permission for the directory (or the user has hidden it my moving it from the regular name) then it won't find the files. The program is constrained not to write any files in this mode. It will also not start any alarms. If a calendar file is read-only to the user, then the string 'Private entry' is displayed. Not much - but something. There should be a private/public button on the edit box. The user is reminded that this invocation is not reading their files because the string (user) is added to various date titles. (Someday, proper group usage should be done). ------- Fix from Ed Gould. Add a new resource execAlarms to inhibit the ! and %cron commands from happening - even though the remaining alarms will fire. ------- Respond to some observations by Jaap Akkerhuis. Now when most buttons are pressed they are made insensitive - so a further button press causes no action. Previously you could get many invocations of dialogs and questions - things could get messy when windows were removed in non-logical orders. Has this fixed everything? Well time will tell. The solution is perhaps a little messy. Still this is the trouble with altering the code rather than re-writing it. ------- Act on an idea from Mac Pigman - there is now an edit button on the Memo panel that allows you to edit today's Calendar entry. ------- Redo the way that help is done. Can now take the text from a file and/or compile it in. This should help non-English speaking users to have a local language help. A shell script is provided to take the help file and translate it into some C. ------- Rework various button handling so that buttons are made insensitive when they are pressed. The main problem here is putting them back on safely. This has added perhaps too much code - but it works better -------- Redo the manual page -------- Make the title bar widgets adjust their offset from the outside world so that they are centred vertically -------- Allow for the 12 hour clock in alarms. If the resource AlarmWarp is set true and the time of the alarm is between zero and the value in MinAlarmWarp then the time is taken as a pm time. This idea from Mark Pawliger. --------- When the Cmd resource is set, the command that is executed takes the data from the remainder of the calendar line as an argument. Ensure that 1) this is passed as a quoted single argument to the system routine call. Cope with embedded single quotes. --------- Fix memory leak when displaying the Weekly entry (leak spotted by chet@arc.uucp - be nice to have his real name) --------- Make a number of changes to the alarm system to attempt to stop the races that happened when using ClockTick update polling. It turns out that various bits of the old code was done without real regard for the event driven nature of X applications. The code now appears to trigger alarms OK - and will not break when the control files are reloaded. While I was testing this the clocks went back an hour and that caused some confusion until I realised what had happened. It's still the case that alarms need one minute to trigger properly. ---------- Provide xcalev, this should go somewhere to meet the needs of the several people who mailed saying `it's great' but I cannot deal with regular events... so I won't be using it. Their loss I feel :-) ---------- Provide xcalpr, print calendar entries to a text terminal. Also generates input for the calendar program ---------- Put xcalev, xcalpr, xcal_cal into sub dirs, deal with the Imakefiles to do that. ---------- Remove AT&T code and replace with code from the NetII tape. --------------------------- 3.4 Add Xos.h as a define in xcal.c and xcal_edit.c. When the middle button is used to get a month/year selection box, if you just type the month name, you will get the next month with that name, not the month THIS year. Fix in xcal_alarm.c that was freeing a non freeable area. I bet this has caused some problems. Fix from Julian Bradfield Fix in xcal_strip.c which is causing widgets to be named incorrectly. Widgets were called `Day' rather than '1 Day' as advertised. Bug spotted by James Matthew Farrow . (This later removed to allow days to be specified in resources) ------- (These from Miles O'Neal ) Now builds for NeXTSTEP 3.0. Compiler warnings were cleaned up. Top level help now through button, not printed to tty. Help boxes are reused, not created and destroyed every time they are accessed. This also prvents multiple copies of the same help box from existing simultaneoulsy. Added the calendar icon from bricons. -------- I guess I have changed my C bracketing style in the last two years. Ran the code through indent so I would feel a little happier. -------- Well, I had this idea two years ago. If you now make a selection using the mouse - select some text on the screen - then it can be appended into a day file by simply clicking with the MIDDLE mouse button on the day of your choice. This makes it easy to set groups of dates up using the mouse. --------------------------- 3.3 Implement the ability to deal with regular weekly events. This is part of the memo system. Today's current events are shown as part of the memo panel. They can be edited by hitting a button and bringing up a special strip with an entry for each day. These regular event files are integrated into the alarm system. Allow today's name: Monday, Tuesday etc to appear in the top level widget, the header of an edit window and the title of the memo box. This is controlled by the Order and Format resources and so previous behaviour can be maintained. Beware that this redefines the names of the days so Sunday maps to Sunday and a new short name is used for the abbreviated form Sun maps to Sun used in date strips. Ensure that middle and right button translations work in the memo button in the top level widget (suggested by Casey Leedom). New Imakefile from Casey Leedom. This has support for pscal. New pscal/Imakefile. Add initialMemo resource so the memo box can popup at startup time - (suggested by G. W. Pigman III) Steven Plite pointed out that the year display is inconsistent. To allow choice, add three new resources: dateYearIsTwoDigits memoYearIsTwoDigits editYearIsTwoDigits You can now choose how you would like to have your year displayed in the various places. Defaults to showing four digits. System V release 4 fixes from Dave McCraken. Alters: xcal_alarm.c, xcal_cal.c, *.bm xcal.c The memo box quit button causes a Save File dialogue box to be popped if the memo data has been altered and not saved. The behaviour of this was wrong when there was no memo data. Reported by Greg Bond. Fixed by changing tests in xcal_memo.c. Proper length of a directory entry under SYSV is strlen(dp->d_name) not strlen(dp->d_name)+1. Changed xcal_edit.c (Dave McCraken) Eliminated double definition of GetMemoFile() and incorrect definition of MemoHelp() in xcal_memo.c (David C Lawrence) --------------------------- 3.2 Xcal - Version 3.2 Issued to comp.sources.x Fixes some stupid bugs Ensures that update code works properly ---------------------------- 3.1 Xcal - Version 3.1 Issued to comp.sources.x (un-intentionally) Adds the memo functionality and the Stick/Unpin feature for alarms. ---------------------------- 2.1 Xcal - Version 2.1 Issued privately Two main differences between version 1.1 and version 2.1 a) Version 2.1 has alarms so that xcal can poll you during the day - idea contributed by Mark Majhor, Sequent and then unashame-edly hacked by me. b) Version 2.1 has a support program supplied by Ed Gould from Mt Xinu allowing you to set up a file suitable for driving UNIX's calendar program. ---------------------------- 1.6 pscal/pscal.sh Fix to make sed work better to truncate the calendar file when printing. From Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia Internet: gnb@melba.bby.oz.au non-MX: gnb%melba.bby.oz@uunet.uu.net ---------------------------- 1.5 xcal.h Add initialCalendar/initialEdit switches Support for better start-up options... from From: Rod Whitby xcal.c Add hooks and code to perform startuo Imakefile Corrected xcal.man Add new lines supporting initialCalendar/initialEdit ---------------------------- 1.4 xcal_edit.c Fix bug where colour mapping on days failed to change when data is deleted or added. xcal.h/xcal.c/xcal_strip.c Add a new resource minStripWidth intended to allow users to widen the strip to some value which seems sensible. If zero the resource is unused. XCal.ad Add colour map from wade@cs.utk.edu xcal_edit.c Changes to XBell calls due to typo Steve Alexander, Software Technologies Group INTERACTIVE Systems Corporation, Naperville, IL ...!{sun,ico}!laidbak!stevea stevea@i88.isc.com Xcal - Version 1.1 Issued to the net comp.sources.x. xcal: Volume 7, Issue 1-2 xcal-4.1.orig/xcal_popup.c100644 13560 13560 23126 6037000373 14261 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_popup.c 3.13 (Hillside Systems) 10/29/93"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_popup.c * function: Deal with various popups for xcal There are two main ones: a) the centre button causes a popup date selection popup b) the right button causes an exit popup * history: Written November 1989 Peter Collinson Hillside Systems * (C) Copyright: 1989 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include #include #include #include #include #include #include #include #include #include "xcal.h" static void AskDialog(); static void NoCal(); static void YesCal(); static char *DateParse(); static int MonScan(); static void LeaveDialog(); static void NoLeave(); static void YesLeave(); static void NoEdit(); #define argLD(N,V) { XtSetArg(args[nargs], N, V); nargs++; } /* * This routine deals with most of the work to create a dialog popup, it is * passed a function which is called to create the dialog box * * The widget here is used for positioning, these popups are always children of * the toplevel widget * * These widgets are generally called from a Command widget button. * if this is the case, we make that button non-sensitive and * use the pop-down callback to turn them on again (see xcal_buts.c) */ void DialogPopup(w, fn, arg, but) Widget w; void (*fn) (); caddr_t arg; Widget but; { Widget pop; Arg args[10]; int nargs; Position x, y; Position nx, ny; Dimension width, height, border; /* * Get the position of the toplevel so we * can position the dialog box properly */ XtSetArg(args[0], XtNwidth, &width); XtSetArg(args[1], XtNheight, &height); XtGetValues(w, args, 2); XtTranslateCoords(w, (Position) (width / 2), (Position) (height / 2), &x, &y); /* * Create a popup to hold the dialog */ nargs = 0; argLD(XtNallowShellResize, True); argLD(XtNinput, True); argLD(XtNx, x); argLD(XtNy, y); argLD(XtNsaveUnder, FALSE); /* was true but this caused */ /* me problems on OpenWindows */ pop = XtCreatePopupShell("question", transientShellWidgetClass, toplevel, args, nargs); if (but && XtIsSubclass(but, commandWidgetClass)) ButtonOff(but, pop); /* * Set up the dialog */ (*fn) (pop, arg); XtRealizeWidget(pop); /* * We can now worry if this box is actually off the screen */ XtSetArg(args[0], XtNwidth, &width); XtSetArg(args[1], XtNheight, &height); XtSetArg(args[2], XtNborderWidth, &border); XtGetValues(pop, args, 3); border <<= 1; XtTranslateCoords(pop, (Position) 0, (Position) 0, &nx, &ny); if ((int)(nx + width + border) > WidthOfScreen(XtScreen(toplevel))) nx = WidthOfScreen(XtScreen(toplevel)) - width - border; else nx = x; if ((int)(ny + height + border) > HeightOfScreen(XtScreen(toplevel))) ny = HeightOfScreen(XtScreen(toplevel)) - height - border; else ny = y; if (nx != x || ny != y) { XtSetArg(args[0], XtNx, nx); XtSetArg(args[1], XtNy, ny); XtSetValues(pop, args, 2); } XtPopup(pop, XtGrabNone); } /************************************************************************/ /* */ /* */ /* Deals with middle button presses - ask for a date */ /* */ /* */ /************************************************************************/ /* * SetDate - ask for a date and start a calendar * This is an action routine */ /* ARGSUSED */ void SetDate(w, event, params, numb) Widget w; XEvent *event; String *params; Cardinal *numb; { DialogPopup(toplevel, AskDialog, NULL, w); } /* ARGSUSED */ static void AskDialog(pop, noop) Widget pop; Cardinal noop; { Widget dia; Arg args[2]; WidgetList children; /* which is Widget children[] */ Cardinal num_children; int i; /* Take from args: "Enter mm yyyy?" */ XtSetArg(args[0], XtNvalue, ""); dia = XtCreateManagedWidget("newdate", dialogWidgetClass, pop, args, 1); XawDialogAddButton(dia, "ok", YesCal, dia); XawDialogAddButton(dia, "cancel", NoCal, pop); /* * I would like to add CR translations to the text box the only way * to get the widget seems to be to use an R4 feature to get the * WidgetList */ XtSetArg(args[0], XtNchildren, &children); XtSetArg(args[1], XtNnumChildren, &num_children); XtGetValues(dia, (ArgList) args, 2); for (i = 0; i < num_children; i++) { if (XtClass(children[i]) == asciiTextWidgetClass) { /* Bingo */ XtOverrideTranslations( children[i], XtParseTranslationTable("Return: SetDateAction()") ); } else if (XtClass(children[i]) == labelWidgetClass) { XtSetArg(args[0], XtNresizable, True); XtSetValues(children[i], args, 1); } } } /* * No we don't want a specified date * Closure here is the pop shell */ /* ARGSUSED */ static void NoCal(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { XtDestroyWidget((Widget) closure); } /* * Yes we do want a specified date * Closure here is the dialog widget */ /* ARGSUSED */ static void YesCal(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { Widget dia; Arg args[2]; Date wanted; char *errstr; dia = (Widget) closure; /* * Parse the string */ if (errstr = DateParse(XawDialogGetValueString(dia), &wanted)) { /* * insert an error * message in the widget */ XtSetArg(args[0], XtNlabel, errstr); XtSetValues(dia, args, 1); XBell(XtDisplay(toplevel), 0); return; } XtDestroyWidget(XtParent(dia)); NewMonthStrip(&wanted, NULL); } /* * Action mapped to by CR in the dialog */ /* ARGSUSED */ void TextCal(w, event, params, numb) Widget w; XEvent *event; String *params; Cardinal *numb; { YesCal(w, (caddr_t) XtParent(w), 0); /* parent of text widget is */ /* the dialog box */ } /* * Parse a date string */ static char * DateParse(str, da) register char *str; Date *da; { register char *wk; int lastc; int mo; *da = today; wk = str; while (isspace(*wk)) wk++; if (*wk == '\0') return ("No data found"); str = wk; if (isdigit(*str)) { while (isdigit(*str)) str++; lastc = *str; *str++ = '\0'; mo = atoi(wk); if (mo < 1 || mo > 12) return ("Illegal month number"); da->month = mo - 1; } else if (isalpha(*str)) { /* be kind - allow month names */ while (isalpha(*str)) { if (isupper(*str)) *str = tolower(*str); str++; } lastc = *str; *str++ = '\0'; mo = MonScan(wk); if (mo < 0) return ("Cannot find month name"); if (mo < da->month) da->year++; da->month = mo; } if (lastc) { wk = str; while (isspace(*wk)) wk++; str = wk; if (*str) da->year = atoi(wk); } return (NULL); } /* * Given a string look in our database for a number */ static int MonScan(monstr) char *monstr; { char *a, *b; int ca, cb; int mon; for (mon = 0; mon < 12; mon++) for (a = monstr, b = appResources.mon[mon];;) { ca = *a++; if (ca == '\0') return (mon); if (isupper(ca)) ca = tolower(ca); cb = *b++; if (cb == '\0') break; if (isupper(cb)) cb = tolower(cb); if (ca != cb) break; } return (-1); } /************************************************************************/ /* */ /* */ /* Deals with right button presses - exit */ /* */ /* */ /************************************************************************/ /* * Get out - possibly */ /* ARGSUSED */ void AskLeave(w, event, params, numb) Widget w; XEvent *event; String *params; Cardinal *numb; { DialogPopup(toplevel, LeaveDialog, NULL, w); } /* ARGSUSED */ static void LeaveDialog(pop, noop) Widget pop; Cardinal noop; { Widget di; /* Take "Really exit? from resources */ di = XtCreateManagedWidget("exit", dialogWidgetClass, pop, NULL, 0); XawDialogAddButton(di, "yes", YesLeave, pop); XawDialogAddButton(di, "no", NoLeave, pop); } /* ARGSUSED */ static void YesLeave(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { Leave(0); } /* ARGSUSED */ static void NoLeave(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { XtDestroyWidget((Widget) closure); } /************************************************************************/ /* */ /* */ /* Deal with an attempt to double edit some data */ /* */ /* */ /************************************************************************/ void NoEditIsPossible(w, da) Widget w; Date *da; { static char errmsg[256]; FmtDate(da, errmsg, sizeof errmsg, appResources.already); DialogPopup(w, NoEdit, errmsg, w); } void NoDayEditIsPossible(w, da) Widget w; Date *da; { static char errmsg[256]; FmtDate(da, errmsg, sizeof errmsg, appResources.alreadyWeekly); DialogPopup(w, NoEdit, errmsg, w); } static void NoEdit(pop, errmsg) Widget pop; String errmsg; { Arg args[2]; Widget dia; XtSetArg(args[0], XtNlabel, errmsg); dia = XtCreateManagedWidget("noedit", dialogWidgetClass, pop, args, 1); XawDialogAddButton(dia, "ok", NoCal, pop); } xcal-4.1.orig/Makefile.sunos100644 13560 13560 33606 6037000375 14557 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ # # The cpp used on this machine replaces all newlines and multiple tabs and # spaces in a macro expansion with a single space. Imake tries to compensate # for this, but is not always successful. # ########################################################################### # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-wide parameters may be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor doesn't define any unique symbols, you'll need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make Makefile", "make Makefiles", or "make World"). # # If you absolutely can't get imake to work, you'll need to set the # variables at the top of each Makefile as well as the dependencies at the # bottom (makedepend will do this automatically). # ########################################################################### # platform-specific configuration parameters - edit sun.cf to change # platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ # operating system: SunOS 4.0.3 ########################################################################### # site-specific configuration parameters - edit site.def to change SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc COMPRESS = compress CPP = /lib/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags SHAREDCODEDEF = -DSHAREDCODE SHLIBDEF = -DSUNSHLIB PROTO_DEFINES = INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0664 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 DESTDIR = TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = COMPATFLAGS = ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) LDCOMBINEFLAGS = -X -r MACROFILE = sun.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) ########################################################################### # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ ########################################################################### # X Window System make variables; this need to be coordinated with rules # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ PATHSEP = / USRLIBDIR = $(DESTDIR)/usr/lib BINDIR = $(DESTDIR)/usr/bin/X11 INCROOT = $(DESTDIR)/usr/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = $(DESTDIR)/usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm AWMDIR = $(LIBDIR)/awm TWMDIR = $(LIBDIR)/twm GWMDIR = $(LIBDIR)/gwm MANPATH = $(DESTDIR)/usr/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)n LIBMANDIR = $(MANSOURCEPATH)3 XAPPLOADDIR = $(LIBDIR)/app-defaults SOXLIBREV = 4.2 SOXTREV = 4.0 SOXAWREV = 4.0 SOOLDXREV = 4.0 SOXMUREV = 4.0 SOXEXTREV = 4.0 FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftosnf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh CONFIGSRC = $(TOP)/config CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf MKFONTDIRSRC = $(FONTSRC)/mkfontdir EXTENSIONSRC = $(TOP)/extensions DEPEXTENSIONLIB = EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXMULIB = XMULIB = -lXmu DEPOLDXLIB = OLDXLIB = -loldX DEPXTOOLLIB = XTOOLLIB = -lXt DEPXAWLIB = XAWLIB = -lXaw LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln LINTXLIB = $(USRLIBDIR)/llib-lX11.ln LINTXMU = $(USRLIBDIR)/llib-lXmu.ln LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln LINTXAW = $(USRLIBDIR)/llib-lXaw.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) ########################################################################### # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ ########################################################################### # start of Imakefile DEFINES = -DLONG_IS_32_BITS -DVER_VEC SRCS1 = xcal.c xcal_alarm.c xcal_buts.c xcal_days.c xcal_edit.c \ xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c strfdate.c version.c OBJS1 = xcal.o xcal_alarm.o xcal_buts.o xcal_days.o xcal_edit.o \ xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o strfdate.o version.o PROGRAMS = derived xcal INSTPGMFLAGS = $(INSTBINFLAGS) BINDIR = /usr/local/bin OBJS = $(OBJS1) $(OBJS2) $(OBJS3) SRCS = $(SRCS1) $(SRCS2) $(SRCS3) all:: $(PROGRAMS) xcal: $(OBJS1) $(DEPLIBS1) $(RM) $@ $(CC) -o $@ $(LDOPTIONS) $(OBJS1) $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(LDLIBS) -lm $(EXTRA_LOAD_FLAGS) install:: xcal $(INSTALL) -c $(INSTPGMFLAGS) xcal $(BINDIR) install.man:: xcal.man $(INSTALL) -c $(INSTMANFLAGS) xcal.man $(MANDIR)/xcal.n saber_xcal: #load $(ALLDEFINES) $(SRCS1) $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) -lm osaber_xcal: #load $(ALLDEFINES) $(OBJS1) $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) -lm depend:: $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) $(PROGRAMS) install:: XCal.ad $(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(XAPPLOADDIR)/XCal install:: XCal.help $(INSTALL) -c $(INSTDATFLAGS) XCal.help $(XAPPLOADDIR)/XCal.help derived: xcal_help.h xcal_ad.h clean:: $(RM) xcal_help.h xcal_ad.h xcal_help.h: XCal.help sh C_from_help.sh xcal_ad.h: XCal.ad sh C_from_ad.sh SUBD=xcalpr xcalev xcal_cal all:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \ done clean:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \ done install:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \ done install.man:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \ done depend:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) depend); \ done SUBDIRS = pscal all:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \ done depend:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) depend); \ done ########################################################################### # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) \#* Makefile:: -@if [ -f Makefile ]; then \ echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS saber: #load $(ALLDEFINES) $(SRCS) osaber: #load $(ALLDEFINES) $(OBJS) ########################################################################### # rules for building in SUBDIRS - do not edit install:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \ done install.man:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \ done clean:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \ done tags:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "tagging" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags); \ done Makefiles:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \ case "$$i" in \ ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \ ./?*/?*) newtop=../../ sub=subsub;; \ ./?*) newtop=../ sub=sub;; \ */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ */?*/?*) newtop=../../../ sub=subsubsub;; \ */?*) newtop=../../ sub=subsub;; \ *) newtop=../ sub=sub;; \ esac; \ case "$(TOP)" in \ /?*) newtop= upprefix= ;; \ *) upprefix=../ ;; \ esac; \ $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \ MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ done subdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles subsubdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles subsubsubdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles subsubsubsubdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles includes:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo including "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) includes); \ done ########################################################################### # dependencies generated by makedepend xcal-4.1.orig/Makefile.bsdi100644 13560 13560 35131 6037000400 14311 0ustar and1000and1000# Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $ # ------------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-specific parameters should be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor does not define any unique symbols, you will need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make World" the first time). # # ------------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ # ------------------------------------------------------------------------- # platform-specific configuration parameters - edit bsd.cf to change # platform: $XConsortium: bsd.cf,v 1.18 91/07/30 12:10:52 rws Exp $ # operating system: 4.3bsd # ------------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $ SHELL = /bin/sh TOP = . CURRENT_DIR = . AR = ar clq BOOTSTRAPCFLAGS = CC = cc AS = as COMPRESS = compress CPP = /usr/bin/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) INSTALL = install LD = ld LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f TROFF = groff -Tps MSMACROS = -ms TBL = tbl EQN = eqn STD_INCLUDES = STD_CPP_DEFINES = STD_DEFINES = EXTRA_LOAD_FLAGS = EXTRA_LIBRARIES = TAGS = ctags PROTO_DEFINES = INSTPGMFLAGS = -s INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4755 INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4755 PROJECTROOT = /usr/X11 TOP_INCLUDES = -I$(INCROOT) CDEBUGFLAGS = -O CCOPTIONS = ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR) LDCOMBINEFLAGS = -X -r DEPENDFLAGS = MACROFILE = bsd.cf RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) # ------------------------------------------------------------------------- # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.138.1.1 92/11/11 09:49:19 rws Exp $ # ------------------------------------------------------------------------- # X Window System make variables; this need to be coordinated with rules PATHSEP = / USRLIBDIR = /usr/X11/lib BINDIR = /usr/X11/bin INCROOT = /usr/X11/include BUILDINCROOT = $(TOP) BUILDINCDIR = $(BUILDINCROOT)/X11 BUILDINCTOP = .. INCDIR = $(INCROOT)/X11 ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 CONFIGDIR = $(LIBDIR)/config LINTLIBDIR = $(USRLIBDIR)/lint FONTDIR = $(LIBDIR)/fonts XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm TWMDIR = $(LIBDIR)/twm MANPATH = /usr/X11/man MANSOURCEPATH = $(MANPATH)/man MANSUFFIX = n LIBMANSUFFIX = 3 MANDIR = $(MANSOURCEPATH)$(MANSUFFIX) LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX) NLSDIR = $(LIBDIR)/nls PEXAPIDIR = $(LIBDIR)/PEX XAPPLOADDIR = $(LIBDIR)/app-defaults FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) IMAKE = imake DEPEND = makedepend RGB = rgb FONTC = bdftopcf MKFONTDIR = mkfontdir MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier CONFIGSRC = $(TOP)/config DOCUTILSRC = $(TOP)/doc/util CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos LIBSRC = $(TOP)/lib FONTSRC = $(TOP)/fonts INCLUDESRC = $(TOP)/X11 SERVERSRC = $(TOP)/server UTILSRC = $(TOP)/util SCRIPTSRC = $(UTILSRC)/scripts EXAMPLESRC = $(TOP)/examples CONTRIBSRC = $(TOP)/../contrib DOCSRC = $(TOP)/doc RGBSRC = $(TOP)/rgb DEPENDSRC = $(UTILSRC)/makedepend IMAKESRC = $(CONFIGSRC) XAUTHSRC = $(LIBSRC)/Xau XLIBSRC = $(LIBSRC)/X XMUSRC = $(LIBSRC)/Xmu TOOLKITSRC = $(LIBSRC)/Xt AWIDGETSRC = $(LIBSRC)/Xaw OLDXLIBSRC = $(LIBSRC)/oldX XDMCPLIBSRC = $(LIBSRC)/Xdmcp BDFTOSNFSRC = $(FONTSRC)/bdftosnf BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir FSLIBSRC = $(FONTSRC)/lib/fs FONTSERVERSRC = $(FONTSRC)/server EXTENSIONSRC = $(TOP)/extensions XILIBSRC = $(EXTENSIONSRC)/lib/xinput PEXLIBSRC = $(EXTENSIONSRC)/lib/PEXlib PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a EXTENSIONLIB = -lXext DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a XLIB = $(EXTENSIONLIB) -lX11 DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a XDMCPLIB = -lXdmcp DEPXMULIB = $(USRLIBDIR)/libXmu.a XMULIB = -lXmu DEPOLDXLIB = $(USRLIBDIR)/liboldX.a OLDXLIB = -loldX DEPXTOOLLIB = $(USRLIBDIR)/libXt.a XTOOLLIB = -lXt DEPXAWLIB = $(USRLIBDIR)/libXaw.a XAWLIB = -lXaw DEPXILIB = $(USRLIBDIR)/libXi.a XILIB = -lXi DEPPEXLIB = $(USRLIBDIR)/libPEX5.a PEXLIB = -lPEX5 DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a PHIGSLIB = -lphigs DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a XBSDLIB = -lXbsd LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln LINTXI = $(LINTLIBDIR)/llib-lXi.ln LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) # ------------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $ # ------------------------------------------------------------------------- # start of Imakefile DEFINES = -DLONG_IS_32_BITS -DVER_VEC SRCS1 = xcal.c xcal_alarm.c xcal_buts.c xcal_days.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c strfdate.c version.c OBJS1 = xcal.o xcal_alarm.o xcal_buts.o xcal_days.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o strfdate.o version.o PROGRAMS = derived xcal INSTPGMFLAGS = $(INSTBINFLAGS) BINDIR = /usr/local/bin OBJS = $(OBJS1) $(OBJS2) $(OBJS3) SRCS = $(SRCS1) $(SRCS2) $(SRCS3) all:: $(PROGRAMS) xcal: $(OBJS1) $(DEPLIBS1) $(RM) $@ $(CC) -o $@ $(LDOPTIONS) $(OBJS1) $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(LDLIBS) -lm $(EXTRA_LOAD_FLAGS) install:: xcal -@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi $(INSTALL) -c $(INSTPGMFLAGS) xcal $(DESTDIR)$(BINDIR) install.man:: xcal.man -@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi $(INSTALL) -c $(INSTMANFLAGS) xcal.man $(DESTDIR)$(MANDIR)/xcal.$(MANSUFFIX) depend:: $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) $(PROGRAMS) install:: XCal.ad -@if [ -d $(DESTDIR)$(XAPPLOADDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(XAPPLOADDIR)); fi $(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(DESTDIR)$(XAPPLOADDIR)/XCal install:: XCal.help $(INSTALL) -c $(INSTDATFLAGS) XCal.help $(DESTDIR) $(XAPPLOADDIR)/XCal.help derived: xcal_help.h xcal_ad.h clean:: $(RM) xcal_help.h xcal_ad.h xcal_help.h: XCal.help sh C_from_help.sh xcal_ad.h: XCal.ad sh C_from_ad.sh SUBD=xcalpr xcalev xcal_cal all:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \ done clean:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \ done install:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \ done install.man:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \ done depend:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBD) ;\ do \ (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) depend); \ done SUBDIRS = pscal all:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \ done depend:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) depend); \ done # ------------------------------------------------------------------------- # common rules for all Makefiles - do not edit emptyrule:: clean:: $(RM_CMD) "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS # ------------------------------------------------------------------------- # rules for building in SUBDIRS - do not edit install:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \ done install.man:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \ done clean:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \ done tags:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo "tagging" "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags); \ done Makefiles:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \ case "$$i" in \ ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \ ./?*/?*) newtop=../../ sub=subsub;; \ ./?*) newtop=../ sub=sub;; \ */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ */?*/?*) newtop=../../../ sub=subsubsub;; \ */?*) newtop=../../ sub=subsub;; \ *) newtop=../ sub=sub;; \ esac; \ case "$(TOP)" in \ /?*) newtop= upprefix= ;; \ *) upprefix=../ ;; \ esac; \ $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \ MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ done subdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles subsubdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles subsubsubdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles subsubsubsubdirMakefiles: $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ else exit 0; fi cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ $(MAKE) $(MFLAGS) Makefiles includes:: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ for i in $(SUBDIRS) ;\ do \ (cd $$i ; echo including "in $(CURRENT_DIR)/$$i..."; \ $(MAKE) $(MFLAGS) includes); \ done # ------------------------------------------------------------------------- # dependencies generated by makedepend xcal-4.1.orig/xcal_memo.c100644 13560 13560 36503 6052205617 14063 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_memo.c 1.23 (Hillside Systems) 9/13/95"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_memo.c * function: Deal with popup memo file A single popup file is stored in a file called memo on the Calendar directory * history: Written December 1990 Peter Collinson Hillside Systems * (C) Copyright: 1989,1990 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xcal.h" static XtCallbackRec callbacks[] = { {NULL, NULL}, {NULL, NULL} }; #define ClearCallbacks() memset((caddr_t)callbacks, '\0', sizeof (callbacks)) #define argLD(N,V) { XtSetArg(args[nargs], N, V); nargs++; } /* * Structure for storing relavant data about the memo Edit */ typedef struct memoEdit { Widget m_button; /* widget of the control button */ Widget m_popup; /* widget of editor popup */ Widget m_quit; /* widget of quit button */ Widget m_edit; /* widget of edit button */ Widget m_help; /* widget of help button */ Widget m_save; /* widget of save button */ Boolean m_savesens; /* state of the save button */ Widget m_display; /* widget of display title area */ Widget m_text; /* the text area */ Widget m_today; /* today's data */ Widget m_weekly; /* widget of text image of weekly */ /* events */ String m_weeklytext; /* weekly text */ Cardinal m_size; /* size of the buffer */ char *m_data; /* pointer to malloc'ed data buffer */ } MemoEdit; static MemoEdit memo; static String memoContents; extern void MemoHelp(); /* look in xcal_help.c */ /* * Internal routines */ void MemoPopup(); static void CleanMemo(); static void MemoCheckExit(); static void MCheckDia(); static Boolean WriteMemoFile(); static void EditToday(); static int NewlineCount(); static String GetMemoFile(); static void SaveMemoEdits(); static void MemoTextChanged(); static void FinishMemoEditing(); static void YesCheck(); static void NoCheck(); static void AdjustTitleHeight(); /* * Callback routine to display the memo file */ void DoMemo(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { static Arg args[1]; /* * Make the button become a finish button */ memo.m_button = w; callbacks[0].callback = FinishMemoEditing; callbacks[0].closure = NULL; XtSetArg(args[0], XtNcallback, callbacks); XtSetValues(w, args, 1); MouseShow(w, False); /* * Get existing memo contents * if the user is polling then re-read the file */ if (appResources.update && memoContents != NULL) { XtFree(memoContents); memoContents = NULL; } if (memoContents == NULL) memoContents = GetMemoFile(); /* * Set up the popup widget for editing */ MemoPopup(); } /* * Get old contents from a memo file if any */ static String GetMemoFile() { if (FoundCalendarDir && access(appResources.memoFile, F_OK) == 0) return ReadCalendarFile(NULL, appResources.memoFile); return NULL; } /* * Do the biz to popup an edit style window */ void MemoPopup() { Widget et, lw; Widget frame; Arg args[10]; Cardinal nargs; String str; MonthEntry *me; Dimension charHeight; /* * set up edit buffer */ if (memoContents) memo.m_size = appResources.textbufsz + strlen(memoContents) + 1; else memo.m_size = appResources.textbufsz; memo.m_data = XtMalloc(memo.m_size); if (memoContents) strcpy(memo.m_data, memoContents); else *memo.m_data = '\0'; memo.m_popup = XtCreatePopupShell("memo", topLevelShellWidgetClass, toplevel, NULL, 0); /* * The first title line */ et = XtCreateManagedWidget("memoPanel", panedWidgetClass, memo.m_popup, NULL, 0); nargs = 0; argLD(XtNshowGrip, False); argLD(XtNskipAdjust, True); argLD(XtNdefaultDistance, 1); frame = XtCreateManagedWidget("title", formWidgetClass, et, args, nargs); /* * containing some buttons for controlling the world */ /* * Take label "quit" from resources */ callbacks[0].callback = FinishMemoEditing; callbacks[0].closure = NULL; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); lw = memo.m_quit = XtCreateManagedWidget("quit", commandWidgetClass, frame, args, nargs); /* * Edit todays file from here as well * Take label from resources */ if (MyCalendar) { callbacks[0].callback = EditToday; callbacks[0].closure = (caddr_t) 0; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, lw); argLD(XtNleft, XtChainLeft); argLD( XtNright, XtChainLeft); memo.m_edit = lw = XtCreateManagedWidget("edit", commandWidgetClass, frame, args, nargs); } /* * If we are dealing with help then do it now */ if (appResources.giveHelp) { /* Take label "help" from resources */ callbacks[0].callback = MemoHelp; callbacks[0].closure = (caddr_t) 0; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, lw); argLD(XtNleft, XtChainLeft); argLD( XtNright, XtChainLeft); memo.m_help = lw = XtCreateManagedWidget("help", commandWidgetClass, frame, args, nargs); } /* * The remaining bit here is a date label */ nargs = 0; argLD(XtNlabel, date_area); argLD(XtNborderWidth, 0); argLD(XtNfromHoriz, lw); argLD(XtNfromVert, NULL); argLD(XtNvertDistance, 2); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainRight); lw = memo.m_display = XtCreateManagedWidget("date", labelWidgetClass, frame, args, nargs); /* * Details for today */ me = GetMonthEntry(today.year, today.month); nargs = 0; str = me->me_have[today.day]; if (str == NULL) str = ""; argLD(XtNstring, str); argLD(XtNdisplayCaret, False); argLD(XtNeditType, XawtextRead); memo.m_today = XtCreateManagedWidget("display", asciiTextWidgetClass, et, args, nargs); { Dimension height; XtSetArg(args[0], XtNheight, &height); XtGetValues(memo.m_today, args, 1); charHeight = height; height = height * NewlineCount(str); XtSetArg(args[0], XtNheight, height); XtSetValues(memo.m_today, args, 1); } AdjustTitleHeight(memo.m_quit, MyCalendar ? memo.m_edit : NULL, appResources.giveHelp ? memo.m_help : NULL, memo.m_display); /* * Weekly details - the data for today + an edit button * The header to this is a form */ nargs = 0; argLD(XtNshowGrip, False); argLD(XtNskipAdjust, True); argLD(XtNdefaultDistance, 1); frame = XtCreateManagedWidget("weeklyMemo", formWidgetClass, et, args, nargs); /* * Take label "edit" from resources */ if (MyCalendar) { callbacks[0].callback = DoWeekly; callbacks[0].closure = (caddr_t) & memo; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); lw = XtCreateManagedWidget("weeklyEdit", commandWidgetClass, frame, args, nargs); } /* * Say this is a weekly commitment */ nargs = 0; argLD(XtNshowGrip, True); argLD(XtNborderWidth, 0); argLD(XtNfromHoriz, MyCalendar ? lw : NULL); argLD(XtNfromVert, NULL); argLD(XtNvertDistance, 2); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainRight); lw = XtCreateManagedWidget("weeklyTitle", labelWidgetClass, frame, args, nargs); /* * Details for today */ nargs = 0; if (memo.m_weeklytext) XtFree(memo.m_weeklytext); memo.m_weeklytext = str = GetWeeklyFile(today.wday); if (str == NULL) str = ""; argLD(XtNstring, str); argLD(XtNdisplayCaret, False); argLD(XtNeditType, XawtextRead); if (charHeight) argLD(XtNheight, NewlineCount(str) * charHeight); memo.m_weekly = XtCreateManagedWidget("display", asciiTextWidgetClass, et, args, nargs); /* * Another form with some buttons */ nargs = 0; argLD(XtNshowGrip, False); argLD(XtNskipAdjust, True); argLD(XtNdefaultDistance, 1); frame = XtCreateManagedWidget("memoMiddle", formWidgetClass, et, args, nargs); if (MyCalendar) { /* * Take label "save" from resources */ callbacks[0].callback = SaveMemoEdits; callbacks[0].closure = (caddr_t) & memo; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); argLD(XtNsensitive, False); lw = memo.m_save = XtCreateManagedWidget("save", commandWidgetClass, frame, args, nargs); memo.m_savesens = False; } /* * Say this is a memo edit */ nargs = 0; argLD(XtNshowGrip, True); argLD(XtNborderWidth, 0); argLD(XtNfromHoriz, MyCalendar ? lw : NULL); argLD(XtNfromVert, NULL); argLD(XtNvertDistance, 2); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainRight); lw = XtCreateManagedWidget("memoTitle", labelWidgetClass, frame, args, nargs); /* * The text widget is in the pane below * The Scroll Attributes are controlled from the application * defaults file */ callbacks[0].callback = MemoTextChanged; callbacks[0].closure = (caddr_t) & memo; nargs = 0; argLD(XtNstring, memo.m_data); argLD(XtNeditType, XawtextEdit); argLD(XtNlength, memo.m_size); argLD(XtNuseStringInPlace, True); argLD(XtNcallback, callbacks); memo.m_text = XtCreateManagedWidget("memoText", asciiTextWidgetClass, et, args, nargs); XtPopup(memo.m_popup, XtGrabNone); } /* * Adjust title line height * possibly 4 objects */ static void AdjustTitleHeight(quit, edit, help, label) Widget quit; Widget edit; Widget help; Widget label; { int hq, he, hh, hl; int max; hq = wHeight(quit); he = edit ? wHeight(edit) : 0; hh = help ? wHeight(help): 0; hl = wHeight(label); max = hq; max = (he > max) ? he : max; max = (hh > max) ? hh : max; max = (hl > max) ? hl : max; if (hq < max) SetWidgetHeightMax(quit, hq, max); if (he && he < max) SetWidgetHeightMax(edit, he, max); if (hh & hh < max) SetWidgetHeightMax(help, hh, max); if (hl < max) SetWidgetHeightMax(label, hl, max); } /* * This callback starts editing today */ static void EditToday(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { StartEditing(w, &today, w); } /* * Count newlines in a string */ static int NewlineCount(str) String str; { register int sum = 0; while (*str) if (*str++ == '\n') sum++; /* Add one line - assume last line does NOT have an nl */ sum++; /* ignore a final newline */ if (str[-1] == '\n') sum--; if (sum <= 0) sum = 1; return (sum > appResources.maxDisplayLines ? appResources.maxDisplayLines : sum); } /* * Entry point from outside when today's text changed */ void UpdateMemo() { Arg args[1]; String str; MonthEntry *me; /* * if the button widget is zero then we are displaying nothing */ if (memo.m_button == 0) return; me = GetMonthEntry(today.year, today.month); str = me->me_have[today.day]; if (str == NULL) str = ""; XtSetArg(args[0], XtNstring, str); XtSetValues(memo.m_today, args, 1); XtSetArg(args[0], XtNlabel, date_area); XtSetValues(memo.m_display, args, 1); if (memo.m_weeklytext) XtFree(memo.m_weeklytext); memo.m_weeklytext = str = GetWeeklyFile(today.wday); if (str == NULL) str = ""; XtSetArg(args[0], XtNstring, str); XtSetValues(memo.m_weekly, args, 1); } /* * Poll call from the alarm timeout */ void MemoPoll() { int size; Arg args[10]; int nargs; if (memo.m_button == 0) return; if (memo.m_savesens == True) return; if (memoContents) XtFree(memoContents); memoContents = GetMemoFile(); if (memoContents) { if (strcmp(memoContents, memo.m_data) == 0) return; size = strlen(memoContents) + 1; if (size > memo.m_size) { size += appResources.textbufsz; XtFree(memo.m_data); memo.m_data = XtMalloc(memo.m_size = size); } strcpy(memo.m_data, memoContents); } else *memo.m_data = '\0'; nargs = 0; argLD(XtNstring, memo.m_data); argLD(XtNlength, memo.m_size); argLD(XtNuseStringInPlace, True); XtSetValues(memo.m_text, args, nargs); } /* * Call backs for various buttons */ /* ARGSUSED */ static void MemoTextChanged(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { register MemoEdit *memo = (MemoEdit *) closure; if (MyCalendar) { memo->m_savesens = True; XtSetSensitive(memo->m_save, True); } } /* * Callback routines */ /* ARGSUSED */ static void SaveMemoEdits(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { MemoEdit *memo = (MemoEdit *) closure; if (WriteMemoFile(memo) == False) return; if (memoContents) { XtFree(memoContents); memoContents = XtNewString(memo->m_data); } memo->m_savesens = False; XtSetSensitive(memo->m_save, False); } /* * Write the memo file out */ static Boolean WriteMemoFile(memo) MemoEdit *memo; { Cardinal len = strlen(memo->m_data); String fname; int fd; if (len == 0) { unlink(appResources.memoFile); return (True); } /* * First let's see if we have to create the toplevel directory */ if (!NeedTop()) return (False); fname = appResources.memoFile; if ((fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname); perror("xcal: open"); fflush(stderr); return (False); } if (write(fd, memo->m_data, len) != len) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Write error %s/%s file.\n", MapStem, fname); perror("xcal: write"); fflush(stderr); close(fd); return (False); } close(fd); return (True); } static void FinishMemoEditing(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { if (memo.m_savesens == True) MemoCheckExit(); else CleanMemo(); } static void CleanMemo() { static Arg args[1]; static MemoEdit zerom; callbacks[0].callback = DoMemo; callbacks[0].closure = NULL; XtSetArg(args[0], XtNcallback, callbacks); XtSetValues(memo.m_button, args, 1); XtSetSensitive(memo.m_button, True); MouseShow(memo.m_button, True); XtPopdown(memo.m_popup); XtDestroyWidget(memo.m_popup); XtFree(memo.m_data); XtFree(memo.m_weeklytext); memo = zerom; } static void MemoCheckExit() { DialogPopup(memo.m_quit, MCheckDia, &memo, NULL); } static void MCheckDia(pop, ed) Widget pop; MemoEdit *ed; { Widget dia; XtSetSensitive(memo.m_quit, False); XtSetSensitive(memo.m_button, False); XtSetSensitive(memo.m_save, False); /* Take "Save file?" from resources */ dia = XtCreateManagedWidget("memocheck", dialogWidgetClass, pop, NULL, 0); XawDialogAddButton(dia, "yes", YesCheck, ed); XawDialogAddButton(dia, "no", NoCheck, ed); } /* ARGSUSED */ static void YesCheck(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { SaveMemoEdits(w, closure, call_data); CleanMemo(); XtDestroyWidget(XtParent(XtParent(w))); } /* ARGSUSED */ static void NoCheck(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { CleanMemo(); XtDestroyWidget(XtParent(XtParent(w))); } xcal-4.1.orig/xcal_strip.c100644 13560 13560 44173 6037000403 14256 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_strip.c 3.27 (Hillside Systems) 11/1/93"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_strip.c * function: Deal with the popup strip calendars obtained either by selection and the middle button, or by the < and > buttons on each strip. * history: Written November 1989 Peter Collinson Hillside Systems * (C) Copyright: 1989 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include #include #include #include #include #include #include #include #include #include #include #include #include "xcal.h" static XtCallbackRec callbacks[] = { {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL} }; #define ClearCallbacks() memset((caddr_t)callbacks, '\0', sizeof (callbacks)) Date callb; /* contains date when calendar day button */ /* pressed */ static String defTranslations = ": set()\n\ : LoadDateAction() unset()"; /* * These translations used to make the middle mouse button * load a date file from a selection when clicked on a strip */ /* * Forward routines local to this file */ static void MakeMonth(); static void DayBack(); #ifndef LONG_IS_32_BITS static void YmBack(); #endif static void StripQuit(); void StripHelp(); void WeeklyHelp(); /* * Local routines */ static void MakeNewMonth(); static void LoadDateCallback(); static Cardinal DateSum(); static void setStripMax(); static Dimension CreateActionBar(); static Dimension CreateWeeklyActionBar(); #define argLD(N,V) { XtSetArg(args[nargs], N, V); nargs++; } /* * Start a strip calendar happening a callback of left button */ /* ARGSUSED */ void DoCalendar(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { NewMonthStrip(&today, NULL); /* today is global */ } /* ARGSUSED */ void DoWeekly(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { Date thisday; thisday.day = 0; thisday.month = 0; thisday.year = 0; thisday.wday = 0; NewMonthStrip(&thisday, w);/* today is global */ } /* * Start a strip calendar happening a callback of the > or < buttons in * another strip */ /* ARGSUSED */ static void MakeNewMonth(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { Date thisday; thisday.year = YrUnpack((Cardinal) closure); thisday.month = MoUnpack((Cardinal) closure); thisday.day = today.day; NewMonthStrip(&thisday, NULL); } /* * Do all the X stuff to popup a Strip calendar * A calendar strip is: * * Popup ("") // Name is the month and the year * Paned ("") // Name is the month * Label ("header") // optional contains Month Year * Form ("action") // < Quit > * Command ("back") // contains < * Label ("quit") // contains Quit * Command ("next") // contains > * ViewPort ("viewport") // Viewport containing strip data * Paned ("data") // Panel containing the calendar data * (Then many of..) * Form ("
") // where DDD is the day of the week * Label ("label") // contains the string above * Command ("info") // contains the text from the file * */ void NewMonthStrip(td, but) Date *td; Widget but; { Widget shell, mon, dw, lw, lwi, form, monvp, mondt; Arg args[15]; char titlestr[256]; char tbuf[256]; char iconName[256]; int type; MonthEntry *me; Instance *ins; register int i; register Cardinal nargs; Cardinal thisDay; Cardinal startLoop; String dayStr; Cardinal numberOfDays; Boolean defaultsAreSet = False; Boolean markThisMonth = False; Dimension labelH, infoH; Dimension width; Dimension totalHeight; Dimension hdrHeight; Dimension totalWidth; static XtTranslations but2; type = (td->day == 0) ? ME_WEEKLY : ME_MONTHLY; hdrHeight = 0; /* * There are lots of differences between Months and weekly strips * here. Later tests are done using a switch structure */ switch (type) { case ME_MONTHLY: FmtDate(td, iconName, sizeof iconName, appResources.stripfmt); XtSetArg(args[0], XtNiconName, iconName); shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, 1); ins = RegisterMonth(td->year, td->month, shell); mon = XtCreateManagedWidget(appResources.mon[td->month], panedWidgetClass, shell, NULL, 0); thisDay = FirstDay(td->month, td->year); numberOfDays = NumberOfDays(td->month, td->year); startLoop = 1; /* * Get the map for this year */ me = GetMonthEntry(td->year, td->month); /* * Title bar is month and date */ FmtDate(td, titlestr, sizeof titlestr, appResources.stripfmt); /* * see if we will need to worry about marking today's entry */ if (appResources.markToday && td->year == today.year && td->month == today.month) markThisMonth = True; break; case ME_WEEKLY: (void) strcpy(iconName, appResources.weekly); nargs = 0; argLD(XtNiconName, iconName); shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, nargs); if (but && XtIsSubclass(but, commandWidgetClass)) ButtonOff(but, shell); ins = RegisterMonth(0, 0, shell); mon = XtCreateManagedWidget(iconName, panedWidgetClass, shell, NULL, 0); thisDay = 0; numberOfDays = 6; /* test is <= */ startLoop = 0; /* * Get the map for this year */ me = GetWeeklyEntry(); /* * Title bar is from the resources */ strcpy(titlestr, iconName); /* * see if we will need to worry about marking today's entry */ if (appResources.markToday) markThisMonth = True; break; } /* * Find size of title bar by creating the widget and then throwing it * away */ DoTemplate(tbuf, sizeof tbuf, appResources.stripfmt); XtSetArg(args[0], XtNlabel, tbuf); lw = XtCreateManagedWidget("sizer", labelWidgetClass, shell, args, 1); XtSetArg(args[0], XtNwidth, &totalWidth); XtGetValues(lw, args, 1); XtDestroyWidget(lw); /* * Width is affected by a resource value */ if (appResources.minstripwidth && appResources.minstripwidth > totalWidth) totalWidth = appResources.minstripwidth; /* * Now set the title bar should we need it */ if (appResources.useWmTitle) { XtSetArg(args[0], XtNlabel, XtNewString(titlestr)); lw = XtCreateManagedWidget("header", labelWidgetClass, mon, args, 1); hdrHeight = wHeight(lw); } /* * Action bar */ nargs = 0; argLD(XtNshowGrip, False); argLD(XtNdefaultDistance, 2); dw = XtCreateManagedWidget("action", formWidgetClass, mon, args, nargs); switch (type) { case ME_MONTHLY: hdrHeight += CreateActionBar(shell, dw, mon, td); break; case ME_WEEKLY: hdrHeight += CreateWeeklyActionBar(shell, dw); break; } /* * Create a Viewport, with a panel inside it */ nargs = 0; argLD(XtNshowGrip, False); argLD(XtNallowVert, True); monvp = XtCreateManagedWidget("viewport", viewportWidgetClass, mon, args, nargs); mondt = XtCreateManagedWidget("panel", panedWidgetClass, monvp, NULL, 0); #ifdef LONG_IS_32_BITS callbacks[0].callback = DayBack; #else callbacks[0].callback = YmBack; callbacks[1].callback = DayBack; #endif totalHeight = 0; for (i = startLoop; i <= numberOfDays; i++) { dayStr = appResources.sday[thisDay]; switch (type) { case ME_MONTHLY: (void) sprintf(titlestr, "%2d %s", i, dayStr); break; case ME_WEEKLY: (void) strcpy(titlestr, dayStr); break; } #ifdef LONG_IS_32_BITS callbacks[0].closure = (caddr_t) DatePack(thisDay, i, td->month, td->year); #else callbacks[0].closure = (caddr_t) DatePack(td->month, td->year); callbacks[1].closure = (caddr_t) DayPack(thisDay, i); #endif thisDay = (thisDay + 1) % 7; /* * Each line in the strip is form containing label - command */ nargs = 0; argLD(XtNshowGrip, False); argLD(XtNdefaultDistance, 0); form = XtCreateManagedWidget(dayStr, formWidgetClass, mondt, args, nargs); nargs = 0; argLD(XtNlabel, XtNewString(titlestr)); /* a little naughty here */ /* this string memory is lost */ /* on quit */ argLD(XtNborderWidth, 0); argLD(XtNjustify, XtJustifyLeft); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); ins->i_day_label[i] = lw = XtCreateManagedWidget("label", labelWidgetClass, form, args, nargs); /* * To get a handle on the old values which are lost by * highlighting we get them after we have created the widget. * Then we highlight today. */ if (markThisMonth && ((type == ME_MONTHLY && today.day == i) || (type == ME_WEEKLY && today.wday == i))) { nargs = 0; argLD(XtNforeground, &ins->i_col.fg); argLD(XtNbackground, &ins->i_col.bg); argLD(XtNfont, &ins->i_font); XtGetValues(lw, args, nargs); nargs = 0; argLD(XtNforeground, appResources.today.fg); argLD(XtNbackground, appResources.today.bg); argLD(XtNfont, appResources.fontToday); XtSetValues(lw, args, nargs); } /* * Done the first time through * Gets the width of the line we have just made */ if (defaultsAreSet == False) { /* compute text width */ nargs = 0; argLD(XtNwidth, &width); argLD(XtNheight, &labelH); XtGetValues(lw, args, nargs); defaultsAreSet = True; } /* * Start processing the RHS of the line * This contains text from the file should any exist */ nargs = 0; argLD(XtNborderWidth, 0); argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, lw); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainRight); argLD(XtNjustify, XtJustifyLeft); argLD(XtNwidth, totalWidth - width); if (me->me_have[i]) { argLD(XtNlabel, me->me_have[i]); } else { argLD(XtNlabel, " "); } ins->i_day_info[i] = lwi = XtCreateManagedWidget("info", commandWidgetClass, form, args, nargs); /* add translations */ if (but2 == NULL) { but2 = XtParseTranslationTable(defTranslations); } XtAugmentTranslations(lwi, but2); /* deal with height */ infoH = wHeight(lwi); if (labelH < infoH) { SetWidgetHeightMax(lw, labelH, infoH); totalHeight += infoH + 1; } else if (labelH > infoH) { SetWidgetHeightMax(lwi, infoH, labelH); totalHeight += labelH + 1; } /* * cope with 1752 */ if (td->year == 1752 && td->month == 8 && i == 2) { i = 13; numberOfDays += 11; /* giving back the 11 days */ } } ClearCallbacks(); /* set up size for viewport scrolling */ setStripMax(monvp, totalHeight, hdrHeight); /* here we go */ XtPopup(shell, XtGrabNone); } /* * Get the height of the specified widget */ Dimension wHeight(w) Widget w; { Arg args[1]; Dimension H; XtSetArg(args[0], XtNheight, &H); XtGetValues(w, args, 1); return H; } /* * Set the max size of the viewport for the strip */ static void setStripMax(w, stripHeight, hdrHeight) Widget w; Dimension stripHeight; Dimension hdrHeight; { Dimension maxH; Arg args[1]; if (appResources.maxstripheight == 0) { /* remove the hdrHeight here as a guess */ maxH = HeightOfScreen(XtScreen(toplevel)); maxH -= hdrHeight; } else maxH = appResources.maxstripheight; maxH -= hdrHeight + 20; if (stripHeight > maxH) { XtSetArg(args[0], XtNheight, maxH); XtSetValues(w, args, 1); } } /* * Create action bar for normal monthly strip */ static Dimension CreateActionBar(shell, dw, mon, td) Widget shell; Widget dw; Widget mon; Date *td; { Widget lw; register Cardinal nargs; Arg args[8]; Dimension ht, maxht = 0; /* * back one month label "<" from resources */ callbacks[0].callback = MakeNewMonth; callbacks[0].closure = (caddr_t) DateSum(td, -1); nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); lw = XtCreateManagedWidget("back", commandWidgetClass, dw, args, nargs); maxht = wHeight(lw); maxht++; ClearCallbacks(); /* * Quit button label "quit" from resources */ callbacks[0].callback = StripQuit; callbacks[0].closure = (caddr_t) shell; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, lw); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainRight); lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs); ht = wHeight(lw); maxht = ht > maxht ? ht : maxht; ClearCallbacks(); /* * On one month label ">" from resources */ callbacks[0].callback = MakeNewMonth; callbacks[0].closure = (caddr_t) DateSum(td, 1); nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, lw); argLD(XtNleft, XtChainRight); argLD(XtNright, XtChainRight); lw = XtCreateManagedWidget("next", commandWidgetClass, dw, args, nargs); ht = wHeight(lw); maxht = ht > maxht ? ht : maxht; ClearCallbacks(); /* * Help button label help from resources */ if (appResources.giveHelp) { callbacks[0].callback = StripHelp; callbacks[0].closure = (caddr_t) 0; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNshowGrip, False); lw = XtCreateManagedWidget("help", commandWidgetClass, mon, args, nargs); maxht += wHeight(lw); ClearCallbacks(); } return maxht; } /* * Create action bar for normal monthly strip */ static Dimension CreateWeeklyActionBar(shell, dw) Widget shell; Widget dw; { Widget lw; register Cardinal nargs; Arg args[8]; Dimension ht, maxht = 0; /* * Quit button label "quit" from resources */ callbacks[0].callback = StripQuit; callbacks[0].closure = (caddr_t) shell; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, appResources.giveHelp ? XtChainLeft : XtChainRight); lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs); maxht = wHeight(lw); ClearCallbacks(); /* * Help button label help from resources */ if (appResources.giveHelp) { callbacks[0].callback = WeeklyHelp; callbacks[0].closure = (caddr_t) 0; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, lw); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainRight); lw = XtCreateManagedWidget("help", commandWidgetClass, dw, args, nargs); ht = wHeight(lw); maxht = ht > maxht ? ht : maxht; ClearCallbacks(); } return maxht; } /* * Called when the date changes to ensure that the correct day has the * appropriate highlights */ void ChangeHighlight(old, new) Date *old; Date *new; { register Instance *ins; Arg args[5]; Cardinal nargs; for (ins = FindInstanceList(old); ins; ins = ins->i_next) { nargs = 0; argLD(XtNforeground, ins->i_col.fg); argLD(XtNbackground, ins->i_col.bg); argLD(XtNfont, ins->i_font); XtSetValues(ins->i_day_label[old->day], args, nargs); } for (ins = FindInstanceList(new); ins; ins = ins->i_next) { nargs = 0; argLD(XtNforeground, &ins->i_col.fg); argLD(XtNbackground, &ins->i_col.bg); argLD(XtNfont, &ins->i_font); XtGetValues(ins->i_day_label[new->day], args, nargs); nargs = 0; argLD(XtNforeground, appResources.today.fg); argLD(XtNbackground, appResources.today.bg); argLD(XtNfont, appResources.fontToday); XtSetValues(ins->i_day_label[new->day], args, nargs); } } /* * Called when middle mouse button is clicked on a date box * This gets the current selection and adds it to the file * corresponding to the day. * This allows quick data loading */ void LoadDateStrip(w, event, params, numb) Widget w; XSelectionEvent *event; String *params; Cardinal *numb; { /* set up to get the selection */ /* I am unconvinced that it should be this easy */ XtGetSelectionValue(w, XA_PRIMARY, XA_STRING, LoadDateCallback, 0, XtLastTimestampProcessed(XtDisplay(w))); /* The work is done in the callback routine */ } static void LoadDateCallback(w, xcd, sel, seltype, val, len, fmt) Widget w; XtPointer xcd; Atom *sel; Atom *seltype; XtPointer val; unsigned long *len; int *fmt; { String s; int n; Arg args[1]; Cardinal v; XtCallbackRec *cb; Date da; /* deal with arguments to get the text */ if (*seltype != XA_STRING) n = 0; else n = (*len) * (*fmt/8); if (n == 0) return; s = (String) XtMalloc(n+1); if (n > 0) memcpy(s, (char *)val, n); s[n] = 0; XtFree(val); /* get closure data to find the date */ XtSetArg(args[0], XtNcallback, &cb); XtGetValues(w, args, 1); v = (Cardinal) cb->closure; da.month = MoUnpack(v), da.year = YrUnpack(v); #ifndef LONG_IS_32_BITS cb++; v = (Cardinal) cb->closure; #endif da.day = DyUnpack(v); da.wday = WdUnpack(v); /* Add text to day file (code in xcal_edit.c) */ AppendText(w, &da, s); } /* * Call back from a quit button to lose a month strip */ /* ARGSUSED */ static void StripQuit(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { XtPopdown((Widget) closure); XtDestroyWidget((Widget) closure); } /* * Month arithmetic and packing */ static Cardinal DateSum(td, inx) Date *td; int inx; { int m, y; m = td->month; y = td->year; m += inx; if (m < 0) { m = 11; y--; } else if (m > 11) { m = 0; y++; } #ifdef LONG_IS_32_BITS return (DatePack(0, 0, m, y)); #else return (DatePack(m, y)); #endif } /* * Call back from day selection button press * This is done in two stages if cannot fold dates into a closure */ /* ARGSUSED */ static void DayBack(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { #ifdef LONG_IS_32_BITS callb.month = MoUnpack((Cardinal) closure); callb.year = YrUnpack((Cardinal) closure); #endif callb.day = DyUnpack((Cardinal) closure); callb.wday = WdUnpack((Cardinal) closure); StartEditing(w, &callb, NULL); } #ifndef LONG_IS_32_BITS /* ARGSUSED */ static void YmBack(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { callb.month = MoUnpack((Cardinal) closure); callb.year = YrUnpack((Cardinal) closure); } #endif xcal-4.1.orig/xcal.c100644 13560 13560 55703 6052205617 13051 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal.c 3.53 (Hillside Systems) 9/13/95"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * program name: xcal.c * function: display the current calendar date if pressed as a button go into strip calendar mode * switches: -format str use str as a main display format -debug run quickly incrementing time - 1 day per sec -alarmscan print alarm debug info -format Set date format of top level box -stripfmt Set date format of strip -editfmt Set date format of edit boxes -clocktick Set clock tick rate. -u Look at another user's calendar * libraries used: libXaw.a, libXmu.a libXt.a libX11.a * compile time parameters: standard * history: Written November 1989 Hacked again October 1993 Peter Collinson Hillside Systems * (C) Copyright: 1989 Hillside Systems/Peter Collinson Permission to use, copy, modify, and distribute this software and its documentation for any purpose is hereby granted to anyone, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Peter Collinson not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Hillside Systems makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. Peter Collinson DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Peter Collinson BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***/ #include #include #include #include #include #include #include #include #include #include #include "xcal.h" char date_area[BUFSIZ]; /* command line options specific to the application */ static XrmOptionDescRec Options[] = { {"-debug", "debug", XrmoptionNoArg, (caddr_t) "TRUE"}, {"-alarmscan", "alarmScan", XrmoptionNoArg, (caddr_t) "TRUE"}, {"-format", "format", XrmoptionSepArg, NULL}, {"-stripfmt", "stripFmt", XrmoptionSepArg, NULL}, {"-editfmt", "editFmt", XrmoptionSepArg, NULL}, {"-clocktick", "clockTick", XrmoptionSepArg, NULL}, {"-u", "otherUser", XrmoptionSepArg, NULL}, }; struct resources appResources; Pixmap HelpPix; Pixmap HelpPressPix; Pixmap IconPix; Pixmap MouseOnPix; Pixmap MouseOffPix; XtAppContext appContext; #define offset(field) XtOffset(struct resources *, field) static XtResource Resources[] = { {"debug", "Debug", XtRBoolean, sizeof(Boolean), offset(debug), XtRString, "False"}, {"otherUser", "OtherUser", XtRString, sizeof(String), offset(otheruser), XtRString, NULL}, {"alarmScan", "AlarmScan", XtRBoolean, sizeof(Boolean), offset(alarmScan), XtRString, "False"}, {"reverseVideo", "ReverseVideo", XtRBoolean, sizeof(Boolean), offset(reverseVideo), XtRString, "False"}, {"xcalendarCompat", "XcalendarCompat", XtRBoolean, sizeof(Boolean), offset(calCompat), XtRString, "False"}, {"giveHelp", "GiveHelp", XtRBoolean, sizeof(Boolean), offset(giveHelp), XtRString, "True"}, {"helpFromFile", "HelpFromFile", XtRBoolean, sizeof(Boolean), offset(helpFromFile), XtRString, "True"}, {"helpFile", "HelpFile", XtRString, sizeof(String), offset(helpfile), XtRString, "/usr/lib/X11/app-defaults/XCal.help"}, {"useMemo", "UseMemo", XtRBoolean, sizeof(Boolean), offset(useMemo), XtRString, "True"}, {"memoLeft", "MemoLeft", XtRBoolean, sizeof(Boolean), offset(memoLeft), XtRString, "True"}, {"initialCalendar", "InitialCalendar", XtRBoolean, sizeof(Boolean), offset(initialCalendar), XtRString, "False"}, {"initialEdit", "InitialEdit", XtRBoolean, sizeof(Boolean), offset(initialEdit), XtRString, "False"}, {"initialMemo", "InitialMemo", XtRBoolean, sizeof(Boolean), offset(initialMemo), XtRString, "False"}, {"format", "Format", XtRString, sizeof(String), offset(format), XtRString, "%A %d %B %Y"}, {"stripFmt", "StripFmt", XtRString, sizeof(String), offset(stripfmt), XtRString, "%B %Y"}, {"editFmt", "EditFmt", XtRString, sizeof(String), offset(editfmt), XtRString, "%A %d %B %Y"}, {"clockTick", "ClockTick", XtRInt, sizeof(int), offset(clocktick), XtRString, "0"}, {"markToday", "MarkToday", XtRBoolean, sizeof(Boolean), offset(markToday), XtRString, "True"}, {"fontToday", "FontToday", XtRFontStruct, sizeof(XFontStruct *), offset(fontToday), XtRString, "XtDefaultFont"}, {"todayForeground", "TodayForeground", XtRPixel, sizeof(Pixel), offset(today.fg), XtRString, "White"}, {"todayBackground", "TodayBackground", XtRPixel, sizeof(Pixel), offset(today.bg), XtRString, "Black"}, {"directory", "Directory", XtRString, sizeof(String), offset(directory), XtRString, "Calendar"}, {"textBufferSize", "TextBufferSize", XtRInt, sizeof(int), offset(textbufsz), XtRString, "2048"}, {"useWmTitle", "UseWmTitle", XtRBoolean, sizeof(Boolean), offset(useWmTitle), XtRString, "True"}, {"minStripWidth", "MinStripWidth", XtRDimension, sizeof(Dimension), offset(minstripwidth), XtRString, "0"}, /* set to screen size in the code */ {"maxStripHeight", "MaxStripHeight", XtRDimension, sizeof(Dimension), offset(maxstripheight), XtRString, "0"}, {"january", "January", XtRString, sizeof(String), offset(mon[0]), XtRString, "January"}, {"february", "February", XtRString, sizeof(String), offset(mon[1]), XtRString, "February"}, {"march", "March", XtRString, sizeof(String), offset(mon[2]), XtRString, "March"}, {"april", "April", XtRString, sizeof(String), offset(mon[3]), XtRString, "April"}, {"may", "May", XtRString, sizeof(String), offset(mon[4]), XtRString, "May"}, {"june", "June", XtRString, sizeof(String), offset(mon[5]), XtRString, "June"}, {"july", "July", XtRString, sizeof(String), offset(mon[6]), XtRString, "July"}, {"august", "August", XtRString, sizeof(String), offset(mon[7]), XtRString, "August"}, {"september", "September", XtRString, sizeof(String), offset(mon[8]), XtRString, "September"}, {"october", "October", XtRString, sizeof(String), offset(mon[9]), XtRString, "October"}, {"november", "November", XtRString, sizeof(String), offset(mon[10]), XtRString, "November"}, {"december", "December", XtRString, sizeof(String), offset(mon[11]), XtRString, "December"}, {"jan", "Jan", XtRString, sizeof(String), offset(smon[0]), XtRString, "Jan"}, {"feb", "Feb", XtRString, sizeof(String), offset(smon[1]), XtRString, "Feb"}, {"mar", "Mar", XtRString, sizeof(String), offset(smon[2]), XtRString, "Mar"}, {"apr", "Apr", XtRString, sizeof(String), offset(smon[3]), XtRString, "Apr"}, {"may", "May", XtRString, sizeof(String), offset(smon[4]), XtRString, "May"}, {"jun", "Jun", XtRString, sizeof(String), offset(smon[5]), XtRString, "Jun"}, {"jul", "Jul", XtRString, sizeof(String), offset(smon[6]), XtRString, "Jul"}, {"aug", "Aug", XtRString, sizeof(String), offset(smon[7]), XtRString, "Aug"}, {"sep", "Sep", XtRString, sizeof(String), offset(smon[8]), XtRString, "Sep"}, {"oct", "Oct", XtRString, sizeof(String), offset(smon[9]), XtRString, "Oct"}, {"nov", "Nov", XtRString, sizeof(String), offset(smon[10]), XtRString, "Nov"}, {"dec", "Dec", XtRString, sizeof(String), offset(smon[11]), XtRString, "Dec"}, {"sunday", "Sunday", XtRString, sizeof(String), offset(day[0]), XtRString, "Sunday"}, {"monday", "Monday", XtRString, sizeof(String), offset(day[1]), XtRString, "Monday"}, {"tuesday", "Tuesday", XtRString, sizeof(String), offset(day[2]), XtRString, "Tuesday"}, {"wednesday", "Wednesday", XtRString, sizeof(String), offset(day[3]), XtRString, "Wednesday"}, {"thursday", "Thursday", XtRString, sizeof(String), offset(day[4]), XtRString, "Thursday"}, {"friday", "Friday", XtRString, sizeof(String), offset(day[5]), XtRString, "Friday"}, {"saturday", "Saturday", XtRString, sizeof(String), offset(day[6]), XtRString, "Saturday"}, {"sun", "Sun", XtRString, sizeof(String), offset(sday[0]), XtRString, "Sun"}, {"mon", "Mon", XtRString, sizeof(String), offset(sday[1]), XtRString, "Mon"}, {"tue", "Tue", XtRString, sizeof(String), offset(sday[2]), XtRString, "Tue"}, {"wed", "Wed", XtRString, sizeof(String), offset(sday[3]), XtRString, "Wed"}, {"thu", "Thu", XtRString, sizeof(String), offset(sday[4]), XtRString, "Thu"}, {"fri", "Fri", XtRString, sizeof(String), offset(sday[5]), XtRString, "Fri"}, {"sat", "Sat", XtRString, sizeof(String), offset(sday[6]), XtRString, "Sat"}, {"weekly", "Weekly", XtRString, sizeof(String), offset(weekly), XtRString, "Weekly"}, {"alarms", "Alarms", XtRBoolean, sizeof(Boolean), offset(alarms), XtRString, "True"}, {"execAlarms", "ExecAlarms", XtRBoolean, sizeof(Boolean), offset(execalarms), XtRString, "True"}, {"alarmWarp", "AlarmWarp", XtRBoolean, sizeof(Boolean), offset(alarmWarp), XtRString, "False"}, {"minAlarmWarp", "MinAlarmWarp", XtRInt, sizeof(int), offset(minAlarmWarp), XtRString, "7"}, {"update", "Update", XtRInt, sizeof(int), offset(update), XtRString, "0"}, {"volume", "Volume", XtRInt, sizeof(int), offset(volume), XtRString, "50"}, {"nbeeps", "Nbeeps", XtRInt, sizeof(int), offset(nbeeps), XtRString, "3"}, {"cmd", "Cmd", XtRString, sizeof(String), offset(cmd), XtRString, NULL}, {"countdown", "Countdown", XtRString, sizeof(String), offset(countdown), XtRString, "10,0"}, {"autoquit", "Autoquit", XtRInt, sizeof(int), offset(autoquit), XtRString, "120"}, {"alarmleft", "Alarmleft", XtRString, sizeof(String), offset(alarmleft), XtRString, "%d minutes before..."}, {"alarmnow", "Alarmnow", XtRString, sizeof(String), offset(alarmnow), XtRString, "Time is now..."}, {"private", "Private", XtRString, sizeof(String), offset(private), XtRString, "Private calendar entry"}, {"already", "Already", XtRString, sizeof(String), offset(already), XtRString, "Already editing %d %B %Y"}, {"alreadyWeekly", "AlreadyWeekly", XtRString, sizeof(String), offset(alreadyWeekly), XtRString, "Already editing %A"}, {"memoFile", "MemoFile", XtRString, sizeof(String), offset(memoFile), XtRString, "memo"}, {"maxDisplayLines", "MaxDisplayLines", XtRInt, sizeof(int), offset(maxDisplayLines), XtRString, "5"}, }; static XtCallbackRec callbacks[] = { {NULL, NULL}, {NULL, NULL}, }; #define ClearCallbacks() memset((caddr_t)callbacks, '\0', sizeof (callbacks)) static XtActionsRec appActions[] = { {"setdate", SetDate}, {"leave", AskLeave}, {"SetDateAction", TextCal}, {"LoadDateAction", LoadDateStrip }, }; static String defTranslations = ": set()\n\ :setdate() unset()\n\ : set()\n\ : leave() unset()"; Widget toplevel; Widget mHelp; /* popup help widget */ Date today; int updatefreq; /* clock tick on the top level widget */ /* * external routines */ extern void MainHelp(); /* * Forward routines local to this file */ void AlterTitles(); static void ConvDate(); static void MkDate(); static void DebugMkDate(); static void PixInit(); static int CycleDays(); static int CycleMonths(); static void SetUpdateFreq(); static int UpdateFreq(); static void AdjustHeights(); /* * Create the three components of the date strip */ static Widget MemoWidget(); static Widget DateWidget(); static Widget HelpWidget(); /* * Your compiler may complain about the fact that some of the * characters in these bitmaps are eight bits. * If this worries you * #define UNSIGNED unsigned */ #define UNSIGNED #include "calendar.bm" #include "help.bm" #include "help_press.bm" #include "mouse.bm" #include "mouseaway.bm" #undef UNSIGNED /* defines fallbackResources */ #include "xcal_ad.h" void main(argc, argv) int argc; char *argv[]; { Widget parent; Widget memo; Widget lab; static Arg iconArg[] = { {XtNiconPixmap, (XtArgVal) NULL}, }; toplevel = XtAppInitialize(&appContext, "XCal", Options, XtNumber(Options), &argc, argv, fallbackResources, NULL, 0); PixInit(toplevel); iconArg[0].value = IconPix; XtSetValues(toplevel, iconArg, XtNumber(iconArg)); if (argc != 1) fprintf(stderr, "%s: Error in arguments\n", argv[0]); XtGetApplicationResources(toplevel, (caddr_t) & appResources, Resources, XtNumber(Resources), (ArgList) NULL, 0); /* * If reverse video invert default colour settings */ if (appResources.reverseVideo) { Colour old; old = appResources.today; appResources.today.fg = old.bg; appResources.today.bg = old.fg; } if (appResources.otheruser) AlterTitles(); InitMonthEntries(); /* get a maximum initial size of the box */ DoTemplate(date_area, sizeof(date_area), appResources.format); parent = XtVaCreateManagedWidget("form", formWidgetClass, toplevel, XtNborderWidth, 0, XtNdefaultDistance, 0, NULL); if (appResources.useMemo) { if (appResources.memoLeft) { memo = MemoWidget(parent, NULL); lab = DateWidget(parent, memo); if (appResources.giveHelp) mHelp = HelpWidget(parent, lab); } else { lab = DateWidget(parent, NULL); memo = MemoWidget(parent, lab); if (appResources.giveHelp) mHelp = HelpWidget(parent, memo); } } else { lab = DateWidget(parent, NULL); if (appResources.giveHelp) mHelp = HelpWidget(parent, lab); } AdjustHeights(appResources.useMemo ? memo : NULL, lab, appResources.giveHelp ? mHelp : NULL); XtSetMappedWhenManaged(toplevel, False); XtRealizeWidget(toplevel); /* set the default geometry */ SetUpdateFreq(appResources.format); if (appResources.debug) { fprintf(stderr, "Debug ON\n"); DebugMkDate(lab); } else MkDate(lab); XtAppAddActions(appContext, appActions, 4); /* register actions */ XtAugmentTranslations(lab, XtParseTranslationTable(defTranslations)); XtMapWidget(toplevel); if (appResources.initialCalendar) DoCalendar(lab, NULL, NULL); if (appResources.initialEdit) { MonthEntry *me; me = GetMonthEntry(today.year, today.month); if (me->me_have[today.day]) StartEditing(lab, &today, NULL); } if (appResources.useMemo && appResources.initialMemo) DoMemo(memo, NULL, NULL); InitAlarms(); XtAppMainLoop(appContext); exit(0); } /* * Make three widgets for the main strip */ static Widget MemoWidget(parent, horiz) Widget parent; Widget horiz; { Widget ret; callbacks[0].callback = DoMemo; ret = XtVaCreateManagedWidget("today", commandWidgetClass, parent, XtNcallback, (XtArgVal) callbacks, XtNfromHoriz, horiz, XtNleft, XtChainLeft, XtNright, XtRubber, XtNborderWidth, 0, XtNbitmap, MouseOnPix, NULL); ClearCallbacks(); return ret; } static Widget DateWidget(parent, horiz) Widget parent, horiz; { Widget ret; callbacks[0].callback = DoCalendar; ret = XtVaCreateManagedWidget("date", commandWidgetClass, parent, XtNlabel, (XtArgVal) date_area, XtNcallback, (XtArgVal) callbacks, XtNfromHoriz, horiz, XtNleft, XtChainLeft, XtNright, XtRubber, XtNborderWidth, 0, NULL); ClearCallbacks(); return ret; } static Widget HelpWidget(parent, horiz) Widget parent, horiz; { Widget ret; callbacks[0].callback = MainHelp; ret = XtVaCreateManagedWidget("mainHelp", commandWidgetClass, parent, XtNcallback, (XtArgVal) callbacks, XtNfromHoriz, horiz, XtNleft, XtRubber, XtNright, XtChainRight, XtNborderWidth, 0, XtNbitmap, HelpPix, NULL); ClearCallbacks(); return ret; } /* * Initialise Pixmaps */ static void PixInit(toplevel) Widget toplevel; { Display *theDisplay = XtDisplay(toplevel); HelpPix = XCreateBitmapFromData(theDisplay, DefaultRootWindow(theDisplay), help_bits, help_width, help_height); HelpPressPix = XCreateBitmapFromData(theDisplay, DefaultRootWindow(theDisplay), help_press_bits, help_press_width, help_press_height); IconPix = XCreateBitmapFromData(theDisplay, DefaultRootWindow(theDisplay), cal_bits, cal_width, cal_height); MouseOnPix = XCreateBitmapFromData(theDisplay, DefaultRootWindow(theDisplay), (char *) mouse_bits, mouse_width, mouse_height); MouseOffPix = XCreateBitmapFromData(theDisplay, DefaultRootWindow(theDisplay), (char *) mouseaway_bits, mouseaway_width, mouseaway_height); } /* * Adjust height of the command box */ static void AdjustHeights(memo, date, help) Widget memo; Widget date; Widget help; { Dimension hm, hd, hh, max; hm = memo ? wHeight(memo): 0; hd = date ? wHeight(date): 0; hh = help ? wHeight(help): 0; max = hm; max = (hd > max) ? hd : max; max = (hh > max) ? hh : max; if (hm && hm < max) SetWidgetHeightMax(memo, hm, max); if (hd && hd < max) SetWidgetHeightMax(date, hd, max); if (hh && hh < max) SetWidgetHeightMax(help, hh, max); } void SetWidgetHeightMax(w, h, max) Widget w; Dimension h; Dimension max; { Arg args[3]; int adj; adj = ((int)max - (int)h)/2; if (adj > 0) { XtSetArg(args[0], XtNvertDistance, adj); XtSetArg(args[1], XtNfromVert, NULL); XtSetValues(w, args, 2); } } /* * If we are not dealing with our calendar entries add * (user-name) * to the end of the date format strings */ void AlterTitles() { char us[16]; char fmt[256]; (void) sprintf(us, " (%s)", appResources.otheruser); /* I am unsure whether it is safe to free these strings */ #define cstr(v) { strcpy(fmt, v); strcat(fmt, us); v = XtNewString(fmt); } cstr(appResources.format); cstr(appResources.stripfmt); cstr(appResources.editfmt); #undef cstr } /* * Flip mouse state */ void MouseShow(w, OnOff) Widget w; Boolean OnOff; { Arg arg[1]; XtSetArg(arg[0], XtNbitmap, OnOff ? MouseOnPix : MouseOffPix); XtSetValues(w, arg, 1); } /* * Flip help state */ void HelpShow(w, Pressed) Widget w; Boolean Pressed; { Arg arg[1]; XtSetArg(arg[0], XtNbitmap, Pressed ? HelpPressPix : HelpPix); XtSetValues(w, arg, 1); } /* * Exit routine */ void Leave(retval) int retval; { exit(retval); } /************************************************************************/ /* */ /* */ /* This deals with the top level date `icon' */ /* */ /* */ /************************************************************************/ /* * Time management code * Set up a Date structure from today's information */ static void ConvDate(tm, dp) struct tm *tm; Date *dp; { dp->day = tm->tm_mday; dp->month = tm->tm_mon; dp->year = tm->tm_year + 1900; dp->wday = tm->tm_wday; } void FmtTime(tm, buf, len, fmt) struct tm *tm; char *buf; int len; char *fmt; { if (strftime(buf, len, fmt, tm) == 0) { strftime(buf, len, "%A %e %B %Y", tm); } } void FmtDate(da, buf, len, fmt) Date *da; char *buf; int len; char *fmt; { if (strfdate(buf, len, fmt, da) == 0) { strfdate(buf, len, "%A %e %B %Y", da); } } static void DebugMkDate(w) Widget w; { static long ti; struct tm *tm; Date yesterday; static firsttime; yesterday = today; if (ti == 0) (void) time(&ti); else ti += updatefreq; tm = localtime(&ti); ConvDate(tm, &today); FmtTime(tm, date_area, sizeof(date_area), appResources.format); XtVaSetValues(w, XtNlabel, (XtArgVal) date_area, NULL); if (firsttime != 0) { if (yesterday.day != today.day) { ChangeHighlight(&yesterday, &today); AlarmFilePoll(tm); } UpdateMemo(); } firsttime = 1; XtAppAddTimeOut(appContext, (updatefreq < 60) ? 25 : 500, DebugMkDate, (caddr_t) w); } static void MkDate(w) Widget w; { long ti; struct tm *tm; Date yesterday; static firsttime; yesterday = today; (void) time(&ti); tm = localtime(&ti); ConvDate(tm, &today); FmtTime(tm, date_area, sizeof(date_area), appResources.format); XtVaSetValues(w, XtNlabel, (XtArgVal) date_area, NULL); if (firsttime != 0) { if (yesterday.day != today.day) { ChangeHighlight(&yesterday, &today); AlarmFilePoll(tm); } UpdateMemo(); } firsttime = 1; ti = ClockSync(tm, updatefreq); XtAppAddTimeOut(appContext, ti * 1000, MkDate, (caddr_t) w); } /* * Given a time structure and a frequency in secs * return no of secs to hit that interval */ long ClockSync(tm, freq) struct tm *tm; long freq; { long ti; ti = freq; if (ti > 1 && ti < 60) ti -= tm->tm_sec%freq; else if (ti >= 60 && ti < 3600) ti -= (tm->tm_min*60 + tm->tm_sec)%freq; else if (ti >= 3600) ti -= (tm->tm_hour*60*60 + tm->tm_min*60 + tm->tm_sec)%freq; return ti; } /* * DoTemplate * place an initial string into the date area so that the label * box will always be big enough */ void DoTemplate(buf, len, fmt) char *buf; size_t len; char *fmt; { Tm *tm; Tm tml; time_t ti; time(&ti); tm = localtime(&ti); tml = *tm; /* it seems that Solaris is unhappy when you */ tm = &tml; /* poke values into its own structure */ /* but is OK if you have your own */ /* generate a maximal structure */ tm->tm_sec = 59; tm->tm_min = 59; tm->tm_hour = 23; tm->tm_mday = 27; tm->tm_mon = CycleMonths(tm); tm->tm_year = 93; tm->tm_wday = CycleDays(tm); FmtTime(tm, buf, len, fmt); } static int CycleDays(settm) struct tm *settm; { int max = 0; int maxday = 0; char buf[BUFSIZ]; struct tm tm; int d; int len; tm = *settm; for (d = 0; d < 7; d++) { tm.tm_wday = d; len = strftime(buf, sizeof buf, "%A", &tm); if (len > max) { maxday = d; max = len; } } return maxday; } static int CycleMonths(settm) struct tm *settm; { int max = 0; int maxmon = 0; char buf[BUFSIZ]; struct tm tm; int d; int len; tm = *settm; for (d = 0; d < 11; d++) { tm.tm_mon = d; len = strftime(buf, sizeof buf, "%B", &tm); if (len > max) { maxmon = d; max = len; } } return maxmon; } /* * Look to see if we need to do something more than poll daily to change * the main toplevel strip */ static void SetUpdateFreq(fmt) char *fmt; { updatefreq = UpdateFreq(fmt); if (appResources.clocktick && updatefreq && updatefreq < appResources.clocktick) updatefreq = appResources.clocktick; if (updatefreq == 0) updatefreq = 24*60*60; } /* * Scan the time format string looking for an update frequency */ static int UpdateFreq(fmt) char *fmt; { int update = 0; #define minu(v) update = (update == 0 ? v : ((update < v) ? update : v)) for(;*fmt; ++fmt) { if (*fmt == '%') switch(*++fmt) { case '\0': --fmt; break; case 'C': case 'c': case 'r': case 'S': case 's': case 'T': case 'X': minu(1); /* every second */ break; case 'M': case 'R': minu(60); /* every minute */ break; case 'H': case 'h': case 'I': case 'k': case 'l': minu(3600); /* every hour */ break; case 'p': case 'P': minu(43200); /* AM/PM */ break; } } return update; } xcal-4.1.orig/xcal_alarm.c100644 13560 13560 46020 6052205542 14212 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_alarm.c 1.25 (Hillside Systems) 8/9/94"; static char *copyright = "@(#)Copyright 1989,1990,1993 Mark Majhor, Peter Collinson"; #endif /* lint */ /*** * module name: xcal_alarm.c * function: Deal with editable days This is derived from xcalendar's view of how to store things * history: Original idea and code from Mark Majhor, Sequent written August 1990, received Sept 1990 I have reworked most of the code and algorithms Peter Collinson Hillside Systems * (C) Copyright: 1989/1990 Hillside Systems/Peter Collinson/Mark Majhor For full permissions and copyright notice - see xcal.c ***/ #include /* for toolkit stuff */ #include #include #include /* for useful atom names */ #include #include #include #include #include #include #include #include /* for printing error messages */ #include #include /* for stat() */ #include /* for getting username */ #include #include "xcal.h" #ifndef wordBreak #define wordBreak 0x01 #define scrollVertical 0x02 #endif static char *LocalMapStem; static int LocalMapStemMade; /* day when LocalMapStem made last */ static struct stat localstat; static char *TodayFile; static struct stat todaystat; static Alarm head; static int *countDown; static int countDownCt; static XtCallbackRec callbacks[] = { {NULL, NULL}, {NULL, NULL} }; #define dprintf if (appResources.alarmScan) printf #define MINUTES(hr, mn) ((hr)*60 + (mn)) #define argLD(N,V) { XtSetArg(args[nargs], N, V); nargs++; } /* * Local routines */ static void AlarmScan(); static void FreeAlarmList(); static void setCall(); static void beep(); static void AddAlarm(); static void DisplayAlarmWindow(); static void DestroyAlarm(); static void HoldAlarm(); static void AutoDestroy(); static void AlarmEvent(); static void ClockTick(); static void AlarmsOff(); static int readDataLine(); static String CreateCommand(); static int ReloadAlarms(); /* * Initialise variables for the alarm mechanism */ void InitAlarms() { register char *str; register char *wk; register ct; register int *p; char *XtMalloc(); if (!MyCalendar) return; if (appResources.alarms == False) { dprintf("Alarms not enabled\n"); return; } dprintf("Alarms on\n"); /* * Interpret the countDown string established * by user - turn this into a vector * countDown -> points to a vector of integers * indicating the number of mins each alarm will be set * countDownCt - the number of integers in the vector */ if (str = appResources.countdown) { for (wk = str, ct = 0; *wk; wk++) if (*wk == ',') ct++; ct++; /* no of things to store */ countDown = (int *) XtMalloc(sizeof(int) * (ct + 2)); p = countDown; while (*str) if (!isdigit(*str)) str++; else break; while (*str) { *p = 0; ct = 0; while (isdigit(*str)) ct = ct * 10 + *str++ - '0'; *p++ = ct; countDownCt++; while (*str && !isdigit(*str)) str++; } } if (appResources.update) ClockTick(0, 0); else AlarmFilePoll(0); } /* * ClockTick is polled every minute (update) to see if the data file has * altered - if so then a new data list is built */ static void ClockTick(client_data, id) caddr_t client_data; XtIntervalId *id; { long secs; time_t ti; struct tm *tm; ti = time(0); tm = localtime(&ti); dprintf("ClockTick %d:%02d:%02d\n", tm->tm_hour, tm->tm_min, tm->tm_sec); secs = ClockSync(tm, appResources.update); (void) XtAppAddTimeOut(appContext, secs * 1000, (XtTimerCallbackProc) ClockTick, (caddr_t) NULL); AlarmFilePoll(tm); MemoPoll(); } void AlarmFilePoll(tm) struct tm *tm; { time_t ti; int mnow; int files, changed; struct stat oldstat; char *home; char buf[256]; Alarm *old; if (appResources.alarms == False) return; if (tm == NULL) { ti = time(0); tm = localtime(&ti); } /* * Create the name of the data file in a cache to save energy */ if (LocalMapStemMade != tm->tm_mday) { LocalMapStemMade = tm->tm_mday; if (appResources.calCompat == False) { (void) sprintf(buf, "%s/xy%d/xc%d%s%d", MapStem, tm->tm_year + 1900, tm->tm_mday, appResources.smon[tm->tm_mon], tm->tm_year + 1900); } else { (void) sprintf(buf, "%s/xc%d%s%d", MapStem, tm->tm_mday, appResources.smon[tm->tm_mon], tm->tm_year + 1900); } if (LocalMapStem) XtFree(LocalMapStem); LocalMapStem = XtNewString(buf); dprintf("Todays Daily Filename = %s\n", LocalMapStem); if (TodayFile) XtFree(TodayFile); TodayFile = XtNewString(MakeWeeklyName(tm->tm_wday)); memset(&localstat, '\0', sizeof (struct stat)); memset(&todaystat, '\0', sizeof (struct stat)); } files = 0; changed = 0; /* * check for file existence */ if (access(LocalMapStem, F_OK) == 0) { files = 1; oldstat = localstat; (void) stat(LocalMapStem, &localstat); if (oldstat.st_mtime != localstat.st_mtime || oldstat.st_ctime != localstat.st_ctime) changed = 1; } if (access(TodayFile, F_OK) == 0) { files |= 2; oldstat = todaystat; (void) stat(TodayFile, &todaystat); if (oldstat.st_mtime != todaystat.st_mtime || oldstat.st_ctime != todaystat.st_ctime) changed |= 2; } old = NULL; if (changed) { old = head.next; head.next = NULL; } if (files) { if (changed) { mnow = MINUTES(tm->tm_hour, tm->tm_min); if (files & 1) AlarmScan(LocalMapStem, tm, mnow); if (files & 2) AlarmScan(TodayFile, tm, mnow); /* check on any extant alarm */ if (ReloadAlarms(old, mnow)) AlarmsOff(); if (appResources.interval_id == 0 && head.next) setCall(); } } else dprintf("No files to scan\n"); if (old) FreeAlarmList(old); UpdateMemo(); } static int ReloadAlarms(old, mnow) Alarm *old; int mnow; { Alarm *prev; dprintf("Checking old alarm details\n"); if (head.next == NULL) { if (old) { dprintf("No new alarms, stop old running\n"); return 1; } } else if (head.next->alarm_mm <= mnow && (old == NULL || old->alarm_mm > head.next->alarm_mm)) { /* * this looks different but let's be careful * if the entries on the new list are earlier * than those on the old - then we have * serviced those requests and we need to * ensure that we don't fire them again */ while (head.next && head.next->alarm_mm <= mnow && (old == NULL || old->alarm_mm > head.next->alarm_mm)) { dprintf("Discard alarm\n"); XtFree(head.next->alarm); XtFree(head.next->what); prev = head.next; head.next = prev->next; XtFree((char *)prev); } return (ReloadAlarms(old, mnow)); } else if (old && old->alarm_mm != head.next->alarm_mm) { dprintf("First new alarm differs from old, stop old alarm\n"); dprintf("Old: %d %s %s\n", old->alarm_mm, old->alarm, old->what); dprintf("New: %d %s %s\n", head.next->alarm_mm, head.next->alarm, head.next->what); return 1; } return 0; } static void AlarmScan(file, tm, mnow) String file; struct tm *tm; int mnow; { FILE *fp; char hrstr[16]; char remline[256]; char *rem; int hr, mn; Boolean isAction; dprintf("Scanning data file %s\n", file); if ((fp = fopen(file, "r")) == NULL) { fprintf(stderr, "Unexpected failure to open: %s\n", file); exit(1); } while (readDataLine(fp, &hr, &mn, hrstr, remline)) { /* see if we have an action string to do */ isAction = False; rem = remline; if (*rem == '!' || strncmp(remline, "%cron", 5) == 0) { if (appResources.execalarms == False) continue; isAction = True; if (*rem == '!') rem++; else rem += 5; while (isspace(*rem)) rem++; if (*rem == '\0') continue; } AddAlarm(mnow, isAction, hr, mn, hrstr, rem); } (void) fclose(fp); } /* * The idea here is to generate a sorted event list - one element for each * event. We will discard anything that has already happened */ static void AddAlarm(mnow, exec, hr, mn, hrstr, rem) int mnow; Boolean exec; int hr; int mn; char *hrstr; char *rem; { Alarm *al, *prev, *new; char *XtMalloc(); int al_hr, al_mn, mm; int loop; int zero = 0; int *p; if (exec || countDownCt == 0) { loop = 1; p = &zero; } else { loop = countDownCt; p = countDown; } for (; loop--; p++) { al_hr = hr; al_mn = mn; if (*p) { al_mn -= *p; if (al_mn < 0) { al_mn += 60; al_hr--; if (al_hr < 0) continue; } } if ((mm = MINUTES(al_hr, al_mn)) < mnow) continue; new = (Alarm *) XtMalloc(sizeof(Alarm)); new->alarm = XtNewString(hrstr); new->what = XtNewString(rem); new->alarm_mm = mm; new->alarm_state = *p; new->isAction = exec; new->next = NULL; /* now insert into correct place in List */ if (head.next == NULL) { head.next = new; dprintf("%s - %s; alarm at %02d:%02d\n", hrstr, rem, al_hr, al_mn); } else { for (prev = &head, al = head.next; al; prev = al, al = prev->next) if (mm < al->alarm_mm) break; prev->next = new; new->next = al; dprintf("%s - %s; alarm at %02d:%02d\n", hrstr, rem, al_hr, al_mn); } } } /* * read a line looking for a time spec and some data * return 1 if found * return 0 at end * Time spec is: hhmm hmm * hh:mm hh.mm * h:mm h.mm * all above may be optionally followed by: * A a AM am Am aM P p PM pm Pm pM * the string is terminated by a space or a tab */ static int readDataLine(fin, hrp, minp, timestr, remline) FILE *fin; int *hrp; int *minp; char *timestr; char *remline; { register enum readState { Ignore, Hr1, Hr2, HrSep, Mn1, Mn2, AmPm, LoseM, LookSp, LoseSp, Store, AllDone } state; register int c = 0; int hr = 0, mn = 0; char *destp; Boolean foundampm = False; if (feof(fin)) return 0; state = Hr1; while (state != AllDone) { if ((c = getc(fin)) == EOF) { if (state == Store) break; return 0; } switch (state) { case Ignore: if (c == '\n') state = Hr1; continue; case Hr1: destp = timestr; if (isdigit(c)) { hr = c - '0'; mn = 0; destp = timestr; *destp = '\0'; state = Hr2; break; } state = (c == '\n' ? Hr1 : Ignore); continue; case Hr2: if (isdigit(c)) { hr = hr * 10 + c - '0'; state = HrSep; break; } /* Falls through to .. */ case HrSep: if (c == ':' || c == '.') { state = Mn1; break; } /* Falls through to .. */ case Mn1: if (isdigit(c)) { mn = c - '0'; state = Mn2; break; } /* Falls through to .. */ case Mn2: if (isdigit(c)) { mn = mn * 10 + c - '0'; state = AmPm; break; } else if (state == Mn2) { state = (c == '\n' ? Hr1 : Ignore); continue; } /* Falls through to .. */ case AmPm: if (c == 'a' || c == 'A') { if (hr == 12) hr = 0; foundampm = True; state = LoseM; break; } else if (c == 'p' || c == 'P') { if (hr < 12) hr += 12; foundampm = True; state = LoseM; break; } /* Falls through to .. */ case LoseM: if (c == 'M' || c == 'm') { state = LookSp; break; } /* Falls through to .. */ case LookSp: if (c == ' ' || c == '\t') { state = LoseSp; if (hr >= 24 || mn >= 60) state = Ignore; destp = remline; *destp = '\0'; continue; } else { state = (c == '\n' ? Hr1 : Ignore); continue; } break; case LoseSp: if (c == ' ' || c == '\t') continue; state = Store; /* Falls through to .. */ case Store: if (c == '\n') { state = AllDone; continue; } break; } *destp++ = c; *destp = '\0'; } /* * idea from Marc Pawliger * if you don't give an am or pm, then hours from 0 to minAlarmWarp * is treated as a pm time */ if (appResources.alarmWarp == True && hr <= appResources.minAlarmWarp && appResources.minAlarmWarp < 12 && foundampm == False) hr += 12; *hrp = hr; *minp = mn; return 1; } /* * set up the timeout for the next event */ static void setCall() { time_t ti; long mnow; struct tm *tm; Alarm *sc; int togo; ti = time(0); tm = localtime(&ti); mnow = MINUTES(tm->tm_hour, tm->tm_min); for (sc = head.next; sc; sc = sc->next) { togo = sc->alarm_mm - mnow; if (togo == 0) { AlarmEvent(1, 0); /* don't miss any current alarms */ sc = &head; continue; } if (togo < 0) continue; appResources.interval_id = XtAppAddTimeOut(appContext, togo * 60 * 1000 - tm->tm_sec * 1000, (XtTimerCallbackProc) AlarmEvent, (caddr_t) NULL); dprintf("Alarm in %d mins (less %d secs)\n", togo, tm->tm_sec); break; } } static void AlarmEvent(client_data, id) caddr_t client_data; XtIntervalId *id; { int tnow; long ti; struct tm *tm; Alarm *al, *action, *actionend; String cmd; appResources.interval_id = 0; ti = time(0); tm = localtime(&ti); tnow = MINUTES(tm->tm_hour, tm->tm_min); dprintf("Alarm %d:%02d:%02d\n", tm->tm_hour, tm->tm_min, tm->tm_sec); /* * Look for alarms that have fired and remove them * from the list */ actionend = NULL; for (al = head.next; al; al = al->next) { if (al->alarm_mm <= tnow) actionend = al; else break; } if (actionend) { al = head.next; head.next = actionend->next; actionend->next = NULL; /* * now process the list */ while (al) { if (tnow == al->alarm_mm) { if (appResources.cmd != NULL) { cmd = CreateCommand(appResources.cmd, al->what); system(cmd); XtFree(cmd); } if (al->isAction == False) { DisplayAlarmWindow(al->alarm_state, al->alarm, al->what); beep(); /* notify the user */ } else { cmd = CreateCommand(al->what, NULL); system(cmd); XtFree(cmd); } } actionend = al->next; XtFree(al->alarm); XtFree(al->what); XtFree((char *) al); al = actionend; } } if (client_data == NULL) setCall(); } static String CreateCommand(cmd, arg) String cmd; String arg; { String buf; char *s, *d; char *fmt; int cmdlen; int arglen; cmdlen = strlen(cmd); arglen = arg ? strlen(arg) : 0; buf = XtMalloc(cmdlen + arglen + 200); if (arglen == 0) fmt = "%s&"; else fmt = "%s '"; (void) sprintf(buf, fmt, cmd); /* * copy the arguments worrying about any embedded quote */ #define QUOTE '\'' #define BACKSLASH '\\' if (arglen) { d = buf + strlen(buf); for(s = arg; *s; s++) { if (*s == QUOTE) { *d++ = QUOTE; *d++ = BACKSLASH; *d++ = QUOTE; } *d++ = *s; } *d++ = QUOTE; *d++ = '&'; *d++ = '\0'; } return buf; } static void beep() { register Display *dpy = XtDisplay(toplevel); int i; for (i = 0; i < appResources.nbeeps; i++) { XBell(dpy, appResources.volume); sleep(1); } } static void FreeAlarmList(al) register Alarm *al; { register Alarm *nx; for (; al; al = nx) { nx = al->next; XtFree(al->alarm); XtFree(al->what); XtFree((char *) al); } } static void AlarmsOff() { if (appResources.interval_id) { XtRemoveTimeOut(appResources.interval_id); appResources.interval_id = 0; } } typedef struct { Widget sa_top; XtIntervalId sa_id; } AlarmStatus; static void DisplayAlarmWindow(tleft, str1, str2) int tleft; String str1, str2; { Widget shell, form, title, aq, ah; Arg args[10]; Cardinal nargs; char *fmt; char buf[255]; AlarmStatus *als; /* * making the top level shell the override widget class causes it to * popup without window manager interaction or window manager * handles. this also means that it pops on the foreground of an * xlocked terminal and is not resizable by the window manager. If * any one finds that to be desirable behavior, then change the * transient class below to override. * * For now transient class is much better behaved */ nargs = 0; argLD(XtNallowShellResize, True); argLD(XtNinput, True); argLD(XtNsaveUnder, TRUE); shell = XtCreatePopupShell("alarm", transientShellWidgetClass, toplevel, args, nargs); form = XtCreateManagedWidget("alarmPanel", panedWidgetClass, shell, NULL, 0); /* * create alarm status save area */ als = (AlarmStatus *) XtMalloc(sizeof(AlarmStatus)); als->sa_top = shell; als->sa_id = (XtIntervalId) NULL; if (appResources.autoquit) { als->sa_id = XtAppAddTimeOut(appContext, appResources.autoquit * 1000, AutoDestroy, (caddr_t) als); } nargs = 0; argLD(XtNshowGrip, False); argLD(XtNdefaultDistance, 2); title = XtCreateManagedWidget("alarmForm", formWidgetClass, form, args, nargs); /* * Exit button Take "Quit" from resources */ callbacks[0].callback = DestroyAlarm; callbacks[0].closure = (caddr_t) als; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); aq = XtCreateManagedWidget("alarmQuit", commandWidgetClass, title, args, nargs); /* * Hold button Take "Hold" from resources */ callbacks[0].callback = HoldAlarm; callbacks[0].closure = (caddr_t) als; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, aq); if (!appResources.autoquit) { argLD(XtNsensitive, False); } argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); ah = XtCreateManagedWidget("alarmHold", commandWidgetClass, title, args, nargs); if (tleft == 0) fmt = appResources.alarmnow; else fmt = appResources.alarmleft; if (fmt && *fmt) { nargs = 0; argLD(XtNfromHoriz, ah); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); argLD(XtNborderWidth, 0); argLD(XtNfromVert, NULL); argLD(XtNvertDistance, 3); (void) sprintf(buf, fmt, tleft); argLD(XtNlabel, buf); (void) XtCreateManagedWidget("alarmTitle", labelWidgetClass, title, args, nargs); } /* * Now the text which is the remainder of the panel */ (void) sprintf(buf, "%s\n%s\n", str1, str2); nargs = 0; argLD(XtNshowGrip, False); argLD(XtNstring, buf); argLD(XtNdisplayCaret, False); (void) XtCreateManagedWidget("alarmText", asciiTextWidgetClass, form, args, nargs); XtPopup(shell, XtGrabNone); } /* ARGSUSED */ static void DestroyAlarm(w, als, call_data) Widget w; AlarmStatus *als; caddr_t call_data; { if (als->sa_id) XtRemoveTimeOut(als->sa_id); AutoDestroy(als, NULL); } /* ARGSUSED */ static void HoldAlarm(w, als, call_data) Widget w; AlarmStatus *als; caddr_t call_data; { if (als->sa_id) XtRemoveTimeOut(als->sa_id); XtSetSensitive(w, FALSE); } /* ARGSUSED */ static void AutoDestroy(als, id) AlarmStatus *als; XtIntervalId *id; { XtDestroyWidget(als->sa_top); XtFree((char *) als); } xcal-4.1.orig/xcal.man100644 13560 13560 61431 6037000411 13361 0ustar and1000and1000.TH xcal 1 "September 1990" "X Version 11 R5" .SH NAME xcal \- calendar with alarms and a notebook for X11 .SH SYNTAX .B xcal [ .B \-debug ][ .B \-alarmscan ][ .B \-format .I fmt ][ .B \-editformat .I fmt ][ .B \-stripformat .I fmt ][ .B \-clocktick .I tick ][ .B \-u .I username ] .SH DESCRIPTION .de EX \"Begin example .ne 5 .if n .sp 1 .if t .sp .5 .nf .ta +8u*\w'\0'u +8u*\w'\0'u +8u*\w'\0'u +8u*\w'\0'u +8u*\w'\0'u +8u*\w'\0'u .. .de EE .fi .if n .sp 1 .if t .sp .5 .. .I Xcal is an interactive calendar program. The user interface has several levels. When started, .I xcal displays today's date in a small command box that is intended to sit on the screen as a companion to the .I xclock program. The format of the command box may be altered using the resource manager, so you are not stuck with my preferred layout. You can set the time in the window too, if you wish (see the format resource). Access to further levels in .I xcal is made by clicking a mouse button in the command box. The command box is split into several areas and clicking on one of these will popup a window supporting a new function. .PP Clicking with mouse button one on the question mark in the command box pops up a help window. .I Xcal comes with many help buttons. When you are convinced they are no longer any use to you, they can all be turned off using an X resource. .LP A small button containing a `mouse' bitmap can be pressed with mouse button one to inspect appointments for today. This generates a panel showing information from the calendar file for today and information from a set of seven daily files holding regular commitments. The panel also contains a text scratchpad, `the memo panel'. This allows the editing of a memo file. .LP The calendar functions are accessed by clicking a mouse buttons inside date portion of the command window. .IP 1) Mouse button one pops up a calendar `strip' for the current month. The strip has some header lines and then one line per day of the month. The `line per day' display contains the day in the month and the day of the week. Today may be highlighted specially \- the notion of Today alters at midnight. The strip has a help button which displays a description of the panel. Command buttons in the header line allows the user to bring up a strip for the previous or the next month. .IP 2) Pressing mouse button two in the date area will bring up a dialogue box which allows the user to select any month of any year (yes, September 1752 is supported). The month may be input as month name or abbreviation, even though the prompt indicates a more restrictive format. .IP 3) Pressing mouse button 3 in the date label causes the whole program to exit, a dialog box is used to ask the user for confirmation. .LP Like .IR xcalendar , daily events are stored in set of files, one for each day. If the file exists when the strip is started, its data is displayed as the label in the command button on the right-hand side of the month strip. The file is created and edited by entering a simple text editor (the standard text widget) which is started by pressing the right hand side of the appropriate day line in the strip. You can also add data to the file by selecting a string on the screen and clicking with the middle button on the right-hand side of the month strip. The string is appended to the file for the day. This short-hand allows one entry to be loaded into several day files. .LP The width of the month strip is computed from the width of the header. Users who wish to display a wider strip to show more of the stored information should widen the strip using the .I minStripWidth resource (see below). .LP The colours and fonts used in the strip is controllable by resources. The widget that comprises each line in the strip is tagged with the short form name of the day, so it's easy to vary the strip display showing weekends differently from the weekdays. .LP Data files are stored in a directory usually called .B Calendar under the user's home directory. Each file is stored in a subdirectory containing all the data for a particular year. This is incompatible with .IR xcalendar , the user may specify that the compatibility should be maintained. .LP Alarms are supported by .IR xcal . When a line in the data file starts with a digit, it is assumed to be a time specification and a candidate for an alarm. The line contains a string giving the alarm time and a text string displayed in a dialogue alarm box that pops up when the alarm fires. You can also arrange for countdown alarms to fire, so that you can be told that something is about to happen. These dialogue boxes will automatically go away after two minutes, unless the `Stick' button is pressed glueing the box onto the screen. The box can be made to go away at any time by hitting the `Unpin' button. .LP When specifying alarms, .I Xcal tries to be liberal about the times that it understands. Time specifications are: h, hh, hhmm, hmm, hh:mm, h:mm, hh.mm, h.mm; all of these may be optionally followed by an am/pm indicator \- one of: A, a, AM, am, Am, aM, P, p, PM, pm, Pm, pM. Times must always be followed by at least one space or tab. Some legal examples are: .br .nf 12:00 Lunch - Meet Joe at Burger King 14.30 Meeting in the cafeteria 2:30p Ring Mark 7pm Pizza .fi .LP You can make a time like 2:30 mean 14:30 by setting the resource .I AlarmWarp to be true. If this is the case, an alarm hour will be promoted to a PM time if it is found to be between the range of zero and the value of the resource .IR minAlarmWarp . .LP .I Xcal also supports timed command execution from the data file. To trigger a command, the data part of the line starts with an exclamation mark, eg: .br 4.30pm !xmessage -message 'ring home' .LP The exclamation mark can also be replaced by the string `%cron'. It is also possible to make .I xcal execute a command whenever an alarm is triggered, see the .I Cmd resource below. .LP The memo function of .I Xcal is accessed by pressing the non-date portion of the command window. This shows a bitmap diagram of three mouse buttons. Clicking the left mouse button in this area brings up a complex panel, clicking on the button again will pop it back down again. The top half of the panel displays the information held in the diary for today; pressing the Edit button here will start an edit box for today. The next section of the panel displays the information held in the weekly files. Again you cannot directly change the text in this area, you must press on the Edit button to bring up a strip enabling you to change things. The bottom portion of the panel is an edit window displaying the contents of a file usually called `memo' in the Calendar directory. The idea of this panel is to allow you to access your current information in one button click. .LP It is obviously possible to change .IR Xcal 's data files without using the inbuilt text widget editor. In general, .I Xcal will not notice this. Editing random day files with a standard text editor will not change the contents of any displayed strips until the strips are popped down and up again. .I Xcal knows what days have been altered when the text widget is used to edit the day files, and will reflect any change immediately into the displayed strips. .LP You can make .I Xcal take notice of today's date file and the current memo file. The `Update' resource sets a polling time in seconds. When the clock fires and today's file has been altered, the alarm list is rebuilt from the current date file and the memo panel is updated. The bottom part of the memo panel is also updated if the `memo' file has been altered on the clock tick. .SH OPTIONS .LP Version 4 of .I Xcal permits one user to view another's calendar by giving the .I \-u option followed by the user's login name. The user's calendar storage area is assumed to be called `Calendar' in their home directory. The facilities are somewhat rudimentary. First, the main date box will have the user's login name appended to the date format string. When a month strip is generated, you will be given read-only access to their calendar files, assuming that the file permissions allow you to read them. This is intended to be one step better than using .I cat on their calendar files. .LP The .I \-debug switch causes contents of the initial date window to be incremented very frequently, this allows some testing of the program. .LP The .I \-alarmscan switch prints debugging information about the alarm system on standard output. .LP The argument following the .I \-format is a date format used to display dates in the top level window (see below, the .I Format resource). Changing this to include a time format will make .I xcal display a clock in your top level window. .LP The argument following the .I \-stripfmt argument is a date format used to display month names and years in the monthly calendar strip. (see the resource .IR StripFmt ). .LP Similarly, the .I \-editfmt argument is the format for dates used in an edit window (see the .I Editfmt resource). .LP The .I \-clocktick argument is used to set the clock update time of the main date window, should a time be displayed as well as the date. See the .I Clocktick resource. .SH RESOURCES As with all standard X applications, .I xcal may be customised through entries in the resource manager. It is a serious mistake to install .I Xcal without putting the resource initialisation file .I Xcal in .IR /usr/lib/X11/app-defaults . Resource class names are listed below; resource instance names are identical, except the first letter is in lower case. The following resource manager entries are defined: .LP .TP "\w'ReverseVideoMarkNNN'u" .B Debug If True enables accelerated time. Alarms will not function correctly. Default: False. .TP .B OtherUser the name of the user whose calendar files will be inspected. This is usually set by the .B \-u option. .TP .B AlarmScan If True enables printing of alarm related debugging information to the standard output. Default: False. .TP .B ReverseVideo If true display the output in reverse video. Default: False. .TP .B Format This is a format string used to create the contents of the top command button and the memo box. The format is aimed at the system routine: .IR strftime . I have chosen to use the system routine because it makes it easier for non-english language sites to generate their own formats. However, this means that the names used for months and days may not be compatible with the ones set in the resources below. Any characters in the format string are passed to the output unchanged unless they specify a format. Format letters are preceded by a `%' character and can be found in the documentation for .I strftime on your system. The SunOS 4.1.3 routine supports: .EX %% same as % %a day of week using abbreviated name %A day of week using full weekday names %b (%h) month, using locale's abbreviated names %B month, using locale's full names %c date and time as %x %X %C date and time, in local long-format date and time representation %d day of month (01-31) %D date as %m/%d/%y %e day of month (1-31; single digits are preceded by a blank) %H hour (00-23) %I hour (00-12) %j day number of year (001-366) %k hour (0-23; single digits are preceded by a blank) %l hour (1-12; single digits are preceded by a blank) %m month number (01-12) %M minute (00-59) %n same as \en %p local equivalent of AM or PM %r time as %I:%M:%S %p %R time as %H:%M %S seconds (00-59) %t same as \et %U week number of year (01-52), Sunday is the first day of the week %W week number of year (01-52), Monday is the first day of the week %x date, using locale's date format %X time, using locale's time format %y year within century (00-99) %Y year, including century (fore example, 1988) %Z time zone abbreviation .EE The default is "%A %d %B %Y", printing the day, the date, the month and the full year. I prefer to use "%A %e %B %Y", but this does not seem to be portable to different systems. The format string is scanned to determine the update frequency that is needed to maintain a correct date image. The default needs updating every 24 hours, if you insert an AM/PM format then the strip will be updated every 12 hours. Adding an hour specification will cause an update every hour and specifying minutes or seconds will cause appropriate behaviour. .TP .B ClockTick If you specify a second hand in the main date string and only want it updated every 30 seconds (say) then setting the ClockTick resource to 30 will force an update for that period. Default: 0 (derived from the .I Format string). .TP .B StripFmt is used to format the date line at the top of each strip. This uses an internal version of the .I strftime routine that only supports format characters relating to months, years and days. The supported format characters are: %A, %a, %B, %b, %h, %D, %d, %e, %m, %n, %t, %x, %y and %%. Long/short day and month names are taken from the resources. Default: "%B %y". .TP .B EditFmt provides the format string for any edit window. This uses the same code as .BR StripFmt . Default: "%A %d %B %Y". Again, I prefer to use "%A %e %B %Y". .TP .B MarkToday If True then highlight today. Default True. .TP .B TodayBackground the background colour when marking, default Black. .TP .B TodayForeground the foreground colour when marking today, default White. .TP .B FontToday Today may be marked by using a special font, if this is desired the font is given by this resource. Default is to use the default font. .TP .B Directory The name of the directory under the home directory where the day files are stored. Default: Calendar. .TP .B XcalendarCompat If true then subdirectories are not created in the Calendar directory. This flag is not relevant when files are being read, so users can use both programs with existing data files. Default: False. .TP .B GiveHelp If True than access to the help information is given. If False, help buttons disappear returning screen real-estate to the user. You should resist setting this to False in the default resources file. Default: True. .TP .B HelpFromFile The .I Xcal program will usually have help strings compiled into it. These are in English and it may be desirable to use help data in other languages. If this resource is true, it forces .I Xcal to look in a data file for the help strings. Default: False. .TP .B HelpFile gives the name of the file used as a database for the help system, accessed when .B HelpFromFile is True. Default: /usr/lib/X11/XCal.help. .TP .B InitialCalendar If True then the calendar for this month is automatically displayed on startup. If False, the calendar is not automatically displayed. Default: False. .TP .B InitialEdit If True then an edit window for today is automatically displayed on startup if a file exists for today's date. If False, the edit window is not automatically displayed. Default: False. .TP .B InitialMemo If True then the memo window is automatically displayed on startup. Default: False. .TP .B UseWmTitle If True display the month and the year at the head of each strip. This information is duplicated if your window manager uses titles so it is nice to be able to turn it off. Default: True. .TP .B TextBufferSize the maximum number of bytes which we are prepared to deal with in an edit window. Default: 2048 bytes. .TP .B Alarms whether or not to enable the alarm system. Default: True. .TP .B ExecAlarms if the alarm system is active, whether or not to invoke timed-execution commands. Default: True. .TP .B Update When scanning for alarms in the current day file .I Xcal inspects it at program startup time and also when it is edited using the normal built-in editing mechanism. However, if some external program changes t file .I xcal will not see the new contents and new alarms will not be set. Setting this resource to non-zero will force .I xcal to scan the file every `update' seconds looking for alterations in size and modification date. When it detects that the file is altered, then it will rebuild the internal alarm list. Default: zero. .TP .B Nbeeps When an alarm window is popped up, it is accompanied by `Nbeeps' beeps. Default: 3. .TP .B Volume Control the loudness of the beep. Default: 50. .TP .B Cmd This resource contains a command that is executed by calling the shell when every alarm is triggered. The command is passed the contents of the data line as one argument. .TP .B Countdown contains a comma separated string of numbers; for example: 10,5,0. The string allows the user to customise warning alarms: so in the example, alarm boxes will be displayed 10 minutes before the stated time, 5 minutes before the stated time and exactly on the stated time. Commands lines in the data prefaced by a `!' will always be triggered exactly at the stated time. Default: 10,0. .TP .B Autoquit Each dialogue box containing an alarm message contains an `Unpin' button allowing the user to remove the message from the screen by using mouse button one. Additionally, the message box can remove itself from the screen after a specified period, this resource gives that timeout in seconds. If the resource is set to zero, then the user is always forced to take explicit action to remove the box. Default: 120, alarm boxes disappear after 2 mins. .TP .B Alarmleft contains a .I printf string that is displayed in the label at the top of an alarm box when countdown is in operation and there is some time before the stated time. The time before the stated time is supplied as the second argument to printf. Default: ``%d minutes before...'' .TP .B Alarmnow contains the .I printf string that is displayed in the label at the top of an alarm box when the stated time is reached. Default: ``Time is now...''. .TP .B UseMemo enables the use of the memo feature. This defaults to ``True'', but is present to allow users to make .I XCal have as it used to. .TP .B MemoLeft affects the placing of the memo button in the top level date window. The default is `True' meaning that the button box is placed on the left of the date portion. Setting this to `False' will place the button box to the right of the date portions. .TP .B MemoFile gives the name of the memo file within the Calendar directory. The default is `memo'. .TP .B MaxDisplayLines controls the maximum number of text lines that can placed in the top half of the memo panel. The top hald will normally size to the number of lines in the diary file for the day, unless the number of lines exceed the value in this resource. This ensures that today's events do not dominate the memo panel. Default: 5 lines. .TP .B MaxStripHeight controls the maximum height of a strip. A scroll bar will be added into the date part of the scrip of the contents are larger than this number. If unset, this defaults to the height of the screen. Default: unset. .TP .B MinStripWidth The width of month strips are set by the top line, which usually displays the month and year. The whole strip can be widened from this default value by setting this resource to be non-zero. Default: zero (i.e. off). .TP .B January .B February and so on. The names of the long form of the month name. .TP .B Jan .B Feb and so on. A short form of the month name - done this way because I doubt that writing with %3s works in all languages. Changing this resource means that the data file will no longer be compatible with .I xcalendar . .TP .B Sunday .B Monday and so on. The .I long names of the days: Sunday, Monday etc. These are used in titles: the top level widget, the title of an edit window and the memo frame. .TP .B Sun .B Mon and so on. The short names of the days \- used in date strips. .TP .B Private Contains the string `Private calendar entry' and is used when the \-u option is in force. It is displayed when a calendar file entry is unreadable by the caller. .TP .B Alarmleft Contains the string `%d minutes before'. .TP .B Alarmnow Contains the string `Time is now...'. .TP .B Already Contains the string `Already editing %d %B %Y' I prefer to use `Already editing %e %B %Y'. .TP .B AlreadyWeekly Contains the string `Already editing %A'. .SH "PANEL MAP" .PP .I Xcal makes extensive use of the resource manager. The user needs to know the names of the various panels and widgets which comprise the application. .LP .EX XCal Toplevel application form Form containing two buttons today Memo Command button date Strip Command button mainHelp Optional main help button .EE .LP Then we have various popups. The Calendar Strip is: .EX "Mon Year" the popup shell Month panel containing the strip header label containing month and year action form containing < quit > buttons back command containing < - last month quit command containing exit button next command containing > - next month help command generating help viewport viewport permitting scrolling of the data data widget "DDD" form containing day button (lots of these) these are named for the short days of the week label label containing dd DDD, day of the month and day of the week info command containing the file data .EE .LP Note that each day button is named for the day of the week, so that weekends can be highlighted specially using the standard resources. .LP The weekly popup strip is: .EX weekly the popup shell weekly panel containing the strip header label containing the title action form containing quit and help quit command containing exit button help command generating help viewport viewport permitting scrolling of the data data widget shortday form containing days label label containing day of the week info command containing the file data .EE .LP The Edit Window is: .EX edit the popup shell panel the panel inside the shell title the form containing the first line quit the exit button save the save button help the help button date the date string text the text widget for editing .EE .LP The Help Window is: .EX help the popup shell helpPanel the panel inside the shell helpForm the form containing the title line quit the exit button helpText the text widget showing the information .EE .LP The Alarm Window is: .EX alarm the popup shell alarmPanel the panel inside the shell alarmForm form for top line alarmQuit the exit button alarmHold the hold button alarmTitle the title on the alarm window alarmText the text widget for displaying .EE .LP The Memo Window is: .EX memo the popup shell memoPanel the panel inside the shell title Top line form widget quit the exit button edit edit button - edit today's info help the help button date display today's date display text from today's date file weeklyMemo form for the Memo title line weeklyEdit Edit button weeklyTitle Title area display text from today's weekly file memoMiddle Middle line form widget save Save button memoTitle text title of middle line memoText Text widget showing memo file .EE .LP The Middle button date selection popup is: .EX question the popup shell newdate the dialog widget ok the OK button cancel the cancel button .EE .LP The Right button exit selection popup is: .EX question the popup shell exit the dialog widget yes the yes button no the no button .EE .LP An error is shown when a multiple attempts are made to edit the same day file. .EX question the popup shell noedit the dialog widget ok the OK button .EE .LP A dialog box is popped up when an attempt is made to exit from an editing box without saving the file. .EX check the dialog widget yes the yes button no the no button .EE .SH FILES .PP $HOME/Calendar/\(** .LP .TP "\w'xc
'u" xc
A data file is day, Month in three letter format and the year. .TP xy A year directory. .TP xw A data file for the weekly code, one per day. .TP memo The memo file. .LP The standard resource database can be found in /usr/lib/X11/app-defaults/Xcal. Assuming that this is where the system admin installed it. .PP .SH SEE ALSO xrdb(1), xcalev(1), xcalpr(1), xcal_cal(1) .PP .SH BUGS There should be some way of removing several edit windows from the screen at once. .LP Setting an alarm 1 minute in the future may not work. .LP Countdown does not work in the early hours of the morning, if you have a ten minute countdown and an alarm set at 0005 \- then you will not get warning at 2325. .LP Alarms set at 0000 probably won't work. .SH AUTHOR .LP Copyright 1989,1990,1993 by Peter Collinson, Hillside Systems All rights reserved. .PP This product includes software developed by the University of California, Berkeley and its contributors. .PP At one time, much of the .B xcalendar program was plundered to create .B xcal ; author is: Roman J. Budzianowski, MIT Project Athena .PP Thanks to Ed Gould, Mt Xinu for the support for the .IR calendar (1) program. Thanks to Mark Majhor, Sequent for the basis of the alarm code. Thanks to Rod Whitby, Austek Microsystems Pty. Ltd., Australia for the ideas of the Stick/Unpin code for alarms and for prompting me to add the memo code. Thanks to Miles O'Neal from Pencom for revising the help code to be a little more `X', although this was later revised to use files. .LP There are a number of other people who have sent in revisions, some I have used, some I have not. Thanks anyway. xcal-4.1.orig/xcal_edit.c100644 13560 13560 66151 6052205617 14055 0ustar and1000and1000#ifndef lint static char *sccsid = "@(#)xcal_edit.c 3.40 (Hillside Systems) 9/15/95"; static char *copyright = "@(#)Copyright 1989,1990,1993 Peter Collinson, Hillside Systems"; #endif /* lint */ /*** * module name: xcal_edit.c * function: Deal with editable days This is derived from xcalendar's view of how to store things * history: Written November 1989 Peter Collinson Hillside Systems * (C) Copyright: 1989 Hillside Systems/Peter Collinson For full permissions and copyright notice - see xcal.c ***/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xcal.h" #include #if defined(NeXT) || defined(mips) #include #include #include #else #include #endif #define argLD(N,V) { XtSetArg(args[nargs], N, V); nargs++; } typedef struct editline { struct editline *ed_next; /* Pointer to next */ struct meWrap *ed_meWrap; /* Pointer to head of the chain */ Cardinal ed_day; /* What day we are */ Widget ed_popup; /* widget of editor popup */ Widget ed_quit; /* widget of quit button */ Widget ed_save; /* widget of save button */ Widget ed_text; /* the text area */ Cardinal ed_size; /* size of the buffer */ char *ed_data; /* pointer to malloc'ed data buffer */ } EditLine; typedef struct meWrap { struct meWrap *mw_next; String mw_dir; /* name of the directory */ Boolean mw_useTopDir; /* have found some data in the top dir */ MonthEntry mw_me; /* what the external world sees */ Instance *mw_list; /* list of toplevel widget for the */ /* current set of displayed strips */ EditLine *mw_ed; /* data being edited */ } MeWrap; #define mw_year mw_me.me_year #define mw_month mw_me.me_month #define mw_have mw_me.me_have #define StripType(mw) (mw->mw_me.me_type) static MeWrap *WrapBase; /* base of the list */ static MeWrap *WrapEnd; /* the last one in the list */ char *MapStem; /* pointer to the string which is */ /* where the map data is stored */ Boolean FoundCalendarDir; /* whether the Calendar directory */ /* exists */ static XtCallbackRec callbacks[] = { {NULL, NULL}, {NULL, NULL} }; #define ClearCallbacks() memset((caddr_t)callbacks, '\0', sizeof (callbacks)) /* * Routine specs */ static void MakeMapStem(); static MeWrap *NewMeWrap(); static MeWrap *MeWrapSearch(); static void DeRegisterMonth(); static Boolean WriteCalendarFile(); static Boolean WriteWeeklyFile(); static void DeleteCalendarFile(); static int EditCheck(); static void SetAllButtons(); static void TextChanged(); static void UpdateDayDetails(); static void FinishEditing(); static void CleanEditPanel(); static void CheckExit(); static void CheckDia(); static void YesCheck(); static void NoCheck(); static int DayMatch(); static void SaveEdits(); void StartDayEditor(); void Fatal(); /* * Fire up the month entry environment called once */ void InitMonthEntries() { if (MapStem == NULL) MakeMapStem(); if (access(MapStem, F_OK) < 0) FoundCalendarDir = False; else { FoundCalendarDir = True; /* * If we can see the directory, then lurch into it */ if (chdir(MapStem) < 0) Fatal("Cannot change into %s", MapStem); } } /* * Find the base of the Calendar structure */ static void MakeMapStem() { char buf[BUFSIZ]; struct passwd *pw; if (appResources.otheruser) { /* someone else */ pw = getpwnam(appResources.otheruser); if (pw == NULL) Fatal("Cannot get password details for %s\n", appResources.otheruser); } else { pw = getpwuid(getuid()); if (pw == NULL) Fatal("Cannot get password details for YOU!\n"); } (void) sprintf(buf, "%s/%s", pw->pw_dir, appResources.directory); MapStem = XtNewString(buf); } /* * Get the entry for a specific month * * xcalendar files are all * xc * or * xc
* * where d or dd is the day (%02d would have been better) * is a capitalised first three letters of the * English month name. If you need compatibility * don't redefine the short names in the resources * for this program. * is the full numeric year. * * We will follow this BUT we will also make this program * create subdirectories for new years * xy * to speed up file access */ MonthEntry * GetMonthEntry(yr, mo) Cardinal yr; Cardinal mo; { MeWrap *mw; char *dir; DIR *dirp; struct dirent *dp; int da; Boolean inSubDir; char yearbuf[5]; char monthbuf[4]; if ((mw = MeWrapSearch(yr, mo)) == NULL) mw = NewMeWrap(yr, mo); mw->mw_me.me_type = ME_MONTHLY; if (!FoundCalendarDir) return (&mw->mw_me); /* * need this for string match */ (void) sprintf(yearbuf, "%d", yr); (void) sprintf(monthbuf, "%s", appResources.smon[mo]); /* we are in the directory */ /* so let's lookee here for the any files of interest */ dir = "."; inSubDir = False; if (mw->mw_dir) { dir = mw->mw_dir; inSubDir = True; } if ((dirp = opendir(dir)) == NULL) Fatal("Cannot open directory: %s", MapStem); for (da = 1; da < 32; da++) if (mw->mw_have[da]) { XtFree(mw->mw_have[da]); mw->mw_have[da] = NULL; } while ((dp = readdir(dirp)) != NULL) { switch (strlen(dp->d_name)) { case 6: /* xy ?? */ if (dp->d_name[0] == 'x' && dp->d_name[1] == 'y' && dp->d_name[2] == yearbuf[0] && dp->d_name[3] == yearbuf[1] && dp->d_name[4] == yearbuf[2] && dp->d_name[5] == yearbuf[3] && appResources.calCompat == False) { /* * well - we're wasting * our time at the top * level - rejig things * to work in the * subdirectory */ inSubDir = True; mw->mw_useTopDir = False; mw->mw_dir = XtNewString(dp->d_name); closedir(dirp); if ((dirp = opendir(mw->mw_dir)) == NULL) Fatal("Cannot open directory %s/%s", MapStem, mw->mw_dir); } break; case 10: /* xc ?? */ if (dp->d_name[0] == 'x' && dp->d_name[1] == 'c' && isdigit(dp->d_name[2]) && dp->d_name[3] == monthbuf[0] && dp->d_name[4] == monthbuf[1] && dp->d_name[5] == monthbuf[2] && dp->d_name[6] == yearbuf[0] && dp->d_name[7] == yearbuf[1] && dp->d_name[8] == yearbuf[2] && dp->d_name[9] == yearbuf[3]) { da = dp->d_name[2] - '0'; mw->mw_have[da] = ReadCalendarFile(mw->mw_dir, dp->d_name); if (inSubDir == False) mw->mw_useTopDir = True; } break; case 11: /* xc
?? */ if (dp->d_name[0] == 'x' && dp->d_name[1] == 'c' && isdigit(dp->d_name[2]) && isdigit(dp->d_name[3]) && dp->d_name[4] == monthbuf[0] && dp->d_name[5] == monthbuf[1] && dp->d_name[6] == monthbuf[2] && dp->d_name[7] == yearbuf[0] && dp->d_name[8] == yearbuf[1] && dp->d_name[9] == yearbuf[2] && dp->d_name[10] == yearbuf[3]) { da = (dp->d_name[2] - '0') * 10 + (dp->d_name[3] - '0'); mw->mw_have[da] = ReadCalendarFile(mw->mw_dir, dp->d_name); if (inSubDir == False) mw->mw_useTopDir = True; } break; } } closedir(dirp); return (&mw->mw_me); } /* * Get the entry for the weekly strip * Files are xw in the Calendar directory */ MonthEntry * GetWeeklyEntry() { MeWrap *mw; int da; DIR *dirp; struct dirent *dp; if ((mw = MeWrapSearch(0, 0)) == NULL) mw = NewMeWrap(0, 0); mw->mw_me.me_type = ME_WEEKLY; if (!FoundCalendarDir) return (&mw->mw_me); if ((dirp = opendir(".")) == NULL) Fatal("Cannot open directory: %s", MapStem); for (da = 0; da < 7; da++) if (mw->mw_have[da]) { XtFree(mw->mw_have[da]); mw->mw_have[da] = NULL; } while ((dp = readdir(dirp)) != NULL) { if (dp->d_name[0] == 'x' && dp->d_name[1] == 'w' && ((da = DayMatch(&dp->d_name[2])) != -1)) { mw->mw_have[da] = ReadCalendarFile(NULL, dp->d_name); } } closedir(dirp); return (&mw->mw_me); } /* * Look for a short name match with a day */ static int DayMatch(day) String day; { register i; for (i = 0; i < 7; i++) if (strcmp(day, appResources.sday[i]) == 0) return (i); return (-1); } /* * create a new MapWrap area */ static MeWrap * NewMeWrap(yr, mo) Cardinal yr; Cardinal mo; { register MeWrap *mw; static MeWrap zerow; mw = (MeWrap *) XtMalloc(sizeof(MeWrap)); *mw = zerow; if (WrapEnd) WrapEnd->mw_next = mw; WrapEnd = mw; if (WrapBase == NULL) WrapBase = mw; mw->mw_year = yr; mw->mw_month = mo; mw->mw_useTopDir = False; return (mw); } /* * Search the MapWrap list for a year */ static MeWrap * MeWrapSearch(yr, mo) Cardinal yr; Cardinal mo; { register MeWrap *mw; if (WrapBase) for (mw = WrapBase; mw; mw = mw->mw_next) if (yr == mw->mw_year && mo == mw->mw_month) return (mw); return (NULL); } /* * Register an instance of a month Return a pointer to an instance structure * so it can be filled in by the caller */ Instance * RegisterMonth(yr, mo, w) Cardinal yr; Cardinal mo; Widget w; { register MeWrap *mw; register Instance *ins; if ((mw = MeWrapSearch(yr, mo)) == NULL) mw = NewMeWrap(yr, mo); ins = (Instance *) XtMalloc(sizeof(Instance)); ins->i_next = mw->mw_list; mw->mw_list = ins; ins->i_w = w; callbacks[0].callback = DeRegisterMonth; #ifdef LONG_IS_32_BITS callbacks[0].closure = (caddr_t) DatePack(0, 0, mo, yr); #else callbacks[0].closure = (caddr_t) DatePack(mo, yr); #endif XtAddCallbacks(w, XtNdestroyCallback, callbacks); return (ins); } /* * Return the head of an instance list - given a date */ Instance * FindInstanceList(da) Date *da; { register MeWrap *mw; if ((mw = MeWrapSearch(da->year, da->month)) == NULL) return (NULL); return (mw->mw_list); } /* * Delete an instance */ /* ARGSUSED */ static void DeRegisterMonth(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { Cardinal yr, mo; register Instance *ins, *inlast; register MeWrap *mw; yr = YrUnpack((Cardinal) closure); mo = MoUnpack((Cardinal) closure); if ((mw = MeWrapSearch(yr, mo)) == NULL) return; for (ins = mw->mw_list, inlast = NULL; ins; inlast = ins, ins = ins->i_next) { if (ins->i_w == w) { if (inlast) inlast->i_next = ins->i_next; else mw->mw_list = ins->i_next; XtFree((char *) ins); return; } inlast = ins; } } /* * Read a calendar file into memory into a string * if the file is zero length then unlink and return NULL */ String ReadCalendarFile(dir, file) String dir; String file; { char fname[256]; int fd; String destb; struct stat fsb; if (dir) { (void) sprintf(fname, "%s/%s", dir, file); file = fname; } if ((fd = open(file, 0)) < 0) { if (MyCalendar) Fatal("Cannot open: %s for reading", file); else return(XtNewString(appResources.private)); } if (fstat(fd, &fsb) < 0) Fatal("Cannot fstat %s", file); if (fsb.st_size == 0) { if (MyCalendar) (void) unlink(file); close(fd); return (NULL); } destb = (String) XtMalloc(fsb.st_size + 1); if (read(fd, (String) destb, fsb.st_size) != fsb.st_size) Fatal("Read error on %s", file); close(fd); destb[fsb.st_size] = '\0'; return (destb); } /* * Check to see if we should create the top directory */ Boolean NeedTop() { if (!FoundCalendarDir) { if (mkdir(MapStem, 0777) == -1) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Could not create: %s directory.\n", MapStem); perror("xcal: mkdir"); fflush(stderr); return (False); } if (chdir(MapStem) < 0) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Could not chdir into %s.\n", MapStem); perror("xcal: chdir"); fflush(stderr); return (False); } FoundCalendarDir = True; } return (True); } /* * Write a calendar file creating any directories which are needed * Return True if OK */ static Boolean WriteCalendarFile(mw, day, contents) register MeWrap *mw; Cardinal day; char *contents; { int fd; Cardinal len; char fname[256]; char cname[16]; len = strlen(contents); if (len == 0) { DeleteCalendarFile(mw, day); return (True); } if (!NeedTop()) return (False); /* * So that looks OK * We can now create the output file. However, we * would like to put any new data into subdirectories named for the * year unless we are compatible with xcalendar */ fname[0] = '\0'; if (appResources.calCompat == False && mw->mw_useTopDir == False) { /* * we have no data in the top directory * so let's create the directory name */ (void) sprintf(fname, "xy%d", mw->mw_year); if (access(fname, F_OK) < 0) { if (mkdir(fname, 0777) < 0) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Could not create: %s/%s directory.\n", MapStem, fname); perror("xcal: mkdir "); fflush(stderr); return (False); } } strcat(fname, "/"); } /* * Whew - it looks as if we can now write the file */ (void) sprintf(cname, "xc%d%s%d", day, appResources.smon[mw->mw_month], mw->mw_year); strcat(fname, cname); if ((fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname); perror("xcal: open"); fflush(stderr); return (False); } if (write(fd, contents, len) != len) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Write error %s/%s file.\n", MapStem, fname); perror("xcal: write"); fflush(stderr); close(fd); return (False); } close(fd); /* * tickle the alarm system if we have altered `today' */ if (today.day == day && today.month == mw->mw_month && today.year == mw->mw_year) AlarmFilePoll(NULL); return (True); } static void DeleteCalendarFile(mw, day) register MeWrap *mw; Cardinal day; { char fname[256]; char cname[16]; fname[0] = '\0'; if (mw->mw_useTopDir == False) { /* * we have no data in the top directory * so let's create the directory name */ (void) sprintf(fname, "xy%d", mw->mw_year); if (access(fname, F_OK) < 0) return; strcat(fname, "/"); } (void) sprintf(cname, "xc%d%s%d", day, appResources.smon[mw->mw_month], mw->mw_year); strcat(fname, cname); unlink(fname); /* * tickle the alarm system if we have altered `today' */ if (today.day == day && today.month == mw->mw_month && today.year == mw->mw_year) AlarmFilePoll(NULL); } /* * Write daily file out */ static Boolean WriteWeeklyFile(mw, day, contents) register MeWrap *mw; Cardinal day; char *contents; { int fd; Cardinal len; char *fname; fname = MakeWeeklyName(day); len = strlen(contents); if (len == 0) (void) unlink(fname); else { if ((fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname); perror("xcal: open"); fflush(stderr); return (False); } if (write(fd, contents, len) != len) { XBell(XtDisplay(toplevel), 0); fprintf(stderr, "xcal: Write error %s/%s file.\n", MapStem, fname); perror("xcal: write"); fflush(stderr); close(fd); return (False); } close(fd); } /* * tickle the alarm system if we have altered `today' */ if (today.wday == day) AlarmFilePoll(NULL); return (True); } /* * Create a standard weekly file name */ String MakeWeeklyName(day) Cardinal day; { static char fname[16]; (void) sprintf(fname, "xw%s", appResources.sday[day]); return (fname); } /* * Get the contents of the current Weekly file if any */ String GetWeeklyFile(day) Cardinal day; { char *fname; if (FoundCalendarDir == False) return (NULL); fname = MakeWeeklyName(day); if (access(fname, F_OK) < 0) return (NULL); return (ReadCalendarFile(NULL, fname)); } /* * Start up an editor window from the callback * Pass the calling widget so we can change its contents after the edit */ /* ARGSUSED */ void StartEditing(w, da, but) Widget w; Date *da; Widget but; { register MeWrap *mw; register EditLine *ed; static EditLine zeroe; if ((mw = MeWrapSearch(da->year, da->month)) == NULL) mw = NewMeWrap(da->year, da->month); /* shouldn`t happen */ /* * see if we are editing this day */ if (EditCheck(w, mw, da)) return; /* * Things are looking OK * Create a new editing record */ ed = (EditLine *) XtMalloc(sizeof(EditLine)); *ed = zeroe; ed->ed_day = da->day; ed->ed_meWrap = mw; /* help for unlinking */ /* * Do we have a string now */ if (mw->mw_have[da->day]) { ed->ed_size = appResources.textbufsz + strlen(mw->mw_have[da->day]) + 1; ed->ed_data = XtMalloc(ed->ed_size); strcpy(ed->ed_data, mw->mw_have[da->day]); } else { ed->ed_data = XtMalloc(ed->ed_size = appResources.textbufsz); *ed->ed_data = '\0'; } /* * put the record into the list */ ed->ed_next = mw->mw_ed; mw->mw_ed = ed; /* * We fiddle with the source widget too * Desensitise visible source widgets * If the user starts up another strip for this month then * the NoEditIsPossible() code above copes */ SetAllButtons(mw->mw_list, da->day, False); /* * Now we should start up the edit window for this month */ StartDayEditor(mw, da, but); } /* * See if we are editing a day already * complain and return 1 if we are * return 0 if not */ static int EditCheck(w, mw, da) Widget w; MeWrap *mw; Date *da; { register EditLine *ed; /* * see if we are already editing this day */ for (ed = mw->mw_ed; ed; ed = ed->ed_next) { if (ed->ed_day == da->day) { /* we are! */ /* Complain via a popup */ switch (StripType(mw)) { case ME_MONTHLY: NoEditIsPossible(w, da); break; case ME_WEEKLY: NoDayEditIsPossible(w, da); break; } return 1; } } return 0; } /* * Set all the relevant buttons in a widget list to off or on */ static void SetAllButtons(ins, day, val) Instance *ins; Cardinal day; Boolean val; { for (; ins; ins = ins->i_next) XtSetSensitive(ins->i_day_info[day], val); } /* * Start up a day editor Modelled on xcalendar.c */ void StartDayEditor(mw, da, but) register MeWrap *mw; register Date *da; Widget but; { register EditLine *ed = mw->mw_ed; /* top of the list is ours */ Widget lw, et; Widget frame; Arg args[10]; Cardinal nargs; char buf[BUFSIZ]; void EditHelp(); ed->ed_popup = XtCreatePopupShell("edit", topLevelShellWidgetClass, toplevel, NULL, 0); if (but && XtIsSubclass(but, commandWidgetClass)) ButtonOff(but, ed->ed_popup); /* * Create the title line - which is a form containing buttons and a * date label */ et = XtCreateManagedWidget("panel", panedWidgetClass, ed->ed_popup, NULL, 0); nargs = 0; argLD(XtNshowGrip, False); argLD(XtNskipAdjust, True); argLD(XtNdefaultDistance, 1); frame = XtCreateManagedWidget("title", formWidgetClass, et, args, nargs); /* * Take label "quit" from resources */ callbacks[0].callback = FinishEditing; callbacks[0].closure = (caddr_t) ed; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, NULL); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); lw = ed->ed_quit = XtCreateManagedWidget("quit", commandWidgetClass, frame, args, nargs); /* * Take label "save" from resources */ if (MyCalendar) { callbacks[0].callback = SaveEdits; callbacks[0].closure = (caddr_t) ed; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, ed->ed_quit); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); argLD(XtNsensitive, False); lw = ed->ed_save = XtCreateManagedWidget("save", commandWidgetClass, frame, args, nargs); } if (appResources.giveHelp) { /* * Take label "help" from resources */ callbacks[0].callback = EditHelp; callbacks[0].closure = (caddr_t) 0; nargs = 0; argLD(XtNcallback, callbacks); argLD(XtNfromHoriz, lw); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainLeft); lw = XtCreateManagedWidget("help", commandWidgetClass, frame, args, nargs); } switch (StripType(mw)) { case ME_MONTHLY: FmtDate(da, buf, sizeof buf, appResources.editfmt); break; case ME_WEEKLY: (void) strcpy(buf, appResources.day[da->day]); break; } nargs = 0; argLD(XtNlabel, buf); argLD(XtNborderWidth, 0); argLD(XtNfromHoriz, lw); argLD(XtNfromVert, NULL); argLD(XtNvertDistance, 2); argLD(XtNleft, XtChainLeft); argLD(XtNright, XtChainRight); lw = XtCreateManagedWidget("date", labelWidgetClass, frame, args, nargs); /* * The text widget is in the pane below * The Scroll Attributes are controlled from the application * defaults file */ callbacks[0].callback = TextChanged; callbacks[0].closure = (caddr_t) ed; nargs = 0; argLD(XtNshowGrip, False); argLD(XtNstring, ed->ed_data); argLD(XtNeditType, XawtextEdit); argLD(XtNlength, ed->ed_size); argLD(XtNuseStringInPlace, True); argLD(XtNcallback, callbacks); ed->ed_text = XtCreateManagedWidget("text", asciiTextWidgetClass, et, args, nargs); XtPopup(ed->ed_popup, XtGrabNone); } /* * Callback for text widget * This gets called before the string is updated */ /* ARGSUSED */ static void TextChanged(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { register EditLine *ed = (EditLine *) closure; if (MyCalendar) XtSetSensitive(ed->ed_save, True); } /* ARGSUSED */ static void SaveEdits(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { register EditLine *ed = (EditLine *) closure; register MeWrap *mw; register Cardinal day; mw = ed->ed_meWrap; day = ed->ed_day; switch (StripType(mw)) { case ME_MONTHLY: if (WriteCalendarFile(mw, day, ed->ed_data) == False) return; break; case ME_WEEKLY: if (WriteWeeklyFile(mw, day, ed->ed_data) == False) return; break; } /* * Otherwise change the displayed string */ if (mw->mw_have[day]) XtFree(mw->mw_have[day]); mw->mw_have[day] = XtMalloc(strlen(ed->ed_data) + 1); strcpy(mw->mw_have[day], ed->ed_data); /* * Update the visual image */ UpdateDayDetails(mw, day); XtSetSensitive(ed->ed_save, False); } static void UpdateDayDetails(mw, day) MeWrap *mw; Cardinal day; { Instance *ins; int nargs; Arg args[3]; XtSetArg(args[0], XtNlabel, mw->mw_have[day]); for (ins = mw->mw_list; ins; ins = ins->i_next) { nargs = 1; if (*mw->mw_have[day] == '\0') { argLD(XtNforeground, ins->i_col.fg); argLD(XtNbackground, ins->i_col.bg); } XtSetValues(ins->i_day_info[day], args, nargs); } /* * worry about updating the memo system */ switch (StripType(mw)) { case ME_MONTHLY: if (today.day == day && today.month == mw->mw_month && today.year == mw->mw_year) UpdateMemo(); break; case ME_WEEKLY: if (today.wday == day) UpdateMemo(); break; } } static void FinishEditing(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { register EditLine *ed = (EditLine *) closure; register MeWrap *mw; Cardinal day; XtSetSensitive(ed->ed_quit, False); if (MyCalendar) XtSetSensitive(ed->ed_save, False); mw = ed->ed_meWrap; day = ed->ed_day; if (MyCalendar) { if (mw->mw_have[day] == NULL) { if (*ed->ed_data) { CheckExit(ed); return; } } else if (strcmp(mw->mw_have[day], ed->ed_data)) { CheckExit(ed); return; } } CleanEditPanel(w, ed, call_data); } static void CleanEditPanel(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { register EditLine *ed = (EditLine *) closure; register EditLine *edl, *eds; register MeWrap *mw; Cardinal day; Widget popup; mw = ed->ed_meWrap; day = ed->ed_day; popup = ed->ed_popup; XtFree(ed->ed_data); for (edl = NULL, eds = mw->mw_ed; eds; edl = eds, eds = eds->ed_next) { if (eds == ed) { if (edl) edl->ed_next = ed->ed_next; else mw->mw_ed = ed->ed_next; break; } } XtFree((char *) ed); XtPopdown(popup); XtDestroyWidget(popup); SetAllButtons(mw->mw_list, day, True); } /* * We are trying to leave with saving the data * let us see if the user really wants to */ static void CheckExit(ed) register EditLine *ed; { DialogPopup(ed->ed_quit, CheckDia, ed, NULL); } /* * Here we do the work */ static void CheckDia(pop, ed) Widget pop; EditLine *ed; { Widget dia; XtSetSensitive(ed->ed_quit, False); /* Take "Save file?" from resources */ dia = XtCreateManagedWidget("check", dialogWidgetClass, pop, NULL, 0); XawDialogAddButton(dia, "yes", YesCheck, ed); XawDialogAddButton(dia, "no", NoCheck, ed); } /* ARGSUSED */ static void YesCheck(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { SaveEdits(w, closure, call_data); CleanEditPanel(w, closure, call_data); XtDestroyWidget(XtParent(XtParent(w))); } /* ARGSUSED */ static void NoCheck(w, closure, call_data) Widget w; caddr_t closure; caddr_t call_data; { CleanEditPanel(w, closure, call_data); XtDestroyWidget(XtParent(XtParent(w))); } /* * Slighty formatted XtError */ /* VARARGS1 */ void Fatal(fmt, a, b) char *fmt; char *a; char *b; { char buf[BUFSIZ]; (void) sprintf(buf, fmt, a, b); XtAppError(appContext, buf); /* NOTREACHED */ } /* * These routines used to insert text into a file * from the middle button press. * Code called from xcal_strip.c * The routine is responsible for freeing the text string */ void AppendText(w, da, txt) Widget w; Date *da; String txt; { MeWrap *mw; Cardinal len; Cardinal srclen; String newstr; if ((mw = MeWrapSearch(da->year, da->month)) == NULL) mw = NewMeWrap(); /* shouldn`t happen */ if (EditCheck(w, mw, da)) return; /* * if we have some text already, we must append the new text to it */ if (mw->mw_have[da->day]) { /* * size of new string is sum of previous two * plus two for the nulls at the end of the string * plus one because we made need to insert a newline * after the old text */ srclen = strlen(mw->mw_have[da->day]); if (srclen) { len = srclen + strlen(txt) +3; newstr = XtMalloc(len); strcpy(newstr, mw->mw_have[da->day]); if (newstr[srclen] == '\0') { newstr[srclen++] = '\n'; newstr[srclen] = '\0'; } strcat(newstr, txt); XtFree(txt); txt = newstr; } } switch (StripType(mw)) { case ME_MONTHLY: if (WriteCalendarFile(mw, da->day, txt) == False) return; break; case ME_WEEKLY: if (WriteWeeklyFile(mw, da->day, txt) == False) return; break; } /* * Otherwise change the displayed string */ if (mw->mw_have[da->day]) XtFree(mw->mw_have[da->day]); mw->mw_have[da->day] = txt; UpdateDayDetails(mw, da->day); }