pc@hillside.co.uk (Peter Collinson) (05/13/91)
Submitted-by: Peter Collinson <pc@hillside.co.uk> Posting-number: Volume 13, Issue 2 Archive-name: xcal/part02 #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # version.c # scott_brim # xcal.c # xcal.man # This archive created: Wed May 8 09:14:08 1991 export PATH; PATH=/bin:$PATH echo shar: extracting "'version.c'" '(852 characters)' if test -f 'version.c' then echo shar: will not over-write existing file "'version.c'" else sed 's/^ X//' << \SHAR_EOF > 'version.c' X#ifndef lint Xstatic char *sccsid = "@(#)version.c 3.3 (Hillside Systems) 3/22/91"; X#endif /* lint */ X/* X * Version control file X * version.c 3.3 3/22/91 X * Automatically created on Fri Mar 22 23:48:16 GMT 1991 X * X * Hand edit none of this if you want freeze to continue to work X */ X#ifdef VER_PROG X#define PROGNAME XCal X#endif X#ifdef VER_VEC Xchar version[] = "XCal Version 3.3, released Fri Mar 22 23:48:16 GMT 1991"; X#endif X#ifdef VER_DEF X#define VERSION "XCal Version 3.3, released Fri Mar 22 23:48:16 GMT 1991" X#endif X X/* SCCS files X * X+1.9 Imakefile X+3.6 xcal_help.c X+1.6 xcal_cal.c X+1.17 xcal.man X+1.11 xcal_memo.c X+1.13 XCal.ad X+1.13 xcal_alarm.c X+3.15 xcal_edit.c X+1.6 README X+2.2 patchlevel.h X+3.10 xcal_strip.c X+1.2 xcal_cal.man X+1.10 Makefile X+3.5 xcal_popup.c X+3.22 xcal.c X+3.14 xcal.h X+2.12 CHANGES X+1.2 mouse.bm X+1.2 mouseaway.bm X * X */ SHAR_EOF if test 852 -ne "`wc -c < 'version.c'`" then echo shar: error transmitting "'version.c'" '(should have been 852 characters)' fi fi # end of overwriting check if test ! -d 'scott_brim' then echo shar: creating directory "'scott_brim'" mkdir 'scott_brim' fi echo shar: entering directory "'scott_brim'" cd 'scott_brim' echo shar: extracting "'README'" '(64 characters)' if test -f 'README' then echo shar: will not over-write existing file "'README'" else sed 's/^ X//' << \SHAR_EOF > 'README' XThis code sent in by Scott Brim X <swb@chumley.tn.cornell.edu> X X SHAR_EOF if test 64 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 64 characters)' fi fi # end of overwriting check echo shar: extracting "'xcshow.c'" '(7326 characters)' if test -f 'xcshow.c' then echo shar: will not over-write existing file "'xcshow.c'" else sed 's/^ X//' << \SHAR_EOF > 'xcshow.c' X/* X * Announce xcal appointment entries. Typical use is to announce a few X * days' worth. Also possible to dump every entry in "calendar" format. X * X * Options: <date> - date to start at - mm/dd[/yy[yy]] X * -d <RootDirectory> - of diary (default ~/Calendar) X * -n <n> - where <n> is number of days to display X * -c - dump everything in "calendar" format; X * ignores <date> and -n. X */ X X X#include <stdio.h> X#include <time.h> X#include <utmp.h> X#include <pwd.h> X#include <dirent.h> X#include <errno.h> X#include <sys/types.h> X#include <sys/stat.h> X X#define FALSE 0 X#define TRUE 1 X Xvoid usage(); X Xstruct tm *tm; /* hold times */ Xchar rootdir[256]; /* build directory name here */ XFILE *fd; /* read file descriptor */ Xchar filename[256]; /* to build filename in */ Xchar *months[] = { X "Jan", "Feb", "Mar", "Apr", X "May", "Jun", "Jul", "Aug", X "Sep", "Oct", "Nov", "Dec" X }; Xint days_in_months[] = { X 31, 28, 31, 30, X 31, 30, 31, 31, X 30, 31, 30, 31, X}; X X Xmain(argc, argv) Xunsigned int argc; Xchar **argv; X{ X int ndays; /* number of days to announce */ X char c, *s; /* reading and writing */ X char *dirname; /* root directory name */ X struct passwd *pwd; X long ti; X int cdump = 0; /* dump into calendar? */ X int i; X X X /* defaults */ X ti = time(0); /* default to today */ X tm = localtime(&ti); X tm->tm_year += 1900; X X ndays = 1; /* and to printing just one day */ X X if ((pwd = getpwuid(getuid())) == NULL) { X fprintf(stderr, "Who are you?\n"); X exit(42); X }; X strcpy(rootdir, pwd->pw_dir); /* default to home directory */ X endpwent(); X strcat(rootdir, "/Calendar"); X dirname = rootdir; X X X /* check options */ X argc--, argv++; X while (argc > 0) { X X if (isdigit(argv[0][0])) { X if ((sscanf(argv[0], "%d/%d/%d", &tm->tm_mon, X &tm->tm_mday, &tm->tm_year)) < 2) { X usage(); X exit(1); X } X else { X tm->tm_mon--; /* internal month # is 0-11 */ X if (valid_date() != 0) { /* user-supplied date */ X /* must make sense */ X usage(); X exit(2); X } X } X X } /* end if first character is digit */ X else if (argv[0][0] == '-') { X switch(argv[0][1]) { X case 'd': /* dirname */ X if (--argc <=0) { X usage(); /* nothing there */ X exit(3); X } X dirname = (++argv)[0]; X break; X case 'n': /* number of days */ X if (--argc <= 0) { X usage(); /* nothing there */ X exit(4); X } X if ((sscanf((++argv)[0], "%d", &ndays)) != 1) { X usage(); /* nothing there */ X exit(5); X } X break; X case 'c': X cdump = 1; X break; X default: X usage(); X exit(6); X } X } X argc--, argv++; X } X X if (cdump) { /* a dump? */ X return(dumpit(dirname)); /* go do so */ X } X X while (ndays--) { /* otherwise loop, for each day requested */ X X valid_date(); /* Make current m, d, y make sense */ X X /* build filename -- e.g. "/mu/swb/Calendar/xy1990/xc1Oct1990" */ X sprintf(filename, "%s/xy%04d/xc%d%s%d", X dirname, tm->tm_year, tm->tm_mday, X months[tm->tm_mon], tm->tm_year); X X /* Read from file, if it exists, and print. */ X if (fd = fopen(filename, "r")) { X fprintf(stdout, "%02d %s %d:\n------------\n", X tm->tm_mday, months[tm->tm_mon], tm->tm_year); X while ((c = getc(fd)) != EOF) putc(c, stdout); X fclose(fd); X fprintf(stdout, "\n"); X } X X tm->tm_mday++; /* do the next day */ X } X exit(0); X} X X/* X * valid_date takes the (external) date and makes it reasonable. First X * it increments the month until the day given is within a month (as X * opposed to, say, 3/47/91). Then it increments the year until the X * month is valid. Right now it doesn't know anything about leap X * years. X */ X Xvalid_date() X{ X int rc; X X rc = 0; X days_in_months[1] = 28; /* default */ X if (leap_year(tm->tm_year)) days_in_months[1] = 29; X X while (tm->tm_mday > days_in_months[tm->tm_mon]) { X tm->tm_mday -= days_in_months[tm->tm_mon]; X tm->tm_mon++; X rc++; X } X X while (tm->tm_mon >= 12) { /* month should be 0-11 */ X tm->tm_mon -= 12; X tm->tm_year++; X rc++; X } X X return(rc); X} X X/* X * leap year? X */ Xint leap_year(year) Xint year; X{ X X if (year%4000 == 0) return FALSE; X else if (year%400 == 0) return TRUE; X else if (year%100 == 0) return FALSE; X else if (year%4 == 0) return TRUE; X else return FALSE; X X} X X X X/* X * explain usage X */ Xvoid Xusage() X{ X fprintf(stderr, "Usage: [date] [-d directory] [-n ndays] [-c]\n"); X fprintf(stderr, " -c dumps all entries in calendar(1) format.\n"); X} X X/* X * dumpit dumps every single xcal entry pre-ambled with monthname, X * day, and year. X */ Xdumpit(dirname) X char *dirname; X{ X DIR *Cdirp, *ydirp; X struct dirent *Centp, *yentp; X struct stat statbuf; X char *Cpathend, *ypathend; /* loc for fname in filepath */ X char *year; /* ascii year */ X char prebuf[14]; /* "calendar" preamble space */ X char inbuf[1024]; X int i; X X if ((Cdirp = opendir(dirname)) == NULL) { /* top xcal dir */ X perror(dirname); X return(errno); X } X X strcpy(filename, dirname); /* initialize file path */ X strcat(filename, "/"); X Cpathend = filename + strlen(filename); /* put year dir here */ X X X /* for each year directory */ X while ((Centp = readdir(Cdirp)) != NULL) { /* foreach year dir */ X X if (Centp->d_name[0] == '.') continue; /* no ., .. */ X X /* check each year directory */ X strcpy(Cpathend, Centp->d_name); /* build filename */ X if ((i = stat(filename, &statbuf)) != 0) { X perror(filename); X return(errno); X } X if (!S_ISDIR(statbuf.st_mode)) { X/* fprintf(stderr, "%s not a directory, ignoring ... \n", */ X/* filename); */ X continue; X } X X if ((ydirp = opendir(filename)) == NULL) { X perror(filename); X return(errno); X } X strcat(filename, "/"); /* path to open data files */ X year = Centp->d_name + 2; /* use year in preamble */ X ypathend = filename + strlen(filename); /* where to put fnames */ X X X /* for each day file in year dir */ X while ((yentp = readdir(ydirp)) != NULL) { X X if (yentp->d_name[0] == '.') continue; X strcpy(ypathend, yentp->d_name); X if ((i = stat(filename, &statbuf)) != 0) { X perror(filename); X return(errno); X } X if (!S_ISREG(statbuf.st_mode)) { X/* fprintf(stderr, */ X/* "%s not a regular file, ignoring ... \n", */ X/* filename); */ X continue; X } X X /* build what to dump in front of info */ X sscanf( &(yentp->d_name[2]), "%d%3c", &i, prebuf); X *(prebuf+3) = '.'; sprintf(prebuf+4, " %02d ", i); X strncpy(prebuf+8, year, 4); X *(prebuf+12) = '\0'; X X /* open file and put each line in stdout, prepended */ X /* with the contents of prebuf and a tab. */ X X if (!(fd = fopen(filename, "r"))) { X fprintf(stderr, X "Error %d opening %s, ignoring ... \n", errno, X filename); X continue; /* the foreach file loop */ X } X X while (fgets(inbuf, sizeof(inbuf), fd)) { X printf("%s\t%s", prebuf, inbuf); X if (*(inbuf + strlen(inbuf) - 1) != '\n') X printf("\n"); X } X fclose(fd); X X } /* end for each day file */ X X if ((closedir(ydirp)) != 0) { X *(ypathend-1) = '\0'; /* reinit to just dirname */ X perror(filename); X } X } /* end for each year */ X X if ((closedir(Cdirp)) != 0) { X perror(dirname); X return(errno); X } X X return(0); X} SHAR_EOF if test 7326 -ne "`wc -c < 'xcshow.c'`" then echo shar: error transmitting "'xcshow.c'" '(should have been 7326 characters)' fi fi # end of overwriting check echo shar: extracting "'vixc.csh'" '(687 characters)' if test -f 'vixc.csh' then echo shar: will not over-write existing file "'vixc.csh'" else sed 's/^ X//' << \SHAR_EOF > 'vixc.csh' X#!/bin/csh X# X# edit with vi an xcal daily diary file, with date defaulting to today. X# From: Scott Brim <swb@chumley.tn.cornell.edu> X X# constants Xset months = \ X{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"} X X# default to today Xset thedate = `date +%m/%d/%y` Xif ($1 != "") set thedate = $1 X Xset month = `echo $thedate | cut -d/ -f1` Xset monthname = $months[$month] Xset day = `echo $thedate | cut -d/ -f2` Xset year = `echo $thedate | cut -d/ -f3` Xif ( $year < 100 ) @ year = $year + 1900 X X# build filename Xset filename = "~/Calendar/xy"${year}"/xc"${day}${monthname}${year} X Xif ($?VISUAL) then X $VISUAL $filename Xelse X /usr/ucb/vi $filename Xendif X Xexit $status SHAR_EOF if test 687 -ne "`wc -c < 'vixc.csh'`" then echo shar: error transmitting "'vixc.csh'" '(should have been 687 characters)' fi fi # end of overwriting check echo shar: extracting "'makefile'" '(242 characters)' if test -f 'makefile' then echo shar: will not over-write existing file "'makefile'" else sed 's/^ X//' << \SHAR_EOF > 'makefile' X# X# Rough makefile X# XCC = gcc XCFLAGS = -g -O X Xxcshow: xcshow.c X $(CC) $(CFLAGS) -o xcshow xcshow.c X Xinstall: xcshow X install -s -m 755 xcshow /usr/local/bin X install -c -m 755 vixc.sh /usr/local/bin/vixc X Xclean: X -rm -f *.o xcshow errs core X SHAR_EOF if test 242 -ne "`wc -c < 'makefile'`" then echo shar: error transmitting "'makefile'" '(should have been 242 characters)' fi fi # end of overwriting check echo shar: done with directory "'scott_brim'" cd .. echo shar: extracting "'xcal.c'" '(18878 characters)' if test -f 'xcal.c' then echo shar: will not over-write existing file "'xcal.c'" else sed 's/^ X//' << \SHAR_EOF > 'xcal.c' X#ifndef lint Xstatic char *sccsid = "@(#)xcal.c 3.22 (Hillside Systems) 1/16/91"; Xstatic char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems"; X#endif /* lint */ X/*** X X* program name: X xcal.c X* function: X display the current calendar date X if pressed as a button go into strip calendar mode X* switches: X -format str use str as a display format X -order ord set the argument order to this X -debug run quickly incrementing time - 1 day per sec X -alarmscan print alarm debug info X* libraries used: X libXaw.a, libXmu.a libXt.a libX11.a X* compile time parameters: X standard X* history: X Written November 1989 X Peter Collinson X Hillside Systems X* (C) Copyright: 1989 Hillside Systems/Peter Collinson X X Permission to use, copy, modify, and distribute this software X and its documentation for any purpose is hereby granted to X anyone, provided that the above copyright notice appear X in all copies and that both that copyright notice and this X permission notice appear in supporting documentation, and that X the name of Peter Collinson not be used in advertising or X publicity pertaining to distribution of the software without X specific, written prior permission. Hillside Systems makes no X representations about the suitability of this software for any X purpose. It is provided "as is" without express or implied X warranty. X X Peter Collinson DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS X SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY X AND FITNESS, IN NO EVENT SHALL Peter Collinson BE LIABLE FOR X ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES X WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS X ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR X PERFORMANCE OF THIS SOFTWARE. X X***/ X#include <stdio.h> X#include <ctype.h> X#include <X11/Intrinsic.h> X#include <X11/StringDefs.h> X#include <X11/Shell.h> X#include <X11/Xaw/Command.h> X#include <X11/Xaw/Label.h> X#include <X11/Xaw/Form.h> X#include "xcal.h" X Xchar date_area[BUFSIZ]; X X/* command line options specific to the application */ Xstatic XrmOptionDescRec Options[] = { X{"-debug", "debug", XrmoptionNoArg, (caddr_t)"TRUE"}, X{"-alarmscan", "alarmScan", XrmoptionNoArg, (caddr_t)"TRUE"}, X{"-format", "format", XrmoptionSepArg, NULL}, X{"-order", "order", XrmoptionSepArg, NULL}, X}; X Xstruct resources appResources; X XPixmap MouseOnPix; XPixmap MouseOffPix; X X#define offset(field) XtOffset(struct resources *, field) X Xstatic XtResource Resources[] = { X{"debug", "Debug", XtRBoolean, sizeof(Boolean), X offset(debug), XtRString, "False" }, X{"alarmScan", "AlarmScan", XtRBoolean, sizeof(Boolean), X offset(alarmScan), XtRString, "False" }, X{"reverseVideo", "ReverseVideo", XtRBoolean, sizeof(Boolean), X offset(reverseVideo), XtRString, "False" }, X{"xcalendarCompat", "XcalendarCompat", XtRBoolean, sizeof(Boolean), X offset(calCompat), XtRString, "False" }, X{"giveHelp", "GiveHelp", XtRBoolean, sizeof(Boolean), X offset(giveHelp), XtRString, "True" }, X{"useMemo", "UseMemo", XtRBoolean, sizeof(Boolean), X offset(useMemo), XtRString, "True" }, X{"memoLeft", "MemoLeft", XtRBoolean, sizeof(Boolean), X offset(memoLeft), XtRString, "True" }, X{"initialCalendar", "InitialCalendar", XtRBoolean, sizeof(Boolean), X offset(initialCalendar), XtRString, "False" }, X{"initialEdit", "InitialEdit", XtRBoolean, sizeof(Boolean), X offset(initialEdit), XtRString, "False" }, X{"initialMemo", "InitialMemo", XtRBoolean, sizeof(Boolean), X offset(initialMemo), XtRString, "False" }, X{"markForeground", "MarkForeground", XtRPixel, sizeof(Pixel), X offset(marked.fg), XtRString, "White" }, X{"markBackground", "MarkBackground", XtRPixel, sizeof(Pixel), X offset(marked.bg), XtRString, "Black" }, X{"markToday", "MarkToday", XtRBoolean, sizeof(Boolean), X offset(markToday), XtRString, "True" }, X{"fontToday", "FontToday", XtRFontStruct, sizeof(XFontStruct *), X offset(fontToday), XtRString, "XtDefaultFont"}, X{"todayForeground", "TodayForeground", XtRPixel, sizeof(Pixel), X offset(today.fg), XtRString, "White" }, X{"todayBackground", "TodayBackground", XtRPixel, sizeof(Pixel), X offset(today.bg), XtRString, "Black" }, X{"format", "Format",XtRString, sizeof(String), X offset(opfmt), XtRString, "%s %2d %s %d"}, X{"order", "Order", XtRString, sizeof(String), X offset(order), XtRString, "wdmy"}, X{"dateYearIsTwoDigits", "DateYearIsTwoDigits", XtRBoolean, sizeof(Boolean), X offset(dateYearIs2), XtRString, "False" }, X{"editYearIsTwoDigits", "EditYearIsTwoDigits", XtRBoolean, sizeof(Boolean), X offset(editYearIs2), XtRString, "False" }, X{"memoYearIsTwoDigits", "MemoYearIsTwoDigits", XtRBoolean, sizeof(Boolean), X offset(memoYearIs2), XtRString, "False" }, X{"directory", "Directory", XtRString, sizeof(String), X offset(directory), XtRString, "Calendar"}, X{"textBufferSize", "TextBufferSize", XtRInt, sizeof(int), X offset(textbufsz), XtRString, "2048"}, X{"useWmTitle", "UseWmTitle", XtRBoolean, sizeof(Boolean), X offset(useWmTitle), XtRString, "True"}, X{"minStripWidth", "MinStripWidth", XtRDimension, sizeof(Dimension), X offset(minstripwidth), XtRString, "0"}, X{"january", "January", XtRString, sizeof(String), X offset(mon[0]), XtRString, "January"}, X{"february", "February", XtRString, sizeof(String), X offset(mon[1]), XtRString, "February"}, X{"march", "March", XtRString, sizeof(String), X offset(mon[2]), XtRString, "March"}, X{"april", "April", XtRString, sizeof(String), X offset(mon[3]), XtRString, "April"}, X{"may", "May", XtRString, sizeof(String), X offset(mon[4]), XtRString, "May"}, X{"june", "June", XtRString, sizeof(String), X offset(mon[5]), XtRString, "June"}, X{"july", "July", XtRString, sizeof(String), X offset(mon[6]), XtRString, "July"}, X{"august", "August", XtRString, sizeof(String), X offset(mon[7]), XtRString, "August"}, X{"september", "September", XtRString, sizeof(String), X offset(mon[8]), XtRString, "September"}, X{"october", "October", XtRString, sizeof(String), X offset(mon[9]), XtRString, "October"}, X{"november", "November", XtRString, sizeof(String), X offset(mon[10]), XtRString, "November"}, X{"december", "December", XtRString, sizeof(String), X offset(mon[11]), XtRString, "December"}, X{"jan", "Jan", XtRString, sizeof(String), X offset(smon[0]), XtRString, "Jan"}, X{"feb", "Feb", XtRString, sizeof(String), X offset(smon[1]), XtRString, "Feb"}, X{"mar", "Mar", XtRString, sizeof(String), X offset(smon[2]), XtRString, "Mar"}, X{"apr", "Apr", XtRString, sizeof(String), X offset(smon[3]), XtRString, "Apr"}, X{"may", "May", XtRString, sizeof(String), X offset(smon[4]), XtRString, "May"}, X{"jun", "Jun", XtRString, sizeof(String), X offset(smon[5]), XtRString, "Jun"}, X{"jul", "Jul", XtRString, sizeof(String), X offset(smon[6]), XtRString, "Jul"}, X{"aug", "Aug", XtRString, sizeof(String), X offset(smon[7]), XtRString, "Aug"}, X{"sep", "Sep", XtRString, sizeof(String), X offset(smon[8]), XtRString, "Sep"}, X{"oct", "Oct", XtRString, sizeof(String), X offset(smon[9]), XtRString, "Oct"}, X{"nov", "Nov", XtRString, sizeof(String), X offset(smon[10]), XtRString, "Nov"}, X{"dec", "Dec", XtRString, sizeof(String), X offset(smon[11]), XtRString, "Dec"}, X{"sunday", "Sunday", XtRString, sizeof(String), X offset(day[0]), XtRString, "Sunday"}, X{"monday", "Monday", XtRString, sizeof(String), X offset(day[1]), XtRString, "Monday"}, X{"tuesday", "Tuesday", XtRString, sizeof(String), X offset(day[2]), XtRString, "Tuesday"}, X{"wednesday", "Wednesday", XtRString, sizeof(String), X offset(day[3]), XtRString, "Wednesday"}, X{"thursday", "Thursday", XtRString, sizeof(String), X offset(day[4]), XtRString, "Thursday"}, X{"friday", "Friday", XtRString, sizeof(String), X offset(day[5]), XtRString, "Friday"}, X{"saturday", "Saturday", XtRString, sizeof(String), X offset(day[6]), XtRString, "Saturday"}, X{"sun", "Sun", XtRString, sizeof(String), X offset(sday[0]), XtRString, "Sun"}, X{"mon", "Mon", XtRString, sizeof(String), X offset(sday[1]), XtRString, "Mon"}, X{"tue", "Tue", XtRString, sizeof(String), X offset(sday[2]), XtRString, "Tue"}, X{"wed", "Wed", XtRString, sizeof(String), X offset(sday[3]), XtRString, "Wed"}, X{"thu", "Thu", XtRString, sizeof(String), X offset(sday[4]), XtRString, "Thu"}, X{"fri", "Fri", XtRString, sizeof(String), X offset(sday[5]), XtRString, "Fri"}, X{"sat", "Sat", XtRString, sizeof(String), X offset(sday[6]), XtRString, "Sat"}, X{"weekly", "Weekly", XtRString, sizeof(String), X offset(weekly), XtRString, "Weekly"}, X{"alarms", "Alarms", XtRBoolean, sizeof(Boolean), X offset(alarms), XtRString, "True"}, X{"update", "Update", XtRInt, sizeof(int), X offset(update), XtRString, "0"}, X{"volume", "Volume", XtRInt, sizeof(int), X offset(volume), XtRString, "50"}, X{"nbeeps", "Nbeeps", XtRInt, sizeof(int), X offset(nbeeps), XtRString, "3"}, X{"cmd", "Cmd", XtRString, sizeof(String), X offset(cmd), XtRString, NULL}, X{"countdown", "Countdown", XtRString, sizeof(String), X offset(countdown), XtRString, "10,0"}, X{"autoquit", "Autoquit", XtRInt, sizeof(int), X offset(autoquit), XtRString, "120"}, X{"alarmleft", "Alarmleft", XtRString, sizeof(String), X offset(alarmleft), XtRString, "%d minutes before..."}, X{"alarmnow", "Alarmnow", XtRString, sizeof(String), X offset(alarmnow), XtRString, "Time is now..."}, X{"memoFile", "MemoFile", XtRString, sizeof(String), X offset(memoFile), XtRString, "memo"}, X{"maxDisplayLines", "MaxDisplayLines", XtRInt, sizeof(int), X offset(maxDisplayLines), XtRString, "5"}, X}; X Xstatic XtCallbackRec callbacks[] = { X {NULL, NULL}, X {NULL, NULL}, X}; X#define ClearCallbacks() bzero((caddr_t)callbacks, sizeof (callbacks)) X Xstatic XtActionsRec appActions[]= { X {"setdate", SetDate}, X {"leave", AskLeave}, X {"SetDateAction", TextCal}, X}; X Xstatic String defTranslations = X "<Btn2Down>: set()\n\ X <Btn2Up>:setdate() unset()\n\ X <Btn3Down>: set()\n\ X <Btn3Up>: leave() unset()"; X Xstatic Arg wargs[7] = { X XtNlabel, (XtArgVal) date_area, X XtNcallback, (XtArgVal)callbacks, X}; X XWidget toplevel; X XDate today; X X/* X * Forward routines local to this file X */ Xstatic void MkDate(); Xstatic void DebugMkDate(); Xstatic void DoTemplate(); Xstatic void DecodeOrder(); Xstatic void PixInit(); X X#include "mouse.bm" X#include "mouseaway.bm" X Xvoid Xmain(argc, argv) X unsigned int argc; X char **argv; X{ X Widget parent; X Widget memo; X Widget lab; X X X toplevel = XtInitialize(argv[0], "XCal", X Options, XtNumber(Options), &argc, argv); X X PixInit(toplevel); X X if (argc != 1) X fprintf(stderr, "Error in arguments\n", argv[0]); X X XtGetApplicationResources(toplevel, (caddr_t)&appResources, Resources, X XtNumber(Resources), (ArgList)NULL, 0); X X /* X * If reverse video X * invert default colour settings X */ X if (appResources.reverseVideo) X { Colour old; X old = appResources.marked; X appResources.marked.fg = old.bg; X appResources.marked.bg = old.fg; X old = appResources.today; X appResources.today.fg = old.bg; X appResources.today.bg = old.fg; X } X X InitMonthEntries(); X X DecodeOrder(); X X DoTemplate(); /* give a maximum initial size of the box */ X X /* X * Top level widget is now a form X * assuming that memo is wanted X */ X if (appResources.useMemo) X { parent = toplevel; X XtSetArg(wargs[2], XtNborderWidth, 0); X XtSetArg(wargs[3], XtNdefaultDistance, 0); X parent = XtCreateManagedWidget("form", formWidgetClass, X parent, &wargs[2], 3); X X if (appResources.memoLeft) X { XtSetArg(wargs[2], XtNfromHoriz, NULL); X XtSetArg(wargs[3], XtNleft, XtChainLeft); X XtSetArg(wargs[4], XtNright, XtRubber); X XtSetArg(wargs[5], XtNborderWidth, 0); X XtSetArg(wargs[6], XtNbitmap, MouseOnPix); X callbacks[0].callback = DoMemo; X memo = XtCreateManagedWidget("today", commandWidgetClass, X parent, &wargs[1], 6); X ClearCallbacks(); X X XtSetArg(wargs[2], XtNfromHoriz, memo); X XtSetArg(wargs[3], XtNleft, XtRubber); X XtSetArg(wargs[4], XtNright, XtChainRight); X XtSetArg(wargs[5], XtNborderWidth, 0); X callbacks[0].callback = DoCalendar; X lab = XtCreateManagedWidget("date", commandWidgetClass, X parent, wargs, 6); X } X else X { X XtSetArg(wargs[2], XtNfromHoriz, NULL); X XtSetArg(wargs[3], XtNleft, XtChainLeft); X XtSetArg(wargs[4], XtNright, XtRubber); X XtSetArg(wargs[5], XtNborderWidth, 0); X callbacks[0].callback = DoCalendar; X lab = XtCreateManagedWidget("date", commandWidgetClass, X parent, wargs, 6); X ClearCallbacks(); X X XtSetArg(wargs[2], XtNfromHoriz, lab); X XtSetArg(wargs[3], XtNleft, XtRubber); X XtSetArg(wargs[4], XtNright, XtChainRight); X XtSetArg(wargs[5], XtNborderWidth, 0); X XtSetArg(wargs[6], XtNbitmap, MouseOnPix); X callbacks[0].callback = DoMemo; X memo = XtCreateManagedWidget("today", commandWidgetClass, X parent, &wargs[1], 6); X } X } X else X { X callbacks[0].callback = DoCalendar; X lab = XtCreateManagedWidget("date", commandWidgetClass, X toplevel, wargs, 2); X } X X ClearCallbacks(); X X XtSetMappedWhenManaged(toplevel, False); X X XtRealizeWidget(toplevel); /* set the default geometry */ X X if (appResources.debug) X { fprintf(stderr, "Debug ON\n"); X DebugMkDate(lab); X } X else MkDate(lab); X X if (appResources.giveHelp) X { printf("\ XThe small date strip is a button\n\ XEnter the button showing the date and use\n\ Xthe mouse buttons to select further actions:\n\ X Left mouse button pops up this month's calendar strip\n\ X Middle mouse button permits date selection\n\ X Right mouse button allows exit\n\ XClick with the left mouse button in the small box holding\n\ Xthe mouse icon to edit a memo file\n"); X } X XtAddActions(appActions, 3); /* register actions */ X XtAugmentTranslations(lab, XtParseTranslationTable(defTranslations)); X if (appResources.useMemo) X XtAugmentTranslations(memo, XtParseTranslationTable(defTranslations)); X X XtMapWidget(toplevel); X X if (appResources.initialCalendar) X DoCalendar(lab, NULL, NULL); X X X if (appResources.initialEdit) X { MonthEntry *me; X X me = GetMonthEntry(today.year, today.month); X if (me->me_have[today.day]) X StartEditing(lab, &today); X } X X if (appResources.useMemo && appResources.initialMemo) X DoMemo(memo, NULL, NULL); X X InitAlarms(); X X XtMainLoop(); X exit(0); X} X X/* X * Initialise Pixmaps X */ Xstatic void XPixInit(toplevel) X Widget toplevel; X{ X Display *theDisplay = XtDisplay(toplevel); X X MouseOnPix = XCreateBitmapFromData(theDisplay, X DefaultRootWindow(theDisplay), X (char *)mouse_bits, mouse_width, mouse_height); X MouseOffPix = XCreateBitmapFromData(theDisplay, X DefaultRootWindow(theDisplay), X (char *)mouseaway_bits, mouseaway_width, mouseaway_height); X} X X/* X * Flip mouse state X */ Xvoid XMouseShow(w, OnOff) X Widget w; X Boolean OnOff; X{ X Arg arg[1]; X X XtSetArg(arg[0], XtNbitmap, OnOff ? MouseOnPix : MouseOffPix); X XtSetValues(w, arg, 1); X} X X X/* X * Exit routine X */ Xvoid XLeave(retval) X int retval; X{ exit(retval); X} X X/************************************************************************/ X/* */ X/* */ X/* This deals with the top level date `icon' */ X/* */ X/* */ X/************************************************************************/ X X/* X * Time management code X * Set up a Date structure from today's information X */ Xstatic void XConvDate(tm, dp) X struct tm *tm; X Date *dp; X{ X dp->day = tm->tm_mday; X dp->month = tm->tm_mon; X dp->year = tm->tm_year + 1900; X dp->wday = tm->tm_wday; X} X X Xstatic void XMkDate(w) X Widget w; X{ long ti; X struct tm *tm; X static timedOut; X Date yesterday; X X if (timedOut) X yesterday = today; X X (void) time(&ti); X tm = localtime(&ti); X X ConvDate(tm, &today); X X PlaceStr(date_area, &today, appResources.dateYearIs2); X X XtSetValues(w, wargs, 1); X X if (timedOut) X { ChangeHighlight(&yesterday, &today); X AlarmFilePoll(tm); X UpdateMemo(); X } X X ti = 24*60*60 - (tm->tm_hour*60*60 + tm->tm_min*60 + tm->tm_sec); X XtAddTimeOut(ti*1000, MkDate, (caddr_t)w); X timedOut++; X} X Xstatic void XDebugMkDate(w) X Widget w; X{ static long ti; X struct tm *tm; X static timedOut; X Date yesterday; X X if (timedOut) X yesterday = today; X X if (ti == 0) X (void) time(&ti); X else ti += 24*60*60; X X tm = localtime(&ti); X ConvDate(tm, &today); X X PlaceStr(date_area, &today, appResources.dateYearIs2); X X XtSetValues(w, wargs, 1); X X if (timedOut) X { ChangeHighlight(&yesterday, &today); X AlarmFilePoll(tm); X UpdateMemo(); X } X X XtAddTimeOut(2000, DebugMkDate, (caddr_t)w); X timedOut++; X} X X/* X * DoTemplate X * place an initial string into the date area so that the label X * box will always be big enough X */ Xstatic void XDoTemplate() X{ int max; X int i; X int len; X char trial[BUFSIZ]; X Date da; X X da.day = 99; X da.year = 9999; X X for (da.wday = max = i = 0; i < 7; i++) X { len = strlen(appResources.day[i]); X if (len > max) X { max = len; X da.wday = i; X } X } X X for (max = i = 0; i < 12; i++) X { da.month = i; X PlaceStr(trial, &da, appResources.dateYearIs2); X len = strlen(trial); X if (len > max) X { max = len; X strcpy(date_area, trial); X } X } X} X X/* X * decode the order X */ Xstatic void XDecodeOrder() X{ X register char *p; X int order = 0; X int addweekday = 0; X X p = appResources.order; X X if (*p == 'w') X { addweekday = O_WEEKLEFT; X p++; X } X X if (*p == 'd' && strncmp(p, "dmy", 3) == 0) X order = O_DMY; X else X if (*p == 'y') X { if (strncmp(p, "ymd", 3) == 0) X order = O_YMD; X else X if (strncmp(p, "ydm", 3) == 0) X order = O_YDM; X else X order = -1; X } X else X if (*p == 'm' && strncmp(p, "mdy", 3) == 0) X order = O_MDY; X else X order = -1; X if (order == -1) X { fprintf(stderr, "Unknown order: %s\n", p); X order = O_DMY; X } X X if (addweekday == 0 && p[3] == 'w') X addweekday = O_WEEKRIGHT; X X appResources.val_order = order | addweekday; X} X X/* X * make a string X */ Xvoid XPlaceStr(dest, da, is2) X String dest; X Date *da; X Boolean is2; X{ X register String fmt; X int d = da->day; X String m = appResources.mon[da->month]; X int y = da->year; X String w = appResources.day[da->wday]; X X if (y > 99 && y < 1900) X y -= 100; X X if (is2) X y %= 100; X X fmt = appResources.opfmt; X X switch (appResources.val_order) X { X case O_DMY: /* default */ X (void) sprintf(dest, fmt, d, m, y); X break; X case O_DMY|O_WEEKLEFT: X (void) sprintf(dest, fmt, w, d, m, y); X break; X case O_DMY|O_WEEKRIGHT: X (void) sprintf(dest, fmt, d, m, y, w); X break; X case O_YMD: /* Year/Month/Day */ X (void) sprintf(dest, fmt, y, m, d); X break; X case O_YMD|O_WEEKLEFT: /* Year/Month/Day */ X (void) sprintf(dest, fmt, w, y, m, d); X break; X case O_YMD|O_WEEKRIGHT: /* Year/Month/Day */ X (void) sprintf(dest, fmt, y, m, d, w); X break; X case O_MDY: /* Month/Day/Year */ X (void) sprintf(dest, fmt, m, d, y); X break; X case O_MDY|O_WEEKLEFT: /* Month/Day/Year */ X (void) sprintf(dest, fmt, w, m, d, y); X break; X case O_MDY|O_WEEKRIGHT: /* Month/Day/Year */ X (void) sprintf(dest, fmt, m, d, y, w); X break; X case O_YDM: /* Year/Day/Month */ X (void) sprintf(dest, fmt, y, d, m); X break; X case O_YDM|O_WEEKLEFT: /* Year/Day/Month */ X (void) sprintf(dest, fmt, w, y, d, m); X break; X case O_YDM|O_WEEKRIGHT: /* Year/Day/Month */ X (void) sprintf(dest, fmt, y, d, m, w); X break; X } X} SHAR_EOF if test 18878 -ne "`wc -c < 'xcal.c'`" then echo shar: error transmitting "'xcal.c'" '(should have been 18878 characters)' fi fi # end of overwriting check echo shar: extracting "'xcal.man'" '(19269 characters)' if test -f 'xcal.man' then echo shar: will not over-write existing file "'xcal.man'" else sed 's/^ X//' << \SHAR_EOF > 'xcal.man' X.TH xcal 1 "September 1990" "X Version 11 R4" X.SH NAME Xxcal \- calendar with alarms and a notebook for X11 X.SH SYNTAX X.B xcal X[ X.B \-debug X][ X.B \-alarmscan X] X.SH DESCRIPTION X.I Xcal Xis an interactive calendar program. XThe user interface has several levels. XWhen started X.I xcal Xdisplays today's date in a small command box on the screen. XThe date changes at midnight. XThe command box is intended to sit on the screen as a companion to the X.I xclock Xprogram. XThe format of the command box may be altered using the resource manager, so you Xare not stuck with my preferred format. XA small button in the top level window can be pressed to Xinspect appointments for today. XThis generates a panel showing information from the calendar file for today and Xinformation from a set of seven daily files holding regular commitments. XFinally, the memo panel displays and allows the edit of a memo file. X.LP XThe calendar and notebook functions are accessed by clicking the mouse Xbuttons inside date portion of the command window. X.IP 1) XMouse button one pops up a calendar `strip' for the current month. XThe strip has some header lines and then one line per day of the month. XThe `line per day' display contains the day in the month and the Xday of the week. XToday may be highlighted specially \- the notion of Today alters at midnight. XThe strip has a help button which displays a description of the panel. XThe command buttons in the header line allows the user to bring up a strip Xfor the previous or the next month. X.IP 2) XPressing mouse button two in the date area will bring up a dialog box Xwhich allows the user to select any month of any year (yes, September 1752 Xis supported). XThe month may be input as month name or abbreviation, even though the Xprompt indicates a more restrictive format. X.IP 3) XPressing mouse button 3 in the command window causes the whole program to Xexit, a dialog box is used to ask the user for confirmation. X.LP XLike X.IR xcalendar , Xdaily events are stored in set of files, one for each day. XThe file is created by entering a simple text editor X(the standard text widget) which is started Xby pressing the right hand side of the appropriate day line in the strip. XIf the file exists Xits data is displayed as the label in the command button. XThis allows the user to use the first few lines of the file in an Xintelligent manner since XX11R4 allows multiple lines of text to appear in a command button. XThe strip width is sized by the length of the header, and users who Xwish to display a wider strip to show more of the stored information Xshould widen the strip using the \fIminStripWidth\fP resource (see below). X.LP XData files are stored in a directory usually called X.B Calendar Xunder the user's home directory. XEach file is stored in a subdirectory containing all the data Xfor a particular year. XThis is incompatible with X.IR xcalendar , Xthe user may specify that compatibility should be maintained. X.LP X.I Alarms Xare supported by X.IR xcal . XWhen a line in the data file starts with a digit it is Xassumed to be a time specification and a candidate for an alarm. XThe line contains a string giving the alarm time, and a text string Xdisplayed in a dialogue alarm box. XWhen the time is reached, or at some user specified time before that, Xa dialogue box will be popped up onto the screen. XThe dialogue box will automatically go away after two minutes, unless the X`Stick' button is pressed glueing the box onto the screen. XThe box can be made to go away at any time by hitting the `Unpin' button. X.LP X.I Xcal Xtries to be liberal about the times that it understands. XTime specifications are: h, hh, hhmm, hmm, hh:mm, h:mm, hh.mm, h.mm; Xall of these may be optionally followed by an am/pm indicator \- one Xof: A, a, AM, am, Am, aM, P, p, PM, pm, Pm, pM. XTimes must always be followed by at least one space or tab. XSome legal examples are: X.br X.nf X 12:00 Lunch - Meet Joe at Burger King X 14.30 Meeting in the cafeteria X 2:30p Ring Mark X 7pm Pizza X.fi X.LP X.I Xcal Xalso supports timed command execution from the data file. XTo trigger a command, the data part of the line starts Xwith an exclamation mark, eg: X.br X 4.30pm !xmessage -message 'ring home' X.LP XIt is also possible to make X.I xcal Xexecute a command whenever an alarm is triggered, see the \fIcmd\fP resource Xbelow. X.LP XThe Memo function of X.I Xcal Xis accessed by pressing the non-date portion of the command window. XCurrently this shows a bitmap diagram of three mouse buttons. XClicking the left mouse button in this area brings up a complex panel, Xclicking on the button again will pop is back down again. XThe top half of the panel displays the information held in the diary Xfor today; you cannot edit the data from here \- and must open the Xdiary strip to change the data. XThe next section of the panel displays the information held in the Xweekly files. XAgain you cannot directly change the text in this area, you must Xpress on the Edit button to bring up a strip enabling you to Xchange things. XThe bottom portion of the panel is an edit window displaying the contents Xof a file usually called `memo' in the Calendar directory. XThe idea of this panel is to allow you to access your current information Xin one button click. X.LP XIt is obviously possible to change X.IR Xcal 's Xdata files without using the inbuilt text widget editor. XIn general, X.I Xcal Xwill not notice this. XEditing random day files with a standard text editor will not Xchange the contents of any displayed strips until the strips are Xpopped down and up again. X.I Xcal Xknows what days have been altered when the text widget is used to Xedit the day files, and will reflect any change immediately into Xthe displayed strips. X.LP XYou can make X.I Xcal Xtake notice of today's date file and the current memo file. XThe `Update' resource sets a polling time in seconds. XWhen the clock fires and today's file has been altered, Xthe alarm list is rebuilt from the current date file Xand the memo panel is updated. XThe bottom part of the memo panel is also updated if the `memo' Xfile has been altered on the clock tick. X.SH OPTIONS XThe X.I \-debug Xswitch causes contents of the initial date window to be incremented once Xa second rather than once per day. X.LP XThe X.I \-alarmscan Xswitch prints debugging information about the alarm system on standard output. X.SH "PANEL MAP" X.PP X.I Xcal Xmakes extensive use of the resource manager. XThe user needs to know the names of the various panels and widgets which Xcomprise the application. X.LP X.de EX \"Begin example X.ne 5 X.if n .sp 1 X.if t .sp .5 X.nf X.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 X.. X.de EE X.fi X.if n .sp 1 X.if t .sp .5 X.. X.EX XXCal Toplevel application X form Form containing two buttons X today Memo Command button X date Strip Command button X.EE X.LP XThen we have various popups. XThe Calendar Strip is: X.EX X"Mon Year" the popup shell X Month panel containing the strip X header label containing month and year X action form containing < quit > buttons X back command containing < - last month X quit command containing exit button X next command containing > - next month X help command generating help X "dd DDD" form containing day button (lots of these) X label label containing dd DDD, day of the month X and day of the week X info command containing the file data X.EE X.LP XThe weekly popup strip is: X.EX Xweekly the popup shell X weekly panel containing the strip X header label containing the title X action form containing quit and help X quit command containing exit button X help command generating help X shortday form containing days X label label containing day of the week X info command containing the file data X.EE X.LP XThe Edit Window is: X.EX Xedit the popup shell X panel the panel inside the shell X title the form containing the first line X quit the exit button X.EE X.LP XThe Help Window is: X.EX Xhelp the popup shell X helpPanel the panel inside the shell X helpForm the form containing the title line X quit the exit button X helpText the text widget showing the information X.EE X.LP XThe Alarm Window is: X.EX Xalarm the popup shell X alarmPanel the panel inside the shell X alarmForm form for top line X alarmQuit the exit button X alarmHold the hold button X alarmTitle the title on the alarm window X alarmText the text widget for displaying X.EE X.LP XThe Memo Window is: X.EX Xmemo the popup shell X memoPanel the panel inside the shell X title Top line form widget X quit the exit button X help the help button X date display today's date X display text from today's date file X weeklyMemo form for the Memo title line X weeklyEdit Edit button X weeklyTitle Title area X2 display text from today's weekly file X memoMiddle Middle line form widget X save Save button X memoTitle text title of middle line X memoText Text widget showing memo file X.EE X.LP XThe Middle button date selection popup is: X.EX Xquestion the popup shell X newdate the dialog widget X ok the OK button X cancel the cancel button X.EE X.LP XThe Right button exit selection popup is: X.EX Xquestion the popup shell X exit the dialog widget X yes the yes button X no the no button X.EE X.LP XAn error is shown when a multiple attempts are made to edit the same day file. X.EX Xquestion the popup shell X noedit the dialog widget X ok the OK button X.EE X.LP XA dialog box is popped up when an attempt is made to exit from an editing Xbox without saving the file. X.EX Xcheck the dialog widget X yes the yes button X no the no button X.EE X.SH RESOURCES XAs with all standard X applications, \fIxcal\fR may be customised through Xentries in the resource manager. XIt is a serious mistake to install X.I Xcal Xwithout putting the resource initialisation file X.I Xcal Xin X.IR /usr/lib/X11/app-defaults . XResource class names are listed below; Xresource instance names are identical, except the first letter is in Xlower case. XThe following resource manager entries are defined: X.LP X.TP "\w'ReverseVideoMarkNNN'u" X.B Debug XIf True enables accelerated time. XAlarms will not function correctly. XDefault: False. X.TP X.B AlarmScan XIf True enables printing of alarm related debugging information Xto the standard output. XDefault: False. X.TP X.B ReverseVideo XIf true display the output in reverse video. X.IP X.B Format XThe \fIprintf\fP format used to create the contents of the top command button, Xthe title in an edit window and the title in the memo window. XThe default is "%s %2d %s %d", the arguments to this command are presented Xin a default order: day, month string and year. XThe order is controlled by the Order resource, this contains the default Xstring "wdmy". X.TP X.B Order XThis resource gives the order that various arguments are presented to the Xprintf using the format string defined above. XLegal combinations using day, month and year are: dmy, ymd, mdy, ydm. XThe name of today can be inserted at the start of the string by Xusing one of the formats: wdmy, wymd, wmdy, wydm. XIt can be entered at the end by using on of the formats: dmyw, ymdw, mdyw, ydmw. XIn case you are wondering the `w' stands for `day' of the week. XBeware that altering this resource from Xthe default may force you to change the format string, Xsee the previous resource. XThe default is wdmy. X.TP X.B DateYearIsTwoDigits XThe display of the year in the date strip is controlled Xthe format above. XIf this resource is true then the year will be displayed as a two Xdigit number; if false the whole four digits will be displayed. XDefault: False. X.TP X.B EditYearIsTwoDigits XThe display of the year in the edit boxes is controlled by Xthe format above. XIf this resource is true then the year will be displayed as a two Xdigit number; if false the whole four digits will be displayed. XDefault: False. X.TP X.B MemoYearIsTwoDigits XThe display of the year in the memo box is controlled Xthe format above. XIf this resource is true then the year will be displayed as a two Xdigit number; if false the whole four digits will be displayed. XDefault: False. X.TP X.B MarkBackground XThe background colour for highlighting entries. XDefault Black. X.TP X.B MarkForeground XThe foreground colour for highlighting entries. XDefault White. X.TP X.B MarkToday XIf True then highlight today. XDefault True. X.TP X.B TodayBackground Xthe background colour when marking, default Black. X.TP X.B TodayForeground Xthe foreground colour when marking today, default White. X.TP X.B FontToday XToday may be marked by using a special font, if this is desired the Xfont is given by this resource. XDefault is to use the default font. X.TP X.B Directory XThe name of the directory under the home directory Xwhere the day files are stored. XDefault: Calendar. X.TP X.B XcalendarCompat XIf true then subdirectories are not created in the Calendar directory. XThis flag is not relevant when files are being read, so users Xcan use both programs with existing data files. XDefault: False. X.TP X.B GiveHelp XIf True than access to the help information is given. XIf False, help buttons disappear and the initial message is not printed. XDefault: True. X.TP X.B InitialCalendar XIf True then the calendar for this month is automatically displayed on Xstartup. XIf False, the calendar is not automatically displayed. XDefault: False. X.TP X.B InitialEdit XIf True then an edit window for today is automatically displayed on Xstartup if a file exists for today's date. XIf False, the edit window is not automatically displayed. XDefault: False. X.TP X.B InitialMemo XIf True then the memo window is automatically displayed on startup. XDefault: False. X.TP X.B UseWmTitle XIf True display the month and the year at the head of each strip. XThis information is duplicated if your window manager uses titles Xso it is nice to be able to turn it off. XDefault: True. X.TP X.B MinStripWidth XThe width of month strips are set by the top line, which usually Xdisplays the month and year. XThe whole strip can be widened from this default value by setting this Xresource to be non-zero. XDefault: zero (i.e. off). X.TP X.B TextBufferSize Xthe maximum number of bytes which we are prepared to deal with in an Xedit window. XDefault: 2048 bytes. X.TP X.B Alarms Xwhether or not to enable the alarm system. XDefault: True. X.TP X.B Update XWhen scanning for alarms in the current day file X.I Xcal Xinspects it at program startup time and also when it is edited using the Xnormal built-in editing mechanism. XHowever, if some external program changes the todays file X.I xcal Xwill not see the new contents and new alarms will not be set. XSetting this resource to non-zero will force X.I xcal Xto scan the file every `update' seconds Xlooking for alterations in size and modification date. XWhen it detects that the file is altered, then Xit will rebuild the internal alarm list. XDefault: zero. X.TP X.B Nbeeps XWhen an alarm window is popped up, it is accompanied by `Nbeeps' beeps. XDefault: 3. X.TP X.B Volume XControl the loudness of the beep. Default: 50. X.TP X.B Cmd XThis resource contains a command that is executed by calling the shell Xwhen every alarm is triggered. XThe command is passed the contents of the data line as one argument. X.TP X.B Countdown Xcontains a comma separated string of numbers; for example: 10,5,0. XThe string allows the user to customise warning alarms: so in the Xexample, alarm boxes will be displayed 10 minutes before the stated time, X5 minutes before the stated time and exactly on the stated time. XCommands lines in the data prefaced by a `!' will always be triggered Xexactly at the stated time. XDefault: 10,0. X.TP X.B Autoquit XEach dialogue box containing an alarm message contains an `Unpin' button Xallowing the user to remove the message from the screen by using mouse button one. XAdditionally, the message box can remove itself from the screen after Xa specified period, this resource gives that timeout in seconds. XIf the resource is set to zero, then the user is always forced to take Xexplicit action to remove the box. XDefault: 120, alarm boxes disappear after 2 mins. X.TP X.B Alarmleft Xcontains a \fIprintf\fP string that is displayed in the label at the top Xof an alarm box when countdown is in operation and Xthere is some time before the stated time. XThe time before the stated time is supplied as the second argument to printf. XDefault: ``%d minutes before...'' X.TP X.B Alarmnow Xcontains the fIprintf\fP string that is displayed in the label at the top Xof an alarm box when the stated time is reached. XDefault: ``Time is now...''. X.TP X.B UseMemo Xenables the use of the memo feature. XThis defaults to ``True'', but is present to allow users to make X.I XCal Xhave as it used to. X.TP X.B MemoLeft Xaffects the placing of the memo button in the top level date window. XThe default is `True' meaning that the button box is placed on the left Xof the date portion. XSetting this to `False' will place the button box to the right of the Xdate portions. X.TP X.B MemoFile Xgives the name of the memo file within the Calendar directory. XThe default is `memo'. X.TP X.B MaxDisplayLines Xcontrols the maximum number of text lines that can placed in the Xtop half of the memo panel. XThe top hald will normally size to the number of lines in the diary Xfile for the day, unless the number of lines exceed the value in Xthis resource. XThis ensures that today's events do not dominate the memo panel. XDefault: 5 lines. X.TP X.B January X.B February Xand so on. XThe names of the long form of the month name. X.TP X.B Jan X.B Feb Xand so on. XA short form of the month name - done this way because I doubt that Xwriting with %3s works in all languages. XChanging this resource means that the data file will no longer be Xcompatible with X.I xcalendar . X.TP X.B Sunday X.B Monday Xand so on. XThe \fIlong\fP names of the days: Sunday, Monday etc. XThese are used in titles: the top level widget, the title of an edit window Xand the memo frame. X.TP X.B Sun X.B Mon Xand so on. XThe short names of the days \- used in date strips. X.TP X.B Weekly XThe word `Weekly' used in various places. X.SH FILES X.PP X $HOME/Calendar/* X.LP X.TP "\w'xc<dd><Mon><Year> 'u" Xxc<dd><Mon><Year> XA data file is day, Month in three letter format and the year. X.TP Xxy<Year> XA year directory. X.TP Xxw<Day> XA data file for the weekly code, one per day. X.TP Xmemo XThe memo file. X.LP XThe standard resource database can be found in /usr/lib/X11/app-defaults/Xcal. XAssuming that this is where the system admin installed it. X.PP X.SH SEE ALSO Xxrdb(1), xcal_cal(1) X.PP X.SH BUGS XThere should be some way of removing several edit windows from the screen Xat once. X.LP XIt would be nice to be able to cut from the date box on the screen. X.LP XSetting an alarm 1 minute in the future may not work. X.LP XCountdown does not work in the early hours of the morning, if you have a Xten minute countdown and an alarm set at 0005 \- then you will not get Xwarning at 2325. X.LP XAlarms set at 0000 probably won't work. X.SH AUTHOR X.LP XCopyright 1989,1990 by Peter Collinson, Hillside Systems XAll rights reserved. XPlaced into the public domain. X.PP XMuch of the X.B xcalendar Xprogram was plundered to create X.B xcal ; Xauthor is: Roman J. Budzianowski, MIT Project Athena X.PP XThanks to Ed Gould, Mt Xinu for the support for the X.IR calendar (1) Xprogram. XThanks to Mark Majhor, Sequent for the basis of the alarm code. XThanks to Rod Whitby, Austek Microsystems Pty. Ltd., Australia Xfor the ideas of the Stick/Unpin code for alarms and for prompting Xme to add the memo code. SHAR_EOF if test 19269 -ne "`wc -c < 'xcal.man'`" then echo shar: error transmitting "'xcal.man'" '(should have been 19269 characters)' fi fi # end of overwriting check # End of shell archive exit 0 -- Dan Heller O'Reilly && Associates Z-Code Software Comp-sources-x: Senior Writer President comp-sources.x@uunet.uu.net argv@ora.com argv@zipcode.com