home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!zaphod.mps.ohio-state.edu!mips!msi!dcmartin
- From: S.Marshall@sequent.cc.hull.ac.uk (Simon Marshall)
- Newsgroups: comp.sources.x
- Subject: v16i036: Xalarm 3.02, Part01/03
- Message-ID: <csx-16i036-xalarm-3.02@uunet.UU.NET>
- Date: 5 Feb 92 14:47:30 GMT
- Sender: dcmartin@msi.com (David C. Martin - Moderator)
- Organization: Molecular Simulations, Inc.
- Lines: 1848
- Approved: dcmartin@msi.com
- Originator: dcmartin@fascet
-
- Submitted-by: Simon Marshall <S.Marshall@sequent.cc.hull.ac.uk>
- Posting-number: Volume 16, Issue 36
- Archive-name: xalarm-3.02/part01
-
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # If this archive is complete, you will see the following message at the end:
- # "End of archive 1 (of 3)."
- # Contents: README Makefile fns.c xalarm.c xalarm.man xmemo
- # Wrapped by dcmartin@fascet on Wed Feb 5 06:46:37 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(3326 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- X Readme for xalarm-3
- X
- X Welcome to xalarm for X11R4/5
- X
- X Ideal for the permanently late, like me
- X
- X Copyright (c) 1991, 1992 by Simon Marshall
- X
- X If you still end up late, don't blame me!
- X
- X
- XDESCRIPTION
- X~~~~~~~~~~~
- X
- X xalarm is an interactive program analogous to leave(1), only much more
- X powerful.
- X
- X You can set the alarm either by command line options, or by entering the time
- X using the popup window. The time and date formats are quite flexible and
- X natural. At the appropriate time, xalarm pops up a window to tell you that
- X your time is up. You can tell xalarm to pop up warning windows at specified
- X times before the alarm is to trigger in order to warn you of the impending
- X alarm.
- X
- X If a time is not given or recognised, or a warning time is not recognised, or
- X confirmation is required, xalarm prompts for one by popping up a window.
- X This gives you an opportunity to change the alarm setting, warnings times,
- X and the message xalarm will display when the alarm is triggered.
- X
- X This form is suitable for inclusion as a menu option under a window manager.
- X
- X You can make xalarm read alarm times and the messages to display from a file,
- X the alarms will only be set on the dates specified in the file. This way you
- X can have an appointments file for regular or future dates.
- X
- X This form is suitable for inclusion in an X start up or initialisation
- X script.
- X
- X xalarm allows you to snooze the alarm after it is triggered, to give you an
- X opportunity to carry on and be late anyway. Even after you have set the
- X alarm and confirmed it, you can reset the alarm as long as you know the
- X xalarm process number: xalarm can list other xalarm pids.
- X
- X xalarm makes maximum use of resources, as well as having a number of command
- X line options, and these can be used to control most of the appearance of
- X xalarm and (just about) all of its behaviour.
- X
- X The current xalarm options include:
- X -appointments
- X -time time
- X -warn time[,time...] -nowarn
- X -confirm -noconfirm
- X -warnwords number -nowarnwords
- X -list
- X -reset pid
- X -snooze time
- X -bell -beep -nobell -nobeep
- X -help -version
- X
- X Also supplied are xmemo, xfortune and xyow front ends to xalarm. Note that
- X xfortune and xyow require the fortune and yow programs respectively, they
- X don't come with this.
- X
- X To have a preview of the manual, try something like:
- X
- X% nroff -man xalarm.man | less # or "more" if you haven't got "less".
- X or
- X% xalarm -help
- X
- X See the file INSTALL for help with installation and problems.
- X
- X
- XTHE END
- X~~~~~~~
- X
- X Xalarm uses Xt & Xaw stuff only, and may well be a useful aid to someone
- X trying to learn X, as I was/am.
- X
- X You may have problems with X function names if using R3 or earlier;
- X application contexts are used, but this should not take much changing - using
- X #defines may do most of the job.
- X
- X Written in an attempt to learn X Windows in as short a time as possible; it
- X may be written badly, but makes as much use of resources as possible. I
- X don't think it is (but I wouldn't, would I?) and I have found it is very
- X useful for me now I'm to be responsible for giving lectures...
- X
- X Simon.
- X_______________________________________________________________________________
- X Simon Marshall, Dept. Computer Science, University of Hull, HU6 7RX, UK
- X S.Marshall@Hull.ac.UK
- END_OF_FILE
- if test 3326 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(12283 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X# Makefile generated by imake - do not edit!
- X# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
- X#
- X# The cpp used on this machine replaces all newlines and multiple tabs and
- X# spaces in a macro expansion with a single space. Imake tries to compensate
- X# for this, but is not always successful.
- X#
- X
- X# -------------------------------------------------------------------------
- X# Makefile generated from "Imake.tmpl" and <Imakefile>
- X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
- X#
- X# Platform-specific parameters may be set in the appropriate <vendor>.cf
- X# configuration files. Site-specific parameters should be set in the file
- X# site.def. Full rebuilds are recommended if any parameters are changed.
- X#
- X# If your C preprocessor does not define any unique symbols, you will need
- X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
- X# "make World" the first time).
- X#
- X
- X# -------------------------------------------------------------------------
- X# site-specific configuration parameters that need to come before
- X# the platform-specific parameters - edit site.def to change
- X
- X# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# platform-specific configuration parameters - edit sun.cf to change
- X
- X# platform: $XConsortium: sun.cf,v 1.68 91/07/30 11:34:39 rws Exp $
- X
- X# operating system: SunOS 4.1.1
- X
- X# $XConsortium: sunLib.rules,v 1.6 91/03/24 17:55:58 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# site-specific configuration parameters that go after
- X# the platform-specific parameters - edit site.def to change
- X
- X# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- X SHELL = /bin/sh
- X
- X TOP = .
- X CURRENT_DIR = .
- X
- X AR = ar clq
- X BOOTSTRAPCFLAGS =
- X CC = cc
- X AS = as
- X
- X COMPRESS = compress
- X CPP = /lib/cpp $(STD_CPP_DEFINES)
- X PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
- X INSTALL = install
- X LD = ld
- X LINT = lint
- X LINTLIBFLAG = -C
- X LINTOPTS = -axz
- X LN = ln -s
- X MAKE = make
- X MV = mv
- X CP = cp
- X
- X RANLIB = ranlib
- X RANLIBINSTFLAGS =
- X
- X RM = rm -f
- X TROFF = psroff
- X MSMACROS = -ms
- X TBL = tbl
- X EQN = eqn
- X STD_INCLUDES =
- X STD_CPP_DEFINES =
- X STD_DEFINES =
- X EXTRA_LOAD_FLAGS =
- X EXTRA_LIBRARIES =
- X TAGS = ctags
- X
- X SHAREDCODEDEF = -DSHAREDCODE
- X SHLIBDEF = -DSUNSHLIB
- X
- X PROTO_DEFINES =
- X
- X INSTPGMFLAGS =
- X
- X INSTBINFLAGS = -m 0755
- X INSTUIDFLAGS = -m 4755
- X INSTLIBFLAGS = -m 0644
- X INSTINCFLAGS = -m 0444
- X INSTMANFLAGS = -m 0444
- X INSTDATFLAGS = -m 0444
- X INSTKMEMFLAGS = -m 4755
- X
- X PROJECTROOT = /usr/X11/R5
- X
- X TOP_INCLUDES = -I$(INCROOT)
- X
- X CDEBUGFLAGS = -O
- X CCOPTIONS = -pipe
- X
- X ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
- X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
- X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
- X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
- X
- X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
- X
- X LDCOMBINEFLAGS = -X -r
- X DEPENDFLAGS =
- X
- X MACROFILE = sun.cf
- X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
- X
- X IMAKE_DEFINES =
- X
- X IRULESRC = $(CONFIGDIR)
- X IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
- X
- X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
- X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
- X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
- X
- X# -------------------------------------------------------------------------
- X# X Window System Build Parameters
- X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# X Window System make variables; this need to be coordinated with rules
- X
- X PATHSEP = /
- X USRLIBDIR = /usr/X11/R5/lib
- X BINDIR = /usr/X11/R5/bin
- X INCROOT = /usr/X11/R5/include
- X BUILDINCROOT = $(TOP)
- X BUILDINCDIR = $(BUILDINCROOT)/X11
- X BUILDINCTOP = ..
- X INCDIR = $(INCROOT)/X11
- X ADMDIR = /usr/adm
- X LIBDIR = $(USRLIBDIR)/X11
- X CONFIGDIR = $(LIBDIR)/config
- X LINTLIBDIR = $(USRLIBDIR)/lint
- X
- X FONTDIR = $(LIBDIR)/fonts
- X XINITDIR = $(LIBDIR)/xinit
- X XDMDIR = $(LIBDIR)/xdm
- X TWMDIR = $(LIBDIR)/twm
- X MANPATH = /usr/X11/R5/man
- X MANSOURCEPATH = $(MANPATH)/man
- X MANSUFFIX = n
- X LIBMANSUFFIX = 3
- X MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
- X LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
- X NLSDIR = $(LIBDIR)/nls
- X PEXAPIDIR = $(LIBDIR)/PEX
- X XAPPLOADDIR = $(LIBDIR)/app-defaults
- X FONTCFLAGS = -t
- X
- X INSTAPPFLAGS = $(INSTDATFLAGS)
- X
- X IMAKE = imake
- X DEPEND = makedepend
- X RGB = rgb
- X
- X FONTC = bdftopcf
- X
- X MKFONTDIR = mkfontdir
- X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
- X
- X CONFIGSRC = $(TOP)/config
- X DOCUTILSRC = $(TOP)/doc/util
- X CLIENTSRC = $(TOP)/clients
- X DEMOSRC = $(TOP)/demos
- X LIBSRC = $(TOP)/lib
- X FONTSRC = $(TOP)/fonts
- X INCLUDESRC = $(TOP)/X11
- X SERVERSRC = $(TOP)/server
- X UTILSRC = $(TOP)/util
- X SCRIPTSRC = $(UTILSRC)/scripts
- X EXAMPLESRC = $(TOP)/examples
- X CONTRIBSRC = $(TOP)/../contrib
- X DOCSRC = $(TOP)/doc
- X RGBSRC = $(TOP)/rgb
- X DEPENDSRC = $(UTILSRC)/makedepend
- X IMAKESRC = $(CONFIGSRC)
- X XAUTHSRC = $(LIBSRC)/Xau
- X XLIBSRC = $(LIBSRC)/X
- X XMUSRC = $(LIBSRC)/Xmu
- X TOOLKITSRC = $(LIBSRC)/Xt
- X AWIDGETSRC = $(LIBSRC)/Xaw
- X OLDXLIBSRC = $(LIBSRC)/oldX
- X XDMCPLIBSRC = $(LIBSRC)/Xdmcp
- X BDFTOSNFSRC = $(FONTSRC)/bdftosnf
- X BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
- X BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
- X MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
- X FSLIBSRC = $(FONTSRC)/lib/fs
- X FONTSERVERSRC = $(FONTSRC)/server
- X EXTENSIONSRC = $(TOP)/extensions
- X XILIBSRC = $(EXTENSIONSRC)/lib/xinput
- X PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
- X
- X# $XConsortium: sunLib.tmpl,v 1.11 91/07/31 11:32:08 rws Exp $
- X
- XSHLIBLDFLAGS = -assert pure-text
- XPICFLAGS = -pic
- X
- X DEPEXTENSIONLIB =
- X EXTENSIONLIB = -lXext
- X
- X DEPXLIB = $(DEPEXTENSIONLIB)
- X XLIB = $(EXTENSIONLIB) -lX11
- X
- X DEPXMULIB = $(USRLIBDIR)/libXmu.sa.$(SOXMUREV)
- X XMULIB = -lXmu
- X
- X DEPOLDXLIB =
- X OLDXLIB = -loldX
- X
- X DEPXTOOLLIB = $(USRLIBDIR)/libXt.sa.$(SOXTREV)
- X XTOOLLIB = -lXt
- X
- X DEPXAWLIB = $(USRLIBDIR)/libXaw.sa.$(SOXAWREV)
- X XAWLIB = -lXaw
- X
- X DEPXILIB =
- X XILIB = -lXi
- X
- X SOXLIBREV = 4.10
- X SOXTREV = 4.10
- X SOXAWREV = 5.0
- X SOOLDXREV = 4.10
- X SOXMUREV = 4.10
- X SOXEXTREV = 4.10
- X SOXINPUTREV = 4.10
- X
- X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
- X XAUTHLIB = -lXau
- X DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
- X XDMCPLIB = -lXdmcp
- X
- X DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
- X PHIGSLIB = -lphigs
- X
- X DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
- X XBSDLIB = -lXbsd
- X
- X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
- X LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
- X LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
- X LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
- X LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
- X LINTXI = $(LINTLIBDIR)/llib-lXi.ln
- X LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
- X
- X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
- X
- X DEPLIBS1 = $(DEPLIBS)
- X DEPLIBS2 = $(DEPLIBS)
- X DEPLIBS3 = $(DEPLIBS)
- X
- X# -------------------------------------------------------------------------
- X# Imake rules for building libraries, programs, scripts, and data files
- X# rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# start of Imakefile
- X
- X# Based on an Imakefile from:
- X# Andreas Stolcke
- X# International Computer Science Institute, Berkeley.
- X
- X# If you don't have gethostname() and you can't change the #define in
- X# alarm.c to what ever it is on your system, add -DNOGETHOSTNAME here:
- XDEFINES = ${SIGNAL_DEFINES}
- X
- XOBJS = alarm.o when.o warning.o times.o fns.o xalarm.o
- XSRCS = alarm.c when.c warning.c times.c fns.c xalarm.c
- X
- XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
- X
- X PROGRAM = xalarm
- X
- Xall:: xalarm
- X
- Xxalarm: $(OBJS) $(DEPLIBS)
- X $(RM) $@
- X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
- X
- Xsaber_xalarm:: $(SRCS)
- X # load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- Xosaber_xalarm:: $(OBJS)
- X # load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- Xinstall:: xalarm
- X @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
- X $(INSTALL) -c $(INSTPGMFLAGS) xalarm $(DESTDIR)$(BINDIR)
- X
- Xinstall.man:: xalarm.man
- X @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
- X $(INSTALL) -c $(INSTMANFLAGS) xalarm.man $(DESTDIR)$(MANDIR)/xalarm.$(MANSUFFIX)
- X
- Xdepend::
- X $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
- X
- Xlint:
- X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
- Xlint1:
- X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
- X
- Xclean::
- X $(RM) $(PROGRAM)
- X
- Xinstall:: XAlarm.ad
- X @if [ -d $(DESTDIR)$(XAPPLOADDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(XAPPLOADDIR)); fi
- X $(INSTALL) -c $(INSTAPPFLAGS) XAlarm.ad $(DESTDIR)$(XAPPLOADDIR)/XAlarm
- X
- Xinstall:: xmemo xfortune xyow
- X @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
- X @case '${MFLAGS}' in *[i]*) set +e;; esac; \
- X for i in xmemo xfortune xyow; do \
- X (set -x; $(INSTALL) -c $(INSTBINFLAGS) $$i $(DESTDIR)$(BINDIR)); \
- X done
- X
- Xinstall.man:: xmemo.man
- X @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
- X $(INSTALL) -c $(INSTMANFLAGS) xmemo.man $(DESTDIR)$(MANDIR)/xmemo.$(MANSUFFIX)
- X
- Xinstall.man:: xfortune.man
- X @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
- X $(INSTALL) -c $(INSTMANFLAGS) xfortune.man $(DESTDIR)$(MANDIR)/xfortune.$(MANSUFFIX)
- X
- Xinstall.man:: xyow.man
- X @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
- X $(INSTALL) -c $(INSTMANFLAGS) xyow.man $(DESTDIR)$(MANDIR)/xyow.$(MANSUFFIX)
- X
- Xfns.h:
- X @config.1st
- X
- Xxmemo.man xyow.man xfortune.man:
- X echo ".so man"`echo n`"/xalarm."`echo n` > $@
- X
- Xxfortune::
- X
- Xxyow::
- X
- Xclean::
- X $(RM) xfortune xyow xmemo.man xyow.man xfortune.man fns.h
- X
- Xconfig::
- X @chmod +x config.1st fullpath xmemo
- X @config.1st fortune yow
- X @xrdb -merge XAlarm.ad
- X @xrdb -merge XAlarm.ad+
- X
- Xalarm.o: xalarm.h patchlevel.h
- Xwhen.o: xalarm.h patchlevel.h
- Xwarning.o: xalarm.h patchlevel.h
- Xtimes.o: xalarm.h patchlevel.h
- Xfns.o: xalarm.h patchlevel.h fns.h
- Xxalarm.o: xalarm.h patchlevel.h
- X
- X# -------------------------------------------------------------------------
- X# common rules for all Makefiles - do not edit
- X
- Xemptyrule::
- X
- Xclean::
- X $(RM_CMD) "#"*
- X
- XMakefile::
- X -@if [ -f Makefile ]; then set -x; \
- X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
- X else exit 0; fi
- X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
- X
- Xtags::
- X $(TAGS) -w *.[ch]
- X $(TAGS) -xw *.[ch] > TAGS
- X
- Xsaber:
- X # load $(ALLDEFINES) $(SRCS)
- X
- Xosaber:
- X # load $(ALLDEFINES) $(OBJS)
- X
- X# -------------------------------------------------------------------------
- X# empty rules for directories that do not have SUBDIRS - do not edit
- X
- Xinstall::
- X @echo "install in $(CURRENT_DIR) done"
- X
- Xinstall.man::
- X @echo "install.man in $(CURRENT_DIR) done"
- X
- XMakefiles::
- X
- Xincludes::
- X
- X# -------------------------------------------------------------------------
- X# dependencies generated by makedepend
- X
- END_OF_FILE
- if test 12283 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'fns.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'fns.c'\"
- else
- echo shar: Extracting \"'fns.c'\" \(9902 characters\)
- sed "s/^X//" >'fns.c' <<'END_OF_FILE'
- X/*
- X Copyright (c) 1991, 1992 by Simon Marshall, University of Hull, UK
- X
- X If you still end up late, don't blame me!
- X
- X Permission to use, copy, modify, distribute, and sell this software and its
- X documentation for any purpose and without fee is hereby granted,
- X provided that the above copyright notice appear in all copies and that
- X both that copyright notice and this permission notice appear in
- X supporting documentation.
- X
- X This software is provided AS IS with no warranties of any kind. The author
- X shall have no liability with respect to the infringement of copyrights,
- X trade secrets or any patents by this file or any part thereof. In no
- X event will the author be liable for any lost revenue or profits or
- X other special, indirect and consequential damages.
- X*/
- X
- X/*
- X * Just a few bits and bobs.
- X */
- X
- X
- X#include "xalarm.h"
- X#include "fns.h"
- X
- X
- X
- X/*
- X * This is cos of a bug of some sort spotted on a Sparc 2 (SunOS 4.1.1), X11r4,
- X * whereby X crashes if given a zero timeout. Just woof it up a bit.
- X */
- X
- X#if defined(SparcArchitecture)
- X#define TIMEOUT(t) ((t) < 100 ? 100 : (t))
- X#else
- X#define TIMEOUT(t) (t)
- X#endif
- X
- X#define APPOINTMENTS "-appointments"
- X#define COMMAND \
- X "echo xalarms: `%s -cx | %s xalarm | %s 7 | %s -v %d`"
- X
- X
- X
- XString Concat(), *PreParseArgList();
- Xvoid Initialise(), DoAppointments(), SetGeometry(), AddTimeOuts(), Quit();
- Xstatic void CentreWidgetUnderPointer(), ParseGeometry();
- XSIGRET ResetAlarm();
- Xextern void DoAlarm(), Warning(), WakeUp(), PopupAndAsk();
- Xextern int fork();
- Xextern long TimeToMilliSeconds();
- Xextern Boolean AppointmentIsToday();
- Xextern String getenv();
- Xextern time_t time();
- X
- X
- X
- Xextern AlarmData xalarm;
- X
- X
- X
- X/*
- X * Just give a bit of help etc.
- X * Fork off a child otherwise.
- X */
- X
- Xvoid Initialise (proggie, data)
- X String proggie;
- X ApplDataPtr data;
- X{
- X char command[TEXT];
- X
- X if (data->proggie == (char *) NULL)
- X data->proggie = proggie;
- X
- X if (data->version)
- X (void) printf ("%s: using xalarm version %s\n",
- X data->proggie, VERSION);
- X
- X if (data->help) {
- X (void) printf ("Usage: %s [options] [text]\n\n", data->proggie);
- X (void) printf ("Default values for these resources/options are used by %s,\n\t",
- X data->proggie);
- X (void) printf ("but may be over-ruled.\n");
- X (void) printf ("Usual X options, plus:\n\t");
- X (void) printf ("-appointments\t\tSet alarms for today from xalarm file.\n\t");
- X (void) printf ("-time time\t\tTime at which to trigger %s.\n\t", data->proggie+1);
- X (void) printf ("-warn time[,time...]\tTimes before %s for warnings.\n\t",
- X data->proggie+1);
- X (void) printf ("-warnwords number\tWords from %s message in warning.\n\t",
- X data->proggie+1);
- X (void) printf ("-list\t\t\tList xalarm process numbers (pids).\n\t");
- X (void) printf ("-reset pid\t\tReset alarm for xalarm process number pid.\n\t");
- X (void) printf ("-snooze time\t\tSet initial alarm snooze time value.\n\t");
- X (void) printf ("-nowarn\t\t\tNo warnings.\n\t");
- X (void) printf ("-nowarnwords\t\tNo words from %s message in warning.\n\t",
- X data->proggie+1);
- X (void) printf ("-[no]confirm\t\t[Don't] ask for confirmation.\n\t");
- X (void) printf ("-[no]bell\t\t[Don't] beep on warnings and %s.\n", data->proggie+1);
- X }
- X
- X if (data->list) {
- X (void) sprintf (command, COMMAND, PS, FGREP, COLRM, FGREP, getpid());
- X (void) system (command);
- X }
- X
- X if (data->reset > 0)
- X if (kill (data->reset, SIGUSR1) == -1)
- X perror (data->proggie);
- X
- X if ((data->list) or (data->version) or (data->help) or (data->reset > 0))
- X exit (0);
- X
- X /*
- X * Fork & exit the parent. If the fork fails, carry on anyway.
- X * Is this OK? Should we sleep a bit first?
- X */
- X switch (fork ()) {
- X case -1:
- X perror (data->proggie);
- X case 0:
- X break;
- X default:
- X exit (0);
- X }
- X}
- X
- X
- X
- X/*
- X * Parse each line of the alarm file, if it's around. If the
- X * appointment is today, fork and do the alarm.
- X */
- X
- Xvoid DoAppointments (argv, argc)
- X String argv[];
- X int argc;
- X{
- X FILE *file;
- X String alarm, timestr;
- X char filename[TEXT], line[TEXT];
- X int newargc, endofdate;
- X
- X if ((alarm = getenv ("XALARM")) == (char *) NULL)
- X alarm = XtNewString (".xalarm");
- X if (alarm[0] == '/')
- X (void) sprintf (filename, "%s", alarm);
- X else
- X (void) sprintf (filename, "%s/%s", getenv ("HOME"), alarm);
- X
- X if ((file = fopen (filename, "r")) == (FILE *) NULL) {
- X perror (filename);
- X exit (1);
- X }
- X
- X while (fgets (line, TEXT, file) != (char *) NULL) {
- X endofdate = 0;
- X if (AppointmentIsToday (line, ×tr, &endofdate)) {
- X while (isspace (line[endofdate]))
- X endofdate++;
- X
- X argv[argc-1] = XtNewString ("-time");
- X argv[argc] = timestr;
- X
- X if (line[endofdate] == '\0')
- X newargc = argc + 1;
- X else {
- X line[strlen (line) - 1] = '\0';
- X argv[argc+1] = line+endofdate;
- X newargc = argc + 2;
- X }
- X switch (fork ()) {
- X case -1:
- X perror ("xalarm");
- X exit (-1);
- X case 0:
- X DoAlarm (argv, newargc);
- X }
- X }
- X }
- X exit (0);
- X}
- X
- X
- X
- X/*
- X * Returns a string concated from the given array of strings.
- X * Separates the strings with a newline.
- X *
- X * Hacked from various books on X & Xt.
- X */
- X
- XString Concat (strings, n)
- X String *strings;
- X int n;
- X{
- X String buffer;
- X unsigned int i, len = 0;
- X
- X if (n <= 1)
- X return ((String) NULL);
- X
- X for (i=1; i<n; i++)
- X len += strlen (strings[i]);
- X len += (n-1);
- X
- X buffer = XtMalloc (len+1);
- X buffer[0] = '\0';
- X for (i=1; i<n; i++) {
- X if (i > 1)
- X (void) strcat (buffer, "\n");
- X (void) strcat (buffer, strings[i]);
- X }
- X
- X return (buffer);
- X}
- X
- X
- X
- X/*
- X * Check to see if we're to do the appointments thing, and copy out
- X * the arg list, then clear it all.
- X */
- X
- XString *PreParseArgList (app, argv, argc)
- X Boolean *app;
- X String *argv;
- X int argc;
- X{
- X String *args = (String *) XtCalloc (argc+2, sizeof (String *));
- X String ch, end;
- X int i, first, offset;
- X
- X *app = (argc > 1) ? (strcmp (argv[1], APPOINTMENTS) == 0) : False;
- X
- X first = (*app) ? 2 : 1;
- X offset = (*app) ? 1 : 0;
- X args[0] = XtNewString (argv[0]);
- X for (i=first; i<argc; i++) {
- X args[i-offset] = XtNewString (argv[i]);
- X }
- X
- X for (i=1; i<argc; i++) {
- X end = argv[i] + strlen (argv[i]);
- X for (ch=argv[i]; ch<end; ch++)
- X *ch = '\0';
- X }
- X
- X return (args);
- X}
- X
- X
- X
- X/*
- X * We add the time outs for the alarm & warnings.
- X * The warnings are added only if there is time enuf to go.
- X * ie. if "-time +10 -warn 15" you will get nowt.
- X * "-time +10 -warn 9" will, however, give you a warning in 1 min.
- X */
- X
- Xvoid AddTimeOuts ()
- X{
- X int i;
- X
- X xalarm.settime = time ((time_t *) NULL);
- X
- X for (i=0; i<xalarm.numwarnings; i++)
- X if (xalarm.timeout > xalarm.warnings[i])
- X xalarm.timeouts[i] =
- X XtAppAddTimeOut (xalarm.appcon,
- X TIMEOUT (xalarm.timeout - xalarm.warnings[i]),
- X Warning, (XtPointer) (xalarm.warnings[i]/(1000*60)));
- X xalarm.timeouts[xalarm.numwarnings] =
- X XtAppAddTimeOut (xalarm.appcon, TIMEOUT (xalarm.timeout),
- X WakeUp, (XtPointer) NULL);
- X}
- X
- X
- X
- X/*
- X * Let's popup to reset our alarm.
- X */
- X
- XSIGRET ResetAlarm (sig, code, scp, addr)
- X int sig, code;
- X struct sigcontext *scp;
- X char *addr;
- X{
- X time_t now;
- X int i;
- X
- X now = time ((time_t *) NULL);
- X for (i=0; i<xalarm.numwarnings; i++)
- X if ((xalarm.timeout - (now - xalarm.settime)) > xalarm.warnings[i])
- X XtRemoveTimeOut (xalarm.timeouts[i]);
- X XtRemoveTimeOut (xalarm.timeouts[xalarm.numwarnings]);
- X
- X xalarm.timeout = TimeToMilliSeconds (xalarm.timestr);
- X
- X PopupAndAsk ();
- X}
- X
- X
- X
- X/*
- X * Set the geometry of the given widget.
- X */
- X
- Xvoid SetGeometry (widget)
- X Widget widget;
- X{
- X Dimension width, height;
- X
- X if (not XtIsRealized (widget))
- X XtRealizeWidget (widget);
- X
- X XtVaGetValues (widget, XtNwidth, &width, XtNheight, &height, NULL);
- X
- X if (strcmp (xalarm.geometry, NOGEOMETRY) != 0)
- X ParseGeometry (widget, (int) width, (int) height, xalarm.geometry);
- X else
- X CentreWidgetUnderPointer (widget, (int) width, (int) height);
- X}
- X
- X
- X
- X/*
- X * Move the given widget so that it is directly underneath the pointer.
- X */
- X
- Xstatic void CentreWidgetUnderPointer (widget, width, height)
- X Widget widget;
- X int width, height;
- X{
- X Window root, child;
- X int x, y, dummy;
- X unsigned int mask;
- X
- X (void) XQueryPointer (XtDisplay (widget), XtWindow (widget),
- X &root, &child, &x, &y, &dummy, &dummy, &mask);
- X
- X x = MAX (0, MIN (x - (width / 2), WidthOfScreen (XtScreen (widget)) - width));
- X y = MAX (0, MIN (y - (height / 2), HeightOfScreen (XtScreen (widget)) - height));
- X
- X XtVaSetValues (widget, XtNx, (XtArgVal) x, XtNy, (XtArgVal) y, NULL);
- X}
- X
- X
- X
- X/*
- X * Move +/ resize the given widget so that it has the given geometry.
- X */
- X
- Xstatic void ParseGeometry (widget, width, height, geometry)
- X Widget widget;
- X String geometry;
- X int width, height;
- X{
- X int mask, x=0, y=0;
- X
- X mask = XParseGeometry (geometry, &x, &y,
- X (unsigned int *) &width, (unsigned int *) &height);
- X
- X if (mask & WidthValue)
- X XtVaSetValues (widget, XtNwidth, (XtArgVal) width, NULL);
- X if (mask & HeightValue)
- X XtVaSetValues (widget, XtNheight, (XtArgVal) height, NULL);
- X if (mask & (WidthValue | HeightValue))
- X XtVaSetValues (widget, XtNallowShellResize, (XtArgVal) False, NULL);
- X
- X if (not (mask & (XValue | YValue)))
- X CentreWidgetUnderPointer (widget, width, height);
- X else {
- X if (mask & XNegative)
- X x = x + WidthOfScreen (XtScreen (widget)) - width;
- X if (mask & YNegative)
- X y = y + HeightOfScreen (XtScreen (widget)) - height;
- X XtVaSetValues (widget, XtNx, (XtArgVal) x, XtNy, (XtArgVal) y, NULL);
- X }
- X}
- X
- X
- X
- X/*
- X * This function generates a random number and stuffs it down the pipe.
- X */
- X
- Xvoid Quit (widget, clientdata, calldata)
- X Widget widget;
- X XtPointer clientdata, calldata;
- X{
- X XtDestroyApplicationContext (xalarm.appcon);
- X exit (0);
- X}
- END_OF_FILE
- if test 9902 -ne `wc -c <'fns.c'`; then
- echo shar: \"'fns.c'\" unpacked with wrong size!
- fi
- # end of 'fns.c'
- fi
- if test -f 'xalarm.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xalarm.c'\"
- else
- echo shar: Extracting \"'xalarm.c'\" \(7172 characters\)
- sed "s/^X//" >'xalarm.c' <<'END_OF_FILE'
- X/*
- X Copyright (c) 1991, 1992 by Simon Marshall, University of Hull, UK
- X
- X If you still end up late, don't blame me!
- X
- X Permission to use, copy, modify, distribute, and sell this software and its
- X documentation for any purpose and without fee is hereby granted,
- X provided that the above copyright notice appear in all copies and that
- X both that copyright notice and this permission notice appear in
- X supporting documentation.
- X
- X This software is provided AS IS with no warranties of any kind. The author
- X shall have no liability with respect to the infringement of copyrights,
- X trade secrets or any patents by this file or any part thereof. In no
- X event will the author be liable for any lost revenue or profits or
- X other special, indirect and consequential damages.
- X*/
- X
- X/*
- X * The marvelous xalarm proggie, or, how to write an X prog in 2 wks.
- X *
- X * Main bit of prog, just deal with parsing command line options etc
- X * (well, letting XtAppInitialize() do it) & setting up stuff by
- X * calling out to other fns.
- X */
- X
- X
- X
- X#include "xalarm.h"
- X
- X
- Xvoid DoAlarm();
- Xstatic void SetAlarm();
- Xextern void Initialise(), CreateAlarmWidget(), PopupAndAsk(), DoAppointments();
- Xextern SIGRET ResetAlarm();
- Xextern void AddTimeOuts(), EnteredTime(), EnteredWarnings(), Confirmed();
- Xextern void SetWarningTimes(), ShowSnoozeValue(), ShowClickToZero(), Quit();
- Xextern long TimeToMilliSeconds();
- Xextern String Concat();
- Xextern String *PreParseArgList();
- X
- X
- X
- Xstatic XtResource resources[] = {
- X {XtNtime, XtCTime, XtRString, sizeof (String),
- X XtOffset (ApplDataPtr, time), XtRString, ""},
- X {XtNwarnings, XtCWarnings, XtRString, sizeof (String),
- X XtOffset (ApplDataPtr, warnings), XtRString, NULL},
- X {XtNwarningwords, XtCWarningwords,XtRInt, sizeof (int),
- X XtOffset (ApplDataPtr, warningwords),XtRString, 0},
- X {XtNsnooze, XtCSnooze, XtRString, sizeof (String),
- X XtOffset (ApplDataPtr, snooze), XtRString, NULL},
- X {XtNconfirm, XtCConfirm, XtRBoolean, sizeof (Boolean),
- X XtOffset (ApplDataPtr, confirm), XtRString, NULL},
- X {XtNreset, XtCReset, XtRInt, sizeof (int),
- X XtOffset (ApplDataPtr, reset), XtRString, NULL},
- X {XtNbell, XtCBell, XtRBoolean, sizeof (Boolean),
- X XtOffset (ApplDataPtr, bell), XtRString, NULL},
- X {XtNlist, XtCList, XtRBoolean, sizeof (Boolean),
- X XtOffset (ApplDataPtr, list), XtRString, "False"},
- X {XtNversion, XtCVersion, XtRBoolean, sizeof (Boolean),
- X XtOffset (ApplDataPtr, version), XtRString, "False"},
- X {XtNhelp, XtCHelp, XtRBoolean, sizeof (Boolean),
- X XtOffset (ApplDataPtr, help), XtRString, "False"},
- X {XtNname, XtCName, XtRString, sizeof (String),
- X XtOffset (ApplDataPtr, proggie), XtRString, NULL},
- X {XtNgeometry, XtCGeometry, XtRString, sizeof (String),
- X XtOffset (ApplDataPtr, geometry), XtRString, NOGEOMETRY},
- X};
- X
- X
- X
- Xstatic XrmOptionDescRec options[] = {
- X {"-time", ".time", XrmoptionSepArg, ""},
- X {"-t", ".time", XrmoptionSepArg, ""},
- X {"-warn", ".warnings", XrmoptionSepArg, NULL},
- X {"-w", ".warnings", XrmoptionSepArg, NULL},
- X {"-nowarn", ".warnings", XrmoptionNoArg, ""},
- X {"-nw", ".warnings", XrmoptionNoArg, ""},
- X {"-warnwords", ".warningwords",XrmoptionSepArg, NULL},
- X {"-ww", ".warningwords",XrmoptionSepArg, NULL},
- X {"-nowarnwords", ".warningwords",XrmoptionNoArg, "0"},
- X {"-noww", ".warningwords",XrmoptionNoArg, "0"},
- X {"-confirm", ".confirm", XrmoptionNoArg, "True"},
- X {"-c", ".confirm", XrmoptionNoArg, "True"},
- X {"-noconfirm", ".confirm", XrmoptionNoArg, "False"},
- X {"-nc", ".confirm", XrmoptionNoArg, "False"},
- X {"-snooze", ".snooze", XrmoptionSepArg, NULL},
- X {"-s", ".snooze", XrmoptionSepArg, NULL},
- X {"-reset", ".reset", XrmoptionSepArg, NULL},
- X {"-r", ".reset", XrmoptionSepArg, NULL},
- X {"-bell", ".bell", XrmoptionNoArg, "True"},
- X {"-beep", ".bell", XrmoptionNoArg, "True"},
- X {"-b", ".bell", XrmoptionNoArg, "True"},
- X {"-nobell", ".bell", XrmoptionNoArg, "False"},
- X {"-nobeep", ".bell", XrmoptionNoArg, "False"},
- X {"-nb", ".bell", XrmoptionNoArg, "False"},
- X {"-list", ".list", XrmoptionNoArg, "True"},
- X {"-l", ".list", XrmoptionNoArg, "True"},
- X {"-version", ".version", XrmoptionNoArg, "True"},
- X {"-v", ".version", XrmoptionNoArg, "True"},
- X {"-help", ".help", XrmoptionNoArg, "True"},
- X {"-h", ".help", XrmoptionNoArg, "True"},
- X {"-geometry", ".geometry", XrmoptionSepArg, NULL},
- X {"-g", ".geometry", XrmoptionSepArg, NULL},
- X};
- X
- X
- X
- Xstatic XtActionsRec actions[] = {
- X {"Quit", Quit},
- X {"EnteredTime", EnteredTime},
- X {"EnteredWarnings", EnteredWarnings},
- X {"Confirmed", Confirmed},
- X {"ShowClickToZero", ShowClickToZero},
- X {"ShowSnoozeValue", ShowSnoozeValue}
- X};
- X
- X
- X
- XAlarmData xalarm;
- X
- X
- X
- Xvoid main (argc, argv)
- X int argc;
- X String argv[];
- X{
- X String *args;
- X Boolean appointments;
- X
- X args = PreParseArgList (&appointments, argv, argc);
- X
- X if (appointments)
- X DoAppointments (args, argc);
- X else
- X DoAlarm (args, argc);
- X}
- X
- X
- X
- Xvoid DoAlarm (argv, argc)
- X int argc;
- X String argv[];
- X{
- X ApplData data;
- X
- X xalarm.toplevel = XtAppInitialize (&xalarm.appcon, "XAlarm",
- X options, XtNumber (options), &argc, argv,
- X (String *) NULL, (ArgList) NULL, 0);
- X
- X XtGetApplicationResources (xalarm.toplevel, &data,
- X resources, XtNumber (resources), (ArgList) NULL, 0);
- X
- X XtAppAddActions (xalarm.appcon, actions, XtNumber (actions));
- X
- X /*
- X * First initialise; exit or fork.
- X * We have to make the alarm widget first, as SetAlarm() may popup
- X * a dialog box which may need to know the alarm widget's label.
- X */
- X
- X Initialise (argv[0], &data);
- X CreateAlarmWidget (Concat (argv, argc));
- X SetAlarm (&data);
- X
- X XtAppMainLoop (xalarm.appcon);
- X}
- X
- X
- X
- X/*
- X * If the time is not given, pop up and ask for it, otherwise add the
- X * time outs. Get the warnings first, tho.
- X */
- X
- Xstatic void SetAlarm (data)
- X ApplDataPtr data;
- X{
- X char snoozetime[TEXT];
- X
- X snoozetime[0] = '+';
- X (void) strcpy (snoozetime+1, data->snooze);
- X xalarm.snooze = TimeToMilliSeconds (snoozetime) / (60*1000);
- X
- X xalarm.warningwords = data->warningwords;
- X xalarm.bell = data->bell;
- X xalarm.confirm = data->confirm;
- X xalarm.proggie = data->proggie;
- X xalarm.geometry = data->geometry;
- X
- X /*
- X * Get the time from the time string, and the warnings from the
- X * warnings string...
- X */
- X xalarm.timeout = TimeToMilliSeconds (xalarm.timestr = data->time);
- X SetWarningTimes (xalarm.warningsstr = data->warnings);
- X
- X /*
- X * If ``invalid'' (may not have been given anyway), popup.
- X * If ok, but we want confirmation, popup to check. (this is cheating!)
- X * There is no waiting for confirmation if the timeout is 0 - the user
- X * will soon realise that there was something wrong...
- X */
- X if ((ISINVALID (xalarm.timeout)) or
- X (ISINVALID (xalarm.numwarnings)) or
- X (xalarm.confirm and (xalarm.timeout != 0)))
- X PopupAndAsk ();
- X else
- X AddTimeOuts ();
- X
- X (void) signal (SIGUSR1, ResetAlarm);
- X}
- END_OF_FILE
- if test 7172 -ne `wc -c <'xalarm.c'`; then
- echo shar: \"'xalarm.c'\" unpacked with wrong size!
- fi
- # end of 'xalarm.c'
- fi
- if test -f 'xalarm.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xalarm.man'\"
- else
- echo shar: Extracting \"'xalarm.man'\" \(19025 characters\)
- sed "s/^X//" >'xalarm.man' <<'END_OF_FILE'
- X.TH XALARM 1 "Release 4" "X Version 11"
- X.SH NAME
- Xxalarm - alarm clock for X
- X.LP
- Xxmemo - memo for X
- X.LP
- Xxfortune - fortune for X
- X.LP
- Xxyow - yow for X
- X.SH SYNOPSIS
- X.B xalarm
- X[-\fItoolkitoption\fP ...] [-option ...] [message_text]
- X.LP
- X.B xmemo
- X[-\fItoolkitoption\fP ...] [-option ...] [message_text]
- X.LP
- X.B xfortune
- X[-\fItoolkitoption\fP ...] [-option ...]
- X.LP
- X.B xyow
- X[-\fItoolkitoption\fP ...] [-option ...]
- X.SH DESCRIPTION
- X.I xalarm
- Xis an interactive alarm program for X11, analogous to
- X.I leave(1),
- Xbut much more powerful. You can set the alarm either on the command line
- Xor by using the popup window. At the appropriate time,
- X.I xalarm
- Xpops up a window to tell you that your time is up. The time the alarm is to
- Xtrigger may be a specific time or a time for
- X.I xalarm
- Xto wait before triggering.
- X
- XYou can tell
- X.I xalarm
- Xto pop up warning windows at specified times before the alarm is to trigger,
- Xin order to warn you of the impending triggering of the alarm, and specify
- Xwhat message you want the alarm to display.
- X
- XYou can also make
- X.I xalarm
- Xread alarm times and dates, along with the message to display in the alarm,
- Xfrom a file. This enables you to forget your regular or important
- Xappointments, but
- X.I xalarm
- Xwill tell you by popping up at the appropriate time.
- X
- XThe alarm window itself consists of a box of buttons and an area containing
- Xthe alarm message. To give you an opportunity to carry on after the alarm has
- Xtriggered and be late anyway,
- X.I xalarm
- Xallows you to snooze the alarm.
- X.SH SETTING THE ALARM
- XIf no time is specified,
- X.I xalarm
- Xwill pop up a window in order for an alarm time to be entered. This form is
- Xsuitable for inclusion as a menu option under a window manager.
- X
- XThe window is also popped up if an invalid alarm or warning time is given
- X(see below for time syntax), or if you specify that confirmation should be
- Xsought before setting the alarm.
- X
- XThe window gives you an opportunity to change the alarm setting, warning times,
- Xand the message
- X.I xalarm
- Xwill display when the alarm is triggered.
- X
- XThe popup resizes itself to
- Xedit any message larger than the space given by default. The keymap used by
- Xthe Athena Dialog widget is modelled on the text buffer keymap of the
- Xeditor/environment
- X.I emacs(1),
- Xwhile text may be entered when the pointer is anywhere within the popup.
- X
- XThis popup window comprises of three separate windows, dealing with the alarm
- Xtime, the warning time(s) and confirmation of all the settings (where you can
- Xalso re-edit the alarm message). If the window is popped up, then you can
- Xre-edit the alarm time or warning time(s) by switching through the windows
- Xusing the
- X.I edit
- Xbuttons. Confirmation of a window's settings is made using the
- X.I enter
- Xbuttons, and the translations resource is set so that the
- X.I return
- Xkey will do the same thing. If confirmation is not enabled, then the
- Xwindow for confirmation of all settings will not be popped up even if the other
- Xwindows are.
- X
- XAlso see the examples section.
- X.SH USING AN ALARM FILE
- XYou can make
- X.I xalarm
- Xlook for alarm times and messages in an alarm file. This form is suitable for
- Xinclusion in your
- X.I X
- Xstart up or initialisation script.
- X
- XIf the environment
- Xvariable
- X.I XALARM
- Xis set, it is assumed to be the name of the file to read from. If it is not
- Xabsolute, it is assumed to be relative to your home directory. Otherwise,
- X.I xalarm
- Xtries
- X.I .xalarm
- Xin your home directory.
- X
- XEach line in the file should consist of the date the alarm is to trigger,
- Xoptionally followed the by time and/or message. If they are present, they must
- Xbe separated from the date by a `-' on its own. If both are given, the time
- Xmust come first, but if no time is specified, the alarm will trigger
- Ximmediately.
- X
- XThe date is in the form of that given by
- X.I date(1),
- X(day of week, month, day of month) but can be in any order and case is not
- Xsignificant. If any is omitted, it is assumed to correspond to today. The
- Xmonth and day of the week must consist of at least the first 3 characters of
- Xthe name.
- X
- XAny line beginning with `#' or `!' is ignored, so this can be used to insert
- Xcomments in the alarm file.
- X
- XAll other command line options and resources still apply. Also see the
- Xexamples section.
- X.SH TIMES
- XThe time format is quite flexible and natural. The definition is that
- Xfor times given with 3 or 4 digits,
- Xthe last 2
- Xdigits are always assumed to be minutes.
- XAbsolute times may be suffixed with `am' or `pm', and are assumed to be in
- Xhours if given with 1 or 2 digits.
- XTimes relative to the present time must be prefixed by a `+', and are assumed
- Xto be in minutes if given with 1 or 2 digits.
- XThe hours and minutes can be separated with a `:', `.' or `-'.
- XThe format is a super-set (by far) of the format recognised by
- X.I leave(1).
- XAlso see the examples section.
- X.SH SNOOZING THE ALARM
- XSnoozing is done by selecting a time to snooze using the
- X.I +mins
- Xbuttons (they can be pressed as often as necessary) and pressing the
- X.I snooze
- Xbutton. The snooze time may be zeroed by clicking on the
- X.I snoozetime
- Xbutton (it has these two functions; display and zero). For the really lazy,
- Xthe initial value of
- X.I snoozetime
- Xcan be set by either a command line option or by its resource.
- X.SH MORE ON XALARM
- XYou can also specify that a number of words from the alarm message should be
- Xdisplayed with any warnings, in case you've forgotten what you set it for. If
- Xnone are to be used, the warning will only indicate when the alarm is due.
- X
- XEven after you have set the alarm and confirmed it, you can reset the alarm
- Xas long as you know the
- X.I xalarm
- Xprocess number. This can be found by using the
- Xcommand line option to list process numbers, or
- X.I ps(1).
- X
- X.I xalarm
- Xmakes maximum use of resources, as well as having a number of command
- Xline options, and these can be used to control most of the appearance of
- X.I xalarm
- Xand (just about) all of its behaviour. Both command line options and useful
- Xresources are listed below.
- X
- XWhen
- X.I xalarm
- Xis invoked it immediately attempts to fork off a child and exit itself, leaving
- Xthe child to continue with the alarm. The child disappears when the X session
- Xon which display
- X.I xalarm
- Xis using is terminated.
- X
- XYou can exit from
- X.I xalarm
- Xat any time by pressing the available
- X.I quit
- Xbutton.
- X.SH XMEMO, XFORTUNE & XYOW
- X
- XIn reality,
- X.I xmemo
- Xis just a front end to
- X.I xalarm
- X(implemented as
- X.I xalarm -time +0 -nowarn),
- Xwhile
- X.I xfortune
- Xand
- X.I xyow
- Xare front ends to
- X.I xmemo
- X(implemented as
- X.I xmemo \fI"\fP`fortune`\fI"\fP
- Xetc.).
- XOptions supplied to them on the command line still override these defaults,
- Xhowever.
- X.PP
- XNote that
- X.I xfortune
- Xand
- X.I xyow
- Xrequire
- X.I fortune(6)
- Xand
- X.I yow(6)
- Xrespectively -
- X.I yow(6)
- Xcomes with
- X.I emacs(1).
- XAlso note that since they are front ends to
- X.I xmemo,
- Xyou can actually give extra message text to include on the command line. If
- Xyou specify a time in the future, you can edit the message text when asked to
- Xconfirm (if enabled).
- X.SH OPTIONS
- X.I xalarm
- Xaccepts all of the standard X Toolkit command line options along with the
- Xadditional options listed below:
- X.TP 8
- X.B \-h[elp]
- XPrint a (possibly) helpful usage message.
- X.TP 8
- X.B \-v[ersion]
- XPrint out the version number of
- X.I xalarm
- Xin the form
- X.I version.patchlevel.
- X.TP 8
- X.B \-appointments
- XThis option makes
- X.I xalarm
- Xread alarm times from a file. Each line in the file should consist of a date
- Xand optional time and/or message. If the date specified at the beginning of
- Xthe line is today and the time has not passed, then the time is used to set an
- Xalarm. Note that this must be given as the first option on the command line.
- X.TP 8
- X.B \-t[ime] \fItime\fP
- XThis option indicates at what time the alarm is to be triggered. Times
- Xrelative to the present must be preceded with a `+', absolute times may end
- Xwith `am' or `pm'.
- X.TP 8
- X.B \-w[arn] \fItime[,time...]\fP
- XIndicate the time(s) before the alarm is due to trigger when a warning should
- Xbe given. They need not be in any particular order, and should be in the same
- Xformat as for relative times, as above, but without the preceding `+'. Note that
- Xmultiple times must be separated by commas but without any spaces.
- X.TP 8
- X.B \-c[onfirm]
- XThis option overrides the resource value and forces
- X.I xalarm
- Xto ask for confirmation, unless the alarm is due to trigger immediately.
- X.TP 8
- X.B \-warnwords [\-ww] \fInumber of words\fP
- XIndicate the number of words from the alarm message you wish to display with
- Xthe warning.
- X.TP 8
- X.B \-l[ist]
- XList the process numbers of any
- X.I xalarm
- Xprocesses running on the current host. Note that this lists what
- X.I ps(1)
- Xthinks are
- X.I xalarm
- Xprocesses, and only on the current host.
- X.TP 8
- X.B \-r[eset] \fIpid\fP
- XSend a signal to the process number
- X.I pid.
- XIf the process is an
- X.I xalarm,
- Xit will pop up the confirmation window to allow you to re-edit the alarm
- Xsettings.
- X.TP 8
- X.B \-s[nooze] \fItime\fP
- XIndicate the time that
- X.I snoozetime
- Xshould initially have when the alarm triggers. It should be in the same format
- Xas for relative times, but without the preceding `+'.
- X.TP 8
- X.B \-nowarn [\-nw]
- XThis option overrides the resource value and forces
- X.I xalarm
- Xnot to give any warnings. This is the same as setting the warning times
- Xresource to the empty string.
- X.TP 8
- X.B \-noconfirm [\-nc]
- XAs above, but prevents any confirmation being sought.
- X.TP 8
- X.B \-nowarnwords [\-noww]
- XThis option overrides the resource value and forces
- X.I xalarm
- Xnot to display any of the alarm text with any warnings. This is the same
- Xas setting the warningwords resource to zero.
- X.TP 8
- X.B \-bell \-beep \-b
- XThese options override the resource value and force
- X.I xalarm
- Xto ring the terminal bell when any warnings and the alarm trigger.
- X.TP 8
- X.B \-nobell \-nobeep \-nb
- XAs above, but prevents any warnings and the alarm ringing the bell when they
- Xtrigger.
- X.TP 8
- X.B \fImessage_text\fP
- XThe remaining unrecognised text is used as the message displayed with the
- Xtriggering of the alarm. Note that each separate argument is assumed to be a
- Xsingle line, so words must be quoted if they are to appear on the same line.
- XFor example:
- X.TP 8
- X % \fBxalarm "On one line" Secondline "Third line"\fP
- X
- XIt is a good idea always to use quotes, even when a line is only one word.
- XNewlines within arguments are recognised, so that input from other tools can be
- Xused:
- X.TP 8
- X % \fBxalarm -time +0 "`fortune -l`"\fR
- X
- XAlso note that
- X.I xalarm
- Xdeletes its copy of any message given on the command line, so your boss can't
- Xsee what it is by looking at the
- X.I xalarm
- Xprocess.
- X.SH EXAMPLES
- XAn entry in an
- X.I X
- Xinitialisation file, before the window manager is executed, making
- X.I xalarm
- Xcheck the alarm file for today's appointments, asking for confirmation before
- Xeach of the alarms are set, and using up to three words from the alarm message
- Xin any warning message:
- X.PP
- X.nf
- X xclock &
- X xbiff &
- X xalarm -appointments -confirm -warnwords 3 &
- X exec twm
- X.fi
- X
- XThe alarm file might contain, for example, the lines:
- X
- X.nf
- X # This is just a comment.
- X ! So is this. Format is: date [- [time] [message]]
- X
- X Wednesday - 12:30pm Football !!!
- X Sun 29 september - 9pm Drag yourself home.
- X Oct 4 - Contrib sometime today...
- X.fi
- X
- XSo that every Wednesday I have an alarm set for 12:30pm; on Sunday September 29
- Xthere is an alarm to be set for 9pm; on October 4 the alarm is to trigger
- Xstraight away.
- X.PP
- XA
- X.I twm(1)
- Xwindow manger entry which makes
- X.I xalarm
- Xask for confirmation and ring the terminal bell when any warnings and the alarm
- Xare triggered, and have the snooze time initially set to 5 minutes:
- X.PP
- X.nf
- X Menu "Utilities" {
- X ...
- X "alarm": f.exec "xalarm -confirm -snooze 5 -beep &"
- X ...
- X }
- X.fi
- X.PP
- XTo set an alarm for 5 o'clock in the evening, without the default warnings or
- Xconfirmation, but with the default alarm message:
- X.TP 8
- X % \fBxalarm -time 5pm -nowarn -noconfirm\fR
- X.PP
- XTo set an alarm for 2 hours in advance, warning 1 minute and 5 minutes before it,
- Xwith a message other than the default:
- X.TP 8
- X % \fBxalarm -time +2.00 -warn 5,1 "Get off your bottom"\fR
- X.PP
- XTo set an alarm for 4.30 (not specifying am/pm, so it is whichever is first),
- Xwith the default warnings and a message other than the default:
- X.TP 8
- X % \fBxalarm -time 4:30 "Time to sneak off home!"\fR
- X.PP
- XAssuming that there is only one
- X.I xalarm
- Xrunning, which we want to reset, we first find out its process number, and then
- Xwe can reset it:
- X.nf
- X
- X % \fBxalarm -list\fR
- X xalarms: 12345
- X % \fBxalarm -reset 12345\fR
- X
- X.fi
- XTo put a 2 line message on the display
- X.I foo
- Ximmediately (this will only work if the display
- X.I foo
- Xcan be opened):
- X.TP 8
- X % \fBxmemo -display foo:0.0 "Bob!" "The bar for lunch?"\fR
- X.PP
- XTo quietly display a fortune at a specific geometry:
- X.TP 8
- X % \fBxfortune -geometry +10+300 -nobeep\fR
- X.PP
- XTo display a Zippy quote (yow!!!) at a specific geometry in 5 minutes and
- X(characteristically) ring the bell:
- X.TP 8
- X % \fBxyow -geometry +100+100 -time +5 -beep\fR
- X.SH RESOURCES
- X.PP
- XThe widget structure is as follows:
- X.PP
- X.nf
- X XAlarm
- X Alarm!
- X alarm
- X buttons
- X quit snooze snooze1 snooze5 snooze15 snoozetime
- X message
- X When?
- X when
- X label value ok toggle quit
- X warnings
- X label value ok toggle quit
- X confirm
- X label value ok cancel quit
- X Warning!
- X warning
- X dismiss message quit
- X.fi
- X.PP
- XSome example resources are:
- X.PP
- X.nf
- X ! For some nice colours...
- X XAlarm*background: LightYellow
- X XAlarm*foreground: IndianRed
- X XAlarm*Command.background: IndianRed
- X XAlarm*Command.foreground: LightYellow
- X ! But this is what you normally get...
- X XAlarm*background: White
- X XAlarm*foreground: Black
- X XAlarm*Command.background: Black
- X XAlarm*Command.foreground: White
- X
- X ! Perhaps the most commonly used resources...
- X XAlarm.bell: True
- X XAlarm.confirm: True
- X XAlarm.warnings: 5,15
- X XAlarm.warningwords: 0
- X XAlarm.snooze: 0
- X
- X ! If you want a more compact alarm window, try these...
- X XAlarm.Alarm!.alarm.buttons.snooze1.fromVert: quit
- X ! This will vary depending on button labels & font...
- X XAlarm.Alarm!.alarm.buttons.snooze1.horizDistance: -93
- X XAlarm.Alarm!.alarm.buttons.snooze5.fromVert: quit
- X XAlarm.Alarm!.alarm.buttons.snooze15.fromVert: quit
- X XAlarm.Alarm!.alarm.buttons.snoozetime.fromHoriz: snooze
- X
- X ! Plus, if you want...
- X XAlarm.Alarm!.alarm.message.fromHoriz: buttons
- X ! This will vary depending on button labels & font...
- X XAlarm.Alarm!.alarm.message.vertDistance: -33
- X
- X ! Some other defaults...
- X XAlarm*font: *-times-bold-r-*-*-14-*
- X XAlarm.Alarm!.alarm.message.font: *-times-bold-i-*-*-34-*
- X XAlarm.Alarm!.alarm.background: Black
- X XAlarm.Alarm!.alarm.message.label: Alarm Call!!!
- X XAlarm.Alarm!.alarm.buttons.quit.label: Quit
- X XAlarm.Alarm!.alarm.buttons.snooze.label: Snooze
- X XAlarm.Alarm!.alarm.buttons.snooze1.label: +1 min
- X XAlarm.Alarm!.alarm.buttons.snooze5.label: +5 mins
- X XAlarm.Alarm!.alarm.buttons.snooze15.label: +15 mins
- X.fi
- X.SH TOOLKIT OPTIONS
- XThe following standard X Toolkit command line arguments are commonly used with
- X.I xalarm:
- X.TP 8
- X.B \-display \fIdisplay\fP
- XThis option specifies the X server to contact.
- X.TP 8
- X.B \-geometry \fIgeometry\fP
- XThis option specifies the preferred size and position of
- X.I xalarm.
- XIt is a little meaningless to specify a size; it is as large as need be.
- X.TP 8
- X.B \-xrm \fIresourcestring\fP
- XThis option specifies a resource string to be used. This is especially
- Xuseful for setting resources that do not have separate command line options.
- X.SH ENVIRONMENT
- X.TP 8
- X.B DISPLAY
- Xto get the default host and display number.
- X.TP 8
- X.B XENVIRONMENT
- Xto get the name of a resource file that overrides the global resources
- Xstored in the RESOURCE_MANAGER property.
- X.TP 8
- X.B XALARM
- Xto get the name of the appointments file. Otherwise, it is assumed to be the
- Xfile
- X.I ~/.xalarm.
- XAny file not given as the full path is assumed to be relative to the home
- Xdirectory.
- X.SH "SEE ALSO"
- XX(1),
- Xleave(1),
- Xemacs(1),
- Xtwm(1),
- Xps(1),
- Xdate(1),
- Xfortune(6),
- Xyow(6)
- X.SH BUGS
- X.TP 8
- X.B Times:
- X
- X.I xalarm
- Xbelieves, and is thus at the mercy of, the system clock.
- X
- XIf the time is relative to the present and confirmation is sought, the alarm
- Xand warnings are set from when the time is confirmed, not from when
- X.I xalarm
- Xwas invoked.
- X
- XThe response when an invalid time or warning time is entered is not
- Xparticularly friendly or helpful.
- X
- XCan't cope with specified times more than 24
- Xhours away. Can't accept things like:
- X.TP 8
- X % \fBxalarm -time +70\fR
- X
- X.B
- XIt must be in proper hours and minutes, otherwise things like the following
- Xwould be ambiguous:
- X.TP 8
- X % \fBxalarm -time +100\fR
- X.B
- X
- XDate checking when reading alarms from the alarm file is pretty rudimentary -
- Xif a date is semantically false but syntactically correct,
- X.I xalarm
- Xwill not notice.
- X
- XOnly times corresponding today's date are checked, even if
- X.I xalarm -appointments
- Xis invoked one minute before midnight.
- X.TP 8
- X.B Editing:
- XThe dialog box uses a subset of the
- X.I emacs(1)
- Xeditor/environment keymap for text buffers (which is certainly not a bug!).
- X
- XHowever, the
- X.I return
- Xkey event is translated by default into the
- X.I confirm
- Xbutton event, as it is translated similarly in the alarm time and warning
- Xdialog boxes.
- XTo insert a newline, use
- X.I ctrl-m
- X(since under
- X.I emacs(1)
- Xthe
- X.I return
- Xkey is a synonym for
- X.I ctrl-m,
- Xunder
- X.I X
- Xthey generate different events), or just change the relevant resource(s) so
- Xthat
- X.I return
- Xproduces the desired effect. The resources, followed by the necessary value,
- Xare:
- X.TP 8
- X XAlarm.When?.when.value.translations
- X XAlarm.When?.warnings.value.translations
- X XAlarm.When?.confirm.value.translations
- X
- X #override <Key>Return: newline()
- X.TP 8
- X.B Resetting:
- XSignalling is implemented very simply, and if the process signalled is not an
- X.I xalarm,
- Xstrange things may occur. Usually, nothing will happen.
- X.TP 8
- X.B Exiting:
- XNormally desirable,
- X.I xalarm
- Xis killed when the X session on which display it is using is terminated whether
- Xyou like it or not.
- X.TP 8
- X.B Input:
- XDoesn't take input from a pipe etc.
- X.SH COPYRIGHT
- XCopyright 1991, 1992, Simon Marshall.
- X.SH AUTHOR
- XSimon Marshall, PhD Self Defense Group, Dept. of Computer Science, University
- XOf Hull, UK. S.Marshall@Hull.ac.UK
- X.SH CONTRIBERS
- XMassive thanks have to go to Bill Leonard, Harris Computer Systems Division,
- XFlorida, for harassing me with suggestions for improvements to make
- X.I xalarm
- Xa useful tool and this manual page easier to understand, and Andreas Stolcke,
- XInternational Computer Science Institute, Berkeley, for his help fixing code.
- XWithout both, xalarm would still be pretty much as version 2.
- X
- XThanks also to J Braham Levy, Stefan Haenssgen, Jamie Zawinski, Jason Venner
- Xand Kimmo Suominen for their help with version 3.
- X
- XFor their help and suggestions with previous versions of
- X.I xalarm,
- XI would also like to thank (in no real order) Dave Brooks, Reiner Hammer,
- XJay Lawlor, Janet Anstett, Gordon Freedman, Francois-Regis
- XColin and Jeffrey Mast. If I've missed anyone, sorry.
- X.SH COMMENTS
- XI'd like some; comments, suggestions, code, bug reports and fixes, etc. Don't
- Xforget to include which version of
- X.I xalarm
- Xyou are using (from
- X.I xalarm -version),
- Xmachine/OS, X11 release & patch number, window manager etc.
- END_OF_FILE
- if test 19025 -ne `wc -c <'xalarm.man'`; then
- echo shar: \"'xalarm.man'\" unpacked with wrong size!
- fi
- # end of 'xalarm.man'
- fi
- if test -f 'xmemo' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xmemo'\"
- else
- echo shar: Extracting \"'xmemo'\" \(73 characters\)
- sed "s/^X//" >'xmemo' <<'END_OF_FILE'
- X#! /bin/sh
- Xexec xalarm -name xmemo -time +0 -nowarn -noconfirm ${1+"$@"}
- END_OF_FILE
- if test 73 -ne `wc -c <'xmemo'`; then
- echo shar: \"'xmemo'\" unpacked with wrong size!
- fi
- chmod +x 'xmemo'
- # end of 'xmemo'
- fi
- echo shar: End of archive 1 \(of 3\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 3 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Molecular Simulations, Inc. mail: dcmartin@msi.com
- 796 N. Pastoria Avenue uucp: uunet!dcmartin
- Sunnyvale, California 94086 at&t: 408/522-9236
-