mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 14:28:40 +02:00
Compare commits
123 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04f6b3223b | ||
|
|
9b3d4281ad | ||
|
|
e0dd960ba6 | ||
|
|
f51e4f0fda | ||
|
|
4a04089285 | ||
|
|
47cb7a4e01 | ||
|
|
904f6f55f5 | ||
|
|
d2e2bf982e | ||
|
|
ab59a2e575 | ||
|
|
e12462630e | ||
|
|
65f62d6012 | ||
|
|
0e6f7f5e35 | ||
|
|
a8e977f8b7 | ||
|
|
8dac9848ee | ||
|
|
e0129313c4 | ||
|
|
85c5dc6d26 | ||
|
|
84a9aa22b4 | ||
|
|
102cbcc181 | ||
|
|
db37d11d52 | ||
|
|
dad6343f1e | ||
|
|
eaecc4d3f4 | ||
|
|
9c1b04b3fe | ||
|
|
f9e28c39f9 | ||
|
|
63983d4f49 | ||
|
|
a39088084e | ||
|
|
5973cb7631 | ||
|
|
9a9da33989 | ||
|
|
8a5df61642 | ||
|
|
6ca72652a3 | ||
|
|
ce1a0c3605 | ||
|
|
920699e17b | ||
|
|
83f24cd94f | ||
|
|
c9aa3000d1 | ||
|
|
08d2a36f2f | ||
|
|
eebe3733fc | ||
|
|
67aab59d19 | ||
|
|
c1e4e42763 | ||
|
|
f3b85cec38 | ||
|
|
dc346f126d | ||
|
|
b565353372 | ||
|
|
b1e70ef272 | ||
|
|
ae072a2fa3 | ||
|
|
39d8fe3523 | ||
|
|
048638cdda | ||
|
|
70ae23809f | ||
|
|
260d66b20f | ||
|
|
4b38ffdf12 | ||
|
|
7ff0315ae9 | ||
|
|
ce5a828896 | ||
|
|
a6686ab4a2 | ||
|
|
55e07e7326 | ||
|
|
3cd69d3cb4 | ||
|
|
8531f8b5b4 | ||
|
|
9a6eef11ea | ||
|
|
ede057e8d1 | ||
|
|
22d3a18116 | ||
|
|
d37d2c08d9 | ||
|
|
49a9dfb0d3 | ||
|
|
69d85c5228 | ||
|
|
6d5ed33b54 | ||
|
|
d380f4571b | ||
|
|
418e9ff265 | ||
|
|
c31b2e1d27 | ||
|
|
38280bed8a | ||
|
|
f4e09f9e96 | ||
|
|
ce88211f50 | ||
|
|
f8d91f559a | ||
|
|
b936e3994b | ||
|
|
bf5a11e1a3 | ||
|
|
0fac20e467 | ||
|
|
0a990f91ee | ||
|
|
c0d14e6d62 | ||
|
|
01455ed0c2 | ||
|
|
727eebfabc | ||
|
|
8841d03fe5 | ||
|
|
4828cfdbf6 | ||
|
|
41310f5a05 | ||
|
|
d3325809ab | ||
|
|
1a538a0112 | ||
|
|
b64ac87881 | ||
|
|
2fe7595d76 | ||
|
|
5a22d20ed4 | ||
|
|
df0bcfc1d2 | ||
|
|
22c169fea8 | ||
|
|
87cfe53b52 | ||
|
|
2db390d2e2 | ||
|
|
f2128d4cb6 | ||
|
|
02a7023040 | ||
|
|
931e7a7b26 | ||
|
|
05b3808e5c | ||
|
|
bc95350f1e | ||
|
|
0ff20006c7 | ||
|
|
1ba2968df8 | ||
|
|
c4fd7e3176 | ||
|
|
e1cf4d5e70 | ||
|
|
31bc3c8aa8 | ||
|
|
dd917df96f | ||
|
|
a15e9bc2b4 | ||
|
|
254f340f4c | ||
|
|
800438a1d1 | ||
|
|
8eb2028cf2 | ||
|
|
ef2aa97967 | ||
|
|
165db3d5b6 | ||
|
|
76e0c78d15 | ||
|
|
2d5d6d1f56 | ||
|
|
6248fd1808 | ||
|
|
2c9465b4bb | ||
|
|
7897067eda | ||
|
|
3c53ab13c9 | ||
|
|
f32e0027ad | ||
|
|
4c46eb5fee | ||
|
|
a1fc29e66d | ||
|
|
8e17c968e2 | ||
|
|
ef9f13e83d | ||
|
|
b5cb430fe4 | ||
|
|
a12cd4234c | ||
|
|
100f038ae1 | ||
|
|
e1730460fe | ||
|
|
00c2383738 | ||
|
|
0f167686d9 | ||
|
|
d0be59edff | ||
|
|
dfbbafe87b | ||
|
|
3183d6340e |
54
ACKNOWLEDGEMENTS
Normal file
54
ACKNOWLEDGEMENTS
Normal file
@@ -0,0 +1,54 @@
|
||||
$Id: ACKNOWLEDGEMENTS,v 1.1 1998-01-19 03:33:34 dfs Exp $
|
||||
|
||||
I would like to thank the following people:
|
||||
|
||||
Bill Aten <netagw!bill@uunet.UU.NET> for providing remind-all.sh
|
||||
|
||||
Bradley D. Keister <keister@poincare.phys.cmu.edu>, Rhys Weatherly
|
||||
rhys@batserver.cs.uq.OZ.AU> and Anthony Cheng for initially providing
|
||||
the Turbo C compiler support.
|
||||
|
||||
Dennis Cottel <dennis@peanuts.nosc.mil> for providing the patch to
|
||||
produce calendars by weeks as well as by months.
|
||||
|
||||
Bill Silvert <bill%biomel@cs.dal.ca> and Dennis Cottel
|
||||
<dennis@peanuts.nosc.mil> for suggesting many of the new features in
|
||||
REMIND.
|
||||
|
||||
Dave Wolfe <dwolfe@pffft.sps.mot.com> and Raphael Manfredi
|
||||
<ram@eiffel.com> for noticing bugs and sending me fixes.
|
||||
|
||||
Dave Rickel and George M. Sipe for sample reminders and holidays.
|
||||
|
||||
Michael Salmon for ISO encoding of PostScript output.
|
||||
|
||||
Darrel Hankerson for helping me provide some OS/2 support. Sorry
|
||||
it's not complete, Darrel!
|
||||
|
||||
Phillipp Slusallek for suggesting the -k option.
|
||||
|
||||
Amos Shapir, David W. Tamkin and Frank Yellin for help with the Hebrew
|
||||
calendar.
|
||||
|
||||
All of the language translators whose names are listed in lang.h
|
||||
|
||||
Mark Harrison and Michael McLennan for the excellent book
|
||||
"Effective Tcl/Tk Programming". This is where I stole the source
|
||||
for Tcl/Tk tabbed notebooks, and is an excellent reference book.
|
||||
Thanks also to Lucent Technologies and Addison Wesley Longman for
|
||||
making it legal to steal the code.
|
||||
|
||||
All others who have corresponded with me to report bugs, express
|
||||
appreciation or suggest features - too many people to list here.
|
||||
|
||||
Finally, all those who donated money to support the production of
|
||||
REMIND. Your donations were gratefully appreciated.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca> <aa775@freenet.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
66
COPYRIGHT
66
COPYRIGHT
@@ -1,25 +1,22 @@
|
||||
$Id: COPYRIGHT,v 1.4 1996-10-12 03:13:04 dfs Exp $
|
||||
$Id: COPYRIGHT,v 1.9 1998-05-06 01:51:11 dfs Exp $
|
||||
THE REMIND COPYRIGHT
|
||||
|
||||
1. REMIND refers to the entire set of files and documentation in the
|
||||
REMIND package.
|
||||
|
||||
2. REMIND is Copyright 1992-1996 by David Skoll,
|
||||
2. REMIND is Copyright 1992-1998 by David Skoll,
|
||||
except where noted in individual files.
|
||||
|
||||
3. DISTRIBUTION AND USE
|
||||
|
||||
a) REMIND may not be used under Microsoft Windows (3.0, 3.1, 95
|
||||
or NT) or any future version of Windows. Such use constitutes
|
||||
a violation of copyright.
|
||||
a) REMIND may not be used under Microsoft Windows (3.0, 3.1, 95, CE,
|
||||
or NT) or any future version of Windows or any other Microsoft
|
||||
operating system. REMIND may not be used in POSIX-like systems
|
||||
built on Windows NT. Such use constitutes a violation of copyright.
|
||||
|
||||
b) REMIND may not be used by Cadabra Design Libraries Inc. or its
|
||||
directors, nor by any of Cadabra's subsidiaries or their directors.
|
||||
Such use constitutes a violation of copyright.
|
||||
|
||||
c) Except for situations (a) and (b), REMIND may be used and
|
||||
distributed according to the terms of the GNU General Public
|
||||
License, Version 2, which follows:
|
||||
b) Except for situation (a), REMIND may be used and distributed
|
||||
according to the terms of the GNU General Public License,
|
||||
Version 2, which follows:
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
@@ -302,51 +299,6 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
ACKNOWLEDGEMENTS:
|
||||
|
||||
I would like to thank the following people:
|
||||
|
||||
Bill Aten <netagw!bill@uunet.UU.NET> for providing remind-all.sh
|
||||
|
||||
Bradley D. Keister <keister@poincare.phys.cmu.edu>, Rhys Weatherly
|
||||
rhys@batserver.cs.uq.OZ.AU> and Anthony Cheng for initially providing
|
||||
the Turbo C compiler support.
|
||||
|
||||
Dennis Cottel <dennis@peanuts.nosc.mil> for providing the patch to
|
||||
produce calendars by weeks as well as by months.
|
||||
|
||||
Bill Silvert <bill%biomel@cs.dal.ca> and Dennis Cottel
|
||||
<dennis@peanuts.nosc.mil> for suggesting many of the new features in
|
||||
REMIND.
|
||||
|
||||
Dave Wolfe <dwolfe@pffft.sps.mot.com> and Raphael Manfredi
|
||||
<ram@eiffel.com> for noticing bugs and sending me fixes.
|
||||
|
||||
Dave Rickel and George M. Sipe for sample reminders and holidays.
|
||||
|
||||
Michael Salmon for ISO encoding of PostScript output.
|
||||
|
||||
Darrel Hankerson for helping me provide some OS/2 support. Sorry
|
||||
it's not complete, Darrel!
|
||||
|
||||
Phillipp Slusallek for suggesting the -k option.
|
||||
|
||||
Amos Shapir, David W. Tamkin and Frank Yellin for help with the Hebrew
|
||||
calendar.
|
||||
|
||||
All of the language translators whose names are listed in lang.h
|
||||
|
||||
Timo Salmi, Keith Petersen, Bill Davidsen and Kent Landfield for
|
||||
maintaining the uwasa and SIMTEL archives, and comp.binaries.ibm.pc
|
||||
and comp.sources.misc in the face of a flurry of updates to REMIND.
|
||||
|
||||
All others who have corresponded with me to report bugs, express
|
||||
appreciation or suggest features - too many people to list here.
|
||||
|
||||
Finally, all those who donated money to support the production of
|
||||
REMIND. Your donations were gratefully appreciated.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca> <aa775@freenet.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
|
||||
234
Makefile
234
Makefile
@@ -1,215 +1,33 @@
|
||||
# Makefile for REMIND
|
||||
# $Id: Makefile,v 1.14 1996-10-27 21:28:03 dfs Exp $
|
||||
# Top-level Makefile for Remind.
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# THINGS FOR YOU TO EDIT START BELOW
|
||||
#-----------------------------------------------------------------------------
|
||||
# $Id: Makefile,v 1.28 1998-05-06 01:51:12 dfs Exp $
|
||||
|
||||
# Uncomment the next line if you are running on a SYSV system
|
||||
SYSV= -DSYSV
|
||||
all: src/Makefile
|
||||
@echo ""
|
||||
@echo "*******************"
|
||||
@echo "* *"
|
||||
@echo "* Building REMIND *"
|
||||
@echo "* *"
|
||||
@echo "*******************"
|
||||
@echo ""
|
||||
@cd src; $(MAKE) all LANGDEF=$(LANGDEF)
|
||||
|
||||
# Uncomment the next line if you are running under UNIX (including SYSV!)
|
||||
UNIX= -DUNIX
|
||||
|
||||
# Uncomment the next lines if you want to use gcc instead of default compiler
|
||||
# NOTE: Tempting as it may be, if you use 'cc' for the C compiler, do not
|
||||
# use 'ld' for the linker. It will probably work much better if you use
|
||||
# LD= cc rather than LD= ld.
|
||||
CC= gcc
|
||||
LD= gcc
|
||||
|
||||
# Put any additional flags for the C compiler or linker here - if you
|
||||
# are not using gcc, you probably want to remove '-ansi -pedantic -Wall'.
|
||||
CFLAGS= -O -ansi -pedantic -Wall
|
||||
CDEFS=
|
||||
LDFLAGS=
|
||||
|
||||
#### INSTALLATION LOCATIONS ####
|
||||
# Note that I use 'cp' rather than 'install' for improved portability.
|
||||
#
|
||||
# BINDIR: Where should the Remind executable be installed?
|
||||
BINDIR= /usr/local/bin
|
||||
|
||||
# SCRIPTDIR: Where should the kall and rem shell scripts be installed?
|
||||
SCRIPTDIR= /usr/local/bin
|
||||
|
||||
# MANDIR: Where should the man pages be installed?
|
||||
MANDIR= /usr/local/man
|
||||
|
||||
# MANSECT: Which man section should the man pages go into?
|
||||
MANSECT= 1
|
||||
|
||||
# EXEMODE: What file protection mode should be used for the executables?
|
||||
EXEMODE= 755
|
||||
|
||||
# MANMODE: What file protection mode should be used for the man pages?
|
||||
MANMODE= 644
|
||||
|
||||
# OWNER, GROUP: What owner and group to use for executables,
|
||||
# scripts and man pages?
|
||||
OWNER=bin
|
||||
GROUP=bin
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# YOU SHOULDN'T EDIT ANYTHING BELOW HERE. You may want to change some things
|
||||
# in config.h; then, you should be able to type 'make'.
|
||||
#-----------------------------------------------------------------------------
|
||||
VERSION= 03.00.15
|
||||
MATHLIB= -lm
|
||||
|
||||
HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
|
||||
lang.h english.h german.h dutch.h finnish.h french.h norwgian.h \
|
||||
danish.h polish.h
|
||||
|
||||
STDHDRS= config.h types.h protos.h globals.h err.h lang.h
|
||||
|
||||
LANGHDRS= english.h german.h dutch.h finnish.h french.h norwgian.h danish.h \
|
||||
polish.h portbr.h italian.h
|
||||
|
||||
SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c hbcal.c \
|
||||
init.c main.c moon.c omit.c sort.c queue.c token.c trigger.c userfns.c \
|
||||
utils.c var.c
|
||||
|
||||
MANIFEST=COPYRIGHT Makefile Makefile_QDOS README.AMIGA README.BCC \
|
||||
README.DOS README.OS2 README.UNIX README_QDOS WHATSNEW.30 \
|
||||
amiga-SCOPTIONS amiga.c calendar.c config.h danish.h defs.rem dorem.c \
|
||||
dosubst.c dutch.h english.h err.h expr.c expr.h files.c finnish.h \
|
||||
french.h funcs.c german.h globals.c globals.h hbcal.c init.c italian.h kall \
|
||||
kall.1 lang.h lnk.bcc lnk.msc lnk.tc main.c makefile.bcc makefile.msc \
|
||||
makefile.os2 makefile.tc moon.c norwgian.h omit.c os2func.c polish.h \
|
||||
protos.h queue.c rem rem.1 rem2ps.1 rem2ps.c rem2ps.h remind-all.csh \
|
||||
remind-all.sh remind.1 remind.def smakefile sort.c test-rem \
|
||||
test-rem.ami test-rem.bat test-rem.cmd test-rem.rexx test.cmp test.rem \
|
||||
test1.cmp test2.cmp tkremind tkremind.1 token.c trigger.c tstlang.rem \
|
||||
types.h userfns.c utils.c var.c version.h remind.LSM
|
||||
|
||||
OBJS= $(SRCS:.c=.o)
|
||||
|
||||
all: remind rem2ps
|
||||
|
||||
.c.o:
|
||||
$(CC) $(UNIX) $(SYSV) -c $(CFLAGS) $(CDEFS) $*.c
|
||||
|
||||
rem2ps: rem2ps.o
|
||||
$(LD) $(LDFLAGS) -o rem2ps rem2ps.o
|
||||
|
||||
remind: $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o remind $(OBJS) $(MATHLIB)
|
||||
install:
|
||||
@echo ""
|
||||
@echo "*********************"
|
||||
@echo "* *"
|
||||
@echo "* Installing REMIND *"
|
||||
@echo "* *"
|
||||
@echo "*********************"
|
||||
@echo ""
|
||||
cd src; $(MAKE) install
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ core *.bak
|
||||
find . -name '*~' -exec rm {} \;
|
||||
cd src; $(MAKE) clean
|
||||
|
||||
clobber:
|
||||
rm -f *.o *~ remind rem2ps test.out core *.bak
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status src/Makefile src/config.h
|
||||
|
||||
test: remind
|
||||
sh test-rem
|
||||
|
||||
rem2ps.o: rem2ps.c rem2ps.h lang.h config.h
|
||||
calendar.o: calendar.c $(STDHDRS) expr.h
|
||||
dorem.o: dorem.c $(STDHDRS) expr.h
|
||||
dosubst.o: dosubst.c $(STDHDRS) $(LANGHDRS)
|
||||
expr.o: expr.c $(STDHDRS) expr.h
|
||||
files.o: files.c $(STDHDRS)
|
||||
funcs.o: funcs.c $(STDHDRS) expr.h version.h
|
||||
globals.o: globals.c config.h types.h globals.h err.h lang.h $(LANGHDRS)
|
||||
hbcal.o: hbcal.c $(STDHDRS)
|
||||
init.o: init.c $(STDHDRS) expr.h version.h lang.h $(LANGHDRS)
|
||||
main.o: main.c $(STDHDRS) expr.h
|
||||
moon.o: moon.c $(STDHDRS)
|
||||
omit.o: omit.c $(STDHDRS)
|
||||
sort.o: sort.c $(STDHDRS)
|
||||
queue.o: queue.c $(STDHDRS)
|
||||
token.o: token.c $(STDHDRS)
|
||||
trigger.o: trigger.c $(STDHDRS) expr.h
|
||||
userfns.o: userfns.c $(STDHDRS) expr.h
|
||||
utils.o: utils.c $(STDHDRS)
|
||||
var.o: var.c $(STDHDRS) expr.h
|
||||
|
||||
# Some of these targets are just for my convenience and
|
||||
# probably won't be too useful to you! -- dfs
|
||||
|
||||
tgz:
|
||||
-rm -rf remind-$(VERSION)
|
||||
-mkdir remind-$(VERSION)
|
||||
cd remind-$(VERSION); for i in $(MANIFEST) ;do ln -s ../$$i .; done; cd ..
|
||||
tar -c -h -v -f remind-3.0.15.tar remind-$(VERSION)
|
||||
gzip -v -9 remind-3.0.15.tar
|
||||
mv remind-3.0.15.tar.gz remind-3.0.15.tgz
|
||||
rm -rf remind-$(VERSION)
|
||||
|
||||
shar:
|
||||
shar -o./Shar -sdfs@doe.carleton.ca -a -c -n"Remind $(VERSION)" -m -l58 -o./Shar $(MANIFEST)
|
||||
|
||||
backup:
|
||||
tar cvzf ../rbackup.tgz $(MANIFEST)
|
||||
|
||||
zip:
|
||||
zip ../rbackup.zip $(MANIFEST)
|
||||
|
||||
todos:
|
||||
rm -rf DOS
|
||||
mkdir DOS
|
||||
for i in $(MANIFEST) ; do todos < $$i > DOS/$$i; done
|
||||
|
||||
transmit:
|
||||
sz -a -e $(MANIFEST)
|
||||
|
||||
install: install-bin install-scripts install-man
|
||||
|
||||
install-bin: remind rem2ps
|
||||
cp remind $(BINDIR)/remind
|
||||
-chmod $(EXEMODE) $(BINDIR)/remind
|
||||
-chown $(OWNER) $(BINDIR)/remind
|
||||
-chgrp $(GROUP) $(BINDIR)/remind
|
||||
cp rem2ps $(BINDIR)/rem2ps
|
||||
-chmod $(EXEMODE) $(BINDIR)/rem2ps
|
||||
-chown $(OWNER) $(BINDIR)/rem2ps
|
||||
-chgrp $(GROUP) $(BINDIR)/rem2ps
|
||||
|
||||
install-scripts:
|
||||
cp kall $(SCRIPTDIR)/kall
|
||||
-chmod $(EXEMODE) $(SCRIPTDIR)/kall
|
||||
-chown $(OWNER) $(SCRIPTDIR)/kall
|
||||
-chgrp $(GROUP) $(SCRIPTDIR)/kall
|
||||
cp rem $(SCRIPTDIR)/rem
|
||||
-chmod $(EXEMODE) $(SCRIPTDIR)/rem
|
||||
-chown $(OWNER) $(SCRIPTDIR)/rem
|
||||
-chgrp $(GROUP) $(SCRIPTDIR)/rem
|
||||
cp tkremind $(SCRIPTDIR)/tkremind
|
||||
-chmod $(EXEMODE) $(SCRIPTDIR)/tkremind
|
||||
-chown $(OWNER) $(SCRIPTDIR)/tkremind
|
||||
-chgrp $(GROUP) $(SCRIPTDIR)/tkremind
|
||||
|
||||
install-man:
|
||||
cp remind.1 $(MANDIR)/man$(MANSECT)/remind.$(MANSECT)
|
||||
-chmod $(MANMODE) $(MANDIR)/man$(MANSECT)/remind.$(MANSECT)
|
||||
-chown $(OWNER) $(MANDIR)/man$(MANSECT)/remind.$(MANSECT)
|
||||
-chgrp $(GROUP) $(MANDIR)/man$(MANSECT)/remind.$(MANSECT)
|
||||
cp tkremind.1 $(MANDIR)/man$(MANSECT)/tkremind.$(MANSECT)
|
||||
-chmod $(MANMODE) $(MANDIR)/man$(MANSECT)/tkremind.$(MANSECT)
|
||||
-chown $(OWNER) $(MANDIR)/man$(MANSECT)/tkremind.$(MANSECT)
|
||||
-chgrp $(GROUP) $(MANDIR)/man$(MANSECT)/tkremind.$(MANSECT)
|
||||
cp rem.1 $(MANDIR)/man$(MANSECT)/rem.$(MANSECT)
|
||||
-chmod $(MANMODE) $(MANDIR)/man$(MANSECT)/rem.$(MANSECT)
|
||||
-chown $(OWNER) $(MANDIR)/man$(MANSECT)/rem.$(MANSECT)
|
||||
-chgrp $(GROUP) $(MANDIR)/man$(MANSECT)/rem.$(MANSECT)
|
||||
cp kall.1 $(MANDIR)/man$(MANSECT)/kall.$(MANSECT)
|
||||
-chmod $(MANMODE) $(MANDIR)/man$(MANSECT)/kall.$(MANSECT)
|
||||
-chown $(OWNER) $(MANDIR)/man$(MANSECT)/kall.$(MANSECT)
|
||||
-chgrp $(GROUP) $(MANDIR)/man$(MANSECT)/kall.$(MANSECT)
|
||||
cp rem2ps.1 $(MANDIR)/man$(MANSECT)/rem2ps.$(MANSECT)
|
||||
-chmod $(MANMODE) $(MANDIR)/man$(MANSECT)/rem2ps.$(MANSECT)
|
||||
-chown $(OWNER) $(MANDIR)/man$(MANSECT)/rem2ps.$(MANSECT)
|
||||
-chgrp $(GROUP) $(MANDIR)/man$(MANSECT)/rem2ps.$(MANSECT)
|
||||
|
||||
release:
|
||||
-mkdir RELEASE
|
||||
-rm -f RELEASE/*
|
||||
mkpatch ../prev . patch.15 Shar "Remind-3.0/Patch-15/part"
|
||||
mv Shar* RELEASE
|
||||
rm -f patch.15*
|
||||
for i in *.1; do nroff -man $$i | sed -e 's/_//g' > `basename $$i .1`.man; done
|
||||
mv *.man RELEASE
|
||||
for i in *.1; do groff -man -Tps $$i > `basename $$i .1`.ps; done
|
||||
mv *.ps RELEASE
|
||||
src/Makefile: src/Makefile.in
|
||||
./configure
|
||||
|
||||
34
README
Normal file
34
README
Normal file
@@ -0,0 +1,34 @@
|
||||
REMIND
|
||||
|
||||
Remind is a full-featured calendar/alarm program. Copying policy is
|
||||
in the file "COPYRIGHT" in this directory.
|
||||
|
||||
Installation notes for various operating systems are in "docs". See
|
||||
the appropriate README file for installation on your system.
|
||||
|
||||
Manual pages are in "man".
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Quick UNIX installation instructions for the very impatient:
|
||||
|
||||
If you have Tcl/Tk (wish 4.1 or higher) installed and are running X Windows:
|
||||
--------------------------------------------------------------
|
||||
|
||||
1) Type: wish ./build.tk from this directory. Fill in the various
|
||||
options and hit "Build Remind"
|
||||
|
||||
2) Type: "make install" -- you may need to be root to do this.
|
||||
|
||||
If you do NOT have Tcl/Tk or are NOT running X Windows:
|
||||
-------------------------------------------------------
|
||||
|
||||
1) Edit the file "src/custom.h" according to your preferences.
|
||||
|
||||
2) Edit the file "src/lang.h" to choose a language.
|
||||
|
||||
3) Type: "make"
|
||||
|
||||
4) Type: "make install" -- you may need to be root to do this.
|
||||
|
||||
$Id: README,v 1.4 1998-01-19 03:24:03 dfs Exp $
|
||||
57
README.AMIGA
57
README.AMIGA
@@ -1,57 +0,0 @@
|
||||
$Id: README.AMIGA,v 1.1 1996-03-31 04:01:52 dfs Exp $
|
||||
REMIND version 3.0 for AmigaDOS
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the man page, "remind.1".
|
||||
|
||||
1 - Read the file COPYRIGHT.
|
||||
|
||||
2 - Examine the file config.h and adjust parameters as needed
|
||||
|
||||
3 - If you are using SAS/C to compile Remind, type:
|
||||
|
||||
copy amiga-SCOPTIONS SCOPTIONS
|
||||
smake -f smakefile
|
||||
|
||||
This will create remind, which is ready to be executed.
|
||||
|
||||
The file "defs.rem" has some sample Remind definitions and commands,
|
||||
as well as U.S. and Jewish holidays.
|
||||
|
||||
OTHER LANGUAGE SUPPORT
|
||||
|
||||
Remind has support for languages other than English. See the file
|
||||
"lang.h" for details. The language support may vary - you can change
|
||||
only the substitution filter, or you can translate all of the usage
|
||||
instructions and error messages as well. See "french.h" for an example.
|
||||
|
||||
If you add support for a non-English language, Remind will accept both the
|
||||
English and non-English names of months and weekdays in an input script.
|
||||
However, you should not rely on this feature if you want to write portable
|
||||
Remind scripts.
|
||||
|
||||
At a minimum, you should support month and day names in the foreign
|
||||
language, and should modify the substitution filter appropriately.
|
||||
If you are truly diligent, you can translate usage and error messages
|
||||
too.
|
||||
|
||||
Take a look at the files "english.h" and "german.h" if you want to add
|
||||
support for your favourite language. If you do add another language
|
||||
to Remind, please let me know! Here are the basic guidelines:
|
||||
|
||||
- Your language file should be called "lxxx.h", where lxxx is the first 8
|
||||
characters of the ENGLISH name of your language.
|
||||
|
||||
- You should define L_LANGNAME to be the full English name of your language,
|
||||
with the first letter capitalized and the rest lower-case.
|
||||
|
||||
[Please note: I CANNOT SUPPORT THE AMIGA VERSION!]
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
65
README.BCC
65
README.BCC
@@ -1,65 +0,0 @@
|
||||
$Id: README.BCC,v 1.1 1996-03-27 03:25:48 dfs Exp $
|
||||
REMIND version 3.0 for Borland C++
|
||||
|
||||
1 - Read the file COPYRIGHT. (This may be called COPYRIGH on your
|
||||
MS-DOS system.)
|
||||
|
||||
2 - You must use the Borland C++ OS/2 or MSDOS/Windows compiler.
|
||||
|
||||
3 - Examine the file config.h and adjust parameters as needed
|
||||
|
||||
4 - Examine the file makefile.bcc and adjust parameters as needed.
|
||||
|
||||
5 - Type:
|
||||
|
||||
make -f makefile.bcc
|
||||
|
||||
This will make 'remind.exe' and 'rem2ps.exe' in the ..\os2-ex or ..\msdos-ex
|
||||
directories.
|
||||
|
||||
The file "defs.rem" has some sample Remind definitions and commands,
|
||||
as well as U.S. and Jewish holidays.
|
||||
|
||||
NOTE that I do not have access to an OS/2 system, so support for this
|
||||
system may not be as good as I'd like.
|
||||
|
||||
OS/2 support is courtesy of Russ Herman <rwh@gov.on.ca>, Norman Walsh
|
||||
<norm@ora.com>, and Darrel Hankerson <hankedr@mail.auburn.edu>.
|
||||
However, if you have problems, please contact me.
|
||||
|
||||
OTHER LANGUAGE SUPPORT
|
||||
|
||||
Remind has support for languages other than English. See the file
|
||||
"lang.h" for details. The language support may vary - you can change
|
||||
only the substitution filter, or you can translate all of the usage
|
||||
instructions and error messages as well. See "french.h" for an
|
||||
example of the latter.
|
||||
|
||||
If you add support for a non-English language, Remind will accept both the
|
||||
English and non-English names of months and weekdays in an input script.
|
||||
However, you should not rely on this feature if you want to write portable
|
||||
Remind scripts.
|
||||
|
||||
At a minimum, you should support month and day names in the foreign
|
||||
language, and should modify the substitution filter appropriately.
|
||||
If you are truly diligent, you can translate usage and error messages
|
||||
too.
|
||||
|
||||
Take a look at the files "english.h" and "german.h" if you want to add
|
||||
support for your favourite language. If you do add another language
|
||||
to Remind, please let me know! Here are the basic guidelines:
|
||||
|
||||
- Your language file should be called "lxxx.h", where lxxx is the first 8
|
||||
characters of the ENGLISH name of your language.
|
||||
|
||||
- You should define L_LANGNAME to be the full English name of your language,
|
||||
with the first letter capitalized and the rest lower-case.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
62
README.DOS
62
README.DOS
@@ -1,62 +0,0 @@
|
||||
$Id: README.DOS,v 1.2 1996-10-12 02:59:06 dfs Exp $
|
||||
REMIND version 3.0 for MS-DOS
|
||||
|
||||
IMPORTANT NOTE: I'm no longer officially supporting Remind under
|
||||
DOS. It may very well work, but if it doesn't... you're on your own.
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the man page, "remind.1".
|
||||
|
||||
1 - Read the file COPYRIGHT. (This may be called COPYRIGH on your
|
||||
MS-DOS system.)
|
||||
|
||||
2 - Examine the file config.h and adjust parameters as needed
|
||||
|
||||
3 - If you are using Turbo C to compile Remind, type:
|
||||
|
||||
make -fmakefile.tc
|
||||
|
||||
If you are using Microsoft C to compile Remind, type:
|
||||
|
||||
make makefile.msc
|
||||
|
||||
This will create REMIND.EXE, which is ready to be executed.
|
||||
|
||||
The file "defs.rem" has some sample Remind definitions and commands,
|
||||
as well as U.S. and Jewish holidays.
|
||||
|
||||
OTHER LANGUAGE SUPPORT
|
||||
|
||||
Remind has support for languages other than English. See the file
|
||||
"lang.h" for details. The language support may vary - you can change
|
||||
only the substitution filter, or you can translate all of the usage
|
||||
instructions and error messages as well. See "french.h" for an example.
|
||||
|
||||
If you add support for a non-English language, Remind will accept both the
|
||||
English and non-English names of months and weekdays in an input script.
|
||||
However, you should not rely on this feature if you want to write portable
|
||||
Remind scripts.
|
||||
|
||||
At a minimum, you should support month and day names in the foreign
|
||||
language, and should modify the substitution filter appropriately.
|
||||
If you are truly diligent, you can translate usage and error messages
|
||||
too.
|
||||
|
||||
Take a look at the files "english.h" and "german.h" if you want to add
|
||||
support for your favourite language. If you do add another language
|
||||
to Remind, please let me know! Here are the basic guidelines:
|
||||
|
||||
- Your language file should be called "lxxx.h", where lxxx is the first 8
|
||||
characters of the ENGLISH name of your language.
|
||||
|
||||
- You should define L_LANGNAME to be the full English name of your language,
|
||||
with the first letter capitalized and the rest lower-case.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
147
README.UNIX
147
README.UNIX
@@ -1,147 +0,0 @@
|
||||
$Id: README.UNIX,v 1.2 1996-10-12 02:59:06 dfs Exp $
|
||||
REMIND version 3.0 for UNIX
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the man page, "remind.1".
|
||||
|
||||
1 - Read the file COPYRIGHT.
|
||||
|
||||
2- Before compiling the software, check to see if it includes patches.
|
||||
These are files called patch.xx. If there are patches, apply them all
|
||||
by typing:
|
||||
|
||||
cat patch.* | patch
|
||||
|
||||
3 - Examine the Makefile and change any parameters which need to be
|
||||
changed for your system. As it stands, the Makefile is set up for a
|
||||
Linux system.
|
||||
|
||||
4 - Examine the file config.h and adjust parameters as needed
|
||||
|
||||
5 - Examine lang.h and choose the language you want Remind to use.
|
||||
(You can do this on the "make" command-line -- see "OTHER
|
||||
LANGUAE SUPPORT.)
|
||||
|
||||
6 - Type 'make'
|
||||
|
||||
7 - Type 'sh test-rem' or 'make test' to run the acceptance test. Note
|
||||
that the test script works only for the English version of Remind.
|
||||
|
||||
8 - Type 'make install' to install Remind, kall, rem and the man
|
||||
pages.
|
||||
|
||||
Two shell scripts, "remind-all.csh" and "remind-all.sh" are provided.
|
||||
These allow automatic mailing of reminders to all users who create a
|
||||
$HOME/.reminders file. These two scripts are equivalent; one is a
|
||||
"sh" script and the other is a "csh" script. Pick the one you want to
|
||||
use, and follow the instructions in the opening comments of the
|
||||
script.
|
||||
|
||||
*** NOTE *** Please be aware that "remind-all.csh" and "remind-all.sh"
|
||||
have been changed since version 03.00.05 of Remind. If you install
|
||||
the new remind executable, make sure you switch over to the new
|
||||
"remind-all" scripts.
|
||||
|
||||
A shell script called "rem" is provided for those who like to have
|
||||
'remind' assume a default reminders file. A man page for this script
|
||||
is provided. You should examine the script to ensure that the defaults
|
||||
are correct.
|
||||
|
||||
Many people have asked me why I supply the "rem" script instead of
|
||||
having Remind assume a default file. The answer is: That's how I like
|
||||
it! My personal preference is for a program which normally takes
|
||||
parameters to display usage information when invoked with no
|
||||
parameters. I like that behaviour so I can quickly get an idea of
|
||||
what a program does without poring through the man page. And I think
|
||||
I'll keep Remind that way. Sorry to all who dislike it. :-)
|
||||
|
||||
A shell script called "kall" is provided so you can kill your background
|
||||
remind processes when you log out. See the man page. Note that kall
|
||||
depends on the output of "ps", and may not be portable.
|
||||
|
||||
The file "defs.rem" has some sample Remind definitions and commands,
|
||||
as well as U.S. and Jewish holidays.
|
||||
|
||||
OTHER LANGUAGE SUPPORT
|
||||
|
||||
Remind has support for languages other than English. See the file
|
||||
"lang.h" for details. The language support may vary - you can change
|
||||
only the substitution filter, or you can translate all of the usage
|
||||
instructions and error messages as well. See "french.h" for an
|
||||
example of the latter.
|
||||
|
||||
To compile Remind for a non-english language, look at the constants
|
||||
defined in "lang.h". Then, to compile Remind for Italian (as an
|
||||
example), type:
|
||||
|
||||
make "CDEFS=-DLANG=ITALIAN"
|
||||
|
||||
If you add support for a non-English language, Remind will accept both the
|
||||
English and non-English names of months and weekdays in an input script.
|
||||
However, you should not rely on this feature if you want to write portable
|
||||
Remind scripts.
|
||||
|
||||
At a minimum, you should support month and day names in the foreign
|
||||
language, and should modify the substitution filter appropriately.
|
||||
If you are truly diligent, you can translate usage and error messages
|
||||
too.
|
||||
|
||||
Take a look at the files "english.h" and "german.h" if you want to add
|
||||
support for your favourite language. If you do add another language
|
||||
to Remind, please let me know! Here are the basic guidelines:
|
||||
|
||||
- Your language file should be called "lxxx.h", where lxxx is the first 8
|
||||
characters of the ENGLISH name of your language.
|
||||
|
||||
- Your language file should define L_LANGNAME to be the full English
|
||||
name of your language, with the first letter capitalized and the rest
|
||||
lower-case.
|
||||
|
||||
RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
|
||||
|
||||
1. POPUP REMINDERS
|
||||
|
||||
If you're running under X-Windows and you have the TCL tools,
|
||||
you can create simple pop-up reminders by creating the following
|
||||
TCL script called 'popup'. It pops a message on to the screen and
|
||||
waits for you to press the 'OK' button. If you don't press the OK button
|
||||
within 15 seconds, it exits anyway. To use it, you can use the '-k' option
|
||||
for Remind as follows:
|
||||
|
||||
remind "-kpopup '%s'&" .reminders
|
||||
|
||||
Or use the following in your Remind script:
|
||||
|
||||
REM AT 17:00 RUN popup 'Time to go home.' &
|
||||
|
||||
This TCL script is a slightly modified version of one submitted by
|
||||
Norman Walsh. TCL is available via FTP at ftp.uu.net in /languages/tcl.
|
||||
|
||||
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
|
||||
#!/usr/local/bin/wish -f
|
||||
|
||||
wm withdraw .
|
||||
|
||||
if { [ llength $argv ] == 1 } {
|
||||
eval set msg $argv
|
||||
} else {
|
||||
eval set msg [ list $argv ]
|
||||
}
|
||||
|
||||
after 15000 { destroy . ; exit }
|
||||
|
||||
tk_dialog .d { Message } $msg warning 0 { OK }
|
||||
|
||||
destroy .
|
||||
|
||||
exit
|
||||
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
|
||||
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
95
README_QDOS
95
README_QDOS
@@ -1,95 +0,0 @@
|
||||
$Id: README_QDOS,v 1.3 1996-09-28 18:17:07 dfs Exp $
|
||||
REMIND version 3.0.15 for QDOS / SMSQ
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the documentation file, "remind_doc" (QUILL format).
|
||||
[Note from David Skoll -- I was not sent the file `remind_doc', so
|
||||
you're on your own here. You'll have to use the UNIX man pages.]
|
||||
|
||||
1 - Read the file COPYRIGHT.
|
||||
|
||||
2 - Do NOT redistribute Remind WITHOUT the sources!
|
||||
|
||||
3 - Examine the Makefile and change any parameters which need to be
|
||||
changed for your system. (The makefile for QDOS / SMSQ is
|
||||
makefile_QDOS).
|
||||
|
||||
4 - Examine the file config_h and adjust parameters as needed
|
||||
|
||||
5 - Examine lang_h and choose the language you want Remind to use.
|
||||
There has no effort been put in making the language modules working
|
||||
on the QL. You'll have to adjust the files for yourself to get
|
||||
them working (umlauts etc).
|
||||
|
||||
6 - Execute "make;'-fMakefile_QDOS'". Be sure, that your DATA_DEFAULT
|
||||
directory is the directory where the remind source files are
|
||||
placed.
|
||||
|
||||
7 - There is an acceptance test for other systems. If you want to
|
||||
test remind on your QDOS / SMSQ system execute the following
|
||||
commands from your command line:
|
||||
SETENV "TEST_GETENV=foo bar baz"
|
||||
ex datad$&'remind';'-e -dxte test_rem 16 feb 1991 > test_out'
|
||||
ex diff;'test_out test_cmp >test_diff'
|
||||
Then check the output of diff. You will find lots of differences.
|
||||
If there are other than differences in the filename
|
||||
(supplied test-result: ./test.rem, QDOS result: test_rem) and
|
||||
in the ostype (supplied: UNIX, QDOS: QDOS / SMSQ) Remind does
|
||||
not work correctly.
|
||||
|
||||
|
||||
The file "defs_rem" has some sample Remind definitions and commands,
|
||||
as well as U.S. and Jewish holidays. You should delete the definitions
|
||||
for ANSI colours as the QL does not support the ANSI standard.
|
||||
|
||||
|
||||
OTHER LANGUAGE SUPPORT
|
||||
|
||||
Remind has support for languages other than English. See the file
|
||||
"lang_h" for details. The language support may vary - you can change
|
||||
only the substitution filter, or you can translate all of the usage
|
||||
instructions and error messages as well. See "french_h" for an
|
||||
example of the latter.
|
||||
|
||||
If you add support for a non-English language, Remind will accept both the
|
||||
English and non-English names of months and weekdays in an input script.
|
||||
However, you should not rely on this feature if you want to write portable
|
||||
Remind scripts.
|
||||
|
||||
At a minimum, you should support month and day names in the foreign
|
||||
language, and should modify the substitution filter appropriately.
|
||||
If you are truly diligent, you can translate usage and error messages
|
||||
too.
|
||||
|
||||
Take a look at the files "english_h" and "german_h" if you want to add
|
||||
support for your favourite language. If you do add another language
|
||||
to Remind, please let me know! Here are the basic guidelines:
|
||||
|
||||
- Your language file should be called "lxxx_h", where lxxx is the first 8
|
||||
characters of the ENGLISH name of your language.
|
||||
|
||||
- Your language file should define L_LANGNAME to be the full English
|
||||
name of your language, with the first letter capitalized and the rest
|
||||
lower-case.
|
||||
|
||||
RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
|
||||
|
||||
The QDOS / SMSQ version does not support the enhanced features of
|
||||
the UNIX and/or OS/2 versions.
|
||||
|
||||
I had some problems with the sunrise() and sunset() functions,
|
||||
but didn't examine it.
|
||||
|
||||
I've ported Remind on a SMSQ/SGC system. It should work on other
|
||||
systems without problems. The compiler used was C68 v4.14c.
|
||||
|
||||
Remind should work with each QL or compatible with 512K or more RAM.
|
||||
It'll however NOT work on a standard QL due to it's code size.
|
||||
|
||||
Any problems with the QDOS / SMSQ versions should be sent to:
|
||||
|
||||
Robert H. Klein
|
||||
Bluecherstrasse 24
|
||||
D-56349 Kaub
|
||||
|
||||
Germany
|
||||
751
build.tk
Executable file
751
build.tk
Executable file
@@ -0,0 +1,751 @@
|
||||
#!/bin/sh
|
||||
# -*-Mode: TCL;-*-
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# BUILD.TK
|
||||
#
|
||||
# A cheesy graphical front-end for building and installing REMIND.
|
||||
#
|
||||
# This file is part of REMIND.
|
||||
# Copyright (C) 1992-1998 by David F. Skoll
|
||||
#
|
||||
#--------------------------------------------------------------
|
||||
|
||||
# $Id: build.tk,v 1.6 1998-03-01 21:03:36 dfs Exp $
|
||||
|
||||
# the next line restarts using wish \
|
||||
exec wish "$0" "$@"
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: SetConfigDefaults
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Sets up default values for various parameters.
|
||||
#***********************************************************************
|
||||
proc SetConfigDefaults {} {
|
||||
global Config
|
||||
set Config(LAT_DEG) 45
|
||||
set Config(LAT_MIN) 24
|
||||
set Config(LON_DEG) 75
|
||||
set Config(LON_MIN) 39
|
||||
set Config(LOCATION) "Ottawa"
|
||||
set Config(DEFAULT_PAGE) "Letter"
|
||||
set Config(DATESEP) "/"
|
||||
set Config(TIMESEP) ":"
|
||||
set Config(ISOLATIN1) 0
|
||||
set Config(IBMEXTENDED) 0
|
||||
set Config(ISOLATIN2) 0
|
||||
set Config(IBM852) 0
|
||||
set Config(NORTHERN_HEMISPHERE) 1
|
||||
set Config(WESTERN_HEMISPHERE) 1
|
||||
set Config(LANGUAGE) "English"
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: Bail
|
||||
# %ARGUMENTS:
|
||||
# msg -- a message
|
||||
# %RETURNS:
|
||||
# Does not return
|
||||
# %DESCRIPTION:
|
||||
# Pops up an error dialog; then calls exit.
|
||||
#***********************************************************************
|
||||
proc Bail { msg } {
|
||||
tk_dialog .err "Remind Configuration Error" $msg error 0 "Bummer"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CheckSanity
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Checks sanity of install dir -- checks for critical files,
|
||||
# warns user if something looks wrong.
|
||||
#***********************************************************************
|
||||
proc CheckSanity {} {
|
||||
if {![file executable ./configure]} {
|
||||
wm withdraw .
|
||||
Bail "I can't seem to execute the file ./configure -- make sure you have all required files and are running this from the top-level Remind directory"
|
||||
}
|
||||
if {![file readable ./src/custom.h.in]} {
|
||||
wm withdraw .
|
||||
Bail "I can't seem to find the file src/custom.h.in -- make sure you have all required files and are running this from the top-level Remind directory"
|
||||
}
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CreateMainDialog
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Creates and displays the main configuration dialog
|
||||
#***********************************************************************
|
||||
proc CreateMainDialog {} {
|
||||
global Instdir Loc Options
|
||||
|
||||
wm title . "Remind Configuration"
|
||||
wm iconname . "Remind Config"
|
||||
|
||||
SetConfigDefaults
|
||||
tabnotebook_create .tn
|
||||
|
||||
set Instdir [tabnotebook_page .tn "Installation Directories"]
|
||||
CreateInstallDirDialog $Instdir
|
||||
|
||||
set Loc [tabnotebook_page .tn "Location"]
|
||||
CreateLocationDialog $Loc
|
||||
|
||||
set Options [tabnotebook_page .tn "Options"]
|
||||
CreateOptionsDialog $Options
|
||||
pack .tn -side top -expand 1 -fill both
|
||||
|
||||
frame .buttons
|
||||
button .build -text "Build Remind" -command BuildRemind
|
||||
button .cancel -text "Cancel" -command exit
|
||||
|
||||
pack .build .cancel -in .buttons -side left -expand 1 -fill both
|
||||
pack .buttons -side top -expand 0 -fill x
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CreateInstallDirDialog
|
||||
# %ARGUMENTS:
|
||||
# w -- frame containing widgets
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Creates the "installation directories" dialog.
|
||||
#***********************************************************************
|
||||
proc CreateInstallDirDialog { w } {
|
||||
label $w.binlabel -text "Location for programs: "
|
||||
entry $w.bin -width 30
|
||||
$w.bin insert end "/usr/local/bin"
|
||||
|
||||
label $w.manlabel -text "Location for man pages: "
|
||||
entry $w.man -width 30
|
||||
$w.man insert end "/usr/local/man"
|
||||
|
||||
text $w.blurb -width 1 -height 5 -wrap word -relief flat -takefocus 0
|
||||
$w.blurb insert end "\n(Tabbed-notebook Tcl code taken from \"Effective Tcl/Tk Programming\" by Mark Harrison and Michael McLennan, Addison-Wesley Professional Computing Series.)"
|
||||
$w.blurb configure -state disabled
|
||||
# Disable all text-window behaviour
|
||||
bindtags $w.blurb {NoSuchTag}
|
||||
grid $w.binlabel -row 0 -column 0 -sticky e
|
||||
grid $w.bin -row 0 -column 1 -sticky nsew
|
||||
grid $w.manlabel -row 1 -column 0 -sticky e
|
||||
grid $w.man -row 1 -column 1 -sticky nsew
|
||||
grid $w.blurb - -sticky nsew
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CreateLocationDialog
|
||||
# %ARGUMENTS:
|
||||
# w -- frame containing dialog
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Creates the location dialog
|
||||
#***********************************************************************
|
||||
proc CreateLocationDialog { w } {
|
||||
global Config
|
||||
scale $w.latdeg -label "Latitude (degrees)" -orient horizontal \
|
||||
-from 0 -to 89 -length 300 -variable Config(LAT_DEG)
|
||||
scale $w.latmin -label "Latitude (minutes)" -orient horizontal \
|
||||
-from 0 -to 59 -length 300 -variable Config(LAT_MIN)
|
||||
scale $w.londeg -label "Longitude (degrees)" -orient horizontal \
|
||||
-from 0 -to 179 -length 300 -variable Config(LON_DEG)
|
||||
scale $w.lonmin -label "Longtude (minutes)" -orient horizontal \
|
||||
-from 0 -to 59 -length 300 -variable Config(LON_MIN)
|
||||
|
||||
radiobutton $w.north -text "Northern Hemisphere" \
|
||||
-variable Config(NORTHERN_HEMISPHERE) -value 1
|
||||
radiobutton $w.south -text "Southern Hemisphere" \
|
||||
-variable Config(NORTHERN_HEMISPHERE) -value 0
|
||||
radiobutton $w.west -text "Western Hemisphere" \
|
||||
-variable Config(WESTERN_HEMISPHERE) -value 1
|
||||
radiobutton $w.east -text "Eastern Hemisphere" \
|
||||
-variable Config(WESTERN_HEMISPHERE) -value 0
|
||||
|
||||
label $w.loclab -text "City or Town: "
|
||||
entry $w.location -width 20
|
||||
$w.location insert end $Config(LOCATION)
|
||||
grid $w.latdeg -
|
||||
grid $w.latmin -
|
||||
grid $w.londeg -
|
||||
grid $w.lonmin -
|
||||
|
||||
grid $w.north $w.west
|
||||
grid $w.south $w.east
|
||||
grid $w.loclab -sticky e
|
||||
grid $w.location -sticky nsew -row 6 -column 1
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CreateOptionsDialog
|
||||
# %ARGUMENTS:
|
||||
# w -- frame containing dialog
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Creates the options dialog
|
||||
#***********************************************************************
|
||||
proc CreateOptionsDialog { w } {
|
||||
global Config
|
||||
|
||||
label $w.pagelabel -text "Default page size: "
|
||||
menubutton $w.page -text $Config(DEFAULT_PAGE) \
|
||||
-indicatoron 1 -relief raised \
|
||||
-menu $w.page.menu
|
||||
menu $w.page.menu -tearoff 0
|
||||
$w.page.menu add command -label "Letter" \
|
||||
-command "$w.page configure -text Letter"
|
||||
$w.page.menu add command -label "A4" -command "$w.page configure -text A4"
|
||||
|
||||
grid configure $w.pagelabel -row 0 -column 0 -sticky e
|
||||
grid configure $w.page -row 0 -column 1 -sticky nsew
|
||||
|
||||
label $w.datelabel -text "Default date separator: "
|
||||
menubutton $w.date -text $Config(DATESEP) -indicatoron 1 -relief raised \
|
||||
-menu $w.date.menu
|
||||
menu $w.date.menu -tearoff 0
|
||||
$w.date.menu add command -label "/" -command "$w.date configure -text /"
|
||||
$w.date.menu add command -label "-" -command "$w.date configure -text -"
|
||||
|
||||
grid configure $w.datelabel -row 1 -column 0 -sticky e
|
||||
grid configure $w.date -row 1 -column 1 -sticky nsew
|
||||
|
||||
label $w.timelabel -text "Default time separator: "
|
||||
menubutton $w.time -text $Config(TIMESEP) -indicatoron 1 -relief raised \
|
||||
-menu $w.time.menu
|
||||
menu $w.time.menu -tearoff 0
|
||||
$w.time.menu add command -label ":" -command "$w.time configure -text :"
|
||||
$w.time.menu add command -label "." -command "$w.time configure -text ."
|
||||
|
||||
grid configure $w.timelabel -row 2 -column 0 -sticky e
|
||||
grid configure $w.time -row 2 -column 1 -sticky nsew
|
||||
|
||||
label $w.charlabel -text "Character set: "
|
||||
menubutton $w.char -text "ISO 8859-1" -indicatoron 1 -relief raised \
|
||||
-menu $w.char.menu
|
||||
menu $w.char.menu -tearoff 0
|
||||
$w.char.menu add command -label "ISO 8859-1" -command "$w.char configure -text {ISO 8859-1}"
|
||||
$w.char.menu add command -label "ISO 8859-2" -command "$w.char configure -text {ISO 8859-2}"
|
||||
$w.char.menu add command -label "IBM Extended" -command "$w.char configure -text {IBM Extended}"
|
||||
$w.char.menu add command -label "IBM CPI-852" -command "$w.char configure -text {ISO 8859-2}"
|
||||
$w.char.menu add command -label "Plain ASCII" -command "$w.char configure -text {Plain ASCII}"
|
||||
|
||||
grid configure $w.charlabel -row 3 -column 0 -sticky e
|
||||
grid configure $w.char -row 3 -column 1 -sticky nsew
|
||||
|
||||
label $w.langlabel -text "Language: "
|
||||
menubutton $w.lang -text $Config(LANGUAGE) -indicatoron 1 -relief raised \
|
||||
-menu $w.lang.menu
|
||||
menu $w.lang.menu -tearoff 0
|
||||
foreach lang {
|
||||
"Brazilian Portuguese"
|
||||
"Danish"
|
||||
"Dutch"
|
||||
"English"
|
||||
"Finnish"
|
||||
"French"
|
||||
"German"
|
||||
"Italian"
|
||||
"Norwegian"
|
||||
"Polish"
|
||||
"Romanian"
|
||||
} {
|
||||
$w.lang.menu add command -label $lang -command [list $w.lang configure -text $lang]
|
||||
}
|
||||
|
||||
grid configure $w.langlabel -row 4 -column 0 -sticky e
|
||||
grid configure $w.lang -row 4 -column 1 -sticky nsew
|
||||
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: BuildRemind
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Builds Remind by:
|
||||
# -- creating custom.h from custom.h.in
|
||||
# -- running ./configure
|
||||
# -- running make
|
||||
#***********************************************************************
|
||||
proc BuildRemind {} {
|
||||
pack forget .tn
|
||||
pack forget .buttons
|
||||
wm title . "Remind Configuration Status"
|
||||
text .msgs -width 80 -height 25 -wrap char -yscrollcommand ".sb set"
|
||||
scrollbar .sb -orient vertical -command ".msgs yview"
|
||||
|
||||
.msgs tag configure green -foreground #005500
|
||||
.msgs tag configure red -foreground #990000
|
||||
pack .msgs -side left -expand 1 -fill both
|
||||
pack .sb -side left -expand 0 -fill y
|
||||
|
||||
update
|
||||
|
||||
.msgs insert end "\n>>> Creating src/custom.h...\n\n" green
|
||||
CreateCustomH
|
||||
.msgs insert end ">>> Calling `./configure'...\n\n" green
|
||||
CallConfigure
|
||||
.msgs insert end ">>> Calling `make'...\n\n" green
|
||||
CallMake
|
||||
.msgs insert end "\n----------------------------------------------\n\n"
|
||||
.msgs insert end "Remind" red
|
||||
.msgs insert end " has been built. To install it, type:\n\n"
|
||||
.msgs insert end "make install\n\n" green
|
||||
.msgs insert end "from the top-level "
|
||||
.msgs insert end "Remind" red
|
||||
.msgs insert end " directory. (You may need to be root.)\n\n"
|
||||
.msgs insert end "After it's installed, create an empty file called:\n"
|
||||
.msgs insert end " \$HOME/.reminders\n" green
|
||||
.msgs insert end "and type "
|
||||
.msgs insert end "tkremind" green
|
||||
.msgs insert end " for a nice easy introduction to "
|
||||
.msgs insert end "Remind.\n\n" red
|
||||
.msgs insert end "Press me to exit --> "
|
||||
button .msgs.ok -text "OK" -command "exit"
|
||||
.msgs window create end -window .msgs.ok
|
||||
.msgs see end
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: RunCommand
|
||||
# %ARGUMENTS:
|
||||
# cmd -- shell command to run
|
||||
# %RETURNS:
|
||||
# Return code of command
|
||||
# %DESCRIPTION:
|
||||
# Runs a command putting output into ".msgs"
|
||||
#***********************************************************************
|
||||
proc RunCommand { cmd } {
|
||||
global CmdDone
|
||||
|
||||
set CmdDone 0
|
||||
|
||||
.msgs insert end "$cmd\n" red
|
||||
|
||||
set problem [catch {set CmdFile [open "|$cmd" "r"]} err]
|
||||
if {$problem} {
|
||||
Bail "Error running command `$cmd': $err"
|
||||
}
|
||||
|
||||
fconfigure $CmdFile -blocking 0
|
||||
|
||||
fileevent $CmdFile readable "CommandReadable $CmdFile"
|
||||
vwait CmdDone
|
||||
|
||||
set problem [catch {close $CmdFile} err]
|
||||
if {$problem} {
|
||||
Bail "Error running command `$cmd': $err"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CommandReadable
|
||||
# %ARGUMENTS:
|
||||
# f -- file to read from
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Reads characters from command pipelin and appends them to .msg.
|
||||
#***********************************************************************
|
||||
proc CommandReadable { f } {
|
||||
global CmdDone
|
||||
set stuff [read $f]
|
||||
.msgs insert end $stuff
|
||||
.msgs see end
|
||||
if {[eof $f]} {
|
||||
set CmdDone 1
|
||||
}
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CallConfigure
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Executes "./configure" with appropriate arguments
|
||||
# %PRECONDITIONS:
|
||||
# Any preconditions
|
||||
# %POSTCONDITIONS:
|
||||
# Any postconditions
|
||||
# %SIDE EFFECTS:
|
||||
# Any side effects
|
||||
#***********************************************************************
|
||||
proc CallConfigure {} {
|
||||
global Instdir
|
||||
set bin [$Instdir.bin get]
|
||||
set man [$Instdir.man get]
|
||||
RunCommand "./configure --bindir=$bin --mandir=$man"
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CreateCustomH
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Creates "src/custom.h" from "src/custom.h.in"
|
||||
#***********************************************************************
|
||||
proc CreateCustomH {} {
|
||||
global Loc Options Config
|
||||
set problem [catch {set in [open "src/custom.h.in" "r"]} err]
|
||||
if {$problem} {
|
||||
Bail "Can't read src/custom.h.in: $err"
|
||||
}
|
||||
set problem [catch {set out [open "src/custom.h" "w"]} err]
|
||||
if {$problem} {
|
||||
Bail "Can't write src/custom.h: $err"
|
||||
}
|
||||
|
||||
# Retrieve values
|
||||
# The latitude/longitude ones are tied to the scales; we can't
|
||||
# modify them willy-nilly
|
||||
set LAT_DEG $Config(LAT_DEG)
|
||||
set LAT_MIN $Config(LAT_MIN)
|
||||
set LON_DEG $Config(LON_DEG)
|
||||
set LON_MIN $Config(LON_MIN)
|
||||
if {!$Config(NORTHERN_HEMISPHERE)} {
|
||||
set LAT_DEG "-$LAT_DEG"
|
||||
set LAT_MIN "-$LAT_MIN"
|
||||
}
|
||||
if {!$Config(WESTERN_HEMISPHERE)} {
|
||||
set LON_DEG "-$LON_DEG"
|
||||
set LON_MIN "-$LON_MIN"
|
||||
}
|
||||
set Config(LOCATION) [$Loc.location get]
|
||||
|
||||
switch -- [$Options.page cget -text] {
|
||||
"A4" {
|
||||
set Config(DEFAULT_PAGE) "{\"A4\", 595, 842}"
|
||||
}
|
||||
default {
|
||||
set Config(DEFAULT_PAGE) "{\"Letter\", 612, 792}"
|
||||
}
|
||||
}
|
||||
set Config(DATESEP) [$Options.date cget -text]
|
||||
set Config(TIMESEP) [$Options.time cget -text]
|
||||
|
||||
switch -- [$Options.char cget -text] {
|
||||
"ISO 8859-1" {
|
||||
set Config(ISOLATIN1) 1
|
||||
}
|
||||
"ISO 8859-2" {
|
||||
set Config(ISOLATIN2) 1
|
||||
}
|
||||
"IBM CPI-852" {
|
||||
set Config(IBM852) 1
|
||||
}
|
||||
"IBM Extended" {
|
||||
set Config(IBMEXTENDED) 1
|
||||
}
|
||||
}
|
||||
|
||||
while {[gets $in line] != -1} {
|
||||
switch -glob -- $line {
|
||||
"#define LAT_DEG *" {
|
||||
puts $out "#define LAT_DEG $LAT_DEG"
|
||||
.msgs insert end "#define LAT_DEG $LAT_DEG\n"
|
||||
}
|
||||
"#define LAT_MIN *" {
|
||||
puts $out "#define LAT_MIN $LAT_MIN"
|
||||
.msgs insert end "#define LAT_MIN $LAT_MIN\n"
|
||||
}
|
||||
"#define LON_DEG *" {
|
||||
puts $out "#define LON_DEG $LON_DEG"
|
||||
.msgs insert end "#define LON_DEG $LON_DEG\n"
|
||||
}
|
||||
"#define LON_MIN *" {
|
||||
puts $out "#define LON_MIN $LON_MIN"
|
||||
.msgs insert end "#define LON_MIN $LON_MIN\n"
|
||||
}
|
||||
"#define LOCATION *" {
|
||||
puts $out "#define LOCATION \"$Config(LOCATION)\""
|
||||
.msgs insert end "#define LOCATION \"$Config(LOCATION)\"\n"
|
||||
}
|
||||
"#define DEFAULT_PAGE *" {
|
||||
puts $out "#define DEFAULT_PAGE $Config(DEFAULT_PAGE)"
|
||||
.msgs insert end "#define DEFAULT_PAGE $Config(DEFAULT_PAGE)\n"
|
||||
}
|
||||
"#define DATESEP *" {
|
||||
puts $out "#define DATESEP '$Config(DATESEP)'"
|
||||
.msgs insert end "#define DATESEP '$Config(DATESEP)'\n"
|
||||
}
|
||||
"#define TIMESEP *" {
|
||||
puts $out "#define TIMESEP '$Config(TIMESEP)'"
|
||||
.msgs insert end "#define TIMESEP '$Config(TIMESEP)'\n"
|
||||
}
|
||||
"#define ISOLATIN1 *" {
|
||||
puts $out "#define ISOLATIN1 $Config(ISOLATIN1)"
|
||||
.msgs insert end "#define ISOLATIN1 $Config(ISOLATIN1)\n"
|
||||
}
|
||||
"#define ISOLATIN2 *" {
|
||||
puts $out "#define ISOLATIN2 $Config(ISOLATIN2)"
|
||||
.msgs insert end "#define ISOLATIN2 $Config(ISOLATIN2)\n"
|
||||
}
|
||||
"#define IBM852 *" {
|
||||
puts $out "#define IBM852 $Config(IBM852)"
|
||||
.msgs insert end "#define IBM852 $Config(IBM852)\n"
|
||||
}
|
||||
"#define IBMEXTENDED *" {
|
||||
puts $out "#define IBMEXTENDED $Config(IBMEXTENDED)"
|
||||
.msgs insert end "#define IBMEXTENDED $Config(IBMEXTENDED)\n"
|
||||
}
|
||||
default {
|
||||
puts $out $line
|
||||
}
|
||||
}
|
||||
}
|
||||
close $in
|
||||
close $out
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CallMake
|
||||
# %ARGUMENTS:
|
||||
# None
|
||||
# %RETURNS:
|
||||
# Nothing
|
||||
# %DESCRIPTION:
|
||||
# Runs "make" with appropriate language definitions
|
||||
#***********************************************************************
|
||||
proc CallMake {} {
|
||||
global Options
|
||||
set lang [$Options.lang cget -text]
|
||||
switch -- $lang {
|
||||
"German" { set lang GERMAN }
|
||||
"Dutch" { set lang DUTCH }
|
||||
"Finnish" { set lang FINNISH }
|
||||
"French" { set lang FRENCH }
|
||||
"Norwegian" { set lang NORWEGIAN }
|
||||
"Danish" { set lang DANISH }
|
||||
"Polish" { set lang POLISH }
|
||||
"Brazilian Portuguese" {set lang BRAZPORT }
|
||||
"Italian" { set lang ITALIAN }
|
||||
"Romanian" { set lang ROMANIAN }
|
||||
default { set lang ENGLISH }
|
||||
}
|
||||
RunCommand "make \"LANGDEF=-DLANG=$lang\""
|
||||
}
|
||||
|
||||
|
||||
# Tabbed notebook code from "Effective Tcl/Tk Programming"
|
||||
# ----------------------------------------------------------------------
|
||||
# EXAMPLE: tabnotebook that can dial up pages
|
||||
# ----------------------------------------------------------------------
|
||||
# Effective Tcl/Tk Programming
|
||||
# Mark Harrison, DSC Communications Corp.
|
||||
# Michael McLennan, Bell Labs Innovations for Lucent Technologies
|
||||
# Addison-Wesley Professional Computing Series
|
||||
# ======================================================================
|
||||
# Copyright (c) 1996-1997 Lucent Technologies Inc. and Mark Harrison
|
||||
# ======================================================================
|
||||
|
||||
option add *Tabnotebook.tabs.background #666666 widgetDefault
|
||||
option add *Tabnotebook.margin 6 widgetDefault
|
||||
option add *Tabnotebook.tabColor #a6a6a6 widgetDefault
|
||||
option add *Tabnotebook.activeTabColor #d9d9d9 widgetDefault
|
||||
option add *Tabnotebook.tabFont \
|
||||
-*-helvetica-bold-r-normal--*-120-* widgetDefault
|
||||
|
||||
proc tabnotebook_create {win} {
|
||||
global tnInfo
|
||||
|
||||
frame $win -class Tabnotebook
|
||||
canvas $win.tabs -highlightthickness 0
|
||||
pack $win.tabs -fill x
|
||||
|
||||
notebook_create $win.notebook
|
||||
pack $win.notebook -expand yes -fill both
|
||||
|
||||
set tnInfo($win-tabs) ""
|
||||
set tnInfo($win-current) ""
|
||||
set tnInfo($win-pending) ""
|
||||
return $win
|
||||
}
|
||||
|
||||
proc tabnotebook_page {win name} {
|
||||
global tnInfo
|
||||
|
||||
set page [notebook_page $win.notebook $name]
|
||||
lappend tnInfo($win-tabs) $name
|
||||
|
||||
if {$tnInfo($win-pending) == ""} {
|
||||
set id [after idle [list tabnotebook_refresh $win]]
|
||||
set tnInfo($win-pending) $id
|
||||
}
|
||||
return $page
|
||||
}
|
||||
|
||||
proc tabnotebook_refresh {win} {
|
||||
global tnInfo
|
||||
|
||||
$win.tabs delete all
|
||||
|
||||
set margin [option get $win margin Margin]
|
||||
set color [option get $win tabColor Color]
|
||||
set font [option get $win tabFont Font]
|
||||
set x 2
|
||||
set maxh 0
|
||||
|
||||
foreach name $tnInfo($win-tabs) {
|
||||
set id [$win.tabs create text \
|
||||
[expr $x+$margin+2] [expr -0.5*$margin] \
|
||||
-anchor sw -text $name -font $font \
|
||||
-tags [list $name]]
|
||||
|
||||
set bbox [$win.tabs bbox $id]
|
||||
set wd [expr [lindex $bbox 2]-[lindex $bbox 0]]
|
||||
set ht [expr [lindex $bbox 3]-[lindex $bbox 1]]
|
||||
if {$ht > $maxh} {
|
||||
set maxh $ht
|
||||
}
|
||||
|
||||
$win.tabs create polygon 0 0 $x 0 \
|
||||
[expr $x+$margin] [expr -$ht-$margin] \
|
||||
[expr $x+$margin+$wd] [expr -$ht-$margin] \
|
||||
[expr $x+$wd+2*$margin] 0 \
|
||||
2000 0 2000 10 0 10 \
|
||||
-outline black -fill $color \
|
||||
-tags [list $name tab tab-$name]
|
||||
|
||||
$win.tabs raise $id
|
||||
|
||||
$win.tabs bind $name <ButtonPress-1> \
|
||||
[list tabnotebook_display $win $name]
|
||||
|
||||
set x [expr $x+$wd+2*$margin]
|
||||
}
|
||||
set height [expr $maxh+2*$margin]
|
||||
$win.tabs move all 0 $height
|
||||
|
||||
$win.tabs configure -width $x -height [expr $height+4]
|
||||
|
||||
if {$tnInfo($win-current) != ""} {
|
||||
tabnotebook_display $win $tnInfo($win-current)
|
||||
} else {
|
||||
tabnotebook_display $win [lindex $tnInfo($win-tabs) 0]
|
||||
}
|
||||
set tnInfo($win-pending) ""
|
||||
}
|
||||
|
||||
proc tabnotebook_display {win name} {
|
||||
global tnInfo
|
||||
|
||||
notebook_display $win.notebook $name
|
||||
|
||||
set normal [option get $win tabColor Color]
|
||||
$win.tabs itemconfigure tab -fill $normal
|
||||
|
||||
set active [option get $win activeTabColor Color]
|
||||
$win.tabs itemconfigure tab-$name -fill $active
|
||||
$win.tabs raise $name
|
||||
|
||||
set tnInfo($win-current) $name
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# EXAMPLE: simple notebook that can dial up pages
|
||||
# ----------------------------------------------------------------------
|
||||
# Effective Tcl/Tk Programming
|
||||
# Mark Harrison, DSC Communications Corp.
|
||||
# Michael McLennan, Bell Labs Innovations for Lucent Technologies
|
||||
# Addison-Wesley Professional Computing Series
|
||||
# ======================================================================
|
||||
# Copyright (c) 1996-1997 Lucent Technologies Inc. and Mark Harrison
|
||||
# ======================================================================
|
||||
|
||||
option add *Notebook.borderWidth 2 widgetDefault
|
||||
option add *Notebook.relief sunken widgetDefault
|
||||
|
||||
proc notebook_create {win} {
|
||||
global nbInfo
|
||||
|
||||
frame $win -class Notebook
|
||||
pack propagate $win 0
|
||||
|
||||
set nbInfo($win-count) 0
|
||||
set nbInfo($win-pages) ""
|
||||
set nbInfo($win-current) ""
|
||||
return $win
|
||||
}
|
||||
|
||||
proc notebook_page {win name} {
|
||||
global nbInfo
|
||||
|
||||
set page "$win.page[incr nbInfo($win-count)]"
|
||||
lappend nbInfo($win-pages) $page
|
||||
set nbInfo($win-page-$name) $page
|
||||
|
||||
frame $page
|
||||
|
||||
if {$nbInfo($win-count) == 1} {
|
||||
after idle [list notebook_display $win $name]
|
||||
}
|
||||
return $page
|
||||
}
|
||||
|
||||
proc notebook_display {win name} {
|
||||
global nbInfo
|
||||
|
||||
set page ""
|
||||
if {[info exists nbInfo($win-page-$name)]} {
|
||||
set page $nbInfo($win-page-$name)
|
||||
} elseif {[winfo exists $win.page$name]} {
|
||||
set page $win.page$name
|
||||
}
|
||||
if {$page == ""} {
|
||||
error "bad notebook page \"$name\""
|
||||
}
|
||||
|
||||
notebook_fix_size $win
|
||||
|
||||
if {$nbInfo($win-current) != ""} {
|
||||
pack forget $nbInfo($win-current)
|
||||
}
|
||||
pack $page -expand yes -fill both
|
||||
set nbInfo($win-current) $page
|
||||
}
|
||||
|
||||
proc notebook_fix_size {win} {
|
||||
global nbInfo
|
||||
|
||||
update idletasks
|
||||
|
||||
set maxw 0
|
||||
set maxh 0
|
||||
foreach page $nbInfo($win-pages) {
|
||||
set w [winfo reqwidth $page]
|
||||
if {$w > $maxw} {
|
||||
set maxw $w
|
||||
}
|
||||
set h [winfo reqheight $page]
|
||||
if {$h > $maxh} {
|
||||
set maxh $h
|
||||
}
|
||||
}
|
||||
set bd [$win cget -borderwidth]
|
||||
set maxw [expr $maxw+2*$bd]
|
||||
set maxh [expr $maxh+2*$bd]
|
||||
$win configure -width $maxw -height $maxh
|
||||
}
|
||||
|
||||
CheckSanity
|
||||
CreateMainDialog
|
||||
46
configure.in
Normal file
46
configure.in
Normal file
@@ -0,0 +1,46 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl $Id: configure.in,v 1.5 1998-02-16 03:41:39 dfs Exp $
|
||||
|
||||
AC_INIT(src/amiga.c)
|
||||
|
||||
cat <<'EOF'
|
||||
|
||||
**********************
|
||||
* *
|
||||
* Configuring REMIND *
|
||||
* *
|
||||
**********************
|
||||
|
||||
EOF
|
||||
|
||||
AC_CONFIG_HEADER(src/config.h)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl Checks for libraries.
|
||||
dnl Replace `main' with a function in -lm:
|
||||
|
||||
AC_CHECK_LIB(m, sqrt)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(sys/file.h sys/time.h sys/types.h unistd.h malloc.h stdarg.h stdlib.h pwd.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_STRUCT_TM
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
AC_TYPE_PID_T
|
||||
AC_TYPE_UID_T
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_HEADER_TIME
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(mktime putenv strstr timegm difftime)
|
||||
|
||||
AC_OUTPUT(src/Makefile)
|
||||
31
docs/README.AMIGA
Normal file
31
docs/README.AMIGA
Normal file
@@ -0,0 +1,31 @@
|
||||
$Id: README.AMIGA,v 1.2 1998-01-17 04:50:33 dfs Exp $
|
||||
REMIND version 3.0 for AmigaDOS
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the man page, "remind.1".
|
||||
|
||||
1 - Read the file COPYRIGHT.
|
||||
|
||||
2 - cd src; examine the files config.h and custom.h and adjust parameters
|
||||
as needed
|
||||
|
||||
3 - If you are using SAS/C to compile Remind, type:
|
||||
|
||||
copy amiga-SCOPTIONS SCOPTIONS
|
||||
smake -f smakefile
|
||||
|
||||
This will create remind, which is ready to be executed.
|
||||
|
||||
[Please note: I CANNOT SUPPORT THE AMIGA VERSION!]
|
||||
|
||||
See README.UNIX for more info.
|
||||
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
33
docs/README.BCC
Normal file
33
docs/README.BCC
Normal file
@@ -0,0 +1,33 @@
|
||||
$Id: README.BCC,v 1.2 1998-01-17 04:50:33 dfs Exp $
|
||||
REMIND version 3.0 for Borland C++
|
||||
|
||||
IMPORTANT NOTE: BCC SUPPORT MAY BE BROKEN. I DON'T CARE. I'M NOT
|
||||
MAINTAINING IT ANY LONGER.
|
||||
|
||||
1 - Read the file COPYRIGHT. (This may be called COPYRIGH on your
|
||||
MS-DOS system.)
|
||||
|
||||
2 - You must use the Borland C++ OS/2 or MSDOS/Windows compiler.
|
||||
|
||||
3 - cd src; examine the files custom.h and config.h and adjust
|
||||
parameters as needed
|
||||
|
||||
4 - Examine the file makefile.bcc and adjust parameters as needed.
|
||||
|
||||
5 - Type:
|
||||
|
||||
make -f makefile.bcc
|
||||
|
||||
This will make 'remind.exe' and 'rem2ps.exe' in the ..\os2-ex or ..\msdos-ex
|
||||
directories.
|
||||
|
||||
See README.UNIX for more info.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
38
docs/README.DOS
Normal file
38
docs/README.DOS
Normal file
@@ -0,0 +1,38 @@
|
||||
$Id: README.DOS,v 1.2 1998-01-17 04:50:33 dfs Exp $
|
||||
REMIND version 3.0 for MS-DOS
|
||||
|
||||
IMPORTANT NOTE: DOS SUPPORT MAY BE BROKEN. I DON'T CARE. I NO LONGER
|
||||
MAINTAIN THE DOS VERSION.
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the man page, "remind.1".
|
||||
|
||||
1 - Read the file COPYRIGHT. (This may be called COPYRIGH on your
|
||||
MS-DOS system.)
|
||||
|
||||
2 - cd src; examine the files custom.h and config.h and adjust parameters
|
||||
as needed
|
||||
|
||||
3 - If you are using Turbo C to compile Remind, type:
|
||||
|
||||
make -fmakefile.tc
|
||||
|
||||
If you are using Microsoft C to compile Remind, type:
|
||||
|
||||
make makefile.msc
|
||||
|
||||
This will create REMIND.EXE, which is ready to be executed.
|
||||
|
||||
The file "defs.rem" has some sample Remind definitions and commands,
|
||||
as well as U.S. and Jewish holidays.
|
||||
|
||||
See README.UNIX for more info.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: README.OS2,v 1.1 1996-03-27 03:25:49 dfs Exp $
|
||||
$Id: README.OS2,v 1.2 1998-01-17 04:50:34 dfs Exp $
|
||||
REMIND version 3.0 for OS/2
|
||||
|
||||
This file contains instructions for compiling Remind under OS/2 with
|
||||
@@ -19,7 +19,8 @@ in the man page, "remind.1".
|
||||
or emx/gcc. You must also have a decent version of 'make', such
|
||||
as dmake or GNU make.
|
||||
|
||||
3 - Examine the file config.h and adjust parameters as needed
|
||||
3 - Change to "src" directory and examine the files config.h and custom.h
|
||||
and adjust parameters as needed.
|
||||
|
||||
4 - Examine the file Makefile.os2 and adjust parameters as needed.
|
||||
|
||||
@@ -33,9 +34,6 @@ to see a list of targets. For example,
|
||||
|
||||
will build a 32-bit emx version which runs under OS/2 2.x and DOS.
|
||||
|
||||
The file "defs.rem" has some sample Remind definitions and commands,
|
||||
as well as U.S. and Jewish holidays.
|
||||
|
||||
NOTE that I do not have access to an OS/2 system, so support for this
|
||||
system may not be as good as I'd like.
|
||||
|
||||
@@ -43,34 +41,6 @@ OS/2 support is courtesy of Russ Herman <rwh@gov.on.ca>, Norman Walsh
|
||||
<norm@ora.com>, and Darrel Hankerson <hankedr@mail.auburn.edu>.
|
||||
However, if you have problems, please contact me.
|
||||
|
||||
OTHER LANGUAGE SUPPORT
|
||||
|
||||
Remind has support for languages other than English. See the file
|
||||
"lang.h" for details. The language support may vary - you can change
|
||||
only the substitution filter, or you can translate all of the usage
|
||||
instructions and error messages as well. See "french.h" for an
|
||||
example of the latter.
|
||||
|
||||
If you add support for a non-English language, Remind will accept both the
|
||||
English and non-English names of months and weekdays in an input script.
|
||||
However, you should not rely on this feature if you want to write portable
|
||||
Remind scripts.
|
||||
|
||||
At a minimum, you should support month and day names in the foreign
|
||||
language, and should modify the substitution filter appropriately.
|
||||
If you are truly diligent, you can translate usage and error messages
|
||||
too.
|
||||
|
||||
Take a look at the files "english.h" and "german.h" if you want to add
|
||||
support for your favourite language. If you do add another language
|
||||
to Remind, please let me know! Here are the basic guidelines:
|
||||
|
||||
- Your language file should be called "lxxx.h", where lxxx is the first 8
|
||||
characters of the ENGLISH name of your language.
|
||||
|
||||
- You should define L_LANGNAME to be the full English name of your language,
|
||||
with the first letter capitalized and the rest lower-case.
|
||||
|
||||
RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
|
||||
|
||||
1. POPUP REMINDERS
|
||||
@@ -127,6 +97,8 @@ CLEANUP:
|
||||
exit
|
||||
-------------- Cut Here ---------- Cut Here ---------- Cut Here --------
|
||||
|
||||
See README.UNIX for some more information about Remind.
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
133
docs/README.UNIX
Normal file
133
docs/README.UNIX
Normal file
@@ -0,0 +1,133 @@
|
||||
$Id: README.UNIX,v 1.4 1998-01-19 03:24:09 dfs Exp $
|
||||
REMIND version 3.0 for UNIX
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the man page, "remind.1".
|
||||
|
||||
INSTALLING REMIND:
|
||||
-----------------
|
||||
|
||||
If you have Tcl/Tk (wish 4.1 or higher) installed and are running X Windows:
|
||||
--------------------------------------------------------------
|
||||
|
||||
1) Type: wish ./build.tk from the top-level Remind directory.
|
||||
Fill in the various options and hit "Build Remind"
|
||||
|
||||
2) Type: "make install" -- you may need to be root to do this.
|
||||
|
||||
If you do NOT have Tcl/Tk or are NOT running X Windows:
|
||||
-------------------------------------------------------
|
||||
|
||||
1) Edit the file "src/custom.h" according to your preferences.
|
||||
|
||||
2) Edit the file "src/lang.h" to choose a language.
|
||||
|
||||
3) Type: "make"
|
||||
|
||||
4) Type: "make install" -- you may need to be root to do this.
|
||||
|
||||
The subdirectory "www" contains scripts for making a nice calendar
|
||||
web server. See the files README and Makefile in that directory.
|
||||
|
||||
Two shell scripts, "scripts/remind-all.csh" and
|
||||
"scripts/remind-all.sh" are provided. These allow automatic mailing of
|
||||
reminders to all users who create a $HOME/.reminders file. These two
|
||||
scripts are equivalent; one is a "sh" script and the other is a "csh"
|
||||
script. Pick the one you want to use, and follow the instructions in
|
||||
the opening comments of the script.
|
||||
|
||||
A shell script called "scripts/rem" is provided for those who like to have
|
||||
'remind' assume a default reminders file. A man page for this script
|
||||
is provided. You should examine the script to ensure that the defaults
|
||||
are correct.
|
||||
|
||||
Many people have asked me why I supply the "rem" script instead of
|
||||
having Remind assume a default file. The answer is: That's how I like
|
||||
it! My personal preference is for a program which normally takes
|
||||
parameters to display usage information when invoked with no
|
||||
parameters. I like that behaviour so I can quickly get an idea of
|
||||
what a program does without poring through the man page. And I think
|
||||
I'll keep Remind that way. Sorry to all who dislike it. :-)
|
||||
|
||||
A shell script called "scripts/kall" is provided so you can kill your
|
||||
background remind processes when you log out. See the man page. Note
|
||||
that kall depends on the output of "ps", and may not be portable.
|
||||
|
||||
The file "examples/defs.rem" has some sample Remind definitions and
|
||||
commands, as well as U.S. and Jewish holidays.
|
||||
|
||||
OTHER LANGUAGE SUPPORT
|
||||
|
||||
Remind has support for languages other than English. See the file
|
||||
"src/lang.h" for details. The language support may vary - you can change
|
||||
only the substitution filter, or you can translate all of the usage
|
||||
instructions and error messages as well. See "src/langs/french.h" for an
|
||||
example of the latter.
|
||||
|
||||
To compile Remind for a non-english language, look at the constants
|
||||
defined in "src/lang.h". Then, to compile Remind for Italian (as an
|
||||
example), type:
|
||||
|
||||
make "LANGDEF=-DLANG=ITALIAN"
|
||||
|
||||
If you add support for a non-English language, Remind will accept both the
|
||||
English and non-English names of months and weekdays in an input script.
|
||||
However, you should not rely on this feature if you want to write portable
|
||||
Remind scripts.
|
||||
|
||||
At a minimum, you should support month and day names in the foreign
|
||||
language, and should modify the substitution filter appropriately.
|
||||
If you are truly diligent, you can translate usage and error messages
|
||||
too.
|
||||
|
||||
Take a look at the files "src/langs/english.h" and
|
||||
"src/langs/german.h" if you want to add support for your favourite
|
||||
language. If you do add another language to Remind, please let me
|
||||
know! Here are the basic guidelines:
|
||||
|
||||
- Your language file should be called "src/langs/lxxx.h", where lxxx
|
||||
is the first 8 characters of the ENGLISH name of your language.
|
||||
|
||||
- Your language file should define L_LANGNAME to be the full English
|
||||
name of your language, with the first letter capitalized and the rest
|
||||
lower-case.
|
||||
|
||||
- You can test your language file with the script "tests/tstlang.rem"
|
||||
|
||||
RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
|
||||
|
||||
1. POPUP REMINDERS
|
||||
|
||||
If you're running under X-Windows and you have the TCL tools,
|
||||
you can create simple pop-up reminders by creating the following
|
||||
TCL script called 'popup'. It pops a message on to the screen and
|
||||
waits for you to press the 'OK' button. If you don't press the OK button
|
||||
within 15 seconds, it exits anyway. To use it, you can use the '-k' option
|
||||
for Remind as follows:
|
||||
|
||||
remind "-kpopup '%s'&" .reminders
|
||||
|
||||
Or use the following in your Remind script:
|
||||
|
||||
REM AT 17:00 RUN popup 'Time to go home.' &
|
||||
|
||||
This Tcl script is a slightly modified version of one submitted by
|
||||
Norman Walsh.
|
||||
|
||||
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
|
||||
#!/usr/local/bin/wish
|
||||
wm withdraw .
|
||||
after 15000 { destroy . ; exit }
|
||||
tk_dialog .d { Message } $argv warning 0 { OK }
|
||||
destroy .
|
||||
exit
|
||||
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
|
||||
|
||||
|
||||
--
|
||||
David F. Skoll <dfs@doe.carleton.ca>
|
||||
986 Eiffel Avenue
|
||||
Ottawa, Ontario K2C 0J2
|
||||
CANADA
|
||||
|
||||
Tel. (613) 225-8687
|
||||
50
docs/README_QDOS
Normal file
50
docs/README_QDOS
Normal file
@@ -0,0 +1,50 @@
|
||||
$Id: README_QDOS,v 1.3 1998-03-01 20:43:04 dfs Exp $
|
||||
REMIND version 3.0.19 for QDOS / SMSQ
|
||||
|
||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||
in the documentation file, "remind_doc" (QUILL format).
|
||||
[Note from David Skoll -- I was not sent the file `remind_doc', so
|
||||
you're on your own here. You'll have to use the UNIX man pages.]
|
||||
|
||||
1 - Read the file COPYRIGHT.
|
||||
|
||||
2 - Change to the directory "src"
|
||||
|
||||
3 - Examine the Makefile and change any parameters which need to be
|
||||
changed for your system. (The makefile for QDOS / SMSQ is
|
||||
makefile_QDOS).
|
||||
|
||||
4 - Examine the files config_h and custom_h and adjust parameters as needed
|
||||
|
||||
5 - Examine lang_h and choose the language you want Remind to use.
|
||||
There has no effort been put in making the language modules working
|
||||
on the QL. You'll have to adjust the files for yourself to get
|
||||
them working (umlauts etc).
|
||||
|
||||
6 - Execute "make;'-fMakefile_QDOS'". Be sure, that your DATA_DEFAULT
|
||||
directory is the directory where the remind source files are
|
||||
placed.
|
||||
|
||||
See README.UNIX for some more information about Remind.
|
||||
|
||||
RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
|
||||
|
||||
The QDOS / SMSQ version does not support the enhanced features of
|
||||
the UNIX and/or OS/2 versions.
|
||||
|
||||
I had some problems with the sunrise() and sunset() functions,
|
||||
but didn't examine it.
|
||||
|
||||
I've ported Remind on a SMSQ/SGC system. It should work on other
|
||||
systems without problems. The compiler used was C68 v4.14c.
|
||||
|
||||
Remind should work with each QL or compatible with 512K or more RAM.
|
||||
It'll however NOT work on a standard QL due to it's code size.
|
||||
|
||||
Any problems with the QDOS / SMSQ versions should be sent to:
|
||||
|
||||
Robert H. Klein
|
||||
Bluecherstrasse 24
|
||||
D-56349 Kaub
|
||||
|
||||
Germany
|
||||
@@ -1,5 +1,180 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* Version 3.0 Patch 19
|
||||
|
||||
+ MAJOR ENHANCEMENTS
|
||||
|
||||
- Added MOON and SHADE specials. These now work with PostScript,
|
||||
HTML and Tcl/Tk front-ends. You can have cute moons and shaded
|
||||
boxes on your printer, on your screen and in your web browser. :-)
|
||||
|
||||
- TkRemind overhauled -- you can now edit and delete reminders from
|
||||
the GUI. You can actually reasonably use Remind without learning
|
||||
the scripting language.
|
||||
|
||||
- TkRemind overhauled -- "server mode" added to Remind; TkRemind will
|
||||
now pop up timed reminders.
|
||||
|
||||
+ MINOR ENHANCEMENTS
|
||||
|
||||
- Updated romanian.h, courtesy Liviu Daia.
|
||||
|
||||
+ BUG FIXES
|
||||
|
||||
- Allowed object files to be built in different directory from
|
||||
source files (thanks to Jonathan Kamens <jik@American.COM>
|
||||
|
||||
- Removed restriction against reading group-writable files. This
|
||||
caused headaches on Red Hat Linux which uses an unusual user/group
|
||||
scheme.
|
||||
|
||||
- Remind would not compile if a non-English language was selected.
|
||||
|
||||
- Fixed free() of a NULL pointer.
|
||||
|
||||
- Made tkremind display a helpful error message if Remind's
|
||||
"security feature" of not reading a group-writable file kicks
|
||||
in.
|
||||
|
||||
- Fixed bug which sometimes prevented reminder times from appearing
|
||||
in a calendar display.
|
||||
|
||||
- Lots more silly little bugs squashed -- too many to go into in
|
||||
detail.
|
||||
|
||||
* Version 3.0 Patch 18
|
||||
|
||||
+ MAJOR ENHANCEMENTS
|
||||
|
||||
- Added the script "build.tk" which makes it trivial to compile
|
||||
and install Remind under UNIX -- no need to edit Makefiles or
|
||||
header files. A nice GUI installation dialog!
|
||||
|
||||
- Got rid of all fixed-size buffers. Hurray! Everything is dynamic --
|
||||
no built-in limits on line length, token size, etc. This should
|
||||
cure lots of SEGV's for weird files.
|
||||
|
||||
- Added TAG and DURATION clauses for communicating more information to
|
||||
back-ends and eventually converting REMIND into a full-fledged
|
||||
scheduler.
|
||||
|
||||
- Completely reworked the PS/PSFILE mechanism to use the more
|
||||
general SPECIAL mechanism for customizing output in REMIND back-ends.
|
||||
|
||||
+ MINOR ENHANCEMENTS
|
||||
|
||||
- Made parser _very_ forgiving -- the type of reminder now defaults
|
||||
to MSG. This lets you have lines in the reminder file like this:
|
||||
|
||||
Feb 9, 1998 Meeting with Joe.
|
||||
|
||||
But I don't recommend abusing it. It's mostly to ease migration from
|
||||
UNIX calendar(1) files.
|
||||
|
||||
- Documented the "remind -p" format.
|
||||
|
||||
- Made Remind communicate day and month names to back-ends so they
|
||||
can automatically take on the language Remind was compiled with.
|
||||
|
||||
- Directory structure totally reorganized. Remind now uses an autoconf
|
||||
"configure" script which should make life very pleasant for UNIX
|
||||
people.
|
||||
|
||||
- Made Rem2HTML work properly if more than one month's worth of calendar
|
||||
data was produced. Rem2HTML also escapes any special HTML characters.
|
||||
However, it recognizes a "SPECIAL HTML" type of reminder which lets
|
||||
you put arbitrary HTML code in your calendar entries. See www/rem2html
|
||||
for details.
|
||||
|
||||
- Added the "-a" option to Rem2HTML to complement the "-p" option. Also
|
||||
made Rem2HTML print a usage message if input is coming from a terminal.
|
||||
|
||||
+ BUG FIXES
|
||||
|
||||
- Fixed sunset(), sunrise() and minsfromutc() functions which were broken
|
||||
by 3.0.17. (In 3.0.17, they did not account for daylight savings time.)
|
||||
|
||||
- Updated "finnish.h" to include proper URL and translation of all
|
||||
error messages.
|
||||
|
||||
+ BUG INTRODUCTIONS
|
||||
|
||||
- The reorganization and use of "configure" probably breaks Remind
|
||||
installation on non-UNIX platforms. Sorry. I can't fix it until
|
||||
I hear back from non-UNIX maintainers.
|
||||
|
||||
- Getting rid of fixed-sized buffers meant lots of changes to code.
|
||||
No doubt, I missed a few regression tests.
|
||||
|
||||
* Version 3.0 Patch 17
|
||||
|
||||
+ MINOR ENHANCEMENTS
|
||||
|
||||
- Made REMIND accept date specs like "Jan 6, 1998" -- the comma is
|
||||
ignored. This was suggested by John Conover <john@johncon.johncon.com>.
|
||||
You can even do "REM 27, Aug, 1998, msg bar". (But I don't know why
|
||||
you'd want to.)
|
||||
|
||||
- Added www/rem2html, a Perl script which converts the output of
|
||||
`remind -p ...' to an HTML table. The script was contributed by
|
||||
Don Schwarz <darkowl@mcs.net>
|
||||
|
||||
- New security features: Because of the risks of statically-allocated
|
||||
buffers, REMIND now refuses to run if it is installed set-uid or set-gid.
|
||||
If REMIND is run as root, it refuses to read files not owned by root.
|
||||
It also won't open group- or world-writable files, no matter who is
|
||||
running it. Finally, if you read a file you don't own, REMIND disables
|
||||
RUN and shell(). REMIND doesn't do these security checks on stdin,
|
||||
though, so be careful if you run it as root in a script.
|
||||
|
||||
NOTE: REMIND doesn't do the world- and group-writable checks
|
||||
on devices, FIFOs, etc. Otherwise "remind /dev/null" fails...
|
||||
|
||||
+ BUG FIXES
|
||||
|
||||
- Increased sizes of some statically-allocated buffers. This doesn't
|
||||
really fix the problem, but makes it more manageable.
|
||||
|
||||
- Using the "-u" option now implies the "-r" option. This is a
|
||||
security feature.
|
||||
|
||||
- Added romanian.h to the manifest. Sorry.
|
||||
|
||||
- CalcMinsFromUTC was failing if time_t was unsigned. I now use
|
||||
difftime(), but not all systems have it. Also, defs.rem was rearranged
|
||||
so PostScript stuff works better, and new target "emxomf" was added to
|
||||
makefile.os2 which uses OMF linking and a dynamically-linked C
|
||||
library. All three of these fixes are courtesy of Christopher
|
||||
J. Madsen <madsen@iglobal.net>. Thanks, Christopher.
|
||||
|
||||
* Version 3.0 Patch 16
|
||||
|
||||
+ MINOR ENHANCEMENTS
|
||||
|
||||
- Bundled scripts for making a nice WWW calendar server. See the
|
||||
"www" subdirectory in the release.
|
||||
|
||||
- Added support for the Romanian language, courtesy of Liviu Daia.
|
||||
|
||||
- Changed sunrise() and sunset() as follows: If the sun never rises,
|
||||
sunrise() returns 1440 and sunset() returns 0. In this case,
|
||||
sunrise()-sunset() returns the length of the dark period of the
|
||||
day, in minutes. If the sun never sets, sunrise() returns 0 and
|
||||
sunset() returns 1440, and sunset()-sunrise() returns the length
|
||||
of the light period of the day, in minutes. Thanks to Michael Salmon
|
||||
for explaining the utility of this. See the file "defs.rem" for the
|
||||
functions _light_len and _dark_len which return the length in minutes
|
||||
of the light and dark period of the day, respectively.
|
||||
|
||||
+ BUG FIXES
|
||||
|
||||
- If you used the "-g" option, then no background reminders were
|
||||
ever issued. DOH! Thanks to Greg Badros <gjb@cs.washington.edu>
|
||||
for pointing this out.
|
||||
|
||||
- Fixed a problem under Solaris 2.5 whereby rem2ps was skipping some
|
||||
latin1 characters which it interpreted as white space.
|
||||
|
||||
* Version 3.0 Patch 15
|
||||
|
||||
+ IMPORTANT NOTES
|
||||
880
dorem.c
880
dorem.c
@@ -1,880 +0,0 @@
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DOREM.C */
|
||||
/* */
|
||||
/* Contains routines for parsing reminders and evaluating */
|
||||
/* triggers. Also contains routines for parsing OMIT */
|
||||
/* commands. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: dorem.c,v 1.3 1996-04-28 02:01:54 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include "globals.h"
|
||||
#include "err.h"
|
||||
#include "types.h"
|
||||
#include "protos.h"
|
||||
#include "expr.h"
|
||||
|
||||
/* Define the shell characters to escape */
|
||||
static char const EscapeMe[] =
|
||||
#ifdef QDOS
|
||||
"\"'!$%^&*()|<>[]{}\x9F~;?\\";
|
||||
#else
|
||||
"\"'!$%^&*()|<>[]{}`~;?\\";
|
||||
#endif
|
||||
|
||||
PRIVATE int ParseTimeTrig ARGS ((ParsePtr s, TimeTrig *tim));
|
||||
PRIVATE int ParseLocalOmit ARGS ((ParsePtr s, Trigger *t));
|
||||
PRIVATE int ParseScanFrom ARGS ((ParsePtr s, Trigger *t));
|
||||
PRIVATE int ParsePriority ARGS ((ParsePtr s, Trigger *t));
|
||||
PRIVATE int ParseUntil ARGS ((ParsePtr s, Trigger *t));
|
||||
PRIVATE int ShouldTriggerBasedOnWarn ARGS ((Trigger *t, int jul));
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DoRem */
|
||||
/* */
|
||||
/* Do the REM command. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int DoRem(ParsePtr p)
|
||||
#else
|
||||
int DoRem(p)
|
||||
ParsePtr p;
|
||||
#endif
|
||||
{
|
||||
|
||||
Trigger trig;
|
||||
TimeTrig tim;
|
||||
int r;
|
||||
int jul;
|
||||
char buf[TOKSIZE];
|
||||
Token tok;
|
||||
|
||||
/* Parse the trigger date and time */
|
||||
if ( (r=ParseRem(p, &trig, &tim)) ) return r;
|
||||
|
||||
if (trig.typ == NO_TYPE) return E_EOLN;
|
||||
if (trig.typ == SAT_TYPE) {
|
||||
r=DoSatRemind(&trig, &tim, p);
|
||||
if (r) return r;
|
||||
r=ParseToken(p, buf);
|
||||
if (r) return r;
|
||||
FindToken(buf, &tok);
|
||||
if (tok.type == T_Empty || tok.type == T_Comment) return OK;
|
||||
if (tok.type != T_RemType || tok.val == SAT_TYPE) return E_PARSE_ERR;
|
||||
trig.typ = tok.val;
|
||||
jul = LastTriggerDate;
|
||||
if (!LastTrigValid) return OK;
|
||||
} else {
|
||||
/* Calculate the trigger date */
|
||||
jul = ComputeTrigger(trig.scanfrom, &trig, &r);
|
||||
if (r) return r;
|
||||
}
|
||||
|
||||
/* Queue the reminder, if necessary */
|
||||
#ifdef HAVE_QUEUED
|
||||
if (jul == JulianToday &&
|
||||
!(!IgnoreOnce &&
|
||||
trig.once != NO_ONCE &&
|
||||
FileAccessDate == JulianToday))
|
||||
QueueReminder(p, trig.typ, &tim, trig.sched);
|
||||
/* If we're in daemon mode, do nothing over here */
|
||||
if (Daemon) return OK;
|
||||
#endif
|
||||
|
||||
|
||||
if (ShouldTriggerReminder(&trig, &tim, jul)) {
|
||||
#ifdef OS2_POPUP
|
||||
if ( (r=TriggerReminder(p, &trig, &tim, jul, 0)) ) {
|
||||
#else
|
||||
if ( (r=TriggerReminder(p, &trig, &tim, jul)) ) {
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParseRem */
|
||||
/* */
|
||||
/* Given a parse pointer, parse line and fill in a */
|
||||
/* trigger structure. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
#else
|
||||
int ParseRem(s, trig, tim)
|
||||
ParsePtr s;
|
||||
Trigger *trig;
|
||||
TimeTrig *tim;
|
||||
#endif
|
||||
{
|
||||
register int r;
|
||||
Token tok;
|
||||
|
||||
trig->y = NO_YR;
|
||||
trig->m = NO_MON;
|
||||
trig->d = NO_DAY;
|
||||
trig->wd = NO_WD;
|
||||
trig->back = NO_BACK;
|
||||
trig->delta = NO_DELTA;
|
||||
trig->until = NO_UNTIL;
|
||||
trig->rep = NO_REP;
|
||||
trig->localomit = NO_WD;
|
||||
trig->skip = NO_SKIP;
|
||||
trig->once = NO_ONCE;
|
||||
trig->typ = NO_TYPE;
|
||||
trig->scanfrom = NO_DATE;
|
||||
trig->priority = DefaultPrio;
|
||||
trig->sched[0] = 0;
|
||||
trig->warn[0] = 0;
|
||||
tim->ttime = NO_TIME;
|
||||
tim->delta = NO_DELTA;
|
||||
tim->rep = NO_REP;
|
||||
|
||||
while(1) {
|
||||
/* Read space-delimited string */
|
||||
r = ParseToken(s, TokBuffer);
|
||||
if (r) return r;
|
||||
|
||||
/* Figure out what we've got */
|
||||
FindToken(TokBuffer, &tok);
|
||||
switch(tok.type) {
|
||||
case T_WkDay:
|
||||
if (trig->wd & (1 << tok.val)) return E_WD_TWICE;
|
||||
trig->wd |= (1 << tok.val);
|
||||
break;
|
||||
|
||||
case T_Month:
|
||||
if (trig->m != NO_MON) return E_MON_TWICE;
|
||||
trig->m = tok.val;
|
||||
break;
|
||||
|
||||
case T_Skip:
|
||||
if (trig->skip != NO_SKIP) return E_SKIP_ERR;
|
||||
trig->skip = tok.val;
|
||||
break;
|
||||
|
||||
case T_Priority:
|
||||
r=ParsePriority(s, trig);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
case T_At:
|
||||
r=ParseTimeTrig(s, tim);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
case T_Scanfrom:
|
||||
r=ParseScanFrom(s, trig);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
case T_RemType:
|
||||
trig->typ = tok.val;
|
||||
if (s->isnested) return E_CANT_NEST_RTYPE;
|
||||
if (trig->scanfrom == NO_DATE) trig->scanfrom = JulianToday;
|
||||
return OK;
|
||||
|
||||
case T_Until:
|
||||
r=ParseUntil(s, trig);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
case T_Year:
|
||||
if (trig->y != NO_YR) return E_YR_TWICE;
|
||||
trig->y = tok.val;
|
||||
break;
|
||||
|
||||
case T_Day:
|
||||
if (trig->d != NO_DAY) return E_DAY_TWICE;
|
||||
trig->d = tok.val;
|
||||
break;
|
||||
|
||||
case T_Rep:
|
||||
if (trig->rep != NO_REP) return E_REP_TWICE;
|
||||
trig->rep = tok.val;
|
||||
break;
|
||||
|
||||
case T_Delta:
|
||||
if (trig->delta != NO_DELTA) return E_DELTA_TWICE;
|
||||
trig->delta = tok.val;
|
||||
break;
|
||||
|
||||
case T_Back:
|
||||
if (trig->back != NO_BACK) return E_BACK_TWICE;
|
||||
trig->back = tok.val;
|
||||
break;
|
||||
|
||||
case T_Once:
|
||||
if (trig->once != NO_ONCE) return E_ONCE_TWICE;
|
||||
trig->once = ONCE_ONCE;
|
||||
break;
|
||||
|
||||
case T_Omit:
|
||||
r = ParseLocalOmit(s, trig);
|
||||
if (r) return r;
|
||||
break;
|
||||
|
||||
case T_Empty:
|
||||
if (trig->scanfrom == NO_DATE) trig->scanfrom = JulianToday;
|
||||
return OK;
|
||||
|
||||
case T_Warn:
|
||||
r=ParseToken(s, TokBuffer);
|
||||
if(r) return r;
|
||||
StrnCpy(trig->warn, TokBuffer, VAR_NAME_LEN);
|
||||
break;
|
||||
|
||||
case T_Sched:
|
||||
r=ParseToken(s, TokBuffer);
|
||||
if(r) return r;
|
||||
StrnCpy(trig->sched, TokBuffer, VAR_NAME_LEN);
|
||||
break;
|
||||
|
||||
default:
|
||||
Eprint("%s: %s", ErrMsg[E_UNKNOWN_TOKEN], TokBuffer);
|
||||
return E_UNKNOWN_TOKEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParseTimeTrig - parse the AT part of a timed reminder */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
|
||||
#else
|
||||
static int ParseTimeTrig(s, tim)
|
||||
ParsePtr s;
|
||||
TimeTrig *tim;
|
||||
#endif
|
||||
{
|
||||
Token tok;
|
||||
int r;
|
||||
|
||||
while(1) {
|
||||
r = ParseToken(s, TokBuffer);
|
||||
if (r) return r;
|
||||
FindToken(TokBuffer, &tok);
|
||||
switch(tok.type) {
|
||||
case T_Time:
|
||||
tim->ttime = tok.val;
|
||||
break;
|
||||
|
||||
case T_Delta:
|
||||
tim->delta = (tok.val > 0) ? tok.val : -tok.val;
|
||||
break;
|
||||
|
||||
case T_Rep:
|
||||
tim->rep = tok.val;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (tim->ttime == NO_TIME) return E_EXPECT_TIME;
|
||||
/* Save in global variable */
|
||||
LastTriggerTime = tim->ttime;
|
||||
PushToken(TokBuffer);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParseLocalOmit - parse the local OMIT portion of a */
|
||||
/* reminder. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ParseLocalOmit(ParsePtr s, Trigger *t)
|
||||
#else
|
||||
static int ParseLocalOmit(s, t)
|
||||
ParsePtr s;
|
||||
Trigger *t;
|
||||
#endif
|
||||
{
|
||||
Token tok;
|
||||
int r;
|
||||
|
||||
while(1) {
|
||||
r = ParseToken(s, TokBuffer);
|
||||
if (r) return r;
|
||||
FindToken(TokBuffer, &tok);
|
||||
switch(tok.type) {
|
||||
case T_WkDay:
|
||||
t->localomit |= (1 << tok.val);
|
||||
break;
|
||||
|
||||
default:
|
||||
PushToken(TokBuffer);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParseUntil - parse the UNTIL portion of a reminder */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ParseUntil(ParsePtr s, Trigger *t)
|
||||
#else
|
||||
static int ParseUntil(s, t)
|
||||
ParsePtr s;
|
||||
Trigger *t;
|
||||
#endif
|
||||
{
|
||||
int y = NO_YR,
|
||||
m = NO_MON,
|
||||
d = NO_DAY;
|
||||
|
||||
Token tok;
|
||||
int r;
|
||||
|
||||
if (t->until != NO_UNTIL) return E_UNTIL_TWICE;
|
||||
|
||||
while(1) {
|
||||
r = ParseToken(s, TokBuffer);
|
||||
if (r) return r;
|
||||
FindToken(TokBuffer, &tok);
|
||||
switch(tok.type) {
|
||||
case T_Year:
|
||||
if (y != NO_YR) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_YR_TWICE]);
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
y = tok.val;
|
||||
break;
|
||||
|
||||
case T_Month:
|
||||
if (m != NO_MON) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_MON_TWICE]);
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
m = tok.val;
|
||||
break;
|
||||
|
||||
case T_Day:
|
||||
if (d != NO_DAY) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_DAY_TWICE]);
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
d = tok.val;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||
Eprint("UNTIL: %s", ErrMsg[E_INCOMPLETE]);
|
||||
return E_INCOMPLETE;
|
||||
}
|
||||
if (!DateOK(y, m, d)) return E_BAD_DATE;
|
||||
t->until = Julian(y, m, d);
|
||||
PushToken(TokBuffer);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParseScanFrom - parse the SCANFROM portion of a reminder */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
||||
#else
|
||||
static int ParseScanFrom(s, t)
|
||||
ParsePtr s;
|
||||
Trigger *t;
|
||||
#endif
|
||||
{
|
||||
int y = NO_YR,
|
||||
m = NO_MON,
|
||||
d = NO_DAY;
|
||||
|
||||
Token tok;
|
||||
int r;
|
||||
|
||||
if (t->scanfrom != NO_DATE) return E_SCAN_TWICE;
|
||||
|
||||
while(1) {
|
||||
r = ParseToken(s, TokBuffer);
|
||||
if (r) return r;
|
||||
FindToken(TokBuffer, &tok);
|
||||
switch(tok.type) {
|
||||
case T_Year:
|
||||
if (y != NO_YR) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_YR_TWICE]);
|
||||
return E_YR_TWICE;
|
||||
}
|
||||
y = tok.val;
|
||||
break;
|
||||
|
||||
case T_Month:
|
||||
if (m != NO_MON) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_MON_TWICE]);
|
||||
return E_MON_TWICE;
|
||||
}
|
||||
m = tok.val;
|
||||
break;
|
||||
|
||||
case T_Day:
|
||||
if (d != NO_DAY) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_DAY_TWICE]);
|
||||
return E_DAY_TWICE;
|
||||
}
|
||||
d = tok.val;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||
Eprint("SCANFROM: %s", ErrMsg[E_INCOMPLETE]);
|
||||
return E_INCOMPLETE;
|
||||
}
|
||||
if (!DateOK(y, m, d)) return E_BAD_DATE;
|
||||
t->scanfrom = Julian(y, m, d);
|
||||
PushToken(TokBuffer);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* TriggerReminder */
|
||||
/* */
|
||||
/* Trigger the reminder if it's a RUN or MSG type. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
#ifdef OS2_POPUP
|
||||
PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
|
||||
int AsPopUp)
|
||||
#else /* ! OS2_POPUP */
|
||||
PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
||||
#endif /* OS2_POPUP */
|
||||
#else /* ! HAVE_PROTOS */
|
||||
#ifdef OS2_POPUP
|
||||
int TriggerReminder(p, t, tim, jul, AsPopUp)
|
||||
ParsePtr p;
|
||||
Trigger *t;
|
||||
TimeTrig *tim;
|
||||
int jul;
|
||||
int AsPopUp;
|
||||
#else /* ! OS2_POPUP */
|
||||
int TriggerReminder(p, t, tim, jul)
|
||||
ParsePtr p;
|
||||
Trigger *t;
|
||||
TimeTrig *tim;
|
||||
int jul;
|
||||
#endif /* OS2_POPUP */
|
||||
#endif /* HAVE_PROTOS */
|
||||
{
|
||||
int r, y, m, d;
|
||||
char PrioExpr[25];
|
||||
static char buf[LINELEN+TOKSIZE];
|
||||
char *s, *s2;
|
||||
Value v;
|
||||
|
||||
if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED;
|
||||
if (t->typ == CAL_TYPE || t->typ == PS_TYPE || t->typ == PSF_TYPE)
|
||||
return OK;
|
||||
|
||||
/* If it's a MSG-type reminder, and no -k option was used, issue the banner. */
|
||||
if ((t->typ == MSG_TYPE || t->typ == MSF_TYPE)
|
||||
&& !NumTriggered && !NextMode && !MsgCommand) {
|
||||
if (!DoSubstFromString(Banner, SubstBuffer, JulianToday, NO_TIME) && *SubstBuffer)
|
||||
#ifdef OS2_POPUP
|
||||
if (AsPopUp)
|
||||
PutlPopUp(SubstBuffer);
|
||||
else
|
||||
printf("%s\n", SubstBuffer);
|
||||
#else
|
||||
printf("%s\n", SubstBuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If it's NextMode, process as a CAL-type entry, and issue simple-calendar
|
||||
format. */
|
||||
if (NextMode) {
|
||||
if ( (r=DoSubst(p, SubstBuffer, t, tim, jul, CAL_MODE)) ) return r;
|
||||
if (!*SubstBuffer) return OK;
|
||||
FromJulian(jul, &y, &m, &d);
|
||||
#ifdef OS2_POPUP
|
||||
if (AsPopUp) {
|
||||
sprintf(buf, "%04d%c%02d%c%02d %s", y, DATESEP, m+1, DATESEP, d,
|
||||
SimpleTime(tim->ttime, NULL));
|
||||
StartPopUp();
|
||||
PutsPopUp(buf);
|
||||
PutlPopUp(SubstBuffer);
|
||||
}
|
||||
else
|
||||
printf("%04d%c%02d%c%02d %s%s\n", y, DATESEP, m+1, DATESEP, d,
|
||||
SimpleTime(tim->ttime, NULL),
|
||||
SubstBuffer);
|
||||
#else
|
||||
printf("%04d%c%02d%c%02d %s%s\n", y, DATESEP, m+1, DATESEP, d,
|
||||
SimpleTime(tim->ttime, NULL),
|
||||
SubstBuffer);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Put the substituted string into the SubstBuffer */
|
||||
s2 = buf;
|
||||
*s2 = 0;
|
||||
if (UserFuncExists("msgprefix") == 1) {
|
||||
sprintf(PrioExpr, "msgprefix(%d)", t->priority);
|
||||
s = PrioExpr;
|
||||
r = EvalExpr(&s, &v);
|
||||
if (!r) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
sprintf(s2, "%s", v.v.str);
|
||||
s2 += strlen(s2);
|
||||
}
|
||||
DestroyValue(v);
|
||||
}
|
||||
}
|
||||
if ( (r=DoSubst(p, s2, t, tim, jul, NORMAL_MODE)) ) return r;
|
||||
s2 += strlen(s2);
|
||||
if (UserFuncExists("msgsuffix") == 1) {
|
||||
sprintf(PrioExpr, "msgsuffix(%d)", t->priority);
|
||||
s = PrioExpr;
|
||||
r = EvalExpr(&s, &v);
|
||||
if (!r) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
sprintf(s2, "%s", v.v.str);
|
||||
s2 += strlen(s2);
|
||||
}
|
||||
DestroyValue(v);
|
||||
}
|
||||
}
|
||||
if ((!MsgCommand && t->typ == MSG_TYPE) || t->typ == MSF_TYPE) {
|
||||
*s2++ = '\n';
|
||||
}
|
||||
*s2 = 0;
|
||||
|
||||
/* If we are sorting, just queue it up in the sort buffer */
|
||||
if (SortByDate) {
|
||||
if (InsertIntoSortBuffer(jul, tim->ttime, buf, t->typ, t->priority) == OK) {
|
||||
NumTriggered++;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we didn't insert the reminder into the sort buffer, issue the
|
||||
reminder now. */
|
||||
switch(t->typ) {
|
||||
case MSG_TYPE:
|
||||
if (MsgCommand) {
|
||||
DoMsgCommand(MsgCommand, buf);
|
||||
} else {
|
||||
#ifdef OS2_POPUP
|
||||
if (AsPopUp)
|
||||
PutlPopUp(buf);
|
||||
else
|
||||
printf("%s", buf);
|
||||
#else
|
||||
printf("%s", buf);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case MSF_TYPE:
|
||||
#ifdef OS2_POPUP
|
||||
if (AsPopUp) {
|
||||
StartPopUp();
|
||||
FillParagraph(buf, 1);
|
||||
EndPopUp();
|
||||
} else {
|
||||
FillParagraph(buf, 0);
|
||||
}
|
||||
#else
|
||||
FillParagraph(buf);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RUN_TYPE:
|
||||
system(buf);
|
||||
break;
|
||||
|
||||
default: /* Unknown/illegal type? */
|
||||
return E_SWERR;
|
||||
}
|
||||
|
||||
NumTriggered++;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ShouldTriggerReminder */
|
||||
/* */
|
||||
/* Return 1 if we should trigger a reminder, based on today's */
|
||||
/* date and the trigger. Return 0 if reminder should not be */
|
||||
/* triggered. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef __TURBOC__
|
||||
#pragma argsused
|
||||
#endif
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
|
||||
#else
|
||||
int ShouldTriggerReminder(t, tim, jul)
|
||||
Trigger *t;
|
||||
TimeTrig *tim;
|
||||
int jul;
|
||||
#endif
|
||||
{
|
||||
int r;
|
||||
|
||||
/* Handle the ONCE modifier in the reminder. */
|
||||
if (!IgnoreOnce && t->once !=NO_ONCE && FileAccessDate == JulianToday)
|
||||
return 0;
|
||||
|
||||
if (jul < JulianToday) return 0;
|
||||
|
||||
/* Don't trigger timed reminders if DontIssueAts is true, and if the
|
||||
reminder is for today */
|
||||
|
||||
#ifdef HAVE_QUEUED
|
||||
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0;
|
||||
#endif
|
||||
|
||||
/* Don't trigger "old" timed reminders */
|
||||
/*** REMOVED...
|
||||
if (jul == JulianToday &&
|
||||
tim->ttime != NO_TIME &&
|
||||
tim->ttime < SystemTime(0) / 60) return 0;
|
||||
*** ...UNTIL HERE */
|
||||
|
||||
/* If "infinite delta" option is chosen, always trigger future reminders */
|
||||
if (InfiniteDelta || NextMode) return 1;
|
||||
|
||||
/* If there's a "warn" function, it overrides any deltas */
|
||||
if (t->warn[0] != 0) {
|
||||
return ShouldTriggerBasedOnWarn(t, jul);
|
||||
}
|
||||
|
||||
/* Move back by delta days, if any */
|
||||
if (t->delta != NO_DELTA) {
|
||||
if (t->delta < 0)
|
||||
jul = jul + t->delta;
|
||||
else {
|
||||
r = t->delta;
|
||||
while(r && jul > JulianToday) {
|
||||
jul--;
|
||||
if (!IsOmitted(jul, t->localomit)) r--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Should we trigger the reminder? */
|
||||
return (jul <= JulianToday);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DoSatRemind */
|
||||
/* */
|
||||
/* Do the "satisfying..." remind calculation. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef __TURBOC__
|
||||
#pragma argsused
|
||||
#endif
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
|
||||
#else
|
||||
int DoSatRemind(trig, tim, p)
|
||||
Trigger *trig;
|
||||
TimeTrig *tim;
|
||||
ParsePtr p;
|
||||
#endif
|
||||
{
|
||||
int iter, jul, r;
|
||||
Value v;
|
||||
char *s, *t;
|
||||
|
||||
t = p->pos;
|
||||
iter = 0;
|
||||
jul = trig->scanfrom;
|
||||
while (iter++ < MaxSatIter) {
|
||||
jul = ComputeTrigger(jul, trig, &r);
|
||||
if (r) {
|
||||
if (r == E_CANT_TRIG) return OK; else return r;
|
||||
}
|
||||
s = p->pos;
|
||||
r = EvaluateExpr(p, &v);
|
||||
t = p->pos;
|
||||
if (r) return r;
|
||||
if (v.type != INT_TYPE && v.type != STR_TYPE) return E_BAD_TYPE;
|
||||
if (v.type == INT_TYPE && v.v.val) return OK;
|
||||
if (v.type == STR_TYPE && *v.v.str) return OK;
|
||||
p->pos = s;
|
||||
jul++;
|
||||
}
|
||||
p->pos = t;
|
||||
LastTrigValid = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ParsePriority - parse the PRIORITY portion of a reminder */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ParsePriority(ParsePtr s, Trigger *t)
|
||||
#else
|
||||
static int ParsePriority(s, t)
|
||||
ParsePtr s;
|
||||
Trigger *t;
|
||||
#endif
|
||||
{
|
||||
int p, r;
|
||||
char *u;
|
||||
|
||||
r = ParseToken(s, TokBuffer);
|
||||
if(r) return r;
|
||||
u = TokBuffer;
|
||||
|
||||
if (!isdigit(*u)) return E_EXPECTING_NUMBER;
|
||||
p = 0;
|
||||
while (isdigit(*u)) {
|
||||
p = p*10 + *u - '0';
|
||||
u++;
|
||||
}
|
||||
if (*u) return E_EXPECTING_NUMBER;
|
||||
|
||||
/* Tricky! The only way p can be < 0 is if overflow occurred; thus,
|
||||
E2HIGH is indeed the appropriate error message. */
|
||||
if (p<0 || p>9999) return E_2HIGH;
|
||||
t->priority = p;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DoMsgCommand */
|
||||
/* */
|
||||
/* Execute the '-k' command, escaping shell chars in message. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void DoMsgCommand(char *cmd, char *msg)
|
||||
#else
|
||||
void DoMsgCommand(cmd, msg)
|
||||
char *cmd;
|
||||
char *msg;
|
||||
#endif
|
||||
{
|
||||
|
||||
#ifdef WANT_SHELL_ESCAPING
|
||||
char buf[2*LINELEN+TOKSIZE];
|
||||
char *s, *t;
|
||||
|
||||
/* Escape shell characters in msg INCLUDING WHITESPACE! */
|
||||
for (t=buf, s=msg; *s; s++) {
|
||||
if (isspace(*s) || strchr(EscapeMe, *s)) *t++ = '\\';
|
||||
*t++ = *s;
|
||||
}
|
||||
*t = 0;
|
||||
|
||||
/* Use SubstBuffer -- not too safe, since no check for overflow... */
|
||||
sprintf(SubstBuffer, cmd, buf);
|
||||
#else
|
||||
sprintf(SubstBuffer, cmd, msg);
|
||||
#endif /* WANT_SHELL_ESCAPING */
|
||||
system(SubstBuffer);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ShouldTriggerBasedOnWarn */
|
||||
/* */
|
||||
/* Determine whether to trigger a reminder based on its WARN */
|
||||
/* function. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ShouldTriggerBasedOnWarn(Trigger *t, int jul)
|
||||
#else
|
||||
static int ShouldTriggerBasedOnWarn(t, jul)
|
||||
Trigger *t;
|
||||
int jul;
|
||||
#endif
|
||||
{
|
||||
char buffer[VAR_NAME_LEN+15];
|
||||
int i;
|
||||
char *s;
|
||||
int r;
|
||||
Value v;
|
||||
int lastReturnVal = 0; /* Silence compiler warning */
|
||||
|
||||
/* If no proper function exists, barf... */
|
||||
if (UserFuncExists(t->warn) != 1) {
|
||||
Eprint("%s: `%s'", ErrMsg[M_BAD_WARN_FUNC], t->warn);
|
||||
return (jul == JulianToday);
|
||||
}
|
||||
for (i=1; ; i++) {
|
||||
sprintf(buffer, "%s(%d)", t->warn, i);
|
||||
s = buffer;
|
||||
r = EvalExpr(&s, &v);
|
||||
if (r) {
|
||||
Eprint("%s: `%s': %s", ErrMsg[M_BAD_WARN_FUNC],
|
||||
t->warn, ErrMsg[r]);
|
||||
return (jul == JulianToday);
|
||||
}
|
||||
if (v.type != INT_TYPE) {
|
||||
DestroyValue(v);
|
||||
Eprint("%s: `%s': %s", ErrMsg[M_BAD_WARN_FUNC],
|
||||
t->warn, ErrMsg[E_BAD_TYPE]);
|
||||
return (jul == JulianToday);
|
||||
}
|
||||
|
||||
/* If absolute value of return is not monotonically
|
||||
decreasing, exit */
|
||||
if (i > 1 && abs(v.v.val) >= lastReturnVal) {
|
||||
return (jul == JulianToday);
|
||||
}
|
||||
|
||||
lastReturnVal = abs(v.v.val);
|
||||
/* Positive values: Just subtract. Negative values:
|
||||
skip omitted days. */
|
||||
if (v.v.val >= 0) {
|
||||
if (JulianToday + v.v.val == jul) return 1;
|
||||
} else {
|
||||
int j = jul;
|
||||
while (v.v.val) {
|
||||
j--;
|
||||
if (!IsOmitted(j, t->localomit)) v.v.val++;
|
||||
}
|
||||
if (j == JulianToday) return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,12 @@
|
||||
# "#COLORS" for examples of ANSI color escape sequences. #
|
||||
# #
|
||||
# This file is part of REMIND. #
|
||||
# Copyright (C) 1992-1996 by David F. Skoll #
|
||||
# Copyright (C) 1992-1997 by David F. Skoll #
|
||||
# #
|
||||
#############################################################################
|
||||
|
||||
#
|
||||
# $Id: defs.rem,v 1.1 1996-03-27 03:25:51 dfs Exp $
|
||||
# $Id: defs.rem,v 1.2 1998-05-05 03:16:23 dfs Exp $
|
||||
#
|
||||
|
||||
RUN OFF
|
||||
@@ -30,8 +30,8 @@ RUN OFF
|
||||
################################################
|
||||
# Ensure required version of remind is used... #
|
||||
################################################
|
||||
IF version() < "03.00.10"
|
||||
ERRMSG This file requires at least version 03.00.10 of Remind.%
|
||||
IF version() < "03.00.19"
|
||||
ERRMSG This file requires at least version 03.00.19 of Remind.%
|
||||
ERRMSG This version is version [version()].
|
||||
EXIT
|
||||
ENDIF
|
||||
@@ -160,6 +160,14 @@ FSET _am_pm(tm) IIF(tm<01:00, tm+12*60+"am", \
|
||||
|
||||
FSET _no_lz(s) IIF(SUBSTR(s, 1, 1)=="0", SUBSTR(s, 2), s)
|
||||
|
||||
#################################################################
|
||||
# Return the length of the daylight/night portion of a date, #
|
||||
# in minutes. #
|
||||
#################################################################
|
||||
|
||||
FSET _light_len(date) MAX(SUNSET(date)-SUNRISE(date), 0)
|
||||
FSET _dark_len(date) 1440-_light_len(date)
|
||||
|
||||
############################################################
|
||||
# Function to calculate number of years since a given year #
|
||||
# or number of months since a given month and year... #
|
||||
@@ -299,50 +307,19 @@ IF !$RunOff && !$CalMode && !$SimpleCal
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
#PSSTUFF
|
||||
#PSSTUFF1
|
||||
##########################################################################
|
||||
# #
|
||||
# This portion of the file contains some cute examples of the new #
|
||||
# PS-type reminders. You need a PostScript printer or viewer to #
|
||||
# appreciate these. To use them, pipe the output of remind -p into the #
|
||||
# rem2ps program. #
|
||||
# rem2ps program. More examples are in the PSSTUFF2 section, below. #
|
||||
# #
|
||||
##########################################################################
|
||||
|
||||
# Convenient to stick all the PostScript code in a string var - makes
|
||||
# reminders easier to understand and faster. The variable "shade" will
|
||||
# contain PostScript code to shade in a particular box on the calendar.
|
||||
SET shade psshade(95)
|
||||
|
||||
# The following reminder will shade the Saturday and Sunday calendar
|
||||
# entries.
|
||||
REM Sat Sun PS [shade]
|
||||
|
||||
# The following will fill in the Hebrew dates on the calendar. For this
|
||||
# example, I recommend that you use the -sd 10 option for Rem2PS.
|
||||
REM PS Border Border moveto \
|
||||
/DayFont findfont DaySize scalefont setfont \
|
||||
([hebday(today())] [hebmon(today())]) show
|
||||
|
||||
# Fill in the phases of the moon on the PostScript calendar
|
||||
[trigger(moondate(0))] PS [psmoon(0)]
|
||||
[trigger(moondate(1))] PS [psmoon(1)]
|
||||
[trigger(moondate(2))] PS [psmoon(2)]
|
||||
[trigger(moondate(3))] PS [psmoon(3)]
|
||||
|
||||
# The following example puts sunrise and sunset times in PostScript in the
|
||||
# calendar - the sizes are hard-coded, however, and work best in landscape.
|
||||
REM PS Border Border 5 sub moveto \
|
||||
/SmallFont findfont 4 scalefont setfont \
|
||||
(Sunrise: [sunrise(trigdate())] Sunset: [sunset(trigdate())]) show
|
||||
|
||||
# The next one puts the day number (1-366) and days left in the year at the
|
||||
# bottom of the post-script calendar. Again, the hard-coded sizes work best
|
||||
# in landscape.
|
||||
FSET _DayOfYear(x) x-(date(year(x),1,1) - 1)
|
||||
REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
|
||||
/SmallFont findfont 4 scalefont setfont \
|
||||
([_DayOfYear(today())]([365+isleap(today())-_DayOfYear(today())])) show
|
||||
REM Sat Sun SPECIAL SHADE 220
|
||||
|
||||
#USHOLS
|
||||
#############################################################################
|
||||
@@ -403,14 +380,13 @@ OMIT Dec 25 MSG %"Christmas%" Day
|
||||
|
||||
##########################################################################
|
||||
# #
|
||||
# The next block uses the shade variable defined in PSSTUFF above. #
|
||||
# If any US holidays were triggered above, shade in the calendar #
|
||||
# entry in PostScript. This is not quite correct, as it blots out the #
|
||||
# entry in PostScript. This is not quite correct, as it blots out any #
|
||||
# other PostScript stuff above. I was too lazy to do it properly :-) #
|
||||
# #
|
||||
##########################################################################
|
||||
if $NumTrig > SaveTrig
|
||||
REM PS [shade]
|
||||
REM SPECIAL SHADE 220
|
||||
endif
|
||||
|
||||
# Seasons (valid from 1992 to 2000)...
|
||||
@@ -420,6 +396,41 @@ REM Sep [CHOOSE(YEAR(TODAY())-1991, 22,22,23,23,22,22,22,23,22)] \
|
||||
MSG %"Fall%" begins
|
||||
REM Dec [IIF((YEAR(TODAY())+1)%4, 21, 22)] MSG %"Winter%" begins
|
||||
|
||||
#PSSTUFF2
|
||||
##########################################################################
|
||||
# #
|
||||
# Since the SHADE special blots out any previous PostScript #
|
||||
# reminders for a date, these examples need to follow the US Holidays #
|
||||
# section, which uses SHADE. #
|
||||
# #
|
||||
##########################################################################
|
||||
|
||||
# The following will fill in the Hebrew dates on the calendar. For this
|
||||
# example, I recommend that you use the -sd 10 option for Rem2PS.
|
||||
REM PS Border Border moveto \
|
||||
/DayFont findfont DaySize scalefont setfont \
|
||||
([hebday(today())] [hebmon(today())]) show
|
||||
|
||||
# Fill in the phases of the moon on the PostScript calendar
|
||||
[trigger(moondate(0))] SPECIAL MOON 0
|
||||
[trigger(moondate(1))] SPECIAL MOON 1
|
||||
[trigger(moondate(2))] SPECIAL MOON 2
|
||||
[trigger(moondate(3))] SPECIAL MOON 3
|
||||
|
||||
# The following example puts sunrise and sunset times in PostScript in the
|
||||
# calendar - the sizes are hard-coded, however, and work best in landscape.
|
||||
REM PS Border Border 5 sub moveto \
|
||||
/SmallFont findfont 4 scalefont setfont \
|
||||
(Sunrise: [sunrise(trigdate())] Sunset: [sunset(trigdate())]) show
|
||||
|
||||
# The next one puts the day number (1-366) and days left in the year at the
|
||||
# bottom of the post-script calendar. Again, the hard-coded sizes work best
|
||||
# in landscape.
|
||||
FSET _DayOfYear(x) x-(date(year(x),1,1) - 1)
|
||||
REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
|
||||
/SmallFont findfont 4 scalefont setfont \
|
||||
([_DayOfYear(today())]([365+isleap(today())-_DayOfYear(today())])) show
|
||||
|
||||
#JHOLS
|
||||
##########################################################################
|
||||
# #
|
||||
238
install-sh
Executable file
238
install-sh
Executable file
@@ -0,0 +1,238 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
#
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" $Id: kall.1,v 1.2 1996-04-28 02:01:58 dfs Exp $
|
||||
.TH KALL 1 "26 February 1991"
|
||||
.\" $Id: kall.1,v 1.2 1998-02-16 02:35:09 dfs Exp $
|
||||
.TH KALL 1 "15 February 1998"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
kall \- kill processes by command name
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" $Id: rem.1,v 1.2 1996-04-28 02:02:01 dfs Exp $
|
||||
.TH REM 1 "26 February 1991"
|
||||
.\" $Id: rem.1,v 1.2 1998-02-16 02:35:09 dfs Exp $
|
||||
.TH REM 1 "15 February 1998"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
rem \- run 'remind' with a default reminder file
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" $Id: rem2ps.1,v 1.2 1996-04-28 02:02:01 dfs Exp $
|
||||
.TH REM2PS 1 "27 April 1996"
|
||||
.\" $Id: rem2ps.1,v 1.2 1998-02-02 02:57:46 dfs Exp $
|
||||
.TH REM2PS 1 "1 February 1998"
|
||||
.UC4
|
||||
.SH NAME
|
||||
rem2ps \- draw a PostScript calendar from Remind output
|
||||
@@ -9,6 +9,11 @@ rem2ps \- draw a PostScript calendar from Remind output
|
||||
\fBRem2ps\fR reads the standard input, which should be the results of running
|
||||
\fBRemind\fR with the \fB\-p\fR option. It emits PostScript code (which
|
||||
draws a calendar) to the standard output.
|
||||
.PP
|
||||
See the section "Rem2PS Input Format" for details about the \fB\-p\fR
|
||||
data. This may be useful if you wish to create other \fBRemind\fR
|
||||
back-ends.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
@@ -300,6 +305,71 @@ Use that file with the \fBRem2ps\fR \fB\-p\fR option to create calendars
|
||||
with the year and month in large grey letters in the background of the
|
||||
calendar.
|
||||
.PP
|
||||
.SH REM2PS INPUT FORMAT
|
||||
\fBRemind \-p\fR sends the following lines to standard output.
|
||||
The information is designed to be easily parsed by back-end programs:
|
||||
.TP
|
||||
.B # rem2ps begin
|
||||
This line signifies the start of calendar data. Back-ends can search
|
||||
for it to verify they are being fed correct information.
|
||||
.TP
|
||||
\fImonth_name year num_days first_day monday_first\fR
|
||||
On this line, \fImonth_name\fR is the name of the month whose calendar
|
||||
information is about to follow. \fInum_days\fR is the number of days
|
||||
in this month. \fIfirst_day\fR is the weekday of the first day of the
|
||||
month (0 = Sunday, 1 = Monday, 6 = Saturday.) And \fImonday_first\fR is
|
||||
1 if the \fB\-m\fR flag was supplied to \fBRemind\fR, or 0 if it was not.
|
||||
All this information is supplied so back-ends don't need any date calculation
|
||||
facilities.
|
||||
.TP
|
||||
\fIsun mon tue wed thu fri sat\fR
|
||||
This line consists of
|
||||
space-separated names of days in whatever language \fBRemind\fR was
|
||||
compiled for. This information can be used by back-ends to annotate
|
||||
calendars, and means they don't have to be created for a specific
|
||||
language.
|
||||
.TP
|
||||
\fInext_mon next_days\fR
|
||||
The name of the next month and the number of days in it.
|
||||
.TP
|
||||
\fIprev_mon prev_days\fR
|
||||
The name of the previous month and the number of days in it. The
|
||||
\fInext_mon\fR and \fIprev_mon\fR lines could be used to generate small
|
||||
inset calendars for the next and previous months.
|
||||
.PP
|
||||
The remaining data consists of calendar entries, in the following format:
|
||||
.PP
|
||||
\fIyyyy/mm/dd special tag dur time body\fR
|
||||
.PP
|
||||
Here, \fIyyyy\fR is the year, \fImm\fR is the month (01-12) and
|
||||
\fIdd\fR is the day of the month.
|
||||
.PP
|
||||
\fIspecial\fR is a string used
|
||||
for "out-of-band" communication with back-ends. If the reminder
|
||||
is a normal reminder, \fIspecial\fR is "*". The \fBRem2PS\fR
|
||||
back-end understands the specials \fBPostScript\fR and \fBPSFile\fR.
|
||||
Other back-ends may understand other specials. A back end should
|
||||
\fIsilently ignore\fR a reminder with a special it doesn't understand.
|
||||
.PP
|
||||
\fItag\fR is whatever tag the user provided with the \fBTAG\fR clause,
|
||||
or "*" if no tag was provided.
|
||||
.PP
|
||||
\fIdur\fR is the \fBDURATION\fR value in minutes, or "*" if no duration
|
||||
was provided.
|
||||
.PP
|
||||
\fItime\fR is the time of the reminder in minutes past midnight, or
|
||||
"*" if the reminder was not a timed reminder.
|
||||
.PP
|
||||
\fIbody\fR is the body of the reminder.
|
||||
.PP
|
||||
After a month's worth of reminders have been emitted, \fBRemind\fR
|
||||
emits the line:
|
||||
.PP
|
||||
\fB# rem2ps end
|
||||
.PP
|
||||
However, back-ends should keep reading until EOF in case more data for
|
||||
subsequent months is forthcoming.
|
||||
.PP
|
||||
.SH AUTHOR
|
||||
David F. Skoll
|
||||
.SH BUGS
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" $Id: remind.1,v 1.5 1996-10-12 02:49:34 dfs Exp $
|
||||
.TH REMIND 1 "27 April 1996"
|
||||
.\" $Id: remind.1,v 1.8 1998-05-06 01:47:41 dfs Exp $
|
||||
.TH REMIND 1 "1 February 1998"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
remind \- a sophisticated reminder service
|
||||
@@ -15,6 +15,8 @@ If \fIfilename\fR is specified as a single dash '-', then \fBRemind\fR
|
||||
takes its input from standard input. This also implicitly enables
|
||||
the \fB\-o\fR option, described below.
|
||||
.SH OPTIONS
|
||||
\fBRemind\fR has a slew of options. If you're new to the program,
|
||||
ignore them for now and skip to the section "Reminder Files".
|
||||
.TP
|
||||
.B \-n
|
||||
The \fB\-n\fR option causes \fBRemind\fR to print the \fBnext\fR occurrence
|
||||
@@ -57,8 +59,10 @@ of weeks.
|
||||
.B \-p\fR\fIn\fR
|
||||
The \fB\-p\fR option is very similar to the \fB\-s\fR option, except
|
||||
that the output contains additional information for use by the
|
||||
\fBrem2ps\fR program, which creates a PostScript calendar. For this
|
||||
\fBRem2PS\fR program, which creates a PostScript calendar. For this
|
||||
option, \fIn\fR cannot start with "+"; it must specify a number of months.
|
||||
The format of the \fB\-p\fR output is described in the \fBrem2ps(1)\fR
|
||||
man page.
|
||||
.TP
|
||||
.B \-m
|
||||
The \fB\-m\fR option causes the \fB\-c\fR or \fB\-p\fR options to produce
|
||||
@@ -67,6 +71,9 @@ a calendar whose first column is Monday rather than Sunday.
|
||||
.TP
|
||||
.B \-v
|
||||
The \fB\-v\fR option makes the output of \fBRemind\fR slightly more verbose.
|
||||
Currently, this causes \fBRemind\fR to echo a bad line in case of an
|
||||
error, and to print a security message if a script tests the
|
||||
$RunOff system variable.
|
||||
.TP
|
||||
.B \-o
|
||||
The \fB\-o\fR option causes \fBRemind\fR to ignore all \fBONCE\fR directives.
|
||||
@@ -172,6 +179,12 @@ specifies how often (in minutes) \fBRemind\fR should wake up to
|
||||
check if the reminder script has been changed. \fIN\fR defaults
|
||||
to 5, and can range from 5 to 60. Note that the use of the
|
||||
\fB\-z\fR option also enables the \fB\-f\fR option.
|
||||
.PP
|
||||
.RS
|
||||
If you supply the option \fB\-z0\fR, \fBRemind\fR runs in a
|
||||
special mode called \fBserver mode\fR. This is documented
|
||||
in the tkremind man page; see tkremind(1).
|
||||
.RE
|
||||
.TP
|
||||
\fB\-u\fR\fIname\fR (UNIX version only)
|
||||
Runs \fBRemind\fR with the uid and gid of the user specified by \fIname\fR.
|
||||
@@ -179,7 +192,9 @@ The option changes the uid and gid as described, and sets the
|
||||
environment variables HOME, SHELL and USER to the home directory, shell,
|
||||
and user name, respectively, of the specified user. LOGNAME is also
|
||||
set to the specified user name. This option is meant for
|
||||
use in shell scripts which mail reminders to all users.
|
||||
use in shell scripts which mail reminders to all users. Note that
|
||||
as of Remind 3.0.17, using \fB\-u\fR implies \fB\-r\fR -- the RUN
|
||||
directive and shell() functions are disabled.
|
||||
.PP
|
||||
.RS
|
||||
Non-root users can also use the \fB\-u\fR option. However, in this
|
||||
@@ -264,8 +279,10 @@ Its syntax is:
|
||||
[\fBWARN\fR \fIwarn_function\fR]
|
||||
[\fBUNTIL\fR \fIexpiry_date\fR]
|
||||
[\fBSCANFROM\fR \fIscan_date\fR]
|
||||
\fBMSG\fR | \fBMSF\fR | \fBRUN\fR | \fBCAL\fR | \fBSATISFY\fR |
|
||||
\fBPS\fR | \fBPSFILE\fR
|
||||
[\fBDURATION\fR \fIduration\fR]
|
||||
[\fBTAG\fR \fItag\fR]
|
||||
<\fBMSG\fR | \fBMSF\fR | \fBRUN\fR | \fBCAL\fR | \fBSATISFY\fR |
|
||||
\fBSPECIAL\fR \fIspecial\fR | \fBPS\fR | \fBPSFILE\fR>
|
||||
.I body
|
||||
.RE
|
||||
.PP
|
||||
@@ -279,7 +296,7 @@ such as \fBOMIT\fR or \fBRUN\fR. The portion of the \fBREM\fR command
|
||||
before the \fBMSG\fR, \fBMSF\fR \fBRUN\fR, \fBCAL\fR or \fBSATISFY\fR clause
|
||||
is called a \fItrigger\fR.
|
||||
.PP
|
||||
.B "MSG, MSF, RUN, CAL, PS and PSFILE"
|
||||
.B "MSG, MSF, RUN, CAL, SPECIAL, PS and PSFILE"
|
||||
.PP
|
||||
These keywords denote the \fItype\fR
|
||||
of the reminder. (\fBSATISFY\fR is more complicated and will be explained
|
||||
@@ -290,6 +307,15 @@ used the \fB\-k\fR command-line option, then \fBMSG\fR-type reminders are
|
||||
passed to the appropriate program. Note that the options \fB\-c\fR,
|
||||
\fB\-s\fR, \fB\-p\fR and \fB\-n\fR disable the \fB\-k\fR option.
|
||||
.PP
|
||||
Note that you can omit the reminder type, in which case it
|
||||
defaults to \fBMSG\fR. So you can write:
|
||||
.PP
|
||||
.nf
|
||||
6 January David's Birthday
|
||||
.fi
|
||||
.PP
|
||||
although this is not recommended.
|
||||
.PP
|
||||
The \fBMSF\fR keyword is almost the same as the \fBMSG\fR keyword,
|
||||
except that the reminder is formatted to fit into a paragraph-like
|
||||
format. Three system variables control the formatting of \fBMSF\fR-type
|
||||
@@ -320,6 +346,15 @@ programmer. The \fBPS\fR and \fBPSFILE\fR reminders are ignored unless
|
||||
\fBRemind\fR is run with the \fB\-p\fR option. See the section
|
||||
"More about PostScript" for more details.
|
||||
.PP
|
||||
A \fBSPECIAL\fR-type reminder is used to pass "out-of-band" information
|
||||
from \fBRemind\fR to a calendar-producing back-end. It should be followed
|
||||
by a word indicating the type of special data being passed. The type
|
||||
of a special reminder depends on the back-end. For the \fBRem2PS\fR
|
||||
back-end, \fBSPECIAL PostScript\fR is equivalent to a \fBPS\fR-type
|
||||
reminder, and \fBSPECIAL PSFile\fR is equivalent to a \fBPSFILE\fR-type
|
||||
reminder. The body of a \fBSPECIAL\fR reminder is obviously dependent
|
||||
upon the back-end.
|
||||
.PP
|
||||
.B DATE SPECIFICATIONS
|
||||
.PP
|
||||
A \fIdate_spec\fR consists of zero to four parts.
|
||||
@@ -790,6 +825,29 @@ However, discussion must be deferred until after
|
||||
expressions and user-defined functions are explained. See the subsection
|
||||
"Precise Scheduling" further on.
|
||||
.PP
|
||||
.B TAG AND DURATION
|
||||
.PP
|
||||
The \fBTAG\fR keyword lets you "tag" certain reminders. This facility
|
||||
is used by certain back-ends or systems built around \fBRemind\fR,
|
||||
such as \fBTkRemind\fR. These back-ends have specific rules about
|
||||
tags; you should \fInot\fR use the \fBTAG\fR keyword yourself, or
|
||||
your script will interact badly with back-ends.
|
||||
.PP
|
||||
The \fBTAG\fR keyword is followed by a tag consisting of up to
|
||||
32 characters.
|
||||
.PP
|
||||
The \fBDURATION\fR keyword makes sense only for timed reminders;
|
||||
it specifies the duration of an event. Currently, this is not
|
||||
used, but it may be used in future by back-ends or scheduling
|
||||
systems built around \fBRemind\fR. For example, if you have
|
||||
a 90-minute meeting starting at 1:00pm, you could use:
|
||||
.PP
|
||||
.nf
|
||||
REM 5 March 1999 AT 13:00 DURATION 1:30 MSG Meeting
|
||||
.fi
|
||||
.PP
|
||||
Note that \fIduration\fR is specified in hours and minutes.
|
||||
.PP
|
||||
.SH THE SUBSTITUTION FILTER
|
||||
.PP
|
||||
Before being processed, the body of a
|
||||
@@ -1167,7 +1225,7 @@ will begin reading from standard input.
|
||||
.SH THE RUN COMMAND
|
||||
.PP
|
||||
If you include other files in your reminder script, you may not always
|
||||
entirely "trust" the contents of the other files. For example, they
|
||||
entirely trust the contents of the other files. For example, they
|
||||
may contain \fBRUN\fR-type reminders which could be used to access your
|
||||
files or perform undesired actions. The \fBRUN\fR command can restrict
|
||||
this: If you include the command \fBRUN OFF\fR in your top-level reminder
|
||||
@@ -1202,6 +1260,12 @@ your main .reminders file, include the following lines:
|
||||
RUN ON # Re-enable RUN
|
||||
.fi
|
||||
.PP
|
||||
In addition, \fBRemind\fR on UNIX contains a few other security
|
||||
features. It will not read a file which is group- or world-writable.
|
||||
It will not run set-uid. If it reads a file you don't own, it will
|
||||
disable RUN and the shell() function. And if it is run as \fIroot\fR,
|
||||
it will only read files owned by \fIroot\fR.
|
||||
.PP
|
||||
.SH THE BANNER COMMAND
|
||||
.PP
|
||||
When \fBRemind\fR first issues a reminder, it prints a message like this:
|
||||
@@ -2120,6 +2184,10 @@ Here's an example of how to use this:
|
||||
.PP
|
||||
The above command emits PostScript code to lightly shade the boxes
|
||||
for Saturday and Sunday in a PostScript calendar.
|
||||
.PP
|
||||
Note that \fBpsmoon\fR and \fBpsshade\fR are deprecated; instead
|
||||
you should use the SPECIAL SHADE and SPECIAL MOON reminders
|
||||
as described in "Out-of-Band Reminders."
|
||||
.RE
|
||||
.TP
|
||||
.B realnow()
|
||||
@@ -2136,13 +2204,18 @@ in calendar mode, or if a date has been supplied on the command line.
|
||||
Returns -1 if \fInum\fR is negative, 1 if \fInum\fR is positive,
|
||||
and 0 if \fInum\fR is zero.
|
||||
.TP
|
||||
.B shell(s_cmd)
|
||||
.B shell(s_cmd [,i_maxlen])
|
||||
Executes \fIcmd\fR as a system command, and returns the first 511
|
||||
characters of output resulting from \fIcmd\fR. Any whitespace
|
||||
character in the output is converted to a space. Note that if \fBRUN
|
||||
OFF\fR has been executed, or the \fB\-r\fR command-line option has
|
||||
been used, \fBshell()\fR will result in an error, and \fIcmd\fR will
|
||||
not be executed.
|
||||
.PP
|
||||
If \fImaxlen\fR is specified, then \fBshell()\fR returns the first
|
||||
\fImaxlen\fR characters of output (rather than the first 511). If
|
||||
\fImaxlen\fR is specified as a negative number, then \fIall\fR the
|
||||
output from \fIcmd\fR is returned.
|
||||
.TP
|
||||
.B strlen(s_str)
|
||||
Returns the length of \fIstr\fR.
|
||||
@@ -2157,13 +2230,14 @@ of \fIstr\fR.
|
||||
Returns a \fBTIME\fR indicating the time of sunrise on the specified
|
||||
\fIdate\fR (default \fBtoday()\fR.) In high lattitudes, there
|
||||
may be no sunrise on a particular day, in which case \fBsunrise()\fR
|
||||
returns the \fBINT\fR 0.
|
||||
returns the \fBINT\fR 0 if the sun never sets, or 1440 if it never rises.
|
||||
.TP
|
||||
.B sunset([d_date])
|
||||
Returns a \fBTIME\fR indicating the time of sunset on the specified
|
||||
\fIdate\fR (default \fBtoday()\fR.) In high lattitudes, there
|
||||
may be no sunset on a particular day, in which case \fBsunset()\fR
|
||||
returns the \fBINT\fR 0.
|
||||
returns the \fBINT\fR 0 if the sun never rises, or 1440 if it never
|
||||
sets.
|
||||
.RS
|
||||
.PP
|
||||
The functions \fBsunrise()\fR and \fBsunset()\fR are based on
|
||||
@@ -2814,7 +2888,7 @@ and then inserted into the calendar in the appropriate places.
|
||||
If you also supply the \fB\-a\fR option, then \fBRemind\fR will not
|
||||
include timed reminders in the calendar.
|
||||
.PP
|
||||
The \fB\-p\fR option is used in conjunction with the \fBrem2ps\fR
|
||||
The \fB\-p\fR option is used in conjunction with the \fBRem2PS\fR
|
||||
program to produce a calendar in PostScript format. For example, the
|
||||
following command will send PostScript code to standard output:
|
||||
.PP
|
||||
@@ -2963,7 +3037,7 @@ The \fBPS\fR and \fBPSFILE\fR reminders pass PostScript code directly
|
||||
to the printer. They differ in that the \fBPS\fR-type reminder passes
|
||||
its body directly to the PostScript output (after processing by the
|
||||
substitution filter) while the \fBPSFILE\fR-type's body should
|
||||
simply consist of a filename. The \fBRem2ps\fR program will open the
|
||||
simply consist of a filename. The \fBRem2PS\fR program will open the
|
||||
file named in the \fBPSFILE\fR-type reminder, and include its contents in
|
||||
the PostScript output.
|
||||
.PP
|
||||
@@ -3410,6 +3484,59 @@ The jahrzeit information was supplied by Frank Yellin, who quoted
|
||||
"The Comprehensive Hebrew Calendar" by Arthur Spier, and "Calendrical
|
||||
Calculations" by E. M. Reingold and Nachum Dershowitz.
|
||||
.PP
|
||||
.SH OUT-OF-BAND REMINDERS
|
||||
.PP
|
||||
The \fBSPECIAL\fR keyword is used to transmit "out-of-band" information
|
||||
to \fBRemind\fR backends, such as \fBtkremind\fR or \fBRem2PS\fR.
|
||||
They are used only when piping data from a \fBremind -p\fR line.
|
||||
.PP
|
||||
The various \fBSPECIAL\fRs recognized are particular for each
|
||||
backend; however, there are two \fBSPECIAL\fRs which all backends
|
||||
should attempt to support. They are currently supported by
|
||||
\fBRem2PS\fR, \fBtkremind\fR and \fBrem2html\fR.
|
||||
.PP
|
||||
The \fBSHADE\fR special replaces the \fBpsshade()\fR function.
|
||||
Use it like this:
|
||||
.nf
|
||||
REM Sat Sun SPECIAL SHADE 128
|
||||
REM Mon SPECIAL SHADE 255 0 0
|
||||
.fi
|
||||
The \fBSHADE\fR keyword is followed by either one or three numbers,
|
||||
from 0 to 255. If one number is supplied, it is interpreted as
|
||||
a grey-scale value from black (0) to white (255). If three numbers
|
||||
are supplied, they are interpreted as RGB components from minimum (0)
|
||||
to maximum (255). The example above shades weekends a fairly dark
|
||||
grey and makes Mondays a fully-saturated red. (These shadings appear
|
||||
in calendars produced by \fBRem2PS\fR, \fBtkremind\fR and \fBrem2html\fR.)
|
||||
.PP
|
||||
The \fBMOON\fR special replaces the \fBpsmoon()\fR function. Use it
|
||||
like this:
|
||||
.nf
|
||||
REM [trigger(moondate(0))] SPECIAL MOON 0
|
||||
REM [trigger(moondate(1))] SPECIAL MOON 1
|
||||
REM [trigger(moondate(2))] SPECIAL MOON 2
|
||||
REM [trigger(moondate(3))] SPECIAL MOON 3
|
||||
.fi
|
||||
These draw little moons on the various calendars. The complete syntax
|
||||
of the \fBMOON\fR special is as follows:
|
||||
.nf
|
||||
... SPECIAL MOON phase moonsize fontsize msg
|
||||
.fi
|
||||
.PP
|
||||
\fIPhase\fR is a number from 0 to 3, with 0 representing a new moon,
|
||||
1 the first quarter, 2 a full moon and 3 the last quarter.
|
||||
.PP
|
||||
\fImoonsize\fR is the diameter in PostScript units of the moon to
|
||||
draw. If omitted or supplied as -1, the backend chooses an appropriate
|
||||
size.
|
||||
.PP
|
||||
\fIfontsize\fR is the font size in PostScript units of the \fImsg\fR
|
||||
.PP
|
||||
\fIMsg\fR is additional text which is placed near the moon glyph.
|
||||
.PP
|
||||
Note that only the \fBRem2PS\fR backend supports \fImoonsize\fR
|
||||
and \fIfontsize\fR; the other backends use fixed sizes.
|
||||
.PP
|
||||
.SH MISCELLANEOUS
|
||||
.PP
|
||||
.B COMMAND ABBREVIATIONS
|
||||
@@ -3619,6 +3746,9 @@ Marco Paganini (complete)
|
||||
.PP
|
||||
\fBItalian\fR --
|
||||
Valerio Aimale
|
||||
.PP
|
||||
\fBRomanian\fR --
|
||||
Liviu Daia
|
||||
.SH BUGS
|
||||
.PP
|
||||
There's no good reason why read-only system variables are not
|
||||
@@ -3635,8 +3765,8 @@ The UTC functions may not be reliable under MS-DOS.
|
||||
The MS-DOS version of \fBRemind\fR does not support queuing or timed
|
||||
activation of reminders.
|
||||
.PP
|
||||
\fBRemind\fR has some built-in limits on total line length,
|
||||
substitution buffer length, number of global \fBOMIT\fRs, etc.
|
||||
\fBRemind\fR has some built-in limits (for example,
|
||||
number of global \fBOMIT\fRs.)
|
||||
.PP
|
||||
.SH BIBLIOGRAPHY
|
||||
.PP
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" $Id: tkremind.1,v 1.4 1996-09-28 18:46:57 dfs Exp $ "
|
||||
.TH TKREMIND 1 "7 July 1996"
|
||||
.\" $Id: tkremind.1,v 1.6 1998-05-10 01:28:53 dfs Exp $ "
|
||||
.TH TKREMIND 1 "15 February 1998"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
tkremind \- graphical front-end to Remind calendar program
|
||||
@@ -14,9 +14,8 @@ Although not all of \fBRemind\fR's features are available with \fBTkRemind\fR,
|
||||
it creates. This allows you to learn \fBRemind\fR's syntax and then add
|
||||
extra features as you become a more sophisticated \fBRemind\fR programmer.
|
||||
|
||||
\fBTkRemind\fR is written in TCL, and requires tcl version 7.4 and tk
|
||||
version 4.0. It also requires a \fBwish\fR binary. \fBTkRemind\fR runs
|
||||
only under UNIX, and requires X-Windows.
|
||||
\fBTkRemind\fR is written in Tcl, and requires version 8.0
|
||||
(or higher). It also requires a \fBwish\fR binary.
|
||||
|
||||
.SH OPTIONS
|
||||
\fBTkRemind\fR itself has no options. However, it passes certain options
|
||||
@@ -50,16 +49,14 @@ is no specific indication of an over-full box; you'll just have to
|
||||
notice that the box appears completely full.
|
||||
|
||||
.SH NAVIGATING
|
||||
To change to the previous or next month, click the \fBPrevious
|
||||
Month\fR or \fBNext Month\fR button, respectively. To change back to
|
||||
To change to the previous or next month, click the \fB<\-\fR
|
||||
or \fB\->\fR button, respectively. To change back to
|
||||
the current month, click \fBToday\fR. To go to a specific month,
|
||||
click \fBGo To Date...\fR. This pops up a dialog box which allows you
|
||||
to select a month and enter a year. Once you've done this, click
|
||||
\fBGo\fR to go to the date, or \fBCancel\fR to cancel.
|
||||
|
||||
To exit \fBTkRemind\fR, click \fBQuit\fR. By default, TkRemind
|
||||
does not ask for confirmation. If it has been configured
|
||||
to ask for confirmation, click \fBYes\fR in the dialog box which pops up.
|
||||
To exit \fBTkRemind\fR, click \fBQuit\fR.
|
||||
|
||||
.SH ADDING REMINDERS
|
||||
To add a reminder, click button 1 in any day number in the calendar.
|
||||
@@ -74,7 +71,7 @@ appear when you click the raised value buttons.
|
||||
|
||||
The next control specifies an expiry date for the reminder. Select
|
||||
the check button to enable an expiry date, and fill in the values
|
||||
using pull pull-down menus.
|
||||
using pull-down menus.
|
||||
|
||||
The third control specifes how much advance notice you want (if any),
|
||||
and whether or not weekends and holidays are counted when computing advance
|
||||
@@ -132,18 +129,92 @@ Note that during printing, \fBRemind\fR is \fInot\fR called with
|
||||
the \fB-itkremind=1\fR option, because it is operated in normal
|
||||
PostScript-producing mode.
|
||||
|
||||
.SH EDITING REMINDERS
|
||||
|
||||
If you created a reminder with \fBTkRemind\fR, it will turn red as the
|
||||
mouse cursor passes over it in the calendar window. Click
|
||||
button-1 over the reminder and you will be presented with a dialog
|
||||
window whose state is identical to the one used to create the reminder.
|
||||
At this point, you can change the reminder by editing the dialog
|
||||
entries and selecting \fBReplace reminder\fR. You can delete the
|
||||
reminder entirely by selecting \fBDelete reminder\fR. The remaining
|
||||
buttons, \fBPreview reminder\fR and \fBCancel\fR operate identically
|
||||
to the dialog in "ADDING REMINDERS."
|
||||
|
||||
Note that if you edit a reminder (using \fBPreview reminder\fR),
|
||||
any edits you made are \fInot\fR retained in the dialog box. You
|
||||
should not attempt to edit such reminders; you have to retype them
|
||||
in the \fBPreview reminder\fR dialog.
|
||||
|
||||
If the reminder was not created with \fBTkRemind\fR, you can't edit
|
||||
it with \fBTkRemind\fR.
|
||||
|
||||
.SH BACKGROUND REMINDERS
|
||||
|
||||
If you create "timed" reminders, \fBTkRemind\fR will queue them in
|
||||
the background and pop up boxes as they are triggered. Additionally,
|
||||
if you created the reminder using \fBTkRemind\fR, you will be given the
|
||||
option of "turning off" the reminder for the rest of the day.
|
||||
\fBTkRemind\fR achieves queueing of background reminders by running
|
||||
\fBRemind\fR in \fIserver mode\fR, described later.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
The final button on the calendar window, \fBOptions\fR, lets you configure
|
||||
certain aspects of \fBTkRemind\fR. The configuration options are:
|
||||
|
||||
.TP
|
||||
.B Start up Iconified
|
||||
If this is selected, \fBTkRemind\fR starts up iconified. Otherwise,
|
||||
it starts up in a normal window.
|
||||
|
||||
.TP
|
||||
.B Confirm Quit
|
||||
If this is selected, you will be asked to confirm when you press
|
||||
\fBQuit\fR. If not, \fBTkRemind\fR quits without prompting.
|
||||
|
||||
.TP
|
||||
.B Automatically close pop-up reminders after a minute
|
||||
If this is selected, pop-up reminder boxes will be closed after one minute
|
||||
has elapsed. Otherwise, they remain on your screen forever until you
|
||||
explicitly dismiss them.
|
||||
|
||||
.TP
|
||||
.B Beep terminal when popping up a reminder
|
||||
If selected, \fBTkRemind\fR beeps the terminal bell when a queued reminder
|
||||
pops up.
|
||||
|
||||
.TP
|
||||
.B Deiconify calendar window when popping up a reminder
|
||||
If selected, does what it says.
|
||||
|
||||
.TP
|
||||
.B Run command when popping up a reminder
|
||||
If this entry is not blank, the specified command is run whenever a
|
||||
background reminder pops up.
|
||||
|
||||
.TP
|
||||
.B Feed popped-up reminder to command's standard input
|
||||
If selected, feeds the text of the reminder to the command described
|
||||
above.
|
||||
.PP
|
||||
Once you've configured the options the way you like them,
|
||||
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
|
||||
to put them into effect and save them in $HOME/.tkremindrc, or
|
||||
\fBCancel\fR to cancel any changes you made.
|
||||
|
||||
.SH ODDS AND ENDS
|
||||
\fBTkRemind\fR performs some basic consistency checks when you add or
|
||||
preview a reminder. However, if you edit a reminder in the previewer,
|
||||
\fBTkRemind\fR does \fInot\fR check the edited reminder. You can
|
||||
produce illegal reminders which may cause problems. (This is one good
|
||||
reason to isolate \fBTkRemind\fR's reminders in a separate file.)
|
||||
|
||||
.PP
|
||||
\fBTkRemind\fR does \fInot\fR check the body of the reminder in any
|
||||
way. You can use the normal \fBRemind\fR substitution sequences in
|
||||
the body. Furthermore, if you use expression-pasting in the body,
|
||||
\fBTkRemind\fR does \fInot\fR validate the expressions.
|
||||
|
||||
.PP
|
||||
When \fBTkRemind\fR invokes \fBRemind\fR, it supplies the option:
|
||||
.PP
|
||||
.nf
|
||||
@@ -160,11 +231,90 @@ on the command line. So, in your \fBRemind\fR file, you can include:
|
||||
.PP
|
||||
You can use this to activate certain reminders in different ways
|
||||
for \fBTkRemind\fR (for example).
|
||||
.PP
|
||||
\fBTkRemind\fR uses tags to keep track of reminders in the
|
||||
script file. It also places special comments in the reminder
|
||||
file to store additional state. You can certainly mix
|
||||
"hand-crafted" reminders with reminders created by \fBTkRemind\fR
|
||||
if you are awared of the following rules and limitations:
|
||||
.TP
|
||||
o
|
||||
Do not use the \fBTAG\fR keyword in hand-crafted reminders.
|
||||
.TP
|
||||
o
|
||||
Do not edit lines starting with "# TKTAGnnn", "# TKEND", or any
|
||||
lines in between. You can move such lines, but be careful to move
|
||||
them as a single block.
|
||||
.TP
|
||||
o
|
||||
Hand-crafted reminders cannot be edited with \fBTkRemind\fR, and
|
||||
for hand-crafted timed reminders, you will not be presented with
|
||||
the "Don't remind me again" option when they pop up.
|
||||
|
||||
.SH SERVER MODE
|
||||
|
||||
\fBRemind\fR has a special mode for interacting with programs like
|
||||
\fBTkRemind\fR. This mode is called \fIserver mode\fR and is
|
||||
selected by supplying the \fB\-z0\fR option to \fBRemind\fR.
|
||||
|
||||
In server mode, \fBRemind\fR operates similar to daemon mode, except
|
||||
it reads commands (one per line)
|
||||
from standard input and writes status lines to standard output.
|
||||
|
||||
The commands accepted in server mode are:
|
||||
|
||||
.TP
|
||||
EXIT
|
||||
Terminate the \fBRemind\fR process. EOF on standard input does the
|
||||
same thing.
|
||||
|
||||
.TP
|
||||
STATUS
|
||||
Return the number of queued reminders.
|
||||
|
||||
.TP
|
||||
REREAD
|
||||
Re-read the reminder file
|
||||
|
||||
.PP
|
||||
The status lines written are as follows:
|
||||
|
||||
.TP
|
||||
NOTE reminder \fItime\fR \fItag\fR
|
||||
Signifies the beginning of a timed reminder whose trigger time is
|
||||
\fItime\fR with tag \fItag\fR. If the reminder has no tag, an
|
||||
asterisk is supplied for \fItag\fR. All lines following this line
|
||||
are the body of the reminder, until the line \fBNOTE endreminder\fR
|
||||
is transmitted.
|
||||
|
||||
.TP
|
||||
NOTE newdate
|
||||
This line is emitted whenever \fBRemind\fR has detected a rollover of
|
||||
the system date. The front-end program should redraw its calendar
|
||||
or take whatever other action is needed.
|
||||
|
||||
.TP
|
||||
NOTE reread
|
||||
This line is emitted whenever the number of reminders in \fBRemind\fR's
|
||||
queue changes because of a date rollover or a \fBREREAD\fR command.
|
||||
The front-end should issue a \fBSTATUS\fR command in response to this
|
||||
message.
|
||||
|
||||
.TP
|
||||
NOTE queued \fIn\fR
|
||||
This line is emitted in response to a \fBSTATUS\fR command. The number
|
||||
\fIn\fR is the number of reminders in the queue.
|
||||
|
||||
.SH AUTHOR
|
||||
David F. Skoll
|
||||
|
||||
\fBTkRemind\fR is Copyright 1996 by David F. Skoll
|
||||
\fBTkRemind\fR is Copyright 1996-1998 by David F. Skoll
|
||||
|
||||
.SH FILES
|
||||
|
||||
$HOME/.reminders -- default reminder file.
|
||||
|
||||
$HOME/.tkremindrc -- \fBTkRemind\fR saved options.
|
||||
|
||||
.SH SEE ALSO
|
||||
remind, rem2ps
|
||||
@@ -1,24 +1,23 @@
|
||||
Begin3
|
||||
Title: Remind
|
||||
Version: 03.00.15
|
||||
Entered-date: 27 October 1996
|
||||
Version: 03.00.19
|
||||
Entered-date: 9 May 1998
|
||||
Description: Full-featured calendar/reminder program featuring
|
||||
sophisticated date calculation, moon phases, sunrise/sunset,
|
||||
Hebrew calendar, alarms, PostScript output, X-Windows
|
||||
front-end, multilingual messages, and proper handling of
|
||||
holidays. Available for UNIX, MS-DOS, OS/2, and other
|
||||
platforms.
|
||||
Keywords: calendar reminder alarm datebook PostScript
|
||||
platforms. Includes scripts for making a nice WWW
|
||||
calendar server.
|
||||
Keywords: calendar reminder alarm datebook PostScript www
|
||||
Author: aa775@freenet.carleton.ca (David F. Skoll)
|
||||
Maintained-by: aa775@freenet.carleton.ca (David F. Skoll)
|
||||
Primary-site: ftp.doe.carleton.ca /pub/Remind-3.0
|
||||
215kB remind-3.0.15.tgz
|
||||
266kB remind-3.0.19.tgz
|
||||
Alternate-site:
|
||||
Original-site:
|
||||
Platform: Linux, Solaris, SunOS, HP-UX -- virtually any UN*X-like
|
||||
system. Wish 4.x required for TCL/Tk front-end, but
|
||||
system. Wish 8.x required for TCL/Tk front-end, but
|
||||
this is not essential to use the software.
|
||||
Copying-policy: An AMENDED version of GPL. The amendments prohibit
|
||||
porting to MS Windows and use by a certain Canadian
|
||||
corporation.
|
||||
Copying-policy: GPL (No ports to MS Windows allowed)
|
||||
End
|
||||
10
scripts/README
Normal file
10
scripts/README
Normal file
@@ -0,0 +1,10 @@
|
||||
Files in this directory:
|
||||
|
||||
kall -- Kills a program by command name, as in "kall remind"
|
||||
rem -- Starts Remind with a default file of $HOME/.reminders
|
||||
remind-all.csh -- Mails reminders to all users (C-Shell version)
|
||||
remind-all.sh -- Mails reminders to all users (Bourne Shell version)
|
||||
tkremind* -- Tcl/Tk graphical calendar using Remind as engine
|
||||
|
||||
$Id: README,v 1.1 1998-01-15 02:50:20 dfs Exp $
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $Id: kall,v 1.1 1996-03-27 03:25:59 dfs Exp $
|
||||
# $Id: kall,v 1.1 1998-01-15 02:50:20 dfs Exp $
|
||||
#
|
||||
# kall - kill all processes belonging to this user that match
|
||||
# specified string.
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# rem - by David Skoll - 26 February 1991
|
||||
#
|
||||
# $Id: rem,v 1.1 1996-03-27 03:26:06 dfs Exp $
|
||||
# $Id: rem,v 1.1 1998-01-15 02:50:21 dfs Exp $
|
||||
#
|
||||
# This script runs 'remind' with a default reminder file assumed. You
|
||||
# can override the default by using "rem -F newfile ..." (But why would
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Shell script to mail all users reminders.
|
||||
|
||||
# $Id: remind-all.csh,v 1.1 1996-03-27 03:26:08 dfs Exp $
|
||||
# $Id: remind-all.csh,v 1.1 1998-01-15 02:50:21 dfs Exp $
|
||||
|
||||
# Run it AFTER MIDNIGHT so that date is correct!
|
||||
# On our system, we have the following in our crontab:
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
# This file is part of REMIND
|
||||
#
|
||||
# $Id: remind-all.sh,v 1.1 1996-03-27 03:26:08 dfs Exp $
|
||||
# $Id: remind-all.sh,v 1.2 1998-02-14 03:56:27 dfs Exp $
|
||||
#
|
||||
# REMIND is Copyright (C) 1992-1996 by David F. Skoll
|
||||
# REMIND is Copyright (C) 1992-1998 by David F. Skoll
|
||||
# This file is Copyright (C) 1990 by Bill Aten
|
||||
|
||||
# Thanks to Bill Aten for this script.
|
||||
File diff suppressed because it is too large
Load Diff
87
src/Makefile.in
Normal file
87
src/Makefile.in
Normal file
@@ -0,0 +1,87 @@
|
||||
# Makefile.in for REMIND
|
||||
#
|
||||
# $Id: Makefile.in,v 1.11 1998-05-10 02:19:20 dfs Exp $
|
||||
|
||||
VERSION= 03.00.19
|
||||
SHELL= /bin/sh
|
||||
|
||||
srcdir=@srcdir@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
mandir=@mandir@
|
||||
bindir=@bindir@
|
||||
datadir=@datadir@
|
||||
VPATH=$(srcdir)
|
||||
|
||||
INSTALL=@INSTALL@
|
||||
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
||||
INSTALL_DATA=@INSTALL_DATA@
|
||||
|
||||
PROGS= remind rem2ps
|
||||
SCRIPTS= $(srcdir)/../scripts/kall $(srcdir)/../scripts/rem \
|
||||
$(srcdir)/../scripts/tkremind
|
||||
MANS= $(srcdir)/../man/kall.1 $(srcdir)/../man/rem.1 \
|
||||
$(srcdir)/../man/rem2ps.1 $(srcdir)/../man/remind.1 \
|
||||
$(srcdir)/../man/tkremind.1
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
REMINDSRCS= calendar.c dynbuf.c dorem.c dosubst.c expr.c files.c funcs.c \
|
||||
globals.c hbcal.c init.c main.c moon.c omit.c queue.c sort.c \
|
||||
token.c trigger.c userfns.c utils.c var.c
|
||||
|
||||
REMINDOBJS= $(REMINDSRCS:.c=.o)
|
||||
|
||||
all: remind rem2ps
|
||||
|
||||
test: remind
|
||||
sh ../tests/test-rem
|
||||
|
||||
.c.o:
|
||||
@CC@ -c @CFLAGS@ @DEFS@ $(LANGDEF) -DUNIX -I. -I$(srcdir) $<
|
||||
|
||||
rem2ps: rem2ps.o dynbuf.o
|
||||
@CC@ @LDFLAGS@ -o rem2ps rem2ps.o dynbuf.o
|
||||
|
||||
remind: $(REMINDOBJS)
|
||||
@CC@ @LDFLAGS@ -o remind $(REMINDOBJS) @LIBS@
|
||||
|
||||
install: all
|
||||
for prog in $(PROGS) $(SCRIPTS) ; do \
|
||||
$(INSTALL_PROGRAM) $$prog $(bindir) ; \
|
||||
done
|
||||
-strip $(bindir)/remind
|
||||
-strip $(bindir)/rem2ps
|
||||
for man in $(MANS) ; do \
|
||||
$(INSTALL_DATA) $$man $(mandir)/man1 ; \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ core *.bak $(PROGS)
|
||||
|
||||
clobber:
|
||||
rm -f *.o *~ remind rem2ps test.out core *.bak
|
||||
|
||||
depend:
|
||||
gccmakedep @DEFS@ -DUNIX $(REMINDSRCS) rem2ps.c
|
||||
|
||||
# The next targets are not very useful to you. I use them to build
|
||||
# distributions, etc.
|
||||
|
||||
# Build a tar file based on all files checked into CVS.
|
||||
tgz:
|
||||
ln -s .. remind-$(VERSION)
|
||||
peekentry `find remind-$(VERSION) -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION).tar
|
||||
gzip -v -9 remind-$(VERSION).tar
|
||||
mv remind-$(VERSION).tar.gz remind-$(VERSION).tgz
|
||||
rm -f remind-$(VERSION)
|
||||
|
||||
beta-tgz:
|
||||
ln -s .. remind-$(VERSION)-BETA
|
||||
peekentry `find remind-$(VERSION)-BETA -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION)-BETA.tar
|
||||
gzip -v -9 remind-$(VERSION)-BETA.tar
|
||||
mv remind-$(VERSION)-BETA.tar.gz remind-$(VERSION)-BETA.tgz
|
||||
rm -f remind-$(VERSION)-BETA
|
||||
#---------------- Stuff after this added by "make depend" -----------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#$Id: Makefile_QDOS,v 1.3 1996-09-28 18:17:06 dfs Exp $
|
||||
#$Id: Makefile_QDOS,v 1.2 1998-03-01 20:43:53 dfs Exp $
|
||||
# Makefile for REMIND for QDOS / SMSQ
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -24,7 +24,7 @@ LDFLAGS= -bufp200K
|
||||
# YOU SHOULDN'T EDIT ANYTHING BELOW HERE. You may want to change some things
|
||||
# in config_h; then, you should be able to type 'make'.
|
||||
#-----------------------------------------------------------------------------
|
||||
VERSION= 03.00.15
|
||||
VERSION= 03.00.19
|
||||
MATHLIB= -lm
|
||||
|
||||
HDRS= config_h err_h expr_h globals_h protos_h types_h version_h \
|
||||
@@ -7,10 +7,11 @@
|
||||
/* This file is Copyright (C) 1995 by Martin Hohl */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Remind is Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Remind is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static char const RCSID[] = "$Id: amiga.c,v 1.1 1996-03-31 04:01:53 dfs Exp $";
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: amiga.c,v 1.2 1998-02-10 03:15:46 dfs Exp $";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -5,22 +5,25 @@
|
||||
/* The code for generating a calendar. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.2 1996-03-31 04:01:54 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.7 1998-03-25 02:47:19 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "protos.h"
|
||||
#include "expr.h"
|
||||
@@ -34,6 +37,9 @@ typedef struct cal_entry {
|
||||
char *pos;
|
||||
int time;
|
||||
int priority;
|
||||
char tag[TAG_LEN+1];
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
int duration;
|
||||
} CalEntry;
|
||||
|
||||
/* Global variables */
|
||||
@@ -203,6 +209,9 @@ static void DoCalendarOneMonth()
|
||||
printf("%s %d %d %d %d\n",
|
||||
MonthName[m], y, DaysInMonth(m, y), (JulianToday+1) % 7,
|
||||
MondayFirst);
|
||||
printf("%s %s %s %s %s %s %s\n",
|
||||
DayName[6], DayName[0], DayName[1], DayName[2],
|
||||
DayName[3], DayName[4], DayName[5]);
|
||||
mm = m-1;
|
||||
if (mm<0) {
|
||||
mm = 11; yy = y-1;
|
||||
@@ -631,7 +640,7 @@ ParsePtr p;
|
||||
int col;
|
||||
#endif
|
||||
{
|
||||
|
||||
int oldLen;
|
||||
Trigger trig;
|
||||
TimeTrig tim;
|
||||
Value v;
|
||||
@@ -641,10 +650,11 @@ int col;
|
||||
CalEntry *CurPs = CalPs[col];
|
||||
CalEntry *e;
|
||||
char *s, *s2;
|
||||
static char buf[TOKSIZE];
|
||||
static char obuf[LINELEN];
|
||||
DynamicBuffer buf, obuf;
|
||||
Token tok;
|
||||
|
||||
DBufInit(&buf);
|
||||
|
||||
/* Parse the trigger date and time */
|
||||
if ( (r=ParseRem(p, &trig, &tim)) ) return r;
|
||||
|
||||
@@ -656,11 +666,22 @@ int col;
|
||||
if (trig.typ == SAT_TYPE) {
|
||||
r=DoSatRemind(&trig, &tim, p);
|
||||
if (r) return r;
|
||||
r=ParseToken(p, buf);
|
||||
r=ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
FindToken(buf, &tok);
|
||||
FindToken(DBufValue(&buf), &tok);
|
||||
DBufFree(&buf);
|
||||
if (tok.type == T_Empty || tok.type == T_Comment) return OK;
|
||||
if (tok.type != T_RemType || tok.val == SAT_TYPE) return E_PARSE_ERR;
|
||||
if (tok.val == PASSTHRU_TYPE) {
|
||||
r=ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
if (!DBufLen(&buf)) {
|
||||
DBufFree(&buf);
|
||||
return E_EOLN;
|
||||
}
|
||||
StrnCpy(trig.passthru, DBufValue(&buf), PASSTHRU_LEN);
|
||||
DBufFree(&buf);
|
||||
}
|
||||
trig.typ = tok.val;
|
||||
jul = LastTriggerDate;
|
||||
if (!LastTrigValid) return OK;
|
||||
@@ -670,58 +691,97 @@ int col;
|
||||
if (r) return r;
|
||||
}
|
||||
|
||||
if (!PsCal && (trig.typ == PS_TYPE || trig.typ == PSF_TYPE)) return OK;
|
||||
/* Convert PS and PSF to PASSTHRU */
|
||||
if (trig.typ == PS_TYPE) {
|
||||
strcpy(trig.passthru, "PostScript");
|
||||
trig.typ = PASSTHRU_TYPE;
|
||||
} else if (trig.typ == PSF_TYPE) {
|
||||
strcpy(trig.passthru, "PSFile");
|
||||
trig.typ = PASSTHRU_TYPE;
|
||||
}
|
||||
if (!PsCal && trig.typ == PASSTHRU_TYPE) return OK;
|
||||
|
||||
/* Remove any "at" times from PS or PSFILE reminders */
|
||||
if (trig.typ == PS_TYPE || trig.typ == PSF_TYPE) tim.ttime = NO_TIME;
|
||||
if (trig.typ == PASSTHRU_TYPE) {
|
||||
tim.ttime = NO_TIME;
|
||||
tim.duration = NO_TIME;
|
||||
}
|
||||
|
||||
/* If trigger date == today, add it to the current entry */
|
||||
DBufInit(&obuf);
|
||||
if (jul == JulianToday) {
|
||||
NumTriggered++;
|
||||
s = obuf;
|
||||
*s = 0;
|
||||
if (DoSimpleCalendar || tim.ttime != NO_TIME)
|
||||
s += strlen(SimpleTime(tim.ttime, s));
|
||||
if (trig.typ != PS_TYPE && trig.typ != PSF_TYPE &&
|
||||
if (DoSimpleCalendar || tim.ttime != NO_TIME) {
|
||||
if (DBufPuts(&obuf, SimpleTime(tim.ttime)) != OK) {
|
||||
DBufFree(&obuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
}
|
||||
if (trig.typ != PASSTHRU_TYPE &&
|
||||
UserFuncExists("calprefix")==1) {
|
||||
sprintf(buf, "calprefix(%d)", trig.priority);
|
||||
s2 = buf;
|
||||
char evalBuf[64];
|
||||
sprintf(evalBuf, "calprefix(%d)", trig.priority);
|
||||
s2 = evalBuf;
|
||||
r = EvalExpr(&s2, &v);
|
||||
if (!r) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
strcat(s, v.v.str);
|
||||
s += strlen(s);
|
||||
if (DBufPuts(&obuf, v.v.str) != OK) {
|
||||
DestroyValue(v);
|
||||
DBufFree(&obuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
}
|
||||
DestroyValue(v);
|
||||
}
|
||||
}
|
||||
if ( (r=DoSubst(p, s, &trig, &tim, jul, CAL_MODE)) ) return r;
|
||||
if (!*s) return OK;
|
||||
if (trig.typ != PS_TYPE && trig.typ != PSF_TYPE &&
|
||||
oldLen = DBufLen(&obuf);
|
||||
if ( (r=DoSubst(p, &obuf, &trig, &tim, jul, CAL_MODE)) ) {
|
||||
DBufFree(&obuf);
|
||||
return r;
|
||||
}
|
||||
if (DBufLen(&obuf) <= oldLen) {
|
||||
DBufFree(&obuf);
|
||||
return OK;
|
||||
}
|
||||
if (trig.typ != PASSTHRU_TYPE &&
|
||||
UserFuncExists("calsuffix")==1) {
|
||||
sprintf(buf, "calsuffix(%d)", trig.priority);
|
||||
s2 = buf;
|
||||
char evalBuf[64];
|
||||
sprintf(evalBuf, "calsuffix(%d)", trig.priority);
|
||||
s2 = evalBuf;
|
||||
r = EvalExpr(&s2, &v);
|
||||
if (!r) {
|
||||
if (!DoCoerce(STR_TYPE, &v)) {
|
||||
strcat(s, v.v.str);
|
||||
s += strlen(s);
|
||||
if (DBufPuts(&obuf, v.v.str) != OK) {
|
||||
DestroyValue(v);
|
||||
DBufFree(&obuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
}
|
||||
DestroyValue(v);
|
||||
}
|
||||
}
|
||||
s = obuf;
|
||||
s = DBufValue(&obuf);
|
||||
if (!DoSimpleCalendar) while (isspace(*s)) s++;
|
||||
e = NEW(CalEntry);
|
||||
if (!e) return E_NO_MEM;
|
||||
if (!e) {
|
||||
DBufFree(&obuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
e->text = StrDup(s);
|
||||
DBufFree(&obuf);
|
||||
if (!e->text) {
|
||||
free(e);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
StrnCpy(e->tag, trig.tag, TAG_LEN);
|
||||
if (!e->tag[0]) {
|
||||
strcpy(e->tag, "*");
|
||||
}
|
||||
e->duration = tim.duration;
|
||||
e->priority = trig.priority;
|
||||
if (trig.typ == PS_TYPE || trig.typ == PSF_TYPE) {
|
||||
e->pos = (trig.typ == PS_TYPE) ? "P" : "F";
|
||||
if (trig.typ == PASSTHRU_TYPE) {
|
||||
StrnCpy(e->passthru, trig.passthru, PASSTHRU_LEN);
|
||||
e->pos = e->passthru;
|
||||
e->time = NO_TIME;
|
||||
e->next = CurPs;
|
||||
CalPs[col] = e;
|
||||
@@ -755,12 +815,22 @@ int col, jul;
|
||||
CalEntry *n;
|
||||
int y, m, d;
|
||||
|
||||
/* Do all the PostScript entries first, if any */
|
||||
/* Do all the PASSTHRU entries first, if any */
|
||||
FromJulian(jul, &y, &m, &d);
|
||||
while(e) {
|
||||
printf("%c%c%c%c%c%02d%c%02d ", *(e->pos), *(e->pos),
|
||||
*(e->pos), *(e->pos), DATESEP,
|
||||
m+1, DATESEP, d);
|
||||
printf("%04d/%02d/%02d ", y, m+1, d);
|
||||
printf("%s ", e->passthru);
|
||||
printf("%s ", e->tag);
|
||||
if (e->duration != NO_TIME) {
|
||||
printf("%d ", e->duration);
|
||||
} else {
|
||||
printf("* ");
|
||||
}
|
||||
if (e->time != NO_TIME) {
|
||||
printf("%d ", e->time);
|
||||
} else {
|
||||
printf("* ");
|
||||
}
|
||||
printf("%s\n", e->text);
|
||||
free(e->text);
|
||||
n = e->next;
|
||||
@@ -771,7 +841,18 @@ int col, jul;
|
||||
|
||||
e = CalColumn[col];
|
||||
while(e) {
|
||||
printf("%04d%c%02d%c%02d ", y, DATESEP, m+1, DATESEP, d);
|
||||
printf("%04d/%02d/%02d", y, m+1, d);
|
||||
printf(" * %s ", e->tag);
|
||||
if (e->duration != NO_TIME) {
|
||||
printf("%d ", e->duration);
|
||||
} else {
|
||||
printf("* ");
|
||||
}
|
||||
if (e->time != NO_TIME) {
|
||||
printf("%d ", e->time);
|
||||
} else {
|
||||
printf("* ");
|
||||
}
|
||||
printf("%s\n", e->text);
|
||||
free(e->text);
|
||||
n = e->next;
|
||||
@@ -837,49 +918,44 @@ static void WriteCalDays()
|
||||
/* SimpleTime */
|
||||
/* */
|
||||
/* Format the time according to simple time format. */
|
||||
/* If out is NULL, result placed in internal static buffer. */
|
||||
/* Answer is returned in a static buffer. */
|
||||
/* A trailing space is always added. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC char *SimpleTime(int tim, char *out)
|
||||
PUBLIC char *SimpleTime(int tim)
|
||||
#else
|
||||
char *SimpleTime(tim, out)
|
||||
char *SimpleTime(tim)
|
||||
int tim;
|
||||
char *out;
|
||||
#endif
|
||||
{
|
||||
static buf[9];
|
||||
static char buf[32];
|
||||
int h, min, hh;
|
||||
|
||||
if (!out) out = (char *) buf;
|
||||
|
||||
*out = 0;
|
||||
buf[0] = 0;
|
||||
|
||||
switch(ScFormat) {
|
||||
|
||||
case SC_AMPM:
|
||||
if (tim == NO_TIME) sprintf(out, " ");
|
||||
else {
|
||||
if (tim != NO_TIME) {
|
||||
h = tim / 60;
|
||||
min = tim % 60;
|
||||
if (h == 0) hh=12;
|
||||
else if (h > 12) hh=h-12;
|
||||
else hh=h;
|
||||
sprintf(out, "%2d%c%02d%s ", hh, TIMESEP, min, (h>=12) ? L_PM : L_AM);
|
||||
sprintf(buf, "%2d%c%02d%s ", hh, TIMESEP, min, (h>=12) ? L_PM : L_AM);
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_MIL:
|
||||
if (tim == NO_TIME) sprintf(out, " ");
|
||||
else {
|
||||
if (tim != NO_TIME) {
|
||||
h = tim / 60;
|
||||
min = tim % 60;
|
||||
sprintf(out, "%02d%c%02d ", h, TIMESEP, min);
|
||||
sprintf(buf, "%02d%c%02d ", h, TIMESEP, min);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return out;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
80
src/config.h.in
Normal file
80
src/config.h.in
Normal file
@@ -0,0 +1,80 @@
|
||||
/* src/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* $Id: config.h.in,v 1.3 1998-02-16 03:41:44 dfs Exp $ */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
/* Define if you don't have vprintf but do have _doprnt. */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#undef HAVE_UTIME_NULL
|
||||
|
||||
/* Define if you have the vprintf function. */
|
||||
#undef HAVE_VPRINTF
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
/* Define if you have the mktime function. */
|
||||
#undef HAVE_MKTIME
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#undef HAVE_STRSTR
|
||||
|
||||
/* Define if you have the timegm function. */
|
||||
#undef HAVE_TIMEGM
|
||||
|
||||
/* Define if you have the difftime function. */
|
||||
#undef HAVE_DIFFTIME
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the m library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
#include "custom.h"
|
||||
@@ -1,27 +1,26 @@
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* CONFIG.H */
|
||||
/* CUSTOM.H.IN */
|
||||
/* */
|
||||
/* Contains various configuration parameters for Remind. */
|
||||
/* You may have to edit this file to tweak parameters or take */
|
||||
/* care of certain system dependencies. */
|
||||
/* Contains various configuration parameters for Remind */
|
||||
/* which you can customize. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: config.h,v 1.5 1996-10-12 02:49:32 dfs Exp $ */
|
||||
/* $Id: custom.h,v 1.15 1998-03-01 21:04:27 dfs Exp $ */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||
/* LOCATION: A string identifying your location. */
|
||||
/* For latitude, north is positive, south is negative. */
|
||||
/* For longitude, west is positive, east is negative. */
|
||||
/* NOTE: For negative numbers, all three of DEG, MIN, SEC should be */
|
||||
/* negative. To indicate -20deg22'33'' use */
|
||||
/* DEG=-20, MIN=-22 and SEC=-33. */
|
||||
/* All latitude and longitude numbers should be positive for the */
|
||||
/* northern and western hemisphere. If you live in the southern */
|
||||
/* hemisphere, ALL latitude values should be negative. If you live */
|
||||
/* in the eastern hemisphere, ALL longitude values should be negative. */
|
||||
/* */
|
||||
/* The default values are initially set to Ottawa, Ontario, Canada. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define LAT_DEG 45
|
||||
@@ -32,21 +31,6 @@
|
||||
#define LON_SEC 0
|
||||
#define LOCATION "Ottawa"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* HAVE_MKTIME: Define this if your C library includes the mktime() */
|
||||
/* function. Otherwise, will attempt to use the Unix */
|
||||
/* style time manipulations. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define HAVE_MKTIME 1
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* NEED_TIMEGM: If your C library does not have mktime() and it ALSO */
|
||||
/* does not have timelocal() or timegm(), uncomment the */
|
||||
/* next line. If HAVE_MKTIME is defined, NEED_TIMEGM is */
|
||||
/* ignored. Very few systems should require NEED_TIMEGM. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* #define NEED_TIMEGM 1 */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* DEFAULT_PAGE: The default page size to use for Rem2PS. */
|
||||
/* The Letter version is appropriate for North America; the A4 version */
|
||||
@@ -70,18 +54,37 @@
|
||||
/* #define TIMESEP '.' */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* ISOLATIN1: uncomment the following line if your system uses the */
|
||||
/* ISOLATIN1: define it to 1 if you use the */
|
||||
/* ISO 8859-1 character set instead of ASCII. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define ISOLATIN1 1
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* IBMEXTENDED: uncomment the following line if you want to use the */
|
||||
/* IBM extended character set. NOT ALL LANGUAGE MODULES SUPPORT THIS. */
|
||||
/* Note that at most one of ISOLATIN1 or IBMEXTENDED should be */
|
||||
/* defined; if both are defined, the results are unspecified. */
|
||||
/* ISOLATIN2: define it to 1 if you use the */
|
||||
/* ISO 8859-2 character set instead of ASCII. */
|
||||
/* NOT ALL LANGUAGE MODULES SUPPORT THIS. Note that at most one of */
|
||||
/* ISOLATIN1, ISOLATIN2, IBMEXTENDED and IBM852 should be 1; if more */
|
||||
/* then one are defined as 1, the results are unspecified. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* #define IBMEXTENDED 1 */
|
||||
#define ISOLATIN2 0
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* IBMEXTENDED: define as 1 if your system uses the IBM extended */
|
||||
/* character set. */
|
||||
/* NOT ALL LANGUAGE MODULES SUPPORT THIS. Note that at most one of */
|
||||
/* ISOLATIN1, ISOLATIN2, IBMEXTENDED and IBM852 should be 1; if more */
|
||||
/* then one are defined as 1, the results are unspecified. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define IBMEXTENDED 0
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* IBM852: define as 1 if your system uses the IBM CPI-852 extended */
|
||||
/* character set. */
|
||||
/* NOT ALL LANGUAGE MODULES SUPPORT THIS. Note that at most one of */
|
||||
/* ISOLATIN1, ISOLATIN2, IBMEXTENDED and IBM852 should be 1; if more */
|
||||
/* then one are defined as 1, the results are unspecified. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define IBM852 0
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* WANT_U_OPTION: Comment out the next define to permanently disable */
|
||||
@@ -90,6 +93,19 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define WANT_U_OPTION 1
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/* You most likely do NOT have to tweak anything after this! */
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* WANT_SHELL_ESCAPING: Define this if you want special shell */
|
||||
/* characters to be escaped with a backslash for the -k option. */
|
||||
@@ -98,12 +114,6 @@
|
||||
#define WANT_SHELL_ESCAPING 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* STRSTR: If your system does not have the "strstr" function, */
|
||||
/* uncomment the following line. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* #define NO_STRSTR 1 */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Some implementations have a broken 'putc' and 'putchar'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
@@ -111,20 +121,6 @@
|
||||
#define BROKEN_PUTC
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* STDLIB: If you don't have the <stdlib.h> header file, comment the */
|
||||
/* following line. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* MALLOC: If you do not have the <malloc.h> header file, */
|
||||
/* comment out the next 3 lines. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#ifdef UNIX
|
||||
#define HAVE_MALLOC_H 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* BASE: The base year for date calculation. NOTE! January 1 of the */
|
||||
/* base year MUST be a Monday, else Remind will not work! */
|
||||
@@ -157,20 +153,15 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_PRT_LEN 40
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* LINELEN: The maximum length of an input line */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define LINELEN 512
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* OP_STACK_SIZE: The size of the operator stack for expr. parsing */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define OP_STACK_SIZE 30
|
||||
#define OP_STACK_SIZE 100
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* VAL_STACK_SIZE: The size of the operand stack for expr. parsing */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAL_STACK_SIZE 30
|
||||
#define VAL_STACK_SIZE 500
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
||||
@@ -198,29 +189,6 @@
|
||||
#define HAVE_PROTOS 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Do we use the <stdarg.h> scheme for functions with variable number */
|
||||
/* of parameters? If not, the <varargs.h> scheme is assumed. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#if defined(__STDC__) || defined(__TURBOC__) || defined(__BORLANDC__)
|
||||
#define HAVE_STDARG 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Does the function argument to the signal() function take an INT */
|
||||
/* argument? If yes, uncomment the next line. If you get it wrong, */
|
||||
/* the only bad side effect is a compiler warning, so don't worry too */
|
||||
/* much about it. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define SIGHANDLER_INT_ARG 1
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Do we have the <unistd.h> header? If not, use sys/files.h */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#ifdef UNIX
|
||||
#define HAVE_UNISTD 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many attempts to resolve a weird date spec? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
@@ -236,16 +204,6 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_PARTIAL_OMITS 75
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* The size of statically-allocated buffers for tokens. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TOKSIZE 128
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* The size of the buffer for the shell() function. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define SHELLSIZE 512
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* A newline - some systems need "\n\r" */
|
||||
/*---------------------------------------------------------------------*/
|
||||
@@ -259,14 +217,19 @@
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Don't change the next definitions */
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* TAG_LEN: The maximum length of tags. Don't change it */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TAG_LEN 32
|
||||
|
||||
#define PASSTHRU_LEN 24
|
||||
|
||||
#define PUBLIC
|
||||
#define PRIVATE static
|
||||
|
||||
#ifdef UNIX
|
||||
#define _POSIX_SOURCE
|
||||
#endif
|
||||
|
||||
#ifdef SYSV
|
||||
#define _SVID_SOURCE
|
||||
#endif
|
||||
|
||||
245
src/custom.h.in
Normal file
245
src/custom.h.in
Normal file
@@ -0,0 +1,245 @@
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* CUSTOM.H.IN */
|
||||
/* */
|
||||
/* Contains various configuration parameters for Remind */
|
||||
/* which you can customize. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: custom.h.in,v 1.5 1998-03-01 20:43:54 dfs Exp $ */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||
/* LOCATION: A string identifying your location. */
|
||||
/* All latitude and longitude numbers should be positive for the */
|
||||
/* northern and western hemisphere. If you live in the southern */
|
||||
/* hemisphere, ALL latitude values should be negative. If you live */
|
||||
/* in the eastern hemisphere, ALL longitude values should be negative. */
|
||||
/* */
|
||||
/* The default values are initially set to Ottawa, Ontario, Canada. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define LAT_DEG 45
|
||||
#define LAT_MIN 24
|
||||
#define LAT_SEC 0
|
||||
#define LON_DEG 75
|
||||
#define LON_MIN 39
|
||||
#define LON_SEC 0
|
||||
#define LOCATION "Ottawa"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* DEFAULT_PAGE: The default page size to use for Rem2PS. */
|
||||
/* The Letter version is appropriate for North America; the A4 version */
|
||||
/* is appropriate for Europe. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define DEFAULT_PAGE {"Letter", 612, 792}
|
||||
/* #define DEFAULT_PAGE {"A4", 595, 842} */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* DATESEP: The default date separator. North American usage is '/'; */
|
||||
/* others may prefer '-'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define DATESEP '/'
|
||||
/* #define DATESEP '-' */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* TIMESEP: The default time separator. North American usage is ':'; */
|
||||
/* others may prefer '.'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TIMESEP ':'
|
||||
/* #define TIMESEP '.' */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* ISOLATIN1: define it to 1 if you use the */
|
||||
/* ISO 8859-1 character set instead of ASCII. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define ISOLATIN1 1
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* ISOLATIN2: define it to 1 if you use the */
|
||||
/* ISO 8859-2 character set instead of ASCII. */
|
||||
/* NOT ALL LANGUAGE MODULES SUPPORT THIS. Note that at most one of */
|
||||
/* ISOLATIN1, ISOLATIN2, IBMEXTENDED and IBM852 should be 1; if more */
|
||||
/* then one are defined as 1, the results are unspecified. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define ISOLATIN2 0
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* IBMEXTENDED: define as 1 if your system uses the IBM extended */
|
||||
/* character set. */
|
||||
/* NOT ALL LANGUAGE MODULES SUPPORT THIS. Note that at most one of */
|
||||
/* ISOLATIN1, ISOLATIN2, IBMEXTENDED and IBM852 should be 1; if more */
|
||||
/* then one are defined as 1, the results are unspecified. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define IBMEXTENDED 0
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* IBM852: define as 1 if your system uses the IBM CPI-852 extended */
|
||||
/* character set. */
|
||||
/* NOT ALL LANGUAGE MODULES SUPPORT THIS. Note that at most one of */
|
||||
/* ISOLATIN1, ISOLATIN2, IBMEXTENDED and IBM852 should be 1; if more */
|
||||
/* then one are defined as 1, the results are unspecified. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define IBM852 0
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* WANT_U_OPTION: Comment out the next define to permanently disable */
|
||||
/* the -u option. If you do this, however, remind-all.[c]sh will not */
|
||||
/* work. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define WANT_U_OPTION 1
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/* You most likely do NOT have to tweak anything after this! */
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* WANT_SHELL_ESCAPING: Define this if you want special shell */
|
||||
/* characters to be escaped with a backslash for the -k option. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#if defined(UNIX)
|
||||
#define WANT_SHELL_ESCAPING 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Some implementations have a broken 'putc' and 'putchar'. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#ifdef __SASC_60
|
||||
#define BROKEN_PUTC
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* BASE: The base year for date calculation. NOTE! January 1 of the */
|
||||
/* base year MUST be a Monday, else Remind will not work! */
|
||||
/* IMPORTANT NOTE: The Hebrew date routines depend on BASE */
|
||||
/* being set to 1990. If you change it, you'll have to add the */
|
||||
/* number of days between 1 Jan <NEWBASE> and 1 Jan 1990 to the */
|
||||
/* manifest constant CORRECTION in hbcal.c. Also, the year */
|
||||
/* folding mechanism in main.c depends on BASE<2001. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define BASE 1990
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* YR_RANGE: The range of years allowed. Computers with 16-bit */
|
||||
/* integers can handle about 89 years worth of reminders; if */
|
||||
/* you use 32-bit integers, you can handle over 5 867 000 */
|
||||
/* years. Note that YR_RANGE is set to 88 rather than 89 */
|
||||
/* because we can range up to the last day of the 88th year. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define YR_RANGE 88
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
||||
/* any less than 12. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAR_NAME_LEN 12
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
||||
/* displaying a string value for debugging purposes. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_PRT_LEN 40
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* OP_STACK_SIZE: The size of the operator stack for expr. parsing */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define OP_STACK_SIZE 100
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* VAL_STACK_SIZE: The size of the operand stack for expr. parsing */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define VAL_STACK_SIZE 500
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define INCLUDE_NEST 8
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* IF_NEST: How many nested IFs do we handle? Maximum is the number */
|
||||
/* of bits in an int, divided by two. Beware! */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define IF_NEST (4*sizeof(unsigned int))
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Do we handle queued reminders? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#if defined(UNIX) || defined(__OS2__)
|
||||
#define HAVE_QUEUED 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Does our C compiler have prototypes? Override this test if you */
|
||||
/* are using a non-ANSI compiler that nevertheless has prototypes. */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#if defined(__STDC__) || defined(__TURBOC__) || defined(__BORLANDC__)
|
||||
#define HAVE_PROTOS 1
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many attempts to resolve a weird date spec? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TRIG_ATTEMPTS 25
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form YYYY MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_FULL_OMITS 75
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* How many global omits of the form MM DD do we handle? */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define MAX_PARTIAL_OMITS 75
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* A newline - some systems need "\n\r" */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define NL "\n"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Minimum number of linefeeds in each calendar "box" */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define CAL_LINES 5
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* Don't change the next definitions */
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* TAG_LEN: The maximum length of tags. Don't change it */
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define TAG_LEN 32
|
||||
|
||||
#define PASSTHRU_LEN 24
|
||||
|
||||
#define PUBLIC
|
||||
#define PRIVATE static
|
||||
|
||||
#ifdef UNIX
|
||||
#define _POSIX_SOURCE
|
||||
#define _SVID_SOURCE
|
||||
#endif
|
||||
|
||||
#define PSBEGIN "# rem2ps begin"
|
||||
#define PSEND "# rem2ps end"
|
||||
|
||||
#ifdef BROKEN_PUTC
|
||||
#define Putc SafePutc
|
||||
#define PutChar SafePutChar
|
||||
#else
|
||||
#define Putc putc
|
||||
#define PutChar putchar
|
||||
#endif
|
||||
1064
src/dorem.c
Normal file
1064
src/dorem.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -6,23 +6,26 @@
|
||||
/* reminders are triggered. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: dosubst.c,v 1.3 1996-10-12 02:49:32 dfs Exp $";
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: dosubst.c,v 1.8 1998-03-04 18:13:26 dfs Exp $";
|
||||
|
||||
#define L_IN_DOSUBST
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
#include "err.h"
|
||||
#include "types.h"
|
||||
@@ -37,6 +40,8 @@ static char const RCSID[] = "$Id: dosubst.c,v 1.3 1996-10-12 02:49:32 dfs Exp $"
|
||||
static char TODAY[] = L_TODAY;
|
||||
static char TOMORROW[] = L_TOMORROW;
|
||||
|
||||
#define SHIP_OUT(s) if(DBufPuts(dbuf, s) != OK) return E_NO_MEM
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DoSubst */
|
||||
@@ -47,11 +52,11 @@ static char TOMORROW[] = L_TOMORROW;
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int DoSubst(ParsePtr p, char *out, Trigger *t, TimeTrig *tt, int jul, int mode)
|
||||
PUBLIC int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode)
|
||||
#else
|
||||
int DoSubst(p, out, t, tt, jul, mode)
|
||||
int DoSubst(p, dbuf, t, tt, jul, mode)
|
||||
ParsePtr p;
|
||||
char *out;
|
||||
DynamicBuffer *dbuf;
|
||||
Trigger *t;
|
||||
TimeTrig *tt;
|
||||
int jul, mode;
|
||||
@@ -68,8 +73,9 @@ int jul, mode;
|
||||
int tdiff, adiff, mdiff, hdiff;
|
||||
char *mplu, *hplu, *when, *plu;
|
||||
int has_quote = 0;
|
||||
char *s = out;
|
||||
char *os;
|
||||
char *ss, *os;
|
||||
char s[256];
|
||||
int origLen = DBufLen(dbuf);
|
||||
|
||||
FromJulian(jul, &y, &m, &d);
|
||||
|
||||
@@ -133,25 +139,30 @@ int jul, mode;
|
||||
|
||||
while(1) {
|
||||
c = ParseChar(p, &err, 0);
|
||||
if (err) return err;
|
||||
if (err) {
|
||||
DBufFree(dbuf);
|
||||
return err;
|
||||
}
|
||||
if (c == '\n') continue;
|
||||
if (!c) {
|
||||
if (mode != CAL_MODE && t->typ != RUN_TYPE && !MsgCommand)
|
||||
*s++ = '\n';
|
||||
*s++ = 0;
|
||||
if (mode != CAL_MODE && t->typ != RUN_TYPE && !MsgCommand) {
|
||||
if (DBufPutc(dbuf, '\n') != OK) return E_NO_MEM;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (c != '%') {
|
||||
*s++ = c;
|
||||
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
|
||||
continue;
|
||||
}
|
||||
s[0] = 0;
|
||||
c = ParseChar(p, &err, 0);
|
||||
if (err) return err;
|
||||
if (err) {
|
||||
DBufFree(dbuf);
|
||||
return err;
|
||||
}
|
||||
if (!c) {
|
||||
*s++ = 0;
|
||||
break;
|
||||
}
|
||||
os = s;
|
||||
done = 0;
|
||||
if (diff <= 1) {
|
||||
switch(UPPER(c)) {
|
||||
@@ -195,7 +206,7 @@ int jul, mode;
|
||||
case 'V':
|
||||
#endif
|
||||
sprintf(s, "%s", (diff ? TOMORROW : TODAY));
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
@@ -211,7 +222,7 @@ int jul, mode;
|
||||
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
|
||||
MonthName[m], y);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
@@ -220,7 +231,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, L_INXDAYS, diff);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
@@ -229,7 +240,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
@@ -238,7 +249,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", d);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
@@ -248,7 +259,7 @@ int jul, mode;
|
||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DATESEP,
|
||||
m+1, DATESEP, y);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
@@ -257,7 +268,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DATESEP, d, DATESEP, y);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
@@ -266,7 +277,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
@@ -275,7 +286,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s %02d%c%02d", L_ON, d, DATESEP, m+1);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
@@ -284,7 +295,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DATESEP, d);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
@@ -294,7 +305,7 @@ int jul, mode;
|
||||
sprintf(s, "%s %s, %s %d%s, %d", L_ON, DayName[jul%7],
|
||||
MonthName[m], d, plu, y);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
@@ -304,7 +315,7 @@ int jul, mode;
|
||||
sprintf(s, "%s %s, %s %d%s", L_ON, DayName[jul%7],
|
||||
MonthName[m], d, plu);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
@@ -313,7 +324,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DATESEP, m+1, DATESEP, d);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
@@ -322,7 +333,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s", MonthName[m]);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
@@ -331,7 +342,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", m+1);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
@@ -341,25 +352,25 @@ int jul, mode;
|
||||
if (RealToday == JulianToday) sprintf(s, " (%s)", L_TODAY);
|
||||
else *s = 0;
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
#ifdef L_P_OVER
|
||||
L_P_OVER
|
||||
#else
|
||||
sprintf(s, (diff == 1 ? "" : L_PLURAL));
|
||||
sprintf(s, "%s", (diff == 1 ? "" : L_PLURAL));
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
#ifdef L_Q_OVER
|
||||
L_Q_OVER
|
||||
#else
|
||||
sprintf(s, (diff == 1 ? "'s" : "s'"));
|
||||
sprintf(s, "%s", (diff == 1 ? "'s" : "s'"));
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
@@ -368,16 +379,16 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%02d", d);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
#ifdef L_S_OVER
|
||||
L_S_OVER
|
||||
#else
|
||||
sprintf(s, plu);
|
||||
sprintf(s, "%s", plu);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
@@ -386,7 +397,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%02d", m+1);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
@@ -396,7 +407,7 @@ int jul, mode;
|
||||
sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], d,
|
||||
plu, MonthName[m], y);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
@@ -406,16 +417,16 @@ int jul, mode;
|
||||
sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu,
|
||||
MonthName[m]);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
#ifdef L_W_OVER
|
||||
L_W_OVER
|
||||
#else
|
||||
sprintf(s, DayName[jul%7]);
|
||||
sprintf(s, "%s", DayName[jul%7]);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
@@ -424,7 +435,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", diff);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
@@ -433,7 +444,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", y);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
@@ -442,7 +453,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", y % 100);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
@@ -450,7 +461,7 @@ int jul, mode;
|
||||
L_1_OVER
|
||||
#else
|
||||
if (tdiff == 0)
|
||||
sprintf(s, L_NOW);
|
||||
sprintf(s, "%s", L_NOW);
|
||||
else if (hdiff == 0)
|
||||
sprintf(s, "%d %s%s %s", mdiff, L_MINUTE, mplu, when);
|
||||
else if (mdiff == 0)
|
||||
@@ -459,7 +470,7 @@ int jul, mode;
|
||||
sprintf(s, "%d %s%s %s %d %s%s %s", hdiff, L_HOUR, hplu,
|
||||
L_AND, mdiff, L_MINUTE, mplu, when);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '2':
|
||||
@@ -468,7 +479,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TIMESEP, min, pm);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '3':
|
||||
@@ -478,7 +489,7 @@ int jul, mode;
|
||||
|
||||
sprintf(s, "%s %02d%c%02d", L_AT, h, TIMESEP, min);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '4':
|
||||
@@ -487,7 +498,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", tdiff);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '5':
|
||||
@@ -496,16 +507,16 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", adiff);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '6':
|
||||
#ifdef L_6_OVER
|
||||
L_6_OVER
|
||||
#else
|
||||
sprintf(s, when);
|
||||
sprintf(s, "%s", when);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '7':
|
||||
@@ -514,7 +525,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", hdiff);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '8':
|
||||
@@ -523,34 +534,34 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d", mdiff);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '9':
|
||||
#ifdef L_9_OVER
|
||||
L_9_OVER
|
||||
#else
|
||||
sprintf(s, mplu);
|
||||
sprintf(s, "%s", mplu);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '0':
|
||||
#ifdef L_0_OVER
|
||||
L_0_OVER
|
||||
#else
|
||||
sprintf(s, hplu);
|
||||
sprintf(s, "%s", hplu);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '!':
|
||||
#ifdef L_BANG_OVER
|
||||
L_BANG_OVER
|
||||
#else
|
||||
sprintf(s, (tdiff >= 0 ? L_IS : L_WAS));
|
||||
sprintf(s, "%s", (tdiff >= 0 ? L_IS : L_WAS));
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '@':
|
||||
@@ -559,7 +570,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%d%c%02d%s", chh, TIMESEP, cmin, cpm);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '#':
|
||||
@@ -568,7 +579,7 @@ int jul, mode;
|
||||
#else
|
||||
sprintf(s, "%02d%c%02d", ch, TIMESEP, cmin);
|
||||
#endif
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case '_':
|
||||
@@ -576,7 +587,7 @@ int jul, mode;
|
||||
sprintf(s, "%s", NL);
|
||||
else
|
||||
sprintf(s, " ");
|
||||
s += strlen(s);
|
||||
SHIP_OUT(s);
|
||||
break;
|
||||
|
||||
case QUOTE_MARKER:
|
||||
@@ -584,14 +595,17 @@ int jul, mode;
|
||||
break;
|
||||
|
||||
case '"':
|
||||
*s++ = QUOTE_MARKER;
|
||||
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
|
||||
has_quote = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
*s++ = c;
|
||||
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
|
||||
}
|
||||
if (isupper(c)) {
|
||||
os = DBufValue(dbuf) - strlen(s);
|
||||
*os = UPPER(*os);
|
||||
}
|
||||
if (isupper(c)) *os = UPPER(*os);
|
||||
}
|
||||
|
||||
/* We're outside the big while loop. The only way to get here is for c to
|
||||
@@ -602,35 +616,40 @@ int jul, mode;
|
||||
/* If there are NO quotes, then: If CAL_MODE && RUN_TYPE, we don't want the
|
||||
reminder in the calendar. Zero the output buffer and quit. */
|
||||
if (!has_quote) {
|
||||
if (mode == CAL_MODE && t->typ == RUN_TYPE) *out = 0;
|
||||
if (mode == CAL_MODE && t->typ == RUN_TYPE) {
|
||||
*DBufValue(dbuf) = 0;
|
||||
dbuf->len = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* There ARE quotes. If in CAL_MODE, delete everything before first quote
|
||||
and after second quote. If in NORMAL_MODE, delete the %" sequences. */
|
||||
|
||||
s = out;
|
||||
os = out;
|
||||
ss = DBufValue(dbuf) + origLen;
|
||||
os = ss;
|
||||
if (mode == NORMAL_MODE) {
|
||||
while (*s) {
|
||||
if (*s != QUOTE_MARKER) *os++ = *s;
|
||||
s++;
|
||||
while (*ss) {
|
||||
if (*ss != QUOTE_MARKER) *os++ = *ss;
|
||||
ss++;
|
||||
}
|
||||
*os = 0;
|
||||
} else {
|
||||
|
||||
/* Skip past the quote marker */
|
||||
while (*s && (*s != QUOTE_MARKER)) s++;
|
||||
while (*ss && (*ss != QUOTE_MARKER)) ss++;
|
||||
|
||||
/* Security check... actually, *s must == QUOTE_MARKER at this point, but
|
||||
it doesn't hurt to make it a bit robust. */
|
||||
if (*s) s++;
|
||||
if (*ss) ss++;
|
||||
|
||||
/* Copy the output until the next QUOTE_MARKER */
|
||||
while (*s && (*s != QUOTE_MARKER)) *os++ = *s++;
|
||||
while (*ss && (*ss != QUOTE_MARKER)) *os++ = *ss++;
|
||||
*os = 0;
|
||||
}
|
||||
|
||||
/* Violating encapsulation here!!!! */
|
||||
dbuf->len = strlen(dbuf->buffer);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -645,11 +664,12 @@ int jul, mode;
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int DoSubstFromString(char *source, char *dest, int jul, int tim)
|
||||
PUBLIC int DoSubstFromString(char *source, DynamicBuffer *dbuf,
|
||||
int jul, int tim)
|
||||
#else
|
||||
int DoSubstFromString(source, dest, jul, tim)
|
||||
int DoSubstFromString(source, dbuf, jul, tim)
|
||||
char *source;
|
||||
char *dest;
|
||||
DynamicBuffer *dbuf;
|
||||
int jul;
|
||||
int tim;
|
||||
#endif
|
||||
@@ -666,7 +686,7 @@ int tim;
|
||||
tempTrig.typ = MSG_TYPE;
|
||||
tempTime.ttime = tim;
|
||||
|
||||
r = DoSubst(&tempP, dest, &tempTrig, &tempTime, jul, NORMAL_MODE);
|
||||
r = DoSubst(&tempP, dbuf, &tempTrig, &tempTime, jul, NORMAL_MODE);
|
||||
DestroyParser(&tempP);
|
||||
return r;
|
||||
}
|
||||
220
src/dynbuf.c
Normal file
220
src/dynbuf.c
Normal file
@@ -0,0 +1,220 @@
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DYNBUF.C */
|
||||
/* */
|
||||
/* Implementation of functions for manipulating dynamic */
|
||||
/* buffers. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] =
|
||||
"$Id: dynbuf.c,v 1.2 1998-02-10 03:15:48 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
#include "dynbuf.h"
|
||||
#include "err.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
/**********************************************************************
|
||||
%FUNCTION: DBufMakeRoom
|
||||
%ARGUMENTS:
|
||||
dbuf -- pointer to a dynamic buffer
|
||||
n -- size to expand to
|
||||
%RETURNS:
|
||||
OK if all went well; E_NO_MEM if out of memory
|
||||
%DESCRIPTION:
|
||||
Doubles the size of dynamic buffer until it has room for at least
|
||||
'n' characters, not including trailing '\0'
|
||||
**********************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int DBufMakeRoom(DynamicBuffer *dbuf, int n)
|
||||
#else
|
||||
static int DBufMakeRoom(dbuf, n)
|
||||
DynamicBuffer *dbuf;
|
||||
int n;
|
||||
#endif
|
||||
{
|
||||
/* Double size until it's greater than n (strictly > to leave room
|
||||
for trailing '\0' */
|
||||
int size = dbuf->allocatedLen;
|
||||
char *buf;
|
||||
|
||||
if (size > n) return OK;
|
||||
|
||||
while (size <= n) {
|
||||
size *= 2;
|
||||
}
|
||||
|
||||
/* Allocate memory */
|
||||
buf = (char *) malloc(size);
|
||||
if (!buf) return E_NO_MEM;
|
||||
|
||||
/* Copy contents */
|
||||
strcpy(buf, dbuf->buffer);
|
||||
|
||||
/* Free contents if necessary */
|
||||
if (dbuf->buffer != dbuf->staticBuf) free(dbuf->buffer);
|
||||
dbuf->buffer = buf;
|
||||
dbuf->allocatedLen = size;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
%FUNCTION: DBufInit
|
||||
%ARGUMENTS:
|
||||
dbuf -- pointer to a dynamic buffer
|
||||
%RETURNS:
|
||||
Nothing
|
||||
%DESCRIPTION:
|
||||
Initializes a dynamic buffer
|
||||
**********************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void DBufInit(DynamicBuffer *dbuf)
|
||||
#else
|
||||
void DBufInit(dbuf)
|
||||
DynamicBuffer *dbuf;
|
||||
#endif
|
||||
{
|
||||
dbuf->buffer = dbuf->staticBuf;
|
||||
dbuf->len = 0;
|
||||
dbuf->allocatedLen = DBUF_STATIC_SIZE;
|
||||
dbuf->buffer[0] = 0;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
%FUNCTION: DBufPutc
|
||||
%ARGUMENTS:
|
||||
dbuf -- pointer to a dynamic buffer
|
||||
c -- character to append to buffer
|
||||
%RETURNS:
|
||||
OK if all went well; E_NO_MEM if out of memory
|
||||
%DESCRIPTION:
|
||||
Appends a character to the buffer.
|
||||
**********************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int DBufPutc(DynamicBuffer *dbuf, char c)
|
||||
#else
|
||||
int DBufPutc(dbuf, c)
|
||||
DynamicBuffer *dbuf;
|
||||
char c;
|
||||
#endif
|
||||
{
|
||||
if (dbuf->allocatedLen == dbuf->len+1) {
|
||||
if (DBufMakeRoom(dbuf, dbuf->len+1) != OK) return E_NO_MEM;
|
||||
}
|
||||
dbuf->buffer[dbuf->len++] = c;
|
||||
dbuf->buffer[dbuf->len] = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
%FUNCTION: DBufPuts
|
||||
%ARGUMENTS:
|
||||
dbuf -- pointer to a dynamic buffer
|
||||
str -- string to append to buffer
|
||||
%RETURNS:
|
||||
OK if all went well; E_NO_MEM if out of memory
|
||||
%DESCRIPTION:
|
||||
Appends a string to the buffer.
|
||||
**********************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int DBufPuts(DynamicBuffer *dbuf, char *str)
|
||||
#else
|
||||
int DBufPuts(dbuf, str)
|
||||
DynamicBuffer *dbuf;
|
||||
char *str;
|
||||
#endif
|
||||
{
|
||||
int l = strlen(str);
|
||||
if (!l) return OK;
|
||||
|
||||
if (DBufMakeRoom(dbuf, dbuf->len+l) != OK) return E_NO_MEM;
|
||||
strcpy((dbuf->buffer+dbuf->len), str);
|
||||
dbuf->len += l;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
%FUNCTION: DBufFree
|
||||
%ARGUMENTS:
|
||||
dbuf -- pointer to a dynamic buffer
|
||||
%RETURNS:
|
||||
Nothing
|
||||
%DESCRIPTION:
|
||||
Frees and reinitializes a dynamic buffer
|
||||
**********************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void DBufFree(DynamicBuffer *dbuf)
|
||||
#else
|
||||
void DBufFree(dbuf)
|
||||
DynamicBuffer *dbuf;
|
||||
#endif
|
||||
{
|
||||
if (dbuf->buffer != dbuf->staticBuf) free(dbuf->buffer);
|
||||
DBufInit(dbuf);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
%FUNCTION: DBufGets
|
||||
%ARGUMENTS:
|
||||
dbuf -- pointer to a dynamic buffer
|
||||
fp -- file to read from
|
||||
%RETURNS:
|
||||
OK or E_NO_MEM
|
||||
%DESCRIPTION:
|
||||
Reads an entire line from a file and appends to dbuf. Does not include
|
||||
trailing newline.
|
||||
**********************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int DBufGets(DynamicBuffer *dbuf, FILE *fp)
|
||||
#else
|
||||
int DBufGets(dbuf, fp)
|
||||
DynamicBuffer *dbuf;
|
||||
FILE *fp
|
||||
#endif
|
||||
{
|
||||
char tmp[256]; /* Safe to hard-code */
|
||||
int busy = 1;
|
||||
int l;
|
||||
|
||||
DBufFree(dbuf);
|
||||
|
||||
/* Try reading the first few bytes right into the buffer --
|
||||
we can usually save some unnecessary copying */
|
||||
|
||||
*(dbuf->buffer) = 0;
|
||||
fgets(dbuf->buffer, dbuf->allocatedLen, fp);
|
||||
if (!*(dbuf->buffer)) return OK;
|
||||
dbuf->len = strlen(dbuf->buffer);
|
||||
l = dbuf->len - 1;
|
||||
if (dbuf->buffer[l] == '\n') {
|
||||
dbuf->buffer[l] = 0;
|
||||
dbuf->len = l;
|
||||
return OK;
|
||||
}
|
||||
|
||||
while(busy) {
|
||||
*tmp = 0;
|
||||
fgets(tmp, 256, fp);
|
||||
if (!*tmp) return OK;
|
||||
l = strlen(tmp) - 1;
|
||||
if (tmp[l] == '\n') {
|
||||
tmp[l] = 0;
|
||||
busy = 0;
|
||||
}
|
||||
if (DBufPuts(dbuf, tmp) != OK) return E_NO_MEM;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
44
src/dynbuf.h
Normal file
44
src/dynbuf.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DYNBUF.H */
|
||||
/* */
|
||||
/* Declaration of functions for manipulating dynamic buffers */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: dynbuf.h,v 1.1 1998-02-07 05:35:57 dfs Exp $ */
|
||||
|
||||
#ifndef DYNBUF_H
|
||||
#define DYNBUF_H
|
||||
|
||||
#include <stdio.h> /* For FILE */
|
||||
|
||||
#define DBUF_STATIC_SIZE 128
|
||||
typedef struct {
|
||||
char *buffer;
|
||||
int len;
|
||||
int allocatedLen;
|
||||
char staticBuf[DBUF_STATIC_SIZE];
|
||||
} DynamicBuffer;
|
||||
|
||||
#ifndef ARGS
|
||||
#ifdef HAVE_PROTOS
|
||||
#define ARGS(x) x
|
||||
#else
|
||||
#define ARGS(x) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void DBufInit(DynamicBuffer *dbuf);
|
||||
int DBufPutc(DynamicBuffer *dbuf, char c);
|
||||
int DBufPuts(DynamicBuffer *dbuf, char *str);
|
||||
void DBufFree(DynamicBuffer *dbuf);
|
||||
int DBufGets(DynamicBuffer *dbuf, FILE *fp);
|
||||
|
||||
#define DBufValue(bufPtr) ((bufPtr)->buffer)
|
||||
#define DBufLen(bufPtr) ((bufPtr)->len)
|
||||
|
||||
#endif /* DYNBUF_H */
|
||||
@@ -5,11 +5,11 @@
|
||||
/* Error definitions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: err.h,v 1.2 1996-04-28 02:01:55 dfs Exp $ */
|
||||
/* $Id: err.h,v 1.2 1998-02-10 03:15:48 dfs Exp $ */
|
||||
|
||||
/* Note that not all of the "errors" are really errors - some are just
|
||||
messages for information purposes. Constants beginning with M_ should
|
||||
@@ -5,22 +5,25 @@
|
||||
/* This file contains routines to parse and evaluate */
|
||||
/* expressions. */
|
||||
/* */
|
||||
/* Copyright 1992-1996 by David F. Skoll */
|
||||
/* Copyright 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: expr.c,v 1.4 1996-05-25 18:14:51 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: expr.c,v 1.6 1998-03-01 20:43:55 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "err.h"
|
||||
#include "types.h"
|
||||
#include "expr.h"
|
||||
@@ -35,8 +38,7 @@ static char const RCSID[] = "$Id: expr.c,v 1.4 1996-05-25 18:14:51 dfs Exp $";
|
||||
#define LE 4
|
||||
#define NE 5
|
||||
|
||||
static char ExprBuf[TOKSIZE+1];
|
||||
static char CoerceBuf[TOKSIZE+1];
|
||||
static char CoerceBuf[512];
|
||||
extern int NumFuncs;
|
||||
|
||||
#ifdef HAVE_PROTOS
|
||||
@@ -174,24 +176,27 @@ char **s;
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ParseExprToken(char *out, char **in)
|
||||
PRIVATE int ParseExprToken(DynamicBuffer *buf, char **in)
|
||||
#else
|
||||
static int ParseExprToken(out, in)
|
||||
char *out;
|
||||
static int ParseExprToken(buf, in)
|
||||
DynamicBuffer *buf;
|
||||
char **in;
|
||||
#endif
|
||||
{
|
||||
|
||||
char c;
|
||||
|
||||
*out = 0;
|
||||
DBufFree(buf);
|
||||
/* Skip white space */
|
||||
while (**in && isspace(**in)) (*in)++;
|
||||
|
||||
if (!**in) return OK;
|
||||
|
||||
*out++ = c = *(*in)++;
|
||||
*out = 0;
|
||||
c = *(*in)++;
|
||||
if (DBufPutc(buf, c) != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
switch(c) {
|
||||
case COMMA:
|
||||
@@ -206,37 +211,59 @@ char **in;
|
||||
|
||||
case '&':
|
||||
case '|':
|
||||
case '=': if (**in == c) {
|
||||
*out++ = c;
|
||||
*out = 0;
|
||||
(*in)++;
|
||||
}
|
||||
return OK;
|
||||
case '=':
|
||||
if (**in == c) {
|
||||
if (DBufPutc(buf, c) != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(*in)++;
|
||||
}
|
||||
return OK;
|
||||
|
||||
case '!':
|
||||
case '>':
|
||||
case '<': if (**in == '=') {
|
||||
*out++ = '=';
|
||||
*out = 0;
|
||||
(*in)++;
|
||||
case '<':
|
||||
if (**in == '=') {
|
||||
if (DBufPutc(buf, '=') != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(*in)++;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
/* Handle the parsing of quoted strings */
|
||||
if (c == '\"') {
|
||||
if (!**in) return E_MISS_QUOTE;
|
||||
while (**in) if ((c = *out++ = *(*in)++) == '\"') break;
|
||||
*out = 0;
|
||||
if (c == '\"') return OK ; else return E_MISS_QUOTE;
|
||||
while (**in) {
|
||||
c = *(*in)++;
|
||||
if (DBufPutc(buf, c) != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
if (c == '\"') break;
|
||||
}
|
||||
if (c == '\"') return OK;
|
||||
DBufFree(buf);
|
||||
return E_MISS_QUOTE;
|
||||
}
|
||||
|
||||
/* Dates can be specified with single-quotes */
|
||||
if (c == '\'') {
|
||||
if (!**in) return E_MISS_QUOTE;
|
||||
while (**in) if ((c = *out++ = *(*in)++) == '\'') break;
|
||||
*out = 0;
|
||||
if (c == '\'') return OK ; else return E_MISS_QUOTE;
|
||||
while (**in) {
|
||||
c = *(*in)++;
|
||||
if (DBufPutc(buf, c) != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
if (c == '\'') break;
|
||||
}
|
||||
if (c == '\'') return OK;
|
||||
DBufFree(buf);
|
||||
}
|
||||
|
||||
if (!ISID(c) && c != '$') {
|
||||
@@ -245,16 +272,24 @@ char **in;
|
||||
}
|
||||
|
||||
/* Parse a constant, variable name or function */
|
||||
while (ISID(**in) || **in == ':' || **in == '.' || **in == TIMESEP)
|
||||
*out++ = *(*in)++;
|
||||
|
||||
while (ISID(**in) || **in == ':' || **in == '.' || **in == TIMESEP) {
|
||||
if (DBufPutc(buf, **in) != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(*in)++;
|
||||
}
|
||||
/* Chew up any remaining white space */
|
||||
while (**in && isspace(**in)) (*in)++;
|
||||
|
||||
/* Peek ahead - is it '('? Then we have a function call */
|
||||
if (**in == '(') *out++ = *(*in)++;
|
||||
|
||||
*out = 0;
|
||||
if (**in == '(') {
|
||||
if (DBufPutc(buf, '(') != OK) {
|
||||
DBufFree(buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
(*in)++;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -265,7 +300,7 @@ char **in;
|
||||
/* Put the result into value pointed to by v. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HaveProtos
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int EvalExpr(char **e, Value *v)
|
||||
#else
|
||||
int EvalExpr(e, v)
|
||||
@@ -277,10 +312,12 @@ Value *v;
|
||||
|
||||
OpStackPtr = 0;
|
||||
ValStackPtr = 0;
|
||||
|
||||
r = Evaluate(e, NULL);
|
||||
|
||||
/* Put last character parsed back onto input stream */
|
||||
if (*ExprBuf) (*e)--;
|
||||
if (DBufLen(&ExprBuf)) (*e)--;
|
||||
DBufFree(&ExprBuf);
|
||||
|
||||
if (r) {
|
||||
CleanStack();
|
||||
@@ -313,21 +350,35 @@ Var *locals;
|
||||
|
||||
while(1) {
|
||||
/* Looking for a value. Accept: value, unary op, func. call or left paren */
|
||||
r = ParseExprToken(ExprBuf, s);
|
||||
r = ParseExprToken(&ExprBuf, s);
|
||||
if (r) return r;
|
||||
if (!*ExprBuf) return E_EOLN;
|
||||
if (!DBufLen(&ExprBuf)) {
|
||||
DBufFree(&ExprBuf);
|
||||
return E_EOLN;
|
||||
}
|
||||
|
||||
if (*ExprBuf == '(') { /* Parenthesized expression */
|
||||
if (*DBufValue(&ExprBuf) == '(') { /* Parenthesized expression */
|
||||
DBufFree(&ExprBuf);
|
||||
r = Evaluate(s, locals); /* Leaves the last parsed token in ExprBuf */
|
||||
if (r) return r;
|
||||
if (*ExprBuf != ')') return E_MISS_RIGHT_PAREN;
|
||||
} else if (*ExprBuf == '+') continue; /* Ignore unary + */
|
||||
else if (*(ExprBuf + strlen(ExprBuf) -1) == '(') { /* Function Call */
|
||||
*(ExprBuf + strlen(ExprBuf) - 1) = 0;
|
||||
f = FindFunc(ExprBuf, Func, NumFuncs);
|
||||
r = OK;
|
||||
if (*DBufValue(&ExprBuf) != ')') {
|
||||
DBufFree(&ExprBuf);
|
||||
return E_MISS_RIGHT_PAREN;
|
||||
}
|
||||
if (r) return r;
|
||||
} else if (*DBufValue(&ExprBuf) == '+') {
|
||||
continue; /* Ignore unary + */
|
||||
}
|
||||
else if (*(DBufValue(&ExprBuf) + DBufLen(&ExprBuf) -1) == '(') { /* Function Call */
|
||||
*(DBufValue(&ExprBuf) + DBufLen(&ExprBuf) - 1) = 0;
|
||||
f = FindFunc(DBufValue(&ExprBuf), Func, NumFuncs);
|
||||
if (!f) {
|
||||
ufname = StrDup(ExprBuf);
|
||||
ufname = StrDup(DBufValue(&ExprBuf));
|
||||
DBufFree(&ExprBuf);
|
||||
if (!ufname) return E_NO_MEM;
|
||||
} else {
|
||||
DBufFree(&ExprBuf);
|
||||
}
|
||||
args = 0;
|
||||
if (PeekChar(s) == ')') { /* Function has no arguments */
|
||||
@@ -337,7 +388,8 @@ Var *locals;
|
||||
free(ufname);
|
||||
}
|
||||
if (r) return r;
|
||||
(void) ParseExprToken(ExprBuf, s); /* Guaranteed to be right paren. */
|
||||
r = ParseExprToken(&ExprBuf, s); /* Guaranteed to be right paren. */
|
||||
if (r) return r;
|
||||
} else { /* Function has some arguments */
|
||||
while(1) {
|
||||
args++;
|
||||
@@ -346,10 +398,12 @@ Var *locals;
|
||||
if (!f) free(ufname);
|
||||
return r;
|
||||
}
|
||||
if (*ExprBuf == ')') break;
|
||||
else if (*ExprBuf != ',') {
|
||||
if (*DBufValue(&ExprBuf) == ')') break;
|
||||
else if (*DBufValue(&ExprBuf) != ',') {
|
||||
if (!f) free(ufname);
|
||||
Eprint("%s: `%c'", ErrMsg[E_EXPECT_COMMA], *ExprBuf);
|
||||
Eprint("%s: `%c'", ErrMsg[E_EXPECT_COMMA],
|
||||
*DBufValue(&ExprBuf));
|
||||
DBufFree(&ExprBuf);
|
||||
return E_EXPECT_COMMA;
|
||||
}
|
||||
}
|
||||
@@ -359,27 +413,37 @@ Var *locals;
|
||||
free(ufname);
|
||||
}
|
||||
if (r) return r;
|
||||
DBufFree(&ExprBuf);
|
||||
}
|
||||
} else { /* Unary operator */
|
||||
f = FindFunc(ExprBuf, UnOp, NUM_UN_OPS);
|
||||
f = FindFunc(DBufValue(&ExprBuf), UnOp, NUM_UN_OPS);
|
||||
if (f) {
|
||||
DBufFree(&ExprBuf);
|
||||
PushOpStack(*f);
|
||||
continue; /* Still looking for an atomic vlue */
|
||||
} else if (!ISID(*ExprBuf) && *ExprBuf != '$'
|
||||
&& *ExprBuf != '"' && *ExprBuf != '\'') {
|
||||
Eprint("%s `%c'", ErrMsg[E_ILLEGAL_CHAR], *ExprBuf);
|
||||
} else if (!ISID(*DBufValue(&ExprBuf)) &&
|
||||
*DBufValue(&ExprBuf) != '$' &&
|
||||
*DBufValue(&ExprBuf) != '"' &&
|
||||
*DBufValue(&ExprBuf) != '\'') {
|
||||
Eprint("%s `%c'", ErrMsg[E_ILLEGAL_CHAR],
|
||||
*DBufValue(&ExprBuf));
|
||||
DBufFree(&ExprBuf);
|
||||
return E_ILLEGAL_CHAR;
|
||||
} else { /* Must be a literal value */
|
||||
r = MakeValue(ExprBuf, &va, locals);
|
||||
r = MakeValue(DBufValue(&ExprBuf), &va, locals);
|
||||
DBufFree(&ExprBuf);
|
||||
if (r) return r;
|
||||
PushValStack(va);
|
||||
}
|
||||
}
|
||||
/* OK, we've got a literal value; now, we're looking for the end of the
|
||||
expression, or a binary operator. */
|
||||
r = ParseExprToken(ExprBuf, s);
|
||||
r = ParseExprToken(&ExprBuf, s);
|
||||
if (r) return r;
|
||||
if (*ExprBuf == 0 || *ExprBuf == ',' || *ExprBuf == ']' || *ExprBuf == ')') {
|
||||
if (*DBufValue(&ExprBuf) == 0 ||
|
||||
*DBufValue(&ExprBuf) == ',' ||
|
||||
*DBufValue(&ExprBuf) == ']' ||
|
||||
*DBufValue(&ExprBuf) == ')') {
|
||||
/* We've hit the end of the expression. Pop off and evaluate until
|
||||
OpStackPtr = OpBase and ValStackPtr = ValBase+1 */
|
||||
while (OpStackPtr > OpBase) {
|
||||
@@ -389,14 +453,20 @@ Var *locals;
|
||||
else
|
||||
r=(op.func)();
|
||||
if (r) {
|
||||
DBufFree(&ExprBuf);
|
||||
Eprint("`%s': %s", op.name, ErrMsg[r]);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if (ValStackPtr != ValBase+1) return E_STACK_ERR; else return OK;
|
||||
if (ValStackPtr != ValBase+1) {
|
||||
DBufFree(&ExprBuf);
|
||||
return E_STACK_ERR;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
/* Must be a binary operator */
|
||||
f = FindFunc(ExprBuf, BinOp, NUM_BIN_OPS);
|
||||
f = FindFunc(DBufValue(&ExprBuf), BinOp, NUM_BIN_OPS);
|
||||
DBufFree(&ExprBuf);
|
||||
if (!f) return E_EXPECTING_BINOP;
|
||||
|
||||
/* While operators of higher or equal precedence are on the stack,
|
||||
@@ -5,11 +5,11 @@
|
||||
/* Contains a few definitions used by expression evaluator. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: expr.h,v 1.1 1996-03-27 03:25:54 dfs Exp $ */
|
||||
/* $Id: expr.h,v 1.2 1998-02-10 03:15:49 dfs Exp $ */
|
||||
|
||||
/* Define the types of values */
|
||||
#define ERR_TYPE 0
|
||||
@@ -7,25 +7,40 @@
|
||||
/* files. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: files.c,v 1.3 1996-05-25 19:10:12 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: files.c,v 1.8 1998-04-19 03:39:43 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__)
|
||||
#include <io.h>
|
||||
@@ -55,6 +70,9 @@ typedef struct cheader {
|
||||
struct cheader *next;
|
||||
char *filename;
|
||||
CachedLine *cache;
|
||||
#ifdef UNIX
|
||||
int ownedByMe;
|
||||
#endif
|
||||
} CachedFile;
|
||||
|
||||
/* Define the structures needed by the INCLUDE file system */
|
||||
@@ -65,6 +83,9 @@ typedef struct {
|
||||
int NumIfs;
|
||||
long offset;
|
||||
CachedLine *CLine;
|
||||
#ifdef UNIX
|
||||
int ownedByMe;
|
||||
#endif
|
||||
} IncludeStruct;
|
||||
|
||||
static CachedFile *CachedFiles = (CachedFile *) NULL;
|
||||
@@ -78,6 +99,7 @@ static int IStackPtr = 0;
|
||||
PRIVATE int ReadLineFromFile ARGS ((void));
|
||||
PRIVATE int CacheFile ARGS ((const char *fname));
|
||||
PRIVATE void DestroyCache ARGS ((CachedFile *cf));
|
||||
PRIVATE int CheckSafety ARGS ((void));
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
@@ -124,36 +146,51 @@ int ReadLine()
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int ReadLineFromFile(void)
|
||||
#else
|
||||
static ReadLineFromFile()
|
||||
static int ReadLineFromFile()
|
||||
#endif
|
||||
{
|
||||
int l;
|
||||
char *ptr;
|
||||
char *tmp;
|
||||
|
||||
CurLine = LineBuffer;
|
||||
*LineBuffer = (char) 0;
|
||||
l = 0;
|
||||
ptr = LineBuffer;
|
||||
DynamicBuffer buf;
|
||||
|
||||
DBufInit(&buf);
|
||||
DBufFree(&LineBuffer);
|
||||
|
||||
while(fp) {
|
||||
tmp=fgets(ptr, LINELEN-l, fp);
|
||||
if (DBufGets(&buf, fp) != OK) {
|
||||
DBufFree(&LineBuffer);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
LineNo++;
|
||||
if (ferror(fp)) return E_IO_ERR;
|
||||
if (feof(fp) || !tmp) {
|
||||
if (ferror(fp)) {
|
||||
DBufFree(&buf);
|
||||
DBufFree(&LineBuffer);
|
||||
return E_IO_ERR;
|
||||
}
|
||||
if (feof(fp)) {
|
||||
FCLOSE(fp);
|
||||
}
|
||||
l = strlen(LineBuffer);
|
||||
if (l && (LineBuffer[l-1] == '\n')) LineBuffer[--l] = '\0';
|
||||
if (l && (LineBuffer[l-1] == '\\')) {
|
||||
l--;
|
||||
ptr = LineBuffer+l;
|
||||
if (l >= LINELEN-1) return E_LINE_2_LONG;
|
||||
l = DBufLen(&buf);
|
||||
if (l && (DBufValue(&buf)[l-1] == '\\')) {
|
||||
DBufValue(&buf)[l-1] = 0;
|
||||
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
|
||||
DBufFree(&buf);
|
||||
DBufFree(&LineBuffer);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
|
||||
DBufFree(&buf);
|
||||
DBufFree(&LineBuffer);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
FreshLine = 1;
|
||||
CurLine = DBufValue(&LineBuffer);
|
||||
if (DebugFlag & DB_ECHO_LINE) OutputLine(ErrFp);
|
||||
return OK;
|
||||
}
|
||||
CurLine = DBufValue(&LineBuffer);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -176,6 +213,9 @@ char *fname;
|
||||
CachedFile *h = CachedFiles;
|
||||
int r;
|
||||
|
||||
/* Assume we own the file for now */
|
||||
RunDisabled &= ~RUN_NOTOWNER;
|
||||
|
||||
/* If it's in the cache, get it from there. */
|
||||
|
||||
while (h) {
|
||||
@@ -183,6 +223,11 @@ char *fname;
|
||||
CLine = h->cache;
|
||||
STRSET(FileName, fname);
|
||||
LineNo = 0;
|
||||
#ifdef UNIX
|
||||
if (!h->ownedByMe) {
|
||||
RunDisabled |= RUN_NOTOWNER;
|
||||
}
|
||||
#endif
|
||||
if (FileName) return OK; else return E_NO_MEM;
|
||||
}
|
||||
h = h->next;
|
||||
@@ -194,7 +239,7 @@ char *fname;
|
||||
} else {
|
||||
fp = fopen(fname, "r");
|
||||
}
|
||||
if (!fp) return E_CANT_OPEN;
|
||||
if (!fp || !CheckSafety()) return E_CANT_OPEN;
|
||||
CLine = NULL;
|
||||
if (ShouldCache) {
|
||||
LineNo = 0;
|
||||
@@ -203,11 +248,12 @@ char *fname;
|
||||
fp = NULL;
|
||||
CLine = CachedFiles->cache;
|
||||
} else {
|
||||
if (strcmp(fname, "-"))
|
||||
if (strcmp(fname, "-")) {
|
||||
fp = fopen(fname, "r");
|
||||
else
|
||||
if (!fp || !CheckSafety()) return E_CANT_OPEN;
|
||||
} else {
|
||||
fp = stdin;
|
||||
if (!fp) return E_CANT_OPEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
STRSET(FileName, fname);
|
||||
@@ -248,6 +294,13 @@ char *fname;
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
#ifdef UNIX
|
||||
if (RunDisabled & RUN_NOTOWNER) {
|
||||
cf->ownedByMe = 0;
|
||||
} else {
|
||||
cf->ownedByMe = 1;
|
||||
}
|
||||
#endif
|
||||
/* Read the file */
|
||||
while(fp) {
|
||||
r = ReadLineFromFile();
|
||||
@@ -258,13 +311,14 @@ char *fname;
|
||||
return r;
|
||||
}
|
||||
/* Skip blank chars */
|
||||
s = LineBuffer;
|
||||
s = DBufValue(&LineBuffer);
|
||||
while (isspace(*s)) s++;
|
||||
if (*s && *s!=';' && *s!='#') {
|
||||
/* Add the line to the cache */
|
||||
if (!cl) {
|
||||
cf->cache = NEW(CachedLine);
|
||||
if (!cf->cache) {
|
||||
DBufFree(&LineBuffer);
|
||||
DestroyCache(cf);
|
||||
ShouldCache = 0;
|
||||
FCLOSE(fp);
|
||||
@@ -274,6 +328,7 @@ char *fname;
|
||||
} else {
|
||||
cl->next = NEW(CachedLine);
|
||||
if (!cl->next) {
|
||||
DBufFree(&LineBuffer);
|
||||
DestroyCache(cf);
|
||||
ShouldCache = 0;
|
||||
FCLOSE(fp);
|
||||
@@ -284,6 +339,7 @@ char *fname;
|
||||
cl->next = NULL;
|
||||
cl->LineNo = LineNo;
|
||||
cl->text = StrDup(s);
|
||||
DBufFree(&LineBuffer);
|
||||
if (!cl->text) {
|
||||
DestroyCache(cf);
|
||||
ShouldCache = 0;
|
||||
@@ -314,6 +370,9 @@ int PopFile()
|
||||
{
|
||||
IncludeStruct *i;
|
||||
|
||||
/* Assume we own the file for now */
|
||||
RunDisabled &= ~RUN_NOTOWNER;
|
||||
|
||||
if (!Hush && NumIfs) Eprint("%s", ErrMsg[E_MISS_ENDIF]);
|
||||
if (!IStackPtr) return E_EOF;
|
||||
IStackPtr--;
|
||||
@@ -325,13 +384,19 @@ int PopFile()
|
||||
CLine = i->CLine;
|
||||
fp = NULL;
|
||||
STRSET(FileName, i->filename);
|
||||
#ifdef UNIX
|
||||
if (!i->ownedByMe) {
|
||||
RunDisabled |= RUN_NOTOWNER;
|
||||
}
|
||||
#endif
|
||||
if (!CLine && (i->offset != -1L)) {
|
||||
/* We must open the file, then seek to specified position */
|
||||
if (strcmp(i->filename, "-"))
|
||||
if (strcmp(i->filename, "-")) {
|
||||
fp = fopen(i->filename, "r");
|
||||
else
|
||||
if (!fp || !CheckSafety()) return E_CANT_OPEN;
|
||||
} else {
|
||||
fp = stdin;
|
||||
if (!fp) return E_CANT_OPEN;
|
||||
}
|
||||
if (fp != stdin)
|
||||
(void) fseek(fp, i->offset, 0); /* Trust that it works... */
|
||||
}
|
||||
@@ -353,13 +418,18 @@ int DoInclude(p)
|
||||
ParsePtr p;
|
||||
#endif
|
||||
{
|
||||
char tok[TOKSIZE];
|
||||
DynamicBuffer buf;
|
||||
int r, e;
|
||||
|
||||
if ( (r=ParseToken(p, tok)) ) return r;
|
||||
DBufInit(&buf);
|
||||
if ( (r=ParseToken(p, &buf)) ) return r;
|
||||
e = VerifyEoln(p);
|
||||
if (e) Eprint("%s", ErrMsg[e]);
|
||||
if ( (r=IncludeFile(tok)) ) return r;
|
||||
if ( (r=IncludeFile(DBufValue(&buf))) ) {
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
DBufFree(&buf);
|
||||
NumIfs = 0;
|
||||
IfFlags = 0;
|
||||
return OK;
|
||||
@@ -382,6 +452,7 @@ char *fname;
|
||||
{
|
||||
IncludeStruct *i;
|
||||
int r;
|
||||
int oldRunDisabled;
|
||||
|
||||
if (IStackPtr+1 >= INCLUDE_NEST) return E_NESTED_INCLUDE;
|
||||
i = &IStack[IStackPtr];
|
||||
@@ -393,6 +464,13 @@ char *fname;
|
||||
i->IfFlags = IfFlags;
|
||||
i->CLine = CLine;
|
||||
i->offset = -1L;
|
||||
#ifdef UNIX
|
||||
if (RunDisabled & RUN_NOTOWNER) {
|
||||
i->ownedByMe = 0;
|
||||
} else {
|
||||
i->ownedByMe = 1;
|
||||
}
|
||||
#endif
|
||||
if (fp) {
|
||||
i->offset = ftell(fp);
|
||||
FCLOSE(fp);
|
||||
@@ -400,10 +478,12 @@ char *fname;
|
||||
|
||||
IStackPtr++;
|
||||
|
||||
oldRunDisabled = RunDisabled;
|
||||
/* Try to open the new file */
|
||||
if (!OpenFile(fname)) {
|
||||
return OK;
|
||||
}
|
||||
RunDisabled = oldRunDisabled;
|
||||
/* Ugh! We failed! */
|
||||
if ( (r=PopFile()) ) return r;
|
||||
Eprint("%s: %s", ErrMsg[E_CANT_OPEN], fname);
|
||||
@@ -556,3 +636,64 @@ int TopLevel()
|
||||
{
|
||||
return !IStackPtr;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* CheckSafety */
|
||||
/* */
|
||||
/* Returns 1 if current file is safe to read; 0 otherwise. */
|
||||
/* Currently only meaningful for UNIX. If we are running as */
|
||||
/* root, we refuse to open files not owned by root. */
|
||||
/* We also reject world-writable files, no matter */
|
||||
/* who we're running as. */
|
||||
/* As a side effect, if we don't own the file, we disable RUN */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE int CheckSafety(void)
|
||||
#else
|
||||
static int CheckSafety()
|
||||
#endif
|
||||
{
|
||||
#ifdef UNIX
|
||||
struct stat statbuf;
|
||||
|
||||
if (fp == stdin) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fstat(fileno(fp), &statbuf)) {
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Under UNIX, take extra precautions if running as root */
|
||||
if (!geteuid()) {
|
||||
/* Reject files not owned by root or group/world writable */
|
||||
if (statbuf.st_uid != 0) {
|
||||
fprintf(ErrFp, "SECURITY: Won't read non-root-owned file when running as root!\n");
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Sigh... /dev/null is usually world-writable, so ignore devices,
|
||||
FIFOs, sockets, etc. */
|
||||
if (!S_ISREG(statbuf.st_mode)) {
|
||||
return 1;
|
||||
}
|
||||
if ((statbuf.st_mode & S_IWOTH)) {
|
||||
fprintf(ErrFp, "SECURITY: Won't read world-writable file!\n");
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If file is not owned by me, disable RUN command */
|
||||
if (statbuf.st_uid != geteuid()) {
|
||||
RunDisabled |= RUN_NOTOWNER;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -6,44 +6,60 @@
|
||||
/* expressions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: funcs.c,v 1.4 1996-10-06 21:03:49 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: funcs.c,v 1.6 1998-02-10 03:33:49 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#ifdef UNIX
|
||||
#ifdef HAVE_UNISTD
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) || defined(__OS2__)
|
||||
#include <io.h>
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
#endif
|
||||
|
||||
#ifndef R_OK
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "globals.h"
|
||||
#include "protos.h"
|
||||
@@ -232,7 +248,7 @@ Operator Func[] = {
|
||||
{ "realnow", 0, 0, FRealnow},
|
||||
{ "realtoday", 0, 0, FRealtoday },
|
||||
{ "sgn", 1, 1, FSgn },
|
||||
{ "shell", 1, 1, FShell },
|
||||
{ "shell", 1, 2, FShell },
|
||||
{ "strlen", 1, 1, FStrlen },
|
||||
{ "substr", 2, 3, FSubstr },
|
||||
{ "sunrise", 0, 1, FSunrise},
|
||||
@@ -1285,35 +1301,52 @@ PRIVATE int FShell(void)
|
||||
static int FShell()
|
||||
#endif
|
||||
{
|
||||
char buf[SHELLSIZE+1];
|
||||
int ch, len;
|
||||
DynamicBuffer buf;
|
||||
int ch, r;
|
||||
FILE *fp;
|
||||
char *s;
|
||||
|
||||
/* For compatibility with previous versions of Remind, which
|
||||
used a static buffer for reading results from shell() command */
|
||||
int maxlen = 511;
|
||||
|
||||
DBufInit(&buf);
|
||||
if (RunDisabled) return E_RUN_DISABLED;
|
||||
if (ARG(0).type != STR_TYPE) return E_BAD_TYPE;
|
||||
s = buf;
|
||||
len = 0;
|
||||
if (Nargs >= 2) {
|
||||
if (ARG(1).type != INT_TYPE) return E_BAD_TYPE;
|
||||
maxlen = ARG(1).v.val;
|
||||
}
|
||||
fp = POPEN(ARG(0).v.str, "r");
|
||||
if (!fp) return E_IO_ERR;
|
||||
while (len < SHELLSIZE) {
|
||||
while (1) {
|
||||
ch = getc(fp);
|
||||
if (ch == EOF) {
|
||||
break;
|
||||
}
|
||||
if (isspace(ch)) *s++ = ' ';
|
||||
else *s++ = ch;
|
||||
len++;
|
||||
if (isspace(ch)) ch = ' ';
|
||||
if (DBufPutc(&buf, (char) ch) != OK) {
|
||||
PCLOSE(fp);
|
||||
DBufFree(&buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
if (maxlen > 0 && DBufLen(&buf) >= maxlen) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*s = 0;
|
||||
|
||||
/* Delete trailing newline (converted to space) */
|
||||
if (s > buf && *(s-1) == ' ') *(s-1) = 0;
|
||||
if (DBufLen(&buf) && DBufValue(&buf)[DBufLen(&buf)-1] == ' ') {
|
||||
DBufValue(&buf)[DBufLen(&buf)-1] = 0;
|
||||
}
|
||||
#if defined(__MSDOS__) || defined(__OS2__)
|
||||
if (s-1 > buf && *(s-2) == ' ') *(s-2) = 0;
|
||||
if (DBufLen(&buf) > 1 && DBufValue(&buf)[DBufLen(&buf)-2] == ' ') {
|
||||
DBufValue(&buf)[DBufLen(&buf)-2] = 0;
|
||||
}
|
||||
#endif
|
||||
PCLOSE(fp);
|
||||
return RetStrVal(buf);
|
||||
r = RetStrVal(DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -1481,24 +1514,33 @@ PRIVATE int FFiledir(void)
|
||||
static int FFiledir()
|
||||
#endif
|
||||
{
|
||||
char TmpBuf[LINELEN]; /* Should be _POSIX_PATH_MAX ? */
|
||||
char *s;
|
||||
DynamicBuffer buf;
|
||||
int r;
|
||||
|
||||
strcpy(TmpBuf, FileName);
|
||||
s = TmpBuf + strlen(TmpBuf) - 1;
|
||||
if (s < TmpBuf) return RetStrVal(".");
|
||||
DBufInit(&buf);
|
||||
|
||||
if (DBufPuts(&buf, FileName) != OK) return E_NO_MEM;
|
||||
if (DBufLen(&buf) == 0) {
|
||||
DBufFree(&buf);
|
||||
return RetStrVal(".");
|
||||
}
|
||||
|
||||
s = DBufValue(&buf) + DBufLen(&buf) - 1;
|
||||
#if defined(__OS2__) || defined(__MSDOS__)
|
||||
/* Both '\\' and '/' can be part of path; handle drive letters. */
|
||||
while (s > TmpBuf && !strchr("\\/:", *s)) s--;
|
||||
while (s > DBufValue(&buf) && !strchr("\\/:", *s)) s--;
|
||||
if (*s == ':') { s[1] = '.'; s += 2; }
|
||||
if (s > TmpBuf) *s = '/';
|
||||
if (s > DBufValue(&buf)) *s = '/';
|
||||
#else
|
||||
while (s > TmpBuf && *s != '/') s--;
|
||||
while (s > DBufValue(&buf) && *s != '/') s--;
|
||||
#endif
|
||||
if (*s == '/') {
|
||||
*s = 0;
|
||||
return RetStrVal(TmpBuf);
|
||||
} else return RetStrVal(".");
|
||||
r = RetStrVal(DBufValue(&buf));
|
||||
} else r = RetStrVal(".");
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
/***************************************************************/
|
||||
/* */
|
||||
@@ -1673,7 +1715,9 @@ static int FDosubst()
|
||||
#endif
|
||||
{
|
||||
int jul, tim, r;
|
||||
char TmpBuf[LINELEN];
|
||||
DynamicBuffer buf;
|
||||
|
||||
DBufInit(&buf);
|
||||
|
||||
jul = NO_DATE;
|
||||
tim = NO_TIME;
|
||||
@@ -1687,8 +1731,10 @@ static int FDosubst()
|
||||
}
|
||||
}
|
||||
|
||||
if ((r=DoSubstFromString(ARG(0).v.str, TmpBuf, jul, tim))) return r;
|
||||
return RetStrVal(TmpBuf);
|
||||
if ((r=DoSubstFromString(ARG(0).v.str, &buf, jul, tim))) return r;
|
||||
r = RetStrVal(DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -2030,7 +2076,14 @@ int jul;
|
||||
/* Cosine of sun's local hour angle */
|
||||
cosH = (cosz - sinDelta * sin(latitude)) / (cosDelta * cos(latitude));
|
||||
|
||||
if (cosH > 1.0 || cosH < -1.0) return NO_TIME;
|
||||
if (cosH < -1.0) { /* Summer -- permanent daylight */
|
||||
if (rise) return NO_TIME;
|
||||
else return -NO_TIME;
|
||||
}
|
||||
if (cosH > 1.0) { /* Winter -- permanent darkness */
|
||||
if (rise) return -NO_TIME;
|
||||
else return NO_TIME;
|
||||
}
|
||||
|
||||
H = RADDEG * acos(cosH);
|
||||
if (rise) H = 360.0 - H;
|
||||
@@ -2049,6 +2102,15 @@ int jul;
|
||||
hours = (int) local;
|
||||
mins = (int) ((local - hours) * 60.0);
|
||||
|
||||
/* Sometimes, we get roundoff error. Check for "reasonableness" of
|
||||
answer. */
|
||||
if (rise) {
|
||||
/* Sunrise so close to midnight it wrapped around -- permament light */
|
||||
if (hours >= 23) return NO_TIME;
|
||||
} else {
|
||||
/* Sunset so close to midnight it wrapped around -- permament light */
|
||||
if (hours <= 1) return -NO_TIME;
|
||||
}
|
||||
return hours*60 + mins;
|
||||
}
|
||||
|
||||
@@ -2077,6 +2139,9 @@ int rise;
|
||||
if (r == NO_TIME) {
|
||||
RetVal.v.val = 0;
|
||||
RetVal.type = INT_TYPE;
|
||||
} else if (r == -NO_TIME) {
|
||||
RetVal.v.val = 1440;
|
||||
RetVal.type = INT_TYPE;
|
||||
} else {
|
||||
RetVal.v.val = r;
|
||||
RetVal.type = TIM_TYPE;
|
||||
@@ -8,13 +8,13 @@
|
||||
/* globals.h and err.h */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: globals.c,v 1.1 1996-03-27 03:25:57 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: globals.c,v 1.2 1998-02-10 03:15:50 dfs Exp $";
|
||||
|
||||
#include <stdio.h> /* For defintion of FILE - sigh! */
|
||||
#include "types.h"
|
||||
#define MK_GLOBALS
|
||||
@@ -7,11 +7,11 @@
|
||||
/* MK_GLOBALS. Also contains useful macro definitions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: globals.h,v 1.1 1996-03-27 03:25:57 dfs Exp $ */
|
||||
/* $Id: globals.h,v 1.5 1998-03-01 20:43:55 dfs Exp $ */
|
||||
|
||||
#ifdef MK_GLOBALS
|
||||
#undef EXTERN
|
||||
@@ -36,9 +36,6 @@ EXTERN int CurMon;
|
||||
EXTERN int CurYear;
|
||||
EXTERN int LineNo;
|
||||
EXTERN int FreshLine;
|
||||
EXTERN char LineBuffer[LINELEN];
|
||||
EXTERN char SubstBuffer[LINELEN];
|
||||
EXTERN char TokBuffer[TOKSIZE+1];
|
||||
EXTERN INIT( char *MsgCommand, NULL);
|
||||
EXTERN INIT( int ShowAllErrors, 0);
|
||||
EXTERN INIT( int DebugFlag, 0);
|
||||
@@ -113,9 +110,11 @@ EXTERN INIT( char *EndSentIg, "\"')]}>");
|
||||
/* We need the language stuff here... */
|
||||
|
||||
#include "lang.h"
|
||||
#include "dynbuf.h"
|
||||
|
||||
EXTERN INIT( char Banner[LINELEN], L_BANNER);
|
||||
|
||||
EXTERN DynamicBuffer Banner;
|
||||
EXTERN DynamicBuffer LineBuffer;
|
||||
EXTERN DynamicBuffer ExprBuf;
|
||||
/* List of months */
|
||||
EXTERN char *EnglishMonthName[]
|
||||
#ifdef MK_GLOBALS
|
||||
@@ -5,17 +5,17 @@
|
||||
/* Support for the Hebrew calendar */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/* Derived from code written by Amos Shapir in 1978; revised */
|
||||
/* 1985. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: hbcal.c,v 1.1 1996-03-27 03:25:58 dfs Exp $";
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: hbcal.c,v 1.2 1998-02-10 03:15:51 dfs Exp $";
|
||||
|
||||
#include <stdio.h> /* For FILE used by protos.h - sigh. */
|
||||
#include "config.h"
|
||||
#include "types.h"
|
||||
#include "protos.h"
|
||||
#include "globals.h"
|
||||
@@ -7,30 +7,38 @@
|
||||
/* in normal mode. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: init.c,v 1.3 1996-10-27 21:28:03 dfs Exp $";
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: init.c,v 1.8 1998-03-02 19:38:40 dfs Exp $";
|
||||
|
||||
#define L_IN_INIT 1
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#ifdef HAVE_UNISTD
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "protos.h"
|
||||
#include "expr.h"
|
||||
@@ -112,6 +120,22 @@ char *argv[];
|
||||
int y, m, d, rep;
|
||||
Token tok;
|
||||
|
||||
/* Initialize global dynamic buffers */
|
||||
DBufInit(&Banner);
|
||||
DBufInit(&LineBuffer);
|
||||
DBufInit(&ExprBuf);
|
||||
|
||||
DBufPuts(&Banner, L_BANNER);
|
||||
|
||||
/* Make sure remind is not installed set-uid or set-gid */
|
||||
#ifdef UNIX
|
||||
if (getgid() != getegid() ||
|
||||
getuid() != geteuid()) {
|
||||
fprintf(ErrFp, "\nRemind should not be installed set-uid or set-gid.\nCHECK YOUR SYSTEM SECURITY.\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
y = NO_YR;
|
||||
m = NO_MON;
|
||||
d = NO_DAY;
|
||||
@@ -171,7 +195,7 @@ char *argv[];
|
||||
|
||||
case 'r':
|
||||
case 'R':
|
||||
RunDisabled = 1;
|
||||
RunDisabled = RUN_CMDLINE;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
@@ -225,6 +249,7 @@ char *argv[];
|
||||
case 'u':
|
||||
case 'U':
|
||||
ChgUser(arg);
|
||||
RunDisabled = RUN_CMDLINE;
|
||||
while (*arg) arg++;
|
||||
break;
|
||||
#endif
|
||||
@@ -233,9 +258,16 @@ char *argv[];
|
||||
case 'z':
|
||||
case 'Z':
|
||||
DontFork = 1;
|
||||
PARSENUM(Daemon, arg);
|
||||
if (Daemon<5) Daemon=5;
|
||||
else if (Daemon>60) Daemon=60;
|
||||
if (*arg == '0') {
|
||||
PARSENUM(Daemon, arg);
|
||||
if (Daemon == 0) Daemon = -1;
|
||||
else if (Daemon < 5) Daemon = 5;
|
||||
else if (Daemon > 60) Daemon = 60;
|
||||
} else {
|
||||
PARSENUM(Daemon, arg);
|
||||
if (Daemon<5) Daemon=5;
|
||||
else if (Daemon>60) Daemon=60;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
@@ -455,7 +487,7 @@ PUBLIC void Usage(void)
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1996 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||
#endif
|
||||
@@ -507,12 +539,7 @@ static void ChgUser(user)
|
||||
char *user;
|
||||
#endif /* HAVE_PROTOS */
|
||||
{
|
||||
#ifdef SYSV
|
||||
/* uid_t myuid; This seems to mess up on XENIX, so forget it... */
|
||||
int myuid;
|
||||
#else
|
||||
int myuid;
|
||||
#endif
|
||||
uid_t myuid;
|
||||
|
||||
struct passwd *pwent;
|
||||
static char *home, *shell, *username, *logname;
|
||||
@@ -5,11 +5,11 @@
|
||||
/* Header file for language support for various languages. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: lang.h,v 1.4 1996-10-12 02:49:33 dfs Exp $ */
|
||||
/* $Id: lang.h,v 1.2 1998-02-10 03:15:52 dfs Exp $ */
|
||||
|
||||
/* I'm chauvinistic and name each language with its English name... */
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define POLISH 7 /* translated by Jerzy Sobczyk */
|
||||
#define BRAZPORT 8 /* Brazilian Portuguese by Marco Paganini */
|
||||
#define ITALIAN 9 /* translated by Valerio Aimale */
|
||||
#define ROMANIAN 10 /* translated by Liviu Daia */
|
||||
|
||||
/* Add more languages here - but please e-mail aa775@freenet.carleton.ca
|
||||
to have your favorite language assigned a number. If you add a
|
||||
@@ -43,28 +44,30 @@
|
||||
|
||||
/* Pick up the appropriate header file */
|
||||
#if LANG == ENGLISH
|
||||
#include "english.h"
|
||||
#include "langs/english.h"
|
||||
#elif LANG == GERMAN
|
||||
#include "german.h"
|
||||
#include "langs/german.h"
|
||||
#elif LANG == DUTCH
|
||||
#include "dutch.h"
|
||||
#include "langs/dutch.h"
|
||||
#elif LANG == FINNISH
|
||||
#include "finnish.h"
|
||||
#include "langs/finnish.h"
|
||||
#elif LANG == FRENCH
|
||||
#include "french.h"
|
||||
#include "langs/french.h"
|
||||
#elif LANG == NORWEGIAN
|
||||
#include "norwgian.h"
|
||||
#include "langs/norwgian.h"
|
||||
#elif LANG == DANISH
|
||||
#include "danish.h"
|
||||
#include "langs/danish.h"
|
||||
#elif LANG == POLISH
|
||||
#include "polish.h"
|
||||
#include "langs/polish.h"
|
||||
#elif LANG == BRAZPORT
|
||||
#include "portbr.h"
|
||||
#include "langs/portbr.h"
|
||||
#elif LANG == ITALIAN
|
||||
#include "italian.h"
|
||||
#include "langs/italian.h"
|
||||
#elif LANG == ROMANIAN
|
||||
#include "langs/romanian.h"
|
||||
|
||||
/* If no sensible language, choose English. I intended to use
|
||||
the #error directive here, but some C compilers barf. */
|
||||
#else
|
||||
#include "english.h"
|
||||
#include "langs/english.h"
|
||||
#endif
|
||||
@@ -6,18 +6,18 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: danish.h,v 1.1 1996-03-27 03:25:51 dfs Exp $ */
|
||||
/* $Id: danish.h,v 1.4 1998-02-10 03:16:07 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Danish"
|
||||
|
||||
/* Day names */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_SUNDAY "S\370ndag"
|
||||
#else
|
||||
# define L_SUNDAY "Soendag"
|
||||
@@ -27,15 +27,12 @@
|
||||
#define L_WEDNESDAY "Onsdag"
|
||||
#define L_THURSDAY "Torsdag"
|
||||
#define L_FRIDAY "Fredag"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_SATURDAY "L\370rdag"
|
||||
#else
|
||||
# define L_SATURDAY "Loerdag"
|
||||
#endif
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "SMTOTFL"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "Januar"
|
||||
#define L_FEB "Februar"
|
||||
@@ -55,7 +52,7 @@
|
||||
#define L_TOMORROW "i morgen"
|
||||
|
||||
/* The default banner */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_BANNER "P\345mindelse for %w, %d. %m, %y%o:"
|
||||
#else
|
||||
# define L_BANNER "Paamindelse for %w, %d. %m, %y%o:"
|
||||
@@ -76,7 +73,7 @@
|
||||
#define L_INXDAYS "om %d dage"
|
||||
|
||||
/* "on" as in "on date..." */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_ON "p\345"
|
||||
#else
|
||||
# define L_ON "paa"
|
||||
@@ -11,11 +11,11 @@
|
||||
/* Further corrections by Erik-Jan Vens */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: dutch.h,v 1.1 1996-03-27 03:25:53 dfs Exp $ */
|
||||
/* $Id: dutch.h,v 1.3 1998-02-10 03:16:07 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Dutch"
|
||||
@@ -29,9 +29,6 @@
|
||||
#define L_FRIDAY "vrijdag"
|
||||
#define L_SATURDAY "zaterdag"
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "zmdwdvz"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "januari"
|
||||
#define L_FEB "februari"
|
||||
@@ -5,11 +5,11 @@
|
||||
/* Support for the English language. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: english.h,v 1.1 1996-03-27 03:25:53 dfs Exp $ */
|
||||
/* $Id: english.h,v 1.3 1998-02-10 03:16:08 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "English"
|
||||
@@ -23,9 +23,6 @@
|
||||
#define L_FRIDAY "Friday"
|
||||
#define L_SATURDAY "Saturday"
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "SMTWTFS"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "January"
|
||||
#define L_FEB "February"
|
||||
@@ -4,18 +4,18 @@
|
||||
/* */
|
||||
/* Support for the Finnish language. */
|
||||
/* */
|
||||
/* Author: Mikko Silvonen <Mikko.Silvonen@Helsinki.FI> */
|
||||
/* Author: Mikko Silvonen <silvonen@iki.fi> */
|
||||
/* */
|
||||
/* Finnish holidays and name days for Remind are available */
|
||||
/* at ftp.funet.fi (pub/unix/misc/remind-fin*). */
|
||||
/* See http://www.iki.fi/silvonen/remind/ for a list of */
|
||||
/* Finnish holidays. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* This file is Copyright (C) 1993, 1994 by Mikko Silvonen. */
|
||||
/* REMIND is Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
|
||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: finnish.h,v 1.3 1996-04-29 19:34:37 dfs Exp $ */
|
||||
/* $Id: finnish.h,v 1.5 1998-02-14 03:56:37 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Finnish"
|
||||
@@ -29,19 +29,16 @@
|
||||
#define L_FRIDAY "perjantai"
|
||||
#define L_SATURDAY "lauantai"
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "SMTKTPL"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "tammikuu"
|
||||
#define L_FEB "helmikuu"
|
||||
#define L_MAR "maaliskuu"
|
||||
#define L_APR "huhtikuu"
|
||||
#define L_MAY "toukokuu"
|
||||
#if defined(ISOLATIN1)
|
||||
#if ISOLATIN1
|
||||
#define L_JUN "kes\xE4kuu"
|
||||
#define L_JUL "hein\xE4kuu"
|
||||
#elif defined(IBMEXTENDED)
|
||||
#elif IBMEXTENDED
|
||||
#define L_JUN "kes\x84kuu"
|
||||
#define L_JUL "hein\x84kuu"
|
||||
#else
|
||||
@@ -55,9 +52,9 @@
|
||||
#define L_DEC "joulukuu"
|
||||
|
||||
/* Today and tomorrow */
|
||||
#if defined(ISOLATIN1)
|
||||
#if ISOLATIN1
|
||||
#define L_TODAY "t\xE4n\xE4\xE4n"
|
||||
#elif defined(IBMEXTENDED)
|
||||
#elif IBMEXTENDED
|
||||
#define L_TODAY "t\x84n\x84\x84n"
|
||||
#else
|
||||
#define L_TODAY "t{n{{n"
|
||||
@@ -65,7 +62,7 @@
|
||||
#define L_TOMORROW "huomenna"
|
||||
|
||||
/* The default banner */
|
||||
#define L_BANNER "Viestit %wna, %d. %mta %y%o:"
|
||||
#define L_BANNER "Viestit %wna %d. %mta %y%o:"
|
||||
|
||||
/* "am" and "pm" */
|
||||
#define L_AM "ap"
|
||||
@@ -79,9 +76,9 @@
|
||||
#define L_FROMNOW "kuluttua"
|
||||
|
||||
/* "in %d days' time" */
|
||||
#if defined(ISOLATIN1)
|
||||
#if ISOLATIN1
|
||||
#define L_INXDAYS "%d p\xE4iv\xE4n kuluttua"
|
||||
#elif defined(IBMEXTENDED)
|
||||
#elif IBMEXTENDED
|
||||
#define L_INXDAYS "%d p\x84iv\x84n kuluttua"
|
||||
#else
|
||||
#define L_INXDAYS "%d p{iv{n kuluttua"
|
||||
@@ -95,9 +92,9 @@
|
||||
/* Pluralizing - this is a problem for many languages and may require
|
||||
a more drastic fix */
|
||||
/* The partitive ending of "day" */
|
||||
#if defined(ISOLATIN1)
|
||||
#if ISOLATIN1
|
||||
#define L_PLURAL "\xE4"
|
||||
#elif defined(IBMEXTENDED)
|
||||
#elif IBMEXTENDED
|
||||
#define L_PLURAL "\x84"
|
||||
#else
|
||||
#define L_PLURAL "{"
|
||||
@@ -125,7 +122,7 @@
|
||||
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
|
||||
See the file dosubst.c for more info. */
|
||||
|
||||
#if defined(ISOLATIN1)
|
||||
#if ISOLATIN1
|
||||
#define L_ORDINAL_OVERRIDE switch(d) { \
|
||||
case 1: plu = ":sen\xE4"; break; \
|
||||
case 2: plu = ":sena"; break; \
|
||||
@@ -138,7 +135,7 @@
|
||||
default: plu = ":nten\xE4"; break; \
|
||||
} \
|
||||
}
|
||||
#elif defined(IBMEXTENDED)
|
||||
#elif IBMEXTENDED
|
||||
#define L_ORDINAL_OVERRIDE switch(d) { \
|
||||
case 1: plu = ":sen\x84"; break; \
|
||||
case 2: plu = ":sena"; break; \
|
||||
@@ -165,25 +162,25 @@
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
#define L_A_OVER sprintf(s, "%s%s, %d. %s%s %d", DayName[jul%7], L_ON, d, \
|
||||
#define L_A_OVER sprintf(s, "%s%s %d. %s%s %d", DayName[jul%7], L_ON, d, \
|
||||
MonthName[m], L_PARTIT, y);
|
||||
#define L_C_OVER sprintf(s, "%s%s", DayName[jul%7], L_ON);
|
||||
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DATESEP, m+1, DATESEP, \
|
||||
y);
|
||||
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DATESEP, d, DATESEP, y);
|
||||
#define L_G_OVER sprintf(s, "%s%s, %d. %s%s", DayName[jul%7], L_ON, d, \
|
||||
#define L_G_OVER sprintf(s, "%s%s %d. %s%s", DayName[jul%7], L_ON, d, \
|
||||
MonthName[m], L_PARTIT);
|
||||
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DATESEP, m+1);
|
||||
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DATESEP, d);
|
||||
#define L_J_OVER sprintf(s, "%s%s, %sn %d%s %d", DayName[jul%7], L_ON, \
|
||||
#define L_J_OVER sprintf(s, "%s%s %sn %d%s %d", DayName[jul%7], L_ON, \
|
||||
MonthName[m], d, plu, y);
|
||||
#define L_K_OVER sprintf(s, "%s%s, %sn %d%s", DayName[jul%7], L_ON, \
|
||||
#define L_K_OVER sprintf(s, "%s%s %sn %d%s", DayName[jul%7], L_ON, \
|
||||
MonthName[m], d, plu);
|
||||
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
|
||||
#define L_Q_OVER sprintf(s, "n");
|
||||
#define L_U_OVER sprintf(s, "%s%s, %d%s %s%s %d", DayName[jul%7], L_ON, \
|
||||
#define L_U_OVER sprintf(s, "%s%s %d%s %s%s %d", DayName[jul%7], L_ON, \
|
||||
d, plu, MonthName[m], L_PARTIT, y);
|
||||
#define L_V_OVER sprintf(s, "%s%s, %d%s %s%s", DayName[jul%7], L_ON, d, \
|
||||
#define L_V_OVER sprintf(s, "%s%s %d%s %s%s", DayName[jul%7], L_ON, d, \
|
||||
plu, MonthName[m], L_PARTIT);
|
||||
#define L_1_OVER if (tdiff == 0) \
|
||||
sprintf(s, L_NOW); \
|
||||
@@ -212,7 +209,7 @@ else { \
|
||||
#define L_ERR_OVERRIDE 1
|
||||
EXTERN char *ErrMsg[] =
|
||||
{
|
||||
#if defined(ISOLATIN1)
|
||||
#if ISOLATIN1
|
||||
"Ok",
|
||||
"Puuttuva ']'",
|
||||
"Puuttuva lainausmerkki",
|
||||
@@ -311,9 +308,9 @@ EXTERN char *ErrMsg[] =
|
||||
"Ei viestej\xE4.",
|
||||
"%d viesti(\xE4) t\xE4m\xE4n p\xE4iv\xE4n jonossa.\n",
|
||||
"Numero puuttuu",
|
||||
"Illegal function in WARN clause (NEEDS TRANSLATION)"
|
||||
"Virheellinen funktio WARN-lausekkeessa"
|
||||
|
||||
#elif defined(IBMEXTENDED)
|
||||
#elif IBMEXTENDED
|
||||
"Ok",
|
||||
"Puuttuva ']'",
|
||||
"Puuttuva lainausmerkki",
|
||||
@@ -412,7 +409,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Ei viestej\x84.",
|
||||
"%d viesti(\x84) t\x84m\x84n p\x84iv\x84n jonossa.\n",
|
||||
"Numero puuttuu"
|
||||
"Illegal function in WARN clause (NEEDS TRANSLATION)"
|
||||
"Virheellinen funktio WARN-lausekkeessa"
|
||||
#else
|
||||
"Ok",
|
||||
"Puuttuva ']'",
|
||||
@@ -512,7 +509,7 @@ EXTERN char *ErrMsg[] =
|
||||
"Ei viestej{.",
|
||||
"%d viesti({) t{m{n p{iv{n jonossa.\n",
|
||||
"Numero puuttuu",
|
||||
"Illegal function in WARN clause (NEEDS TRANSLATION)"
|
||||
"Virheellinen funktio WARN-lausekkeessa"
|
||||
#endif
|
||||
};
|
||||
#endif /* MK_GLOBALS */
|
||||
@@ -526,11 +523,11 @@ PUBLIC void Usage(void)
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1994 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
|
||||
#endif
|
||||
#if defined(ISOLATIN1)
|
||||
#if ISOLATIN1
|
||||
fprintf(ErrFp, "K\xE4ytt\xF6: remind [tarkenteet] tiedosto [p\xE4iv\xE4ys] [aika] [*toisto]\n");
|
||||
fprintf(ErrFp, "Tarkenteet:\n");
|
||||
fprintf(ErrFp, " -n Tulosta viestien seuraavat esiintymiskerrat yksink. muodossa\n");
|
||||
@@ -559,7 +556,7 @@ void Usage()
|
||||
fprintf(ErrFp, " -ivar=val Alusta muuttuja var arvolla val ja s\xE4ilyt\xE4 var\n");
|
||||
fprintf(ErrFp, " -m Aloita kalenteri maanantaista eik\xE4 sunnuntaista\n");
|
||||
exit(1);
|
||||
#elif defined(IBMEXTENDED)
|
||||
#elif IBMEXTENDED
|
||||
fprintf(ErrFp, "K\x84ytt\x94: remind [tarkenteet] tiedosto [p\x84iv\x84ys] [aika] [*toisto]\n");
|
||||
fprintf(ErrFp, "Tarkenteet:\n");
|
||||
fprintf(ErrFp, " -n Tulosta viestien seuraavat esiintymiskerrat yksink. muodossa\n");
|
||||
@@ -8,13 +8,13 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* This file is Copyright (C) 1993 by Laurent Duperval and */
|
||||
/* David F. Skoll. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: french.h,v 1.3 1996-04-29 19:34:37 dfs Exp $ */
|
||||
/* $Id: french.h,v 1.5 1998-02-14 03:56:38 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "French"
|
||||
@@ -28,12 +28,9 @@
|
||||
#define L_FRIDAY "vendredi"
|
||||
#define L_SATURDAY "samedi"
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "dlmmjvs"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "janvier"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_FEB "f\351vrier"
|
||||
#else
|
||||
#define L_FEB "fevrier"
|
||||
@@ -43,7 +40,7 @@
|
||||
#define L_MAY "mai"
|
||||
#define L_JUN "juin"
|
||||
#define L_JUL "juillet"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_AUG "ao\373t"
|
||||
#else
|
||||
#define L_AUG "aout"
|
||||
@@ -51,7 +48,7 @@
|
||||
#define L_SEP "septembre"
|
||||
#define L_OCT "octobre"
|
||||
#define L_NOV "novembre"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_DEC "d\351cembre"
|
||||
#else
|
||||
#define L_DEC "decembre"
|
||||
@@ -86,7 +83,7 @@
|
||||
|
||||
/* Minutes, hours, at, etc */
|
||||
#define L_NOW "maintenant"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_AT "\340"
|
||||
#else
|
||||
#define L_AT "a"
|
||||
@@ -94,7 +91,7 @@
|
||||
#define L_MINUTE "minute"
|
||||
#define L_HOUR "heure"
|
||||
#define L_IS "est"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_WAS "\351tait"
|
||||
#else
|
||||
#define L_WAS "etait"
|
||||
@@ -148,7 +145,7 @@ sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], \
|
||||
#define L_ERR_OVERRIDE 1
|
||||
EXTERN char *ErrMsg[] =
|
||||
{
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
"Ok",
|
||||
"']' manquant",
|
||||
"Apostrophe manquant",
|
||||
@@ -361,11 +358,11 @@ PUBLIC void Usage(void)
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1996 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||
#endif
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
fprintf(ErrFp, "\nUtilisation: remind [options] fichier [date] [heure] [*r\351p\351tition]\n");
|
||||
fprintf(ErrFp, "Options:\n");
|
||||
fprintf(ErrFp, " -n Afficher la prochaine occurence des rappels en format simple\n");
|
||||
@@ -9,11 +9,11 @@
|
||||
/* I don't speak German. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: german.h,v 1.1 1996-03-27 03:25:56 dfs Exp $ */
|
||||
/* $Id: german.h,v 1.4 1998-02-10 03:16:09 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "German"
|
||||
@@ -27,13 +27,10 @@
|
||||
#define L_FRIDAY "Freitag"
|
||||
#define L_SATURDAY "Samstag"
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "SMDMDFS"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "Januar"
|
||||
#define L_FEB "Februar"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_MAR "M\344rz"
|
||||
#else
|
||||
# define L_MAR "Maerz"
|
||||
@@ -53,7 +50,7 @@
|
||||
#define L_TOMORROW "morgen"
|
||||
|
||||
/* The default banner */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_BANNER "Termine f\374r %w, den %d. %m %y%o:"
|
||||
#else
|
||||
# define L_BANNER "Termine fuer %w, den %d. %m %y%o:"
|
||||
@@ -7,17 +7,17 @@
|
||||
/* This file is part of REMIND. */
|
||||
/* It is Copyright (C) 1996 by Valerio Aimale */
|
||||
/* */
|
||||
/* Remind is copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Remind is copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: italian.h,v 1.1 1996-10-12 02:49:33 dfs Exp $ */
|
||||
/* $Id: italian.h,v 1.4 1998-02-10 03:16:09 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Italian"
|
||||
|
||||
/* Day names */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_SUNDAY "Domenica"
|
||||
#define L_MONDAY "Luned\354"
|
||||
#define L_TUESDAY "Marted\354"
|
||||
@@ -35,10 +35,6 @@
|
||||
#define L_SATURDAY "Sabato"
|
||||
#endif /* ISOLATIN */
|
||||
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "DLMMGVS"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "Gennaio"
|
||||
#define L_FEB "Febbraio"
|
||||
@@ -86,7 +82,7 @@
|
||||
#define L_AT "alle"
|
||||
#define L_MINUTE "minut"
|
||||
#define L_HOUR "or"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_IS "\350"
|
||||
#else /* ISOLATIN1 */
|
||||
#define L_IS "e`"
|
||||
@@ -6,17 +6,17 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* This file is Copyright (C) 1993 by Trygve Randen. */
|
||||
/* Remind is Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Remind is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: norwgian.h,v 1.1 1996-03-27 03:26:03 dfs Exp $ */
|
||||
/* $Id: norwgian.h,v 1.4 1998-02-10 03:16:09 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Norwegian"
|
||||
|
||||
/* Day names */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_SUNDAY "S\370ndag"
|
||||
#else
|
||||
# define L_SUNDAY "Soendag"
|
||||
@@ -26,15 +26,12 @@
|
||||
#define L_WEDNESDAY "Onsdag"
|
||||
#define L_THURSDAY "Torsdag"
|
||||
#define L_FRIDAY "Fredag"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_SATURDAY "L\370rdag"
|
||||
#else
|
||||
# define L_SATURDAY "Loerdag"
|
||||
#endif
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "SMTOTFL"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "Januar"
|
||||
#define L_FEB "Februar"
|
||||
@@ -54,7 +51,7 @@
|
||||
#define L_TOMORROW "i morgen"
|
||||
|
||||
/* The default banner */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_BANNER "P\345minnelse for %w, %d. %m, %y%o:"
|
||||
#else
|
||||
# define L_BANNER "Paaminnelse for %w, %d. %m, %y%o:"
|
||||
@@ -69,7 +66,7 @@
|
||||
|
||||
/* Ago and from now */
|
||||
#define L_AGO "siden"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_FROMNOW "fra n\345"
|
||||
#else
|
||||
# define L_FROMNOW "fra naa"
|
||||
@@ -86,7 +83,7 @@
|
||||
#define L_PLURAL "er"
|
||||
|
||||
/* Minutes, hours, at, etc */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_NOW "n\345"
|
||||
#else
|
||||
# define L_NOW "naa"
|
||||
@@ -9,17 +9,17 @@
|
||||
/* Polish. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: polish.h,v 1.3 1996-04-29 19:34:38 dfs Exp $ */
|
||||
/* $Id: polish.h,v 1.5 1998-02-14 03:56:38 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Polish"
|
||||
|
||||
/* Day names */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_SUNDAY "Niedziela"
|
||||
# define L_MONDAY "Poniedzia\263ek"
|
||||
# define L_TUESDAY "Wtorek"
|
||||
@@ -37,15 +37,8 @@
|
||||
# define L_SATURDAY "Sobota"
|
||||
#endif
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#ifdef ISOLATIN1
|
||||
#define L_DAYINIT "NPW\246CPS"
|
||||
#else
|
||||
#define L_DAYINIT "NPWSCPS"
|
||||
#endif
|
||||
|
||||
/* Month names */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_JAN "Stycze\361"
|
||||
# define L_FEB "Luty"
|
||||
# define L_MAR "Marzec"
|
||||
@@ -106,7 +99,7 @@
|
||||
#define L_AT "o"
|
||||
#define L_MINUTE "minut"
|
||||
#define L_HOUR "godzin"
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
# define L_IS "b\352dzie"
|
||||
# define L_WAS "by\263o"
|
||||
#else
|
||||
@@ -115,7 +108,7 @@
|
||||
#endif
|
||||
#define L_AND "i"
|
||||
/* What to add to make "hour" or "minute" plural */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_NPLU( N ) ((N == 1) ? "\352" : ((N==12) || (N==13) || (N==14)) ? "" : \
|
||||
((N%10==2) || (N%10==3) || (N%10==4)) ? "y" : "" )
|
||||
#else
|
||||
@@ -129,7 +122,7 @@
|
||||
|
||||
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
|
||||
See the file dosubst.c for more info. */
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
#define L_AMPM_OVERRIDE(ampm, hour) \
|
||||
ampm = (hour<12) ? \
|
||||
(hour<5) ? " w nocy" \
|
||||
@@ -187,7 +180,7 @@ else \
|
||||
#define L_ERR_OVERRIDE 1
|
||||
EXTERN char *ErrMsg[] =
|
||||
{
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
"OK",
|
||||
"Brakuj\261cy ']'",
|
||||
"Brakuj\261cy nawias",
|
||||
@@ -400,11 +393,11 @@ PUBLIC void Usage(void)
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1996 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||
#endif
|
||||
#ifdef ISOLATIN1
|
||||
#if ISOLATIN1
|
||||
fprintf(ErrFp, "\nSpos\363b u\277ycia: remind [opcje] plik [data] [czas] [*powt\363rzenie]\n");
|
||||
fprintf(ErrFp, "Opcje:\n");
|
||||
fprintf(ErrFp, " -n Wypisz nast\352pne przypomnienia w prostym formacie\n");
|
||||
@@ -8,13 +8,13 @@
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* This file is Copyright (C) 1996 by Marco Paganini and */
|
||||
/* David F. Skoll. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: portbr.h,v 1.1 1996-06-22 02:21:29 dfs Exp $ */
|
||||
/* $Id: portbr.h,v 1.4 1998-02-14 03:56:38 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Brazilian Portuguese"
|
||||
@@ -28,9 +28,6 @@
|
||||
#define L_FRIDAY "sexta"
|
||||
#define L_SATURDAY "sabado"
|
||||
|
||||
/* Day initials - first letter only */
|
||||
#define L_DAYINIT "dstqqss"
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "janeiro"
|
||||
#define L_FEB "fevereiro"
|
||||
@@ -261,7 +258,7 @@ PUBLIC void Usage(void)
|
||||
void Usage()
|
||||
#endif /* HAVE_PROTOS */
|
||||
{
|
||||
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-1996 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
||||
#ifdef BETA
|
||||
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
|
||||
#endif
|
||||
164
src/langs/romanian.h
Normal file
164
src/langs/romanian.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* ROMANIAN.H */
|
||||
/* */
|
||||
/* Support for the Romanian language. */
|
||||
/* */
|
||||
/* Contributed by Liviu Daia <daia@stoilow.imar.ro> */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: romanian.h,v 1.4 1998-03-01 20:44:10 dfs Exp $ */
|
||||
|
||||
/* The very first define in a language support file must be L_LANGNAME: */
|
||||
#define L_LANGNAME "Romanian"
|
||||
|
||||
/* Day names */
|
||||
#if ISOLATIN1
|
||||
# define L_SUNDAY "Duminica"
|
||||
# define L_MONDAY "Luni"
|
||||
# define L_TUESDAY "Marti"
|
||||
# define L_WEDNESDAY "Miercuri"
|
||||
# define L_THURSDAY "Joi"
|
||||
# define L_FRIDAY "Vineri"
|
||||
# define L_SATURDAY "S\342mbata"
|
||||
#elif ISOLATIN2
|
||||
# define L_SUNDAY "Duminic\343"
|
||||
# define L_MONDAY "Luni"
|
||||
# define L_TUESDAY "Mar\376i"
|
||||
# define L_WEDNESDAY "Miercuri"
|
||||
# define L_THURSDAY "Joi"
|
||||
# define L_FRIDAY "Vineri"
|
||||
# define L_SATURDAY "S\342mb\343t\343"
|
||||
#elif IBM852
|
||||
# define L_SUNDAY "Duminic\307"
|
||||
# define L_MONDAY "Luni"
|
||||
# define L_TUESDAY "Mar\316i"
|
||||
# define L_WEDNESDAY "Miercuri"
|
||||
# define L_THURSDAY "Joi"
|
||||
# define L_FRIDAY "Vineri"
|
||||
# define L_SATURDAY "S\203mb\307t\307"
|
||||
#else
|
||||
# define L_SUNDAY "Duminica"
|
||||
# define L_MONDAY "Luni"
|
||||
# define L_TUESDAY "Marti"
|
||||
# define L_WEDNESDAY "Miercuri"
|
||||
# define L_THURSDAY "Joi"
|
||||
# define L_FRIDAY "Vineri"
|
||||
# define L_SATURDAY "Sambata"
|
||||
#endif
|
||||
|
||||
/* Month names */
|
||||
#define L_JAN "Ianuarie"
|
||||
#define L_FEB "Februarie"
|
||||
#define L_MAR "Martie"
|
||||
#define L_APR "Aprilie"
|
||||
#define L_MAY "Mai"
|
||||
#define L_JUN "Iunie"
|
||||
#define L_JUL "Iulie"
|
||||
#define L_AUG "August"
|
||||
#define L_SEP "Septembrie"
|
||||
#define L_OCT "Octombrie"
|
||||
#define L_NOV "Noiembrie"
|
||||
#define L_DEC "Decembrie"
|
||||
|
||||
/* Today and tomorrow */
|
||||
#if ISOLATIN1
|
||||
# define L_TODAY "astazi"
|
||||
# define L_TOMORROW "m\342ine"
|
||||
#elif ISOLATIN2
|
||||
# define L_TODAY "ast\343zi"
|
||||
# define L_TOMORROW "m\342ine"
|
||||
#elif IBM852
|
||||
# define L_TODAY "ast\307zi"
|
||||
# define L_TOMORROW "m\203ine"
|
||||
#else
|
||||
# define L_TODAY "astazi"
|
||||
# define L_TOMORROW "maine"
|
||||
#endif
|
||||
|
||||
/* The default banner */
|
||||
#define L_BANNER "Reamintiri pentru %w, %d %m %y%o:"
|
||||
|
||||
/* "am" and "pm" */
|
||||
#define L_AM "am"
|
||||
#define L_PM "pm"
|
||||
|
||||
#ifdef L_IN_DOSUBST
|
||||
/*** The following are only used in dosubst.c ***/
|
||||
|
||||
/* Ago and from now */
|
||||
#define L_AGO "acum"
|
||||
#define L_FROMNOW "peste"
|
||||
|
||||
/* "in %d days' time" */
|
||||
#define L_INXDAYS "peste %d zile"
|
||||
|
||||
/* "on" as in "on date..." */
|
||||
#define L_ON "pe"
|
||||
|
||||
/* Pluralizing - this is a problem for many languages and may require
|
||||
a more drastic fix */
|
||||
#define L_PLURAL "le"
|
||||
|
||||
/* Minutes, hours, at, etc */
|
||||
#define L_NOW "acum"
|
||||
#define L_AT "la ora"
|
||||
#define L_MINUTE "minut"
|
||||
#define L_HOUR "or"
|
||||
#define L_IS "este"
|
||||
#define L_WAS "a fost"
|
||||
/* What to add to make "minute" plural */
|
||||
#define L_MPLU "e"
|
||||
|
||||
#if ISOLATIN2
|
||||
/* What to add to make "hour" plural */
|
||||
# define L_HPLU_OVER hplu = (hdiff == 1 ? "\343" : "e");
|
||||
# define L_AND "\272i"
|
||||
#elif IBM852
|
||||
/* What to add to make "hour" plural */
|
||||
# define L_HPLU_OVER hplu = (hdiff == 1 ? "\307" : "e");
|
||||
# define L_AND "\255i"
|
||||
#else
|
||||
/* What to add to make "hour" plural */
|
||||
# define L_HPLU_OVER hplu = (hdiff == 1 ? "a" : "e");
|
||||
# define L_AND "si"
|
||||
#endif
|
||||
|
||||
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
|
||||
See the file dosubst.c for more info. */
|
||||
#if ISOLATIN2
|
||||
# define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<4) ? " noaptea" : " diminea\376a" : (hour > 17) ? " seara" : " dup\343-amiaza";
|
||||
#elif IBM852
|
||||
# define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<4) ? " noaptea" : " diminea\316a" : (hour > 17) ? " seara" : " dup\307-amiaza";
|
||||
#else
|
||||
# define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<4) ? " noaptea" : " dimineata" : (hour > 17) ? " seara" : " dupa-amiaza";
|
||||
#endif
|
||||
|
||||
#define L_ORDINAL_OVERRIDE plu = "";
|
||||
|
||||
#define L_A_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, MonthName[m], y);
|
||||
#define L_C_OVER sprintf(s, "%s", DayName[jul%7]);
|
||||
#define L_G_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, MonthName[m]);
|
||||
#define L_J_OVER sprintf(s, "%s, %s %d, %d", DayName[jul%7], MonthName[m], d, y);
|
||||
#define L_K_OVER sprintf(s, "%s, %s %d", DayName[jul%7], MonthName[m], d);
|
||||
#define L_S_OVER
|
||||
#define L_U_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, MonthName[m], y);
|
||||
#define L_V_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, MonthName[m]);
|
||||
#define L_1_OVER \
|
||||
if (tdiff == 0) \
|
||||
sprintf(s, L_NOW); \
|
||||
else if (hdiff == 0) \
|
||||
sprintf(s, "%s %d %s%s", when, mdiff, L_MINUTE, mplu); \
|
||||
else if (mdiff == 0) \
|
||||
sprintf(s, "%s %d %s%s", when, hdiff, L_HOUR, hplu); \
|
||||
else \
|
||||
sprintf(s, "%s %d %s%s %s %d %s%s", when, hdiff, \
|
||||
L_HOUR, hplu, L_AND, mdiff, L_MINUTE, mplu);
|
||||
|
||||
#endif /* L_IN_DOSUBST */
|
||||
@@ -6,49 +6,59 @@
|
||||
/* routines, etc. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: main.c,v 1.3 1996-04-28 02:01:59 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: main.c,v 1.9 1998-02-16 03:41:45 dfs Exp $";
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STDARG
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#if defined(HAVE_SYS_TIME_H) || defined (TIME_WITH_SYS_TIME)
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef AMIGA
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) || defined(__OS2__)
|
||||
#include <dos.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#ifndef SYSV
|
||||
#ifdef QDOS
|
||||
#include <sys/times.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif /* QDOS */
|
||||
#endif /* ndef SYSV */
|
||||
#endif /* if defined(__MSDOS__)... */
|
||||
#endif /* AMIGA */
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "protos.h"
|
||||
#include "expr.h"
|
||||
@@ -57,15 +67,12 @@ static char const RCSID[] = "$Id: main.c,v 1.3 1996-04-28 02:01:59 dfs Exp $";
|
||||
|
||||
PRIVATE void DoReminders ARGS ((void));
|
||||
|
||||
#if defined(NEED_TIMEGM) && !defined(HAVE_MKTIME)
|
||||
#if !defined(HAVE_TIMEGM) && !defined(HAVE_MKTIME)
|
||||
PRIVATE long time_cheat ARGS ((int year, int month));
|
||||
long timegm ARGS((struct tm *tm));
|
||||
long timelocal ARGS((struct tm *tm));
|
||||
#endif
|
||||
|
||||
static char TPushBuffer[TOKSIZE+1]; /* Buffer for pushing back a token. */
|
||||
static char *TokenPushed = NULL;
|
||||
|
||||
/* Whooo... the putchar/Putchar/PutChar macros are a mess...
|
||||
my apologies... */
|
||||
#ifdef OS2_POPUP
|
||||
@@ -383,9 +390,17 @@ int peek;
|
||||
int r;
|
||||
|
||||
*err = 0;
|
||||
if (TokenPushed && *TokenPushed)
|
||||
if (peek) return *TokenPushed;
|
||||
else return *TokenPushed++;
|
||||
if (p->tokenPushed && *p->tokenPushed) {
|
||||
if (peek) return *p->tokenPushed;
|
||||
else {
|
||||
r = *p->tokenPushed++;
|
||||
if (!r) {
|
||||
DBufFree(&p->pushedToken);
|
||||
p->tokenPushed = NULL;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
while(1) {
|
||||
if (p->isnested) {
|
||||
@@ -472,17 +487,16 @@ int peek;
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int ParseToken(ParsePtr p, char *out)
|
||||
PUBLIC int ParseToken(ParsePtr p, DynamicBuffer *dbuf)
|
||||
#else
|
||||
int ParseToken(p, out)
|
||||
int ParseToken(p, dbuf)
|
||||
ParsePtr p;
|
||||
char *out;
|
||||
DynamicBuffer *dbuf;
|
||||
#endif
|
||||
{
|
||||
int c, err;
|
||||
int len = 0;
|
||||
|
||||
*out = 0;
|
||||
DBufFree(dbuf);
|
||||
|
||||
c = ParseChar(p, &err, 0);
|
||||
if (err) return err;
|
||||
@@ -491,18 +505,17 @@ char *out;
|
||||
if (err) return err;
|
||||
}
|
||||
if (!c) return OK;
|
||||
*out++ = c;
|
||||
len++;
|
||||
|
||||
while (c && !isspace(c)) {
|
||||
if (DBufPutc(dbuf, c) != OK) {
|
||||
DBufFree(dbuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
c = ParseChar(p, &err, 0);
|
||||
if (err) return err;
|
||||
if (len < TOKSIZE && c && !isspace(c)) {
|
||||
*out++ = c;
|
||||
len++;
|
||||
if (err) {
|
||||
DBufFree(dbuf);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
*out = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -516,17 +529,16 @@ char *out;
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int ParseIdentifier(ParsePtr p, char *out)
|
||||
PUBLIC int ParseIdentifier(ParsePtr p, DynamicBuffer *dbuf)
|
||||
#else
|
||||
int ParseIdentifier(p, out)
|
||||
int ParseIdentifier(p, dbuf)
|
||||
ParsePtr p;
|
||||
char *out;
|
||||
DynamicBuffer *dbuf;
|
||||
#endif
|
||||
{
|
||||
int c, err;
|
||||
int len = 0;
|
||||
|
||||
*out = 0;
|
||||
DBufFree(dbuf);
|
||||
|
||||
c = ParseChar(p, &err, 0);
|
||||
if (err) return err;
|
||||
@@ -536,23 +548,26 @@ char *out;
|
||||
}
|
||||
if (!c) return E_EOLN;
|
||||
if (c != '$' && c != '_' && !isalpha(c)) return E_BAD_ID;
|
||||
*out++ = c;
|
||||
*out = 0;
|
||||
len++;
|
||||
if (DBufPutc(dbuf, c) != OK) {
|
||||
DBufFree(dbuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
c = ParseChar(p, &err, 1);
|
||||
if (err) return err;
|
||||
if (err) {
|
||||
DBufFree(dbuf);
|
||||
return err;
|
||||
}
|
||||
if (c != '_' && !isalnum(c)) return OK;
|
||||
|
||||
if (len < TOKSIZE) {
|
||||
c = ParseChar(p, &err, 0); /* Guaranteed to work */
|
||||
*out++ = c;
|
||||
*out = 0;
|
||||
len++;
|
||||
c = ParseChar(p, &err, 0); /* Guaranteed to work */
|
||||
if (DBufPutc(dbuf, c) != OK) {
|
||||
DBufFree(dbuf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* EvaluateExpr */
|
||||
@@ -594,7 +609,7 @@ Value *v;
|
||||
/* Eprint - print an error message. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_STDARG
|
||||
#ifdef HAVE_STDARG_H
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void Eprint(const char *fmt, ...)
|
||||
#else
|
||||
@@ -608,7 +623,7 @@ va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list argptr;
|
||||
#ifndef HAVE_STDARG
|
||||
#ifndef HAVE_STDARG_H
|
||||
char *fmt;
|
||||
#endif
|
||||
|
||||
@@ -624,7 +639,7 @@ va_dcl
|
||||
if (DebugFlag & DB_PRTLINE) OutputLine(ErrFp);
|
||||
} else fprintf(ErrFp, " ");
|
||||
|
||||
#ifdef HAVE_STDARG
|
||||
#ifdef HAVE_STDARG_H
|
||||
va_start(argptr, fmt);
|
||||
#else
|
||||
va_start(argptr);
|
||||
@@ -632,7 +647,7 @@ va_dcl
|
||||
#endif
|
||||
(void) vfprintf(ErrFp, fmt, argptr);
|
||||
(void) fputc('\n', ErrFp);
|
||||
#ifndef HAVE_STDARG
|
||||
#ifndef HAVE_STDARG_H
|
||||
va_end(argptr);
|
||||
#endif
|
||||
return;
|
||||
@@ -685,7 +700,8 @@ ParsePtr p;
|
||||
p->epos = NULL;
|
||||
p->etext = NULL;
|
||||
p->allownested = 1;
|
||||
TokenPushed = NULL;
|
||||
p->tokenPushed = NULL;
|
||||
DBufInit(&p->pushedToken);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -707,26 +723,31 @@ ParsePtr p;
|
||||
p->etext = NULL;
|
||||
p->isnested = 0;
|
||||
}
|
||||
DBufFree(&p->pushedToken);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* PushToken - one level of token pushback. This is */
|
||||
/* GLOBAL, not on a per-parser basis. */
|
||||
/* on a per-parser basis. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC void PushToken(const char *tok)
|
||||
PUBLIC int PushToken(const char *tok, ParsePtr p)
|
||||
#else
|
||||
void PushToken(tok)
|
||||
int PushToken(tok, p)
|
||||
char *tok;
|
||||
ParsePtr p;
|
||||
#endif
|
||||
{
|
||||
TokenPushed = TPushBuffer;
|
||||
strcpy(TPushBuffer, tok);
|
||||
strcat(TPushBuffer, " "); /* Separate the pushed token from the next
|
||||
token */
|
||||
|
||||
DBufFree(&p->pushedToken);
|
||||
if (DBufPuts(&p->pushedToken, (char *) tok) != OK ||
|
||||
DBufPutc(&p->pushedToken, ' ') != OK) {
|
||||
DBufFree(&p->pushedToken);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
p->tokenPushed = DBufValue(&p->pushedToken);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -972,11 +993,18 @@ ParsePtr p;
|
||||
{
|
||||
int r;
|
||||
|
||||
if ( (r = ParseToken(p, TokBuffer)) ) return r;
|
||||
if (*TokBuffer && (*TokBuffer != '#') && (*TokBuffer != ';')) {
|
||||
Eprint("%s: `%s'", ErrMsg[E_EXPECTING_EOL], TokBuffer);
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
if ( (r = ParseToken(p, &buf)) ) return r;
|
||||
if (*DBufValue(&buf) &&
|
||||
(*DBufValue(&buf) != '#') &&
|
||||
(*DBufValue(&buf) != ';')) {
|
||||
Eprint("%s: `%s'", ErrMsg[E_EXPECTING_EOL], DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
return E_EXTRANEOUS_TOKEN;
|
||||
}
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1070,9 +1098,9 @@ ParsePtr p;
|
||||
{
|
||||
int err;
|
||||
int c;
|
||||
char buf[LINELEN]; /* So we don't mess up the banner if an error occurs */
|
||||
char *s;
|
||||
DynamicBuffer buf;
|
||||
|
||||
DBufInit(&buf);
|
||||
c = ParseChar(p, &err, 0);
|
||||
if (err) return err;
|
||||
while (isspace(c)) {
|
||||
@@ -1080,16 +1108,20 @@ ParsePtr p;
|
||||
if (err) return err;
|
||||
}
|
||||
if (!c) return E_EOLN;
|
||||
s = buf;
|
||||
|
||||
while(c) {
|
||||
*s++ = c;
|
||||
if (DBufPutc(&buf, c) != OK) return E_NO_MEM;
|
||||
c = ParseChar(p, &err, 0);
|
||||
if (err) return err;
|
||||
if (err) {
|
||||
DBufFree(&buf);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
*s++ = 0;
|
||||
strcpy(Banner, buf);
|
||||
return OK;
|
||||
DBufFree(&Banner);
|
||||
|
||||
err = DBufPuts(&Banner, DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -1109,16 +1141,23 @@ ParsePtr p;
|
||||
{
|
||||
int r;
|
||||
|
||||
if ( (r=ParseToken(p, TokBuffer)) ) return r;
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
if ( (r=ParseToken(p, &buf)) ) return r;
|
||||
|
||||
/* Only allow RUN ON in top-level script */
|
||||
if (! StrCmpi(TokBuffer, "ON")) {
|
||||
if (! StrCmpi(DBufValue(&buf), "ON")) {
|
||||
if (TopLevel()) RunDisabled &= ~RUN_SCRIPT;
|
||||
}
|
||||
/* But allow RUN OFF anywhere */
|
||||
else if (! StrCmpi(TokBuffer, "OFF"))
|
||||
else if (! StrCmpi(DBufValue(&buf), "OFF"))
|
||||
RunDisabled |= RUN_SCRIPT;
|
||||
else return E_PARSE_ERR;
|
||||
else {
|
||||
DBufFree(&buf);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
DBufFree(&buf);
|
||||
|
||||
return VerifyEoln(p);
|
||||
}
|
||||
@@ -1183,13 +1222,18 @@ ParsePtr p;
|
||||
int r;
|
||||
char *s;
|
||||
|
||||
DynamicBuffer buf;
|
||||
|
||||
DBufInit(&buf);
|
||||
t.typ = MSG_TYPE;
|
||||
tt.ttime = SystemTime(0) / 60;
|
||||
if ( (r=DoSubst(p, SubstBuffer, &t, &tt, JulianToday, NORMAL_MODE)) )
|
||||
if ( (r=DoSubst(p, &buf, &t, &tt, JulianToday, NORMAL_MODE)) ) {
|
||||
return r;
|
||||
s = SubstBuffer;
|
||||
}
|
||||
s = DBufValue(&buf);
|
||||
while (isspace(*s)) s++;
|
||||
fprintf(ErrFp, "%s\n", s);
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1223,8 +1267,10 @@ int jul, tim, *mins, *isdst;
|
||||
|
||||
/* Convert jul and tim to an Unix tm struct */
|
||||
int yr, mon, day;
|
||||
int tdiff;
|
||||
struct tm local, utc, *temp;
|
||||
time_t loc_t, utc_t;
|
||||
int isdst_tmp;
|
||||
|
||||
FromJulian(jul, &yr, &mon, &day);
|
||||
|
||||
@@ -1243,11 +1289,17 @@ int jul, tim, *mins, *isdst;
|
||||
local.tm_year = yr-1900;
|
||||
local.tm_isdst = -1; /* We don't know whether or not dst is in effect */
|
||||
|
||||
|
||||
#if !defined(HAVE_MKTIME)
|
||||
loc_t = timelocal(&local);
|
||||
local.tm_isdst = 0;
|
||||
utc_t = timegm(&local);
|
||||
#else
|
||||
/* Horrible contortions to get minutes from UTC portably */
|
||||
loc_t = mktime(&local);
|
||||
if (loc_t == -1) return 1;
|
||||
isdst_tmp = local.tm_isdst;
|
||||
local.tm_isdst = 0;
|
||||
loc_t = mktime(&local);
|
||||
if (loc_t == -1) return 1;
|
||||
temp = gmtime(&loc_t);
|
||||
@@ -1256,14 +1308,23 @@ int jul, tim, *mins, *isdst;
|
||||
utc_t = mktime(&utc);
|
||||
if (utc_t == -1) return 1;
|
||||
#endif
|
||||
temp = localtime(&loc_t);
|
||||
#ifdef HAVE_MKTIME
|
||||
if (mins) *mins = (int) ( ((temp->tm_isdst) ? 60 : 0) +
|
||||
(loc_t - utc_t) / 60 ); /* Should use difftime */
|
||||
/* Compute difference between local time and UTC in seconds.
|
||||
Be careful, since time_t might be unsigned. */
|
||||
|
||||
#ifdef HAVE_DIFFTIME
|
||||
tdiff = (int) difftime(loc_t, utc_t);
|
||||
#else
|
||||
if (mins) *mins = (int) ((utc_t - loc_t) / 60);
|
||||
/* time_t may be unsigned, hence the contortions */
|
||||
if (loc_t < utc_t) {
|
||||
tdiff = - (int) (utc_t - loc_t);
|
||||
} else {
|
||||
tdiff = (int) (loc_t - utc_t);
|
||||
}
|
||||
#endif
|
||||
if (isdst) *isdst = temp->tm_isdst;
|
||||
|
||||
if (isdst_tmp) tdiff += 60*60;
|
||||
if (mins) *mins = (int)(tdiff / 60);
|
||||
if (isdst) *isdst = isdst_tmp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1371,7 +1432,7 @@ char *s;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(NEED_TIMEGM) && !defined(HAVE_MKTIME)
|
||||
#if !defined(HAVE_TIMEGM) && !defined(HAVE_MKTIME)
|
||||
#define TGM_SEC (1)
|
||||
#define TGM_MIN (60 * TGM_SEC)
|
||||
#define TGM_HR (60 * TGM_MIN)
|
||||
@@ -1528,26 +1589,19 @@ int utcdate, utctime, *locdate, *loctime;
|
||||
void __cdecl SigIntHandler(int d)
|
||||
#else
|
||||
#ifdef HAVE_PROTOS
|
||||
#ifdef SIGHANDLER_INT_ARG
|
||||
void SigIntHandler(int d)
|
||||
RETSIGTYPE SigIntHandler(int d)
|
||||
#else
|
||||
void SigIntHandler(void)
|
||||
#endif
|
||||
#else
|
||||
void SigIntHandler()
|
||||
RETSIGTYPE SigIntHandler()
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
#ifdef SYSV
|
||||
signal(SIGINT, SigIntHandler);
|
||||
#else
|
||||
#ifdef __BORLANDC__
|
||||
signal(SIGINT, SIG_DFL);
|
||||
#else
|
||||
#ifdef __OS2__
|
||||
signal(SIGINT, SIG_ACK);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
GotSigInt();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile for REMIND for Borland C++
|
||||
# $Id: makefile.bcc,v 1.3 1996-09-28 18:17:07 dfs Exp $
|
||||
# $Id: makefile.bcc,v 1.2 1998-03-01 20:43:56 dfs Exp $
|
||||
|
||||
VERSION= 03.00.15
|
||||
VERSION= 03.00.19
|
||||
|
||||
MODEL=l
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Makefile for REMIND for Microsoft C for MSDOS
|
||||
# $Id: makefile.msc,v 1.1 1996-03-27 03:26:01 dfs Exp $
|
||||
# $Id: makefile.msc,v 1.1 1998-01-15 02:50:32 dfs Exp $
|
||||
|
||||
OBJS= calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
|
||||
globals.obj init.obj main.obj omit.obj token.obj trigger.obj userfns.obj \
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile for REMIND
|
||||
#
|
||||
# $Id: makefile.os2,v 1.2 1996-10-12 02:49:34 dfs Exp $
|
||||
# $Id: makefile.os2,v 1.1 1998-01-15 02:50:32 dfs Exp $
|
||||
#
|
||||
# THIS IS OUT OF DATE!
|
||||
#
|
||||
@@ -18,6 +18,7 @@ default:
|
||||
@echo " msc OS/2 exe [Microsoft C 6.00a] "
|
||||
@echo " mscbnd OS/2 and DOS exe [Microsoft C 6.00a] "
|
||||
@echo " emx OS/2 and DOS 32-bit exe [EMX/gcc] "
|
||||
@echo " emxomf OS/2 32-bit exe w/DLL C library [EMX/gcc] "
|
||||
|
||||
|
||||
msc:
|
||||
@@ -41,6 +42,13 @@ emx:
|
||||
CFLAGS="-D__OS2__ -D__MSDOS__" \
|
||||
LFLAGS=""
|
||||
|
||||
emxomf:
|
||||
$(MAKE) -f Makefile.os2 all \
|
||||
CC="gcc -Zomf -O -s" O=".obj" \
|
||||
CFLAGS="-D__OS2__" \
|
||||
LFLAGS="-Zcrtdll -Zstack 32" \
|
||||
LFLAGS2="remind.def"
|
||||
|
||||
|
||||
# OS2_POPUP enables Russ Herman's popup reminders
|
||||
#OS2_POPUP =
|
||||
@@ -71,6 +79,8 @@ OBJS= $(SRCS:.c=$O)
|
||||
|
||||
all: remind.exe rem2ps.exe
|
||||
|
||||
.SUFFIXES: $O
|
||||
|
||||
.c$O:
|
||||
$(CC) -c $(CFLAGS) $(OS2_POPUP) $*.c
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Makefile for REMIND for Turbo C for MSDOS
|
||||
# $Id: makefile.tc,v 1.3 1996-09-28 18:17:08 dfs Exp $
|
||||
# $Id: makefile.tc,v 1.2 1998-03-01 20:43:57 dfs Exp $
|
||||
|
||||
CC= tcc
|
||||
VERSION= 03.00.15
|
||||
VERSION= 03.00.19
|
||||
|
||||
HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
|
||||
lang.h english.h german.h dutch.h finnish.h french.h norwgian.h \
|
||||
@@ -5,11 +5,12 @@
|
||||
/* Calculations for figuring out moon phases. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: moon.c,v 1.1 1996-03-27 03:26:03 dfs Exp $";
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: moon.c,v 1.3 1998-02-10 03:15:52 dfs Exp $";
|
||||
|
||||
/* All of these routines were adapted from the program "moontool"
|
||||
by John Walker, February 1988. Here's the blurb from moontool:
|
||||
@@ -59,10 +60,10 @@ static char const RCSID[] = "$Id: moon.c,v 1.1 1996-03-27 03:26:03 dfs Exp $";
|
||||
that credit and blame may be properly apportioned.
|
||||
|
||||
*/
|
||||
#include "config.h"
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
@@ -6,20 +6,23 @@
|
||||
/* the data structures for OMITted dates. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: omit.c,v 1.2 1996-04-28 02:02:00 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: omit.c,v 1.4 1998-02-10 03:15:53 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "protos.h"
|
||||
#include "globals.h"
|
||||
@@ -300,39 +303,51 @@ ParsePtr p;
|
||||
Token tok;
|
||||
int parsing=1;
|
||||
int syndrome;
|
||||
|
||||
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
/* Parse the OMIT. We need a month and day; year is optional. */
|
||||
while(parsing) {
|
||||
if ( (r=ParseToken(p, TokBuffer)) ) return r;
|
||||
FindToken(TokBuffer, &tok);
|
||||
if ( (r=ParseToken(p, &buf)) ) return r;
|
||||
FindToken(DBufValue(&buf), &tok);
|
||||
switch (tok.type) {
|
||||
case T_Year:
|
||||
DBufFree(&buf);
|
||||
if (y != NO_YR) return E_YR_TWICE;
|
||||
y = tok.val;
|
||||
break;
|
||||
|
||||
case T_Month:
|
||||
DBufFree(&buf);
|
||||
if (m != NO_MON) return E_MON_TWICE;
|
||||
m = tok.val;
|
||||
break;
|
||||
|
||||
case T_Day:
|
||||
DBufFree(&buf);
|
||||
if (d != NO_DAY) return E_DAY_TWICE;
|
||||
d = tok.val;
|
||||
break;
|
||||
|
||||
case T_Delta:
|
||||
DBufFree(&buf);
|
||||
break;
|
||||
|
||||
case T_Empty:
|
||||
case T_Comment:
|
||||
case T_RemType:
|
||||
case T_Priority:
|
||||
case T_Tag:
|
||||
case T_Duration:
|
||||
DBufFree(&buf);
|
||||
parsing = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
Eprint("%s: `%s' (OMIT)", ErrMsg[E_UNKNOWN_TOKEN], TokBuffer);
|
||||
Eprint("%s: `%s' (OMIT)", ErrMsg[E_UNKNOWN_TOKEN],
|
||||
DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
return E_UNKNOWN_TOKEN;
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,12 @@
|
||||
/* This file is part of REMIND. */
|
||||
/* */
|
||||
/* This file is Copyright (C) 1993 by Russ Herman. */
|
||||
/* REMIND is Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: os2func.c,v 1.1 1996-03-27 03:26:04 dfs Exp $";
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: os2func.c,v 1.2 1998-02-10 03:15:53 dfs Exp $";
|
||||
|
||||
#ifdef OS2_POPUP
|
||||
#define INCL_VIO
|
||||
@@ -34,7 +35,6 @@ static char const RCSID[] = "$Id: os2func.c,v 1.1 1996-03-27 03:26:04 dfs Exp $"
|
||||
#include <dos.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "config.h"
|
||||
#include "globals.h"
|
||||
|
||||
/* EMX defines PS_TYPE, so we undefine it here to avoid
|
||||
@@ -5,11 +5,11 @@
|
||||
/* Function Prototypes. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: protos.h,v 1.2 1996-03-31 04:01:57 dfs Exp $ */
|
||||
/* $Id: protos.h,v 1.6 1998-03-30 05:08:52 dfs Exp $ */
|
||||
|
||||
#ifdef HAVE_PROTOS
|
||||
#define ARGS(x) x
|
||||
@@ -23,14 +23,16 @@
|
||||
/* Define a general malloc routine for creating pointers to objects */
|
||||
#define NEW(type) ((type *) malloc(sizeof(type)))
|
||||
|
||||
#ifdef NO_STRSTR
|
||||
#include "dynbuf.h"
|
||||
|
||||
#ifndef HAVE_STRSTR
|
||||
char *strstr ARGS ((char *s1, char *s2));
|
||||
#endif
|
||||
|
||||
int CallUserFunc ARGS ((char *name, int nargs));
|
||||
int DoFset ARGS ((ParsePtr p));
|
||||
void ProduceCalendar ARGS ((void));
|
||||
char *SimpleTime ARGS ((int tim, char *out));
|
||||
char *SimpleTime ARGS ((int tim));
|
||||
int DoRem ARGS ((ParsePtr p));
|
||||
int DoFlush ARGS ((ParsePtr p));
|
||||
void DoExit ARGS ((ParsePtr p));
|
||||
@@ -42,8 +44,8 @@ int TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
|
||||
int TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul));
|
||||
#endif
|
||||
int ShouldTriggerReminder ARGS ((Trigger *t, TimeTrig *tim, int jul));
|
||||
int DoSubst ARGS ((ParsePtr p, char *out, Trigger *t, TimeTrig *tt, int jul, int mode));
|
||||
int DoSubstFromString ARGS ((char *source, char *dest, int jul, int tim));
|
||||
int DoSubst ARGS ((ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode));
|
||||
int DoSubstFromString ARGS ((char *source, DynamicBuffer *dbuf, int jul, int tim));
|
||||
int EvalExpr ARGS ((char **e, Value *v));
|
||||
int DoCoerce ARGS ((char type, Value *v));
|
||||
void PrintValue ARGS ((Value *v, FILE *fp));
|
||||
@@ -63,8 +65,8 @@ int main ARGS ((int argc, char *argv[]));
|
||||
int Julian ARGS ((int year, int month, int day));
|
||||
void FromJulian ARGS ((int jul, int *y, int *m, int *d));
|
||||
int ParseChar ARGS ((ParsePtr p, int *err, int peek));
|
||||
int ParseToken ARGS ((ParsePtr p, char *out));
|
||||
int ParseIdentifier ARGS ((ParsePtr p, char *out));
|
||||
int ParseToken ARGS ((ParsePtr p, DynamicBuffer *dbuf));
|
||||
int ParseIdentifier ARGS ((ParsePtr p, DynamicBuffer *dbuf));
|
||||
int EvaluateExpr ARGS ((ParsePtr p, Value *v));
|
||||
int Evaluate ARGS ((char **s, Var *locals));
|
||||
int FnPopValStack ARGS ((Value *val));
|
||||
@@ -72,7 +74,7 @@ void Eprint ARGS ((const char *fmt, ...));
|
||||
void OutputLine ARGS ((FILE *fp));
|
||||
void CreateParser ARGS ((char *s, ParsePtr p));
|
||||
void DestroyParser ARGS ((ParsePtr p));
|
||||
void PushToken ARGS ((const char *tok));
|
||||
int PushToken ARGS ((const char *tok, ParsePtr p));
|
||||
long SystemTime ARGS ((int realtime));
|
||||
int SystemDate ARGS ((int *y, int *m, int *d));
|
||||
int DoIf ARGS ((ParsePtr p));
|
||||
@@ -92,7 +94,7 @@ int PushOmitContext ARGS ((ParsePtr p));
|
||||
int PopOmitContext ARGS ((ParsePtr p));
|
||||
int IsOmitted ARGS ((int jul, int localomit));
|
||||
int DoOmit ARGS ((ParsePtr p));
|
||||
int QueueReminder ARGS ((ParsePtr p, int typ, TimeTrig *tim, const char *sched));
|
||||
int QueueReminder ARGS ((ParsePtr p, Trigger *trig, TimeTrig *tim, const char *sched));
|
||||
void HandleQueuedReminders ARGS ((void));
|
||||
char *FindInitialToken ARGS ((Token *tok, char *s));
|
||||
void FindToken ARGS ((const char *s, Token *tok));
|
||||
@@ -115,7 +117,7 @@ void DestroyVars ARGS ((int all));
|
||||
int PreserveVar ARGS ((char *name));
|
||||
int DoPreserve ARGS ((Parser *p));
|
||||
int DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
|
||||
void DoMsgCommand ARGS ((char *cmd, char *msg));
|
||||
int DoMsgCommand ARGS ((char *cmd, char *msg));
|
||||
int ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
|
||||
unsigned int HashVal ARGS ((const char *str));
|
||||
int DateOK ARGS ((int y, int m, int d));
|
||||
@@ -151,11 +153,7 @@ int CompareRems ARGS ((int dat1, int tim1, int prio1, int dat2, int tim2, int pr
|
||||
#ifdef __BORLANDC__
|
||||
void __cdecl SigIntHandler ARGS ((int d));
|
||||
#else
|
||||
#ifdef SIGHANDLER_INT_ARG
|
||||
void SigIntHandler ARGS ((int d));
|
||||
#else
|
||||
void SigIntHandler ARGS ((void));
|
||||
#endif
|
||||
RETSIGTYPE SigIntHandler ARGS ((int d));
|
||||
#endif
|
||||
void GotSigInt ARGS ((void));
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
/* Queue up reminders for subsequent execution. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: queue.c,v 1.1 1996-03-27 03:26:05 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: queue.c,v 1.9 1998-05-10 02:46:43 dfs Exp $";
|
||||
|
||||
/* Solaris needs this to get select() prototype */
|
||||
#ifdef __sun__
|
||||
#define __EXTENSIONS__ 1
|
||||
#undef _POSIX_SOURCE
|
||||
#endif
|
||||
|
||||
/* We only want object code generated if we have queued reminders */
|
||||
#ifdef HAVE_QUEUED
|
||||
@@ -20,13 +25,20 @@ static char const RCSID[] = "$Id: queue.c,v 1.1 1996-03-27 03:26:05 dfs Exp $";
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
@@ -52,6 +64,7 @@ typedef struct queuedrem {
|
||||
int ntrig;
|
||||
char *text;
|
||||
char sched[VAR_NAME_LEN+1];
|
||||
char tag[TAG_LEN+1];
|
||||
TimeTrig tt;
|
||||
} QueuedRem;
|
||||
|
||||
@@ -65,6 +78,8 @@ PRIVATE void CheckInitialFile ARGS ((void));
|
||||
PRIVATE int CalculateNextTime ARGS ((QueuedRem *q));
|
||||
PRIVATE QueuedRem *FindNextReminder ARGS ((void));
|
||||
PRIVATE int CalculateNextTimeUsingSched ARGS ((QueuedRem *q));
|
||||
PRIVATE void DaemonWait ARGS ((unsigned int sleeptime));
|
||||
PRIVATE void reread ARGS((void));
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
@@ -75,11 +90,12 @@ PRIVATE int CalculateNextTimeUsingSched ARGS ((QueuedRem *q));
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC int QueueReminder(ParsePtr p, int typ, TimeTrig *tim, const char *sched)
|
||||
PUBLIC int QueueReminder(ParsePtr p, Trigger *trig,
|
||||
TimeTrig *tim, const char *sched)
|
||||
#else
|
||||
int QueueReminder(p, typ, tim, sched)
|
||||
int QueueReminder(p, trig, tim, sched)
|
||||
ParsePtr p;
|
||||
int typ;
|
||||
Trigger *trig,
|
||||
TimeTrig *tim;
|
||||
char *sched;
|
||||
#endif
|
||||
@@ -88,9 +104,9 @@ char *sched;
|
||||
|
||||
if (DontQueue ||
|
||||
tim->ttime == NO_TIME ||
|
||||
typ == CAL_TYPE ||
|
||||
trig->typ == CAL_TYPE ||
|
||||
tim->ttime < SystemTime(0) / 60 ||
|
||||
((typ == RUN_TYPE) && RunDisabled)) return OK;
|
||||
((trig->typ == RUN_TYPE) && RunDisabled)) return OK;
|
||||
|
||||
qelem = NEW(QueuedRem);
|
||||
if (!qelem) {
|
||||
@@ -101,12 +117,13 @@ char *sched;
|
||||
free(qelem);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
qelem->typ = typ;
|
||||
qelem->typ = trig->typ;
|
||||
qelem->tt = *tim;
|
||||
qelem->next = QueueHead;
|
||||
qelem->RunDisabled = RunDisabled;
|
||||
qelem->ntrig = 0;
|
||||
strcpy(qelem->sched, sched);
|
||||
strcpy(qelem->tag, trig->tag);
|
||||
QueueHead = qelem;
|
||||
NumQueued++;
|
||||
return OK;
|
||||
@@ -133,7 +150,10 @@ void HandleQueuedReminders()
|
||||
|
||||
/* Suppress the BANNER from being issued */
|
||||
NumTriggered = 1;
|
||||
|
||||
|
||||
/* Turn off sorting -- otherwise, TriggerReminder has no effect! */
|
||||
SortByDate = 0;
|
||||
|
||||
/* If we are not connected to a tty, then we must close the
|
||||
* standard file descriptors. This is to prevent someone
|
||||
* doing:
|
||||
@@ -149,7 +169,7 @@ void HandleQueuedReminders()
|
||||
}
|
||||
|
||||
/* If we're a daemon, get the mod time of initial file */
|
||||
if (Daemon) {
|
||||
if (Daemon > 0) {
|
||||
if (stat(InitialFile, &StatBuf)) {
|
||||
fprintf(ErrFp, "Cannot stat %s - not running as daemon!\n",
|
||||
InitialFile);
|
||||
@@ -178,35 +198,66 @@ void HandleQueuedReminders()
|
||||
/* If no more reminders to issue, we're done unless we're a daemon. */
|
||||
if (!q && !Daemon) break;
|
||||
|
||||
if (Daemon && !q)
|
||||
TimeToSleep = (long) 60*Daemon;
|
||||
else
|
||||
if (Daemon && !q) {
|
||||
if (Daemon < 0) {
|
||||
/* Sleep until midnight */
|
||||
TimeToSleep = (long) 1440*60L - SystemTime(0);
|
||||
} else {
|
||||
TimeToSleep = (long) 60*Daemon;
|
||||
}
|
||||
} else {
|
||||
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
|
||||
}
|
||||
|
||||
while (TimeToSleep > 0L) {
|
||||
SleepTime = (unsigned) ((TimeToSleep > 30000L) ? 30000 : TimeToSleep);
|
||||
|
||||
if (Daemon && SleepTime > 60*Daemon) SleepTime = 60*Daemon;
|
||||
if (Daemon > 0 && SleepTime > 60*Daemon) SleepTime = 60*Daemon;
|
||||
|
||||
sleep(SleepTime);
|
||||
if (Daemon >= 0) {
|
||||
sleep(SleepTime);
|
||||
} else {
|
||||
DaemonWait(SleepTime);
|
||||
}
|
||||
|
||||
if (Daemon && SleepTime) CheckInitialFile();
|
||||
if (Daemon> 0 && SleepTime) CheckInitialFile();
|
||||
|
||||
if (Daemon && !q)
|
||||
TimeToSleep = (long) 60*Daemon;
|
||||
else
|
||||
if (Daemon && !q) {
|
||||
if (Daemon < 0) {
|
||||
/* Sleep until midnight */
|
||||
TimeToSleep = (long) 1440*60L - SystemTime(0);
|
||||
} else {
|
||||
TimeToSleep = (long) 60*Daemon;
|
||||
}
|
||||
} else {
|
||||
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Trigger the reminder */
|
||||
CreateParser(q->text, &p);
|
||||
trig.typ = q->typ;
|
||||
RunDisabled = q->RunDisabled;
|
||||
if (Daemon < 0) {
|
||||
printf("NOTE reminder %s ",
|
||||
SimpleTime(q->tt.ttime));
|
||||
printf("%s ", SimpleTime(SystemTime(0)/60));
|
||||
if (!*q->tag) {
|
||||
printf("*");
|
||||
} else {
|
||||
printf("%s", q->tag);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
#ifdef OS2_POPUP
|
||||
(void) TriggerReminder(&p, &trig, &q->tt, JulianToday, 1);
|
||||
#else
|
||||
(void) TriggerReminder(&p, &trig, &q->tt, JulianToday);
|
||||
#endif
|
||||
if (Daemon < 0) {
|
||||
printf("NOTE endreminder\n");
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
/* Calculate the next trigger time */
|
||||
@@ -344,8 +395,9 @@ static void CheckInitialFile()
|
||||
|
||||
if (stat(InitialFile, &StatBuf) == 0) tim = StatBuf.st_mtime;
|
||||
if (tim != FileModTime ||
|
||||
RealToday != SystemDate(&y, &m, &d))
|
||||
execvp(ArgV[0], ArgV);
|
||||
RealToday != SystemDate(&y, &m, &d)) {
|
||||
reread();
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -377,8 +429,9 @@ QueuedRem *q;
|
||||
RunDisabled = q->RunDisabled; /* Don't want weird scheduling functions
|
||||
to be a security hole! */
|
||||
while(1) {
|
||||
sprintf(LineBuffer, "%s(%d)", q->sched, q->ntrig);
|
||||
s = LineBuffer;
|
||||
char exprBuf[VAR_NAME_LEN+32];
|
||||
sprintf(exprBuf, "%s(%d)", q->sched, q->ntrig);
|
||||
s = exprBuf;
|
||||
r = EvalExpr(&s, &v);
|
||||
if (r) {
|
||||
q->sched[0] = 0;
|
||||
@@ -409,4 +462,92 @@ QueuedRem *q;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DaemonWait */
|
||||
/* */
|
||||
/* Sleep or read command from stdin in "daemon -1" mode */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE void DaemonWait(unsigned int sleeptime)
|
||||
#else
|
||||
static DaemonWait(sleeptime)
|
||||
unsigned int sleeptime
|
||||
#endif
|
||||
{
|
||||
fd_set readSet;
|
||||
struct timeval timeout;
|
||||
int retval;
|
||||
int y, m, d;
|
||||
char cmdLine[256];
|
||||
|
||||
FD_ZERO(&readSet);
|
||||
FD_SET(0, &readSet);
|
||||
timeout.tv_sec = sleeptime;
|
||||
timeout.tv_usec = 0;
|
||||
retval = select(1, &readSet, NULL, NULL, &timeout);
|
||||
|
||||
/* If date has rolled around, restart */
|
||||
if (RealToday != SystemDate(&y, &m, &d)) {
|
||||
printf("NOTE newdate\nNOTE reread\n");
|
||||
fflush(stdout);
|
||||
reread();
|
||||
}
|
||||
|
||||
/* If nothing readable or interrupted system call, return */
|
||||
if (retval <= 0) return;
|
||||
|
||||
/* If stdin not readable, return */
|
||||
if (!FD_ISSET(0, &readSet)) return;
|
||||
|
||||
/* If EOF on stdin, exit */
|
||||
if (feof(stdin)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Read a line from stdin and interpret it */
|
||||
if (!fgets(cmdLine, sizeof(cmdLine), stdin)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!strcmp(cmdLine, "EXIT\n")) {
|
||||
exit(0);
|
||||
} else if (!strcmp(cmdLine, "STATUS\n")) {
|
||||
int nqueued = 0;
|
||||
QueuedRem *q = QueueHead;
|
||||
while(q) {
|
||||
if (q->tt.nexttime != NO_TIME) {
|
||||
nqueued++;
|
||||
}
|
||||
q = q->next;
|
||||
}
|
||||
printf("NOTE queued %d\n", nqueued);
|
||||
fflush(stdout);
|
||||
} else if (!strcmp(cmdLine, "REREAD\n")) {
|
||||
printf("NOTE reread\n");
|
||||
fflush(stdout);
|
||||
reread();
|
||||
} else {
|
||||
printf("ERR Invalid daemon command: %s", cmdLine);
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* reread */
|
||||
/* */
|
||||
/* Restarts Remind if date rolls over or REREAD cmd received */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PRIVATE void reread(void)
|
||||
#else
|
||||
static reread()
|
||||
#endif
|
||||
{
|
||||
execvp(ArgV[0], ArgV);
|
||||
}
|
||||
|
||||
#endif /* HAVE_QUEUED from way at the top */
|
||||
@@ -5,25 +5,26 @@
|
||||
/* Print a PostScript calendar. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: rem2ps.c,v 1.4 1996-07-07 16:35:42 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
#include "lang.h"
|
||||
#include "dynbuf.h"
|
||||
static char const RCSID[] = "$Id: rem2ps.c,v 1.7 1998-04-19 03:03:25 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_UNISTD
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "rem2ps.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
@@ -32,6 +33,9 @@ static char const RCSID[] = "$Id: rem2ps.c,v 1.4 1996-07-07 16:35:42 dfs Exp $";
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "rem2ps.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifdef HAVE_PROTOS
|
||||
#define ARGS(x) x
|
||||
#else
|
||||
@@ -49,7 +53,7 @@ typedef struct {
|
||||
int xsize, ysize;
|
||||
} PageType;
|
||||
|
||||
char Days[]=L_DAYINIT;
|
||||
char DayName[7][33];
|
||||
|
||||
char *SmallCalLoc[] = {
|
||||
"",
|
||||
@@ -94,8 +98,6 @@ char PortraitMode;
|
||||
char NoSmallCal;
|
||||
char UseISO;
|
||||
|
||||
char LineBuffer[LINELEN];
|
||||
|
||||
char *HeadFont="Helvetica";
|
||||
char *TitleFont="Helvetica";
|
||||
char *DayFont="Helvetica-BoldOblique";
|
||||
@@ -132,6 +134,7 @@ void WriteProlog ARGS ((void));
|
||||
void WriteCalEntry ARGS ((void));
|
||||
void WriteOneEntry ARGS ((char *s));
|
||||
void GetSmallLocations ARGS ((void));
|
||||
char *EatToken(char *in, char *out, int maxlen);
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
@@ -148,6 +151,8 @@ char argv[];
|
||||
{
|
||||
/* If stdin is a tty - probably wrong. */
|
||||
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
Init(argc, argv);
|
||||
|
||||
if (isatty(0)) {
|
||||
@@ -156,11 +161,11 @@ char argv[];
|
||||
|
||||
/* Search for a valid input file */
|
||||
while (!feof(stdin)) {
|
||||
gets(LineBuffer);
|
||||
if (!strcmp(LineBuffer, PSBEGIN)) {
|
||||
DBufGets(&buf, stdin);
|
||||
if (!strcmp(DBufValue(&buf), PSBEGIN)) {
|
||||
if (!validfile) {
|
||||
if (Verbose) {
|
||||
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-1996 by David F. Skoll\n\n", VERSION);
|
||||
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-1998 by David F. Skoll\n\n", VERSION);
|
||||
fprintf(stderr, "Generating PostScript calendar\n");
|
||||
}
|
||||
}
|
||||
@@ -197,25 +202,35 @@ void DoPsCal()
|
||||
int i;
|
||||
int is_ps;
|
||||
int firstcol;
|
||||
|
||||
char *startOfBody;
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
DynamicBuffer buf;
|
||||
CalEntry *c, *d;
|
||||
|
||||
/* Read the month and year name, followed by # days in month and 1st day of
|
||||
month */
|
||||
gets(LineBuffer);
|
||||
sscanf(LineBuffer, "%s %s %d %d %d", month, year, &days, &wkday,
|
||||
DBufInit(&buf);
|
||||
DBufGets(&buf, stdin);
|
||||
sscanf(DBufValue(&buf), "%s %s %d %d %d", month, year, &days, &wkday,
|
||||
&MondayFirst);
|
||||
|
||||
/* Get day names */
|
||||
DBufGets(&buf, stdin);
|
||||
sscanf(DBufValue(&buf), "%32s %32s %32s %32s %32s %32s %32s",
|
||||
DayName[0], DayName[1], DayName[2], DayName[3],
|
||||
DayName[4], DayName[5], DayName[6]);
|
||||
|
||||
/* We write the prolog here because it's only at this point that
|
||||
MondayFirst is set correctly. */
|
||||
if (validfile == 1) {
|
||||
WriteProlog();
|
||||
}
|
||||
|
||||
gets(LineBuffer);
|
||||
sscanf(LineBuffer, "%s %d", prevm, &prevdays);
|
||||
gets(LineBuffer);
|
||||
sscanf(LineBuffer, "%s %d", nextm, &nextdays);
|
||||
DBufGets(&buf, stdin);
|
||||
sscanf(DBufValue(&buf), "%s %d", prevm, &prevdays);
|
||||
DBufGets(&buf, stdin);
|
||||
sscanf(DBufValue(&buf), "%s %d", nextm, &nextdays);
|
||||
DBufFree(&buf);
|
||||
MaxDay = days;
|
||||
FirstWkDay = wkday;
|
||||
|
||||
@@ -226,7 +241,7 @@ void DoPsCal()
|
||||
year[2], year[3], validfile);
|
||||
|
||||
/* Emit PostScript to do the heading */
|
||||
if (!PortraitMode) printf("XSIZE 0 translate 90 rotate\n");
|
||||
if (!PortraitMode) printf("90 rotate 0 XSIZE neg translate\n");
|
||||
printf("/SAVESTATE save def (%s) (%s) PreCal SAVESTATE restore\n", month, year);
|
||||
printf("(%s %s) doheading\n", month, year);
|
||||
|
||||
@@ -265,11 +280,14 @@ void DoPsCal()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gets(LineBuffer);
|
||||
if (!strcmp(LineBuffer, PSEND)) break;
|
||||
DBufGets(&buf, stdin);
|
||||
if (!strcmp(DBufValue(&buf), PSEND)) {
|
||||
DBufFree(&buf);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Read the day number - a bit of a hack! */
|
||||
DayNum = (LineBuffer[8] - '0') * 10 + LineBuffer[9] - '0';
|
||||
DayNum = (DBufValue(&buf)[8] - '0') * 10 + DBufValue(&buf)[9] - '0';
|
||||
if (DayNum != CurDay) {
|
||||
for(; CurDay<DayNum; CurDay++) {
|
||||
WriteCalEntry();
|
||||
@@ -282,18 +300,48 @@ void DoPsCal()
|
||||
fprintf(stderr, "malloc failed - aborting.\n");
|
||||
exit(1);
|
||||
}
|
||||
is_ps = (*LineBuffer == 'F' || *LineBuffer == 'P');
|
||||
c->next = NULL;
|
||||
c->entry = malloc(strlen(LineBuffer+10) + 1 + is_ps);
|
||||
|
||||
/* Skip the tag, duration and time */
|
||||
startOfBody = DBufValue(&buf)+10;
|
||||
|
||||
/* Eat the passthru */
|
||||
startOfBody = EatToken(startOfBody, passthru, PASSTHRU_LEN);
|
||||
|
||||
/* Eat the tag */
|
||||
startOfBody = EatToken(startOfBody, NULL, 0);
|
||||
|
||||
/* Eat the duration */
|
||||
startOfBody = EatToken(startOfBody, NULL, 0);
|
||||
|
||||
/* Eat the time */
|
||||
startOfBody = EatToken(startOfBody, NULL, 0);
|
||||
|
||||
is_ps = 0;
|
||||
if (!strcmp(passthru, "PostScript") ||
|
||||
!strcmp(passthru, "PSFile") ||
|
||||
!strcmp(passthru, "MOON") ||
|
||||
!strcmp(passthru, "SHADE")) {
|
||||
is_ps = 1;
|
||||
}
|
||||
c->entry = malloc(strlen(startOfBody) + 1 + is_ps);
|
||||
if (!c->entry) {
|
||||
fprintf(stderr, "malloc failed - aborting.\n");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(c->entry+is_ps, LineBuffer+10);
|
||||
strcpy(c->entry+is_ps, startOfBody);
|
||||
|
||||
if (is_ps) {
|
||||
/* Save the 'P' or 'F' flag */
|
||||
*(c->entry) = *LineBuffer;
|
||||
if (!strcmp(passthru, "PostScript")) {
|
||||
*(c->entry) = 'P';
|
||||
} else if (!strcmp(passthru, "SHADE")) {
|
||||
*(c->entry) = 'S';
|
||||
} else if (!strcmp(passthru, "MOON")) {
|
||||
*(c->entry) = 'M';
|
||||
} else {
|
||||
*(c->entry) = 'F';
|
||||
}
|
||||
if (!PsEntries[DayNum]) PsEntries[DayNum] = c;
|
||||
else {
|
||||
d = PsEntries[DayNum];
|
||||
@@ -355,7 +403,7 @@ void WriteProlog()
|
||||
char *isostuff;
|
||||
FILE *fp;
|
||||
int nread;
|
||||
char buffer[LINELEN];
|
||||
char buffer[512];
|
||||
|
||||
if (!PortraitMode) {
|
||||
i = x; x = y; y = i;
|
||||
@@ -367,7 +415,7 @@ void WriteProlog()
|
||||
isostuff = "copyFont";
|
||||
|
||||
/* Write the document structuring stuff */
|
||||
printf("%%!PS-Adobe-\n");
|
||||
printf("%%!PS-Adobe-2.0\n");
|
||||
printf("%%%%DocumentFonts: %s", HeadFont);
|
||||
if (strcmp(TitleFont, HeadFont)) printf(" %s", TitleFont);
|
||||
if (strcmp(TitleFont, DayFont) &&
|
||||
@@ -388,12 +436,12 @@ void WriteProlog()
|
||||
for (i=0; PSProlog1[i]; i++) puts(PSProlog1[i]);
|
||||
if (!MondayFirst)
|
||||
printf("[(%s) (%s) (%s) (%s) (%s) (%s) (%s)]\n",
|
||||
L_SUNDAY, L_MONDAY, L_TUESDAY, L_WEDNESDAY,
|
||||
L_THURSDAY, L_FRIDAY, L_SATURDAY);
|
||||
DayName[0], DayName[1], DayName[2], DayName[3],
|
||||
DayName[4], DayName[5], DayName[6]);
|
||||
else
|
||||
printf("[(%s) (%s) (%s) (%s) (%s) (%s) (%s)]\n",
|
||||
L_MONDAY, L_TUESDAY, L_WEDNESDAY,
|
||||
L_THURSDAY, L_FRIDAY, L_SATURDAY, L_SUNDAY);
|
||||
DayName[1], DayName[2], DayName[3],
|
||||
DayName[4], DayName[5], DayName[6], DayName[0]);
|
||||
for (i=0; PSProlog2[i]; i++) puts(PSProlog2[i]);
|
||||
|
||||
printf("/HeadFont /%s %s\n", HeadFont, isostuff);
|
||||
@@ -430,7 +478,7 @@ void WriteProlog()
|
||||
fprintf(stderr, "Could not open prologue file `%s'\n", UserProlog);
|
||||
} else {
|
||||
while(1) {
|
||||
nread = fread(buffer, sizeof(char), LINELEN, fp);
|
||||
nread = fread(buffer, sizeof(char), 512, fp);
|
||||
if (!nread) break;
|
||||
fwrite(buffer, sizeof(char), nread, stdout);
|
||||
}
|
||||
@@ -550,16 +598,18 @@ char *s;
|
||||
printf(" [");
|
||||
|
||||
/* Chew up leading spaces */
|
||||
while(isspace(*s)) s++;
|
||||
while(isspace((unsigned char) *s)) s++;
|
||||
|
||||
PutChar('(');
|
||||
while(*s) {
|
||||
c = *s++;
|
||||
/* Use the "unsigned char" cast to fix problem on Solaris 2.5 */
|
||||
/* which treated some latin1 characters as white space. */
|
||||
c = (unsigned char) *s++;
|
||||
if (c == '\\' || c == '(' || c == ')') PutChar('\\');
|
||||
if (!isspace(c)) PutChar(c);
|
||||
else {
|
||||
PutChar(')');
|
||||
while(isspace(*s)) s++;
|
||||
while(isspace((unsigned char)*s)) s++;
|
||||
if (!*s) {
|
||||
printf("]\n");
|
||||
return;
|
||||
@@ -799,7 +849,7 @@ int days, first, col;
|
||||
for (i=0; i<7; i++) {
|
||||
if (MondayFirst) j=(i+1)%7;
|
||||
else j=i;
|
||||
printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize sub 2 sub moveto (%c) show\n", i, Days[j]);
|
||||
printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize sub 2 sub moveto (%c) show\n", i, DayName[j][0]);
|
||||
}
|
||||
|
||||
/* Now do the days of the month */
|
||||
@@ -832,7 +882,10 @@ int DoQueuedPs()
|
||||
CalEntry *e, *n;
|
||||
FILE *fp;
|
||||
int fnoff;
|
||||
char buffer[LINELEN];
|
||||
char buffer[512];
|
||||
char *size, *extra;
|
||||
int num, r, g, b, phase, fontsize, moonsize;
|
||||
unsigned char c;
|
||||
|
||||
if (!MondayFirst) begin = CurDay - WkDayNum;
|
||||
else begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
|
||||
@@ -859,20 +912,128 @@ int DoQueuedPs()
|
||||
/* Now do the user's PostScript code */
|
||||
fnoff = 1;
|
||||
while (isspace(*(e->entry+fnoff))) fnoff++;
|
||||
if (*(e->entry) == 'P') {
|
||||
switch(*e->entry) {
|
||||
case 'P': /* Send PostScript through */
|
||||
printf("%s\n", e->entry+fnoff);
|
||||
} else {
|
||||
break;
|
||||
case 'F': /* PostScript from a file */
|
||||
fp = fopen(e->entry+fnoff, "r");
|
||||
if (!fp) {
|
||||
fprintf(stderr, "Could not open PostScript file `%s'\n", e->entry+1);
|
||||
} else {
|
||||
while(1) {
|
||||
nread = fread(buffer, sizeof(char), LINELEN, fp);
|
||||
nread = fread(buffer, sizeof(char), 512, fp);
|
||||
if (!nread) break;
|
||||
fwrite(buffer, sizeof(char), nread, stdout);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
break;
|
||||
case 'S': /* Shading */
|
||||
num = sscanf(e->entry+fnoff, "%d %d %d", &r, &g, &b);
|
||||
if (num == 1) {
|
||||
g = r;
|
||||
b = r;
|
||||
} else if (num != 3) {
|
||||
fprintf(stderr, "Rem2PS: Malformed SHADE special\n");
|
||||
break;
|
||||
}
|
||||
if (r < 0 || r > 255 ||
|
||||
g < 0 || g > 255 ||
|
||||
b < 0 || b > 255) {
|
||||
fprintf(stderr, "Rem2PS: Illegal values for SHADE\n");
|
||||
break;
|
||||
}
|
||||
printf("/_A LineWidth 2 div def _A _A moveto\n");
|
||||
printf("BoxWidth _A sub _A lineto BoxWidth _A sub BoxHeight _A sub lineto\n");
|
||||
printf("_A BoxHeight _A sub lineto closepath\n");
|
||||
printf("%g %g %g setrgbcolor fill 0.0 setgray\n",
|
||||
r/255.0, g/255.0, b/255.0);
|
||||
break;
|
||||
|
||||
case 'M': /* Moon phase */
|
||||
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
||||
&fontsize);
|
||||
if (num == 1) {
|
||||
moonsize = -1;
|
||||
fontsize = -1;
|
||||
} else if (num == 2) {
|
||||
fontsize = -1;
|
||||
} else if (num != 3) {
|
||||
fprintf(stderr, "Rem2PS: Badly formed MOON special\n");
|
||||
break;
|
||||
}
|
||||
if (phase < 0 || phase > 3) {
|
||||
fprintf(stderr, "Rem2PS: Illegal MOON phase %d\n",
|
||||
phase);
|
||||
break;
|
||||
}
|
||||
if (moonsize < 0) {
|
||||
size = "DaySize 2 div";
|
||||
} else {
|
||||
sprintf(buffer, "%d", moonsize);
|
||||
size = buffer;
|
||||
}
|
||||
|
||||
printf("gsave 0 setgray newpath Border %s add BoxHeight Border sub %s sub\n", size, size);
|
||||
printf(" %s 0 360 arc closepath\n", size);
|
||||
switch(phase) {
|
||||
case 0:
|
||||
printf("fill\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("stroke\n");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
printf("stroke\n");
|
||||
printf("newpath Border %s add BoxHeight Border sub %s sub\n",
|
||||
size, size);
|
||||
printf("%s 90 270 arc closepath fill\n", size);
|
||||
break;
|
||||
default:
|
||||
printf("stroke\n");
|
||||
printf("newpath Border %s add BoxHeight Border sub %s sub\n",
|
||||
size, size);
|
||||
printf("%s 270 90 arc closepath fill\n", size);
|
||||
break;
|
||||
}
|
||||
/* See if we have extra stuff */
|
||||
extra = e->entry+fnoff;
|
||||
|
||||
/* Skip phase */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Skip moon size */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Skip font size */
|
||||
while(*extra && !isspace(*extra)) extra++;
|
||||
while(*extra && isspace(*extra)) extra++;
|
||||
|
||||
/* Anything left? */
|
||||
if (*extra) {
|
||||
printf("Border %s add %s add Border add BoxHeight border sub %s sub %s sub moveto\n", size, size, size, size);
|
||||
if (fontsize < 0) {
|
||||
size = "EntrySize";
|
||||
} else {
|
||||
sprintf(buffer, "%d", fontsize);
|
||||
size = buffer;
|
||||
}
|
||||
printf("/EntryFont findfont %s scalefont setfont (",
|
||||
size);
|
||||
while(*extra) {
|
||||
c = (unsigned char) *extra++;
|
||||
if (c == '\\' || c == '(' || c == ')') PutChar('\\');
|
||||
PutChar(c);
|
||||
}
|
||||
printf(") show\n");
|
||||
|
||||
}
|
||||
printf("grestore\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Free the entry */
|
||||
@@ -956,3 +1117,34 @@ void GetSmallLocations()
|
||||
return;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* EatToken */
|
||||
/* */
|
||||
/* Read a space-delimited token into an output buffer. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC char *EatToken(char *in, char *out, int maxlen)
|
||||
#else
|
||||
char *EatToken(in, out, maxlen)
|
||||
char *in, *out;
|
||||
int maxlen;
|
||||
#endif
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/* Skip space before token */
|
||||
while(*in && isspace(*in)) in++;
|
||||
|
||||
/* Eat the token */
|
||||
while(*in && !isspace(*in)) {
|
||||
if (i < maxlen) {
|
||||
if (out) *out++ = *in;
|
||||
i++;
|
||||
}
|
||||
in++;
|
||||
}
|
||||
if (out) *out = 0;
|
||||
return in;
|
||||
}
|
||||
@@ -5,16 +5,17 @@
|
||||
/* Define the PostScript prologue */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: rem2ps.h,v 1.1 1996-03-27 03:26:08 dfs Exp $ */
|
||||
/* $Id: rem2ps.h,v 1.2 1998-02-10 03:15:54 dfs Exp $ */
|
||||
|
||||
char *PSProlog1[] =
|
||||
{
|
||||
"% This file was produced by Remind and Rem2PS, written by",
|
||||
"% David F. Skoll.",
|
||||
"% Remind and Rem2PS are Copyright 1992-1997 David F. Skoll.",
|
||||
"/ISOLatin1Encoding where { pop save true }{ false } ifelse",
|
||||
" /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
|
||||
" StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: smakefile,v 1.3 1996-10-12 02:49:35 dfs Exp $
|
||||
# $Id: smakefile,v 1.1 1998-01-15 02:50:36 dfs Exp $
|
||||
# Makefile for REMIND, suitable for SAS/C 6.50 under AmigaDOS
|
||||
# English version
|
||||
# THIS IS OUT OF DATE!
|
||||
@@ -5,13 +5,15 @@
|
||||
/* Routines for sorting reminders by trigger date */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: sort.c,v 1.1 1996-03-27 03:26:10 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: sort.c,v 1.4 1998-02-10 03:15:55 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
@@ -21,8 +23,6 @@ static char const RCSID[] = "$Id: sort.c,v 1.1 1996-03-27 03:26:10 dfs Exp $";
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "types.h"
|
||||
#include "protos.h"
|
||||
#include "expr.h"
|
||||
@@ -205,10 +205,11 @@ static void IssueSortBanner(jul)
|
||||
int jul;
|
||||
#endif
|
||||
{
|
||||
char BanExpr[25];
|
||||
char BanExpr[64];
|
||||
int y, m, d;
|
||||
Value v;
|
||||
char *s = BanExpr;
|
||||
DynamicBuffer buf;
|
||||
|
||||
if (UserFuncExists("sortbanner") != 1) return;
|
||||
|
||||
@@ -217,8 +218,11 @@ int jul;
|
||||
y = EvalExpr(&s, &v);
|
||||
if (y) return;
|
||||
if (DoCoerce(STR_TYPE, &v)) return;
|
||||
if (!DoSubstFromString(v.v.str, SubstBuffer, jul, NO_TIME))
|
||||
if (*SubstBuffer) printf("%s\n", SubstBuffer);
|
||||
DBufInit(&buf);
|
||||
if (!DoSubstFromString(v.v.str, &buf, jul, NO_TIME)) {
|
||||
if (*DBufValue(&buf)) printf("%s\n", DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
}
|
||||
DestroyValue(v);
|
||||
}
|
||||
|
||||
@@ -6,22 +6,25 @@
|
||||
/* classifying the tokens parsed. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: token.c,v 1.2 1996-04-28 02:02:10 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: token.c,v 1.7 1998-03-01 20:43:57 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "globals.h"
|
||||
#include "protos.h"
|
||||
@@ -52,13 +55,14 @@ Token TokArray[] = {
|
||||
{ "banner", 3, T_Banner, 0 },
|
||||
{ "before", 3, T_Skip, BEFORE_SKIP },
|
||||
{ "cal", 3, T_RemType, CAL_TYPE },
|
||||
{ "clear-omit-context", 5, T_Clr, 0 },
|
||||
{ "debug", 5, T_Debug, 0 },
|
||||
{ "december", 3, T_Month, 11 },
|
||||
{ "dumpvars", 4, T_Dumpvars, 0 },
|
||||
{ "clear-omit-context", 5, T_Clr, 0 },
|
||||
{ "debug", 5, T_Debug, 0 },
|
||||
{ "december", 3, T_Month, 11 },
|
||||
{ "dumpvars", 4, T_Dumpvars, 0 },
|
||||
{ "duration", 3, T_Duration, 0 },
|
||||
{ "else", 4, T_Else, 0 },
|
||||
{ "endif", 5, T_EndIf, 0 },
|
||||
{ "errmsg", 6, T_ErrMsg, 0 },
|
||||
{ "errmsg", 6, T_ErrMsg, 0 },
|
||||
{ "exit", 4, T_Exit, 0 },
|
||||
{ "february", 3, T_Month, 1 },
|
||||
{ "flush", 5, T_Flush, 0 },
|
||||
@@ -67,7 +71,7 @@ Token TokArray[] = {
|
||||
{ "if", 2, T_If, 0 },
|
||||
{ "iftrig", 6, T_IfTrig, 0 },
|
||||
{ "include", 3, T_Include, 0 },
|
||||
{ "january", 3, T_Month, 0 },
|
||||
{ "january", 3, T_Month, 0 },
|
||||
{ "july", 3, T_Month, 6 },
|
||||
{ "june", 3, T_Month, 5 },
|
||||
{ "march", 3, T_Month, 2 },
|
||||
@@ -76,27 +80,29 @@ Token TokArray[] = {
|
||||
{ "msf", 3, T_RemType, MSF_TYPE },
|
||||
{ "msg", 3, T_RemType, MSG_TYPE },
|
||||
{ "november", 3, T_Month, 10 },
|
||||
{ "october", 3, T_Month, 9 },
|
||||
{ "october", 3, T_Month, 9 },
|
||||
{ "omit", 3, T_Omit, 0 },
|
||||
{ "once", 3, T_Once, 0 },
|
||||
{ "pop-omit-context", 3, T_Pop, 0 },
|
||||
{ "preserve", 8, T_Preserve, 0 },
|
||||
{ "preserve", 8, T_Preserve, 0 },
|
||||
{ "priority", 8, T_Priority, 0 },
|
||||
{ "ps", 2, T_RemType, PS_TYPE },
|
||||
{ "psfile", 6, T_RemType, PSF_TYPE },
|
||||
{ "psfile", 6, T_RemType, PSF_TYPE },
|
||||
{ "push-omit-context", 4, T_Push, 0 },
|
||||
{ "rem", 3, T_Rem, 0 },
|
||||
{ "run", 3, T_RemType, RUN_TYPE },
|
||||
{ "satisfy", 7, T_RemType, SAT_TYPE },
|
||||
{ "satisfy", 7, T_RemType, SAT_TYPE },
|
||||
{ "saturday", 3, T_WkDay, 5 },
|
||||
{ "scanfrom", 4, T_Scanfrom, 0 },
|
||||
{ "sched", 5, T_Sched, 0 },
|
||||
{ "september", 3, T_Month, 8 },
|
||||
{ "set", 3, T_Set, 0 },
|
||||
{ "skip", 3, T_Skip, SKIP_SKIP },
|
||||
{ "special", 7, T_RemType, PASSTHRU_TYPE },
|
||||
{ "sunday", 3, T_WkDay, 6 },
|
||||
{ "tag", 3, T_Tag, 0 },
|
||||
{ "thursday", 3, T_WkDay, 3 },
|
||||
{ "tuesday", 3, T_WkDay, 1 },
|
||||
{ "tuesday", 3, T_WkDay, 1 },
|
||||
{ "unset", 5, T_UnSet, 0 },
|
||||
{ "until", 3, T_Until, 0 },
|
||||
{ "warn", 4, T_Warn, 0 },
|
||||
@@ -109,24 +115,24 @@ Token NonEnglishToks[] = {
|
||||
/* NAME MINLEN TYPE VALUE */
|
||||
|
||||
{ L_MONDAY, 3, T_WkDay, 0 },
|
||||
{ L_TUESDAY, 3, T_WkDay, 1 },
|
||||
{ L_WEDNESDAY, 3, T_WkDay, 2 },
|
||||
{ L_THURSDAY, 3, T_WkDay, 3 },
|
||||
{ L_TUESDAY, 3, T_WkDay, 1 },
|
||||
{ L_WEDNESDAY, 3, T_WkDay, 2 },
|
||||
{ L_THURSDAY, 3, T_WkDay, 3 },
|
||||
{ L_FRIDAY, 3, T_WkDay, 4 },
|
||||
{ L_SATURDAY, 3, T_WkDay, 5 },
|
||||
{ L_SATURDAY, 3, T_WkDay, 5 },
|
||||
{ L_SUNDAY, 3, T_WkDay, 6 },
|
||||
{ L_JAN, 3, T_Month, 0 },
|
||||
{ L_FEB, 3, T_Month, 1 },
|
||||
{ L_MAR, 3, T_Month, 2 },
|
||||
{ L_APR, 3, T_Month, 3 },
|
||||
{ L_MAY, 3, T_Month, 4 },
|
||||
{ L_JUN, 3, T_Month, 5 },
|
||||
{ L_JUL, 3, T_Month, 6 },
|
||||
{ L_AUG, 3, T_Month, 7 },
|
||||
{ L_SEP, 3, T_Month, 8 },
|
||||
{ L_OCT, 3, T_Month, 9 },
|
||||
{ L_NOV, 3, T_Month, 10 },
|
||||
{ L_DEC, 3, T_Month, 11 }
|
||||
{ L_JAN, 3, T_Month, 0 },
|
||||
{ L_FEB, 3, T_Month, 1 },
|
||||
{ L_MAR, 3, T_Month, 2 },
|
||||
{ L_APR, 3, T_Month, 3 },
|
||||
{ L_MAY, 3, T_Month, 4 },
|
||||
{ L_JUN, 3, T_Month, 5 },
|
||||
{ L_JUL, 3, T_Month, 6 },
|
||||
{ L_AUG, 3, T_Month, 7 },
|
||||
{ L_SEP, 3, T_Month, 8 },
|
||||
{ L_OCT, 3, T_Month, 9 },
|
||||
{ L_NOV, 3, T_Month, 10 },
|
||||
{ L_DEC, 3, T_Month, 11 }
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -148,23 +154,20 @@ Token *tok;
|
||||
char *s;
|
||||
#endif
|
||||
{
|
||||
char *t;
|
||||
int len=0;
|
||||
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
tok->type = T_Illegal;
|
||||
|
||||
while (isspace(*s)) s++;
|
||||
|
||||
t = TokBuffer;
|
||||
|
||||
while (*s && !isspace(*s)) {
|
||||
if (len < TOKSIZE) {
|
||||
*t++ = *s++;
|
||||
len++;
|
||||
}else s++;
|
||||
if (DBufPutc(&buf, *s++) != OK) return s;
|
||||
}
|
||||
|
||||
*t = 0;
|
||||
FindToken(DBufValue(&buf), tok);
|
||||
DBufFree(&buf);
|
||||
|
||||
FindToken(TokBuffer, tok);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -205,6 +208,11 @@ Token *tok;
|
||||
}
|
||||
|
||||
l = strlen(s);
|
||||
|
||||
/* Ignore trailing commas */
|
||||
if (l > 0 && s[l-1] == ',') {
|
||||
l--;
|
||||
}
|
||||
bot = 0;
|
||||
top = sizeof(TokArray) / sizeof(TokArray[0]) - 1;
|
||||
|
||||
@@ -274,6 +282,20 @@ Token *t;
|
||||
if (isdigit(*s)) {
|
||||
PARSENUM(t->val, s);
|
||||
|
||||
/* If we hit a comma, swallow it. This allows stuff
|
||||
like Jan 6, 1998 */
|
||||
if (*s == ',') {
|
||||
s++;
|
||||
/* Special hack - convert years between 90 and
|
||||
99 to 1990 and 1999 */
|
||||
if (t->val >= 90 && t->val <= 99) t->val += 1900;
|
||||
|
||||
/* Classify the number we've got */
|
||||
if (t->val >= BASE && t->val <= BASE+YR_RANGE) t->type = T_Year;
|
||||
else if (t->val >= 1 && t->val <= 31) t->type = T_Day;
|
||||
else t->type = T_Number;
|
||||
return;
|
||||
}
|
||||
/* If we hit a colon or a period, we've probably got a time hr:min */
|
||||
if (*s == ':' || *s == '.' || *s == TIMESEP) {
|
||||
s++;
|
||||
@@ -340,12 +362,14 @@ char *s;
|
||||
{
|
||||
register int r;
|
||||
char *tk = t->name;
|
||||
while(*tk && *s) {
|
||||
while(*tk && *s && !(*s == ',' && *(s+1) == 0)) {
|
||||
r = UPPER(*tk) - UPPER(*s);
|
||||
tk++;
|
||||
s++;
|
||||
if (r) return r;
|
||||
}
|
||||
if (!*s) return 0;
|
||||
/* Ignore trailing commas on s */
|
||||
|
||||
if (!*s || (*s == ',' && !*(s+1))) return 0;
|
||||
return (*tk - *s);
|
||||
}
|
||||
@@ -5,20 +5,23 @@
|
||||
/* Routines for figuring out the trigger date of a reminder */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: trigger.c,v 1.2 1996-05-25 19:10:13 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: trigger.c,v 1.3 1998-02-10 03:15:55 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
#include "expr.h"
|
||||
#include "protos.h"
|
||||
@@ -5,11 +5,13 @@
|
||||
/* Type definitions all dumped here. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: types.h,v 1.2 1996-04-28 02:02:11 dfs Exp $ */
|
||||
/* $Id: types.h,v 1.3 1998-02-10 04:11:47 dfs Exp $ */
|
||||
|
||||
#include "dynbuf.h"
|
||||
|
||||
/* Values */
|
||||
typedef struct {
|
||||
@@ -58,6 +60,8 @@ typedef struct {
|
||||
int priority;
|
||||
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
|
||||
char warn[VAR_NAME_LEN+1]; /* Warning function */
|
||||
char tag[TAG_LEN+1];
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
} Trigger;
|
||||
|
||||
/* A time trigger */
|
||||
@@ -66,6 +70,7 @@ typedef struct {
|
||||
int nexttime;
|
||||
int delta;
|
||||
int rep;
|
||||
int duration;
|
||||
} TimeTrig;
|
||||
|
||||
/* The parse pointer */
|
||||
@@ -76,6 +81,8 @@ typedef struct {
|
||||
char *pos; /* Current position */
|
||||
char *etext; /* Substituted text */
|
||||
char *epos; /* Position in substituted text */
|
||||
DynamicBuffer pushedToken; /* Pushed-back token */
|
||||
char *tokenPushed; /* NULL if no pushed-back token */
|
||||
} Parser;
|
||||
|
||||
typedef Parser *ParsePtr; /* Pointer to parser structure */
|
||||
@@ -109,6 +116,8 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
|
||||
#define PS_TYPE 5
|
||||
#define PSF_TYPE 6
|
||||
#define MSF_TYPE 7
|
||||
#define PASSTHRU_TYPE 8
|
||||
|
||||
|
||||
/* DEFINES for debugging flags */
|
||||
#define DB_PRTLINE 1
|
||||
@@ -138,7 +147,9 @@ enum TokTypes
|
||||
T_Flush,
|
||||
T_Priority,
|
||||
T_Sched,
|
||||
T_Warn
|
||||
T_Warn,
|
||||
T_Tag,
|
||||
T_Duration
|
||||
};
|
||||
|
||||
/* The structure of a token */
|
||||
@@ -164,8 +175,9 @@ typedef struct {
|
||||
#define QUOTE_MARKER 1 /* Unlikely character to appear in reminder */
|
||||
|
||||
/* Flags for disabling run */
|
||||
#define RUN_CMDLINE 1
|
||||
#define RUN_SCRIPT 2
|
||||
#define RUN_CMDLINE 1
|
||||
#define RUN_SCRIPT 2
|
||||
#define RUN_NOTOWNER 4
|
||||
|
||||
/* Flags for the SimpleCalendar format */
|
||||
#define SC_AMPM 0 /* Time shown as 3:00am, etc. */
|
||||
@@ -6,21 +6,24 @@
|
||||
/* functions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: userfns.c,v 1.2 1996-04-28 02:02:11 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: userfns.c,v 1.4 1998-02-10 03:15:57 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "globals.h"
|
||||
#include "protos.h"
|
||||
@@ -35,7 +38,6 @@ typedef struct udf_struct {
|
||||
char name[VAR_NAME_LEN+1];
|
||||
char *text;
|
||||
Var *locals;
|
||||
char IsCached;
|
||||
char IsActive;
|
||||
int nargs;
|
||||
} UserFunc;
|
||||
@@ -76,27 +78,42 @@ ParsePtr p;
|
||||
UserFunc *func;
|
||||
Var *v;
|
||||
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
/* Get the function name */
|
||||
if ( (r=ParseIdentifier(p, TokBuffer)) ) return r;
|
||||
if (*TokBuffer == '$') return E_BAD_ID;
|
||||
if ( (r=ParseIdentifier(p, &buf)) ) return r;
|
||||
if (*DBufValue(&buf) == '$') {
|
||||
DBufFree(&buf);
|
||||
return E_BAD_ID;
|
||||
}
|
||||
|
||||
/* Should be followed by '(' */
|
||||
c = ParseNonSpaceChar(p, &r, 0);
|
||||
if (r) return r;
|
||||
if (c != '(') return E_PARSE_ERR;
|
||||
if (r) {
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
if (c != '(') {
|
||||
DBufFree(&buf);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
|
||||
func = NEW(UserFunc);
|
||||
if (!func) return E_NO_MEM;
|
||||
StrnCpy(func->name, TokBuffer, VAR_NAME_LEN);
|
||||
if (!func) {
|
||||
DBufFree(&buf);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
StrnCpy(func->name, DBufValue(&buf), VAR_NAME_LEN);
|
||||
DBufFree(&buf);
|
||||
if (!Hush) {
|
||||
if (FindFunc(TokBuffer, Func, NumFuncs)) {
|
||||
if (FindFunc(DBufValue(&buf), Func, NumFuncs)) {
|
||||
Eprint("%s: `%s'", ErrMsg[E_REDEF_FUNC],
|
||||
TokBuffer);
|
||||
DBufValue(&buf));
|
||||
}
|
||||
}
|
||||
func->locals = NULL;
|
||||
func->text = NULL;
|
||||
func->IsCached = 1;
|
||||
func->IsActive = 0;
|
||||
func->nargs = 0;
|
||||
|
||||
@@ -111,16 +128,21 @@ ParsePtr p;
|
||||
}
|
||||
else {
|
||||
while(1) {
|
||||
if ( (r=ParseIdentifier(p, TokBuffer)) ) return r;
|
||||
if (*TokBuffer == '$') return E_BAD_ID;
|
||||
if ( (r=ParseIdentifier(p, &buf)) ) return r;
|
||||
if (*DBufValue(&buf) == '$') {
|
||||
DBufFree(&buf);
|
||||
return E_BAD_ID;
|
||||
}
|
||||
v = NEW(Var);
|
||||
func->nargs++;
|
||||
v->v.type = ERR_TYPE;
|
||||
if (!v) {
|
||||
DBufFree(&buf);
|
||||
DestroyUserFunc(func);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
StrnCpy(v->name, TokBuffer, VAR_NAME_LEN);
|
||||
func->nargs++;
|
||||
v->v.type = ERR_TYPE;
|
||||
StrnCpy(v->name, DBufValue(&buf), VAR_NAME_LEN);
|
||||
DBufFree(&buf);
|
||||
v->next = func->locals;
|
||||
func->locals = v;
|
||||
c = ParseNonSpaceChar(p, &r, 0);
|
||||
@@ -139,18 +161,10 @@ ParsePtr p;
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
|
||||
/* A bit of trickery here - if the definition is already cached,
|
||||
no point in copying it. */
|
||||
if (CurLine != LineBuffer) {
|
||||
func->IsCached = 1;
|
||||
func->text = p->pos;
|
||||
} else {
|
||||
func->IsCached = 0;
|
||||
func->text = StrDup(p->pos);
|
||||
if (!func->text) {
|
||||
DestroyUserFunc(func);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
func->text = StrDup(p->pos);
|
||||
if (!func->text) {
|
||||
DestroyUserFunc(func);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
/* If an old definition of this function exists, destroy it */
|
||||
@@ -187,7 +201,7 @@ UserFunc *f;
|
||||
}
|
||||
|
||||
/* Free the function definition */
|
||||
if (f->text && !f->IsCached) free(f->text);
|
||||
if (f->text) free(f->text);
|
||||
|
||||
/* Free the data structure itself */
|
||||
free(f);
|
||||
@@ -5,22 +5,25 @@
|
||||
/* Useful utility functions. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: utils.c,v 1.2 1996-03-31 04:02:00 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: utils.c,v 1.3 1998-02-10 03:15:57 dfs Exp $";
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "globals.h"
|
||||
#include "protos.h"
|
||||
@@ -139,7 +142,7 @@ char *s1, *s2;
|
||||
return UPPER(*s1) - UPPER(*s2);
|
||||
}
|
||||
|
||||
#ifdef NO_STRSTR
|
||||
#ifndef HAVE_STRSTR
|
||||
#ifdef HAVE_PROTOS
|
||||
PUBLIC char *strstr(char *s1, char *s2)
|
||||
#else
|
||||
@@ -6,22 +6,25 @@
|
||||
/* user- and system-defined variables. */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
static char const RCSID[] = "$Id: var.c,v 1.3 1996-04-28 02:02:12 dfs Exp $";
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: var.c,v 1.5 1998-02-12 03:48:34 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "expr.h"
|
||||
#include "globals.h"
|
||||
@@ -215,14 +218,22 @@ Parser *p;
|
||||
Value v;
|
||||
int r;
|
||||
|
||||
r = ParseIdentifier(p, TokBuffer);
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
r = ParseIdentifier(p, &buf);
|
||||
if (r) return r;
|
||||
|
||||
r = EvaluateExpr(p, &v);
|
||||
if (r) return r;
|
||||
if (r) {
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
|
||||
if (*TokBuffer == '$') return SetSysVar(TokBuffer+1, &v);
|
||||
else return SetVar(TokBuffer, &v);
|
||||
if (*DBufValue(&buf) == '$') r = SetSysVar(DBufValue(&buf)+1, &v);
|
||||
else r = SetVar(DBufValue(&buf), &v);
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
@@ -239,18 +250,27 @@ Parser *p;
|
||||
{
|
||||
int r;
|
||||
|
||||
r = ParseToken(p, TokBuffer);
|
||||
if (r) return r;
|
||||
if (!*TokBuffer) return E_EOLN;
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
(void) DeleteVar(TokBuffer); /* Ignore error - nosuchvar */
|
||||
r = ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
if (!DBufLen(&buf)) {
|
||||
DBufFree(&buf);
|
||||
return E_EOLN;
|
||||
}
|
||||
|
||||
(void) DeleteVar(DBufValue(&buf)); /* Ignore error - nosuchvar */
|
||||
|
||||
/* Keep going... */
|
||||
while(1) {
|
||||
r = ParseToken(p, TokBuffer);
|
||||
r = ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
if (!*TokBuffer) return OK;
|
||||
(void) DeleteVar(TokBuffer);
|
||||
if (!DBufLen(&buf)) {
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
(void) DeleteVar(DBufValue(&buf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,30 +290,41 @@ ParsePtr p;
|
||||
{
|
||||
int r;
|
||||
Var *v;
|
||||
DynamicBuffer buf;
|
||||
|
||||
r = ParseToken(p, TokBuffer);
|
||||
DBufInit(&buf);
|
||||
r = ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
if (!*TokBuffer || *TokBuffer == '#' || *TokBuffer == ';') {
|
||||
if (!*DBufValue(&buf) ||
|
||||
*DBufValue(&buf) == '#' ||
|
||||
*DBufValue(&buf) == ';') {
|
||||
DBufFree(&buf);
|
||||
DumpVarTable();
|
||||
return OK;
|
||||
}
|
||||
fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, VARIABLE, VALUE);
|
||||
while(1) {
|
||||
if (*TokBuffer == '$') {
|
||||
DumpSysVarByName(TokBuffer+1);
|
||||
if (*DBufValue(&buf) == '$') {
|
||||
DumpSysVarByName(DBufValue(&buf)+1);
|
||||
} else {
|
||||
v = FindVar(TokBuffer, 0);
|
||||
TokBuffer[VAR_NAME_LEN] = 0;
|
||||
if (!v) fprintf(ErrFp, "%*s %s\n", VAR_NAME_LEN, TokBuffer, UNDEF);
|
||||
v = FindVar(DBufValue(&buf), 0);
|
||||
DBufValue(&buf)[VAR_NAME_LEN] = 0;
|
||||
if (!v) fprintf(ErrFp, "%*s %s\n", VAR_NAME_LEN,
|
||||
DBufValue(&buf), UNDEF);
|
||||
else {
|
||||
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, v->name);
|
||||
PrintValue(&(v->v), ErrFp);
|
||||
fprintf(ErrFp, "\n");
|
||||
}
|
||||
}
|
||||
r = ParseToken(p, TokBuffer);
|
||||
r = ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
if (!*TokBuffer || *TokBuffer == '#' || *TokBuffer == ';') return OK;
|
||||
if (!*DBufValue(&buf) ||
|
||||
*DBufValue(&buf) == '#' ||
|
||||
*DBufValue(&buf) == ';') {
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,19 +432,30 @@ Parser *p;
|
||||
{
|
||||
int r;
|
||||
|
||||
r = ParseToken(p, TokBuffer);
|
||||
if (r) return r;
|
||||
if (!*TokBuffer) return E_EOLN;
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
r = PreserveVar(TokBuffer);
|
||||
r = ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
if (!DBufLen(&buf)) {
|
||||
DBufFree(&buf);
|
||||
return E_EOLN;
|
||||
}
|
||||
|
||||
r = PreserveVar(DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
|
||||
/* Keep going... */
|
||||
while(1) {
|
||||
r = ParseToken(p, TokBuffer);
|
||||
r = ParseToken(p, &buf);
|
||||
if (r) return r;
|
||||
if (!*TokBuffer) return OK;
|
||||
r = PreserveVar(TokBuffer);
|
||||
if (!DBufLen(&buf)) {
|
||||
DBufFree(&buf);
|
||||
return OK;
|
||||
}
|
||||
r = PreserveVar(DBufValue(&buf));
|
||||
DBufFree(&buf);
|
||||
if (r) return r;
|
||||
}
|
||||
}
|
||||
@@ -547,6 +589,15 @@ Value *val;
|
||||
val->v.val = *((int *) v->value);
|
||||
}
|
||||
val->type = v->type;
|
||||
|
||||
/* In "verbose" mode, print attempts to test $RunOff */
|
||||
if (DebugFlag & DB_PRTLINE) {
|
||||
if (v->value == (void *) &RunDisabled) {
|
||||
Eprint("(Security note: $RunOff variable tested.)\n");
|
||||
/* Allow further messages from this line */
|
||||
FreshLine = 1;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
/* What version of remind do we have? */
|
||||
/* */
|
||||
/* This file is part of REMIND. */
|
||||
/* Copyright (C) 1992-1996 by David F. Skoll */
|
||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: version.h,v 1.3 1996-09-28 18:17:10 dfs Exp $ */
|
||||
#define VERSION "03.00.15"
|
||||
/* $Id: version.h,v 1.5 1998-05-06 01:47:27 dfs Exp $ */
|
||||
#define VERSION "03.00.19"
|
||||
@@ -2,19 +2,19 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# TEST-REM
|
||||
#
|
||||
# $Id: test-rem,v 1.1 1996-03-27 03:26:10 dfs Exp $
|
||||
# $Id: test-rem,v 1.2 1998-01-17 04:51:04 dfs Exp $
|
||||
#
|
||||
# This file runs an acceptance test for Remind. To use it, type:
|
||||
# sh test-rem OR make test
|
||||
# in the build directory.
|
||||
#
|
||||
# This file is part of REMIND.
|
||||
# Copyright (C) 1992-1996 by David F. Skoll
|
||||
# Copyright (C) 1992-1997 by David F. Skoll
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
TEST_GETENV="foo bar baz" ; export TEST_GETENV
|
||||
./remind -e -dxte ./test.rem 16 feb 1991 > ./test.out
|
||||
cmp -s ./test.out ./test.cmp
|
||||
../src/remind -e -dxte ../tests/test.rem 16 feb 1991 > ../tests/test.out
|
||||
cmp -s ../tests/test.out ../tests/test.cmp
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Remind: Acceptance test PASSED"
|
||||
exit 0
|
||||
@@ -631,7 +631,7 @@ set a057 value("a05"+"6")
|
||||
"a05" + "6" => "a056"
|
||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a058 version()
|
||||
version() => "03.00.15"
|
||||
version() => "03.00.19"
|
||||
set a059 wkday(today())
|
||||
today() => 1991/02/16
|
||||
wkday(1991/02/16) => "Saturday"
|
||||
@@ -772,7 +772,7 @@ dump
|
||||
a048 "foo"
|
||||
a067 "INT"
|
||||
a039 "February"
|
||||
a058 "03.00.15"
|
||||
a058 "03.00.19"
|
||||
a077 "1992 92
|
||||
"
|
||||
a049 21
|
||||
@@ -2,14 +2,14 @@
|
||||
rem ---------------------------------------------------------------------------
|
||||
rem TEST-REM
|
||||
rem
|
||||
rem $Id: test-rem.bat,v 1.1 1996-03-27 03:26:10 dfs Exp $
|
||||
rem $Id: test-rem.bat,v 1.1 1998-01-15 02:50:50 dfs Exp $
|
||||
rem
|
||||
rem This file runs an MSDOS acceptance test for Remind. To use it, type:
|
||||
rem test-rem
|
||||
rem in the build directory.
|
||||
rem
|
||||
rem This file is part of REMIND.
|
||||
rem Copyright (C) 1992-1996 by David F. Skoll
|
||||
rem Copyright (C) 1992-1997 by David F. Skoll
|
||||
rem ---------------------------------------------------------------------------
|
||||
|
||||
del test.out > nul
|
||||
@@ -2,14 +2,14 @@
|
||||
rem ---------------------------------------------------------------------------
|
||||
rem TEST-REM
|
||||
rem
|
||||
rem $Id: test-rem.cmd,v 1.1 1996-03-27 03:26:11 dfs Exp $
|
||||
rem $Id: test-rem.cmd,v 1.1 1998-01-15 02:50:50 dfs Exp $
|
||||
rem
|
||||
rem This file runs an OS/2 acceptance test for Remind. To use it, type:
|
||||
rem test-rem
|
||||
rem in the build directory.
|
||||
rem
|
||||
rem This file is part of REMIND.
|
||||
rem Copyright (C) 1992-1996 by David F. Skoll
|
||||
rem Copyright (C) 1992-1997 by David F. Skoll
|
||||
rem ---------------------------------------------------------------------------
|
||||
|
||||
del /f test.out > nul
|
||||
@@ -1,5 +1,5 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
$Id: test-rem.rexx,v 1.1 1996-03-31 04:02:00 dfs Exp $
|
||||
$Id: test-rem.rexx,v 1.1 1998-01-15 02:50:50 dfs Exp $
|
||||
TEST-REM
|
||||
This file runs an AmigaDOS acceptance test for Remind. To use it, type:
|
||||
rx test-rem
|
||||
@@ -6,7 +6,7 @@
|
||||
# ./test-rem # From WITHIN Remind source directory!
|
||||
|
||||
REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())]
|
||||
./test.rem(8): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(8): Trig = Saturday, 16 February, 1991
|
||||
Reminders for Saturday, 16th February, 1991:
|
||||
|
||||
today() => 1991/02/16
|
||||
@@ -26,7 +26,7 @@ y => "Tishrey"
|
||||
hebdate(1, "Tishrey") => 1991/09/09
|
||||
trigger(1991/09/09) => "9 September 1991"
|
||||
Leaving UserFN _h() => "9 September 1991"
|
||||
./test.rem(11): Trig = Monday, 9 September, 1991
|
||||
../tests/test.rem(11): Trig = Monday, 9 September, 1991
|
||||
[_h(2, "Tishrey")] MSG Rosh Hashana 2
|
||||
Entering UserFN _h(2, "Tishrey")
|
||||
x => 2
|
||||
@@ -34,7 +34,7 @@ y => "Tishrey"
|
||||
hebdate(2, "Tishrey") => 1991/09/10
|
||||
trigger(1991/09/10) => "10 September 1991"
|
||||
Leaving UserFN _h() => "10 September 1991"
|
||||
./test.rem(12): Trig = Tuesday, 10 September, 1991
|
||||
../tests/test.rem(12): Trig = Tuesday, 10 September, 1991
|
||||
[_h(3, "Tishrey")] MSG Tzom Gedalia
|
||||
Entering UserFN _h(3, "Tishrey")
|
||||
x => 3
|
||||
@@ -42,7 +42,7 @@ y => "Tishrey"
|
||||
hebdate(3, "Tishrey") => 1991/09/11
|
||||
trigger(1991/09/11) => "11 September 1991"
|
||||
Leaving UserFN _h() => "11 September 1991"
|
||||
./test.rem(13): Trig = Wednesday, 11 September, 1991
|
||||
../tests/test.rem(13): Trig = Wednesday, 11 September, 1991
|
||||
[_h(10, "Tishrey")] MSG Yom Kippur
|
||||
Entering UserFN _h(10, "Tishrey")
|
||||
x => 10
|
||||
@@ -50,7 +50,7 @@ y => "Tishrey"
|
||||
hebdate(10, "Tishrey") => 1991/09/18
|
||||
trigger(1991/09/18) => "18 September 1991"
|
||||
Leaving UserFN _h() => "18 September 1991"
|
||||
./test.rem(14): Trig = Wednesday, 18 September, 1991
|
||||
../tests/test.rem(14): Trig = Wednesday, 18 September, 1991
|
||||
[_h(15, "Tishrey")] MSG Sukkot 1
|
||||
Entering UserFN _h(15, "Tishrey")
|
||||
x => 15
|
||||
@@ -58,7 +58,7 @@ y => "Tishrey"
|
||||
hebdate(15, "Tishrey") => 1991/09/23
|
||||
trigger(1991/09/23) => "23 September 1991"
|
||||
Leaving UserFN _h() => "23 September 1991"
|
||||
./test.rem(15): Trig = Monday, 23 September, 1991
|
||||
../tests/test.rem(15): Trig = Monday, 23 September, 1991
|
||||
[_h(25, "Kislev")] MSG Channuka
|
||||
Entering UserFN _h(25, "Kislev")
|
||||
x => 25
|
||||
@@ -66,7 +66,7 @@ y => "Kislev"
|
||||
hebdate(25, "Kislev") => 1991/12/02
|
||||
trigger(1991/12/02) => "2 December 1991"
|
||||
Leaving UserFN _h() => "2 December 1991"
|
||||
./test.rem(16): Trig = Monday, 2 December, 1991
|
||||
../tests/test.rem(16): Trig = Monday, 2 December, 1991
|
||||
[_h(10, "Tevet")] MSG Asara B'Tevet
|
||||
Entering UserFN _h(10, "Tevet")
|
||||
x => 10
|
||||
@@ -74,7 +74,7 @@ y => "Tevet"
|
||||
hebdate(10, "Tevet") => 1991/12/17
|
||||
trigger(1991/12/17) => "17 December 1991"
|
||||
Leaving UserFN _h() => "17 December 1991"
|
||||
./test.rem(17): Trig = Tuesday, 17 December, 1991
|
||||
../tests/test.rem(17): Trig = Tuesday, 17 December, 1991
|
||||
[_h(15, "Shvat")] MSG Tu B'Shvat
|
||||
Entering UserFN _h(15, "Shvat")
|
||||
x => 15
|
||||
@@ -82,7 +82,7 @@ y => "Shvat"
|
||||
hebdate(15, "Shvat") => 1992/01/20
|
||||
trigger(1992/01/20) => "20 January 1992"
|
||||
Leaving UserFN _h() => "20 January 1992"
|
||||
./test.rem(18): Trig = Monday, 20 January, 1992
|
||||
../tests/test.rem(18): Trig = Monday, 20 January, 1992
|
||||
[_h(15, "Adar A")] MSG Purim Katan
|
||||
Entering UserFN _h(15, "Adar A")
|
||||
x => 15
|
||||
@@ -90,7 +90,7 @@ y => "Adar A"
|
||||
hebdate(15, "Adar A") => 1992/02/19
|
||||
trigger(1992/02/19) => "19 February 1992"
|
||||
Leaving UserFN _h() => "19 February 1992"
|
||||
./test.rem(19): Trig = Wednesday, 19 February, 1992
|
||||
../tests/test.rem(19): Trig = Wednesday, 19 February, 1992
|
||||
[_h(14, "Adar")] MSG Purim
|
||||
Entering UserFN _h(14, "Adar")
|
||||
x => 14
|
||||
@@ -98,7 +98,7 @@ y => "Adar"
|
||||
hebdate(14, "Adar") => 1991/02/28
|
||||
trigger(1991/02/28) => "28 February 1991"
|
||||
Leaving UserFN _h() => "28 February 1991"
|
||||
./test.rem(20): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(20): Trig = Thursday, 28 February, 1991
|
||||
[_h(15, "Nisan")] MSG Pesach
|
||||
Entering UserFN _h(15, "Nisan")
|
||||
x => 15
|
||||
@@ -106,7 +106,7 @@ y => "Nisan"
|
||||
hebdate(15, "Nisan") => 1991/03/30
|
||||
trigger(1991/03/30) => "30 March 1991"
|
||||
Leaving UserFN _h() => "30 March 1991"
|
||||
./test.rem(21): Trig = Saturday, 30 March, 1991
|
||||
../tests/test.rem(21): Trig = Saturday, 30 March, 1991
|
||||
[_h(27, "Nisan")] MSG Yom HaShoah
|
||||
Entering UserFN _h(27, "Nisan")
|
||||
x => 27
|
||||
@@ -114,7 +114,7 @@ y => "Nisan"
|
||||
hebdate(27, "Nisan") => 1991/04/11
|
||||
trigger(1991/04/11) => "11 April 1991"
|
||||
Leaving UserFN _h() => "11 April 1991"
|
||||
./test.rem(22): Trig = Thursday, 11 April, 1991
|
||||
../tests/test.rem(22): Trig = Thursday, 11 April, 1991
|
||||
[_h(4, "Iyar")] MSG Yom HaZikaron
|
||||
Entering UserFN _h(4, "Iyar")
|
||||
x => 4
|
||||
@@ -122,7 +122,7 @@ y => "Iyar"
|
||||
hebdate(4, "Iyar") => 1991/04/18
|
||||
trigger(1991/04/18) => "18 April 1991"
|
||||
Leaving UserFN _h() => "18 April 1991"
|
||||
./test.rem(23): Trig = Thursday, 18 April, 1991
|
||||
../tests/test.rem(23): Trig = Thursday, 18 April, 1991
|
||||
[_h(5, "Iyar")] MSG Yom Ha'atzmaut
|
||||
Entering UserFN _h(5, "Iyar")
|
||||
x => 5
|
||||
@@ -130,7 +130,7 @@ y => "Iyar"
|
||||
hebdate(5, "Iyar") => 1991/04/19
|
||||
trigger(1991/04/19) => "19 April 1991"
|
||||
Leaving UserFN _h() => "19 April 1991"
|
||||
./test.rem(24): Trig = Friday, 19 April, 1991
|
||||
../tests/test.rem(24): Trig = Friday, 19 April, 1991
|
||||
[_h(28, "Iyar")] MSG Yom Yerushalayim
|
||||
Entering UserFN _h(28, "Iyar")
|
||||
x => 28
|
||||
@@ -138,7 +138,7 @@ y => "Iyar"
|
||||
hebdate(28, "Iyar") => 1991/05/12
|
||||
trigger(1991/05/12) => "12 May 1991"
|
||||
Leaving UserFN _h() => "12 May 1991"
|
||||
./test.rem(25): Trig = Sunday, 12 May, 1991
|
||||
../tests/test.rem(25): Trig = Sunday, 12 May, 1991
|
||||
[_h(6, "Sivan")] MSG Shavuot
|
||||
Entering UserFN _h(6, "Sivan")
|
||||
x => 6
|
||||
@@ -146,7 +146,7 @@ y => "Sivan"
|
||||
hebdate(6, "Sivan") => 1991/05/19
|
||||
trigger(1991/05/19) => "19 May 1991"
|
||||
Leaving UserFN _h() => "19 May 1991"
|
||||
./test.rem(26): Trig = Sunday, 19 May, 1991
|
||||
../tests/test.rem(26): Trig = Sunday, 19 May, 1991
|
||||
[_h(9, "Av")] MSG Tish'a B'Av
|
||||
Entering UserFN _h(9, "Av")
|
||||
x => 9
|
||||
@@ -154,7 +154,7 @@ y => "Av"
|
||||
hebdate(9, "Av") => 1991/07/20
|
||||
trigger(1991/07/20) => "20 July 1991"
|
||||
Leaving UserFN _h() => "20 July 1991"
|
||||
./test.rem(27): Trig = Saturday, 20 July, 1991
|
||||
../tests/test.rem(27): Trig = Saturday, 20 July, 1991
|
||||
|
||||
# Test some jahrzeit cases
|
||||
fset _i(x,y,z,a) trigger(hebdate(x,y,z,a))
|
||||
@@ -168,7 +168,7 @@ a => 5759
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5759) => 1991/11/07
|
||||
trigger(1991/11/07) => "7 November 1991"
|
||||
Leaving UserFN _i() => "7 November 1991"
|
||||
./test.rem(31): Trig = Thursday, 7 November, 1991
|
||||
../tests/test.rem(31): Trig = Thursday, 7 November, 1991
|
||||
[_i(30, "Heshvan", today(), 5760)] MSG Complete-Defective
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5760)
|
||||
@@ -179,7 +179,7 @@ a => 5760
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5760) => 1991/11/07
|
||||
trigger(1991/11/07) => "7 November 1991"
|
||||
Leaving UserFN _i() => "7 November 1991"
|
||||
./test.rem(32): Trig = Thursday, 7 November, 1991
|
||||
../tests/test.rem(32): Trig = Thursday, 7 November, 1991
|
||||
[_i(30, "Heshvan", today(), 5761)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Heshvan", 1991/02/16, 5761)
|
||||
@@ -187,7 +187,7 @@ x => 30
|
||||
y => "Heshvan"
|
||||
z => 1991/02/16
|
||||
a => 5761
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5761) => ./test.rem(33): 30 Heshvan 5761: Invalid Hebrew date
|
||||
hebdate(30, "Heshvan", 1991/02/16, 5761) => ../tests/test.rem(33): 30 Heshvan 5761: Invalid Hebrew date
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
@@ -201,7 +201,7 @@ a => 5759
|
||||
hebdate(30, "Kislev", 1991/02/16, 5759) => 1991/12/07
|
||||
trigger(1991/12/07) => "7 December 1991"
|
||||
Leaving UserFN _i() => "7 December 1991"
|
||||
./test.rem(35): Trig = Saturday, 7 December, 1991
|
||||
../tests/test.rem(35): Trig = Saturday, 7 December, 1991
|
||||
[_i(30, "Kislev", today(), 5760)] MSG Complete-Defective
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5760)
|
||||
@@ -212,7 +212,7 @@ a => 5760
|
||||
hebdate(30, "Kislev", 1991/02/16, 5760) => 1991/12/07
|
||||
trigger(1991/12/07) => "7 December 1991"
|
||||
Leaving UserFN _i() => "7 December 1991"
|
||||
./test.rem(36): Trig = Saturday, 7 December, 1991
|
||||
../tests/test.rem(36): Trig = Saturday, 7 December, 1991
|
||||
[_i(30, "Kislev", today(), 5761)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Kislev", 1991/02/16, 5761)
|
||||
@@ -220,7 +220,7 @@ x => 30
|
||||
y => "Kislev"
|
||||
z => 1991/02/16
|
||||
a => 5761
|
||||
hebdate(30, "Kislev", 1991/02/16, 5761) => ./test.rem(37): 30 Kislev 5761: Invalid Hebrew date
|
||||
hebdate(30, "Kislev", 1991/02/16, 5761) => ../tests/test.rem(37): 30 Kislev 5761: Invalid Hebrew date
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
@@ -234,7 +234,7 @@ a => 5755
|
||||
hebdate(30, "Adar A", 1991/02/16, 5755) => 1992/03/05
|
||||
trigger(1992/03/05) => "5 March 1992"
|
||||
Leaving UserFN _i() => "5 March 1992"
|
||||
./test.rem(39): Trig = Thursday, 5 March, 1992
|
||||
../tests/test.rem(39): Trig = Thursday, 5 March, 1992
|
||||
[_i(30, "Adar A", today(), 5756)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(30, "Adar A", 1991/02/16, 5756)
|
||||
@@ -242,7 +242,7 @@ x => 30
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
a => 5756
|
||||
hebdate(30, "Adar A", 1991/02/16, 5756) => ./test.rem(40): No Adar A in 5756
|
||||
hebdate(30, "Adar A", 1991/02/16, 5756) => ../tests/test.rem(40): No Adar A in 5756
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
[_i(29, "Adar A", today(), 5755)] MSG Leap
|
||||
@@ -255,7 +255,7 @@ a => 5755
|
||||
hebdate(29, "Adar A", 1991/02/16, 5755) => 1991/03/15
|
||||
trigger(1991/03/15) => "15 March 1991"
|
||||
Leaving UserFN _i() => "15 March 1991"
|
||||
./test.rem(41): Trig = Friday, 15 March, 1991
|
||||
../tests/test.rem(41): Trig = Friday, 15 March, 1991
|
||||
[_i(29, "Adar A", today(), 5756)] MSG Illegal
|
||||
today() => 1991/02/16
|
||||
Entering UserFN _i(29, "Adar A", 1991/02/16, 5756)
|
||||
@@ -263,221 +263,221 @@ x => 29
|
||||
y => "Adar A"
|
||||
z => 1991/02/16
|
||||
a => 5756
|
||||
hebdate(29, "Adar A", 1991/02/16, 5756) => ./test.rem(42): No Adar A in 5756
|
||||
hebdate(29, "Adar A", 1991/02/16, 5756) => ../tests/test.rem(42): No Adar A in 5756
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
# Test each possible case of the basic reminders.
|
||||
|
||||
REM MSG Every Day
|
||||
./test.rem(46): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(46): Trig = Saturday, 16 February, 1991
|
||||
Every Day
|
||||
|
||||
|
||||
REM 18 MSG Every 18th
|
||||
./test.rem(48): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(48): Trig = Monday, 18 February, 1991
|
||||
REM 15 MSG Every 15th
|
||||
./test.rem(49): Trig = Friday, 15 March, 1991
|
||||
../tests/test.rem(49): Trig = Friday, 15 March, 1991
|
||||
|
||||
REM Feb MSG February
|
||||
./test.rem(51): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(51): Trig = Saturday, 16 February, 1991
|
||||
February
|
||||
|
||||
REM Jan MSG January
|
||||
./test.rem(52): Trig = Wednesday, 1 January, 1992
|
||||
../tests/test.rem(52): Trig = Wednesday, 1 January, 1992
|
||||
REM March MSG March
|
||||
./test.rem(53): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(53): Trig = Friday, 1 March, 1991
|
||||
|
||||
REM 13 Jan MSG 13 Jan
|
||||
./test.rem(55): Trig = Monday, 13 January, 1992
|
||||
../tests/test.rem(55): Trig = Monday, 13 January, 1992
|
||||
REM 15 Feb MSG 15 Feb
|
||||
./test.rem(56): Trig = Saturday, 15 February, 1992
|
||||
../tests/test.rem(56): Trig = Saturday, 15 February, 1992
|
||||
REM 28 Feb MSG 28 Feb
|
||||
./test.rem(57): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(57): Trig = Thursday, 28 February, 1991
|
||||
REM 29 Feb MSG 29 Feb
|
||||
./test.rem(58): Trig = Saturday, 29 February, 1992
|
||||
../tests/test.rem(58): Trig = Saturday, 29 February, 1992
|
||||
REM 5 Mar MSG 5 Mar
|
||||
./test.rem(59): Trig = Tuesday, 5 March, 1991
|
||||
../tests/test.rem(59): Trig = Tuesday, 5 March, 1991
|
||||
|
||||
REM 1990 MSG 1990
|
||||
./test.rem(61): Expired
|
||||
../tests/test.rem(61): Expired
|
||||
REM 1991 MSG 1991
|
||||
./test.rem(62): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(62): Trig = Saturday, 16 February, 1991
|
||||
1991
|
||||
|
||||
REM 1992 MSG 1991
|
||||
./test.rem(63): Trig = Wednesday, 1 January, 1992
|
||||
../tests/test.rem(63): Trig = Wednesday, 1 January, 1992
|
||||
|
||||
REM 1 1990 MSG 1 1990
|
||||
./test.rem(65): Expired
|
||||
../tests/test.rem(65): Expired
|
||||
REM 29 1991 MSG 29 1991
|
||||
./test.rem(66): Trig = Friday, 29 March, 1991
|
||||
../tests/test.rem(66): Trig = Friday, 29 March, 1991
|
||||
REM 29 1992 MSG 29 1992
|
||||
./test.rem(67): Trig = Wednesday, 29 January, 1992
|
||||
../tests/test.rem(67): Trig = Wednesday, 29 January, 1992
|
||||
REM 16 1991 MSG 16 1991
|
||||
./test.rem(68): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(68): Trig = Saturday, 16 February, 1991
|
||||
16 1991
|
||||
|
||||
|
||||
REM Jan 1990 MSG Jan 1990
|
||||
./test.rem(70): Expired
|
||||
../tests/test.rem(70): Expired
|
||||
REM Feb 1991 MSG Feb 1991
|
||||
./test.rem(71): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(71): Trig = Saturday, 16 February, 1991
|
||||
Feb 1991
|
||||
|
||||
REM Dec 1991 MSG Dec 1991
|
||||
./test.rem(72): Trig = Sunday, 1 December, 1991
|
||||
../tests/test.rem(72): Trig = Sunday, 1 December, 1991
|
||||
REM May 1992 MSG May 1992
|
||||
./test.rem(73): Trig = Friday, 1 May, 1992
|
||||
../tests/test.rem(73): Trig = Friday, 1 May, 1992
|
||||
|
||||
REM 1 Jan 1991 MSG 1 Jan 1991
|
||||
./test.rem(75): Expired
|
||||
../tests/test.rem(75): Expired
|
||||
REM 16 Feb 1991 MSG 16 Feb 1991
|
||||
./test.rem(76): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(76): Trig = Saturday, 16 February, 1991
|
||||
16 Feb 1991
|
||||
|
||||
REM 29 Dec 1992 MSG 29 Dec 1992
|
||||
./test.rem(77): Trig = Tuesday, 29 December, 1992
|
||||
../tests/test.rem(77): Trig = Tuesday, 29 December, 1992
|
||||
|
||||
REM Sun MSG Sun
|
||||
./test.rem(79): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(79): Trig = Sunday, 17 February, 1991
|
||||
REM Fri Sat Tue MSG Fri Sat Tue
|
||||
./test.rem(80): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(80): Trig = Saturday, 16 February, 1991
|
||||
Fri Sat Tue
|
||||
|
||||
|
||||
REM Sun 16 MSG Sun 16
|
||||
./test.rem(82): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(82): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue Wed Thu Fri 1 MSG Mon Tue Wed Thu Fri 1
|
||||
./test.rem(83): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(83): Trig = Friday, 1 March, 1991
|
||||
|
||||
REM Sun Feb MSG Sun Feb
|
||||
./test.rem(85): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(85): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue March MSG Mon Tue March
|
||||
./test.rem(86): Trig = Monday, 4 March, 1991
|
||||
../tests/test.rem(86): Trig = Monday, 4 March, 1991
|
||||
|
||||
REM Sun 16 Feb MSG Sun 16 Feb
|
||||
./test.rem(88): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(88): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue 10 March MSG Mon Tue 10 March
|
||||
./test.rem(89): Trig = Monday, 11 March, 1991
|
||||
../tests/test.rem(89): Trig = Monday, 11 March, 1991
|
||||
|
||||
REM Sat Sun 1991 MSG Sat Sun 1991
|
||||
./test.rem(91): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(91): Trig = Saturday, 16 February, 1991
|
||||
Sat Sun 1991
|
||||
|
||||
REM Mon Tue 1992 MSG Mon Tue 1992
|
||||
./test.rem(92): Trig = Monday, 6 January, 1992
|
||||
../tests/test.rem(92): Trig = Monday, 6 January, 1992
|
||||
|
||||
REM Sun 16 1991 MSG Sun 16 1991
|
||||
./test.rem(94): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(94): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue Wed Thu Fri 1 1992 MSG Mon Tue Wed Thu Fri 1 1992
|
||||
./test.rem(95): Trig = Wednesday, 1 January, 1992
|
||||
../tests/test.rem(95): Trig = Wednesday, 1 January, 1992
|
||||
|
||||
REM Mon Feb 1991 MSG Mon Feb 1991
|
||||
./test.rem(97): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(97): Trig = Monday, 18 February, 1991
|
||||
REM Tue Jan 1992 MSG Tue Jan 1992
|
||||
./test.rem(98): Trig = Tuesday, 7 January, 1992
|
||||
../tests/test.rem(98): Trig = Tuesday, 7 January, 1992
|
||||
|
||||
REM Sun Mon 16 Feb 1991 MSG Sun Mon 16 Feb 1991
|
||||
./test.rem(100): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(100): Trig = Sunday, 17 February, 1991
|
||||
REM Tue 28 Jan 1992 MSG Tue 28 Jan 1992
|
||||
./test.rem(101): Trig = Tuesday, 28 January, 1992
|
||||
../tests/test.rem(101): Trig = Tuesday, 28 January, 1992
|
||||
|
||||
# Try some Backs
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun
|
||||
./test.rem(105): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(105): Trig = Thursday, 28 February, 1991
|
||||
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun
|
||||
./test.rem(106): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(106): Trig = Thursday, 28 February, 1991
|
||||
|
||||
OMIT 28 Feb
|
||||
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun (28 Feb omitted)
|
||||
./test.rem(109): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(109): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun (28 Feb omitted)
|
||||
./test.rem(110): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(110): Trig = Thursday, 28 February, 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
|
||||
# Try out UNTIL
|
||||
REM Wed UNTIL 21 Feb 1991 MSG Wed UNTIL 21 Feb 1991
|
||||
./test.rem(115): Trig = Wednesday, 20 February, 1991
|
||||
../tests/test.rem(115): Trig = Wednesday, 20 February, 1991
|
||||
|
||||
# Try playing with the OMIT context
|
||||
|
||||
OMIT 28 Feb 1991
|
||||
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
|
||||
./test.rem(120): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(120): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
|
||||
./test.rem(121): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(121): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
|
||||
./test.rem(122): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(122): Trig = Wednesday, 27 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
|
||||
./test.rem(123): Trig = Friday, 28 February, 1992
|
||||
../tests/test.rem(123): Trig = Friday, 28 February, 1992
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
|
||||
./test.rem(124): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(124): Trig = Friday, 1 March, 1991
|
||||
|
||||
PUSH-OMIT-CONTEXT
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 1 Mar -1 MSG 1 mar -1
|
||||
./test.rem(128): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(128): Trig = Thursday, 28 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1
|
||||
./test.rem(129): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(129): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE
|
||||
./test.rem(130): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(130): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP
|
||||
./test.rem(131): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(131): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER
|
||||
./test.rem(132): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(132): Trig = Thursday, 28 February, 1991
|
||||
|
||||
POP-OMIT-CONTEXT
|
||||
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
|
||||
./test.rem(135): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(135): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
|
||||
./test.rem(136): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(136): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
|
||||
./test.rem(137): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(137): Trig = Wednesday, 27 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
|
||||
./test.rem(138): Trig = Friday, 28 February, 1992
|
||||
../tests/test.rem(138): Trig = Friday, 28 February, 1992
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
|
||||
./test.rem(139): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(139): Trig = Friday, 1 March, 1991
|
||||
|
||||
|
||||
REM 13 March 1991 *1 UNTIL 19 March 1991 MSG 13-19 Mar 91
|
||||
./test.rem(142): Trig = Wednesday, 13 March, 1991
|
||||
../tests/test.rem(142): Trig = Wednesday, 13 March, 1991
|
||||
|
||||
# Test BACK
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1
|
||||
./test.rem(146): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(146): Trig = Monday, 18 February, 1991
|
||||
|
||||
OMIT 17 Feb 1991
|
||||
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 (17Feb91 omitted)
|
||||
./test.rem(149): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(149): Trig = Monday, 18 February, 1991
|
||||
18 Feb 1991 +1 (17Feb91 omitted)
|
||||
|
||||
REM 18 Feb 1991 ++1 MSG 18 Feb 1991 ++1 (17Feb91 omitted)
|
||||
./test.rem(150): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(150): Trig = Monday, 18 February, 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
# Test the scanfrom clause
|
||||
REM Fri SATISFY 1
|
||||
./test.rem(154): Trig = Friday, 22 February, 1991
|
||||
../tests/test.rem(154): Trig = Friday, 22 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991/02/22
|
||||
trigger(1991/02/22) => "22 February 1991"
|
||||
REM Fri after MSG 23 Feb 1991
|
||||
./test.rem(156): Trig = Saturday, 23 February, 1991
|
||||
../tests/test.rem(156): Trig = Saturday, 23 February, 1991
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
|
||||
today() => 1991/02/16
|
||||
1991/02/16 - 7 => 1991/02/09
|
||||
trigger(1991/02/09) => "9 February 1991"
|
||||
./test.rem(158): Trig = Friday, 15 February, 1991
|
||||
../tests/test.rem(158): Trig = Friday, 15 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991/02/15
|
||||
trigger(1991/02/15) => "15 February 1991"
|
||||
REM Fri after MSG 16 Feb 1991
|
||||
./test.rem(160): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(160): Trig = Saturday, 16 February, 1991
|
||||
16 Feb 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
@@ -503,7 +503,7 @@ set a008 coerce("string", 11:44)
|
||||
coerce("string", 11:44) => "11:44"
|
||||
set a009 coerce("int", "badnews")
|
||||
coerce("int", "badnews") => Can't coerce
|
||||
./test.rem(171): Can't coerce
|
||||
../tests/test.rem(171): Can't coerce
|
||||
set a010 coerce("int", "12")
|
||||
coerce("int", "12") => 12
|
||||
set a011 coerce("int", 11:44)
|
||||
@@ -515,7 +515,7 @@ set a013 date(1992, 2, 2)
|
||||
date(1992, 2, 2) => 1992/02/02
|
||||
set a014 date(1993, 2, 29)
|
||||
date(1993, 2, 29) => Bad date specification
|
||||
./test.rem(176): Bad date specification
|
||||
../tests/test.rem(176): Bad date specification
|
||||
set a015 day(today())
|
||||
today() => 1991/02/16
|
||||
day(1991/02/16) => 16
|
||||
@@ -528,7 +528,7 @@ defined("a017") => 1
|
||||
set a019 defined("a019")
|
||||
defined("a019") => 0
|
||||
set a020 filename()
|
||||
filename() => "./test.rem"
|
||||
filename() => "../tests/test.rem"
|
||||
set a021 getenv("TEST_GETENV")
|
||||
getenv("TEST_GETENV") => "foo bar baz"
|
||||
set a022 hour(11:22)
|
||||
@@ -610,15 +610,15 @@ strlen("sadjflkhsldkfhsdlfjhk") => 21
|
||||
set a050 substr(a049, 2)
|
||||
a049 => 21
|
||||
substr(21, 2) => Type mismatch
|
||||
./test.rem(214): Type mismatch
|
||||
../tests/test.rem(214): Type mismatch
|
||||
set a051 substr(a050, 2, 6)
|
||||
a050 => ./test.rem(215): Undefined variable: a050
|
||||
a050 => ../tests/test.rem(215): Undefined variable: a050
|
||||
set a052 time(1+2, 3+4)
|
||||
1 + 2 => 3
|
||||
3 + 4 => 7
|
||||
time(3, 7) => 03:07
|
||||
rem 10 jan 1992 AT 11:22 CAL
|
||||
./test.rem(217): Trig = Friday, 10 January, 1992
|
||||
../tests/test.rem(217): Trig = Friday, 10 January, 1992
|
||||
set a053 trigdate()
|
||||
trigdate() => 1992/01/10
|
||||
set a054 trigtime()
|
||||
@@ -631,7 +631,7 @@ set a057 value("a05"+"6")
|
||||
"a05" + "6" => "a056"
|
||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a058 version()
|
||||
version() => "03.00.15"
|
||||
version() => "03.00.19"
|
||||
set a059 wkday(today())
|
||||
today() => 1991/02/16
|
||||
wkday(1991/02/16) => "Saturday"
|
||||
@@ -710,31 +710,31 @@ y => 11:33
|
||||
x => "foo"
|
||||
y => 11:33
|
||||
"foo" * 11:33 => Type mismatch
|
||||
./test.rem(240): `*': Type mismatch
|
||||
../tests/test.rem(240): `*': Type mismatch
|
||||
Leaving UserFN h() => Type mismatch
|
||||
set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5')
|
||||
dosubst("%a %b %c %d %e %f %g %h", 1992/05/05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
msg [a074]%
|
||||
./test.rem(242): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(242): Trig = Saturday, 16 February, 1991
|
||||
a074 => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05/05/1992 on 05/05/1992 on Tuesday, 5 May on 05/05
|
||||
set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5')
|
||||
dosubst("%i %j %k %l %m %n %o %p", 1992/05/05) => "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
msg [a075]%
|
||||
./test.rem(244): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(244): Trig = Saturday, 16 February, 1991
|
||||
a075 => "on 05/05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
on 05/05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992/05/05 May 5 s
|
||||
set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5')
|
||||
dosubst("%q %r %s %t %u %v %w %x", 1992/05/05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
msg [a076]%
|
||||
./test.rem(246): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(246): Trig = Saturday, 16 February, 1991
|
||||
a076 => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
s' 05 th 05 on Tuesday, 5th May, 1992 on Tuesday, 5th May Tuesday 444
|
||||
set a077 dosubst("%y %z", '1992/5/5')
|
||||
dosubst("%y %z", 1992/05/05) => "1992 92
|
||||
"
|
||||
msg [a077]%
|
||||
./test.rem(248): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(248): Trig = Saturday, 16 February, 1991
|
||||
a077 => "1992 92
|
||||
"
|
||||
1992 92
|
||||
@@ -772,7 +772,7 @@ dump
|
||||
a048 "foo"
|
||||
a067 "INT"
|
||||
a039 "February"
|
||||
a058 "03.00.15"
|
||||
a058 "03.00.19"
|
||||
a077 "1992 92
|
||||
"
|
||||
a049 21
|
||||
@@ -784,7 +784,7 @@ dump
|
||||
a000 1
|
||||
a010 12
|
||||
a001 1
|
||||
a020 "./test.rem"
|
||||
a020 "../tests/test.rem"
|
||||
a011 704
|
||||
a030 1
|
||||
a002 102
|
||||
@@ -1,6 +1,6 @@
|
||||
# Test file for REMIND
|
||||
#
|
||||
# $Id: test1.cmp,v 1.4 1996-09-28 18:17:09 dfs Exp $
|
||||
# $Id: test1.cmp,v 1.2 1998-03-01 20:44:20 dfs Exp $
|
||||
#
|
||||
# Use this file to test the date calculation routines
|
||||
# of the REMIND program by typing:
|
||||
@@ -633,7 +633,7 @@ set a057 value("a05"+"6")
|
||||
"a05" + "6" => "a056"
|
||||
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
|
||||
set a058 version()
|
||||
version() => "03.00.15"
|
||||
version() => "03.00.19"
|
||||
set a059 wkday(today())
|
||||
today() => 1991/02/16
|
||||
wkday(1991/02/16) => "Saturday"
|
||||
@@ -774,7 +774,7 @@ dump
|
||||
a048 "foo"
|
||||
a067 "INT"
|
||||
a039 "February"
|
||||
a058 "03.00.15"
|
||||
a058 "03.00.19"
|
||||
a077 "1992 92
|
||||
"
|
||||
a049 21
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user