mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 14:59:20 +02:00
Compare commits
303 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0aef0703c | ||
|
|
7356a511e0 | ||
|
|
5be26a3cff | ||
|
|
36a80acb0c | ||
|
|
37ab03b49d | ||
|
|
75209cb40e | ||
|
|
4b2d274748 | ||
|
|
1423495b88 | ||
|
|
42e4ec8890 | ||
|
|
58fbd51ef4 | ||
|
|
7552dbb812 | ||
|
|
31e0ecb71d | ||
|
|
f6743a4f87 | ||
|
|
5f574949e6 | ||
|
|
724bce4fb9 | ||
|
|
8d59f025af | ||
|
|
aad44f4716 | ||
|
|
0a38d7d213 | ||
|
|
4fcd60fd95 | ||
|
|
38beeb8cb0 | ||
|
|
26f0acab35 | ||
|
|
3897973bc1 | ||
|
|
7b3da27461 | ||
|
|
a85ee5f31c | ||
|
|
b272863aa0 | ||
|
|
8249964380 | ||
|
|
af81bbb299 | ||
|
|
d818dd9c80 | ||
|
|
fe8e34dece | ||
|
|
ba928989f7 | ||
|
|
742f973028 | ||
|
|
043932fcbe | ||
|
|
ad5e096caa | ||
|
|
06c8fc8f78 | ||
|
|
487338d10c | ||
|
|
3d1c0e5667 | ||
|
|
ce3bb191c4 | ||
|
|
03e9dbf364 | ||
|
|
518aab3d02 | ||
|
|
f055664f77 | ||
|
|
ba3e01f2ce | ||
|
|
b6883c8a45 | ||
|
|
9e49ee3acb | ||
|
|
7481f68bb2 | ||
|
|
99792eec03 | ||
|
|
91458c7845 | ||
|
|
cad5849dc0 | ||
|
|
a38e120e99 | ||
|
|
0b31a78cf2 | ||
|
|
861858c1a6 | ||
|
|
d43a2277da | ||
|
|
f678dc96b8 | ||
|
|
c2e371904e | ||
|
|
2a1cbff22e | ||
|
|
a2d9f277c4 | ||
|
|
d939059417 | ||
|
|
740cd4cfed | ||
|
|
91a5306a67 | ||
|
|
b78ffcbffd | ||
|
|
4f72f557b7 | ||
|
|
e3b21d6d0d | ||
|
|
af28c49d8d | ||
|
|
67f4635573 | ||
|
|
5f8d10908d | ||
|
|
7307421812 | ||
|
|
5cd3b628c5 | ||
|
|
29e483ab64 | ||
|
|
66ddba45af | ||
|
|
9325b3f035 | ||
|
|
522c4c94e1 | ||
|
|
730505cff3 | ||
|
|
019783e1fa | ||
|
|
8612bb6480 | ||
|
|
7f1e6d21d9 | ||
|
|
e6c0371be1 | ||
|
|
58feaa7e0c | ||
|
|
a828378466 | ||
|
|
53316e8b06 | ||
|
|
6127e390a1 | ||
|
|
4caa77f6b1 | ||
|
|
70419e8757 | ||
|
|
21d8bd1406 | ||
|
|
25abee3259 | ||
|
|
2d490c2b7a | ||
|
|
902b7895b7 | ||
|
|
1c80bb649f | ||
|
|
4508215617 | ||
|
|
739b68347a | ||
|
|
d834760cda | ||
|
|
1bc78650bf | ||
|
|
ec4e203099 | ||
|
|
d23528da82 | ||
|
|
7401a0ba23 | ||
|
|
b14b4f08b1 | ||
|
|
70ece81340 | ||
|
|
19ac350527 | ||
|
|
a9b08d7db8 | ||
|
|
df8fa05632 | ||
|
|
6556137aad | ||
|
|
aa1ab2bbb4 | ||
|
|
be38d86521 | ||
|
|
3931afb6b1 | ||
|
|
7d2df86b75 | ||
|
|
5a3bd5839b | ||
|
|
b91ce9a3f7 | ||
|
|
ac889dd329 | ||
|
|
420df9b6ed | ||
|
|
f862b6811d | ||
|
|
c072698927 | ||
|
|
d22895831b | ||
|
|
3c41f4ade4 | ||
|
|
335d5fb984 | ||
|
|
66bd2b8fac | ||
|
|
fed3cad3b8 | ||
|
|
b20578f24f | ||
|
|
7a86e7f777 | ||
|
|
16c93fcad6 | ||
|
|
edd66d8d89 | ||
|
|
3ba39b6efe | ||
|
|
c656a1a169 | ||
|
|
19f03e419a | ||
|
|
5a281d5999 | ||
|
|
d80d14f585 | ||
|
|
520b8511bd | ||
|
|
91627d4f22 | ||
|
|
a21147c7a5 | ||
|
|
d22c1dee49 | ||
|
|
95b0fc7480 | ||
|
|
b40d5d7984 | ||
|
|
2df93c9df3 | ||
|
|
51cdea4b17 | ||
|
|
f229e64744 | ||
|
|
0f15955a41 | ||
|
|
390e6c2eed | ||
|
|
877eaccd6d | ||
|
|
6424e655a1 | ||
|
|
176037082b | ||
|
|
a361c7e426 | ||
|
|
caba0c1695 | ||
|
|
71b3f9fefc | ||
|
|
91f8507e51 | ||
|
|
b68e81a126 | ||
|
|
72658025f1 | ||
|
|
93aea240d6 | ||
|
|
7717b37c36 | ||
|
|
e1b2990fb0 | ||
|
|
e49194c6ee | ||
|
|
79ab150546 | ||
|
|
fc658d15d4 | ||
|
|
76d130ef82 | ||
|
|
3e9a55fbdb | ||
|
|
b071397d46 | ||
|
|
df0dd55635 | ||
|
|
960d08fd24 | ||
|
|
38603916a2 | ||
|
|
0ed1bb4017 | ||
|
|
b4ac0c9f6c | ||
|
|
b136af88ad | ||
|
|
508b5f9aae | ||
|
|
43dff67a60 | ||
|
|
41b850321f | ||
|
|
523237007b | ||
|
|
a3f6c5fd9c | ||
|
|
785cdc8726 | ||
|
|
cbf12b5601 | ||
|
|
1a6d59d9c0 | ||
|
|
23ae054abb | ||
|
|
b57852d3d8 | ||
|
|
c0e1be2f3a | ||
|
|
a442a15a8d | ||
|
|
f91bf634ad | ||
|
|
ce4311c3df | ||
|
|
08e69cb541 | ||
|
|
f8e2eaed73 | ||
|
|
e68a16e73d | ||
|
|
ca191fbd92 | ||
|
|
10276826c0 | ||
|
|
02c9129903 | ||
|
|
04e4c902bd | ||
|
|
0663ae77de | ||
|
|
0c0f5ea093 | ||
|
|
f450fd633e | ||
|
|
59cdd35f61 | ||
|
|
eab67cbda4 | ||
|
|
b3c4a48641 | ||
|
|
07ac8ed341 | ||
|
|
e32aa218fc | ||
|
|
09d11d36c3 | ||
|
|
629e287526 | ||
|
|
e2cd29c824 | ||
|
|
69e597dbe7 | ||
|
|
152e7ebac9 | ||
|
|
8d4451ed85 | ||
|
|
5b8836d4b8 | ||
|
|
be7086579e | ||
|
|
ab16c8f1fe | ||
|
|
6bb71ee5e3 | ||
|
|
ebb4ebea97 | ||
|
|
bf97e62d56 | ||
|
|
47645cddb6 | ||
|
|
cf2af56a05 | ||
|
|
50d1ae42c9 | ||
|
|
9501498a7e | ||
|
|
614ab08099 | ||
|
|
64ee338433 | ||
|
|
43556238d0 | ||
|
|
58d7ac0520 | ||
|
|
0754678ce7 | ||
|
|
2bea176816 | ||
|
|
fa90333219 | ||
|
|
e007b3bc0f | ||
|
|
978e83567b | ||
|
|
d01c1190cd | ||
|
|
0b1855df9b | ||
|
|
951f2785cc | ||
|
|
30090d3f8d | ||
|
|
b6ad67891c | ||
|
|
b61c9db6e6 | ||
|
|
29368ec2ee | ||
|
|
88ff86c910 | ||
|
|
0cc5ae521c | ||
|
|
da1b5ed9a0 | ||
|
|
f786d05c04 | ||
|
|
0bcbe9047e | ||
|
|
585346f753 | ||
|
|
324aa01f80 | ||
|
|
8d0adfa6b7 | ||
|
|
bffae3724c | ||
|
|
a60dc3d1c8 | ||
|
|
df9977d4da | ||
|
|
c31678d28e | ||
|
|
40c1a5a3ee | ||
|
|
846dbd9338 | ||
|
|
2bfed13ebc | ||
|
|
2a5c625a7f | ||
|
|
7660e4a5f1 | ||
|
|
779672a5b5 | ||
|
|
46e9ac86bc | ||
|
|
8d6ca79934 | ||
|
|
2212d1eebe | ||
|
|
c78c284f19 | ||
|
|
b6b30637c6 | ||
|
|
b17198697c | ||
|
|
3ec57a608d | ||
|
|
49cd14846c | ||
|
|
1fd794a5bc | ||
|
|
5848991c27 | ||
|
|
d71f92d034 | ||
|
|
f9719ae7f5 | ||
|
|
4e0be6645a | ||
|
|
da25a18610 | ||
|
|
7bc3aa52d4 | ||
|
|
ca5bb13096 | ||
|
|
da124475fa | ||
|
|
ff04b2e481 | ||
|
|
09d66135b2 | ||
|
|
65cb72f7e8 | ||
|
|
8ae1f93899 | ||
|
|
0017f81da5 | ||
|
|
8c782c5b4e | ||
|
|
ffd283d779 | ||
|
|
b9227e11df | ||
|
|
5a289add73 | ||
|
|
614254a40d | ||
|
|
e31981c4c8 | ||
|
|
eb67e7757b | ||
|
|
ececf4a76e | ||
|
|
0a437420d8 | ||
|
|
b6ddc22c80 | ||
|
|
83d88affb7 | ||
|
|
5ae835db6c | ||
|
|
47e16f5525 | ||
|
|
a6a3dffbd6 | ||
|
|
9d1fcb19bf | ||
|
|
7176277ddb | ||
|
|
d9acf28ea5 | ||
|
|
00bbb8b159 | ||
|
|
dbe22e99ee | ||
|
|
361aa04c6d | ||
|
|
7e82b93a84 | ||
|
|
36731d2606 | ||
|
|
2e3ca89e0b | ||
|
|
394c4d0791 | ||
|
|
2bc3d991c1 | ||
|
|
a479ea971d | ||
|
|
075a491847 | ||
|
|
fefaea005b | ||
|
|
c564fa6165 | ||
|
|
0f4d6b5f8b | ||
|
|
55059d60e7 | ||
|
|
d45b590e59 | ||
|
|
76938d27f9 | ||
|
|
e89b5a2d91 | ||
|
|
a9ffc57ce6 | ||
|
|
97fdee4616 | ||
|
|
f9884f3e9d | ||
|
|
87b9dbf36b | ||
|
|
415c49fdb9 | ||
|
|
89cbe86ad9 | ||
|
|
db605a774c | ||
|
|
0e00cf4ee9 | ||
|
|
5bfac19a2e | ||
|
|
ea34bd0950 |
15
.gitignore
vendored
Normal file
15
.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
*.bak
|
||||||
|
autom4te.cache
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
src/Makefile
|
||||||
|
www/Makefile
|
||||||
|
*.o
|
||||||
|
src/config.h
|
||||||
|
src/remind
|
||||||
|
src/*.tar.gz*
|
||||||
|
tests/test.out
|
||||||
|
.gitignore
|
||||||
|
*~
|
||||||
|
src/rem2ps
|
||||||
|
src/version.h
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
$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
|
|
||||||
|
|
||||||
10
COPYRIGHT
10
COPYRIGHT
@@ -1,10 +1,9 @@
|
|||||||
$Id: COPYRIGHT,v 1.11 1999-04-05 17:34:27 dfs Exp $
|
|
||||||
THE REMIND COPYRIGHT
|
THE REMIND COPYRIGHT
|
||||||
|
|
||||||
1. REMIND refers to the entire set of files and documentation in the
|
1. REMIND refers to the entire set of files and documentation in the
|
||||||
REMIND package.
|
REMIND package.
|
||||||
|
|
||||||
2. REMIND is Copyright 1999 by Roaring Penguin Software Inc.,
|
2. REMIND is Copyright 1999-2008 Roaring Penguin Software Inc.,
|
||||||
except where noted in individual files.
|
except where noted in individual files.
|
||||||
|
|
||||||
3. DISTRIBUTION AND USE
|
3. DISTRIBUTION AND USE
|
||||||
@@ -294,11 +293,8 @@ POSSIBILITY OF SUCH DAMAGES.
|
|||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
--
|
--
|
||||||
David F. Skoll <dskoll@iname.com>
|
David F. Skoll <dfs@roaringpenguin.com>
|
||||||
986 Eiffel Avenue
|
|
||||||
Ottawa, Ontario K2C 0J2
|
|
||||||
CANADA
|
|
||||||
|
|
||||||
Tel. (613) 225-8687
|
Tel. (613) 231-6599
|
||||||
http://www.roaringpenguin.com
|
http://www.roaringpenguin.com
|
||||||
|
|
||||||
|
|||||||
10
Makefile
10
Makefile
@@ -1,7 +1,5 @@
|
|||||||
# Top-level Makefile for Remind.
|
# Top-level Makefile for Remind.
|
||||||
|
|
||||||
# $Id: Makefile,v 1.28 1998-05-06 01:51:12 dfs Exp $
|
|
||||||
|
|
||||||
all: src/Makefile
|
all: src/Makefile
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "*******************"
|
@echo "*******************"
|
||||||
@@ -26,8 +24,14 @@ clean:
|
|||||||
find . -name '*~' -exec rm {} \;
|
find . -name '*~' -exec rm {} \;
|
||||||
cd src; $(MAKE) clean
|
cd src; $(MAKE) clean
|
||||||
|
|
||||||
|
test:
|
||||||
|
cd src && $(MAKE) test
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f config.cache config.log config.status src/Makefile src/config.h
|
rm -f config.cache config.log config.status src/Makefile src/config.h tests/test.out www/Makefile
|
||||||
|
|
||||||
src/Makefile: src/Makefile.in
|
src/Makefile: src/Makefile.in
|
||||||
./configure
|
./configure
|
||||||
|
|
||||||
|
# DO NOT DELETE
|
||||||
|
|
||||||
|
|||||||
10
README
10
README
@@ -27,8 +27,12 @@ If you do NOT have Tcl/Tk or are NOT running X Windows:
|
|||||||
|
|
||||||
2) Edit the file "src/lang.h" to choose a language.
|
2) Edit the file "src/lang.h" to choose a language.
|
||||||
|
|
||||||
3) Type: "make"
|
3) Type: "./configure" (You can supply options; type "./configure --help"
|
||||||
|
for details.)
|
||||||
|
|
||||||
4) Type: "make install" -- you may need to be root to do this.
|
4) Type: "make"
|
||||||
|
|
||||||
$Id: README,v 1.4 1998-01-19 03:24:03 dfs Exp $
|
5) Type: "make install" -- you may need to be root to do this.
|
||||||
|
|
||||||
|
Contact info: mailto:dfs@roaringpenguin.com
|
||||||
|
Home page: http://www.roaringpenguin.com/remind
|
||||||
|
|||||||
2
WINDOWS
2
WINDOWS
@@ -1,5 +1,3 @@
|
|||||||
$Id: WINDOWS,v 1.1 1999-04-05 17:34:28 dfs Exp $
|
|
||||||
|
|
||||||
MICROSOFT WINDOWS
|
MICROSOFT WINDOWS
|
||||||
|
|
||||||
I used to prohibit porting Remind to Microsoft Windows. However, this
|
I used to prohibit porting Remind to Microsoft Windows. However, this
|
||||||
|
|||||||
26
configure.in
26
configure.in
@@ -1,7 +1,6 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
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)
|
AC_INIT(src/queue.c)
|
||||||
|
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
|
|
||||||
@@ -26,21 +25,26 @@ dnl Replace `main' with a function in -lm:
|
|||||||
|
|
||||||
AC_CHECK_LIB(m, sqrt)
|
AC_CHECK_LIB(m, sqrt)
|
||||||
|
|
||||||
|
dnl Integer sizes
|
||||||
|
AC_CHECK_SIZEOF(unsigned short)
|
||||||
|
AC_CHECK_SIZEOF(unsigned int)
|
||||||
|
AC_CHECK_SIZEOF(unsigned long)
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_CHECK_HEADERS(sys/file.h glob.h)
|
||||||
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.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_TYPE_SIGNAL
|
|
||||||
AC_TYPE_PID_T
|
|
||||||
AC_TYPE_UID_T
|
|
||||||
AC_FUNC_UTIME_NULL
|
AC_FUNC_UTIME_NULL
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
AC_FUNC_VPRINTF
|
|
||||||
AC_CHECK_FUNCS(mktime putenv strstr timegm difftime)
|
|
||||||
|
|
||||||
AC_OUTPUT(src/Makefile)
|
if test "$GCC" = yes; then
|
||||||
|
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(setenv unsetenv glob)
|
||||||
|
VERSION=03.01.05
|
||||||
|
AC_SUBST(VERSION)
|
||||||
|
AC_OUTPUT(src/Makefile www/Makefile src/version.h)
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
$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
|
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
$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
|
|
||||||
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
$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
|
|
||||||
|
|
||||||
109
docs/README.OS2
109
docs/README.OS2
@@ -1,109 +0,0 @@
|
|||||||
$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
|
|
||||||
Eberhard Mattes' emx/gcc compiler and with the Microsoft C compiler.
|
|
||||||
There are a number of targets in Makefile.os2, including OS/2-only
|
|
||||||
versions and bound versions (programs which run under OS/2 and DOS).
|
|
||||||
|
|
||||||
Note that there is also support for OS/2 using the Borland C
|
|
||||||
compiler--see the file README.BCC for details.
|
|
||||||
|
|
||||||
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 - To compile Remind for OS/2, you must use the Microsoft C compiler
|
|
||||||
or emx/gcc. You must also have a decent version of 'make', such
|
|
||||||
as dmake or GNU make.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
5 - Type:
|
|
||||||
|
|
||||||
make -f Makefile.os2
|
|
||||||
|
|
||||||
to see a list of targets. For example,
|
|
||||||
|
|
||||||
make -f Makefile.os2 emx
|
|
||||||
|
|
||||||
will build a 32-bit emx version which runs under OS/2 2.x and DOS.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
|
|
||||||
|
|
||||||
1. POPUP REMINDERS
|
|
||||||
|
|
||||||
If you define the symbol OS2_POPUP in the OS/2 Makefile, you get
|
|
||||||
"full-screen popups" (as implemented by Russ Herman) for all MSG-
|
|
||||||
and MSF-type reminders. You may or may not like this feature.
|
|
||||||
|
|
||||||
One way of implementing popup reminders is to get the program
|
|
||||||
"pmpopup.exe" from ftp-os2.cdrom.com, and using Remind with the
|
|
||||||
'-k' option as follows from C:\STARTUP.CMD:
|
|
||||||
|
|
||||||
start /pm /inv /n remind "-kstart pmpopup %%s" remfile
|
|
||||||
|
|
||||||
Alternatively, if you have the Vrexx package, you can use this
|
|
||||||
procedure suggested by Norman Walsh:
|
|
||||||
|
|
||||||
Start remind like this in C:\STARTUP.CMD:
|
|
||||||
|
|
||||||
start /pm /inv /n \bin\remind -faz "-kstart popupmsg %%s" .reminders
|
|
||||||
|
|
||||||
The popups are done by POPUPMSG.CMD which looks like this:
|
|
||||||
|
|
||||||
-------------- Cut Here ---------- Cut Here ---------- Cut Here --------
|
|
||||||
/* PopUpMsg */
|
|
||||||
|
|
||||||
'@echo off'
|
|
||||||
|
|
||||||
parse arg theargs
|
|
||||||
if theargs = "" then
|
|
||||||
theargs = "Empty message"
|
|
||||||
|
|
||||||
call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
|
|
||||||
initcode = VInit()
|
|
||||||
if initcode = 'ERROR' then signal CLEANUP
|
|
||||||
|
|
||||||
signal on failure name CLEANUP
|
|
||||||
signal on halt name CLEANUP
|
|
||||||
signal on syntax name CLEANUP
|
|
||||||
|
|
||||||
/* example VMsgBox call */
|
|
||||||
|
|
||||||
msg.0 = 1
|
|
||||||
msg.1 = theargs
|
|
||||||
|
|
||||||
call VDialogPos 50, 50
|
|
||||||
call VMsgBox 'Popup Message', msg, 1
|
|
||||||
|
|
||||||
/* end of CMD file */
|
|
||||||
|
|
||||||
CLEANUP:
|
|
||||||
call VExit
|
|
||||||
|
|
||||||
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
|
|
||||||
Ottawa, Ontario K2C 0J2
|
|
||||||
CANADA
|
|
||||||
|
|
||||||
Tel. (613) 225-8687
|
|
||||||
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
$Id: README.UNIX,v 1.4 1998-01-19 03:24:09 dfs Exp $
|
REMIND version 3.1 for UNIX
|
||||||
REMIND version 3.0 for UNIX
|
|
||||||
|
|
||||||
REMIND is a sophisticated alarm/calendar program. Details are given
|
REMIND is a sophisticated alarm/calendar program. Details are given
|
||||||
in the man page, "remind.1".
|
in the man page, "remind.1".
|
||||||
@@ -29,30 +28,6 @@ If you do NOT have Tcl/Tk or are NOT running X Windows:
|
|||||||
The subdirectory "www" contains scripts for making a nice calendar
|
The subdirectory "www" contains scripts for making a nice calendar
|
||||||
web server. See the files README and Makefile in that directory.
|
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
|
The file "examples/defs.rem" has some sample Remind definitions and
|
||||||
commands, as well as U.S. and Jewish holidays.
|
commands, as well as U.S. and Jewish holidays.
|
||||||
|
|
||||||
@@ -125,9 +100,5 @@ exit
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
David F. Skoll <dfs@doe.carleton.ca>
|
David F. Skoll <dfs@roaringpenguin.com>
|
||||||
986 Eiffel Avenue
|
http://www.roaringpenguin.com/remind/
|
||||||
Ottawa, Ontario K2C 0J2
|
|
||||||
CANADA
|
|
||||||
|
|
||||||
Tel. (613) 225-8687
|
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
$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,6 +1,324 @@
|
|||||||
CHANGES TO REMIND
|
CHANGES TO REMIND
|
||||||
|
|
||||||
* Version 3.0 Patch 20
|
* Version 3.1 Patch 5 - 2008-04-15
|
||||||
|
|
||||||
|
- MAJOR ENHANCEMENT: If you supply a directory name on the command line
|
||||||
|
or for an INCLUDE command, then Remind reads all *.rem file in that
|
||||||
|
directory (in the order returned by "glob")
|
||||||
|
|
||||||
|
- ENHANCEMENT: The plain-text calendar ("-c") can draw lines using VT-100
|
||||||
|
line-drawing characters if invoked as "-cl"
|
||||||
|
|
||||||
|
- ENHANCEMENT: The plain-text calendar can approximate SPECIAL COLOR reminders
|
||||||
|
using VT-100 color escape sequences if invoked as "-cc". (You can combine
|
||||||
|
the colors and line-drawing characters with -clc or -ccl.)
|
||||||
|
|
||||||
|
- ENHANCEMENT: The "-t" option can take a numeric argument n. In this case,
|
||||||
|
all reminders are assumed to have a delta of +n. (Without the argument,
|
||||||
|
an infinite delta is assumed, as before.) If a numeric argument is given,
|
||||||
|
the new system variable $DeltaOffset is set to the argument.
|
||||||
|
|
||||||
|
- MINOR ENHANCEMENT: The "-i" command-line option can be used to define
|
||||||
|
a function as well as set a variable.
|
||||||
|
|
||||||
|
- MINOR ENHANCEMENT: String constants can have embedded quotes "Like \"this"
|
||||||
|
|
||||||
|
- MINOR ENHANCEMENT: tkremind works better on small screens like that of
|
||||||
|
the Eee-PC.
|
||||||
|
|
||||||
|
- BUG FIX: Minor fix to HTML output courtesy of Ian! Allen.
|
||||||
|
|
||||||
|
- BUG FIX: Parse error in calendar mode was fixed.
|
||||||
|
|
||||||
|
* Version 3.1 Patch 4 - 2008-02-03
|
||||||
|
|
||||||
|
- ENHANCMENT: tkremind respects the "-b1" option and operates in 24-hour
|
||||||
|
clock mode if the option is supplied.
|
||||||
|
|
||||||
|
- ENHANCEMENT: tkremind has been tweaked to look better with Tcl/Tk 8.5.
|
||||||
|
|
||||||
|
- CLEANUP: Version is kept only in configure.in instead of two different
|
||||||
|
places.
|
||||||
|
|
||||||
|
- CLEANUP: Added "const" qualifier to many places in the code that previously
|
||||||
|
lacked it.
|
||||||
|
|
||||||
|
- BUG FIX: A rare parsing error involving interaction between SATISFY and
|
||||||
|
SKIP has been fixed.
|
||||||
|
|
||||||
|
- BUG FIX: rem2html would output a horribly-wrong calendar for a 28-day
|
||||||
|
February starting on Sunday (such as February 2009.) This has been fixed.
|
||||||
|
|
||||||
|
- BUG FIX: The "-ivar=value" command-line option failed if Remind re-execed
|
||||||
|
itself because we overwrote argv[]. This has been fixed.
|
||||||
|
|
||||||
|
* Version 3.1 Patch 3 - 2007-10-15
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- rem2html now uses CSS for a much better-looking calendar.
|
||||||
|
NOTE: rem2html was completely rewritten and some of the command-line
|
||||||
|
options have changed!
|
||||||
|
|
||||||
|
- If a reminder has a DURATION clause, then the starting and ending times
|
||||||
|
are output in calendar mode.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- DST rules in "defs.rem" were updated to reflect new US/Canadian DST rules.
|
||||||
|
|
||||||
|
- If a REM command cannot compute a trigger date, the SATISFY expression
|
||||||
|
is not evaluated. This helps avoid spurious error messages in some
|
||||||
|
reminders.
|
||||||
|
|
||||||
|
* Version 3.1 Patch 2 - 2007-09-12
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- build.tk tries to set defaults for location, paper size, etc from an
|
||||||
|
existing "remind" installation if it detects one.
|
||||||
|
|
||||||
|
- In queue mode, wake up once a minute and recalibrate sleep time.
|
||||||
|
This should make Remind work better on laptops that suspend or
|
||||||
|
hibernate. Note that "remind -q" does *not* handle date-rollover
|
||||||
|
well; it simply exits if it notices date rollover. "remind -z0"
|
||||||
|
(as used by tkremind) handles date rollover properly; it rereads the
|
||||||
|
reminder file and rebuilds the queue if it notices date rollover.
|
||||||
|
|
||||||
|
- tkremind: Added some key bindings to make navigation easier.
|
||||||
|
|
||||||
|
- tkremind: Made calendar boxes use space more efficiently.
|
||||||
|
|
||||||
|
- remind: The functionality of "rem" is now built into remind. If you
|
||||||
|
invoke remind as "rem", then it uses a default filename. The installer
|
||||||
|
sets up "rem" as a symbolic link to "remind".
|
||||||
|
|
||||||
|
+ CHANGE
|
||||||
|
|
||||||
|
- "remind -p" no longer sorts SPECIAL reminders before non-SPECIAL.
|
||||||
|
|
||||||
|
*** THIS MAY AFFECT BACKENDS ***
|
||||||
|
|
||||||
|
Backends supplied by Roaring Penguin (rem2ps, rem2html and tkremind)
|
||||||
|
are known to work properly.
|
||||||
|
|
||||||
|
- "remind -p" no longer suppresses any AT-time associated with SPECIAL
|
||||||
|
reminders.
|
||||||
|
|
||||||
|
*** THIS MAY AFFECT BACKENDS ***
|
||||||
|
|
||||||
|
Backends supplied by Roaring Penguin (rem2ps, rem2html and tkremind)
|
||||||
|
are known to work properly.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- examples/defs.rem: A few corrections to Jewish holidays courtesy of
|
||||||
|
Art Werschulz.
|
||||||
|
|
||||||
|
- src/Makefile.in: Added install-nostripped target.
|
||||||
|
|
||||||
|
- SPECIAL COLOR now works more like MSG, including proper support for AT and
|
||||||
|
for the %" %" escape sequence.
|
||||||
|
|
||||||
|
- SPECIAL COLOR is queued correctly if it has an AT clause.
|
||||||
|
|
||||||
|
- Using the psshade() or psmoon() functions emits a warning on stderr. You
|
||||||
|
should use SPECIAL SHADE or SPECIAL MOON instead.
|
||||||
|
|
||||||
|
* Version 3.1 Patch 1 - 2007-08-23
|
||||||
|
|
||||||
|
+ MAJOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- Added the "nonomitted" function that solves a number of
|
||||||
|
moving-reminder-in-response-to-holiday problems. The real-world
|
||||||
|
problems solved are the "moving-garbage-day" problem and the
|
||||||
|
"six-day-school-cycle" problem.
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- A few minor performance improvements in response to profiling runs.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- Prevent compilation failure with gcc 2.95.
|
||||||
|
|
||||||
|
- Fix trailing "s" bug with -k option. This was fixed in Debian's release,
|
||||||
|
but the Debian maintainer never bothered to let me know.
|
||||||
|
|
||||||
|
- Removed obsolete scripts: kall, rem, remind-all.sh, remind-all.csh
|
||||||
|
|
||||||
|
- Made "-n" output always use "/" as date separator for consistency with
|
||||||
|
"-p" and "-s".
|
||||||
|
|
||||||
|
- Moon PNG images are transparent. Output of moon phases in rem2html
|
||||||
|
improved slightly.
|
||||||
|
|
||||||
|
- Various man-page fixes.
|
||||||
|
|
||||||
|
* Version 3.1 Patch 0 - 2007-07-14
|
||||||
|
|
||||||
|
+ MAJOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- Added the FROM clause. This lets you write reminders like:
|
||||||
|
|
||||||
|
REM Mon FROM 16 July 2007 UNTIL 13 Aug 2007 MSG Some Mondays...
|
||||||
|
|
||||||
|
- Remind now has a new datatype: A DATETIME object represents a date AND
|
||||||
|
a time (to the nearest minute). DATETIME constants are written
|
||||||
|
as '2007-09-01@14:33'. Various operators and functions have been
|
||||||
|
modified to do sensible things with DATETIMEs and several new DATETIME
|
||||||
|
functions have been added.
|
||||||
|
|
||||||
|
- The SPECIAL COLOR reminder type has been hacked to behave more like
|
||||||
|
a MSG type. It sorts properly and is emitted as a normal reminder
|
||||||
|
in non-calendar mode. Simlarly, SPECIAL HTML sorts with -g as well.
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- TkRemind can e-mail you reminders if you don't dismiss the popup window
|
||||||
|
after one minute. This is useful if you need to leave your workstation
|
||||||
|
but want reminders to "follow" you via e-mail.
|
||||||
|
|
||||||
|
- A new "-y" option to Remind generates tags for all reminders that lack
|
||||||
|
a TAG clause. This may be useful for conversion tools that want each
|
||||||
|
reminder to have a unique identifier.
|
||||||
|
|
||||||
|
- A new "tzconvert" function lets you convert datetimes between different
|
||||||
|
time zones. It's only as good as your C library, so test thoroughly
|
||||||
|
please! Based on a patch from Stefan Wehr.
|
||||||
|
|
||||||
|
- TkRemind sorts reminders by invoking Remind with the '-g' option.
|
||||||
|
|
||||||
|
- The time and date separator characters can be changed at runtime by
|
||||||
|
setting $TimeSep and $DateSep respectively.
|
||||||
|
|
||||||
|
- The simple calendar ('-s') option can be immediately followed by an 'a'.
|
||||||
|
This causes Remind to output reminders with deltas before the actual
|
||||||
|
trigger date. Based loosely on an idea from Frank Terbeck.
|
||||||
|
|
||||||
|
+ MINOR CHANGES
|
||||||
|
|
||||||
|
- Default date separator is now '-' instead of '/'
|
||||||
|
|
||||||
|
- trigdate() and trigtime() behave differently - they return the integer 0
|
||||||
|
if the last reminder could not be computed or did not have an AT clause
|
||||||
|
(respectively).
|
||||||
|
|
||||||
|
- Maximum length of variable names has been increased from 12 to 16 characters.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- Fixed a potential memory leak in queue.c
|
||||||
|
|
||||||
|
- Fixed compile error on Mac OS X.
|
||||||
|
|
||||||
|
- Fixed behaviour of "-sa" option so deltas correctly obey omitted days
|
||||||
|
and the scheduling function (if one is used).
|
||||||
|
|
||||||
|
- rem2ps would produce invalid PostScript in some rare cases
|
||||||
|
(eg, for February 2007). This has been fixed.
|
||||||
|
|
||||||
|
* Version 3.0 Patch 24 - 2005-11-19
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- Permit the DURATION of a reminder to be as high as you like. Previously,
|
||||||
|
DURATIONs could be at most 23:59. Fix courtesy of Paul Pelzl.
|
||||||
|
|
||||||
|
- The "-n" flag can be usefully combined with "-s", "-p" and "-l" now.
|
||||||
|
Fix courtesy of Paul Pelzl.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- The "-k" command escapes all characters except those known to be
|
||||||
|
safe, rather than attempting to escape only characters thought to be
|
||||||
|
unsafe.
|
||||||
|
|
||||||
|
- Removed the crufty code that supported non-ANSI C compilers.
|
||||||
|
|
||||||
|
- Removed all support for non-UNIX/non-Linux systems.
|
||||||
|
|
||||||
|
- Fixed a bug in the tokenizer that could make Remind segfault. Fix courtesy
|
||||||
|
of Stan Tobias.
|
||||||
|
|
||||||
|
* Version 3.0 Patch 23 - 2005-04-14
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- Added the COLOR special for putting colored reminders in the calendar.
|
||||||
|
Supported by the HTML, Tcl/Tk and PostScript back-ends.
|
||||||
|
|
||||||
|
- Many minor tweaks to tkremind.
|
||||||
|
|
||||||
|
- Added ability to specify paper size in inches or centimetres to rem2ps.
|
||||||
|
|
||||||
|
- Added the "-l" option to Remind. This outputs additional information
|
||||||
|
for back-end programs that use the "-p" output format. Currently
|
||||||
|
used only by the "tkremind" back-end.
|
||||||
|
|
||||||
|
- Fixed dates for Yom Hazikaron and Yom Ha'atzmaut if 5 Iyar falls on a
|
||||||
|
Saturday. (Hebrew calendar fix.)
|
||||||
|
|
||||||
|
- Added support for the Icelandic language, courtesy of Björn Davíðsson.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- Fixed parser error for unterminated date constant: '2005/01/01
|
||||||
|
|
||||||
|
* Version 3.0 Patch 22 - 2000-06-16
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- Added option to have TkRemind display all of today's reminders in a text
|
||||||
|
box on startup. This option is on by default.
|
||||||
|
|
||||||
|
- Makefile in "www" directory allows you to add ".cgi" suffix to CGI scripts.
|
||||||
|
|
||||||
|
- Added option to completely delete a reminder from the reminder file in
|
||||||
|
the timed reminder popup dialog.
|
||||||
|
|
||||||
|
- Clarified build instructions.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- Fixed packing order in TkRemind so resizing window doesn't make control
|
||||||
|
buttons disappear.
|
||||||
|
|
||||||
|
- Fixed serious bug in which background queued reminders were ignored and
|
||||||
|
Remind simply exited. Doh! Sorry about that.
|
||||||
|
|
||||||
|
* Version 3.0 Patch 21 - 2000-03-15
|
||||||
|
|
||||||
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
|
- Updated copyright years and contact info.
|
||||||
|
|
||||||
|
- Changed GIF images to PNG to avoid patent problems.
|
||||||
|
|
||||||
|
- Added "cm2trem.tcl" to convert from CDE's "cm" calendar manager to Remind
|
||||||
|
format. It handles only an older version of "cm" data; there is a utility
|
||||||
|
available (under Solaris anyway) to convert newer files to the older "cm"
|
||||||
|
format.
|
||||||
|
|
||||||
|
- Fixed the scripts in the "www" directory to install and work properly.
|
||||||
|
|
||||||
|
- Added "remind.vim" file for Vim syntax highlighting of Remind files,
|
||||||
|
thanks to Davide Alberani.
|
||||||
|
|
||||||
|
- Added "dusk" and "dawn" built-in functions, thanks to Ron Aaron.
|
||||||
|
|
||||||
|
+ BUG FIXES
|
||||||
|
|
||||||
|
- Files for no-longer-supported platforms (OS/2, amiga, MS-DOS) have been
|
||||||
|
moved to OBSOLETE subdirectory. They will disappear unless someone
|
||||||
|
wants to maintain them.
|
||||||
|
|
||||||
|
- Fixed typo which caused compilation failure on compilers without function
|
||||||
|
prototypes. Thanks to Ian Darwin for the patch.
|
||||||
|
|
||||||
|
- Fixed compilation problem on FreeBSD, IRIX, Tru64 and other UNIXes.
|
||||||
|
|
||||||
|
* Version 3.0 Patch 20 - 1999-04-12
|
||||||
|
|
||||||
+ NEWS
|
+ NEWS
|
||||||
|
|
||||||
@@ -29,7 +347,7 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Fixed a typo in danish.h, courtesy of Niels Kristian Bech Jensen.
|
- Fixed a typo in danish.h, courtesy of Niels Kristian Bech Jensen.
|
||||||
|
|
||||||
* Version 3.0 Patch 19
|
* Version 3.0 Patch 19 - 1998-05-09
|
||||||
|
|
||||||
+ MAJOR ENHANCEMENTS
|
+ MAJOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -71,7 +389,7 @@ CHANGES TO REMIND
|
|||||||
- Lots more silly little bugs squashed -- too many to go into in
|
- Lots more silly little bugs squashed -- too many to go into in
|
||||||
detail.
|
detail.
|
||||||
|
|
||||||
* Version 3.0 Patch 18
|
* Version 3.0 Patch 18 - 1998-02-15
|
||||||
|
|
||||||
+ MAJOR ENHANCEMENTS
|
+ MAJOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -135,7 +453,7 @@ CHANGES TO REMIND
|
|||||||
- Getting rid of fixed-sized buffers meant lots of changes to code.
|
- Getting rid of fixed-sized buffers meant lots of changes to code.
|
||||||
No doubt, I missed a few regression tests.
|
No doubt, I missed a few regression tests.
|
||||||
|
|
||||||
* Version 3.0 Patch 17
|
* Version 3.0 Patch 17 - 1997-09-07
|
||||||
|
|
||||||
+ MINOR ENHANCEMENTS
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -176,7 +494,7 @@ CHANGES TO REMIND
|
|||||||
library. All three of these fixes are courtesy of Christopher
|
library. All three of these fixes are courtesy of Christopher
|
||||||
J. Madsen <madsen@iglobal.net>. Thanks, Christopher.
|
J. Madsen <madsen@iglobal.net>. Thanks, Christopher.
|
||||||
|
|
||||||
* Version 3.0 Patch 16
|
* Version 3.0 Patch 16 - 1997-02-11
|
||||||
|
|
||||||
+ MINOR ENHANCEMENTS
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -204,7 +522,7 @@ CHANGES TO REMIND
|
|||||||
- Fixed a problem under Solaris 2.5 whereby rem2ps was skipping some
|
- Fixed a problem under Solaris 2.5 whereby rem2ps was skipping some
|
||||||
latin1 characters which it interpreted as white space.
|
latin1 characters which it interpreted as white space.
|
||||||
|
|
||||||
* Version 3.0 Patch 15
|
* Version 3.0 Patch 15 - 1996-10-27
|
||||||
|
|
||||||
+ IMPORTANT NOTES
|
+ IMPORTANT NOTES
|
||||||
|
|
||||||
@@ -234,7 +552,7 @@ CHANGES TO REMIND
|
|||||||
- Fixed bug in TkRemind which caused a crash if the "-m" option was used
|
- Fixed bug in TkRemind which caused a crash if the "-m" option was used
|
||||||
for a month beginning on Sunday. Doh!!!
|
for a month beginning on Sunday. Doh!!!
|
||||||
|
|
||||||
* Version 3.0 Patch 14
|
* Version 3.0 Patch 14 - 1996-05-25
|
||||||
|
|
||||||
+ CHANGE IN COPYING POLICY
|
+ CHANGE IN COPYING POLICY
|
||||||
|
|
||||||
@@ -293,7 +611,7 @@ CHANGES TO REMIND
|
|||||||
_not_ support MS Windows, and in fact do not allow Remind to run
|
_not_ support MS Windows, and in fact do not allow Remind to run
|
||||||
under Windows (see COPYRIGHT).
|
under Windows (see COPYRIGHT).
|
||||||
|
|
||||||
* Version 3.0 Patch 13
|
* Version 3.0 Patch 13 - 1994-05-06
|
||||||
|
|
||||||
+ MINOR ENHANCEMENTS
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -328,7 +646,7 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Updated the copyright notices everywhere.
|
- Updated the copyright notices everywhere.
|
||||||
|
|
||||||
* Version 3.0 Patch 12
|
* Version 3.0 Patch 12 - 1994-02-01
|
||||||
|
|
||||||
+ MINOR ENHANCEMENTS
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -347,7 +665,7 @@ CHANGES TO REMIND
|
|||||||
- Fixed a problem with the '-k' option which resulted in a newline being
|
- Fixed a problem with the '-k' option which resulted in a newline being
|
||||||
placed after the message text. This was giving sh(1) heartburn...
|
placed after the message text. This was giving sh(1) heartburn...
|
||||||
|
|
||||||
* Version 3.0 Patch 11
|
* Version 3.0 Patch 11 - 1993-11-26
|
||||||
|
|
||||||
+ MINOR ENHANCEMENTS
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -427,7 +745,7 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Fixed the Finnish language support which was missing a few newlines.
|
- Fixed the Finnish language support which was missing a few newlines.
|
||||||
|
|
||||||
* Version 3.0 Patch 9
|
* Version 3.0 Patch 9 - 1993-10-04
|
||||||
|
|
||||||
+ NOTES
|
+ NOTES
|
||||||
|
|
||||||
@@ -484,7 +802,7 @@ CHANGES TO REMIND
|
|||||||
so that newlines in the body start new paragraphs, rather than being
|
so that newlines in the body start new paragraphs, rather than being
|
||||||
swallowed as white-space.
|
swallowed as white-space.
|
||||||
|
|
||||||
* Version 3.0 Patch 8
|
* Version 3.0 Patch 8 - 1993-09-08
|
||||||
|
|
||||||
+ MAJOR ENHANCEMENTS
|
+ MAJOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -536,7 +854,7 @@ CHANGES TO REMIND
|
|||||||
range [-128, 255] (but not 0) so that char(asc(s)) works even
|
range [-128, 255] (but not 0) so that char(asc(s)) works even
|
||||||
on machines with signed char types.
|
on machines with signed char types.
|
||||||
|
|
||||||
* Version 3.0 Patch 7
|
* Version 3.0 Patch 7 - 1993-07-22
|
||||||
|
|
||||||
+ MAJOR ENHANCEMENTS
|
+ MAJOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -579,7 +897,7 @@ CHANGES TO REMIND
|
|||||||
- Changed kall so that "kall sh" doesn't commit suicide - patch courtesy
|
- Changed kall so that "kall sh" doesn't commit suicide - patch courtesy
|
||||||
of Michael Salmon.
|
of Michael Salmon.
|
||||||
|
|
||||||
* Version 3.0 Patch 6
|
* Version 3.0 Patch 6 - 1993-05-05
|
||||||
|
|
||||||
+ MINOR ENHANCEMENTS
|
+ MINOR ENHANCEMENTS
|
||||||
|
|
||||||
@@ -602,7 +920,7 @@ CHANGES TO REMIND
|
|||||||
- Fixed a bug in the -u option which sometimes caused a core dump
|
- Fixed a bug in the -u option which sometimes caused a core dump
|
||||||
(embarrassed grin!) The fix is due to Tina Hoeltig. Thanks, Tina!
|
(embarrassed grin!) The fix is due to Tina Hoeltig. Thanks, Tina!
|
||||||
|
|
||||||
* Version 3.0 Patch 5
|
* Version 3.0 Patch 5 - 1993-04-27
|
||||||
|
|
||||||
+ MAJOR ENHANCEMENTS:
|
+ MAJOR ENHANCEMENTS:
|
||||||
|
|
||||||
@@ -637,7 +955,7 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Fixed a bug in the man page - thanks to Ed Oskiewicz.
|
- Fixed a bug in the man page - thanks to Ed Oskiewicz.
|
||||||
|
|
||||||
* Version 3.0 Patch 4
|
* Version 3.0 Patch 4 - 1993-03-08
|
||||||
|
|
||||||
- Added the -g option - this sorts reminders by date/time before
|
- Added the -g option - this sorts reminders by date/time before
|
||||||
issuing them. (You can see I'm running out of letters to
|
issuing them. (You can see I'm running out of letters to
|
||||||
@@ -696,13 +1014,13 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Put my new mailing address in the README files.
|
- Put my new mailing address in the README files.
|
||||||
|
|
||||||
* Version 3.0 Patch 3
|
* Version 3.0 Patch 3 - 1993-02-21
|
||||||
|
|
||||||
- Corrected bugs in Remind and Rem2PS. No new features added. You
|
- Corrected bugs in Remind and Rem2PS. No new features added. You
|
||||||
should NOT use patch level 2 - either stick to 3.0.1 or upgrade to
|
should NOT use patch level 2 - either stick to 3.0.1 or upgrade to
|
||||||
3.0.3.
|
3.0.3.
|
||||||
|
|
||||||
* Version 3.0 Patch 2
|
* Version 3.0 Patch 2 - 1993-02-04
|
||||||
|
|
||||||
- Added the -u option to Remind so that root can run it as any user.
|
- Added the -u option to Remind so that root can run it as any user.
|
||||||
This simplifies the remind-all scripts, and makes them more efficient.
|
This simplifies the remind-all scripts, and makes them more efficient.
|
||||||
@@ -742,7 +1060,7 @@ CHANGES TO REMIND
|
|||||||
- Changed Remind so that supplying the -a option causes timed reminders
|
- Changed Remind so that supplying the -a option causes timed reminders
|
||||||
not to be placed into the calendar in calendar mode.
|
not to be placed into the calendar in calendar mode.
|
||||||
|
|
||||||
* Version 3.0 Patch 1
|
* Version 3.0 Patch 1 - 1992-12-18
|
||||||
|
|
||||||
- Wrote the Rem2ps program to produce PostScript calendars
|
- Wrote the Rem2ps program to produce PostScript calendars
|
||||||
|
|
||||||
@@ -782,7 +1100,7 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Re-formatted the WHATSNEW.30 file.
|
- Re-formatted the WHATSNEW.30 file.
|
||||||
|
|
||||||
* Version 3.0
|
* Version 3.0 - 1992-11-09
|
||||||
|
|
||||||
- Total rewrite from previous versions
|
- Total rewrite from previous versions
|
||||||
|
|
||||||
@@ -803,23 +1121,23 @@ CHANGES TO REMIND
|
|||||||
- Fixed a lurking bug in trigger date calculation which, amazingly, had not
|
- Fixed a lurking bug in trigger date calculation which, amazingly, had not
|
||||||
been caught in the couple of years that Remind has been out!
|
been caught in the couple of years that Remind has been out!
|
||||||
|
|
||||||
* Version 2.3 Patch 5
|
* Version 2.3 Patch 5 - 1992-04-11
|
||||||
|
|
||||||
- Added the "c+n" option for printing a calendar by
|
- Added the "c+n" option for printing a calendar by
|
||||||
weeks instead of months, courtesy Dennis Cottel (dennis@peanuts.nosc.mil).
|
weeks instead of months, courtesy Dennis Cottel (dennis@peanuts.nosc.mil).
|
||||||
|
|
||||||
* Version 2.3 Patch 4
|
* Version 2.3 Patch 4 - 1991-11-06
|
||||||
|
|
||||||
- Made the init.c file nicer. Made the Makefile
|
- Made the init.c file nicer. Made the Makefile
|
||||||
prettier. Added "make test", "make tar" and "make shar" Makefile targets.
|
prettier. Added "make test", "make tar" and "make shar" Makefile targets.
|
||||||
|
|
||||||
* Version 2.3 Patch 3
|
* Version 2.3 Patch 3 - 1991-09-11
|
||||||
|
|
||||||
- Added a command-line option for Remind to process
|
- Added a command-line option for Remind to process
|
||||||
queued reminders in the foreground. This makes automatic termination
|
queued reminders in the foreground. This makes automatic termination
|
||||||
of Remind processes from within X-Windows and Sunview easier.
|
of Remind processes from within X-Windows and Sunview easier.
|
||||||
|
|
||||||
* Version 2.3 Patch 2
|
* Version 2.3 Patch 2 - 1991-07-19
|
||||||
|
|
||||||
- Fixed up a problem with timed reminders which resulted
|
- Fixed up a problem with timed reminders which resulted
|
||||||
in cursor not starting from left side of screen on some systems.
|
in cursor not starting from left side of screen on some systems.
|
||||||
@@ -836,7 +1154,7 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Made the Makefile more portable
|
- Made the Makefile more portable
|
||||||
|
|
||||||
* Version 2.3 Patch 1
|
* Version 2.3 Patch 1 - 1991-03-08
|
||||||
|
|
||||||
- Added the "-t" command-line option to get Remind
|
- Added the "-t" command-line option to get Remind
|
||||||
to trigger all non-expired reminders.
|
to trigger all non-expired reminders.
|
||||||
@@ -850,7 +1168,7 @@ CHANGES TO REMIND
|
|||||||
|
|
||||||
- Added manual pages for "kall" and "rem".
|
- Added manual pages for "kall" and "rem".
|
||||||
|
|
||||||
* Version 2.3
|
* Version 2.3 - 1991-02-20
|
||||||
|
|
||||||
- Added the UNTIL keyword for forcing reminders to expire.
|
- Added the UNTIL keyword for forcing reminders to expire.
|
||||||
|
|
||||||
@@ -872,28 +1190,28 @@ CHANGES TO REMIND
|
|||||||
- Modified the calendar and SimpleCalendar formats so that the % escape
|
- Modified the calendar and SimpleCalendar formats so that the % escape
|
||||||
substitutions ARE performed.
|
substitutions ARE performed.
|
||||||
|
|
||||||
* Version 2.2 - Patch 5
|
* Version 2.2 - Patch 5 - 1990-12-03
|
||||||
|
|
||||||
- Added the BEFORE, AFTER and SKIP tokens to make the
|
- Added the BEFORE, AFTER and SKIP tokens to make the
|
||||||
handling of holidays more sensible. Also corrected a few more bugs.
|
handling of holidays more sensible. Also corrected a few more bugs.
|
||||||
|
|
||||||
* Version 2.2 - Patch 3
|
* Version 2.2 - Patch 3 - 1990-11-28
|
||||||
|
|
||||||
- Added the MSG or RUN tokens in an OMIT command; also
|
- Added the MSG or RUN tokens in an OMIT command; also
|
||||||
allowed RUN-type reminders to be explicitly included in the calendar by
|
allowed RUN-type reminders to be explicitly included in the calendar by
|
||||||
using the %" escape sequence.
|
using the %" escape sequence.
|
||||||
|
|
||||||
* Version 2.2
|
* Version 2.2 - 1990-11-16
|
||||||
|
|
||||||
- Added the AT keyword, the timed reminders daemon, and the
|
- Added the AT keyword, the timed reminders daemon, and the
|
||||||
calendar facility.
|
calendar facility.
|
||||||
|
|
||||||
* Version 2.1
|
* Version 2.1 - 1990-11-06
|
||||||
|
|
||||||
- Added the "repeat" token for repeating reminders with a period
|
- Added the "repeat" token for repeating reminders with a period
|
||||||
other than 7 days. Also fixed some bugs from version 2.0
|
other than 7 days. Also fixed some bugs from version 2.0
|
||||||
|
|
||||||
* Version 2.0
|
* Version 2.0 - 1990-11-01
|
||||||
|
|
||||||
- first public release. Included advanced date specifications,
|
- first public release. Included advanced date specifications,
|
||||||
character substitution, and the RUN keyword.
|
character substitution, and the RUN keyword.
|
||||||
@@ -17,22 +17,18 @@
|
|||||||
# "#COLORS" for examples of ANSI color escape sequences. #
|
# "#COLORS" for examples of ANSI color escape sequences. #
|
||||||
# #
|
# #
|
||||||
# This file is part of REMIND. #
|
# This file is part of REMIND. #
|
||||||
# Copyright (C) 1992-1997 by David F. Skoll #
|
# Copyright (C) 1992-1997 David F. Skoll #
|
||||||
# Copyright (C) 1999 by Roaring Penguin Software Inc. #
|
# Copyright (C) 1999-2000 Roaring Penguin Software Inc. #
|
||||||
# #
|
# #
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
#
|
|
||||||
# $Id: defs.rem,v 1.3 1999-04-05 17:34:38 dfs Exp $
|
|
||||||
#
|
|
||||||
|
|
||||||
RUN OFF
|
RUN OFF
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Ensure required version of remind is used... #
|
# Ensure required version of remind is used... #
|
||||||
################################################
|
################################################
|
||||||
IF version() < "03.00.19"
|
IF version() < "03.01.02"
|
||||||
ERRMSG This file requires at least version 03.00.19 of Remind.%
|
ERRMSG This file requires at least version 03.01.02 of Remind.%
|
||||||
ERRMSG This version is version [version()].
|
ERRMSG This version is version [version()].
|
||||||
EXIT
|
EXIT
|
||||||
ENDIF
|
ENDIF
|
||||||
@@ -97,7 +93,7 @@ SET Week_1 1
|
|||||||
SET Week_2 8
|
SET Week_2 8
|
||||||
SET Week_3 15
|
SET Week_3 15
|
||||||
SET Week_4 22
|
SET Week_4 22
|
||||||
FSET _last(mo) "1 " + MON((mo%12)+1)+" --7"
|
FSET _last(mo) "1 " + MON((mo%12)+1) + " --7"
|
||||||
|
|
||||||
# Shorthand for commonly used expression...
|
# Shorthand for commonly used expression...
|
||||||
FSET _trig() TRIGGER(TRIGDATE())
|
FSET _trig() TRIGGER(TRIGDATE())
|
||||||
@@ -105,46 +101,6 @@ FSET _trig() TRIGGER(TRIGDATE())
|
|||||||
# Handy function to provide SCANFROM dates...
|
# Handy function to provide SCANFROM dates...
|
||||||
FSET _back(days) TRIGGER(TODAY()-days)
|
FSET _back(days) TRIGGER(TODAY()-days)
|
||||||
|
|
||||||
###########################################################
|
|
||||||
# On MS-DOS systems, the standard C library functions are #
|
|
||||||
# not reliable for computing offsets from local time to #
|
|
||||||
# UTC. The following provides a work-around for the #
|
|
||||||
# sunrise() and sunset() functions. Note, however, that #
|
|
||||||
# if Daylight Savings Time is in effect for today(), the #
|
|
||||||
# sun functions return times in DST even for dates on #
|
|
||||||
# which DST is not in effect; the converse can also occur.#
|
|
||||||
# #
|
|
||||||
# Change the timezone to your timezone - the default is #
|
|
||||||
# for EST which is 5 hours (300 minutes) behind UTC. #
|
|
||||||
# The code is correct for places in which Daylight Savings#
|
|
||||||
# Time begins on the last Sunday in April and ends on the #
|
|
||||||
# last Sunday in October. #
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
IF OSTYPE() == "MSDOS"
|
|
||||||
# Eastern Standard Time
|
|
||||||
SET TimeZone -300
|
|
||||||
|
|
||||||
# Use --8 rather than --7 because we want the last day BEFORE
|
|
||||||
# the time switch occurs.
|
|
||||||
REM Sun 1 May --8 SATISFY 1
|
|
||||||
SET BegDst TRIGDATE()
|
|
||||||
|
|
||||||
REM Sun 1 Nov --8 SATISFY 1
|
|
||||||
SET EndDst TRIGDATE()
|
|
||||||
|
|
||||||
SET $CalcUTC 0
|
|
||||||
|
|
||||||
# Check out the following IF statement and figure out why it works!
|
|
||||||
IF EndDst < BegDst
|
|
||||||
# Daylight Savings Time
|
|
||||||
SET $MinsFromUTC TimeZone+60
|
|
||||||
ELSE
|
|
||||||
# Standard Time
|
|
||||||
SET $MinsFromUTC TimeZone
|
|
||||||
ENDIF
|
|
||||||
ENDIF
|
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# Function which returns a string in "am/pm" format based #
|
# Function which returns a string in "am/pm" format based #
|
||||||
# on the time. For example, set a am_pm(NOW())... #
|
# on the time. For example, set a am_pm(NOW())... #
|
||||||
@@ -351,7 +307,12 @@ REM Feb 14 MSG %"Valentine's%" Day
|
|||||||
REM Mon Feb [Week_3] SCANFROM [_back(7)] SATISFY 1
|
REM Mon Feb [Week_3] SCANFROM [_back(7)] SATISFY 1
|
||||||
OMIT [_trig()] MSG %"President's Day%"
|
OMIT [_trig()] MSG %"President's Day%"
|
||||||
REM Mar 17 MSG %"St. Patrick's%" Day
|
REM Mar 17 MSG %"St. Patrick's%" Day
|
||||||
REM Sun Apr 1 ++2 MSG Daylight Savings Time - %"DST starts%" %b
|
|
||||||
|
# The DST rules are accurate for most locations in
|
||||||
|
# North America
|
||||||
|
REM Sun Apr 1 ++2 UNTIL 1 Jan 2007 MSG Daylight Savings Time - %"DST starts%" %b
|
||||||
|
REM Sun Mar 8 ++2 FROM 1 Jan 2007 MSG Daylight Savings Time - %"DST starts%" %b
|
||||||
|
|
||||||
REM Apr 1 MSG %"April Fool's%" Day
|
REM Apr 1 MSG %"April Fool's%" Day
|
||||||
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
|
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
|
||||||
REM May 5 MSG %"Cinco de Mayo%"
|
REM May 5 MSG %"Cinco de Mayo%"
|
||||||
@@ -366,7 +327,12 @@ REM Mon Sep [Week_1] SCANFROM [_back(7)] SATISFY 1
|
|||||||
OMIT [_trig()] MSG %"Labor Day%"
|
OMIT [_trig()] MSG %"Labor Day%"
|
||||||
REM Mon Oct [Week_2] MSG %"Columbus Day%"
|
REM Mon Oct [Week_2] MSG %"Columbus Day%"
|
||||||
REM Nov 11 MSG %"Veterans Day%"
|
REM Nov 11 MSG %"Veterans Day%"
|
||||||
REM Sun [_last(Oct)] MSG Daylight Savings Time - %"DST over%"
|
|
||||||
|
# The DST rules are accurate for most locations in
|
||||||
|
# North America
|
||||||
|
REM Sun [_last(Oct)] UNTIL 1 Jan 2007 MSG Daylight Savings Time - %"DST over%"
|
||||||
|
REM Sun 1 Nov FROM 1 Jan 2007 MSG Daylight Savings Time - %"DST over%"
|
||||||
|
|
||||||
REM Oct 30 MSG %"Mischief Night%"
|
REM Oct 30 MSG %"Mischief Night%"
|
||||||
REM Oct 31 MSG %"Halloween%"
|
REM Oct 31 MSG %"Halloween%"
|
||||||
REM Tue Nov 2 SCANFROM [_back(7)] \
|
REM Tue Nov 2 SCANFROM [_back(7)] \
|
||||||
@@ -472,6 +438,8 @@ SET Reform 0
|
|||||||
FSET _h(x, y) TRIGGER(HEBDATE(x,y))
|
FSET _h(x, y) TRIGGER(HEBDATE(x,y))
|
||||||
FSET _h2(x, y) HEBDATE(x, y, TODAY()-7)
|
FSET _h2(x, y) HEBDATE(x, y, TODAY()-7)
|
||||||
FSET _PastSat(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)+1))
|
FSET _PastSat(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)+1))
|
||||||
|
FSET _PastSun(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=0, _h2(x,y), _h2(x,y)+1))
|
||||||
|
FSET _PastMon(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=1, _h2(x,y), _h2(x,y)+1))
|
||||||
|
|
||||||
# Default values in case InIsrael and Reform are not set
|
# Default values in case InIsrael and Reform are not set
|
||||||
SET InIsrael VALUE("InIsrael", 0)
|
SET InIsrael VALUE("InIsrael", 0)
|
||||||
@@ -492,7 +460,7 @@ IF !InIsrael
|
|||||||
[_h(16, "Tishrey")] MSG %"Sukkot 2%"
|
[_h(16, "Tishrey")] MSG %"Sukkot 2%"
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
[_h(21, "Tishrey")] ++4 MSG %"Hashana Rabba%" is %b.
|
[_h(21, "Tishrey")] ++4 MSG %"Hoshana Rabba%" is %b.
|
||||||
[_h(22, "Tishrey")] ++4 MSG %"Shemini Atzeret%" is %b.
|
[_h(22, "Tishrey")] ++4 MSG %"Shemini Atzeret%" is %b.
|
||||||
|
|
||||||
IF InIsrael
|
IF InIsrael
|
||||||
@@ -520,7 +488,8 @@ IF !Reform
|
|||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
[_h(15, "Shvat")] ++4 MSG %"Tu B'Shvat%" is %b.
|
[_h(15, "Shvat")] ++4 MSG %"Tu B'Shvat%" is %b.
|
||||||
[_h(15, "Adar A")] ++4 MSG %"Purim Katan%" is %b.
|
[_h(14, "Adar A")] ++4 MSG %"Purim Katan%" is %b.
|
||||||
|
[_h(15, "Adar A")] ++4 MSG %"Shushan Purim Katan%" is %b.
|
||||||
|
|
||||||
# If Purim is on Sunday, then Fast of Esther is 11 Adar.
|
# If Purim is on Sunday, then Fast of Esther is 11 Adar.
|
||||||
IF WKDAYNUM(_h2(13, "Adar")) != 6
|
IF WKDAYNUM(_h2(13, "Adar")) != 6
|
||||||
@@ -529,6 +498,7 @@ ELSE
|
|||||||
REM [TRIGGER(_h2(11, "Adar"))] ++4 MSG %"Fast of Esther%" is %b.
|
REM [TRIGGER(_h2(11, "Adar"))] ++4 MSG %"Fast of Esther%" is %b.
|
||||||
ENDIF
|
ENDIF
|
||||||
[_h(14, "Adar")] ++4 MSG %"Purim%" is %b.
|
[_h(14, "Adar")] ++4 MSG %"Purim%" is %b.
|
||||||
|
[_h(15, "Adar")] ++4 MSG %"Shushan Purim%" is %b.
|
||||||
[_h(15, "Nisan")] ++4 MSG %"Pesach%" is %b.
|
[_h(15, "Nisan")] ++4 MSG %"Pesach%" is %b.
|
||||||
|
|
||||||
IF !InIsrael
|
IF !InIsrael
|
||||||
@@ -541,9 +511,24 @@ IF !InIsrael && !Reform
|
|||||||
[_h(22, "Nisan")] MSG %"Pesach 8%"
|
[_h(22, "Nisan")] MSG %"Pesach 8%"
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
[_h(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
|
[_PastSun(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
|
||||||
[_h(4, "Iyar")] ++4 MSG %"Yom HaZikaron%" is %b.
|
|
||||||
[_h(5, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
# If 4 Iyar is a Friday, then Yom Hazikaron is
|
||||||
|
# the Wednesday before and Yom Ha'atzmaut is on
|
||||||
|
# Thursday. If 4 Iyar is a Sunday, then Yom Hazikaron
|
||||||
|
# moves to 5 Iyar and Yom Ha'atzmaut to 6 Iyar.
|
||||||
|
IF WKDAYNUM(_h2(4, "Iyar")) == 5
|
||||||
|
[_h(2, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
|
||||||
|
[_h(3, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
||||||
|
ELSE
|
||||||
|
IF WKDAYNUM(_h2, 4, "Iyar") == 0
|
||||||
|
[_h(5, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
|
||||||
|
[_h(6, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
||||||
|
ELSE
|
||||||
|
[_h(4, "Iyar")] ++4 MSG %"Yom Hazikaron%" is %b.
|
||||||
|
[_h(5, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
|
||||||
|
ENDIF
|
||||||
|
ENDIF
|
||||||
|
|
||||||
# Not sure about Reform's position on Lag B'Omer
|
# Not sure about Reform's position on Lag B'Omer
|
||||||
IF !Reform
|
IF !Reform
|
||||||
|
|||||||
53
examples/remind.vim
Normal file
53
examples/remind.vim
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Remind
|
||||||
|
" Maintainer: Davide Alberani <alberanid@bigfoot.com>
|
||||||
|
" Last change: 03 Dec 1999
|
||||||
|
" Version: 0.1
|
||||||
|
" URL: http://members.xoom.com/alberanid/vim/syntax/remind.vim
|
||||||
|
"
|
||||||
|
" remind is a sophisticated reminder service
|
||||||
|
" you can download remind from ftp://ftp.doe.carleton.ca/pub/remind-3.0/
|
||||||
|
|
||||||
|
" clear any unwanted syntax defs
|
||||||
|
syn clear
|
||||||
|
|
||||||
|
" shut case off
|
||||||
|
syn case ignore
|
||||||
|
|
||||||
|
syn keyword remindCommands REM OMIT SET FSET UNSET
|
||||||
|
syn keyword remindExpiry UNTIL SCANFROM SCAN WARN SCHED
|
||||||
|
syn keyword remindTag PRIORITY TAG
|
||||||
|
syn keyword remindTimed AT DURATION
|
||||||
|
syn keyword remindMove ONCE SKIP BEFORE AFTER
|
||||||
|
syn keyword remindSpecial INCLUDE INC BANNER PUSH-OMIT-CONTEXT PUSH CLEAR-OMIT-CONTEXT CLEAR POP-OMIT-CONTEXT POP
|
||||||
|
syn keyword remindRun MSG MSF RUN CAL SATISFY SPECIAL PS PSFILE SHADE MOON
|
||||||
|
syn keyword remindConditional IF ELSE ENDIF IFTRIG
|
||||||
|
syn match remindComment "#.*$"
|
||||||
|
syn region remindString start=+'+ end=+'+ skip=+\\\\\|\\'+ oneline
|
||||||
|
syn region remindString start=+"+ end=+"+ skip=+\\\\\|\\"+ oneline
|
||||||
|
syn keyword remindDebug DEBUG DUMPVARS DUMP ERRMSG FLUSH PRESERVE
|
||||||
|
syn match remindVar "\$[_a-zA-Z][_a-zA-Z0-9]*"
|
||||||
|
syn match remindSubst "%[^ ]"
|
||||||
|
syn match remindAdvanceNumber "\(\*\|+\|-\|++\|--\)[0-9]\+"
|
||||||
|
|
||||||
|
if !exists("did_remind_syntax_inits")
|
||||||
|
let did_remind_syntax_inits = 1
|
||||||
|
hi link remindCommands Function
|
||||||
|
hi link remindExpiry Repeat
|
||||||
|
hi link remindTag Label
|
||||||
|
hi link remindTimed Statement
|
||||||
|
hi link remindMove Statement
|
||||||
|
hi link remindSpecial Include
|
||||||
|
hi link remindRun Function
|
||||||
|
hi link remindConditional Conditional
|
||||||
|
hi link remindComment Comment
|
||||||
|
hi link remindString String
|
||||||
|
hi link remindDebug Debug
|
||||||
|
hi link remindVar Identifier
|
||||||
|
hi link remindSubst Constant
|
||||||
|
hi link remindAdvanceNumber Number
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "remind"
|
||||||
|
|
||||||
|
"EOF vim: ts=8 noet tw=100 sw=8 sts=0
|
||||||
28
man/cm2rem.1
Normal file
28
man/cm2rem.1
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
.TH CM2REM 1 "18 October 1999"
|
||||||
|
.UC4
|
||||||
|
.SH NAME
|
||||||
|
cm2rem.tcl \- Convert Sun's "cm" input file to Remind format
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B cm2rem.tcl < cm_file > remind_file
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fBcm2rem.tcl\fR reads the Sun calendar manager data file and converts
|
||||||
|
it into a \fBRemind\fR script. Note that \fBcm2rem.tcl\fR can convert
|
||||||
|
\fIonly\fR version 3 calendar manager files. If you are using version 4
|
||||||
|
files, there should be a system utility to convert them to version 3 files.
|
||||||
|
.SH AUTHOR
|
||||||
|
\fBcm2rem.tcl\fR is supported by Roaring Penguin Software
|
||||||
|
Inc. (http://www.roaringpenguin.com)
|
||||||
|
.PP
|
||||||
|
\fBcm2rem.tcl\fR was written by David F. Skoll <dfs@roaringpenguin.com>.
|
||||||
|
.SH BUGS
|
||||||
|
Not all of the Sun calendar manager options are respected. In particular,
|
||||||
|
nothing is done for e-mail actions. Also, the resulting Remind script
|
||||||
|
is not editable with \fBTkRemind\fR; you can only edit it with a text
|
||||||
|
editor.
|
||||||
|
.PP
|
||||||
|
\fBcm2rem.tcl\fR requires Tcl/Tk version 8.0 or higher. The
|
||||||
|
\fBtclsh\fR interpreter must be on your \fBpath\fR.
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
\fBremind(1)\fR, \fBtkremind(1)\fR
|
||||||
|
|
||||||
28
man/kall.1
28
man/kall.1
@@ -1,28 +0,0 @@
|
|||||||
.\" $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
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.B kall
|
|
||||||
[\-\fIsignal\fR] prog1 [prog2...]
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.B Kall
|
|
||||||
sends the specified \fIsignal\fR (defaults to \fB-TERM\fR) to all processes
|
|
||||||
whose command name is specified on the command line. For example:
|
|
||||||
.PP
|
|
||||||
.nf
|
|
||||||
kall -HUP remind foobar
|
|
||||||
.fi
|
|
||||||
.PP
|
|
||||||
sends a \fBHUP\fR signal to all \fIremind\fR and \fIfoobar\fR programs.
|
|
||||||
Note that \fBkall\fR sends signals only to those processes owned by the
|
|
||||||
user invoking \fBkall\fR.
|
|
||||||
.SH AUTHOR
|
|
||||||
David F. Skoll
|
|
||||||
.SH BUGS
|
|
||||||
.B Kall
|
|
||||||
is a sh(1) script and depends on the behaviour of ps(1); thus, it is
|
|
||||||
not especially portable.
|
|
||||||
.SH SEE ALSO
|
|
||||||
remind, rem
|
|
||||||
41
man/rem.1
41
man/rem.1
@@ -1,35 +1,20 @@
|
|||||||
.\" $Id: rem.1,v 1.2 1998-02-16 02:35:09 dfs Exp $
|
.TH REM 1 "30 August 2007"
|
||||||
.TH REM 1 "15 February 1998"
|
.UC4
|
||||||
.UC 4
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
rem \- run 'remind' with a default reminder file
|
rem \- Invoke Remind with a default filename
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B rem
|
.B rem [\fIoptions\fR] [\fIdate\fR] [\fI*rep\fR] [\fItime\fR]
|
||||||
[\-F \fIfilename\fR] [\fIremind_options\fR] [\fIremind_params\fR]
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B Rem
|
\fBrem\fR is a symbolic link to \fBremind\fR. When \fBremind\fR
|
||||||
runs the \fBremind\fR program with a default reminder file of
|
determines that it has been invoked as \fBrem\fR, it uses a default
|
||||||
"$HOME/.reminders". You can supply remind options on the command line,
|
filename rather than expecting a filename to be supplied on the command
|
||||||
as well as a date specification, just as with \fBremind\fR.
|
line.
|
||||||
|
|
||||||
If you don't want to use the default filename, you can override it with
|
|
||||||
the "-F" option, followed by a space and a filename. (This, however,
|
|
||||||
defeats the purpose of \fBrem\fR)
|
|
||||||
.PP
|
.PP
|
||||||
For example, typing:
|
If the environment variable DOTREMINDERS is set, \fBremind\fR uses the
|
||||||
.PP
|
value of DOTREMINDERS as the filename. Otherwise, \fBremind\fR uses
|
||||||
.nf
|
the filename $HOME/.reminders
|
||||||
rem -c 1 jan 1992
|
|
||||||
.fi
|
|
||||||
.PP
|
|
||||||
has the same effect as typing:
|
|
||||||
.PP
|
|
||||||
.nf
|
|
||||||
remind -c $HOME/.reminders 1 jan 1992
|
|
||||||
.fi
|
|
||||||
.PP
|
.PP
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
David F. Skoll
|
Remind was written by David F. Skoll <dfs@roaringpenguin.com>
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
remind, kall
|
\fBremind\fR
|
||||||
|
|
||||||
|
|||||||
48
man/rem2ps.1
48
man/rem2ps.1
@@ -1,5 +1,4 @@
|
|||||||
.\" $Id: rem2ps.1,v 1.3 1999-04-13 01:46:18 dfs Exp $
|
.TH REM2PS 1 "11 April 2005"
|
||||||
.TH REM2PS 1 "1 February 1998"
|
|
||||||
.UC4
|
.UC4
|
||||||
.SH NAME
|
.SH NAME
|
||||||
rem2ps \- draw a PostScript calendar from Remind output
|
rem2ps \- draw a PostScript calendar from Remind output
|
||||||
@@ -78,10 +77,10 @@ Letter
|
|||||||
8.5 x 11 in.
|
8.5 x 11 in.
|
||||||
.TP
|
.TP
|
||||||
Legal
|
Legal
|
||||||
11 x 17 in.
|
8.5 x 14 in.
|
||||||
.TP
|
.TP
|
||||||
Ledger
|
Ledger
|
||||||
8.5 x 14 in.
|
11 x 17 in.
|
||||||
.TP
|
.TP
|
||||||
Statement
|
Statement
|
||||||
5.5 x 8.5 in.
|
5.5 x 8.5 in.
|
||||||
@@ -112,11 +111,20 @@ Quarto
|
|||||||
.TP
|
.TP
|
||||||
10x14
|
10x14
|
||||||
10 x 14 in.
|
10 x 14 in.
|
||||||
|
.TP
|
||||||
|
\fIX\fRx\fIY\fRin
|
||||||
|
\fIX\fR by \fIY\fR inches, where \fIX\fR and \fIY\fR can be floating-point
|
||||||
|
numbers.
|
||||||
|
.TP
|
||||||
|
\fIX\fRx\fIY\fRcm
|
||||||
|
\fIX\fR by \fIY\fR centimetres, where \fIX\fR and \fIY\fR can be floating-point
|
||||||
|
numbers.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
Type "rem2ps -m help" for a list of available media. Note that the media
|
Type "rem2ps \-m help" for a list of available media. Note that the media
|
||||||
type (and all \fBRem2ps\fR options) are case-sensitive. If you don't use
|
type (and all \fBRem2ps\fR options) are case-sensitive. If you don't use
|
||||||
the \fB\-m\fR option, the media defaults to a compiled-in default - this
|
the \fB\-m\fR option, the media defaults to a compiled-in default - this
|
||||||
is usually Letter for North America and A4 for Europe. The "-m help"
|
is usually Letter for North America and A4 for Europe. The "\-m help"
|
||||||
option will display the compiled-in default.
|
option will display the compiled-in default.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
@@ -129,7 +137,7 @@ specifying:
|
|||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
-ftshe Helvetica -fd Helvetica-BoldOblique
|
\-ftshe Helvetica \-fd Helvetica-BoldOblique
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
In other words, the heading, entry and small-calendar fonts are set
|
In other words, the heading, entry and small-calendar fonts are set
|
||||||
@@ -145,7 +153,7 @@ are equivalent to specifying:
|
|||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
-sthd 14 -se 8
|
\-sthd 14 \-se 8
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
In other words, the heading and day numbers are 14-point fonts, and the
|
In other words, the heading and day numbers are 14-point fonts, and the
|
||||||
@@ -171,7 +179,7 @@ for good output:
|
|||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
# This gives good results for putting into a binder
|
# This gives good results for putting into a binder
|
||||||
rem2ps -ol 72 -sh 12
|
rem2ps \-ol 72 \-sh 12
|
||||||
.fi
|
.fi
|
||||||
.SH USAGE
|
.SH USAGE
|
||||||
To use \fBRem2ps\fR, you should pipe the output of \fBRemind\fR with the \fB\-p\fR
|
To use \fBRem2ps\fR, you should pipe the output of \fBRemind\fR with the \fB\-p\fR
|
||||||
@@ -179,14 +187,14 @@ option to \fBRem2ps\fR, and then send the result to a printer. This is most eas
|
|||||||
illustrated with examples:
|
illustrated with examples:
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
remind -p12 /dev/null 1 jan 1994 | rem2ps | lpr -Plaser
|
remind \-p12 /dev/null 1 jan 1994 | rem2ps | lpr \-Plaser
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
That example creates a blank calendar for the entire year of 1994, and
|
That example creates a blank calendar for the entire year of 1994, and
|
||||||
sends it the the printer named "laser."
|
sends it the the printer named "laser."
|
||||||
.PP
|
.PP
|
||||||
.nf
|
.nf
|
||||||
remind -p ~/.reminders | rem2ps -l -sd 18 > cal.ps
|
remind \-p ~/.reminders | rem2ps \-l \-sd 18 > cal.ps
|
||||||
.fi
|
.fi
|
||||||
.PP
|
.PP
|
||||||
This reminder creates a calendar for the current month, filling in
|
This reminder creates a calendar for the current month, filling in
|
||||||
@@ -342,7 +350,9 @@ The remaining data consists of calendar entries, in the following format:
|
|||||||
\fIyyyy/mm/dd special tag dur time body\fR
|
\fIyyyy/mm/dd special tag dur time body\fR
|
||||||
.PP
|
.PP
|
||||||
Here, \fIyyyy\fR is the year, \fImm\fR is the month (01-12) and
|
Here, \fIyyyy\fR is the year, \fImm\fR is the month (01-12) and
|
||||||
\fIdd\fR is the day of the month.
|
\fIdd\fR is the day of the month. Note that the date components are
|
||||||
|
always separated by "/" even if the date separator in \fBRemind\fR has
|
||||||
|
been set to "-". The consistent use of "/" is designed to ease parsing.
|
||||||
.PP
|
.PP
|
||||||
\fIspecial\fR is a string used
|
\fIspecial\fR is a string used
|
||||||
for "out-of-band" communication with back-ends. If the reminder
|
for "out-of-band" communication with back-ends. If the reminder
|
||||||
@@ -370,11 +380,21 @@ emits the line:
|
|||||||
However, back-ends should keep reading until EOF in case more data for
|
However, back-ends should keep reading until EOF in case more data for
|
||||||
subsequent months is forthcoming.
|
subsequent months is forthcoming.
|
||||||
.PP
|
.PP
|
||||||
|
If you supply the \fB\-l\fR option to \fBremind\fR, then reminders
|
||||||
|
may be preceded by a line that looks like this:
|
||||||
|
.PP
|
||||||
|
\fB# fileinfo \fIlineno filename\fR
|
||||||
|
.PP
|
||||||
|
The word \fBfileinfo\fR is literal; \fIlineno\fR and \fIfilename\fR specify
|
||||||
|
the line number and file name of the file containing the reminder. Back-ends
|
||||||
|
that don't care about this information should ignore lines starting with
|
||||||
|
"#" (except, of course, for the # rem2ps lines.)
|
||||||
|
.PP
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Rem2PS is now supported by Roaring Penguin Software
|
Rem2PS is now supported by Roaring Penguin Software
|
||||||
Inc. (http://www.roaringpenguin.com)
|
Inc. (http://www.roaringpenguin.com)
|
||||||
.PP
|
.PP
|
||||||
Rem2PS was written by David F. Skoll (dskoll@iname.com).
|
Rem2PS was written by David F. Skoll <dfs@roaringpenguin.com>.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
All \fBRem2ps\fR options are case-sensitive, unlike \fBRemind\fR.
|
All \fBRem2ps\fR options are case-sensitive, unlike \fBRemind\fR.
|
||||||
Any time you supply
|
Any time you supply
|
||||||
@@ -387,4 +407,4 @@ You should ensure that the values you supply for margin widths are sensible.
|
|||||||
If they are too big for the media size, \fBRem2ps\fR will not complain,
|
If they are too big for the media size, \fBRem2ps\fR will not complain,
|
||||||
but again, the PostScript output will probably not work.
|
but again, the PostScript output will probably not work.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
\fBRemind\fR
|
\fBremind\fR
|
||||||
|
|||||||
705
man/remind.1
705
man/remind.1
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
|||||||
.\" $Id: tkremind.1,v 1.8 1999-04-13 01:46:20 dfs Exp $ "
|
|
||||||
.TH TKREMIND 1 "15 February 1998"
|
.TH TKREMIND 1 "15 February 1998"
|
||||||
.UC 4
|
.UC 4
|
||||||
.SH NAME
|
.SH NAME
|
||||||
@@ -22,6 +21,8 @@ extra features as you become a more sophisticated \fBRemind\fR programmer.
|
|||||||
on to \fBRemind\fR. The options it passes are
|
on to \fBRemind\fR. The options it passes are
|
||||||
\fB\-b\fR, \fB\-g\fR, \fB\-x\fR, \fB\-i\fR and \fB\-m\fR.
|
\fB\-b\fR, \fB\-g\fR, \fB\-x\fR, \fB\-i\fR and \fB\-m\fR.
|
||||||
See the \fBRemind\fR man page for details about the options.
|
See the \fBRemind\fR man page for details about the options.
|
||||||
|
Note that \fBTkRemind\fR will respect the \fB\-m\fR and
|
||||||
|
\fB\-b1\fR options and adjust its appearance accordingly.
|
||||||
|
|
||||||
\fIRead_file\fR is the file from which \fBTkRemind\fR reads reminders.
|
\fIRead_file\fR is the file from which \fBTkRemind\fR reads reminders.
|
||||||
It is in standard \fBRemind\fR format. \fIWrite_file\fR is the file
|
It is in standard \fBRemind\fR format. \fIWrite_file\fR is the file
|
||||||
@@ -149,6 +150,13 @@ in the \fBPreview reminder\fR dialog.
|
|||||||
If the reminder was not created with \fBTkRemind\fR, you can't edit
|
If the reminder was not created with \fBTkRemind\fR, you can't edit
|
||||||
it with \fBTkRemind\fR.
|
it with \fBTkRemind\fR.
|
||||||
|
|
||||||
|
.SH USING A TEXT EDITOR
|
||||||
|
|
||||||
|
If you have set the "text editor" option correctly, right-clicking
|
||||||
|
on a reminder will bring up a text editor on the file containing
|
||||||
|
the reminder. The cursor will be positioned on the line that
|
||||||
|
generated the reminder.
|
||||||
|
|
||||||
.SH BACKGROUND REMINDERS
|
.SH BACKGROUND REMINDERS
|
||||||
|
|
||||||
If you create "timed" reminders, \fBTkRemind\fR will queue them in
|
If you create "timed" reminders, \fBTkRemind\fR will queue them in
|
||||||
@@ -168,6 +176,12 @@ certain aspects of \fBTkRemind\fR. The configuration options are:
|
|||||||
If this is selected, \fBTkRemind\fR starts up iconified. Otherwise,
|
If this is selected, \fBTkRemind\fR starts up iconified. Otherwise,
|
||||||
it starts up in a normal window.
|
it starts up in a normal window.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B Show Today's Reminders on Startup
|
||||||
|
If this is selected, \fBTkRemind\fR shows a text window containing reminders
|
||||||
|
which would be issued by "remind -q -a -r" on startup, and when the date
|
||||||
|
changes at midnight.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B Confirm Quit
|
.B Confirm Quit
|
||||||
If this is selected, you will be asked to confirm when you press
|
If this is selected, you will be asked to confirm when you press
|
||||||
@@ -197,12 +211,48 @@ background reminder pops up.
|
|||||||
.B Feed popped-up reminder to command's standard input
|
.B Feed popped-up reminder to command's standard input
|
||||||
If selected, feeds the text of the reminder to the command described
|
If selected, feeds the text of the reminder to the command described
|
||||||
above.
|
above.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B E-mail reminders here if popup not dismissed
|
||||||
|
If you enter a non-blank e-mail address in this field, then \fBTkRemind\fR
|
||||||
|
will e-mail you a reminder if you don't dismiss the popup box within
|
||||||
|
one minute. This is useful if you need to leave your terminal but
|
||||||
|
want your reminders to "follow" you via e-mail.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B Name or IP address of SMTP server
|
||||||
|
\fBTkRemind\fR uses a direct SMTP connection to send mail. Enter the
|
||||||
|
IP address of your SMTP server here.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B Text Editor
|
||||||
|
This specifies a text editor to invoke when a reminder is right-clicked.
|
||||||
|
The characters "%d" are replaced with the lined number of the file
|
||||||
|
containing the reminder, and "%s" are replaced with the file name.
|
||||||
|
Useful strings might be "emacs +%d %s" or "gvim +%d %s"
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
Once you've configured the options the way you like them,
|
Once you've configured the options the way you like them,
|
||||||
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
|
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
|
||||||
to put them into effect and save them in $HOME/.tkremindrc, or
|
to put them into effect and save them in $HOME/.tkremindrc, or
|
||||||
\fBCancel\fR to cancel any changes you made.
|
\fBCancel\fR to cancel any changes you made.
|
||||||
|
|
||||||
|
.SH KEYBOARD SHORTCUTS
|
||||||
|
\fBTkRemind\fR's main window includes the following keyboard shortcuts:
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B Ctrl-Q
|
||||||
|
Quit
|
||||||
|
.TP
|
||||||
|
.B Left Arrow
|
||||||
|
Previous Month
|
||||||
|
.TP
|
||||||
|
.B Right Arrow
|
||||||
|
Next Month
|
||||||
|
.TP
|
||||||
|
.B Home
|
||||||
|
Today
|
||||||
|
|
||||||
.SH ODDS AND ENDS
|
.SH ODDS AND ENDS
|
||||||
\fBTkRemind\fR performs some basic consistency checks when you add or
|
\fBTkRemind\fR performs some basic consistency checks when you add or
|
||||||
preview a reminder. However, if you edit a reminder in the previewer,
|
preview a reminder. However, if you edit a reminder in the previewer,
|
||||||
@@ -236,7 +286,7 @@ for \fBTkRemind\fR (for example).
|
|||||||
script file. It also places special comments in the reminder
|
script file. It also places special comments in the reminder
|
||||||
file to store additional state. You can certainly mix
|
file to store additional state. You can certainly mix
|
||||||
"hand-crafted" reminders with reminders created by \fBTkRemind\fR
|
"hand-crafted" reminders with reminders created by \fBTkRemind\fR
|
||||||
if you are awared of the following rules and limitations:
|
if you are aware of the following rules and limitations:
|
||||||
.TP
|
.TP
|
||||||
o
|
o
|
||||||
Do not use the \fBTAG\fR keyword in hand-crafted reminders.
|
Do not use the \fBTAG\fR keyword in hand-crafted reminders.
|
||||||
@@ -309,7 +359,7 @@ This line is emitted in response to a \fBSTATUS\fR command. The number
|
|||||||
TkRemind is now supported by Roaring Penguin Software
|
TkRemind is now supported by Roaring Penguin Software
|
||||||
Inc. (http://www.roaringpenguin.com)
|
Inc. (http://www.roaringpenguin.com)
|
||||||
.PP
|
.PP
|
||||||
TkRemind was written by David F. Skoll (dskoll@iname.com)
|
TkRemind was written by David F. Skoll <dfs@roaringpenguin.com>.
|
||||||
|
|
||||||
\fBTkRemind\fR is Copyright 1996-1998 by David F. Skoll, Copyright
|
\fBTkRemind\fR is Copyright 1996-1998 by David F. Skoll, Copyright
|
||||||
1999 by Roaring Penguin Software Inc.
|
1999 by Roaring Penguin Software Inc.
|
||||||
|
|||||||
23
remind.lsm
23
remind.lsm
@@ -1,23 +0,0 @@
|
|||||||
Begin3
|
|
||||||
Title: Remind
|
|
||||||
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. 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
|
|
||||||
266kB remind-3.0.19.tgz
|
|
||||||
Alternate-site:
|
|
||||||
Original-site:
|
|
||||||
Platform: Linux, Solaris, SunOS, HP-UX -- virtually any UN*X-like
|
|
||||||
system. Wish 8.x required for TCL/Tk front-end, but
|
|
||||||
this is not essential to use the software.
|
|
||||||
Copying-policy: GPL (No ports to MS Windows allowed)
|
|
||||||
End
|
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
Files in this directory:
|
Files in this directory:
|
||||||
|
|
||||||
kall -- Kills a program by command name, as in "kall remind"
|
tkremind -- Tcl/Tk graphical calendar using Remind as engine
|
||||||
rem -- Starts Remind with a default file of $HOME/.reminders
|
cm2rem.tcl -- Convert Sun's "cm" calendar manager files to Remind.
|
||||||
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 $
|
|
||||||
|
|
||||||
|
|||||||
359
scripts/cm2rem.tcl
Executable file
359
scripts/cm2rem.tcl
Executable file
@@ -0,0 +1,359 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# -*-Mode: TCL;-*-
|
||||||
|
|
||||||
|
#--------------------------------------------------------------
|
||||||
|
# cm2rem.tcl
|
||||||
|
#
|
||||||
|
# A cheesy Tcl script to convert Sun's "cm" calendar manager
|
||||||
|
# files (version 3 only) to Remind format.
|
||||||
|
#
|
||||||
|
# This file is part of REMIND.
|
||||||
|
# Copyright (C) 1992-1998 by David F. Skoll
|
||||||
|
# Copyright (C) 1999-2000 by Roaring Penguin Software Inc.
|
||||||
|
#
|
||||||
|
#--------------------------------------------------------------
|
||||||
|
|
||||||
|
# the next line restarts using tclsh \
|
||||||
|
exec tclsh "$0" "$@"
|
||||||
|
|
||||||
|
set i 0
|
||||||
|
foreach month {January February March April May June
|
||||||
|
July August September October November December} {
|
||||||
|
incr i
|
||||||
|
set MonthNum($month) $i
|
||||||
|
set FullMonth([string range $month 0 2]) $month
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: convertParens
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# line -- a line read from a cm file
|
||||||
|
# %RETURNS:
|
||||||
|
# A new line with all ( and ) outside quotes converted to { and }.
|
||||||
|
# This cheap trick allows us to use Tcl's built-in list manipulation
|
||||||
|
# functions to munge the line.
|
||||||
|
#***********************************************************************
|
||||||
|
proc convertParens { line } {
|
||||||
|
# Convert all ( and ) to { and } unless they are inside a quoted
|
||||||
|
# string
|
||||||
|
set out ""
|
||||||
|
set len [string length $line]
|
||||||
|
set inQuotes 0
|
||||||
|
for {set i 0} {$i < $len} {incr i} {
|
||||||
|
set char [string range $line $i $i]
|
||||||
|
if {$char == "\\" && $inQuotes} {
|
||||||
|
append out $char
|
||||||
|
incr i
|
||||||
|
set char [string range $line $i $i]
|
||||||
|
append out $char
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$char == "(" && !$inQuotes} {
|
||||||
|
set char \{
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$char == ")" && !$inQuotes} {
|
||||||
|
set char \}
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$char == "\""} {
|
||||||
|
set inQuotes [expr !$inQuotes]
|
||||||
|
}
|
||||||
|
|
||||||
|
append out $char
|
||||||
|
}
|
||||||
|
return $out
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: processLine
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# line -- a line read from a cm file
|
||||||
|
# %RETURNS:
|
||||||
|
# Nothing
|
||||||
|
# %DESCRIPTION:
|
||||||
|
# Processes a single line from the file, possibly writing a reminder
|
||||||
|
# in Remind format to stdout
|
||||||
|
#***********************************************************************
|
||||||
|
proc processLine { line } {
|
||||||
|
global Attributes
|
||||||
|
global FullMonth
|
||||||
|
|
||||||
|
catch {unset Attributes}
|
||||||
|
|
||||||
|
# Only convert lines which start with "(add"
|
||||||
|
if {[string range $line 0 3] != "(add"} {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
set line [convertParens $line]
|
||||||
|
# Convert it to a list. CAREFUL: Potential security problem if
|
||||||
|
# $line contains something nasty.
|
||||||
|
|
||||||
|
eval set line $line
|
||||||
|
|
||||||
|
set Attributes(body) ""
|
||||||
|
foreach {key val} $line {
|
||||||
|
switch -exact -- $key {
|
||||||
|
"add" {
|
||||||
|
set Attributes(date) $val
|
||||||
|
}
|
||||||
|
"what:" {
|
||||||
|
append Attributes(body) $val
|
||||||
|
}
|
||||||
|
"details:" {
|
||||||
|
append Attributes(body) $val
|
||||||
|
}
|
||||||
|
"duration:" {
|
||||||
|
set Attributes(duration) $val
|
||||||
|
}
|
||||||
|
"period:" {
|
||||||
|
set Attributes(period) $val
|
||||||
|
}
|
||||||
|
"ntimes:" {
|
||||||
|
set Attributes(ntimes) $val
|
||||||
|
}
|
||||||
|
"attributes:" {
|
||||||
|
set Attributes(action) $val
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if {[info exists Attributes(action)]} {
|
||||||
|
# Nuke quotes and commas in action
|
||||||
|
regsub -all {[,\"]} $Attributes(action) { } Attributes(action)
|
||||||
|
|
||||||
|
# Add spaces to pairs
|
||||||
|
regsub -all \}\{ $Attributes(action) \}\ \{ Attributes(action)
|
||||||
|
|
||||||
|
# Add another pair of brackets to make a proper list
|
||||||
|
set Attributes(action) "{$Attributes(action)}"
|
||||||
|
|
||||||
|
# Convert to a real Tcl list
|
||||||
|
eval set Attributes(action) $Attributes(action)
|
||||||
|
}
|
||||||
|
# Split out date into month, day, year, time parts
|
||||||
|
scan $Attributes(date) "%s%s%s%s%s" wkday month day time year
|
||||||
|
set time [string range $time 0 4]
|
||||||
|
set Attributes(wkday) $wkday
|
||||||
|
set Attributes(month) $FullMonth($month)
|
||||||
|
set Attributes(day) $day
|
||||||
|
set Attributes(time) $time
|
||||||
|
set Attributes(year) $year
|
||||||
|
|
||||||
|
# Convert newlines in body to spaces
|
||||||
|
set body $Attributes(body)
|
||||||
|
regsub -all "\n" $body " " body
|
||||||
|
|
||||||
|
# TODO: Escape BODY to get rid of [] chars.
|
||||||
|
set Attributes(body) $body
|
||||||
|
|
||||||
|
# Convert to Reminder format
|
||||||
|
convertReminder
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: convertReminder
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses global Attributes variable which must be filled in
|
||||||
|
# %RETURNS:
|
||||||
|
# Nothing
|
||||||
|
# %DESCRIPTION:
|
||||||
|
# Converts a reminder to Remind format.
|
||||||
|
#***********************************************************************
|
||||||
|
proc convertReminder {} {
|
||||||
|
global Attributes
|
||||||
|
switch -exact $Attributes(period) {
|
||||||
|
single { convertSingleReminder }
|
||||||
|
daily { convertDailyReminder }
|
||||||
|
weekly { convertWeeklyReminder }
|
||||||
|
monthly { convertMonthlyReminder }
|
||||||
|
yearly { convertYearlyReminder }
|
||||||
|
default {
|
||||||
|
puts "\# Unable to convert reminder with period $Attributes(period)"
|
||||||
|
puts "\# Body is: $Attributes(body)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: convertSingleReminder
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses global Attributes variable which must be filled in
|
||||||
|
# %RETURNS:
|
||||||
|
# Nothing
|
||||||
|
# %DESCRIPTION:
|
||||||
|
# Converts a reminder with "single" period to Remind format.
|
||||||
|
#***********************************************************************
|
||||||
|
proc convertSingleReminder {} {
|
||||||
|
global Attributes
|
||||||
|
puts "REM $Attributes(day) $Attributes(month) $Attributes(year) [at][duration]MSG $Attributes(body)"
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: convertDailyReminder
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses global Attributes variable which must be filled in
|
||||||
|
# %RETURNS:
|
||||||
|
# Nothing
|
||||||
|
# %DESCRIPTION:
|
||||||
|
# Converts a reminder with "daily" period to Remind format.
|
||||||
|
#***********************************************************************
|
||||||
|
proc convertDailyReminder {} {
|
||||||
|
global Attributes
|
||||||
|
set ntimes [expr $Attributes(ntimes) - 1]
|
||||||
|
if {$ntimes <= 1} {
|
||||||
|
convertSingleReminder
|
||||||
|
return
|
||||||
|
}
|
||||||
|
set until [getUntilDate $Attributes(day) $Attributes(month) $Attributes(year) $ntimes]
|
||||||
|
|
||||||
|
puts "REM $Attributes(day) $Attributes(month) $Attributes(year) *1 [at][duration]UNTIL $until MSG $Attributes(body)"
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: convertWeeklyReminder
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses global Attributes variable which must be filled in
|
||||||
|
# %RETURNS:
|
||||||
|
# Nothing
|
||||||
|
# %DESCRIPTION:
|
||||||
|
# Converts a reminder with "daily" period to Remind format.
|
||||||
|
#***********************************************************************
|
||||||
|
proc convertWeeklyReminder {} {
|
||||||
|
global Attributes
|
||||||
|
set ntimes [expr $Attributes(ntimes) - 1]
|
||||||
|
if {$ntimes <= 1} {
|
||||||
|
convertSingleReminder
|
||||||
|
return
|
||||||
|
}
|
||||||
|
set until [getUntilDate $Attributes(day) $Attributes(month) $Attributes(year) [expr $ntimes * 7]]
|
||||||
|
|
||||||
|
puts "REM $Attributes(day) $Attributes(month) $Attributes(year) *7 [at][duration]UNTIL $until MSG $Attributes(body)"
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: convertMonthlyReminder
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses global Attributes variable which must be filled in
|
||||||
|
# %RETURNS:
|
||||||
|
# Nothing
|
||||||
|
# %DESCRIPTION:
|
||||||
|
# Converts a reminder with "monthly" period to Remind format.
|
||||||
|
#***********************************************************************
|
||||||
|
proc convertMonthlyReminder {} {
|
||||||
|
global Attributes
|
||||||
|
set ntimes [expr $Attributes(ntimes) - 1]
|
||||||
|
if {$ntimes <= 1} {
|
||||||
|
convertSingleReminder
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# If repetition > 1000, it's infinite
|
||||||
|
if {$ntimes > 1000} {
|
||||||
|
puts "REM $Attributes(day) [at][duration]MSG $Attributes(body)"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
### UNTIL date is fudged!
|
||||||
|
set until [getUntilDate $Attributes(day) $Attributes(month) $Attributes(year) [expr $ntimes * 30]]
|
||||||
|
|
||||||
|
puts "REM $Attributes(day) [at][duration]UNTIL $until MSG $Attributes(body)"
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: convertYearlyReminder
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses global Attributes variable which must be filled in
|
||||||
|
# %RETURNS:
|
||||||
|
# Nothing
|
||||||
|
# %DESCRIPTION:
|
||||||
|
# Converts a reminder with "yearly" period to Remind format.
|
||||||
|
#***********************************************************************
|
||||||
|
proc convertYearlyReminder {} {
|
||||||
|
global Attributes
|
||||||
|
|
||||||
|
# No special handling of ntimes et al.
|
||||||
|
puts "REM $Attributes(day) $Attributes(month) [at][duration]MSG $Attributes(body)"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: at
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses Attributes global variable
|
||||||
|
# %RETURNS:
|
||||||
|
# A string providing the correct AT clause for a timed reminder.
|
||||||
|
#***********************************************************************
|
||||||
|
proc at {} {
|
||||||
|
global Attributes
|
||||||
|
if {![info exists Attributes(time)]} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if {"$Attributes(time)" == ""} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return "AT $Attributes(time) "
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: duration
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# None -- uses Attributes global variable
|
||||||
|
# %RETURNS:
|
||||||
|
# A string providing the correct DURATION clause for a timed reminder.
|
||||||
|
#***********************************************************************
|
||||||
|
proc duration {} {
|
||||||
|
global Attributes
|
||||||
|
if {![info exists Attributes(duration)]} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if {"$Attributes(duration)" == ""} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
set h [expr $Attributes(duration) / 3600]
|
||||||
|
set remainder [expr $Attributes(duration) - $h*3600]
|
||||||
|
set m [expr $remainder / 60]
|
||||||
|
return "DURATION [format "%d:%02d " $h $m]"
|
||||||
|
}
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# %PROCEDURE: getUntilDate
|
||||||
|
# %ARGUMENTS:
|
||||||
|
# day, month, year -- a date
|
||||||
|
# days -- number of days to add to date
|
||||||
|
# %RETURNS:
|
||||||
|
# The date which is "days" later than supplied date in a correct UNTIL
|
||||||
|
# format.
|
||||||
|
#***********************************************************************
|
||||||
|
proc getUntilDate { day month year days } {
|
||||||
|
global RemindPipe
|
||||||
|
global MonthNum
|
||||||
|
set date "'$year/$MonthNum($month)/$day'"
|
||||||
|
puts $RemindPipe "MSG \[trigger($date + $days)\]%"
|
||||||
|
puts $RemindPipe "flush"
|
||||||
|
flush $RemindPipe
|
||||||
|
gets $RemindPipe line
|
||||||
|
return $line
|
||||||
|
}
|
||||||
|
|
||||||
|
catch {wm withdraw .}
|
||||||
|
# Start a Remind process to issue reminders
|
||||||
|
if {[catch {set RemindPipe [open "|remind -" "r+"]} err]} {
|
||||||
|
puts stderr "Error: Cannot run Remind: $err"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
puts $RemindPipe "banner %"
|
||||||
|
flush $RemindPipe
|
||||||
|
|
||||||
|
# Write some blurb
|
||||||
|
puts "\# Reminder file converted from \"cm\" data by cm2rem.tcl"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
while {[gets stdin line] >= 0} {
|
||||||
|
processLine $line
|
||||||
|
}
|
||||||
|
exit 0
|
||||||
42
scripts/kall
42
scripts/kall
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# $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.
|
|
||||||
|
|
||||||
signal=`echo $1 | grep '^\-.*'`
|
|
||||||
me=`basename $0`
|
|
||||||
|
|
||||||
if [ "$signal" != "" ]; then
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
signal="-TERM"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" = "" ]; then
|
|
||||||
echo "usage: $me [-signal] string [string...]"
|
|
||||||
echo " kills all of your processes where command name matches"
|
|
||||||
echo " any of the given strings."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg="0"
|
|
||||||
|
|
||||||
while [ "$1" != "" ]; do
|
|
||||||
|
|
||||||
# NOTE: You may have to modify the next line, since PS is non-portable.
|
|
||||||
# The 'awk' command picks out the process IDs to pass them on to kill.
|
|
||||||
rprocs=`ps cx | awk '{if(prog == $NF && $1 != mypid) print $1}' prog=$1 mypid=$$ -`
|
|
||||||
if [ "$rprocs" != "" ]; then
|
|
||||||
msg="1"
|
|
||||||
echo -n "${me}: Sending $signal signal to $1 process(es)"
|
|
||||||
echo '...'
|
|
||||||
kill $signal $rprocs
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $msg = "1" ]; then
|
|
||||||
echo "${me}: Done."
|
|
||||||
fi
|
|
||||||
45
scripts/rem
45
scripts/rem
@@ -1,45 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# rem - by David Skoll - 26 February 1991
|
|
||||||
#
|
|
||||||
# $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
|
|
||||||
# you use rem unless you wanted to accept the default??)
|
|
||||||
|
|
||||||
# ------ You may wish to change the defaults below this line ------
|
|
||||||
|
|
||||||
# The default reminder file
|
|
||||||
DEFAULT=$HOME/.reminders
|
|
||||||
|
|
||||||
# The executable file (you may wish to change this to /usr/local/bin/remind
|
|
||||||
# or whatever.
|
|
||||||
EXECUTABLE=remind
|
|
||||||
|
|
||||||
# No options yet
|
|
||||||
OPTIONS=""
|
|
||||||
|
|
||||||
# No parameters yet
|
|
||||||
PARAMETERS=""
|
|
||||||
|
|
||||||
# ------ You shouldn't change anything below this line -----
|
|
||||||
|
|
||||||
# Scan for options
|
|
||||||
while test "$1" != ""
|
|
||||||
do
|
|
||||||
case $1 in
|
|
||||||
|
|
||||||
-F) DEFAULT=$2
|
|
||||||
shift
|
|
||||||
shift ;;
|
|
||||||
|
|
||||||
-*) OPTIONS="$OPTIONS $1"
|
|
||||||
shift ;;
|
|
||||||
|
|
||||||
*) PARAMETERS=$*
|
|
||||||
break ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
$EXECUTABLE $OPTIONS $DEFAULT $PARAMETERS
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#!/bin/csh -f
|
|
||||||
|
|
||||||
# Shell script to mail all users reminders.
|
|
||||||
|
|
||||||
# $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:
|
|
||||||
# 05 5 * * * /usr/share/lib/remind/remind-all > /dev/null 2>&1
|
|
||||||
|
|
||||||
# This script must be run by root. The -u option MUST be supplied
|
|
||||||
# to Remind, or a severe security hole will exist. Note that Remind
|
|
||||||
# must be compiled to support the -u option for this script to work.
|
|
||||||
# Also, the -r and -q options must be used.
|
|
||||||
|
|
||||||
# The following line gets a list of users for systems using SUN's
|
|
||||||
# NIS service:
|
|
||||||
set USERS = `ypcat passwd | awk -F: '{print $1}'`
|
|
||||||
|
|
||||||
# The following line gets a list of users by examining /etc/passwd:
|
|
||||||
# set USERS = `awk -F: '{print $1}' /etc/passwd`
|
|
||||||
|
|
||||||
# If neither of the above methods works, you must come up with some
|
|
||||||
# way of getting a list of users on the system
|
|
||||||
|
|
||||||
# Set the following variables as appropriate for your system
|
|
||||||
set REMIND = /usr/local/bin/remind
|
|
||||||
set MAIL = /usr/ucb/mail
|
|
||||||
set RM = "/usr/bin/rm -f"
|
|
||||||
|
|
||||||
set REMFILE = /tmp/RemFile.$$
|
|
||||||
|
|
||||||
# Scan each user's directory for a .reminders file
|
|
||||||
foreach i ($USERS)
|
|
||||||
if (-r ~$i/.reminders) then
|
|
||||||
# echo "$i has a .reminders file." DEBUGGING PURPOSES ONLY
|
|
||||||
|
|
||||||
$REMIND -u$i -h -r -q -iremind_all=1 ~$i/.reminders < /dev/null > $REMFILE
|
|
||||||
if (! -z $REMFILE) then
|
|
||||||
# echo "Sending mail to $i" DEBUGGING PURPOSES ONLY
|
|
||||||
|
|
||||||
$MAIL -s "Reminders" $i < $REMFILE
|
|
||||||
endif
|
|
||||||
$RM $REMFILE
|
|
||||||
endif
|
|
||||||
end
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Shell script to mail all users reminders.
|
|
||||||
|
|
||||||
# This file is part of REMIND
|
|
||||||
#
|
|
||||||
# $Id: remind-all.sh,v 1.3 1999-04-05 17:34:40 dfs Exp $
|
|
||||||
#
|
|
||||||
# REMIND is Copyright (C) 1992-1998 by David F. Skoll
|
|
||||||
# Copyright (C) 1999 by Roaring Penguin Software Inc.
|
|
||||||
# This file is Copyright (C) 1990 by Bill Aten
|
|
||||||
|
|
||||||
# Thanks to Bill Aten for this script.
|
|
||||||
|
|
||||||
# Run it AFTER MIDNIGHT so that date is correct!
|
|
||||||
# On our system, we have the following in our crontab:
|
|
||||||
# 02 00 * * * /usr/local/adm/remind-all >/dev/null 2>&1
|
|
||||||
|
|
||||||
# This script must be run by root. The -u option MUST be supplied
|
|
||||||
# to Remind, or a severe security hole will exist. Note that Remind
|
|
||||||
# must be compiled to support the -u option for this script to work.
|
|
||||||
# Also, the -r and -q options must be used.
|
|
||||||
|
|
||||||
# The following line gets a list of users for systems using SUN's
|
|
||||||
# NIS service:
|
|
||||||
# USERS=`ypcat passwd | awk -F: '{print $1}'`
|
|
||||||
|
|
||||||
# The following line gets a list of users by examining /etc/passwd:
|
|
||||||
USERS=`awk -F: '{print $1}' /etc/passwd`
|
|
||||||
|
|
||||||
# If neither of the above methods works, you must come up with some
|
|
||||||
# way of getting a list of users on the system
|
|
||||||
|
|
||||||
# Set the following variables as appropriate for your system
|
|
||||||
REMIND=/usr/local/bin/remind
|
|
||||||
MAIL=/usr/bin/mail
|
|
||||||
RM="/bin/rm -f"
|
|
||||||
|
|
||||||
REMFILE=/tmp/RemFile.$$
|
|
||||||
|
|
||||||
# Scan each user's directory for a .reminders file
|
|
||||||
for i in $USERS
|
|
||||||
do
|
|
||||||
HOME=`grep \^$i: /etc/passwd | awk -F: '{print $6}'`
|
|
||||||
if [ -r $HOME/.reminders ]; then
|
|
||||||
|
|
||||||
# echo "$i has a .reminders file." DEBUGGING PURPOSES ONLY
|
|
||||||
|
|
||||||
$REMIND -u$i -h -r -q -iremind_all=1 $HOME/.reminders < /dev/null > $REMFILE
|
|
||||||
if [ -s $REMFILE ]; then
|
|
||||||
# echo "Sending mail to $i" DEBUGGING PURPOSES ONLY
|
|
||||||
$MAIL -s "Reminders" $i < $REMFILE
|
|
||||||
fi
|
|
||||||
$RM $REMFILE
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
1586
scripts/tkremind
1586
scripts/tkremind
File diff suppressed because it is too large
Load Diff
@@ -1,36 +1,38 @@
|
|||||||
# Makefile.in for REMIND
|
# 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
|
SHELL= /bin/sh
|
||||||
|
BETA = 1
|
||||||
srcdir=@srcdir@
|
srcdir=@srcdir@
|
||||||
prefix=@prefix@
|
prefix=@prefix@
|
||||||
exec_prefix=@exec_prefix@
|
exec_prefix=@exec_prefix@
|
||||||
mandir=@mandir@
|
mandir=@mandir@
|
||||||
bindir=@bindir@
|
bindir=@bindir@
|
||||||
datadir=@datadir@
|
datadir=@datadir@
|
||||||
|
datarootdir=@datarootdir@
|
||||||
VPATH=$(srcdir)
|
VPATH=$(srcdir)
|
||||||
|
VERSION=@VERSION@
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
INSTALL=@INSTALL@
|
||||||
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
INSTALL_PROGRAM=@INSTALL_PROGRAM@
|
||||||
INSTALL_DATA=@INSTALL_DATA@
|
INSTALL_DATA=@INSTALL_DATA@
|
||||||
|
|
||||||
PROGS= remind rem2ps
|
PROGS= remind rem2ps
|
||||||
SCRIPTS= $(srcdir)/../scripts/kall $(srcdir)/../scripts/rem \
|
SCRIPTS= $(srcdir)/../scripts/tkremind $(srcdir)/../scripts/cm2rem.tcl
|
||||||
$(srcdir)/../scripts/tkremind
|
|
||||||
MANS= $(srcdir)/../man/kall.1 $(srcdir)/../man/rem.1 \
|
MANS= $(srcdir)/../man/rem2ps.1 $(srcdir)/../man/remind.1 \
|
||||||
$(srcdir)/../man/rem2ps.1 $(srcdir)/../man/remind.1 \
|
$(srcdir)/../man/tkremind.1 $(srcdir)/../man/cm2rem.1 \
|
||||||
$(srcdir)/../man/tkremind.1
|
$(srcdir)/../man/rem.1
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
REMINDSRCS= calendar.c dynbuf.c dorem.c dosubst.c expr.c files.c funcs.c \
|
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 \
|
globals.c hbcal.c init.c main.c md5.c moon.c omit.c queue.c \
|
||||||
token.c trigger.c userfns.c utils.c var.c
|
sort.c token.c trigger.c userfns.c utils.c var.c
|
||||||
|
|
||||||
|
REMINDHDRS=config.h custom.h dynbuf.h err.h expr.h globals.h lang.h \
|
||||||
|
md5.h protos.h rem2ps.h types.h version.h
|
||||||
REMINDOBJS= $(REMINDSRCS:.c=.o)
|
REMINDOBJS= $(REMINDSRCS:.c=.o)
|
||||||
|
|
||||||
all: remind rem2ps
|
all: remind rem2ps
|
||||||
@@ -39,24 +41,30 @@ test: remind
|
|||||||
sh ../tests/test-rem
|
sh ../tests/test-rem
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@CC@ -c @CFLAGS@ @DEFS@ $(LANGDEF) -DUNIX -I. -I$(srcdir) $<
|
@CC@ -c @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -I. -I$(srcdir) $<
|
||||||
|
|
||||||
rem2ps: rem2ps.o dynbuf.o
|
rem2ps: rem2ps.o dynbuf.o
|
||||||
@CC@ @LDFLAGS@ -o rem2ps rem2ps.o dynbuf.o
|
@CC@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o
|
||||||
|
|
||||||
remind: $(REMINDOBJS)
|
remind: $(REMINDOBJS)
|
||||||
@CC@ @LDFLAGS@ -o remind $(REMINDOBJS) @LIBS@
|
@CC@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
|
||||||
|
|
||||||
install: all
|
install-nostripped: all
|
||||||
|
-mkdir -p $(DESTDIR)$(bindir) || true
|
||||||
for prog in $(PROGS) $(SCRIPTS) ; do \
|
for prog in $(PROGS) $(SCRIPTS) ; do \
|
||||||
$(INSTALL_PROGRAM) $$prog $(bindir) ; \
|
$(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir) || exit 1; \
|
||||||
done
|
done
|
||||||
-strip $(bindir)/remind
|
rm -f $(DESTDIR)$(bindir)/rem > /dev/null 2>&1 || true
|
||||||
-strip $(bindir)/rem2ps
|
ln -s remind $(DESTDIR)$(bindir)/rem
|
||||||
|
-mkdir -p $(DESTDIR)$(mandir)/man1 || true
|
||||||
for man in $(MANS) ; do \
|
for man in $(MANS) ; do \
|
||||||
$(INSTALL_DATA) $$man $(mandir)/man1 ; \
|
$(INSTALL_DATA) $$man $(DESTDIR)$(mandir)/man1 || exit 1; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
install: install-nostripped
|
||||||
|
strip $(DESTDIR)$(bindir)/remind || true
|
||||||
|
strip $(DESTDIR)$(bindir)/rem2ps || true
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *~ core *.bak $(PROGS)
|
rm -f *.o *~ core *.bak $(PROGS)
|
||||||
|
|
||||||
@@ -64,24 +72,24 @@ clobber:
|
|||||||
rm -f *.o *~ remind rem2ps test.out core *.bak
|
rm -f *.o *~ remind rem2ps test.out core *.bak
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
gccmakedep @DEFS@ -DUNIX $(REMINDSRCS) rem2ps.c
|
gccmakedep @DEFS@ $(REMINDSRCS) rem2ps.c
|
||||||
|
|
||||||
# The next targets are not very useful to you. I use them to build
|
# The next targets are not very useful to you. I use them to build
|
||||||
# distributions, etc.
|
# distributions, etc.
|
||||||
|
|
||||||
# Build a tar file based on all files checked into CVS.
|
# Build a tar file based on all files checked into git.
|
||||||
tgz:
|
distro:
|
||||||
ln -s .. remind-$(VERSION)
|
ln -s . ../remind-$(VERSION)
|
||||||
peekentry `find remind-$(VERSION) -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION).tar
|
(cd ..; git-ls-files -x .gitignore) | sed -e 's/^/remind-$(VERSION)\//' | xargs tar -C .. -cvf remind-$(VERSION).tar
|
||||||
gzip -v -9 remind-$(VERSION).tar
|
gzip -f -v -9 remind-$(VERSION).tar
|
||||||
mv remind-$(VERSION).tar.gz remind-$(VERSION).tgz
|
rm -f ../remind-$(VERSION)
|
||||||
rm -f remind-$(VERSION)
|
|
||||||
|
|
||||||
beta-tgz:
|
beta-tgz:
|
||||||
ln -s .. remind-$(VERSION)-BETA
|
ln -s . ../remind-$(VERSION)-BETA-$(BETA)
|
||||||
peekentry `find remind-$(VERSION)-BETA -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION)-BETA.tar
|
(cd ..; git-ls-files -x .gitignore) | sed -e 's/^/remind-$(VERSION)-BETA-$(BETA)\//' | xargs tar -C .. -cvf remind-$(VERSION)-BETA-$(BETA).tar
|
||||||
gzip -v -9 remind-$(VERSION)-BETA.tar
|
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
|
||||||
mv remind-$(VERSION)-BETA.tar.gz remind-$(VERSION)-BETA.tgz
|
rm -f ../remind-$(VERSION)-BETA-$(BETA)
|
||||||
rm -f remind-$(VERSION)-BETA
|
|
||||||
#---------------- Stuff after this added by "make depend" -----------------
|
#---------------- Stuff after this added by "make depend" -----------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
#$Id: Makefile_QDOS,v 1.2 1998-03-01 20:43:53 dfs Exp $
|
|
||||||
# Makefile for REMIND for QDOS / SMSQ
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# THINGS FOR YOU TO EDIT START BELOW
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
# QDOS remark: I made it work the following way, and I found it to be working.
|
|
||||||
CC= cc
|
|
||||||
LD= ld
|
|
||||||
|
|
||||||
# Put any additional flags for the C compiler or linker here - if you
|
|
||||||
# are not using gcc, you probably want to remove '-ansi'.
|
|
||||||
# QDOS remark: no -ansi option and no gcc on QDOS / SMSQ
|
|
||||||
CFLAGS= -V -O -DQDOS
|
|
||||||
CDEFS=
|
|
||||||
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.19
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
OBJS= calendar_o dorem_o dosubst_o expr_o files_o funcs_o globals_o hbcal_o \
|
|
||||||
init_o main_o moon_o omit_o sort_o queue_o token_o trigger_o userfns_o \
|
|
||||||
utils_o var_o
|
|
||||||
|
|
||||||
all: remind rem2ps
|
|
||||||
|
|
||||||
# _c_o:
|
|
||||||
# $(CC) $(UNIX) $(SYSV) -c $(CFLAGS) $(CDEFS) $*_c
|
|
||||||
|
|
||||||
rem2ps: rem2ps_o
|
|
||||||
# $(CC) $(CFLAGS) rem2ps_c
|
|
||||||
$(LD) $(LDFLAGS) -orem2ps rem2ps_o
|
|
||||||
|
|
||||||
remind: $(OBJS)
|
|
||||||
# $(CC) $(CFLAGS) $(SRCS)
|
|
||||||
$(LD) $(LDFLAGS) -oremind $(OBJS) $(MATHLIB)
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *_o *_bak
|
|
||||||
|
|
||||||
clobber:
|
|
||||||
rm -f *_o remind rem2ps test_out *_bak
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
IGNORE=154
|
|
||||||
IGNORE=161
|
|
||||||
IGNORE=100
|
|
||||||
IGNORE=85
|
|
||||||
LINKOPT SC
|
|
||||||
LINKOPT SD
|
|
||||||
LINKOPT NOICONS
|
|
||||||
65
src/amiga.c
65
src/amiga.c
@@ -1,65 +0,0 @@
|
|||||||
/***************************************************************/
|
|
||||||
/* */
|
|
||||||
/* AMIGA.C */
|
|
||||||
/* */
|
|
||||||
/* Support functions for AmigaDOS */
|
|
||||||
/* */
|
|
||||||
/* This file is Copyright (C) 1995 by Martin Hohl */
|
|
||||||
/* */
|
|
||||||
/* This file is part of REMIND. */
|
|
||||||
/* Remind is Copyright (C) 1992-1998 by David F. Skoll */
|
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
|
||||||
#include "config.h"
|
|
||||||
static char const RCSID[] = "$Id: amiga.c,v 1.3 1999-04-05 17:34:42 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <exec/types.h>
|
|
||||||
#include <dos/dos.h>
|
|
||||||
#include <dos/dosextens.h>
|
|
||||||
|
|
||||||
#include <proto/dos.h>
|
|
||||||
|
|
||||||
#include "version.h" /* Hopefully this will define VERSION as a string */
|
|
||||||
|
|
||||||
#ifdef __SASC_60
|
|
||||||
/* AmigaDOS 2.04 compatible version string for "version" utility */
|
|
||||||
const static char ver_string[] = "$VER: remind "VERSION" "__AMIGADATE__;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void sleep(int dt)
|
|
||||||
{
|
|
||||||
register long Ticks;
|
|
||||||
|
|
||||||
if (dt != 0) {
|
|
||||||
Ticks = 50L * dt;
|
|
||||||
Delay(Ticks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void execvp(char *name, char **argvec)
|
|
||||||
{
|
|
||||||
char *cmdline;
|
|
||||||
int i,l;
|
|
||||||
|
|
||||||
l = strlen(name)+2;
|
|
||||||
i=1;
|
|
||||||
while (argvec[i] != 0L) {
|
|
||||||
l += strlen(argvec[i])+1;
|
|
||||||
i++;
|
|
||||||
};
|
|
||||||
cmdline = malloc(l+1);
|
|
||||||
if (cmdline == 0L) return;
|
|
||||||
strcpy(cmdline,name);
|
|
||||||
i=1;
|
|
||||||
while (argvec[i] != 0L) {
|
|
||||||
strcat(cmdline," ");
|
|
||||||
strcat(cmdline,argvec[i]);
|
|
||||||
i++;
|
|
||||||
};
|
|
||||||
system(cmdline);
|
|
||||||
free(cmdline);
|
|
||||||
}
|
|
||||||
770
src/calendar.c
770
src/calendar.c
File diff suppressed because it is too large
Load Diff
@@ -1,80 +1,31 @@
|
|||||||
/* 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. */
|
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||||
#undef HAVE_UTIME_NULL
|
#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>. */
|
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||||
#undef TIME_WITH_SYS_TIME
|
#undef TIME_WITH_SYS_TIME
|
||||||
|
|
||||||
/* Define if your <sys/time.h> declares struct tm. */
|
/* Define if your <sys/time.h> declares struct tm. */
|
||||||
#undef TM_IN_SYS_TIME
|
#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. */
|
/* Define if you have the <sys/file.h> header file. */
|
||||||
#undef HAVE_SYS_FILE_H
|
#undef HAVE_SYS_FILE_H
|
||||||
|
|
||||||
/* Define if you have the <sys/time.h> header file. */
|
/* Define if you have the <glob.h> header file */
|
||||||
#undef HAVE_SYS_TIME_H
|
#undef HAVE_GLOB_H
|
||||||
|
|
||||||
/* Define if you have the <sys/types.h> header file. */
|
#undef HAVE_GLOB
|
||||||
#undef HAVE_SYS_TYPES_H
|
|
||||||
|
|
||||||
/* Define if you have the <unistd.h> header file. */
|
#undef HAVE_SETENV
|
||||||
#undef HAVE_UNISTD_H
|
|
||||||
|
|
||||||
/* Define if you have the m library (-lm). */
|
#undef HAVE_UNSETENV
|
||||||
#undef HAVE_LIBM
|
|
||||||
|
/* The number of bytes in a unsigned int. */
|
||||||
|
#undef SIZEOF_UNSIGNED_INT
|
||||||
|
|
||||||
|
/* The number of bytes in a unsigned long. */
|
||||||
|
#undef SIZEOF_UNSIGNED_LONG
|
||||||
|
|
||||||
|
/* The number of bytes in a unsigned short. */
|
||||||
|
#undef SIZEOF_UNSIGNED_SHORT
|
||||||
|
|
||||||
#include "custom.h"
|
#include "custom.h"
|
||||||
|
|||||||
61
src/custom.h
61
src/custom.h
@@ -7,12 +7,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: custom.h,v 1.19 1999-04-05 17:42:35 dfs Exp $ */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||||
@@ -41,11 +39,11 @@
|
|||||||
/* #define DEFAULT_PAGE {"A4", 595, 842} */
|
/* #define DEFAULT_PAGE {"A4", 595, 842} */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* DATESEP: The default date separator. North American usage is '/'; */
|
/* DATESEP: The default date separator. Standard usage is '-'; */
|
||||||
/* others may prefer '-'. */
|
/* others may prefer '/'. */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define DATESEP '/'
|
#define DATESEP '-'
|
||||||
/* #define DATESEP '-' */
|
/* #define DATESEP '/' */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* TIMESEP: The default time separator. North American usage is ':'; */
|
/* TIMESEP: The default time separator. North American usage is ':'; */
|
||||||
@@ -89,8 +87,7 @@
|
|||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* WANT_U_OPTION: Comment out the next define to permanently disable */
|
/* 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 */
|
/* the -u option. */
|
||||||
/* work. */
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define WANT_U_OPTION 1
|
#define WANT_U_OPTION 1
|
||||||
|
|
||||||
@@ -134,19 +131,16 @@
|
|||||||
#define BASE 1990
|
#define BASE 1990
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* YR_RANGE: The range of years allowed. Computers with 16-bit */
|
/* YR_RANGE: The range of years allowed. With 32-bit signed integers, */
|
||||||
/* integers can handle about 89 years worth of reminders; if */
|
/* the DATETIME type can store 2^31 minutes or about 4074 years. */
|
||||||
/* 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
|
#define YR_RANGE 4000
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
||||||
/* any less than 12. */
|
/* any less than 12. */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define VAR_NAME_LEN 12
|
#define VAR_NAME_LEN 16
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
||||||
@@ -167,7 +161,7 @@
|
|||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define INCLUDE_NEST 8
|
#define INCLUDE_NEST 9
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* IF_NEST: How many nested IFs do we handle? Maximum is the number */
|
/* IF_NEST: How many nested IFs do we handle? Maximum is the number */
|
||||||
@@ -175,35 +169,20 @@
|
|||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define IF_NEST (4*sizeof(unsigned int))
|
#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? */
|
/* How many attempts to resolve a weird date spec? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define TRIG_ATTEMPTS 25
|
#define TRIG_ATTEMPTS 50
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* How many global omits of the form YYYY MM DD do we handle? */
|
/* How many global omits of the form YYYY MM DD do we handle? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define MAX_FULL_OMITS 75
|
#define MAX_FULL_OMITS 250
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* How many global omits of the form MM DD do we handle? */
|
/* How many global omits of the form MM DD do we handle? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define MAX_PARTIAL_OMITS 75
|
#define MAX_PARTIAL_OMITS 250
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* A newline - some systems need "\n\r" */
|
/* A newline - some systems need "\n\r" */
|
||||||
@@ -222,17 +201,9 @@
|
|||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* TAG_LEN: The maximum length of tags. Don't change it */
|
/* TAG_LEN: The maximum length of tags. Don't change it */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define TAG_LEN 32
|
#define TAG_LEN 48
|
||||||
|
|
||||||
#define PASSTHRU_LEN 24
|
#define PASSTHRU_LEN 32
|
||||||
|
|
||||||
#define PUBLIC
|
|
||||||
#define PRIVATE static
|
|
||||||
|
|
||||||
#ifdef UNIX
|
|
||||||
#define _POSIX_SOURCE
|
|
||||||
#define _SVID_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PSBEGIN "# rem2ps begin"
|
#define PSBEGIN "# rem2ps begin"
|
||||||
#define PSEND "# rem2ps end"
|
#define PSEND "# rem2ps end"
|
||||||
|
|||||||
@@ -7,12 +7,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: custom.h.in,v 1.6 1999-04-05 17:34:43 dfs Exp $ */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
|
||||||
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
|
||||||
@@ -41,11 +39,11 @@
|
|||||||
/* #define DEFAULT_PAGE {"A4", 595, 842} */
|
/* #define DEFAULT_PAGE {"A4", 595, 842} */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* DATESEP: The default date separator. North American usage is '/'; */
|
/* DATESEP: The default date separator. Standard usage is '-'; */
|
||||||
/* others may prefer '-'. */
|
/* others may prefer '/'. */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define DATESEP '/'
|
#define DATESEP '-'
|
||||||
/* #define DATESEP '-' */
|
/* #define DATESEP '/' */
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* TIMESEP: The default time separator. North American usage is ':'; */
|
/* TIMESEP: The default time separator. North American usage is ':'; */
|
||||||
@@ -89,8 +87,7 @@
|
|||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* WANT_U_OPTION: Comment out the next define to permanently disable */
|
/* 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 */
|
/* the -u option. */
|
||||||
/* work. */
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define WANT_U_OPTION 1
|
#define WANT_U_OPTION 1
|
||||||
|
|
||||||
@@ -134,19 +131,16 @@
|
|||||||
#define BASE 1990
|
#define BASE 1990
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* YR_RANGE: The range of years allowed. Computers with 16-bit */
|
/* YR_RANGE: The range of years allowed. With 32-bit signed integers, */
|
||||||
/* integers can handle about 89 years worth of reminders; if */
|
/* the DATETIME type can store 2^31 minutes or about 4074 years. */
|
||||||
/* 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
|
#define YR_RANGE 4000
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
|
||||||
/* any less than 12. */
|
/* any less than 12. */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define VAR_NAME_LEN 12
|
#define VAR_NAME_LEN 16
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
/* MAX_PRT_LEN: The maximum number of characters to print when */
|
||||||
@@ -167,7 +161,7 @@
|
|||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define INCLUDE_NEST 8
|
#define INCLUDE_NEST 9
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* IF_NEST: How many nested IFs do we handle? Maximum is the number */
|
/* IF_NEST: How many nested IFs do we handle? Maximum is the number */
|
||||||
@@ -175,35 +169,20 @@
|
|||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define IF_NEST (4*sizeof(unsigned int))
|
#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? */
|
/* How many attempts to resolve a weird date spec? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define TRIG_ATTEMPTS 25
|
#define TRIG_ATTEMPTS 50
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* How many global omits of the form YYYY MM DD do we handle? */
|
/* How many global omits of the form YYYY MM DD do we handle? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define MAX_FULL_OMITS 75
|
#define MAX_FULL_OMITS 250
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* How many global omits of the form MM DD do we handle? */
|
/* How many global omits of the form MM DD do we handle? */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define MAX_PARTIAL_OMITS 75
|
#define MAX_PARTIAL_OMITS 250
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* A newline - some systems need "\n\r" */
|
/* A newline - some systems need "\n\r" */
|
||||||
@@ -222,17 +201,9 @@
|
|||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
/* TAG_LEN: The maximum length of tags. Don't change it */
|
/* TAG_LEN: The maximum length of tags. Don't change it */
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
#define TAG_LEN 32
|
#define TAG_LEN 48
|
||||||
|
|
||||||
#define PASSTHRU_LEN 24
|
#define PASSTHRU_LEN 32
|
||||||
|
|
||||||
#define PUBLIC
|
|
||||||
#define PRIVATE static
|
|
||||||
|
|
||||||
#ifdef UNIX
|
|
||||||
#define _POSIX_SOURCE
|
|
||||||
#define _SVID_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PSBEGIN "# rem2ps begin"
|
#define PSBEGIN "# rem2ps begin"
|
||||||
#define PSEND "# rem2ps end"
|
#define PSEND "# rem2ps end"
|
||||||
|
|||||||
365
src/dorem.c
365
src/dorem.c
@@ -8,24 +8,16 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: dorem.c,v 1.8 1999-04-05 17:34:44 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
@@ -33,20 +25,16 @@ static char const RCSID[] = "$Id: dorem.c,v 1.8 1999-04-05 17:34:44 dfs Exp $";
|
|||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
|
||||||
/* Define the shell characters to escape */
|
/* Define the shell characters not to escape */
|
||||||
static char const EscapeMe[] =
|
static char const DontEscapeMe[] =
|
||||||
#ifdef QDOS
|
"1234567890_-=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@.,";
|
||||||
"\"'!$%^&*()|<>[]{}\x9F~;?\\";
|
|
||||||
#else
|
|
||||||
"\"'!$%^&*()|<>[]{}`~;?\\";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PRIVATE int ParseTimeTrig ARGS ((ParsePtr s, TimeTrig *tim));
|
static int ParseTimeTrig (ParsePtr s, TimeTrig *tim);
|
||||||
PRIVATE int ParseLocalOmit ARGS ((ParsePtr s, Trigger *t));
|
static int ParseLocalOmit (ParsePtr s, Trigger *t);
|
||||||
PRIVATE int ParseScanFrom ARGS ((ParsePtr s, Trigger *t));
|
static int ParseScanFrom (ParsePtr s, Trigger *t, int type);
|
||||||
PRIVATE int ParsePriority ARGS ((ParsePtr s, Trigger *t));
|
static int ParsePriority (ParsePtr s, Trigger *t);
|
||||||
PRIVATE int ParseUntil ARGS ((ParsePtr s, Trigger *t));
|
static int ParseUntil (ParsePtr s, Trigger *t);
|
||||||
PRIVATE int ShouldTriggerBasedOnWarn ARGS ((Trigger *t, int jul));
|
static int ShouldTriggerBasedOnWarn (Trigger *t, int jul);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -55,12 +43,7 @@ PRIVATE int ShouldTriggerBasedOnWarn ARGS ((Trigger *t, int jul));
|
|||||||
/* Do the REM command. */
|
/* Do the REM command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoRem(ParsePtr p)
|
||||||
PUBLIC int DoRem(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoRem(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
Trigger trig;
|
Trigger trig;
|
||||||
@@ -79,6 +62,7 @@ ParsePtr p;
|
|||||||
if (trig.typ == SAT_TYPE) {
|
if (trig.typ == SAT_TYPE) {
|
||||||
r=DoSatRemind(&trig, &tim, p);
|
r=DoSatRemind(&trig, &tim, p);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
|
if (!LastTrigValid) return OK;
|
||||||
r=ParseToken(p, &buf);
|
r=ParseToken(p, &buf);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
FindToken(DBufValue(&buf), &tok);
|
FindToken(DBufValue(&buf), &tok);
|
||||||
@@ -109,9 +93,8 @@ ParsePtr p;
|
|||||||
jul = ComputeTrigger(trig.scanfrom, &trig, &r);
|
jul = ComputeTrigger(trig.scanfrom, &trig, &r);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Queue the reminder, if necessary */
|
/* Queue the reminder, if necessary */
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
if (jul == JulianToday &&
|
if (jul == JulianToday &&
|
||||||
!(!IgnoreOnce &&
|
!(!IgnoreOnce &&
|
||||||
trig.once != NO_ONCE &&
|
trig.once != NO_ONCE &&
|
||||||
@@ -119,15 +102,9 @@ ParsePtr p;
|
|||||||
QueueReminder(p, &trig, &tim, trig.sched);
|
QueueReminder(p, &trig, &tim, trig.sched);
|
||||||
/* If we're in daemon mode, do nothing over here */
|
/* If we're in daemon mode, do nothing over here */
|
||||||
if (Daemon) return OK;
|
if (Daemon) return OK;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (ShouldTriggerReminder(&trig, &tim, jul)) {
|
if (ShouldTriggerReminder(&trig, &tim, jul)) {
|
||||||
#ifdef OS2_POPUP
|
if ( (r=TriggerReminder(p, &trig, &tim, jul)) )
|
||||||
if ( (r=TriggerReminder(p, &trig, &tim, jul, 0)) )
|
|
||||||
#else
|
|
||||||
if ( (r=TriggerReminder(p, &trig, &tim, jul)) )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -144,14 +121,7 @@ ParsePtr p;
|
|||||||
/* trigger structure. */
|
/* trigger structure. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||||
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;
|
register int r;
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
@@ -176,10 +146,12 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
|||||||
trig->sched[0] = 0;
|
trig->sched[0] = 0;
|
||||||
trig->warn[0] = 0;
|
trig->warn[0] = 0;
|
||||||
trig->tag[0] = 0;
|
trig->tag[0] = 0;
|
||||||
|
trig->passthru[0] = 0;
|
||||||
tim->ttime = NO_TIME;
|
tim->ttime = NO_TIME;
|
||||||
tim->delta = NO_DELTA;
|
tim->delta = NO_DELTA;
|
||||||
tim->rep = NO_REP;
|
tim->rep = NO_REP;
|
||||||
tim->duration = NO_TIME;
|
tim->duration = NO_TIME;
|
||||||
|
LastTriggerTime = NO_TIME;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
/* Read space-delimited string */
|
/* Read space-delimited string */
|
||||||
@@ -221,7 +193,7 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
|||||||
|
|
||||||
case T_Scanfrom:
|
case T_Scanfrom:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
r=ParseScanFrom(s, trig);
|
r=ParseScanFrom(s, trig, tok.val);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -314,6 +286,7 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
|||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
switch(tok.type) {
|
switch(tok.type) {
|
||||||
case T_Time:
|
case T_Time:
|
||||||
|
case T_LongTime:
|
||||||
tim->duration = tok.val;
|
tim->duration = tok.val;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -328,6 +301,11 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
|||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_LongTime:
|
||||||
|
DBufFree(&buf);
|
||||||
|
return E_BAD_TIME;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PushToken(DBufValue(&buf), s);
|
PushToken(DBufValue(&buf), s);
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
@@ -344,13 +322,7 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
|||||||
/* ParseTimeTrig - parse the AT part of a timed reminder */
|
/* ParseTimeTrig - parse the AT part of a timed reminder */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
|
||||||
PRIVATE int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
|
|
||||||
#else
|
|
||||||
static int ParseTimeTrig(s, tim)
|
|
||||||
ParsePtr s;
|
|
||||||
TimeTrig *tim;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Token tok;
|
Token tok;
|
||||||
int r;
|
int r;
|
||||||
@@ -396,13 +368,7 @@ PRIVATE int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
|
|||||||
/* reminder. */
|
/* reminder. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ParseLocalOmit(ParsePtr s, Trigger *t)
|
||||||
PRIVATE int ParseLocalOmit(ParsePtr s, Trigger *t)
|
|
||||||
#else
|
|
||||||
static int ParseLocalOmit(s, t)
|
|
||||||
ParsePtr s;
|
|
||||||
Trigger *t;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Token tok;
|
Token tok;
|
||||||
int r;
|
int r;
|
||||||
@@ -432,13 +398,7 @@ PRIVATE int ParseLocalOmit(ParsePtr s, Trigger *t)
|
|||||||
/* ParseUntil - parse the UNTIL portion of a reminder */
|
/* ParseUntil - parse the UNTIL portion of a reminder */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ParseUntil(ParsePtr s, Trigger *t)
|
||||||
PRIVATE int ParseUntil(ParsePtr s, Trigger *t)
|
|
||||||
#else
|
|
||||||
static int ParseUntil(s, t)
|
|
||||||
ParsePtr s;
|
|
||||||
Trigger *t;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y = NO_YR,
|
int y = NO_YR,
|
||||||
m = NO_MON,
|
m = NO_MON,
|
||||||
@@ -503,16 +463,10 @@ PRIVATE int ParseUntil(ParsePtr s, Trigger *t)
|
|||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* ParseScanFrom - parse the SCANFROM portion of a reminder */
|
/* ParseScanFrom - parse the FROM/SCANFROM portion */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
|
||||||
PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|
||||||
#else
|
|
||||||
static int ParseScanFrom(s, t)
|
|
||||||
ParsePtr s;
|
|
||||||
Trigger *t;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y = NO_YR,
|
int y = NO_YR,
|
||||||
m = NO_MON,
|
m = NO_MON,
|
||||||
@@ -521,7 +475,14 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|||||||
Token tok;
|
Token tok;
|
||||||
int r;
|
int r;
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
|
char const *word;
|
||||||
|
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
|
if (type == SCANFROM_TYPE) {
|
||||||
|
word = "SCANFROM";
|
||||||
|
} else {
|
||||||
|
word = "FROM";
|
||||||
|
}
|
||||||
|
|
||||||
if (t->scanfrom != NO_DATE) return E_SCAN_TWICE;
|
if (t->scanfrom != NO_DATE) return E_SCAN_TWICE;
|
||||||
|
|
||||||
@@ -533,7 +494,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|||||||
case T_Year:
|
case T_Year:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (y != NO_YR) {
|
if (y != NO_YR) {
|
||||||
Eprint("SCANFROM: %s", ErrMsg[E_YR_TWICE]);
|
Eprint("%s: %s", word, ErrMsg[E_YR_TWICE]);
|
||||||
return E_YR_TWICE;
|
return E_YR_TWICE;
|
||||||
}
|
}
|
||||||
y = tok.val;
|
y = tok.val;
|
||||||
@@ -542,7 +503,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|||||||
case T_Month:
|
case T_Month:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (m != NO_MON) {
|
if (m != NO_MON) {
|
||||||
Eprint("SCANFROM: %s", ErrMsg[E_MON_TWICE]);
|
Eprint("%s: %s", word, ErrMsg[E_MON_TWICE]);
|
||||||
return E_MON_TWICE;
|
return E_MON_TWICE;
|
||||||
}
|
}
|
||||||
m = tok.val;
|
m = tok.val;
|
||||||
@@ -551,7 +512,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|||||||
case T_Day:
|
case T_Day:
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
if (d != NO_DAY) {
|
if (d != NO_DAY) {
|
||||||
Eprint("SCANFROM: %s", ErrMsg[E_DAY_TWICE]);
|
Eprint("%s: %s", word, ErrMsg[E_DAY_TWICE]);
|
||||||
return E_DAY_TWICE;
|
return E_DAY_TWICE;
|
||||||
}
|
}
|
||||||
d = tok.val;
|
d = tok.val;
|
||||||
@@ -559,7 +520,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
|
||||||
Eprint("SCANFROM: %s", ErrMsg[E_INCOMPLETE]);
|
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
return E_INCOMPLETE;
|
return E_INCOMPLETE;
|
||||||
}
|
}
|
||||||
@@ -568,6 +529,12 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|||||||
return E_BAD_DATE;
|
return E_BAD_DATE;
|
||||||
}
|
}
|
||||||
t->scanfrom = Julian(y, m, d);
|
t->scanfrom = Julian(y, m, d);
|
||||||
|
if (type == FROM_TYPE) {
|
||||||
|
if (t->scanfrom < JulianToday) {
|
||||||
|
t->scanfrom = JulianToday;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PushToken(DBufValue(&buf), s);
|
PushToken(DBufValue(&buf), s);
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
return OK;
|
return OK;
|
||||||
@@ -581,57 +548,53 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
|
|||||||
/* Trigger the reminder if it's a RUN or MSG type. */
|
/* Trigger the reminder if it's a RUN or MSG type. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
|
||||||
#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;
|
int r, y, m, d;
|
||||||
char PrioExpr[25];
|
char PrioExpr[25];
|
||||||
DynamicBuffer buf;
|
char tmpBuf[64];
|
||||||
char *s;
|
DynamicBuffer buf, calRow;
|
||||||
|
DynamicBuffer pre_buf;
|
||||||
|
char const *s;
|
||||||
Value v;
|
Value v;
|
||||||
|
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
|
DBufInit(&calRow);
|
||||||
|
DBufInit(&pre_buf);
|
||||||
if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED;
|
if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED;
|
||||||
if (t->typ == PASSTHRU_TYPE ||
|
if ((t->typ == PASSTHRU_TYPE && strcmp(t->passthru, "COLOR")) ||
|
||||||
t->typ == CAL_TYPE ||
|
t->typ == CAL_TYPE ||
|
||||||
t->typ == PS_TYPE ||
|
t->typ == PS_TYPE ||
|
||||||
t->typ == PSF_TYPE)
|
t->typ == PSF_TYPE)
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
|
/* Handle COLOR types */
|
||||||
|
if (t->typ == PASSTHRU_TYPE && !strcmp(t->passthru, "COLOR")) {
|
||||||
|
/* Strip off three tokens */
|
||||||
|
r = ParseToken(p, &buf);
|
||||||
|
DBufPuts(&pre_buf, DBufValue(&buf));
|
||||||
|
DBufPutc(&pre_buf, ' ');
|
||||||
|
DBufFree(&buf);
|
||||||
|
if (r) return r;
|
||||||
|
r = ParseToken(p, &buf);
|
||||||
|
DBufPuts(&pre_buf, DBufValue(&buf));
|
||||||
|
DBufPutc(&pre_buf, ' ');
|
||||||
|
DBufFree(&buf);
|
||||||
|
if (r) return r;
|
||||||
|
r = ParseToken(p, &buf);
|
||||||
|
DBufPuts(&pre_buf, DBufValue(&buf));
|
||||||
|
DBufPutc(&pre_buf, ' ');
|
||||||
|
DBufFree(&buf);
|
||||||
|
if (r) return r;
|
||||||
|
t->typ = MSG_TYPE;
|
||||||
|
}
|
||||||
/* If it's a MSG-type reminder, and no -k option was used, issue the banner. */
|
/* 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)
|
if ((t->typ == MSG_TYPE || t->typ == MSF_TYPE)
|
||||||
&& !NumTriggered && !NextMode && !MsgCommand) {
|
&& !NumTriggered && !NextMode && !MsgCommand) {
|
||||||
if (!DoSubstFromString(DBufValue(&Banner), &buf,
|
if (!DoSubstFromString(DBufValue(&Banner), &buf,
|
||||||
JulianToday, NO_TIME) &&
|
JulianToday, NO_TIME) &&
|
||||||
DBufLen(&buf)) {
|
DBufLen(&buf)) {
|
||||||
#ifdef OS2_POPUP
|
|
||||||
if (AsPopUp)
|
|
||||||
PutlPopUp(DBufValue(&buf));
|
|
||||||
else
|
|
||||||
printf("%s\n", DBufValue(&buf));
|
|
||||||
#else
|
|
||||||
printf("%s\n", DBufValue(&buf));
|
printf("%s\n", DBufValue(&buf));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
}
|
}
|
||||||
@@ -642,28 +605,65 @@ PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
|
|||||||
if ( (r=DoSubst(p, &buf, t, tim, jul, CAL_MODE)) ) return r;
|
if ( (r=DoSubst(p, &buf, t, tim, jul, CAL_MODE)) ) return r;
|
||||||
if (!DBufLen(&buf)) {
|
if (!DBufLen(&buf)) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
|
DBufFree(&pre_buf);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
FromJulian(jul, &y, &m, &d);
|
FromJulian(jul, &y, &m, &d);
|
||||||
#ifdef OS2_POPUP
|
sprintf(tmpBuf, "%04d/%02d/%02d ", y, m+1, d);
|
||||||
if (AsPopUp) {
|
if (DBufPuts(&calRow, tmpBuf) != OK) {
|
||||||
char tmpBuf[64];
|
DBufFree(&calRow);
|
||||||
sprintf(tmpBuf, "%04d%c%02d%c%02d %s", y, DATESEP, m+1, DATESEP, d,
|
DBufFree(&pre_buf);
|
||||||
SimpleTime(tim->ttime));
|
return E_NO_MEM;
|
||||||
StartPopUp();
|
}
|
||||||
PutsPopUp(tmpBuf);
|
/* If DoSimpleCalendar==1, output *all* simple calendar fields */
|
||||||
PutlPopUp(DBufValue(&buf));
|
if (DoSimpleCalendar) {
|
||||||
}
|
/* ignore passthru field when in NextMode */
|
||||||
else
|
if (DBufPuts(&calRow, "* ") != OK) {
|
||||||
printf("%04d%c%02d%c%02d %s%s\n", y, DATESEP, m+1, DATESEP, d,
|
DBufFree(&calRow);
|
||||||
SimpleTime(tim->ttime),
|
DBufFree(&pre_buf);
|
||||||
DBufValue(&buf));
|
return E_NO_MEM;
|
||||||
#else
|
}
|
||||||
printf("%04d%c%02d%c%02d %s%s\n", y, DATESEP, m+1, DATESEP, d,
|
if (t->tag[0]) {
|
||||||
SimpleTime(tim->ttime),
|
sprintf(tmpBuf, "%s ", t->tag);
|
||||||
DBufValue(&buf));
|
} else {
|
||||||
#endif
|
sprintf(tmpBuf, "* ");
|
||||||
|
}
|
||||||
|
if (DBufPuts(&calRow, tmpBuf) != OK) {
|
||||||
|
DBufFree(&calRow);
|
||||||
|
DBufFree(&pre_buf);
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
if (tim->duration != NO_TIME) {
|
||||||
|
sprintf(tmpBuf, "%d ", tim->duration);
|
||||||
|
} else {
|
||||||
|
sprintf(tmpBuf, "* ");
|
||||||
|
}
|
||||||
|
if (DBufPuts(&calRow, tmpBuf) != OK) {
|
||||||
|
DBufFree(&calRow);
|
||||||
|
DBufFree(&pre_buf);
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
if (tim->ttime != NO_TIME) {
|
||||||
|
sprintf(tmpBuf, "%d ", tim->ttime);
|
||||||
|
} else {
|
||||||
|
sprintf(tmpBuf, "* ");
|
||||||
|
}
|
||||||
|
if (DBufPuts(&calRow, tmpBuf) != OK) {
|
||||||
|
DBufFree(&calRow);
|
||||||
|
DBufFree(&pre_buf);
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DBufPuts(&calRow, SimpleTime(tim->ttime)) != OK) {
|
||||||
|
DBufFree(&calRow);
|
||||||
|
DBufFree(&pre_buf);
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s%s%s\n", DBufValue(&calRow), DBufValue(&pre_buf), DBufValue(&buf));
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
|
DBufFree(&pre_buf);
|
||||||
|
DBufFree(&calRow);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,32 +720,16 @@ PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
|
|||||||
reminder now. */
|
reminder now. */
|
||||||
switch(t->typ) {
|
switch(t->typ) {
|
||||||
case MSG_TYPE:
|
case MSG_TYPE:
|
||||||
|
case PASSTHRU_TYPE:
|
||||||
if (MsgCommand) {
|
if (MsgCommand) {
|
||||||
DoMsgCommand(MsgCommand, DBufValue(&buf));
|
DoMsgCommand(MsgCommand, DBufValue(&buf));
|
||||||
} else {
|
} else {
|
||||||
#ifdef OS2_POPUP
|
|
||||||
if (AsPopUp)
|
|
||||||
PutlPopUp(DBufValue(&buf));
|
|
||||||
else
|
|
||||||
printf("%s", DBufValue(&buf));
|
|
||||||
#else
|
|
||||||
printf("%s", DBufValue(&buf));
|
printf("%s", DBufValue(&buf));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSF_TYPE:
|
case MSF_TYPE:
|
||||||
#ifdef OS2_POPUP
|
|
||||||
if (AsPopUp) {
|
|
||||||
StartPopUp();
|
|
||||||
FillParagraph(DBufValue(&buf), 1);
|
|
||||||
EndPopUp();
|
|
||||||
} else {
|
|
||||||
FillParagraph(DBufValue(&buf), 0);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
FillParagraph(DBufValue(&buf));
|
FillParagraph(DBufValue(&buf));
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RUN_TYPE:
|
case RUN_TYPE:
|
||||||
@@ -771,32 +755,19 @@ PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
|
|||||||
/* triggered. */
|
/* triggered. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef __TURBOC__
|
int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
|
||||||
#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;
|
int r;
|
||||||
|
|
||||||
/* Handle the ONCE modifier in the reminder. */
|
/* Handle the ONCE modifier in the reminder. */
|
||||||
if (!IgnoreOnce && t->once !=NO_ONCE && FileAccessDate == JulianToday)
|
if (!IgnoreOnce && t->once !=NO_ONCE && FileAccessDate == JulianToday)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (jul < JulianToday) return 0;
|
if (jul < JulianToday) return 0;
|
||||||
|
|
||||||
/* Don't trigger timed reminders if DontIssueAts is true, and if the
|
/* Don't trigger timed reminders if DontIssueAts is true, and if the
|
||||||
reminder is for today */
|
reminder is for today */
|
||||||
|
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0;
|
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Don't trigger "old" timed reminders */
|
/* Don't trigger "old" timed reminders */
|
||||||
/*** REMOVED...
|
/*** REMOVED...
|
||||||
@@ -810,6 +781,11 @@ PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
|
|||||||
|
|
||||||
/* If there's a "warn" function, it overrides any deltas */
|
/* If there's a "warn" function, it overrides any deltas */
|
||||||
if (t->warn[0] != 0) {
|
if (t->warn[0] != 0) {
|
||||||
|
if (DeltaOffset) {
|
||||||
|
if (jul <= JulianToday + DeltaOffset) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
return ShouldTriggerBasedOnWarn(t, jul);
|
return ShouldTriggerBasedOnWarn(t, jul);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +803,7 @@ PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Should we trigger the reminder? */
|
/* Should we trigger the reminder? */
|
||||||
return (jul <= JulianToday);
|
return (jul <= JulianToday + DeltaOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@@ -837,21 +813,12 @@ PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
|
|||||||
/* Do the "satisfying..." remind calculation. */
|
/* Do the "satisfying..." remind calculation. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef __TURBOC__
|
int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
|
||||||
#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;
|
int iter, jul, r;
|
||||||
Value v;
|
Value v;
|
||||||
char *s, *t;
|
char const *s;
|
||||||
|
char const *t;
|
||||||
|
|
||||||
t = p->pos;
|
t = p->pos;
|
||||||
iter = 0;
|
iter = 0;
|
||||||
@@ -861,6 +828,9 @@ PUBLIC int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
|
|||||||
if (r) {
|
if (r) {
|
||||||
if (r == E_CANT_TRIG) return OK; else return r;
|
if (r == E_CANT_TRIG) return OK; else return r;
|
||||||
}
|
}
|
||||||
|
if (jul == -1) {
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
s = p->pos;
|
s = p->pos;
|
||||||
r = EvaluateExpr(p, &v);
|
r = EvaluateExpr(p, &v);
|
||||||
t = p->pos;
|
t = p->pos;
|
||||||
@@ -881,16 +851,10 @@ PUBLIC int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
|
|||||||
/* ParsePriority - parse the PRIORITY portion of a reminder */
|
/* ParsePriority - parse the PRIORITY portion of a reminder */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ParsePriority(ParsePtr s, Trigger *t)
|
||||||
PRIVATE int ParsePriority(ParsePtr s, Trigger *t)
|
|
||||||
#else
|
|
||||||
static int ParsePriority(s, t)
|
|
||||||
ParsePtr s;
|
|
||||||
Trigger *t;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int p, r;
|
int p, r;
|
||||||
char *u;
|
char const *u;
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
|
|
||||||
@@ -928,28 +892,21 @@ PRIVATE int ParsePriority(ParsePtr s, Trigger *t)
|
|||||||
/* Execute the '-k' command, escaping shell chars in message. */
|
/* Execute the '-k' command, escaping shell chars in message. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoMsgCommand(char const *cmd, char const *msg)
|
||||||
PUBLIC int DoMsgCommand(char *cmd, char *msg)
|
|
||||||
#else
|
|
||||||
int DoMsgCommand(cmd, msg)
|
|
||||||
char *cmd;
|
|
||||||
char *msg;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
int i, l;
|
int i, l;
|
||||||
DynamicBuffer execBuffer;
|
DynamicBuffer execBuffer;
|
||||||
|
|
||||||
#ifdef WANT_SHELL_ESCAPING
|
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
char *s;
|
char const *s;
|
||||||
|
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
DBufInit(&execBuffer);
|
DBufInit(&execBuffer);
|
||||||
|
|
||||||
/* Escape shell characters in msg INCLUDING WHITESPACE! */
|
/* Escape shell characters in msg INCLUDING WHITESPACE! */
|
||||||
for (s=msg; *s; s++) {
|
for (s=msg; *s; s++) {
|
||||||
if (isspace(*s) || strchr(EscapeMe, *s)) {
|
if (isspace(*s) || !strchr(DontEscapeMe, *s)) {
|
||||||
if (DBufPutc(&buf, '\\') != OK) {
|
if (DBufPutc(&buf, '\\') != OK) {
|
||||||
r = E_NO_MEM;
|
r = E_NO_MEM;
|
||||||
goto finished;
|
goto finished;
|
||||||
@@ -961,12 +918,9 @@ PUBLIC int DoMsgCommand(char *cmd, char *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg = DBufValue(&buf);
|
msg = DBufValue(&buf);
|
||||||
#else
|
|
||||||
DBufInit(&execBuffer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Do "%s" substitution */
|
/* Do "%s" substitution */
|
||||||
l = strlen(cmd)-1;
|
l = strlen(cmd);
|
||||||
for (i=0; i<l; i++) {
|
for (i=0; i<l; i++) {
|
||||||
if (cmd[i] == '%' && cmd[i+1] == 's') {
|
if (cmd[i] == '%' && cmd[i+1] == 's') {
|
||||||
++i;
|
++i;
|
||||||
@@ -981,19 +935,12 @@ PUBLIC int DoMsgCommand(char *cmd, char *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (l >= 0 && DBufPutc(&execBuffer, cmd[l]) != OK) {
|
|
||||||
r = E_NO_MEM;
|
|
||||||
goto finished;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = OK;
|
r = OK;
|
||||||
|
|
||||||
system(DBufValue(&execBuffer));
|
system(DBufValue(&execBuffer));
|
||||||
|
|
||||||
finished:
|
finished:
|
||||||
#ifdef WANT_SHELL_ESCAPING
|
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
#endif
|
|
||||||
DBufFree(&execBuffer);
|
DBufFree(&execBuffer);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -1006,17 +953,11 @@ finished:
|
|||||||
/* function. */
|
/* function. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ShouldTriggerBasedOnWarn(Trigger *t, int jul)
|
||||||
PRIVATE int ShouldTriggerBasedOnWarn(Trigger *t, int jul)
|
|
||||||
#else
|
|
||||||
static int ShouldTriggerBasedOnWarn(t, jul)
|
|
||||||
Trigger *t;
|
|
||||||
int jul;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char buffer[VAR_NAME_LEN+32];
|
char buffer[VAR_NAME_LEN+32];
|
||||||
int i;
|
int i;
|
||||||
char *s;
|
char const *s;
|
||||||
int r;
|
int r;
|
||||||
Value v;
|
Value v;
|
||||||
int lastReturnVal = 0; /* Silence compiler warning */
|
int lastReturnVal = 0; /* Silence compiler warning */
|
||||||
|
|||||||
134
src/dosubst.c
134
src/dosubst.c
@@ -7,32 +7,24 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: dosubst.c,v 1.9 1999-04-05 17:34:44 dfs Exp $";
|
|
||||||
|
|
||||||
#define L_IN_DOSUBST
|
#define L_IN_DOSUBST
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#define UPPER(c) (islower(c) ? toupper(c) : c)
|
#define UPPER(c) (islower(c) ? toupper(c) : (c))
|
||||||
#define ABS(x) ( (x) < 0 ? -(x) : (x) )
|
#define ABS(x) ( (x) < 0 ? -(x) : (x) )
|
||||||
#ifndef NL
|
#ifndef NL
|
||||||
#define NL "\n"
|
#define NL "\n"
|
||||||
@@ -50,18 +42,10 @@ static char TOMORROW[] = L_TOMORROW;
|
|||||||
/* Process the % escapes in the reminder. If */
|
/* Process the % escapes in the reminder. If */
|
||||||
/* mode==NORMAL_MODE, ignore the %" sequence. If */
|
/* mode==NORMAL_MODE, ignore the %" sequence. If */
|
||||||
/* mode==CAL_MODE, process the %" sequence. */
|
/* mode==CAL_MODE, process the %" sequence. */
|
||||||
|
/* If mode==ADVANCE_MODE, ignore %" but don't add newline */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoSubst(ParsePtr p, DynamicBuffer *dbuf, 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, dbuf, t, tt, jul, mode)
|
|
||||||
ParsePtr p;
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
Trigger *t;
|
|
||||||
TimeTrig *tt;
|
|
||||||
int jul, mode;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int diff = jul - JulianToday;
|
int diff = jul - JulianToday;
|
||||||
int curtime = SystemTime(0) / 60;
|
int curtime = SystemTime(0) / 60;
|
||||||
@@ -70,11 +54,12 @@ int jul, mode;
|
|||||||
int d, m, y;
|
int d, m, y;
|
||||||
int tim = tt->ttime;
|
int tim = tt->ttime;
|
||||||
int h, min, hh, ch, cmin, chh;
|
int h, min, hh, ch, cmin, chh;
|
||||||
char *pm, *cpm;
|
char const *pm, *cpm;
|
||||||
int tdiff, adiff, mdiff, hdiff;
|
int tdiff, adiff, mdiff, hdiff;
|
||||||
char *mplu, *hplu, *when, *plu;
|
char const *mplu, *hplu, *when, *plu;
|
||||||
int has_quote = 0;
|
int has_quote = 0;
|
||||||
char *ss, *os;
|
char *ss;
|
||||||
|
char *os;
|
||||||
char s[256];
|
char s[256];
|
||||||
int origLen = DBufLen(dbuf);
|
int origLen = DBufLen(dbuf);
|
||||||
|
|
||||||
@@ -92,14 +77,14 @@ int jul, mode;
|
|||||||
mplu = (mdiff == 1 ? "" : L_MPLU);
|
mplu = (mdiff == 1 ? "" : L_MPLU);
|
||||||
#endif /* L_MPLU_OVER */
|
#endif /* L_MPLU_OVER */
|
||||||
|
|
||||||
#ifdef L_HPLU_OVER
|
#ifdef L_HPLU_OVER
|
||||||
L_HPLU_OVER
|
L_HPLU_OVER
|
||||||
#else /* L_HPLU_OVER */
|
#else /* L_HPLU_OVER */
|
||||||
hplu = (hdiff == 1 ? "" : L_HPLU);
|
hplu = (hdiff == 1 ? "" : L_HPLU);
|
||||||
#endif /* L_HPLU_OVER */
|
#endif /* L_HPLU_OVER */
|
||||||
|
|
||||||
when = (tdiff < 0 ? L_AGO : L_FROMNOW);
|
when = (tdiff < 0 ? L_AGO : L_FROMNOW);
|
||||||
|
|
||||||
h = tim / 60;
|
h = tim / 60;
|
||||||
min = tim % 60;
|
min = tim % 60;
|
||||||
|
|
||||||
@@ -109,7 +94,7 @@ int jul, mode;
|
|||||||
pm = (h < 12) ? L_AM : L_PM;
|
pm = (h < 12) ? L_AM : L_PM;
|
||||||
#endif
|
#endif
|
||||||
hh = (h == 12) ? 12 : h % 12;
|
hh = (h == 12) ? 12 : h % 12;
|
||||||
|
|
||||||
ch = curtime / 60;
|
ch = curtime / 60;
|
||||||
cmin = curtime % 60;
|
cmin = curtime % 60;
|
||||||
|
|
||||||
@@ -127,17 +112,17 @@ int jul, mode;
|
|||||||
case 1:
|
case 1:
|
||||||
case 21:
|
case 21:
|
||||||
case 31: plu = "st"; break;
|
case 31: plu = "st"; break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
case 22: plu = "nd"; break;
|
case 22: plu = "nd"; break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
case 23: plu = "rd"; break;
|
case 23: plu = "rd"; break;
|
||||||
|
|
||||||
default: plu = "th"; break;
|
default: plu = "th"; break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
c = ParseChar(p, &err, 0);
|
c = ParseChar(p, &err, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -146,7 +131,8 @@ int jul, mode;
|
|||||||
}
|
}
|
||||||
if (c == '\n') continue;
|
if (c == '\n') continue;
|
||||||
if (!c) {
|
if (!c) {
|
||||||
if (mode != CAL_MODE && t->typ != RUN_TYPE && !MsgCommand) {
|
if (mode != CAL_MODE && mode != ADVANCE_MODE &&
|
||||||
|
t->typ != RUN_TYPE && !MsgCommand) {
|
||||||
if (DBufPutc(dbuf, '\n') != OK) return E_NO_MEM;
|
if (DBufPutc(dbuf, '\n') != OK) return E_NO_MEM;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -168,10 +154,10 @@ int jul, mode;
|
|||||||
if (diff <= 1) {
|
if (diff <= 1) {
|
||||||
switch(UPPER(c)) {
|
switch(UPPER(c)) {
|
||||||
#ifndef L_NOTOMORROW_A
|
#ifndef L_NOTOMORROW_A
|
||||||
case 'A':
|
case 'A':
|
||||||
#endif
|
#endif
|
||||||
#ifndef L_NOTOMORROW_B
|
#ifndef L_NOTOMORROW_B
|
||||||
case 'B':
|
case 'B':
|
||||||
#endif
|
#endif
|
||||||
#ifndef L_NOTOMORROW_C
|
#ifndef L_NOTOMORROW_C
|
||||||
case 'C':
|
case 'C':
|
||||||
@@ -210,35 +196,35 @@ int jul, mode;
|
|||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: done = 0;
|
default: done = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done) switch(UPPER(c)) {
|
if (!done) switch(UPPER(c)) {
|
||||||
case 'A':
|
case 'A':
|
||||||
#ifdef L_A_OVER
|
#ifdef L_A_OVER
|
||||||
L_A_OVER
|
L_A_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
|
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
|
||||||
MonthName[m], y);
|
MonthName[m], y);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
#ifdef L_B_OVER
|
#ifdef L_B_OVER
|
||||||
L_B_OVER
|
L_B_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, L_INXDAYS, diff);
|
sprintf(s, L_INXDAYS, diff);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
#ifdef L_C_OVER
|
#ifdef L_C_OVER
|
||||||
L_C_OVER
|
L_C_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
|
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
@@ -247,7 +233,7 @@ int jul, mode;
|
|||||||
case 'D':
|
case 'D':
|
||||||
#ifdef L_D_OVER
|
#ifdef L_D_OVER
|
||||||
L_D_OVER
|
L_D_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%d", d);
|
sprintf(s, "%d", d);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
@@ -256,9 +242,9 @@ int jul, mode;
|
|||||||
case 'E':
|
case 'E':
|
||||||
#ifdef L_E_OVER
|
#ifdef L_E_OVER
|
||||||
L_E_OVER
|
L_E_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DATESEP,
|
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DateSep,
|
||||||
m+1, DATESEP, y);
|
m+1, DateSep, y);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -266,8 +252,8 @@ int jul, mode;
|
|||||||
case 'F':
|
case 'F':
|
||||||
#ifdef L_F_OVER
|
#ifdef L_F_OVER
|
||||||
L_F_OVER
|
L_F_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DATESEP, d, DATESEP, y);
|
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DateSep, d, DateSep, y);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -275,7 +261,7 @@ int jul, mode;
|
|||||||
case 'G':
|
case 'G':
|
||||||
#ifdef L_G_OVER
|
#ifdef L_G_OVER
|
||||||
L_G_OVER
|
L_G_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
|
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
@@ -284,8 +270,8 @@ int jul, mode;
|
|||||||
case 'H':
|
case 'H':
|
||||||
#ifdef L_H_OVER
|
#ifdef L_H_OVER
|
||||||
L_H_OVER
|
L_H_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %02d%c%02d", L_ON, d, DATESEP, m+1);
|
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -293,8 +279,8 @@ int jul, mode;
|
|||||||
case 'I':
|
case 'I':
|
||||||
#ifdef L_I_OVER
|
#ifdef L_I_OVER
|
||||||
L_I_OVER
|
L_I_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DATESEP, d);
|
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -323,7 +309,7 @@ int jul, mode;
|
|||||||
#ifdef L_L_OVER
|
#ifdef L_L_OVER
|
||||||
L_L_OVER
|
L_L_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DATESEP, m+1, DATESEP, d);
|
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DateSep, m+1, DateSep, d);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -461,9 +447,9 @@ int jul, mode;
|
|||||||
#ifdef L_1_OVER
|
#ifdef L_1_OVER
|
||||||
L_1_OVER
|
L_1_OVER
|
||||||
#else
|
#else
|
||||||
if (tdiff == 0)
|
if (tdiff == 0)
|
||||||
sprintf(s, "%s", L_NOW);
|
sprintf(s, "%s", L_NOW);
|
||||||
else if (hdiff == 0)
|
else if (hdiff == 0)
|
||||||
sprintf(s, "%d %s%s %s", mdiff, L_MINUTE, mplu, when);
|
sprintf(s, "%d %s%s %s", mdiff, L_MINUTE, mplu, when);
|
||||||
else if (mdiff == 0)
|
else if (mdiff == 0)
|
||||||
sprintf(s, "%d %s%s %s", hdiff, L_HOUR, hplu, when);
|
sprintf(s, "%d %s%s %s", hdiff, L_HOUR, hplu, when);
|
||||||
@@ -478,7 +464,7 @@ int jul, mode;
|
|||||||
#ifdef L_2_OVER
|
#ifdef L_2_OVER
|
||||||
L_2_OVER
|
L_2_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TIMESEP, min, pm);
|
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TimeSep, min, pm);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -488,7 +474,7 @@ int jul, mode;
|
|||||||
L_3_OVER
|
L_3_OVER
|
||||||
#else
|
#else
|
||||||
|
|
||||||
sprintf(s, "%s %02d%c%02d", L_AT, h, TIMESEP, min);
|
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -569,7 +555,7 @@ int jul, mode;
|
|||||||
#ifdef L_AT_OVER
|
#ifdef L_AT_OVER
|
||||||
L_AT_OVER
|
L_AT_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%d%c%02d%s", chh, TIMESEP, cmin, cpm);
|
sprintf(s, "%d%c%02d%s", chh, TimeSep, cmin, cpm);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -578,15 +564,15 @@ int jul, mode;
|
|||||||
#ifdef L_HASH_OVER
|
#ifdef L_HASH_OVER
|
||||||
L_HASH_OVER
|
L_HASH_OVER
|
||||||
#else
|
#else
|
||||||
sprintf(s, "%02d%c%02d", ch, TIMESEP, cmin);
|
sprintf(s, "%02d%c%02d", ch, TimeSep, cmin);
|
||||||
#endif
|
#endif
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '_':
|
case '_':
|
||||||
if (mode != CAL_MODE && !MsgCommand)
|
if (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)
|
||||||
sprintf(s, "%s", NL);
|
sprintf(s, "%s", NL);
|
||||||
else
|
else
|
||||||
sprintf(s, " ");
|
sprintf(s, " ");
|
||||||
SHIP_OUT(s);
|
SHIP_OUT(s);
|
||||||
break;
|
break;
|
||||||
@@ -617,7 +603,7 @@ int jul, mode;
|
|||||||
/* If there are NO quotes, then: If CAL_MODE && RUN_TYPE, we don't want the
|
/* 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. */
|
reminder in the calendar. Zero the output buffer and quit. */
|
||||||
if (!has_quote) {
|
if (!has_quote) {
|
||||||
if (mode == CAL_MODE && t->typ == RUN_TYPE) {
|
if ((mode == ADVANCE_MODE || mode == CAL_MODE) && t->typ == RUN_TYPE) {
|
||||||
*DBufValue(dbuf) = 0;
|
*DBufValue(dbuf) = 0;
|
||||||
dbuf->len = 0;
|
dbuf->len = 0;
|
||||||
}
|
}
|
||||||
@@ -629,7 +615,7 @@ int jul, mode;
|
|||||||
|
|
||||||
ss = DBufValue(dbuf) + origLen;
|
ss = DBufValue(dbuf) + origLen;
|
||||||
os = ss;
|
os = ss;
|
||||||
if (mode == NORMAL_MODE) {
|
if (mode == NORMAL_MODE || mode == ADVANCE_MODE) {
|
||||||
while (*ss) {
|
while (*ss) {
|
||||||
if (*ss != QUOTE_MARKER) *os++ = *ss;
|
if (*ss != QUOTE_MARKER) *os++ = *ss;
|
||||||
ss++;
|
ss++;
|
||||||
@@ -653,7 +639,7 @@ int jul, mode;
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -664,16 +650,8 @@ int jul, mode;
|
|||||||
/* default triggers and a mode of NORMAL_MODE. */
|
/* default triggers and a mode of NORMAL_MODE. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoSubstFromString(char const *source, DynamicBuffer *dbuf,
|
||||||
PUBLIC int DoSubstFromString(char *source, DynamicBuffer *dbuf,
|
|
||||||
int jul, int tim)
|
int jul, int tim)
|
||||||
#else
|
|
||||||
int DoSubstFromString(source, dbuf, jul, tim)
|
|
||||||
char *source;
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
int jul;
|
|
||||||
int tim;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Trigger tempTrig;
|
Trigger tempTrig;
|
||||||
TimeTrig tempTime;
|
TimeTrig tempTime;
|
||||||
@@ -686,7 +664,7 @@ int tim;
|
|||||||
tempP.allownested = 0;
|
tempP.allownested = 0;
|
||||||
tempTrig.typ = MSG_TYPE;
|
tempTrig.typ = MSG_TYPE;
|
||||||
tempTime.ttime = tim;
|
tempTime.ttime = tim;
|
||||||
|
|
||||||
r = DoSubst(&tempP, dbuf, &tempTrig, &tempTime, jul, NORMAL_MODE);
|
r = DoSubst(&tempP, dbuf, &tempTrig, &tempTime, jul, NORMAL_MODE);
|
||||||
DestroyParser(&tempP);
|
DestroyParser(&tempP);
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
62
src/dynbuf.c
62
src/dynbuf.c
@@ -7,25 +7,15 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
static char const RCSID[] =
|
|
||||||
"$Id: dynbuf.c,v 1.3 1999-04-05 17:34:45 dfs Exp $";
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dynbuf.h"
|
#include "dynbuf.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
%FUNCTION: DBufMakeRoom
|
%FUNCTION: DBufMakeRoom
|
||||||
@@ -38,13 +28,7 @@ static char const RCSID[] =
|
|||||||
Doubles the size of dynamic buffer until it has room for at least
|
Doubles the size of dynamic buffer until it has room for at least
|
||||||
'n' characters, not including trailing '\0'
|
'n' characters, not including trailing '\0'
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int DBufMakeRoom(DynamicBuffer *dbuf, int n)
|
||||||
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
|
/* Double size until it's greater than n (strictly > to leave room
|
||||||
for trailing '\0' */
|
for trailing '\0' */
|
||||||
@@ -58,7 +42,7 @@ int n;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory */
|
/* Allocate memory */
|
||||||
buf = (char *) malloc(size);
|
buf = malloc(size);
|
||||||
if (!buf) return E_NO_MEM;
|
if (!buf) return E_NO_MEM;
|
||||||
|
|
||||||
/* Copy contents */
|
/* Copy contents */
|
||||||
@@ -80,12 +64,7 @@ int n;
|
|||||||
%DESCRIPTION:
|
%DESCRIPTION:
|
||||||
Initializes a dynamic buffer
|
Initializes a dynamic buffer
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DBufInit(DynamicBuffer *dbuf)
|
||||||
PUBLIC void DBufInit(DynamicBuffer *dbuf)
|
|
||||||
#else
|
|
||||||
void DBufInit(dbuf)
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
dbuf->buffer = dbuf->staticBuf;
|
dbuf->buffer = dbuf->staticBuf;
|
||||||
dbuf->len = 0;
|
dbuf->len = 0;
|
||||||
@@ -94,7 +73,7 @@ DynamicBuffer *dbuf;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
%FUNCTION: DBufPutc
|
%FUNCTION: DBufPutcFN
|
||||||
%ARGUMENTS:
|
%ARGUMENTS:
|
||||||
dbuf -- pointer to a dynamic buffer
|
dbuf -- pointer to a dynamic buffer
|
||||||
c -- character to append to buffer
|
c -- character to append to buffer
|
||||||
@@ -103,13 +82,7 @@ DynamicBuffer *dbuf;
|
|||||||
%DESCRIPTION:
|
%DESCRIPTION:
|
||||||
Appends a character to the buffer.
|
Appends a character to the buffer.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DBufPutcFN(DynamicBuffer *dbuf, char c)
|
||||||
PUBLIC int DBufPutc(DynamicBuffer *dbuf, char c)
|
|
||||||
#else
|
|
||||||
int DBufPutc(dbuf, c)
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
char c;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (dbuf->allocatedLen == dbuf->len+1) {
|
if (dbuf->allocatedLen == dbuf->len+1) {
|
||||||
if (DBufMakeRoom(dbuf, dbuf->len+1) != OK) return E_NO_MEM;
|
if (DBufMakeRoom(dbuf, dbuf->len+1) != OK) return E_NO_MEM;
|
||||||
@@ -129,13 +102,7 @@ char c;
|
|||||||
%DESCRIPTION:
|
%DESCRIPTION:
|
||||||
Appends a string to the buffer.
|
Appends a string to the buffer.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DBufPuts(DynamicBuffer *dbuf, char const *str)
|
||||||
PUBLIC int DBufPuts(DynamicBuffer *dbuf, char *str)
|
|
||||||
#else
|
|
||||||
int DBufPuts(dbuf, str)
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
char *str;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int l = strlen(str);
|
int l = strlen(str);
|
||||||
if (!l) return OK;
|
if (!l) return OK;
|
||||||
@@ -155,12 +122,7 @@ char *str;
|
|||||||
%DESCRIPTION:
|
%DESCRIPTION:
|
||||||
Frees and reinitializes a dynamic buffer
|
Frees and reinitializes a dynamic buffer
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DBufFree(DynamicBuffer *dbuf)
|
||||||
PUBLIC void DBufFree(DynamicBuffer *dbuf)
|
|
||||||
#else
|
|
||||||
void DBufFree(dbuf)
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (dbuf->buffer != dbuf->staticBuf) free(dbuf->buffer);
|
if (dbuf->buffer != dbuf->staticBuf) free(dbuf->buffer);
|
||||||
DBufInit(dbuf);
|
DBufInit(dbuf);
|
||||||
@@ -177,13 +139,7 @@ DynamicBuffer *dbuf;
|
|||||||
Reads an entire line from a file and appends to dbuf. Does not include
|
Reads an entire line from a file and appends to dbuf. Does not include
|
||||||
trailing newline.
|
trailing newline.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DBufGets(DynamicBuffer *dbuf, FILE *fp)
|
||||||
PUBLIC int DBufGets(DynamicBuffer *dbuf, FILE *fp)
|
|
||||||
#else
|
|
||||||
int DBufGets(dbuf, fp)
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
FILE *fp
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char tmp[256]; /* Safe to hard-code */
|
char tmp[256]; /* Safe to hard-code */
|
||||||
int busy = 1;
|
int busy = 1;
|
||||||
|
|||||||
18
src/dynbuf.h
18
src/dynbuf.h
@@ -6,12 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: dynbuf.h,v 1.2 1999-04-05 17:34:45 dfs Exp $ */
|
|
||||||
|
|
||||||
#ifndef DYNBUF_H
|
#ifndef DYNBUF_H
|
||||||
#define DYNBUF_H
|
#define DYNBUF_H
|
||||||
|
|
||||||
@@ -25,21 +23,15 @@ typedef struct {
|
|||||||
char staticBuf[DBUF_STATIC_SIZE];
|
char staticBuf[DBUF_STATIC_SIZE];
|
||||||
} DynamicBuffer;
|
} DynamicBuffer;
|
||||||
|
|
||||||
#ifndef ARGS
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
#define ARGS(x) x
|
|
||||||
#else
|
|
||||||
#define ARGS(x) ()
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void DBufInit(DynamicBuffer *dbuf);
|
void DBufInit(DynamicBuffer *dbuf);
|
||||||
int DBufPutc(DynamicBuffer *dbuf, char c);
|
int DBufPutcFN(DynamicBuffer *dbuf, char c);
|
||||||
int DBufPuts(DynamicBuffer *dbuf, char *str);
|
int DBufPuts(DynamicBuffer *dbuf, char const *str);
|
||||||
void DBufFree(DynamicBuffer *dbuf);
|
void DBufFree(DynamicBuffer *dbuf);
|
||||||
int DBufGets(DynamicBuffer *dbuf, FILE *fp);
|
int DBufGets(DynamicBuffer *dbuf, FILE *fp);
|
||||||
|
|
||||||
#define DBufValue(bufPtr) ((bufPtr)->buffer)
|
#define DBufValue(bufPtr) ((bufPtr)->buffer)
|
||||||
#define DBufLen(bufPtr) ((bufPtr)->len)
|
#define DBufLen(bufPtr) ((bufPtr)->len)
|
||||||
|
|
||||||
|
#define DBufPutc(dbuf, c) ( (dbuf)->allocatedLen < (dbuf)->len+1 ) ? (dbuf)->buffer[(dbuf)->len++] = c, (dbuf)->buffer[(dbuf)->len] = 0, OK : DBufPutcFN((dbuf), c)
|
||||||
|
|
||||||
#endif /* DYNBUF_H */
|
#endif /* DYNBUF_H */
|
||||||
|
|||||||
14
src/err.h
14
src/err.h
@@ -6,12 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: err.h,v 1.3 1999-04-05 17:34:46 dfs Exp $ */
|
|
||||||
|
|
||||||
/* Note that not all of the "errors" are really errors - some are just
|
/* Note that not all of the "errors" are really errors - some are just
|
||||||
messages for information purposes. Constants beginning with M_ should
|
messages for information purposes. Constants beginning with M_ should
|
||||||
never be returned as error indicators - they should only be used to
|
never be returned as error indicators - they should only be used to
|
||||||
@@ -118,6 +116,8 @@
|
|||||||
#define M_QUEUED 96
|
#define M_QUEUED 96
|
||||||
#define E_EXPECTING_NUMBER 97
|
#define E_EXPECTING_NUMBER 97
|
||||||
#define M_BAD_WARN_FUNC 98
|
#define M_BAD_WARN_FUNC 98
|
||||||
|
#define E_CANT_CONVERT_TZ 99
|
||||||
|
#define E_NO_MATCHING_REMS 100
|
||||||
|
|
||||||
#ifdef MK_GLOBALS
|
#ifdef MK_GLOBALS
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
@@ -190,7 +190,7 @@ EXTERN char *ErrMsg[]
|
|||||||
"Too many partial OMITs",
|
"Too many partial OMITs",
|
||||||
"Too many full OMITs",
|
"Too many full OMITs",
|
||||||
"Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",
|
"Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",
|
||||||
"Error reading file",
|
"Error reading",
|
||||||
"Expecting end-of-line",
|
"Expecting end-of-line",
|
||||||
"Invalid Hebrew date",
|
"Invalid Hebrew date",
|
||||||
"IIF needs odd number of arguments",
|
"IIF needs odd number of arguments",
|
||||||
@@ -206,7 +206,7 @@ EXTERN char *ErrMsg[]
|
|||||||
"Expecting time after AT",
|
"Expecting time after AT",
|
||||||
"UNTIL keyword used twice",
|
"UNTIL keyword used twice",
|
||||||
"Incomplete date specification",
|
"Incomplete date specification",
|
||||||
"SCANFROM keyword used twice",
|
"FROM/SCANFROM keyword used twice",
|
||||||
"Variable",
|
"Variable",
|
||||||
"Value",
|
"Value",
|
||||||
"*UNDEFINED*",
|
"*UNDEFINED*",
|
||||||
@@ -230,7 +230,9 @@ EXTERN char *ErrMsg[]
|
|||||||
"No reminders.",
|
"No reminders.",
|
||||||
"%d reminder(s) queued for later today.\n",
|
"%d reminder(s) queued for later today.\n",
|
||||||
"Expecting number",
|
"Expecting number",
|
||||||
"Bad function in WARN clause"
|
"Bad function in WARN clause",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
}
|
}
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
;
|
;
|
||||||
|
|||||||
465
src/expr.c
465
src/expr.c
@@ -6,24 +6,16 @@
|
|||||||
/* expressions. */
|
/* expressions. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1992-1998 by David F. Skoll */
|
/* Copyright 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: expr.c,v 1.7 1999-04-05 17:34:46 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@@ -42,23 +34,15 @@ static char const RCSID[] = "$Id: expr.c,v 1.7 1999-04-05 17:34:46 dfs Exp $";
|
|||||||
static char CoerceBuf[512];
|
static char CoerceBuf[512];
|
||||||
extern int NumFuncs;
|
extern int NumFuncs;
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
static int Multiply(void), Divide(void), Mod(void), Add(void),
|
||||||
PRIVATE int Multiply(void), Divide(void), Mod(void), Add(void),
|
|
||||||
Subtract(void), GreaterThan(void), LessThan(void),
|
Subtract(void), GreaterThan(void), LessThan(void),
|
||||||
EqualTo(void), NotEqual(void), LessOrEqual(void),
|
EqualTo(void), NotEqual(void), LessOrEqual(void),
|
||||||
GreaterOrEqual(void), LogAND(void), LogOR(void),
|
GreaterOrEqual(void), LogAND(void), LogOR(void),
|
||||||
UnMinus(void), LogNot(void),
|
UnMinus(void), LogNot(void),
|
||||||
Compare(int);
|
Compare(int);
|
||||||
#else
|
|
||||||
PRIVATE int Multiply(), Divide(), Mod(), Add(),
|
|
||||||
Subtract(), GreaterThan(), LessThan(),
|
|
||||||
EqualTo(), NotEqual(), LessOrEqual(),
|
|
||||||
GreaterOrEqual(), LogAND(), LogOR(),
|
|
||||||
UnMinus(), LogNot(), Compare();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PRIVATE int MakeValue ARGS ((char *s, Value *v, Var *locals));
|
static int MakeValue (char const *s, Value *v, Var *locals);
|
||||||
PRIVATE int ParseLiteralDate ARGS ((char **s, int *jul));
|
static int ParseLiteralDate (char const **s, int *jul, int *tim);
|
||||||
|
|
||||||
/* Binary operators - all left-associative */
|
/* Binary operators - all left-associative */
|
||||||
|
|
||||||
@@ -104,12 +88,7 @@ int OpStackPtr, ValStackPtr;
|
|||||||
/* Execute an operator or function with debugging. */
|
/* Execute an operator or function with debugging. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int DebugPerform(Operator *op)
|
||||||
PRIVATE int DebugPerform(Operator *op)
|
|
||||||
#else
|
|
||||||
static int DebugPerform(op)
|
|
||||||
Operator *op;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -140,11 +119,7 @@ Operator *op;
|
|||||||
/* Clean the stack after an error occurs. */
|
/* Clean the stack after an error occurs. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void CleanStack(void)
|
||||||
PRIVATE void CleanStack(void)
|
|
||||||
#else
|
|
||||||
static void CleanStack()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -157,14 +132,9 @@ static void CleanStack()
|
|||||||
/* PeekChar - peek ahead to next char. */
|
/* PeekChar - peek ahead to next char. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static char PeekChar(char const **s)
|
||||||
PRIVATE char PeekChar(char **s)
|
|
||||||
#else
|
|
||||||
static char PeekChar(s)
|
|
||||||
char **s;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *t = *s;
|
char const *t = *s;
|
||||||
while (*t && isspace(*t)) t++;
|
while (*t && isspace(*t)) t++;
|
||||||
return *t;
|
return *t;
|
||||||
}
|
}
|
||||||
@@ -176,21 +146,15 @@ char **s;
|
|||||||
/* Read a token. */
|
/* Read a token. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ParseExprToken(DynamicBuffer *buf, char const **in)
|
||||||
PRIVATE int ParseExprToken(DynamicBuffer *buf, char **in)
|
|
||||||
#else
|
|
||||||
static int ParseExprToken(buf, in)
|
|
||||||
DynamicBuffer *buf;
|
|
||||||
char **in;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
DBufFree(buf);
|
DBufFree(buf);
|
||||||
/* Skip white space */
|
/* Skip white space */
|
||||||
while (**in && isspace(**in)) (*in)++;
|
while (**in && isspace(**in)) (*in)++;
|
||||||
|
|
||||||
if (!**in) return OK;
|
if (!**in) return OK;
|
||||||
|
|
||||||
c = *(*in)++;
|
c = *(*in)++;
|
||||||
@@ -221,7 +185,7 @@ char **in;
|
|||||||
(*in)++;
|
(*in)++;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
case '!':
|
case '!':
|
||||||
case '>':
|
case '>':
|
||||||
case '<':
|
case '<':
|
||||||
@@ -240,6 +204,46 @@ char **in;
|
|||||||
if (c == '\"') {
|
if (c == '\"') {
|
||||||
if (!**in) return E_MISS_QUOTE;
|
if (!**in) return E_MISS_QUOTE;
|
||||||
while (**in) {
|
while (**in) {
|
||||||
|
/* Allow backslash-escapes */
|
||||||
|
if (**in == '\\') {
|
||||||
|
int r;
|
||||||
|
(*in)++;
|
||||||
|
if (!**in) {
|
||||||
|
DBufFree(buf);
|
||||||
|
return E_MISS_QUOTE;
|
||||||
|
}
|
||||||
|
switch(**in) {
|
||||||
|
case 'a':
|
||||||
|
r = DBufPutc(buf, '\a');
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
r = DBufPutc(buf, '\b');
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
r = DBufPutc(buf, '\f');
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
r = DBufPutc(buf, '\n');
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
r = DBufPutc(buf, '\r');
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
r = DBufPutc(buf, '\t');
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
r = DBufPutc(buf, '\v');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
r = DBufPutc(buf, **in);
|
||||||
|
}
|
||||||
|
(*in)++;
|
||||||
|
if (r != OK) {
|
||||||
|
DBufFree(buf);
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
c = *(*in)++;
|
c = *(*in)++;
|
||||||
if (DBufPutc(buf, c) != OK) {
|
if (DBufPutc(buf, c) != OK) {
|
||||||
DBufFree(buf);
|
DBufFree(buf);
|
||||||
@@ -265,6 +269,7 @@ char **in;
|
|||||||
}
|
}
|
||||||
if (c == '\'') return OK;
|
if (c == '\'') return OK;
|
||||||
DBufFree(buf);
|
DBufFree(buf);
|
||||||
|
return E_MISS_QUOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ISID(c) && c != '$') {
|
if (!ISID(c) && c != '$') {
|
||||||
@@ -273,7 +278,7 @@ char **in;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Parse a constant, variable name or function */
|
/* Parse a constant, variable name or function */
|
||||||
while (ISID(**in) || **in == ':' || **in == '.' || **in == TIMESEP) {
|
while (ISID(**in) || **in == ':' || **in == '.' || **in == TimeSep) {
|
||||||
if (DBufPutc(buf, **in) != OK) {
|
if (DBufPutc(buf, **in) != OK) {
|
||||||
DBufFree(buf);
|
DBufFree(buf);
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
@@ -301,13 +306,7 @@ char **in;
|
|||||||
/* Put the result into value pointed to by v. */
|
/* Put the result into value pointed to by v. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int EvalExpr(char const **e, Value *v)
|
||||||
PUBLIC int EvalExpr(char **e, Value *v)
|
|
||||||
#else
|
|
||||||
int EvalExpr(e, v)
|
|
||||||
char **e;
|
|
||||||
Value *v;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -330,13 +329,7 @@ Value *v;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Evaluate - do the actual work of evaluation. */
|
/* Evaluate - do the actual work of evaluation. */
|
||||||
#ifdef HAVE_PROTOS
|
int Evaluate(char const **s, Var *locals)
|
||||||
PUBLIC int Evaluate(char **s, Var *locals)
|
|
||||||
#else
|
|
||||||
int Evaluate(s, locals)
|
|
||||||
char **s;
|
|
||||||
Var *locals;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int OpBase, ValBase;
|
int OpBase, ValBase;
|
||||||
int r;
|
int r;
|
||||||
@@ -344,11 +337,11 @@ Var *locals;
|
|||||||
int args; /* Number of function arguments */
|
int args; /* Number of function arguments */
|
||||||
Operator op, op2;
|
Operator op, op2;
|
||||||
Value va;
|
Value va;
|
||||||
char *ufname = NULL; /* Stop GCC from complaining about use of uninit var */
|
char const *ufname = NULL; /* Stop GCC from complaining about use of uninit var */
|
||||||
|
|
||||||
OpBase = OpStackPtr;
|
OpBase = OpStackPtr;
|
||||||
ValBase = ValStackPtr;
|
ValBase = ValStackPtr;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
/* Looking for a value. Accept: value, unary op, func. call or left paren */
|
/* Looking for a value. Accept: value, unary op, func. call or left paren */
|
||||||
r = ParseExprToken(&ExprBuf, s);
|
r = ParseExprToken(&ExprBuf, s);
|
||||||
@@ -386,7 +379,7 @@ Var *locals;
|
|||||||
if (f) r = CallFunc(f, 0);
|
if (f) r = CallFunc(f, 0);
|
||||||
else {
|
else {
|
||||||
r = CallUserFunc(ufname, 0);
|
r = CallUserFunc(ufname, 0);
|
||||||
free(ufname);
|
free((char *) ufname);
|
||||||
}
|
}
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
r = ParseExprToken(&ExprBuf, s); /* Guaranteed to be right paren. */
|
r = ParseExprToken(&ExprBuf, s); /* Guaranteed to be right paren. */
|
||||||
@@ -396,12 +389,12 @@ Var *locals;
|
|||||||
args++;
|
args++;
|
||||||
r = Evaluate(s, locals);
|
r = Evaluate(s, locals);
|
||||||
if (r) {
|
if (r) {
|
||||||
if (!f) free(ufname);
|
if (!f) free((char *) ufname);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if (*DBufValue(&ExprBuf) == ')') break;
|
if (*DBufValue(&ExprBuf) == ')') break;
|
||||||
else if (*DBufValue(&ExprBuf) != ',') {
|
else if (*DBufValue(&ExprBuf) != ',') {
|
||||||
if (!f) free(ufname);
|
if (!f) free((char *) ufname);
|
||||||
Eprint("%s: `%c'", ErrMsg[E_EXPECT_COMMA],
|
Eprint("%s: `%c'", ErrMsg[E_EXPECT_COMMA],
|
||||||
*DBufValue(&ExprBuf));
|
*DBufValue(&ExprBuf));
|
||||||
DBufFree(&ExprBuf);
|
DBufFree(&ExprBuf);
|
||||||
@@ -411,10 +404,10 @@ Var *locals;
|
|||||||
if (f) r = CallFunc(f, args);
|
if (f) r = CallFunc(f, args);
|
||||||
else {
|
else {
|
||||||
r = CallUserFunc(ufname, args);
|
r = CallUserFunc(ufname, args);
|
||||||
free(ufname);
|
free((char *) ufname);
|
||||||
}
|
}
|
||||||
if (r) return r;
|
|
||||||
DBufFree(&ExprBuf);
|
DBufFree(&ExprBuf);
|
||||||
|
if (r) return r;
|
||||||
}
|
}
|
||||||
} else { /* Unary operator */
|
} else { /* Unary operator */
|
||||||
f = FindFunc(DBufValue(&ExprBuf), UnOp, NUM_UN_OPS);
|
f = FindFunc(DBufValue(&ExprBuf), UnOp, NUM_UN_OPS);
|
||||||
@@ -487,7 +480,7 @@ Var *locals;
|
|||||||
PushOpStack(*f);
|
PushOpStack(*f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* MakeValue */
|
/* MakeValue */
|
||||||
@@ -495,14 +488,7 @@ Var *locals;
|
|||||||
/* a date or the value of a symbol. */
|
/* a date or the value of a symbol. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int MakeValue(char const *s, Value *v, Var *locals)
|
||||||
PRIVATE int MakeValue(char *s, Value *v, Var *locals)
|
|
||||||
#else
|
|
||||||
static int MakeValue(s, v, locals)
|
|
||||||
char *s;
|
|
||||||
Value *v;
|
|
||||||
Var *locals;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
int h, m, r;
|
int h, m, r;
|
||||||
@@ -510,7 +496,7 @@ Var *locals;
|
|||||||
if (*s == '\"') { /* It's a literal string "*/
|
if (*s == '\"') { /* It's a literal string "*/
|
||||||
len = strlen(s)-1;
|
len = strlen(s)-1;
|
||||||
v->type = STR_TYPE;
|
v->type = STR_TYPE;
|
||||||
v->v.str = (char *) malloc(len);
|
v->v.str = malloc(len);
|
||||||
if (! v->v.str) {
|
if (! v->v.str) {
|
||||||
v->type = ERR_TYPE;
|
v->type = ERR_TYPE;
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
@@ -520,10 +506,15 @@ Var *locals;
|
|||||||
return OK;
|
return OK;
|
||||||
} else if (*s == '\'') { /* It's a literal date */
|
} else if (*s == '\'') { /* It's a literal date */
|
||||||
s++;
|
s++;
|
||||||
if ((r=ParseLiteralDate(&s, &h))) return r;
|
if ((r=ParseLiteralDate(&s, &h, &m))) return r;
|
||||||
if (*s != '\'') return E_BAD_DATE;
|
if (*s != '\'') return E_BAD_DATE;
|
||||||
v->type = DATE_TYPE;
|
if (m == NO_TIME) {
|
||||||
v->v.val = h;
|
v->type = DATE_TYPE;
|
||||||
|
v->v.val = h;
|
||||||
|
} else {
|
||||||
|
v->type = DATETIME_TYPE;
|
||||||
|
v->v.val = (h * MINUTES_PER_DAY) + m;
|
||||||
|
}
|
||||||
return OK;
|
return OK;
|
||||||
} else if (isdigit(*s)) { /* It's a number - use len to hold it.*/
|
} else if (isdigit(*s)) { /* It's a number - use len to hold it.*/
|
||||||
len = 0;
|
len = 0;
|
||||||
@@ -531,7 +522,7 @@ Var *locals;
|
|||||||
len *= 10;
|
len *= 10;
|
||||||
len += (*s++ - '0');
|
len += (*s++ - '0');
|
||||||
}
|
}
|
||||||
if (*s == ':' || *s == '.' || *s == TIMESEP) { /* Must be a literal time */
|
if (*s == ':' || *s == '.' || *s == TimeSep) { /* Must be a literal time */
|
||||||
s++;
|
s++;
|
||||||
if (!isdigit(*s)) return E_BAD_TIME;
|
if (!isdigit(*s)) return E_BAD_TIME;
|
||||||
h = len;
|
h = len;
|
||||||
@@ -542,7 +533,7 @@ Var *locals;
|
|||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
if (*s || h>23 || m>59) return E_BAD_TIME;
|
if (*s || h>23 || m>59) return E_BAD_TIME;
|
||||||
v->type = TIM_TYPE;
|
v->type = TIME_TYPE;
|
||||||
v->v.val = h*60 + m;
|
v->v.val = h*60 + m;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -555,7 +546,7 @@ Var *locals;
|
|||||||
if (DebugFlag & DB_PRTEXPR)
|
if (DebugFlag & DB_PRTEXPR)
|
||||||
fprintf(ErrFp, "%s => ", s);
|
fprintf(ErrFp, "%s => ", s);
|
||||||
r = GetSysVar(s+1, v);
|
r = GetSysVar(s+1, v);
|
||||||
|
|
||||||
if (! (DebugFlag & DB_PRTEXPR)) return r;
|
if (! (DebugFlag & DB_PRTEXPR)) return r;
|
||||||
if (r == OK) {
|
if (r == OK) {
|
||||||
PrintValue(v, ErrFp);
|
PrintValue(v, ErrFp);
|
||||||
@@ -568,7 +559,7 @@ Var *locals;
|
|||||||
r = GetVarValue(s, v, locals);
|
r = GetVarValue(s, v, locals);
|
||||||
if (! (DebugFlag & DB_PRTEXPR)) return r;
|
if (! (DebugFlag & DB_PRTEXPR)) return r;
|
||||||
if (r == OK) {
|
if (r == OK) {
|
||||||
PrintValue(v, ErrFp);
|
PrintValue(v, ErrFp);
|
||||||
Putc('\n', ErrFp);
|
Putc('\n', ErrFp);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
@@ -579,30 +570,54 @@ Var *locals;
|
|||||||
/* DoCoerce - actually coerce a value to the specified type. */
|
/* DoCoerce - actually coerce a value to the specified type. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoCoerce(char type, Value *v)
|
||||||
PUBLIC int DoCoerce(char type, Value *v)
|
|
||||||
#else
|
|
||||||
int DoCoerce(type, v)
|
|
||||||
char type;
|
|
||||||
Value *v;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int h, d, m, y, i;
|
int h, d, m, y, i, k;
|
||||||
char *s;
|
char const *s;
|
||||||
|
|
||||||
/* Do nothing if value is already the right type */
|
/* Do nothing if value is already the right type */
|
||||||
if (type == v->type) return OK;
|
if (type == v->type) return OK;
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
case DATETIME_TYPE:
|
||||||
|
switch(v->type) {
|
||||||
|
case INT_TYPE:
|
||||||
|
v->type = DATETIME_TYPE;
|
||||||
|
return OK;
|
||||||
|
case DATE_TYPE:
|
||||||
|
v->type = DATETIME_TYPE;
|
||||||
|
v->v.val *= MINUTES_PER_DAY;
|
||||||
|
return OK;
|
||||||
|
case STR_TYPE:
|
||||||
|
s = v->v.str;
|
||||||
|
if (ParseLiteralDate(&s, &i, &m)) return E_CANT_COERCE;
|
||||||
|
if (*s) return E_CANT_COERCE;
|
||||||
|
v->type = DATETIME_TYPE;
|
||||||
|
free(v->v.str);
|
||||||
|
if (m == NO_TIME) m = 0;
|
||||||
|
v->v.val = i * MINUTES_PER_DAY + m;
|
||||||
|
return OK;
|
||||||
|
default:
|
||||||
|
return E_CANT_COERCE;
|
||||||
|
}
|
||||||
case STR_TYPE:
|
case STR_TYPE:
|
||||||
switch(v->type) {
|
switch(v->type) {
|
||||||
case INT_TYPE: sprintf(CoerceBuf, "%d", v->v.val); break;
|
case INT_TYPE: sprintf(CoerceBuf, "%d", v->v.val); break;
|
||||||
case TIM_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
|
case TIME_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
|
||||||
TIMESEP, v->v.val % 60);
|
TimeSep, v->v.val % 60);
|
||||||
break;
|
break;
|
||||||
case DATE_TYPE: FromJulian(v->v.val, &y, &m, &d);
|
case DATE_TYPE: FromJulian(v->v.val, &y, &m, &d);
|
||||||
sprintf(CoerceBuf, "%04d%c%02d%c%02d",
|
sprintf(CoerceBuf, "%04d%c%02d%c%02d",
|
||||||
y, DATESEP, m+1, DATESEP, d);
|
y, DateSep, m+1, DateSep, d);
|
||||||
|
break;
|
||||||
|
case DATETIME_TYPE:
|
||||||
|
i = v->v.val / MINUTES_PER_DAY;
|
||||||
|
FromJulian(i, &y, &m, &d);
|
||||||
|
k = v->v.val % MINUTES_PER_DAY;
|
||||||
|
h = k / 60;
|
||||||
|
i = k % 60;
|
||||||
|
sprintf(CoerceBuf, "%04d%c%02d%c%02d@%02d%c%02d",
|
||||||
|
y, DateSep, m+1, DateSep, d, h, TimeSep, i);
|
||||||
break;
|
break;
|
||||||
default: return E_CANT_COERCE;
|
default: return E_CANT_COERCE;
|
||||||
}
|
}
|
||||||
@@ -639,7 +654,8 @@ Value *v;
|
|||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
case DATE_TYPE:
|
case DATE_TYPE:
|
||||||
case TIM_TYPE:
|
case TIME_TYPE:
|
||||||
|
case DATETIME_TYPE:
|
||||||
v->type = INT_TYPE;
|
v->type = INT_TYPE;
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
@@ -656,22 +672,28 @@ Value *v;
|
|||||||
|
|
||||||
case STR_TYPE:
|
case STR_TYPE:
|
||||||
s = v->v.str;
|
s = v->v.str;
|
||||||
if (ParseLiteralDate(&s, &i)) return E_CANT_COERCE;
|
if (ParseLiteralDate(&s, &i, &m)) return E_CANT_COERCE;
|
||||||
if (*s) return E_CANT_COERCE;
|
if (*s) return E_CANT_COERCE;
|
||||||
v->type = DATE_TYPE;
|
v->type = DATE_TYPE;
|
||||||
free(v->v.str);
|
free(v->v.str);
|
||||||
v->v.val = i;
|
v->v.val = i;
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
|
case DATETIME_TYPE:
|
||||||
|
v->type = DATE_TYPE;
|
||||||
|
v->v.val /= MINUTES_PER_DAY;
|
||||||
|
return OK;
|
||||||
|
|
||||||
default: return E_CANT_COERCE;
|
default: return E_CANT_COERCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TIM_TYPE:
|
case TIME_TYPE:
|
||||||
switch(v->type) {
|
switch(v->type) {
|
||||||
case INT_TYPE:
|
case INT_TYPE:
|
||||||
v->type = TIM_TYPE;
|
case DATETIME_TYPE:
|
||||||
v->v.val %= 1440;
|
v->type = TIME_TYPE;
|
||||||
if (v->v.val < 0) v->v.val += 1440;
|
v->v.val %= MINUTES_PER_DAY;
|
||||||
|
if (v->v.val < 0) v->v.val += MINUTES_PER_DAY;
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
case STR_TYPE:
|
case STR_TYPE:
|
||||||
@@ -683,7 +705,7 @@ Value *v;
|
|||||||
h *= 10;
|
h *= 10;
|
||||||
h += *s++ - '0';
|
h += *s++ - '0';
|
||||||
}
|
}
|
||||||
if (*s != ':' && *s != '.' && *s != TIMESEP)
|
if (*s != ':' && *s != '.' && *s != TimeSep)
|
||||||
return E_CANT_COERCE;
|
return E_CANT_COERCE;
|
||||||
s++;
|
s++;
|
||||||
if (!isdigit(*s)) return E_CANT_COERCE;
|
if (!isdigit(*s)) return E_CANT_COERCE;
|
||||||
@@ -692,7 +714,7 @@ Value *v;
|
|||||||
m += *s++ - '0';
|
m += *s++ - '0';
|
||||||
}
|
}
|
||||||
if (*s || h>23 || m>59) return E_CANT_COERCE;
|
if (*s || h>23 || m>59) return E_CANT_COERCE;
|
||||||
v->type = TIM_TYPE;
|
v->type = TIME_TYPE;
|
||||||
free(v->v.str);
|
free(v->v.str);
|
||||||
v->v.val = h*60+m;
|
v->v.val = h*60+m;
|
||||||
return OK;
|
return OK;
|
||||||
@@ -710,21 +732,17 @@ Value *v;
|
|||||||
/* Perform addition. */
|
/* Perform addition. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int Add(void)
|
||||||
PRIVATE int Add(void)
|
|
||||||
#else
|
|
||||||
static int Add()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2, v3;
|
Value v1, v2, v3;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
PopValStack(v2);
|
PopValStack(v2);
|
||||||
if ( (r = FnPopValStack(&v1)) ) {
|
if ( (r = FnPopValStack(&v1)) ) {
|
||||||
DestroyValue(v2);
|
DestroyValue(v2);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If both are ints, just add 'em */
|
/* If both are ints, just add 'em */
|
||||||
if (v2.type == INT_TYPE && v1.type == INT_TYPE) {
|
if (v2.type == INT_TYPE && v1.type == INT_TYPE) {
|
||||||
v2.v.val += v1.v.val;
|
v2.v.val += v1.v.val;
|
||||||
@@ -741,16 +759,26 @@ static int Add()
|
|||||||
PushValStack(v1);
|
PushValStack(v1);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a time plus an int, add 'em mod 1440 */
|
/* If it's a datetime plus an int, add 'em */
|
||||||
if ((v1.type == TIM_TYPE && v2.type == INT_TYPE) ||
|
if ((v1.type == DATETIME_TYPE && v2.type == INT_TYPE) ||
|
||||||
(v1.type == INT_TYPE && v2.type == TIM_TYPE)) {
|
(v1.type == INT_TYPE && v2.type == DATETIME_TYPE)) {
|
||||||
v1.v.val = (v1.v.val + v2.v.val) % 1440;
|
v1.v.val += v2.v.val;
|
||||||
if (v1.v.val < 0) v1.v.val += 1440;
|
if (v1.v.val < 0) return E_DATE_OVER;
|
||||||
v1.type = TIM_TYPE;
|
v1.type = DATETIME_TYPE;
|
||||||
PushValStack(v1);
|
PushValStack(v1);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If it's a time plus an int, add 'em mod MINUTES_PER_DAY */
|
||||||
|
if ((v1.type == TIME_TYPE && v2.type == INT_TYPE) ||
|
||||||
|
(v1.type == INT_TYPE && v2.type == TIME_TYPE)) {
|
||||||
|
v1.v.val = (v1.v.val + v2.v.val) % MINUTES_PER_DAY;
|
||||||
|
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
|
||||||
|
v1.type = TIME_TYPE;
|
||||||
|
PushValStack(v1);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* If either is a string, coerce them both to strings and concatenate */
|
/* If either is a string, coerce them both to strings and concatenate */
|
||||||
if (v1.type == STR_TYPE || v2.type == STR_TYPE) {
|
if (v1.type == STR_TYPE || v2.type == STR_TYPE) {
|
||||||
@@ -763,7 +791,7 @@ static int Add()
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
v3.type = STR_TYPE;
|
v3.type = STR_TYPE;
|
||||||
v3.v.str = (char *) malloc(strlen(v1.v.str) + strlen(v2.v.str) + 1);
|
v3.v.str = malloc(strlen(v1.v.str) + strlen(v2.v.str) + 1);
|
||||||
if (!v3.v.str) {
|
if (!v3.v.str) {
|
||||||
DestroyValue(v1); DestroyValue(v2);
|
DestroyValue(v1); DestroyValue(v2);
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
@@ -778,7 +806,7 @@ static int Add()
|
|||||||
/* Don't handle other types yet */
|
/* Don't handle other types yet */
|
||||||
return E_BAD_TYPE;
|
return E_BAD_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Subtract */
|
/* Subtract */
|
||||||
@@ -786,15 +814,11 @@ static int Add()
|
|||||||
/* Perform subtraction. */
|
/* Perform subtraction. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int Subtract(void)
|
||||||
PRIVATE int Subtract(void)
|
|
||||||
#else
|
|
||||||
static int Subtract()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2;
|
Value v1, v2;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
PopValStack(v2);
|
PopValStack(v2);
|
||||||
if ( (r = FnPopValStack(&v1)) ) {
|
if ( (r = FnPopValStack(&v1)) ) {
|
||||||
DestroyValue(v2);
|
DestroyValue(v2);
|
||||||
@@ -816,16 +840,25 @@ static int Subtract()
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a time minus an int, do subtraction mod 1440 */
|
/* If it's a datetime minus an int, do subtraction, checking for underflow */
|
||||||
if (v1.type == TIM_TYPE && v2.type == INT_TYPE) {
|
if (v1.type == DATETIME_TYPE && v2.type == INT_TYPE) {
|
||||||
v1.v.val = (v1.v.val - v2.v.val) % 1440;
|
v1.v.val -= v2.v.val;
|
||||||
if (v1.v.val < 0) v1.v.val += 1440;
|
if (v1.v.val < 0) return E_DATE_OVER;
|
||||||
|
PushValStack(v1);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If it's a time minus an int, do subtraction mod MINUTES_PER_DAY */
|
||||||
|
if (v1.type == TIME_TYPE && v2.type == INT_TYPE) {
|
||||||
|
v1.v.val = (v1.v.val - v2.v.val) % MINUTES_PER_DAY;
|
||||||
|
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
|
||||||
PushValStack(v1);
|
PushValStack(v1);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a time minus a time or a date minus a date, do it */
|
/* If it's a time minus a time or a date minus a date, do it */
|
||||||
if ((v1.type == TIM_TYPE && v2.type == TIM_TYPE) ||
|
if ((v1.type == TIME_TYPE && v2.type == TIME_TYPE) ||
|
||||||
|
(v1.type == DATETIME_TYPE && v2.type == DATETIME_TYPE) ||
|
||||||
(v1.type == DATE_TYPE && v2.type == DATE_TYPE)) {
|
(v1.type == DATE_TYPE && v2.type == DATE_TYPE)) {
|
||||||
v1.v.val -= v2.v.val;
|
v1.v.val -= v2.v.val;
|
||||||
v1.type = INT_TYPE;
|
v1.type = INT_TYPE;
|
||||||
@@ -845,11 +878,7 @@ static int Subtract()
|
|||||||
/* Perform multiplication. */
|
/* Perform multiplication. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int Multiply(void)
|
||||||
PRIVATE int Multiply(void)
|
|
||||||
#else
|
|
||||||
static int Multiply()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2;
|
Value v1, v2;
|
||||||
int r;
|
int r;
|
||||||
@@ -876,11 +905,7 @@ static int Multiply()
|
|||||||
/* Perform division. */
|
/* Perform division. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int Divide(void)
|
||||||
PRIVATE int Divide(void)
|
|
||||||
#else
|
|
||||||
static int Divide()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2;
|
Value v1, v2;
|
||||||
int r;
|
int r;
|
||||||
@@ -908,11 +933,7 @@ static int Divide()
|
|||||||
/* Perform modulus function. */
|
/* Perform modulus function. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int Mod(void)
|
||||||
PRIVATE int Mod(void)
|
|
||||||
#else
|
|
||||||
static int Mod()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2;
|
Value v1, v2;
|
||||||
int r;
|
int r;
|
||||||
@@ -942,21 +963,12 @@ static int Mod()
|
|||||||
/* All the comparison functions. */
|
/* All the comparison functions. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int GreaterThan(void) {return Compare(GT);}
|
||||||
PRIVATE int GreaterThan(void) {return Compare(GT);}
|
static int LessThan(void) {return Compare(LT);}
|
||||||
PRIVATE int LessThan(void) {return Compare(LT);}
|
static int EqualTo(void) {return Compare(EQ);}
|
||||||
PRIVATE int EqualTo(void) {return Compare(EQ);}
|
static int NotEqual(void) {return Compare(NE);}
|
||||||
PRIVATE int NotEqual(void) {return Compare(NE);}
|
static int LessOrEqual(void) {return Compare(LE);}
|
||||||
PRIVATE int LessOrEqual(void) {return Compare(LE);}
|
static int GreaterOrEqual(void) {return Compare(GE);}
|
||||||
PRIVATE int GreaterOrEqual(void) {return Compare(GE);}
|
|
||||||
#else
|
|
||||||
static int GreaterThan() {return Compare(GT);}
|
|
||||||
static int LessThan() {return Compare(LT);}
|
|
||||||
static int EqualTo() {return Compare(EQ);}
|
|
||||||
static int NotEqual() {return Compare(NE);}
|
|
||||||
static int LessOrEqual() {return Compare(LE);}
|
|
||||||
static int GreaterOrEqual() {return Compare(GE);}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -964,12 +976,7 @@ static int GreaterOrEqual() {return Compare(GE);}
|
|||||||
/* Do the actual work of comparison. */
|
/* Do the actual work of comparison. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int Compare(int how)
|
||||||
PRIVATE int Compare(int how)
|
|
||||||
#else
|
|
||||||
static int Compare(how)
|
|
||||||
int how;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2, v3;
|
Value v1, v2, v3;
|
||||||
int r;
|
int r;
|
||||||
@@ -1027,11 +1034,7 @@ int how;
|
|||||||
/* Do logical OR */
|
/* Do logical OR */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int LogOR(void)
|
||||||
PRIVATE int LogOR(void)
|
|
||||||
#else
|
|
||||||
static int LogOR()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2;
|
Value v1, v2;
|
||||||
int r;
|
int r;
|
||||||
@@ -1058,11 +1061,7 @@ static int LogOR()
|
|||||||
/* Do logical AND */
|
/* Do logical AND */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int LogAND(void)
|
||||||
PRIVATE int LogAND(void)
|
|
||||||
#else
|
|
||||||
static int LogAND()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v1, v2;
|
Value v1, v2;
|
||||||
int r;
|
int r;
|
||||||
@@ -1089,11 +1088,7 @@ static int LogAND()
|
|||||||
/* Unary Minus */
|
/* Unary Minus */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int UnMinus(void)
|
||||||
PRIVATE int UnMinus(void)
|
|
||||||
#else
|
|
||||||
static int UnMinus()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value *v = &ValStack[ValStackPtr-1];
|
Value *v = &ValStack[ValStackPtr-1];
|
||||||
if (v->type != INT_TYPE) return E_BAD_TYPE;
|
if (v->type != INT_TYPE) return E_BAD_TYPE;
|
||||||
@@ -1108,11 +1103,7 @@ static int UnMinus()
|
|||||||
/* Logical NOT */
|
/* Logical NOT */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int LogNot(void)
|
||||||
PRIVATE int LogNot(void)
|
|
||||||
#else
|
|
||||||
static int LogNot()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value *v = &ValStack[ValStackPtr-1];
|
Value *v = &ValStack[ValStackPtr-1];
|
||||||
if (v->type != INT_TYPE) return E_BAD_TYPE;
|
if (v->type != INT_TYPE) return E_BAD_TYPE;
|
||||||
@@ -1127,14 +1118,7 @@ static int LogNot()
|
|||||||
/* Find a function. */
|
/* Find a function. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
Operator *FindFunc(char const *name, Operator where[], int num)
|
||||||
Operator *FindFunc(char *name, Operator where[], int num)
|
|
||||||
#else
|
|
||||||
Operator *FindFunc(name, where, num)
|
|
||||||
char *name;
|
|
||||||
Operator where[];
|
|
||||||
int num;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int top=num-1, bot=0;
|
int top=num-1, bot=0;
|
||||||
int mid, r;
|
int mid, r;
|
||||||
@@ -1147,7 +1131,7 @@ int num;
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* PrintValue */
|
/* PrintValue */
|
||||||
@@ -1155,16 +1139,10 @@ int num;
|
|||||||
/* Print a value to stdout for debugging purposes. */
|
/* Print a value to stdout for debugging purposes. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void PrintValue (Value *v, FILE *fp)
|
||||||
PUBLIC void PrintValue (Value *v, FILE *fp)
|
|
||||||
#else
|
|
||||||
void PrintValue(v, fp)
|
|
||||||
Value *v;
|
|
||||||
FILE *fp;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
char *s;
|
char const *s;
|
||||||
|
|
||||||
if (v->type == STR_TYPE) {
|
if (v->type == STR_TYPE) {
|
||||||
s=v->v.str;
|
s=v->v.str;
|
||||||
@@ -1172,13 +1150,18 @@ FILE *fp;
|
|||||||
for (y=0; y<MAX_PRT_LEN && *s; y++) Putc(*s++, fp);
|
for (y=0; y<MAX_PRT_LEN && *s; y++) Putc(*s++, fp);
|
||||||
Putc('"',fp);
|
Putc('"',fp);
|
||||||
if (*s) fprintf(fp, "...");
|
if (*s) fprintf(fp, "...");
|
||||||
}
|
}
|
||||||
else if (v->type == INT_TYPE) fprintf(fp, "%d", v->v.val);
|
else if (v->type == INT_TYPE) fprintf(fp, "%d", v->v.val);
|
||||||
else if (v->type == TIM_TYPE) fprintf(fp, "%02d%c%02d", v->v.val / 60,
|
else if (v->type == TIME_TYPE) fprintf(fp, "%02d%c%02d", v->v.val / 60,
|
||||||
TIMESEP, v->v.val % 60);
|
TimeSep, v->v.val % 60);
|
||||||
else if (v->type == DATE_TYPE) {
|
else if (v->type == DATE_TYPE) {
|
||||||
FromJulian(v->v.val, &y, &m, &d);
|
FromJulian(v->v.val, &y, &m, &d);
|
||||||
fprintf(fp, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
|
fprintf(fp, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
|
||||||
|
}
|
||||||
|
else if (v->type == DATETIME_TYPE) {
|
||||||
|
FromJulian(v->v.val / MINUTES_PER_DAY, &y, &m, &d);
|
||||||
|
fprintf(fp, "%04d%c%02d%c%02d@%02d%c%02d", y, DateSep, m+1, DateSep, d,
|
||||||
|
(v->v.val % MINUTES_PER_DAY) / 60, TimeSep, (v->v.val % MINUTES_PER_DAY) % 60);
|
||||||
}
|
}
|
||||||
else fprintf(fp, "ERR");
|
else fprintf(fp, "ERR");
|
||||||
}
|
}
|
||||||
@@ -1190,12 +1173,7 @@ FILE *fp;
|
|||||||
/* Copy a value. */
|
/* Copy a value. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int CopyValue(Value *dest, const Value *src)
|
||||||
PUBLIC int CopyValue(Value *dest, const Value *src)
|
|
||||||
#else
|
|
||||||
int CopyValue(dest, src)
|
|
||||||
Value *dest, *src;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
dest->type = ERR_TYPE;
|
dest->type = ERR_TYPE;
|
||||||
if (src->type == STR_TYPE) {
|
if (src->type == STR_TYPE) {
|
||||||
@@ -1212,27 +1190,25 @@ Value *dest, *src;
|
|||||||
/* */
|
/* */
|
||||||
/* ParseLiteralDate */
|
/* ParseLiteralDate */
|
||||||
/* */
|
/* */
|
||||||
/* Parse a literal date. Return result in jul, update s. */
|
/* Parse a literal date or datetime. Return result in jul */
|
||||||
|
/* and tim; update s. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ParseLiteralDate(char const **s, int *jul, int *tim)
|
||||||
PRIVATE int ParseLiteralDate(char **s, int *jul)
|
|
||||||
#else
|
|
||||||
static int ParseLiteralDate(s, jul)
|
|
||||||
char **s;
|
|
||||||
int *jul;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
int hour, min;
|
||||||
|
|
||||||
y=0; m=0; d=0;
|
y=0; m=0; d=0;
|
||||||
|
hour=0; min=0;
|
||||||
|
|
||||||
|
*tim = NO_TIME;
|
||||||
if (!isdigit(**s)) return E_BAD_DATE;
|
if (!isdigit(**s)) return E_BAD_DATE;
|
||||||
while (isdigit(**s)) {
|
while (isdigit(**s)) {
|
||||||
y *= 10;
|
y *= 10;
|
||||||
y += *(*s)++ - '0';
|
y += *(*s)++ - '0';
|
||||||
}
|
}
|
||||||
if (**s != '/' && **s != '-' && **s != DATESEP) return E_BAD_DATE;
|
if (**s != '/' && **s != '-' && **s != DateSep) return E_BAD_DATE;
|
||||||
(*s)++;
|
(*s)++;
|
||||||
if (!isdigit(**s)) return E_BAD_DATE;
|
if (!isdigit(**s)) return E_BAD_DATE;
|
||||||
while (isdigit(**s)) {
|
while (isdigit(**s)) {
|
||||||
@@ -1240,7 +1216,7 @@ int *jul;
|
|||||||
m += *(*s)++ - '0';
|
m += *(*s)++ - '0';
|
||||||
}
|
}
|
||||||
m--;
|
m--;
|
||||||
if (**s != '/' && **s != '-' && **s != DATESEP) return E_BAD_DATE;
|
if (**s != '/' && **s != '-' && **s != DateSep) return E_BAD_DATE;
|
||||||
(*s)++;
|
(*s)++;
|
||||||
if (!isdigit(**s)) return E_BAD_DATE;
|
if (!isdigit(**s)) return E_BAD_DATE;
|
||||||
while (isdigit(**s)) {
|
while (isdigit(**s)) {
|
||||||
@@ -1248,9 +1224,26 @@ int *jul;
|
|||||||
d += *(*s)++ - '0';
|
d += *(*s)++ - '0';
|
||||||
}
|
}
|
||||||
if (!DateOK(y, m, d)) return E_BAD_DATE;
|
if (!DateOK(y, m, d)) return E_BAD_DATE;
|
||||||
|
|
||||||
*jul = Julian(y, m, d);
|
*jul = Julian(y, m, d);
|
||||||
|
|
||||||
|
/* Do we have a time part as well? */
|
||||||
|
if (**s == ' ' || **s == '@') {
|
||||||
|
(*s)++;
|
||||||
|
while(isdigit(**s)) {
|
||||||
|
hour *= 10;
|
||||||
|
hour += *(*s)++ - '0';
|
||||||
|
}
|
||||||
|
if (**s != ':' && **s != '.' && **s != TimeSep) return E_BAD_TIME;
|
||||||
|
(*s)++;
|
||||||
|
while(isdigit(**s)) {
|
||||||
|
min *= 10;
|
||||||
|
min += *(*s)++ - '0';
|
||||||
|
}
|
||||||
|
if (hour > 23 || min > 59) return E_BAD_TIME;
|
||||||
|
*tim = hour * 60 + min;
|
||||||
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1263,12 +1256,7 @@ int *jul;
|
|||||||
/* return upon failure. */
|
/* return upon failure. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int FnPopValStack(Value *val)
|
||||||
PUBLIC int FnPopValStack(Value *val)
|
|
||||||
#else
|
|
||||||
int FnPopValStack(val)
|
|
||||||
Value *val;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (ValStackPtr <= 0)
|
if (ValStackPtr <= 0)
|
||||||
return E_VA_STK_UNDER;
|
return E_VA_STK_UNDER;
|
||||||
@@ -1277,4 +1265,3 @@ Value *val;
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
src/expr.h
16
src/expr.h
@@ -6,18 +6,18 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: expr.h,v 1.3 1999-04-05 17:34:48 dfs Exp $ */
|
|
||||||
|
|
||||||
/* Define the types of values */
|
/* Define the types of values */
|
||||||
#define ERR_TYPE 0
|
#define ERR_TYPE 0
|
||||||
#define INT_TYPE 1
|
#define INT_TYPE 1
|
||||||
#define TIM_TYPE 2
|
#define TIME_TYPE 2
|
||||||
#define DATE_TYPE 3
|
#define DATE_TYPE 3
|
||||||
#define STR_TYPE 4
|
#define STR_TYPE 4
|
||||||
|
#define DATETIME_TYPE 5
|
||||||
|
#define SPECIAL_TYPE 6 /* Only for system variables */
|
||||||
|
|
||||||
/* Define stuff for parsing expressions */
|
/* Define stuff for parsing expressions */
|
||||||
#define BEG_OF_EXPR '['
|
#define BEG_OF_EXPR '['
|
||||||
|
|||||||
450
src/files.c
450
src/files.c
@@ -8,12 +8,11 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: files.c,v 1.9 1999-04-05 17:34:48 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -27,28 +26,12 @@ static char const RCSID[] = "$Id: files.c,v 1.9 1999-04-05 17:34:48 dfs Exp $";
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__MSDOS__)
|
#ifdef HAVE_GLOB_H
|
||||||
#include <io.h>
|
#include <glob.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __MSC__
|
|
||||||
#include <dos.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@@ -63,44 +46,72 @@ static char const RCSID[] = "$Id: files.c,v 1.9 1999-04-05 17:34:48 dfs Exp $";
|
|||||||
/* Define the structures needed by the file caching system */
|
/* Define the structures needed by the file caching system */
|
||||||
typedef struct cache {
|
typedef struct cache {
|
||||||
struct cache *next;
|
struct cache *next;
|
||||||
char *text;
|
char const *text;
|
||||||
int LineNo;
|
int LineNo;
|
||||||
} CachedLine;
|
} CachedLine;
|
||||||
|
|
||||||
typedef struct cheader {
|
typedef struct cheader {
|
||||||
struct cheader *next;
|
struct cheader *next;
|
||||||
char *filename;
|
char const *filename;
|
||||||
CachedLine *cache;
|
CachedLine *cache;
|
||||||
#ifdef UNIX
|
|
||||||
int ownedByMe;
|
int ownedByMe;
|
||||||
#endif
|
|
||||||
} CachedFile;
|
} CachedFile;
|
||||||
|
|
||||||
|
/* A linked list of filenames if we INCLUDE /some/directory/ */
|
||||||
|
typedef struct fname_chain {
|
||||||
|
struct fname_chain *next;
|
||||||
|
char const *filename;
|
||||||
|
} FilenameChain;
|
||||||
|
|
||||||
|
/* Cache filename chains for directories */
|
||||||
|
typedef struct directory_fname_chain {
|
||||||
|
struct directory_fname_chain *next;
|
||||||
|
FilenameChain *chain;
|
||||||
|
char const *dirname;
|
||||||
|
} DirectoryFilenameChain;
|
||||||
|
|
||||||
/* Define the structures needed by the INCLUDE file system */
|
/* Define the structures needed by the INCLUDE file system */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *filename;
|
char const *filename;
|
||||||
|
FilenameChain *chain;
|
||||||
int LineNo;
|
int LineNo;
|
||||||
unsigned int IfFlags;
|
unsigned int IfFlags;
|
||||||
int NumIfs;
|
int NumIfs;
|
||||||
long offset;
|
long offset;
|
||||||
CachedLine *CLine;
|
CachedLine *CLine;
|
||||||
#ifdef UNIX
|
|
||||||
int ownedByMe;
|
int ownedByMe;
|
||||||
#endif
|
|
||||||
} IncludeStruct;
|
} IncludeStruct;
|
||||||
|
|
||||||
static CachedFile *CachedFiles = (CachedFile *) NULL;
|
static CachedFile *CachedFiles = (CachedFile *) NULL;
|
||||||
static CachedLine *CLine = (CachedLine *) NULL;
|
static CachedLine *CLine = (CachedLine *) NULL;
|
||||||
|
static DirectoryFilenameChain *CachedDirectoryChains = NULL;
|
||||||
|
|
||||||
static FILE *fp;
|
static FILE *fp;
|
||||||
|
|
||||||
static IncludeStruct IStack[INCLUDE_NEST];
|
static IncludeStruct IStack[INCLUDE_NEST];
|
||||||
static int IStackPtr = 0;
|
static int IStackPtr = 0;
|
||||||
|
|
||||||
PRIVATE int ReadLineFromFile ARGS ((void));
|
static int ReadLineFromFile (void);
|
||||||
PRIVATE int CacheFile ARGS ((const char *fname));
|
static int CacheFile (char const *fname);
|
||||||
PRIVATE void DestroyCache ARGS ((CachedFile *cf));
|
static void DestroyCache (CachedFile *cf);
|
||||||
PRIVATE int CheckSafety ARGS ((void));
|
static int CheckSafety (void);
|
||||||
|
static int PopFile (void);
|
||||||
|
|
||||||
|
static void FreeChainItem(FilenameChain *chain)
|
||||||
|
{
|
||||||
|
if (chain->filename) free((void *) chain->filename);
|
||||||
|
free(chain);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FreeChain(FilenameChain *chain)
|
||||||
|
{
|
||||||
|
FilenameChain *next;
|
||||||
|
while(chain) {
|
||||||
|
next = chain->next;
|
||||||
|
FreeChainItem(chain);
|
||||||
|
chain = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -109,11 +120,7 @@ PRIVATE int CheckSafety ARGS ((void));
|
|||||||
/* Read a line from the file or cache. */
|
/* Read a line from the file or cache. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ReadLine(void)
|
||||||
PUBLIC int ReadLine(void)
|
|
||||||
#else
|
|
||||||
int ReadLine()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -144,11 +151,7 @@ int ReadLine()
|
|||||||
/* Read a line from the file pointed to by fp. */
|
/* Read a line from the file pointed to by fp. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int ReadLineFromFile(void)
|
||||||
PRIVATE int ReadLineFromFile(void)
|
|
||||||
#else
|
|
||||||
static int ReadLineFromFile()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
@@ -173,7 +176,7 @@ static int ReadLineFromFile()
|
|||||||
}
|
}
|
||||||
l = DBufLen(&buf);
|
l = DBufLen(&buf);
|
||||||
if (l && (DBufValue(&buf)[l-1] == '\\')) {
|
if (l && (DBufValue(&buf)[l-1] == '\\')) {
|
||||||
DBufValue(&buf)[l-1] = 0;
|
DBufValue(&buf)[l-1] = '\n';
|
||||||
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
|
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
DBufFree(&LineBuffer);
|
DBufFree(&LineBuffer);
|
||||||
@@ -204,12 +207,7 @@ static int ReadLineFromFile()
|
|||||||
/* ShouldCache is 1, cache the file */
|
/* ShouldCache is 1, cache the file */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int OpenFile(char const *fname)
|
||||||
PUBLIC int OpenFile(const char *fname)
|
|
||||||
#else
|
|
||||||
int OpenFile(fname)
|
|
||||||
char *fname;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
CachedFile *h = CachedFiles;
|
CachedFile *h = CachedFiles;
|
||||||
int r;
|
int r;
|
||||||
@@ -221,14 +219,15 @@ char *fname;
|
|||||||
|
|
||||||
while (h) {
|
while (h) {
|
||||||
if (!strcmp(fname, h->filename)) {
|
if (!strcmp(fname, h->filename)) {
|
||||||
|
if (DebugFlag & DB_TRACE_FILES) {
|
||||||
|
fprintf(ErrFp, "Reading `%s': Found in cache\n", fname);
|
||||||
|
}
|
||||||
CLine = h->cache;
|
CLine = h->cache;
|
||||||
STRSET(FileName, fname);
|
STRSET(FileName, fname);
|
||||||
LineNo = 0;
|
LineNo = 0;
|
||||||
#ifdef UNIX
|
|
||||||
if (!h->ownedByMe) {
|
if (!h->ownedByMe) {
|
||||||
RunDisabled |= RUN_NOTOWNER;
|
RunDisabled |= RUN_NOTOWNER;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (FileName) return OK; else return E_NO_MEM;
|
if (FileName) return OK; else return E_NO_MEM;
|
||||||
}
|
}
|
||||||
h = h->next;
|
h = h->next;
|
||||||
@@ -237,8 +236,14 @@ char *fname;
|
|||||||
/* If it's a dash, then it's stdin */
|
/* If it's a dash, then it's stdin */
|
||||||
if (!strcmp(fname, "-")) {
|
if (!strcmp(fname, "-")) {
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
|
if (DebugFlag & DB_TRACE_FILES) {
|
||||||
|
fprintf(ErrFp, "Reading `-': Reading stdin\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fp = fopen(fname, "r");
|
fp = fopen(fname, "r");
|
||||||
|
if (DebugFlag & DB_TRACE_FILES) {
|
||||||
|
fprintf(ErrFp, "Reading `%s': Opening file on disk\n", fname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!fp || !CheckSafety()) return E_CANT_OPEN;
|
if (!fp || !CheckSafety()) return E_CANT_OPEN;
|
||||||
CLine = NULL;
|
CLine = NULL;
|
||||||
@@ -270,18 +275,16 @@ char *fname;
|
|||||||
/* Returns an indication of success or failure. */
|
/* Returns an indication of success or failure. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int CacheFile(char const *fname)
|
||||||
PRIVATE int CacheFile(const char *fname)
|
|
||||||
#else
|
|
||||||
static int CacheFile(fname)
|
|
||||||
char *fname;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
CachedFile *cf;
|
CachedFile *cf;
|
||||||
CachedLine *cl;
|
CachedLine *cl;
|
||||||
char *s;
|
char const *s;
|
||||||
|
|
||||||
|
if (DebugFlag & DB_TRACE_FILES) {
|
||||||
|
fprintf(ErrFp, "Caching file `%s' in memory\n", fname);
|
||||||
|
}
|
||||||
cl = NULL;
|
cl = NULL;
|
||||||
/* Create a file header */
|
/* Create a file header */
|
||||||
cf = NEW(CachedFile);
|
cf = NEW(CachedFile);
|
||||||
@@ -295,13 +298,12 @@ char *fname;
|
|||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIX
|
|
||||||
if (RunDisabled & RUN_NOTOWNER) {
|
if (RunDisabled & RUN_NOTOWNER) {
|
||||||
cf->ownedByMe = 0;
|
cf->ownedByMe = 0;
|
||||||
} else {
|
} else {
|
||||||
cf->ownedByMe = 1;
|
cf->ownedByMe = 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* Read the file */
|
/* Read the file */
|
||||||
while(fp) {
|
while(fp) {
|
||||||
r = ReadLineFromFile();
|
r = ReadLineFromFile();
|
||||||
@@ -357,17 +359,33 @@ char *fname;
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* NextChainedFile - move to the next chained file in a glob */
|
||||||
|
/* list. */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
static int NextChainedFile(IncludeStruct *i)
|
||||||
|
{
|
||||||
|
while(i->chain) {
|
||||||
|
FilenameChain *cur = i->chain;
|
||||||
|
i->chain = i->chain->next;
|
||||||
|
if (OpenFile(cur->filename) == OK) {
|
||||||
|
return OK;
|
||||||
|
} else {
|
||||||
|
Eprint("%s: %s", ErrMsg[E_CANT_OPEN], cur->filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return E_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* PopFile - we've reached the end. Pop up to the previous */
|
/* PopFile - we've reached the end. Pop up to the previous */
|
||||||
/* file, or return E_EOF */
|
/* file, or return E_EOF */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int PopFile(void)
|
||||||
PUBLIC int PopFile(void)
|
|
||||||
#else
|
|
||||||
int PopFile()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
IncludeStruct *i;
|
IncludeStruct *i;
|
||||||
|
|
||||||
@@ -376,8 +394,21 @@ int PopFile()
|
|||||||
|
|
||||||
if (!Hush && NumIfs) Eprint("%s", ErrMsg[E_MISS_ENDIF]);
|
if (!Hush && NumIfs) Eprint("%s", ErrMsg[E_MISS_ENDIF]);
|
||||||
if (!IStackPtr) return E_EOF;
|
if (!IStackPtr) return E_EOF;
|
||||||
|
i = &IStack[IStackPtr-1];
|
||||||
|
|
||||||
|
if (i->chain) {
|
||||||
|
int oldRunDisabled = RunDisabled;
|
||||||
|
if (NextChainedFile(i) == OK) {
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
RunDisabled = oldRunDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IStackPtr <= 1) {
|
||||||
|
return E_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
IStackPtr--;
|
IStackPtr--;
|
||||||
i = &IStack[IStackPtr];
|
|
||||||
|
|
||||||
LineNo = i->LineNo;
|
LineNo = i->LineNo;
|
||||||
IfFlags = i->IfFlags;
|
IfFlags = i->IfFlags;
|
||||||
@@ -385,11 +416,9 @@ int PopFile()
|
|||||||
CLine = i->CLine;
|
CLine = i->CLine;
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
STRSET(FileName, i->filename);
|
STRSET(FileName, i->filename);
|
||||||
#ifdef UNIX
|
|
||||||
if (!i->ownedByMe) {
|
if (!i->ownedByMe) {
|
||||||
RunDisabled |= RUN_NOTOWNER;
|
RunDisabled |= RUN_NOTOWNER;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (!CLine && (i->offset != -1L)) {
|
if (!CLine && (i->offset != -1L)) {
|
||||||
/* We must open the file, then seek to specified position */
|
/* We must open the file, then seek to specified position */
|
||||||
if (strcmp(i->filename, "-")) {
|
if (strcmp(i->filename, "-")) {
|
||||||
@@ -401,7 +430,7 @@ int PopFile()
|
|||||||
if (fp != stdin)
|
if (fp != stdin)
|
||||||
(void) fseek(fp, i->offset, 0); /* Trust that it works... */
|
(void) fseek(fp, i->offset, 0); /* Trust that it works... */
|
||||||
}
|
}
|
||||||
free(i->filename);
|
free((char *) i->filename);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,19 +441,14 @@ int PopFile()
|
|||||||
/* The INCLUDE command. */
|
/* The INCLUDE command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoInclude(ParsePtr p)
|
||||||
PUBLIC int DoInclude(ParsePtr p)
|
{
|
||||||
#else
|
|
||||||
int DoInclude(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
int r, e;
|
int r, e;
|
||||||
|
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
if ( (r=ParseToken(p, &buf)) ) return r;
|
if ( (r=ParseToken(p, &buf)) ) return r;
|
||||||
e = VerifyEoln(p);
|
e = VerifyEoln(p);
|
||||||
if (e) Eprint("%s", ErrMsg[e]);
|
if (e) Eprint("%s", ErrMsg[e]);
|
||||||
if ( (r=IncludeFile(DBufValue(&buf))) ) {
|
if ( (r=IncludeFile(DBufValue(&buf))) ) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
@@ -436,6 +460,114 @@ ParsePtr p;
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GLOB
|
||||||
|
static int SetupGlobChain(char const *dirname, IncludeStruct *i)
|
||||||
|
{
|
||||||
|
DynamicBuffer pattern;
|
||||||
|
char *dir;
|
||||||
|
size_t l;
|
||||||
|
int r;
|
||||||
|
glob_t glob_buf;
|
||||||
|
DirectoryFilenameChain *dc = CachedDirectoryChains;
|
||||||
|
|
||||||
|
i->chain = NULL;
|
||||||
|
if (!*dirname) return E_CANT_OPEN;
|
||||||
|
|
||||||
|
dir = StrDup(dirname);
|
||||||
|
if (!dir) return E_NO_MEM;
|
||||||
|
|
||||||
|
/* Strip trailing slashes off directory */
|
||||||
|
l = strlen(dir);
|
||||||
|
while(l) {
|
||||||
|
if (*(dir+l-1) == '/') {
|
||||||
|
l--;
|
||||||
|
*(dir+l) = 0;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Repair root directory :-) */
|
||||||
|
if (!l) {
|
||||||
|
*dir = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check the cache */
|
||||||
|
while(dc) {
|
||||||
|
if (!strcmp(dc->dirname, dir)) {
|
||||||
|
free(dir);
|
||||||
|
i->chain = dc->chain;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
dc = dc->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ShouldCache) {
|
||||||
|
dc = malloc(sizeof(DirectoryFilenameChain));
|
||||||
|
if (dc) {
|
||||||
|
dc->dirname = StrDup(dir);
|
||||||
|
if (!dc->dirname) {
|
||||||
|
free(dc);
|
||||||
|
dc = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dc) {
|
||||||
|
dc->chain = NULL;
|
||||||
|
dc->next = CachedDirectoryChains;
|
||||||
|
CachedDirectoryChains = dc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DBufInit(&pattern);
|
||||||
|
DBufPuts(&pattern, dir);
|
||||||
|
DBufPuts(&pattern, "/*.rem");
|
||||||
|
free(dir);
|
||||||
|
|
||||||
|
r = glob(DBufValue(&pattern), 0, NULL, &glob_buf);
|
||||||
|
DBufFree(&pattern);
|
||||||
|
|
||||||
|
if (r == GLOB_NOMATCH) {
|
||||||
|
globfree(&glob_buf);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r != 0) {
|
||||||
|
globfree(&glob_buf);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add the files to the chain backwards to preserve sort order */
|
||||||
|
for (r=glob_buf.gl_pathc-1; r>=0; r--) {
|
||||||
|
FilenameChain *ch = malloc(sizeof(FilenameChain));
|
||||||
|
if (!ch) {
|
||||||
|
globfree(&glob_buf);
|
||||||
|
FreeChain(i->chain);
|
||||||
|
i->chain = NULL;
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: stat the file and only add if it's a plain file and
|
||||||
|
readable by us */
|
||||||
|
ch->filename = StrDup(glob_buf.gl_pathv[r]);
|
||||||
|
if (!ch->filename) {
|
||||||
|
globfree(&glob_buf);
|
||||||
|
FreeChain(i->chain);
|
||||||
|
i->chain = NULL;
|
||||||
|
free(ch);
|
||||||
|
return E_NO_MEM;
|
||||||
|
}
|
||||||
|
ch->next = i->chain;
|
||||||
|
i->chain = ch;
|
||||||
|
}
|
||||||
|
if (dc) {
|
||||||
|
dc->chain = i->chain;
|
||||||
|
}
|
||||||
|
|
||||||
|
globfree(&glob_buf);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* IncludeFile */
|
/* IncludeFile */
|
||||||
@@ -444,34 +576,33 @@ ParsePtr p;
|
|||||||
/* inclusion. */
|
/* inclusion. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int IncludeFile(char const *fname)
|
||||||
PUBLIC int IncludeFile(const char *fname)
|
|
||||||
#else
|
|
||||||
int IncludeFile(fname)
|
|
||||||
char *fname;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
IncludeStruct *i;
|
IncludeStruct *i;
|
||||||
int r;
|
|
||||||
int oldRunDisabled;
|
int oldRunDisabled;
|
||||||
|
struct stat statbuf;
|
||||||
|
|
||||||
|
FreshLine = 1;
|
||||||
if (IStackPtr+1 >= INCLUDE_NEST) return E_NESTED_INCLUDE;
|
if (IStackPtr+1 >= INCLUDE_NEST) return E_NESTED_INCLUDE;
|
||||||
i = &IStack[IStackPtr];
|
i = &IStack[IStackPtr];
|
||||||
|
|
||||||
i->filename = StrDup(FileName);
|
if (FileName) {
|
||||||
if (!i->filename) return E_NO_MEM;
|
i->filename = StrDup(FileName);
|
||||||
|
if (!i->filename) return E_NO_MEM;
|
||||||
|
} else {
|
||||||
|
i->filename = NULL;
|
||||||
|
}
|
||||||
i->LineNo = LineNo;
|
i->LineNo = LineNo;
|
||||||
i->NumIfs = NumIfs;
|
i->NumIfs = NumIfs;
|
||||||
i->IfFlags = IfFlags;
|
i->IfFlags = IfFlags;
|
||||||
i->CLine = CLine;
|
i->CLine = CLine;
|
||||||
i->offset = -1L;
|
i->offset = -1L;
|
||||||
#ifdef UNIX
|
i->chain = NULL;
|
||||||
if (RunDisabled & RUN_NOTOWNER) {
|
if (RunDisabled & RUN_NOTOWNER) {
|
||||||
i->ownedByMe = 0;
|
i->ownedByMe = 0;
|
||||||
} else {
|
} else {
|
||||||
i->ownedByMe = 1;
|
i->ownedByMe = 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (fp) {
|
if (fp) {
|
||||||
i->offset = ftell(fp);
|
i->offset = ftell(fp);
|
||||||
FCLOSE(fp);
|
FCLOSE(fp);
|
||||||
@@ -479,15 +610,55 @@ char *fname;
|
|||||||
|
|
||||||
IStackPtr++;
|
IStackPtr++;
|
||||||
|
|
||||||
|
#ifdef HAVE_GLOB
|
||||||
|
/* If it's a directory, set up the glob chain here. */
|
||||||
|
if (stat(fname, &statbuf) == 0) {
|
||||||
|
FilenameChain *fc;
|
||||||
|
if (S_ISDIR(statbuf.st_mode)) {
|
||||||
|
if (DebugFlag & DB_TRACE_FILES) {
|
||||||
|
fprintf(ErrFp, "Scanning directory `%s' for *.rem files\n", fname);
|
||||||
|
}
|
||||||
|
if (SetupGlobChain(fname, i) == OK) { /* Glob succeeded */
|
||||||
|
if (!i->chain) { /* Oops... no matching files */
|
||||||
|
if (!Hush) {
|
||||||
|
Eprint("%s: %s", fname, ErrMsg[E_NO_MATCHING_REMS]);
|
||||||
|
}
|
||||||
|
PopFile();
|
||||||
|
return E_NO_MATCHING_REMS;
|
||||||
|
}
|
||||||
|
while(i->chain) {
|
||||||
|
fc = i->chain;
|
||||||
|
i->chain = i->chain->next;
|
||||||
|
|
||||||
|
/* Munch first file */
|
||||||
|
oldRunDisabled = RunDisabled;
|
||||||
|
if (!OpenFile(fc->filename)) {
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
Eprint("%s: %s", ErrMsg[E_CANT_OPEN], fc->filename);
|
||||||
|
RunDisabled = oldRunDisabled;
|
||||||
|
}
|
||||||
|
/* Couldn't open anything... bail */
|
||||||
|
return PopFile();
|
||||||
|
} else {
|
||||||
|
if (!Hush) {
|
||||||
|
Eprint("%s: %s", fname, ErrMsg[E_NO_MATCHING_REMS]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return E_NO_MATCHING_REMS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
oldRunDisabled = RunDisabled;
|
oldRunDisabled = RunDisabled;
|
||||||
/* Try to open the new file */
|
/* Try to open the new file */
|
||||||
if (!OpenFile(fname)) {
|
if (!OpenFile(fname)) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
RunDisabled = oldRunDisabled;
|
RunDisabled = oldRunDisabled;
|
||||||
/* Ugh! We failed! */
|
|
||||||
if ( (r=PopFile()) ) return r;
|
|
||||||
Eprint("%s: %s", ErrMsg[E_CANT_OPEN], fname);
|
Eprint("%s: %s", ErrMsg[E_CANT_OPEN], fname);
|
||||||
|
/* Ugh! We failed! */
|
||||||
|
PopFile();
|
||||||
return E_CANT_OPEN;
|
return E_CANT_OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,22 +667,13 @@ char *fname;
|
|||||||
/* GetAccessDate - get the access date of a file. */
|
/* GetAccessDate - get the access date of a file. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int GetAccessDate(char const *file)
|
||||||
PUBLIC int GetAccessDate(char *file)
|
|
||||||
#else
|
|
||||||
int GetAccessDate(file)
|
|
||||||
char *file;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
struct tm *t1;
|
struct tm *t1;
|
||||||
|
|
||||||
if (stat(file, &statbuf)) return -1;
|
if (stat(file, &statbuf)) return -1;
|
||||||
#ifdef __TURBOC__
|
|
||||||
t1 = localtime( (time_t *) &(statbuf.st_atime) );
|
|
||||||
#else
|
|
||||||
t1 = localtime(&(statbuf.st_atime));
|
t1 = localtime(&(statbuf.st_atime));
|
||||||
#endif
|
|
||||||
|
|
||||||
if (t1->tm_year + 1900 < BASE)
|
if (t1->tm_year + 1900 < BASE)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -519,71 +681,6 @@ char *file;
|
|||||||
return Julian(t1->tm_year+1900, t1->tm_mon, t1->tm_mday);
|
return Julian(t1->tm_year+1900, t1->tm_mon, t1->tm_mday);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
/* */
|
|
||||||
/* SetAccessDate */
|
|
||||||
/* */
|
|
||||||
/* Used only by DOS to set access date after we close the */
|
|
||||||
/* file. Not needed for UNIX. */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
|
||||||
#if defined(__MSDOS__)
|
|
||||||
/*
|
|
||||||
* WARNING WARNING WARNING WARNING
|
|
||||||
* In the version of Turbo C which I have, there is a bug in the
|
|
||||||
* stdio.h file. The following lines correct the bug. YOU MAY
|
|
||||||
* HAVE TO REMOVE THESE LINES FOR LATER VERSIONS OF TURBOC
|
|
||||||
*/
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
#ifndef fileno
|
|
||||||
#define fileno(f) ((f)->fd)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PUBLIC int SetAccessDate(char *fname, int jul)
|
|
||||||
#else
|
|
||||||
int SetAccessDate(fname, jul)
|
|
||||||
char *fname;
|
|
||||||
int jul;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
int y, m, d;
|
|
||||||
struct ftime ft;
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
FromJulian(jul, &y, &m, &d);
|
|
||||||
ft.ft_tsec = 0;
|
|
||||||
ft.ft_min = 0;
|
|
||||||
ft.ft_hour = 12; /* Arbitrarily set time to noon. */
|
|
||||||
ft.ft_day = (unsigned int) d;
|
|
||||||
ft.ft_month = (unsigned int) m+1;
|
|
||||||
ft.ft_year = (unsigned int) (y - 1980);
|
|
||||||
|
|
||||||
f = fopen(fname, "r");
|
|
||||||
if (!f || setftime(fileno(f) , &ft)) {
|
|
||||||
|
|
||||||
#else /* Must be MSC */
|
|
||||||
if (utime(fname, (struct utimbuf *) NULL)) {
|
|
||||||
#endif
|
|
||||||
fprintf(ErrFp, ErrMsg[M_CANTSET_ACCESS], fname);
|
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
if (f) FCLOSE(f);
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
FCLOSE(f);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* __MSDOS__ */
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* DestroyCache */
|
/* DestroyCache */
|
||||||
@@ -591,19 +688,14 @@ int jul;
|
|||||||
/* Free all the memory used by a cached file. */
|
/* Free all the memory used by a cached file. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void DestroyCache(CachedFile *cf)
|
||||||
PRIVATE void DestroyCache(CachedFile *cf)
|
|
||||||
#else
|
|
||||||
static void DestroyCache(cf)
|
|
||||||
CachedFile *cf;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
CachedLine *cl, *cnext;
|
CachedLine *cl, *cnext;
|
||||||
CachedFile *temp;
|
CachedFile *temp;
|
||||||
if (cf->filename) free(cf->filename);
|
if (cf->filename) free((char *) cf->filename);
|
||||||
cl = cf->cache;
|
cl = cf->cache;
|
||||||
while (cl) {
|
while (cl) {
|
||||||
if (cl->text) free (cl->text);
|
if (cl->text) free ((char *) cl->text);
|
||||||
cnext = cl->next;
|
cnext = cl->next;
|
||||||
free(cl);
|
free(cl);
|
||||||
cl = cnext;
|
cl = cnext;
|
||||||
@@ -629,11 +721,7 @@ CachedFile *cf;
|
|||||||
/* Returns 1 if current file is top level, 0 otherwise. */
|
/* Returns 1 if current file is top level, 0 otherwise. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int TopLevel(void)
|
||||||
PUBLIC int TopLevel(void)
|
|
||||||
#else
|
|
||||||
int TopLevel()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return !IStackPtr;
|
return !IStackPtr;
|
||||||
}
|
}
|
||||||
@@ -649,13 +737,8 @@ int TopLevel()
|
|||||||
/* who we're running as. */
|
/* who we're running as. */
|
||||||
/* As a side effect, if we don't own the file, we disable RUN */
|
/* As a side effect, if we don't own the file, we disable RUN */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int CheckSafety(void)
|
||||||
PRIVATE int CheckSafety(void)
|
|
||||||
#else
|
|
||||||
static int CheckSafety()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef UNIX
|
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
if (fp == stdin) {
|
if (fp == stdin) {
|
||||||
@@ -695,6 +778,5 @@ static int CheckSafety()
|
|||||||
RunDisabled |= RUN_NOTOWNER;
|
RunDisabled |= RUN_NOTOWNER;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
1472
src/funcs.c
1472
src/funcs.c
File diff suppressed because it is too large
Load Diff
@@ -9,15 +9,15 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: globals.c,v 1.3 1999-04-05 17:34:50 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h> /* For defintion of FILE - sigh! */
|
#include <stdio.h> /* For defintion of FILE - sigh! */
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "custom.h"
|
||||||
#define MK_GLOBALS
|
#define MK_GLOBALS
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
|
|||||||
@@ -8,12 +8,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: globals.h,v 1.6 1999-04-05 17:34:50 dfs Exp $ */
|
|
||||||
|
|
||||||
#ifdef MK_GLOBALS
|
#ifdef MK_GLOBALS
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#define EXTERN
|
#define EXTERN
|
||||||
@@ -24,6 +22,8 @@
|
|||||||
#define INIT(var, val) var
|
#define INIT(var, val) var
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MINUTES_PER_DAY 1440
|
||||||
|
|
||||||
#define DaysInYear(y) (((y) % 4) ? 365 : ((!((y) % 100) && ((y) % 400)) ? 365 : 366 ))
|
#define DaysInYear(y) (((y) % 4) ? 365 : ((!((y) % 100) && ((y) % 400)) ? 365 : 366 ))
|
||||||
#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
|
#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
|
||||||
#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
|
#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
|
||||||
@@ -37,11 +37,13 @@ EXTERN int CurMon;
|
|||||||
EXTERN int CurYear;
|
EXTERN int CurYear;
|
||||||
EXTERN int LineNo;
|
EXTERN int LineNo;
|
||||||
EXTERN int FreshLine;
|
EXTERN int FreshLine;
|
||||||
EXTERN INIT( char *MsgCommand, NULL);
|
EXTERN INIT( char const *MsgCommand, NULL);
|
||||||
EXTERN INIT( int ShowAllErrors, 0);
|
EXTERN INIT( int ShowAllErrors, 0);
|
||||||
EXTERN INIT( int DebugFlag, 0);
|
EXTERN INIT( int DebugFlag, 0);
|
||||||
EXTERN INIT( int DoCalendar, 0);
|
EXTERN INIT( int DoCalendar, 0);
|
||||||
EXTERN INIT( int DoSimpleCalendar, 0);
|
EXTERN INIT( int DoSimpleCalendar, 0);
|
||||||
|
EXTERN INIT( int DoSimpleCalDelta, 0);
|
||||||
|
EXTERN INIT( int DoPrefixLineNo, 0);
|
||||||
EXTERN INIT( int MondayFirst, 0);
|
EXTERN INIT( int MondayFirst, 0);
|
||||||
EXTERN INIT( int Iterations, 1);
|
EXTERN INIT( int Iterations, 1);
|
||||||
EXTERN INIT( int PsCal, 0);
|
EXTERN INIT( int PsCal, 0);
|
||||||
@@ -51,6 +53,7 @@ EXTERN INIT( int CalMonths, 0);
|
|||||||
EXTERN INIT( int Hush, 0);
|
EXTERN INIT( int Hush, 0);
|
||||||
EXTERN INIT( int NextMode, 0);
|
EXTERN INIT( int NextMode, 0);
|
||||||
EXTERN INIT( int InfiniteDelta, 0);
|
EXTERN INIT( int InfiniteDelta, 0);
|
||||||
|
EXTERN INIT( int DeltaOffset, 0);
|
||||||
EXTERN INIT( int RunDisabled, 0);
|
EXTERN INIT( int RunDisabled, 0);
|
||||||
EXTERN INIT( int IgnoreOnce, 0);
|
EXTERN INIT( int IgnoreOnce, 0);
|
||||||
EXTERN INIT( int SortByTime, 0);
|
EXTERN INIT( int SortByTime, 0);
|
||||||
@@ -59,7 +62,7 @@ EXTERN INIT( int SortByPrio, 0);
|
|||||||
EXTERN INIT( int DefaultPrio, NO_PRIORITY);
|
EXTERN INIT( int DefaultPrio, NO_PRIORITY);
|
||||||
EXTERN INIT( long SysTime, -1L);
|
EXTERN INIT( long SysTime, -1L);
|
||||||
|
|
||||||
EXTERN char *InitialFile;
|
EXTERN char const *InitialFile;
|
||||||
EXTERN int FileAccessDate;
|
EXTERN int FileAccessDate;
|
||||||
|
|
||||||
EXTERN INIT( int DontFork, 0);
|
EXTERN INIT( int DontFork, 0);
|
||||||
@@ -67,8 +70,9 @@ EXTERN INIT( int DontQueue, 0);
|
|||||||
EXTERN INIT( int NumQueued, 0);
|
EXTERN INIT( int NumQueued, 0);
|
||||||
EXTERN INIT( int DontIssueAts, 0);
|
EXTERN INIT( int DontIssueAts, 0);
|
||||||
EXTERN INIT( int Daemon, 0);
|
EXTERN INIT( int Daemon, 0);
|
||||||
|
EXTERN INIT( char DateSep, DATESEP);
|
||||||
|
EXTERN INIT( char TimeSep, TIMESEP);
|
||||||
|
EXTERN INIT( int SynthesizeTags, 0);
|
||||||
EXTERN INIT( int ScFormat, SC_AMPM);
|
EXTERN INIT( int ScFormat, SC_AMPM);
|
||||||
EXTERN INIT( int MaxSatIter, 150);
|
EXTERN INIT( int MaxSatIter, 150);
|
||||||
EXTERN INIT( char *FileName, NULL);
|
EXTERN INIT( char *FileName, NULL);
|
||||||
@@ -80,12 +84,14 @@ EXTERN INIT( int LastTriggerDate, 0);
|
|||||||
EXTERN INIT( int LastTrigValid, 0);
|
EXTERN INIT( int LastTrigValid, 0);
|
||||||
EXTERN INIT( int LastTriggerTime, 0);
|
EXTERN INIT( int LastTriggerTime, 0);
|
||||||
EXTERN INIT( int ShouldCache, 0);
|
EXTERN INIT( int ShouldCache, 0);
|
||||||
EXTERN char *CurLine;
|
EXTERN char const *CurLine;
|
||||||
EXTERN INIT( int NumTriggered, 0);
|
EXTERN INIT( int NumTriggered, 0);
|
||||||
EXTERN int ArgC;
|
EXTERN int ArgC;
|
||||||
EXTERN char **ArgV;
|
EXTERN char const **ArgV;
|
||||||
EXTERN INIT( int CalLines, CAL_LINES);
|
EXTERN INIT( int CalLines, CAL_LINES);
|
||||||
EXTERN INIT( int CalPad, 1);
|
EXTERN INIT( int CalPad, 1);
|
||||||
|
EXTERN INIT( int UseVTChars, 0);
|
||||||
|
EXTERN INIT( int UseVTColors, 0);
|
||||||
|
|
||||||
/* Latitude and longitude */
|
/* Latitude and longitude */
|
||||||
EXTERN INIT( int LatDeg, LAT_DEG);
|
EXTERN INIT( int LatDeg, LAT_DEG);
|
||||||
@@ -171,12 +177,3 @@ EXTERN int MonthIndex[2][12]
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
#if defined(__OS2__)
|
|
||||||
#if defined(_MSC_VER) || defined(__EMX__)
|
|
||||||
#define OS2MODE (_osmode == OS2_MODE)
|
|
||||||
#define DOSMODE (_osmode == DOS_MODE)
|
|
||||||
#else
|
|
||||||
#define OS2MODE 1
|
|
||||||
#define DOSMODE 0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|||||||
92
src/hbcal.c
92
src/hbcal.c
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/* Derived from code written by Amos Shapir in 1978; revised */
|
/* Derived from code written by Amos Shapir in 1978; revised */
|
||||||
/* 1985. */
|
/* 1985. */
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: hbcal.c,v 1.3 1999-04-05 17:34:50 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h> /* For FILE used by protos.h - sigh. */
|
#include <stdio.h> /* For FILE used by protos.h - sigh. */
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@@ -56,7 +55,7 @@ static char const RCSID[] = "$Id: hbcal.c,v 1.3 1999-04-05 17:34:50 dfs Exp $";
|
|||||||
#define ADAR2ADARA 1
|
#define ADAR2ADARA 1
|
||||||
#define ADAR2BOTH 2
|
#define ADAR2BOTH 2
|
||||||
|
|
||||||
static char *HebMonthNames[] = {
|
static char const *HebMonthNames[] = {
|
||||||
"Tishrey", "Heshvan", "Kislev", "Tevet", "Shvat", "Adar A", "Adar B",
|
"Tishrey", "Heshvan", "Kislev", "Tevet", "Shvat", "Adar A", "Adar B",
|
||||||
"Nisan", "Iyar", "Sivan", "Tamuz", "Av", "Elul", "Adar"};
|
"Nisan", "Iyar", "Sivan", "Tamuz", "Av", "Elul", "Adar"};
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ static char MaxMonLen[] = {
|
|||||||
30, 30, 30, 29, 30, 30, 29, 30, 29, 30, 29, 30, 29, 29};
|
30, 30, 30, 29, 30, 30, 29, 30, 29, 30, 29, 30, 29, 29};
|
||||||
|
|
||||||
static char HebIsLeap[] = {0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1};
|
static char HebIsLeap[] = {0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1};
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* RoshHashana */
|
/* RoshHashana */
|
||||||
@@ -73,12 +72,7 @@ static char HebIsLeap[] = {0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1};
|
|||||||
/* Hebrew year. (ie, 5751, not 1990) */
|
/* Hebrew year. (ie, 5751, not 1990) */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int RoshHashana(int i)
|
||||||
PUBLIC int RoshHashana(int i)
|
|
||||||
#else
|
|
||||||
int RoshHashana(i)
|
|
||||||
int i;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
long j;
|
long j;
|
||||||
j = DaysToHebYear(i-3744) - CORRECTION;
|
j = DaysToHebYear(i-3744) - CORRECTION;
|
||||||
@@ -93,12 +87,7 @@ int i;
|
|||||||
/* from new moon before Tishrey 1 5701. */
|
/* from new moon before Tishrey 1 5701. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
long DaysToHebYear(int y)
|
||||||
PUBLIC long DaysToHebYear(int y)
|
|
||||||
#else
|
|
||||||
long DaysToHebYear(y)
|
|
||||||
int y;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
long m, nm, dw, s, l;
|
long m, nm, dw, s, l;
|
||||||
|
|
||||||
@@ -131,12 +120,7 @@ int y;
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DaysInHebYear(int y)
|
||||||
PUBLIC int DaysInHebYear(int y)
|
|
||||||
#else
|
|
||||||
int DaysInHebYear(y)
|
|
||||||
int y;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
long thisyear, nextyear;
|
long thisyear, nextyear;
|
||||||
|
|
||||||
@@ -153,12 +137,7 @@ int y;
|
|||||||
/* given the LENGTH of the Hebrew year. */
|
/* given the LENGTH of the Hebrew year. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
char const *DaysInHebMonths(int ylen)
|
||||||
PUBLIC char *DaysInHebMonths(int ylen)
|
|
||||||
#else
|
|
||||||
char *DaysInHebMonths(ylen)
|
|
||||||
int ylen;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
static char monlen[13] =
|
static char monlen[13] =
|
||||||
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29};
|
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29};
|
||||||
@@ -184,15 +163,10 @@ int ylen;
|
|||||||
/* non-leap-years. */
|
/* non-leap-years. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int HebToJul(int hy, int hm, int hd)
|
||||||
PUBLIC int HebToJul(int hy, int hm, int hd)
|
|
||||||
#else
|
|
||||||
int HebToJul(hy, hm, hd)
|
|
||||||
int hy, hm, hd;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int ylen;
|
int ylen;
|
||||||
char *monlens;
|
char const *monlens;
|
||||||
int rh;
|
int rh;
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
@@ -222,17 +196,12 @@ int hy, hm, hd;
|
|||||||
/* non-leap-years. */
|
/* non-leap-years. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void JulToHeb(int jul, int *hy, int *hm, int *hd)
|
||||||
PUBLIC void JulToHeb(int jul, int *hy, int *hm, int *hd)
|
|
||||||
#else
|
|
||||||
void JulToHeb(jul, hy, hm, hd)
|
|
||||||
int jul, *hy, *hm, *hd;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
int rh;
|
int rh;
|
||||||
int ylen;
|
int ylen;
|
||||||
char *monlen;
|
char const *monlen;
|
||||||
/* Get the common year */
|
/* Get the common year */
|
||||||
FromJulian(jul, &y, &m, &d);
|
FromJulian(jul, &y, &m, &d);
|
||||||
y += 3763; /* Over-estimate a bit to be on the safe side below... */
|
y += 3763; /* Over-estimate a bit to be on the safe side below... */
|
||||||
@@ -263,12 +232,7 @@ int jul, *hy, *hm, *hd;
|
|||||||
/* year. */
|
/* year. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int HebNameToNum(char const *mname)
|
||||||
PUBLIC int HebNameToNum(const char *mname)
|
|
||||||
#else
|
|
||||||
int HebNameToNum(mname)
|
|
||||||
char *mname;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int m=-1;
|
int m=-1;
|
||||||
@@ -290,12 +254,7 @@ char *mname;
|
|||||||
/* year. */
|
/* year. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
char const *HebMonthName(int m, int y)
|
||||||
PUBLIC char *HebMonthName(int m, int y)
|
|
||||||
#else
|
|
||||||
char *HebMonthName(m, y)
|
|
||||||
int m, y;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (m != ADARA && m != ADARB) return HebMonthNames[m];
|
if (m != ADARA && m != ADARB) return HebMonthNames[m];
|
||||||
|
|
||||||
@@ -331,15 +290,10 @@ int m, y;
|
|||||||
/* Change 30 Adar A to 30 Shvat in nonleap */
|
/* Change 30 Adar A to 30 Shvat in nonleap */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int GetValidHebDate(int yin, int min, int din, int adarbehave,
|
||||||
PUBLIC int GetValidHebDate(int yin, int min, int din, int adarbehave,
|
|
||||||
int *mout, int *dout, int jahr)
|
int *mout, int *dout, int jahr)
|
||||||
#else
|
|
||||||
int GetValidHebDate(yin, min, din, adarbehave, mout, dout, jahr)
|
|
||||||
int yin, min, din, adarbehave, *mout, *dout, jahr;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *monlen;
|
char const *monlen;
|
||||||
int ylen;
|
int ylen;
|
||||||
|
|
||||||
*mout = min;
|
*mout = min;
|
||||||
@@ -436,13 +390,8 @@ int yin, min, din, adarbehave, *mout, *dout, jahr;
|
|||||||
/* Returns 0 for success, non-zero for failure. */
|
/* Returns 0 for success, non-zero for failure. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int GetNextHebrewDate(int julstart, int hm, int hd,
|
||||||
PUBLIC int GetNextHebrewDate(int julstart, int hm, int hd,
|
|
||||||
int jahr, int adarbehave, int *ans)
|
int jahr, int adarbehave, int *ans)
|
||||||
#else
|
|
||||||
int GetNextHebrewDate(julstart, hm, hd, jahr, adarbehave, ans)
|
|
||||||
int julstart, hm, hd, jahr, adarbehave, *ans;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r, yout, mout, dout, jul=1;
|
int r, yout, mout, dout, jul=1;
|
||||||
int adarflag = adarbehave;
|
int adarflag = adarbehave;
|
||||||
@@ -497,14 +446,9 @@ int julstart, hm, hd, jahr, adarbehave, *ans;
|
|||||||
/* Given a date of death, compute the value to use for jahr. */
|
/* Given a date of death, compute the value to use for jahr. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ComputeJahr(int y, int m, int d, int *ans)
|
||||||
PUBLIC int ComputeJahr(int y, int m, int d, int *ans)
|
|
||||||
#else
|
|
||||||
int ComputeJahr(y, m, d, ans)
|
|
||||||
int y, m, d, *ans;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *monlen;
|
char const *monlen;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
*ans = JAHR_NONE;
|
*ans = JAHR_NONE;
|
||||||
|
|||||||
292
src/init.c
292
src/init.c
@@ -8,43 +8,27 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: init.c,v 1.11 1999-04-12 19:45:27 dfs Exp $";
|
|
||||||
|
|
||||||
#define L_IN_INIT 1
|
#define L_IN_INIT 1
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "version.h"
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
@@ -58,6 +42,8 @@ static char const RCSID[] = "$Id: init.c,v 1.11 1999-04-12 19:45:27 dfs Exp $";
|
|||||||
* -w[n,n,n] = Specify output device width, padding and spacing
|
* -w[n,n,n] = Specify output device width, padding and spacing
|
||||||
* -s[n] = Produce calendar in "simple calendar" format
|
* -s[n] = Produce calendar in "simple calendar" format
|
||||||
* -p[n] = Produce calendar in format compatible with rem2ps
|
* -p[n] = Produce calendar in format compatible with rem2ps
|
||||||
|
* -l = Prefix simple calendar lines with a comment containing
|
||||||
|
* their trigger line numbers and filenames
|
||||||
* -v = Verbose mode
|
* -v = Verbose mode
|
||||||
* -o = Ignore ONCE directives
|
* -o = Ignore ONCE directives
|
||||||
* -a = Don't issue timed reminders which will be queued
|
* -a = Don't issue timed reminders which will be queued
|
||||||
@@ -66,6 +52,7 @@ static char const RCSID[] = "$Id: init.c,v 1.11 1999-04-12 19:45:27 dfs Exp $";
|
|||||||
* -h = Hush mode
|
* -h = Hush mode
|
||||||
* -f = Do not fork
|
* -f = Do not fork
|
||||||
* -dchars = Debugging mode: Chars are:
|
* -dchars = Debugging mode: Chars are:
|
||||||
|
* f = Trace file openings
|
||||||
* e = Echo input lines
|
* e = Echo input lines
|
||||||
* x = Display expression evaluation
|
* x = Display expression evaluation
|
||||||
* t = Display trigger dates
|
* t = Display trigger dates
|
||||||
@@ -93,13 +80,41 @@ while (isdigit(*(s))) { \
|
|||||||
s++; \
|
s++; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIX
|
static void ChgUser(char const *u);
|
||||||
PRIVATE void ChgUser ARGS((char *uname));
|
static void InitializeVar(char const *str);
|
||||||
#endif
|
|
||||||
|
|
||||||
PRIVATE void InitializeVar ARGS ((char *str));
|
static char const *BadDate = "Illegal date on command line\n";
|
||||||
|
|
||||||
static char *BadDate = "Illegal date on command line\n";
|
static DynamicBuffer default_filename_buf;
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* DefaultFilename */
|
||||||
|
/* */
|
||||||
|
/* If we're invoked as "rem" rather than "remind", use a */
|
||||||
|
/* default filename. Use $DOTREMINDERS or $HOME/.reminders */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
static char const *DefaultFilename(void)
|
||||||
|
{
|
||||||
|
char const *s;
|
||||||
|
|
||||||
|
DBufInit(&default_filename_buf);
|
||||||
|
|
||||||
|
s = getenv("DOTREMINDERS");
|
||||||
|
if (s) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = getenv("HOME");
|
||||||
|
if (!s) {
|
||||||
|
fprintf(stderr, "HOME environment variable not set. Unable to determine reminder file.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
DBufPuts(&default_filename_buf, s);
|
||||||
|
DBufPuts(&default_filename_buf, "/.reminders");
|
||||||
|
return DBufValue(&default_filename_buf);
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -108,18 +123,15 @@ static char *BadDate = "Illegal date on command line\n";
|
|||||||
/* Initialize the system - called only once at beginning! */
|
/* Initialize the system - called only once at beginning! */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void InitRemind(int argc, char const *argv[])
|
||||||
PUBLIC void InitRemind(int argc, char *argv[])
|
|
||||||
#else
|
|
||||||
void InitRemind(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *arg;
|
char const *arg;
|
||||||
int i;
|
int i;
|
||||||
int y, m, d, rep;
|
int y, m, d, rep;
|
||||||
Token tok;
|
Token tok;
|
||||||
|
int InvokedAsRem = 0;
|
||||||
|
char const *s;
|
||||||
|
int weeks;
|
||||||
|
|
||||||
/* Initialize global dynamic buffers */
|
/* Initialize global dynamic buffers */
|
||||||
DBufInit(&Banner);
|
DBufInit(&Banner);
|
||||||
@@ -129,13 +141,11 @@ char *argv[];
|
|||||||
DBufPuts(&Banner, L_BANNER);
|
DBufPuts(&Banner, L_BANNER);
|
||||||
|
|
||||||
/* Make sure remind is not installed set-uid or set-gid */
|
/* Make sure remind is not installed set-uid or set-gid */
|
||||||
#ifdef UNIX
|
|
||||||
if (getgid() != getegid() ||
|
if (getgid() != getegid() ||
|
||||||
getuid() != geteuid()) {
|
getuid() != geteuid()) {
|
||||||
fprintf(ErrFp, "\nRemind should not be installed set-uid or set-gid.\nCHECK YOUR SYSTEM SECURITY.\n");
|
fprintf(ErrFp, "\nRemind should not be installed set-uid or set-gid.\nCHECK YOUR SYSTEM SECURITY.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
y = NO_YR;
|
y = NO_YR;
|
||||||
m = NO_MON;
|
m = NO_MON;
|
||||||
@@ -150,18 +160,18 @@ char *argv[];
|
|||||||
JulianToday = RealToday;
|
JulianToday = RealToday;
|
||||||
FromJulian(JulianToday, &CurYear, &CurMon, &CurDay);
|
FromJulian(JulianToday, &CurYear, &CurMon, &CurDay);
|
||||||
|
|
||||||
#if !defined(HAVE_QUEUED)
|
/* See if we were invoked as "rem" rather than "remind" */
|
||||||
DontFork = 1;
|
if (argv[0]) {
|
||||||
DontQueue = 1;
|
s = strrchr(argv[0], '/');
|
||||||
NumQueued = 0;
|
if (!s) {
|
||||||
DontIssueAts = 0;
|
s = argv[0];
|
||||||
Daemon = 0;
|
} else {
|
||||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
s++;
|
||||||
DontFork = 1;
|
}
|
||||||
#elif defined(__OS2__) && defined (__MSDOS__)
|
if (!strcmp(s, "rem")) {
|
||||||
if (DOSMODE)
|
InvokedAsRem = 1;
|
||||||
DontFork = 1;
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
/* Parse the command-line options */
|
/* Parse the command-line options */
|
||||||
i = 1;
|
i = 1;
|
||||||
@@ -184,14 +194,12 @@ char *argv[];
|
|||||||
InitializeVar(arg);
|
InitializeVar(arg);
|
||||||
while(*arg) arg++;
|
while(*arg) arg++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
case 'N':
|
case 'N':
|
||||||
NextMode = 1;
|
NextMode = 1;
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
DontQueue = 1;
|
DontQueue = 1;
|
||||||
Daemon = 0;
|
Daemon = 0;
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
@@ -209,11 +217,22 @@ char *argv[];
|
|||||||
IgnoreOnce = 1;
|
IgnoreOnce = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 'y':
|
||||||
case 'T':
|
case 'Y':
|
||||||
InfiniteDelta = 1;
|
SynthesizeTags = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
case 'T':
|
||||||
|
if (!*arg) {
|
||||||
|
InfiniteDelta = 1;
|
||||||
|
} else {
|
||||||
|
PARSENUM(DeltaOffset, arg);
|
||||||
|
if (DeltaOffset < 0) {
|
||||||
|
DeltaOffset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
case 'E':
|
case 'E':
|
||||||
ErrFp = stdout;
|
ErrFp = stdout;
|
||||||
@@ -246,27 +265,23 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(UNIX) && defined(WANT_U_OPTION)
|
|
||||||
case 'u':
|
case 'u':
|
||||||
case 'U':
|
case 'U':
|
||||||
ChgUser(arg);
|
ChgUser(arg);
|
||||||
RunDisabled = RUN_CMDLINE;
|
RunDisabled = RUN_CMDLINE;
|
||||||
while (*arg) arg++;
|
while (*arg) arg++;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
case 'z':
|
case 'z':
|
||||||
case 'Z':
|
case 'Z':
|
||||||
DontFork = 1;
|
DontFork = 1;
|
||||||
if (*arg == '0') {
|
if (*arg == '0') {
|
||||||
PARSENUM(Daemon, arg);
|
PARSENUM(Daemon, arg);
|
||||||
if (Daemon == 0) Daemon = -1;
|
if (Daemon == 0) Daemon = -1;
|
||||||
else if (Daemon < 5) Daemon = 5;
|
else if (Daemon < 1) Daemon = 1;
|
||||||
else if (Daemon > 60) Daemon = 60;
|
else if (Daemon > 60) Daemon = 60;
|
||||||
} else {
|
} else {
|
||||||
PARSENUM(Daemon, arg);
|
PARSENUM(Daemon, arg);
|
||||||
if (Daemon<5) Daemon=5;
|
if (Daemon<1) Daemon=1;
|
||||||
else if (Daemon>60) Daemon=60;
|
else if (Daemon>60) Daemon=60;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -285,12 +300,36 @@ char *argv[];
|
|||||||
case 'F':
|
case 'F':
|
||||||
DontFork = 1;
|
DontFork = 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'C':
|
case 'C':
|
||||||
DoCalendar = 1;
|
DoCalendar = 1;
|
||||||
if (*arg == '+') {
|
weeks = 0;
|
||||||
arg++;
|
/* Parse the flags */
|
||||||
|
while(*arg) {
|
||||||
|
if (*arg == 'a' ||
|
||||||
|
*arg == 'A') {
|
||||||
|
DoSimpleCalDelta = 1;
|
||||||
|
arg++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (*arg == '+') {
|
||||||
|
weeks = 1;
|
||||||
|
arg++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (*arg == 'l' || *arg == 'L') {
|
||||||
|
UseVTChars = 1;
|
||||||
|
arg++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (*arg == 'c' || *arg == 'C') {
|
||||||
|
UseVTColors = 1;
|
||||||
|
arg++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (weeks) {
|
||||||
PARSENUM(CalWeeks, arg);
|
PARSENUM(CalWeeks, arg);
|
||||||
if (!CalWeeks) CalWeeks = 1;
|
if (!CalWeeks) CalWeeks = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -302,8 +341,21 @@ char *argv[];
|
|||||||
case 's':
|
case 's':
|
||||||
case 'S':
|
case 'S':
|
||||||
DoSimpleCalendar = 1;
|
DoSimpleCalendar = 1;
|
||||||
if (*arg == '+') {
|
weeks = 0;
|
||||||
arg++;
|
while(*arg) {
|
||||||
|
if (*arg == 'a' || *arg == 'A') {
|
||||||
|
DoSimpleCalDelta = 1;
|
||||||
|
arg++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (*arg == '+') {
|
||||||
|
arg++;
|
||||||
|
weeks = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (weeks) {
|
||||||
PARSENUM(CalWeeks, arg);
|
PARSENUM(CalWeeks, arg);
|
||||||
if (!CalWeeks) CalWeeks = 1;
|
if (!CalWeeks) CalWeeks = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -316,10 +368,19 @@ char *argv[];
|
|||||||
case 'P':
|
case 'P':
|
||||||
DoSimpleCalendar = 1;
|
DoSimpleCalendar = 1;
|
||||||
PsCal = 1;
|
PsCal = 1;
|
||||||
|
if (*arg == 'a' || *arg == 'A') {
|
||||||
|
DoSimpleCalDelta = 1;
|
||||||
|
arg++;
|
||||||
|
}
|
||||||
PARSENUM(CalMonths, arg);
|
PARSENUM(CalMonths, arg);
|
||||||
if (!CalMonths) CalMonths = 1;
|
if (!CalMonths) CalMonths = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'l':
|
||||||
|
case 'L':
|
||||||
|
DoPrefixLineNo = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
case 'W':
|
case 'W':
|
||||||
if (*arg != ',') {
|
if (*arg != ',') {
|
||||||
@@ -344,11 +405,12 @@ char *argv[];
|
|||||||
case 'D':
|
case 'D':
|
||||||
while (*arg) {
|
while (*arg) {
|
||||||
switch(*arg++) {
|
switch(*arg++) {
|
||||||
case 'e': case 'E': DebugFlag |= DB_ECHO_LINE; break;
|
case 'e': case 'E': DebugFlag |= DB_ECHO_LINE; break;
|
||||||
case 'x': case 'X': DebugFlag |= DB_PRTEXPR; break;
|
case 'x': case 'X': DebugFlag |= DB_PRTEXPR; break;
|
||||||
case 't': case 'T': DebugFlag |= DB_PRTTRIG; break;
|
case 't': case 'T': DebugFlag |= DB_PRTTRIG; break;
|
||||||
case 'v': case 'V': DebugFlag |= DB_DUMP_VARS; break;
|
case 'v': case 'V': DebugFlag |= DB_DUMP_VARS; break;
|
||||||
case 'l': case 'L': DebugFlag |= DB_PRTLINE; break;
|
case 'l': case 'L': DebugFlag |= DB_PRTLINE; break;
|
||||||
|
case 'f': case 'F': DebugFlag |= DB_TRACE_FILES; break;
|
||||||
default:
|
default:
|
||||||
fprintf(ErrFp, ErrMsg[M_BAD_DB_FLAG], *(arg-1));
|
fprintf(ErrFp, ErrMsg[M_BAD_DB_FLAG], *(arg-1));
|
||||||
}
|
}
|
||||||
@@ -387,11 +449,15 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the filename. */
|
/* Get the filename. */
|
||||||
if (i >= argc) {
|
if (!InvokedAsRem) {
|
||||||
Usage();
|
if (i >= argc) {
|
||||||
exit(1);
|
Usage();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
InitialFile = argv[i++];
|
||||||
|
} else {
|
||||||
|
InitialFile = DefaultFilename();
|
||||||
}
|
}
|
||||||
InitialFile = argv[i++];
|
|
||||||
|
|
||||||
/* Get the date, if any */
|
/* Get the date, if any */
|
||||||
if (i < argc) {
|
if (i < argc) {
|
||||||
@@ -403,10 +469,8 @@ char *argv[];
|
|||||||
if (SysTime != -1L) Usage();
|
if (SysTime != -1L) Usage();
|
||||||
else {
|
else {
|
||||||
SysTime = (long) tok.val * 60L;
|
SysTime = (long) tok.val * 60L;
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
DontQueue = 1;
|
DontQueue = 1;
|
||||||
Daemon = 0;
|
Daemon = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -482,14 +546,10 @@ char *argv[];
|
|||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifndef L_USAGE_OVERRIDE
|
#ifndef L_USAGE_OVERRIDE
|
||||||
#ifdef HAVE_PROTOS
|
void Usage(void)
|
||||||
PUBLIC void Usage(void)
|
|
||||||
#else
|
|
||||||
void Usage()
|
|
||||||
#endif /* HAVE_PROTOS */
|
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||||
fprintf(ErrFp, "Copyright 1999 by Roaring Penguin Software Inc.\n");
|
fprintf(ErrFp, "Copyright 1999-2008 Roaring Penguin Software Inc.\n");
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -497,22 +557,21 @@ void Usage()
|
|||||||
fprintf(ErrFp, "Options:\n");
|
fprintf(ErrFp, "Options:\n");
|
||||||
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
|
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
|
||||||
fprintf(ErrFp, " -r Disable RUN directives\n");
|
fprintf(ErrFp, " -r Disable RUN directives\n");
|
||||||
fprintf(ErrFp, " -c[n] Produce a calendar for n (default 1) months\n");
|
fprintf(ErrFp, " -c[a][n] Produce a calendar for n (default 1) months\n");
|
||||||
fprintf(ErrFp, " -c+[n] Produce a calendar for n (default 1) weeks\n");
|
fprintf(ErrFp, " -c[a]+[n] Produce a calendar for n (default 1) weeks\n");
|
||||||
fprintf(ErrFp, " -w[n[,p[,s]]] Specify width, padding and spacing of calendar\n");
|
fprintf(ErrFp, " -w[n[,p[,s]]] Specify width, padding and spacing of calendar\n");
|
||||||
fprintf(ErrFp, " -s[+][n] Produce `simple calendar' for n (1) months (weeks)\n");
|
fprintf(ErrFp, " -s[a][+][n] Produce `simple calendar' for n (1) months (weeks)\n");
|
||||||
fprintf(ErrFp, " -p[n] Same as -s, but input compatible with rem2ps\n");
|
fprintf(ErrFp, " -p[a][n] Same as -s, but input compatible with rem2ps\n");
|
||||||
|
fprintf(ErrFp, " -l Prefix each simple calendar line with line number and filename comment\n");
|
||||||
fprintf(ErrFp, " -v Verbose mode\n");
|
fprintf(ErrFp, " -v Verbose mode\n");
|
||||||
fprintf(ErrFp, " -o Ignore ONCE directives\n");
|
fprintf(ErrFp, " -o Ignore ONCE directives\n");
|
||||||
fprintf(ErrFp, " -t Trigger all future reminders regardless of delta\n");
|
fprintf(ErrFp, " -t[n] Trigger all future (or those within `n' days)\n");
|
||||||
fprintf(ErrFp, " -h `Hush' mode - be very quiet\n");
|
fprintf(ErrFp, " -h `Hush' mode - be very quiet\n");
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
fprintf(ErrFp, " -a Don't trigger timed reminders immediately - just queue them\n");
|
fprintf(ErrFp, " -a Don't trigger timed reminders immediately - just queue them\n");
|
||||||
fprintf(ErrFp, " -q Don't queue timed reminders\n");
|
fprintf(ErrFp, " -q Don't queue timed reminders\n");
|
||||||
fprintf(ErrFp, " -f Trigger timed reminders by staying in foreground\n");
|
fprintf(ErrFp, " -f Trigger timed reminders by staying in foreground\n");
|
||||||
fprintf(ErrFp, " -z[n] Enter daemon mode, waking every n (5) minutes.\n");
|
fprintf(ErrFp, " -z[n] Enter daemon mode, waking every n (5) minutes.\n");
|
||||||
#endif
|
fprintf(ErrFp, " -d... Debug: e=echo x=expr-eval t=trig v=dumpvars l=showline f=tracefiles\n");
|
||||||
fprintf(ErrFp, " -d... Debug: e=echo x=expr-eval t=trig v=dumpvars l=showline\n");
|
|
||||||
fprintf(ErrFp, " -e Divert messages normally sent to stderr to stdout\n");
|
fprintf(ErrFp, " -e Divert messages normally sent to stderr to stdout\n");
|
||||||
fprintf(ErrFp, " -b[n] Time format for cal: 0=am/pm, 1=24hr, 2=none\n");
|
fprintf(ErrFp, " -b[n] Time format for cal: 0=am/pm, 1=24hr, 2=none\n");
|
||||||
fprintf(ErrFp, " -x[n] Iteration limit for SATISFY clause (def=150)\n");
|
fprintf(ErrFp, " -x[n] Iteration limit for SATISFY clause (def=150)\n");
|
||||||
@@ -520,6 +579,7 @@ void Usage()
|
|||||||
fprintf(ErrFp, " -g[ddd] Sort reminders by date, time and priority before issuing\n");
|
fprintf(ErrFp, " -g[ddd] Sort reminders by date, time and priority before issuing\n");
|
||||||
fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
|
fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
|
||||||
fprintf(ErrFp, " -m Start calendar with Monday rather than Sunday\n");
|
fprintf(ErrFp, " -m Start calendar with Monday rather than Sunday\n");
|
||||||
|
fprintf(ErrFp, " -y Synthesize tags for tagless reminders\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif /* L_USAGE_OVERRIDE */
|
#endif /* L_USAGE_OVERRIDE */
|
||||||
@@ -533,18 +593,15 @@ void Usage()
|
|||||||
/* USER environment variables. */
|
/* USER environment variables. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#if defined(UNIX) && defined(WANT_U_OPTION)
|
static void ChgUser(char const *user)
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PRIVATE void ChgUser(char *user)
|
|
||||||
#else
|
|
||||||
static void ChgUser(user)
|
|
||||||
char *user;
|
|
||||||
#endif /* HAVE_PROTOS */
|
|
||||||
{
|
{
|
||||||
uid_t myuid;
|
uid_t myuid;
|
||||||
|
|
||||||
struct passwd *pwent;
|
struct passwd *pwent;
|
||||||
static char *home, *shell, *username, *logname;
|
static char *home;
|
||||||
|
static char *shell;
|
||||||
|
static char *username;
|
||||||
|
static char *logname;
|
||||||
|
|
||||||
myuid = getuid();
|
myuid = getuid();
|
||||||
|
|
||||||
@@ -598,8 +655,20 @@ char *user;
|
|||||||
putenv(logname);
|
putenv(logname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* UNIX && WANT_U_OPTION */
|
|
||||||
|
static void
|
||||||
|
DefineFunction(char const *str)
|
||||||
|
{
|
||||||
|
Parser p;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
CreateParser(str, &p);
|
||||||
|
r = DoFset(&p);
|
||||||
|
DestroyParser(&p);
|
||||||
|
if (r != OK) {
|
||||||
|
fprintf(ErrFp, "-i option: %s: %s\n", str, ErrMsg[r]);
|
||||||
|
}
|
||||||
|
}
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* InitializeVar */
|
/* InitializeVar */
|
||||||
@@ -607,27 +676,34 @@ char *user;
|
|||||||
/* Initialize and preserve a variable */
|
/* Initialize and preserve a variable */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void InitializeVar(char const *str)
|
||||||
PRIVATE void InitializeVar(char *str)
|
|
||||||
#else
|
|
||||||
static void InitializeVar(str)
|
|
||||||
char *str;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *varname, *expr;
|
char const *expr;
|
||||||
|
char const *ostr = str;
|
||||||
|
char varname[VAR_NAME_LEN+1];
|
||||||
|
|
||||||
Value val;
|
Value val;
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* Scan for an '=' sign */
|
/* Scan for an '=' sign */
|
||||||
varname = str;
|
r = 0;
|
||||||
while (*str && *str != '=') str++;
|
while (*str && *str != '=') {
|
||||||
|
if (r < VAR_NAME_LEN) {
|
||||||
|
varname[r++] = *str;
|
||||||
|
}
|
||||||
|
if (*str == '(') {
|
||||||
|
/* Do a function definition if we see a paren */
|
||||||
|
DefineFunction(ostr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
varname[r] = 0;
|
||||||
if (!*str) {
|
if (!*str) {
|
||||||
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_EQ]);
|
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_EQ]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*str = 0;
|
|
||||||
if (!*varname) {
|
if (!*varname) {
|
||||||
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_VAR]);
|
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_VAR]);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,12 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: lang.h,v 1.4 1999-04-05 17:34:51 dfs Exp $ */
|
|
||||||
|
|
||||||
/* I'm chauvinistic and name each language with its English name... */
|
/* I'm chauvinistic and name each language with its English name... */
|
||||||
|
|
||||||
#define ENGLISH 0 /* original by David F. Skoll */
|
#define ENGLISH 0 /* original by David F. Skoll */
|
||||||
@@ -26,8 +24,9 @@
|
|||||||
#define ITALIAN 9 /* translated by Valerio Aimale */
|
#define ITALIAN 9 /* translated by Valerio Aimale */
|
||||||
#define ROMANIAN 10 /* translated by Liviu Daia */
|
#define ROMANIAN 10 /* translated by Liviu Daia */
|
||||||
#define SPANISH 11 /* translated by Rafa Couto */
|
#define SPANISH 11 /* translated by Rafa Couto */
|
||||||
|
#define ICELANDIC 12 /* translated by Björn Davíðsson */
|
||||||
|
|
||||||
/* Add more languages here - but please e-mail aa775@freenet.carleton.ca
|
/* Add more languages here - but please e-mail dfs@roaringpenguin.com
|
||||||
to have your favorite language assigned a number. If you add a
|
to have your favorite language assigned a number. If you add a
|
||||||
language, please send me the header file, and permission to include
|
language, please send me the header file, and permission to include
|
||||||
it in future releases of Remind. Note that you'll get no remuneration
|
it in future releases of Remind. Note that you'll get no remuneration
|
||||||
@@ -69,6 +68,8 @@
|
|||||||
#include "langs/romanian.h"
|
#include "langs/romanian.h"
|
||||||
#elif LANG == SPANISH
|
#elif LANG == SPANISH
|
||||||
#include "langs/spanish.h"
|
#include "langs/spanish.h"
|
||||||
|
#elif LANG == ICELANDIC
|
||||||
|
#include "langs/icelandic.h"
|
||||||
|
|
||||||
/* If no sensible language, choose English. I intended to use
|
/* If no sensible language, choose English. I intended to use
|
||||||
the #error directive here, but some C compilers barf. */
|
the #error directive here, but some C compilers barf. */
|
||||||
|
|||||||
@@ -7,13 +7,11 @@
|
|||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
|
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: danish.h,v 1.6 1999-04-05 17:35:05 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Danish"
|
#define L_LANGNAME "Danish"
|
||||||
|
|
||||||
@@ -103,11 +101,11 @@
|
|||||||
#define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<5) ? " om natten" : " om formiddagen" : (hour > 17) ? " om aftenen" : " om eftermiddagen";
|
#define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<5) ? " om natten" : " om formiddagen" : (hour > 17) ? " om aftenen" : " om eftermiddagen";
|
||||||
#define L_ORDINAL_OVERRIDE plu = ".";
|
#define L_ORDINAL_OVERRIDE plu = ".";
|
||||||
#define L_A_OVER sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
|
#define L_A_OVER sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
|
||||||
#define L_E_OVER sprintf(s, "den %02d%c%02d%c%04d", d, DATESEP, m+1, DATESEP, y);
|
#define L_E_OVER sprintf(s, "den %02d%c%02d%c%04d", d, DateSep, m+1, DateSep, y);
|
||||||
#define L_F_OVER sprintf(s, "den %02d%c%02d%c%04d", m+1, DATESEP, d, DATESEP, y);
|
#define L_F_OVER sprintf(s, "den %02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
|
||||||
#define L_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
|
#define L_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
|
||||||
#define L_H_OVER sprintf(s, "den %02d%c%02d", d, DATESEP, m+1);
|
#define L_H_OVER sprintf(s, "den %02d%c%02d", d, DateSep, m+1);
|
||||||
#define L_I_OVER sprintf(s, "den %02d%c%02d", m+1, DATESEP, d);
|
#define L_I_OVER sprintf(s, "den %02d%c%02d", m+1, DateSep, d);
|
||||||
#define L_U_OVER L_A_OVER
|
#define L_U_OVER L_A_OVER
|
||||||
#define L_V_OVER L_G_OVER
|
#define L_V_OVER L_G_OVER
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: dutch.h,v 1.4 1999-04-05 17:35:06 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Dutch"
|
#define L_LANGNAME "Dutch"
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: english.h,v 1.4 1999-04-05 17:35:06 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "English"
|
#define L_LANGNAME "English"
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,10 @@
|
|||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
|
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
|
||||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: finnish.h,v 1.8 1999-04-12 19:45:41 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Finnish"
|
#define L_LANGNAME "Finnish"
|
||||||
|
|
||||||
@@ -166,18 +164,18 @@
|
|||||||
#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);
|
MonthName[m], L_PARTIT, y);
|
||||||
#define L_C_OVER sprintf(s, "%s%s", DayName[jul%7], L_ON);
|
#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, \
|
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep, m+1, DateSep, \
|
||||||
y);
|
y);
|
||||||
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DATESEP, d, 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);
|
MonthName[m], L_PARTIT);
|
||||||
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DATESEP, m+1);
|
#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_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);
|
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);
|
MonthName[m], d, plu);
|
||||||
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
|
#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_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);
|
d, plu, MonthName[m], L_PARTIT, y);
|
||||||
@@ -284,7 +282,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"AT-sanan per\xE4st\xE4 puuttuu aika",
|
"AT-sanan per\xE4st\xE4 puuttuu aika",
|
||||||
"UNTIL-sanaa k\xE4ytetty kahdesti",
|
"UNTIL-sanaa k\xE4ytetty kahdesti",
|
||||||
"Ep\xE4t\xE4ydellinen p\xE4iv\xE4ys",
|
"Ep\xE4t\xE4ydellinen p\xE4iv\xE4ys",
|
||||||
"SCANFROM-sanaa k\xE4ytetty kahdesti",
|
"FROM/SCANFROM-sanaa k\xE4ytetty kahdesti",
|
||||||
"Muuttuja",
|
"Muuttuja",
|
||||||
"Arvo",
|
"Arvo",
|
||||||
"*M\xC4\xC4RITTELEM\xC4T\xD6N*",
|
"*M\xC4\xC4RITTELEM\xC4T\xD6N*",
|
||||||
@@ -308,7 +306,9 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Ei viestej\xE4.",
|
"Ei viestej\xE4.",
|
||||||
"%d viesti(\xE4) t\xE4m\xE4n p\xE4iv\xE4n jonossa.\n",
|
"%d viesti(\xE4) t\xE4m\xE4n p\xE4iv\xE4n jonossa.\n",
|
||||||
"Numero puuttuu",
|
"Numero puuttuu",
|
||||||
"Virheellinen funktio WARN-lausekkeessa"
|
"Virheellinen funktio WARN-lausekkeessa",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
|
|
||||||
#elif IBMEXTENDED
|
#elif IBMEXTENDED
|
||||||
"Ok",
|
"Ok",
|
||||||
@@ -385,7 +385,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"AT-sanan per\x84st\x84 puuttuu aika",
|
"AT-sanan per\x84st\x84 puuttuu aika",
|
||||||
"UNTIL-sanaa k\x84ytetty kahdesti",
|
"UNTIL-sanaa k\x84ytetty kahdesti",
|
||||||
"Ep\x84t\x84ydellinen p\x84iv\x84ys",
|
"Ep\x84t\x84ydellinen p\x84iv\x84ys",
|
||||||
"SCANFROM-sanaa k\x84ytetty kahdesti",
|
"FROM/SCANFROM-sanaa k\x84ytetty kahdesti",
|
||||||
"Muuttuja",
|
"Muuttuja",
|
||||||
"Arvo",
|
"Arvo",
|
||||||
"*M\x8E\x8ERITTELEM\x8ET\x99N*",
|
"*M\x8E\x8ERITTELEM\x8ET\x99N*",
|
||||||
@@ -409,7 +409,9 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Ei viestej\x84.",
|
"Ei viestej\x84.",
|
||||||
"%d viesti(\x84) t\x84m\x84n p\x84iv\x84n jonossa.\n",
|
"%d viesti(\x84) t\x84m\x84n p\x84iv\x84n jonossa.\n",
|
||||||
"Numero puuttuu"
|
"Numero puuttuu"
|
||||||
"Virheellinen funktio WARN-lausekkeessa"
|
"Virheellinen funktio WARN-lausekkeessa",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
#else
|
#else
|
||||||
"Ok",
|
"Ok",
|
||||||
"Puuttuva ']'",
|
"Puuttuva ']'",
|
||||||
@@ -485,7 +487,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"AT-sanan per{st{ puuttuu aika",
|
"AT-sanan per{st{ puuttuu aika",
|
||||||
"UNTIL-sanaa k{ytetty kahdesti",
|
"UNTIL-sanaa k{ytetty kahdesti",
|
||||||
"Ep{t{ydellinen p{iv{ys",
|
"Ep{t{ydellinen p{iv{ys",
|
||||||
"SCANFROM-sanaa k{ytetty kahdesti",
|
"FROM/SCANFROM-sanaa k{ytetty kahdesti",
|
||||||
"Muuttuja",
|
"Muuttuja",
|
||||||
"Arvo",
|
"Arvo",
|
||||||
"*M[[RITTELEM[T\\N*",
|
"*M[[RITTELEM[T\\N*",
|
||||||
@@ -509,7 +511,10 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Ei viestej{.",
|
"Ei viestej{.",
|
||||||
"%d viesti({) t{m{n p{iv{n jonossa.\n",
|
"%d viesti({) t{m{n p{iv{n jonossa.\n",
|
||||||
"Numero puuttuu",
|
"Numero puuttuu",
|
||||||
"Virheellinen funktio WARN-lausekkeessa"
|
"Virheellinen funktio WARN-lausekkeessa",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
@@ -517,14 +522,10 @@ EXTERN char *ErrMsg[] =
|
|||||||
/* The following is only used in init.c */
|
/* The following is only used in init.c */
|
||||||
#ifdef L_IN_INIT
|
#ifdef L_IN_INIT
|
||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
#ifdef HAVE_PROTOS
|
void Usage(void)
|
||||||
PUBLIC void Usage(void)
|
|
||||||
#else
|
|
||||||
void Usage()
|
|
||||||
#endif /* HAVE_PROTOS */
|
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||||
fprintf(ErrFp, "Copyright 1999 by Roaring Penguin Software Inc.\n");
|
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
|
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,14 +9,12 @@
|
|||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* This file is Copyright (C) 1993 by Laurent Duperval and */
|
/* This file is Copyright (C) 1993 by Laurent Duperval and */
|
||||||
/* David F. Skoll. */
|
/* David F. Skoll. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: french.h,v 1.7 1999-04-12 19:45:42 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "French"
|
#define L_LANGNAME "French"
|
||||||
|
|
||||||
@@ -221,7 +219,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Heure attendue apr\350s AT",
|
"Heure attendue apr\350s AT",
|
||||||
"Mot-cl\351 UNTIL utilis\351 deux fois",
|
"Mot-cl\351 UNTIL utilis\351 deux fois",
|
||||||
"Sp\351cification de date incompl\350te",
|
"Sp\351cification de date incompl\350te",
|
||||||
"Mot-cl\351 SCANFROM utilis\351 deux fois",
|
"Mot-cl\351 FROM/SCANFROM utilis\351 deux fois",
|
||||||
"Variable",
|
"Variable",
|
||||||
"Valeur",
|
"Valeur",
|
||||||
"*NON-DEFINI*",
|
"*NON-DEFINI*",
|
||||||
@@ -245,7 +243,9 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Pas de rappels.",
|
"Pas de rappels.",
|
||||||
"%d rappel(s) en file pour aujourd'hui.\n",
|
"%d rappel(s) en file pour aujourd'hui.\n",
|
||||||
"Nombre attendu",
|
"Nombre attendu",
|
||||||
"Fonction ill\351gale apr\350s WARN"
|
"Fonction ill\351gale apr\350s WARN",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
#else /* ISOLATIN1 */
|
#else /* ISOLATIN1 */
|
||||||
"Ok",
|
"Ok",
|
||||||
"']' manquant",
|
"']' manquant",
|
||||||
@@ -321,7 +321,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Heure attendue apres AT",
|
"Heure attendue apres AT",
|
||||||
"Mot-cle UNTIL utilise deux fois",
|
"Mot-cle UNTIL utilise deux fois",
|
||||||
"Specification de date incomplete",
|
"Specification de date incomplete",
|
||||||
"Mot-cle SCANFROM utilise deux fois",
|
"Mot-cle FROM/SCANFROM utilise deux fois",
|
||||||
"Variable",
|
"Variable",
|
||||||
"Valeur",
|
"Valeur",
|
||||||
"*NON-DEFINI*",
|
"*NON-DEFINI*",
|
||||||
@@ -345,7 +345,9 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Pas de rappels.",
|
"Pas de rappels.",
|
||||||
"%d rappel(s) en file pour aujourd'hui.\n",
|
"%d rappel(s) en file pour aujourd'hui.\n",
|
||||||
"Nombre attendu",
|
"Nombre attendu",
|
||||||
"Fonction illegale apres WARN"
|
"Fonction illegale apres WARN",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
#endif /* ISOLATIN1 */
|
#endif /* ISOLATIN1 */
|
||||||
};
|
};
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
@@ -353,14 +355,10 @@ EXTERN char *ErrMsg[] =
|
|||||||
/* The following is only used in init.c */
|
/* The following is only used in init.c */
|
||||||
#ifdef L_IN_INIT
|
#ifdef L_IN_INIT
|
||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
#ifdef HAVE_PROTOS
|
void Usage(void)
|
||||||
PUBLIC void Usage(void)
|
|
||||||
#else
|
|
||||||
void Usage()
|
|
||||||
#endif /* HAVE_PROTOS */
|
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||||
fprintf(ErrFp, "Copyright 1999 by Roaring Penguin Software Inc.\n");
|
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,12 +10,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: german.h,v 1.5 1999-04-05 17:35:08 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "German"
|
#define L_LANGNAME "German"
|
||||||
|
|
||||||
|
|||||||
84
src/langs/icelandic.h
Normal file
84
src/langs/icelandic.h
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/***************************************************************/
|
||||||
|
/* */
|
||||||
|
/* ICELANDIC.H */
|
||||||
|
/* */
|
||||||
|
/* Support for the Icelandic language. */
|
||||||
|
/* */
|
||||||
|
/* This file is part of REMIND. */
|
||||||
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
|
/* Translated by Björn Davíðsson (bjossi@snerpa.is) */
|
||||||
|
/* */
|
||||||
|
/***************************************************************/
|
||||||
|
|
||||||
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
|
#define L_LANGNAME "Icelandic"
|
||||||
|
|
||||||
|
/* Day names */
|
||||||
|
#define L_SUNDAY "sunnudagur"
|
||||||
|
#define L_MONDAY "mánudagur"
|
||||||
|
#define L_TUESDAY "þriðjudagur"
|
||||||
|
#define L_WEDNESDAY "miðvikudagur"
|
||||||
|
#define L_THURSDAY "fimmtudagur"
|
||||||
|
#define L_FRIDAY "föstudagur"
|
||||||
|
#define L_SATURDAY "laugardagur"
|
||||||
|
|
||||||
|
/* Month names */
|
||||||
|
#define L_JAN "janúar"
|
||||||
|
#define L_FEB "febrúar"
|
||||||
|
#define L_MAR "mars"
|
||||||
|
#define L_APR "apríl"
|
||||||
|
#define L_MAY "maí"
|
||||||
|
#define L_JUN "júní"
|
||||||
|
#define L_JUL "júlí"
|
||||||
|
#define L_AUG "ágúst"
|
||||||
|
#define L_SEP "september"
|
||||||
|
#define L_OCT "október"
|
||||||
|
#define L_NOV "nóvember"
|
||||||
|
#define L_DEC "desember"
|
||||||
|
|
||||||
|
/* Today and tomorrow */
|
||||||
|
#define L_TODAY "í dag"
|
||||||
|
#define L_TOMORROW "á morgun"
|
||||||
|
|
||||||
|
/* The default banner */
|
||||||
|
#define L_BANNER "Minnisatriði: %w, %d%s %m, %y%o:"
|
||||||
|
|
||||||
|
/* "am" and "pm" */
|
||||||
|
#define L_AM "fh"
|
||||||
|
#define L_PM "eh"
|
||||||
|
|
||||||
|
/*** The following are only used in dosubst.c ***/
|
||||||
|
#ifdef L_IN_DOSUBST
|
||||||
|
|
||||||
|
/* Ago and from now */
|
||||||
|
#define L_AGO "síðan"
|
||||||
|
#define L_FROMNOW "frá því nú"
|
||||||
|
|
||||||
|
/* "in %d days' time" */
|
||||||
|
#define L_INXDAYS "eftir %d daga"
|
||||||
|
|
||||||
|
/* "on" as in "on date..." */
|
||||||
|
#define L_ON "þann"
|
||||||
|
|
||||||
|
/* Pluralizing - this is a problem for many languages and may require
|
||||||
|
a more drastic fix */
|
||||||
|
#define L_PLURAL "a"
|
||||||
|
|
||||||
|
/* Minutes, hours, at, etc */
|
||||||
|
#define L_NOW "núna"
|
||||||
|
#define L_AT "kl."
|
||||||
|
#define L_MINUTE "mínútu"
|
||||||
|
#define L_HOUR "klukkustund"
|
||||||
|
#define L_IS "er"
|
||||||
|
#define L_WAS "var"
|
||||||
|
#define L_AND "og"
|
||||||
|
/* What to add to make "hour" plural */
|
||||||
|
#define L_HPLU "ir"
|
||||||
|
/* What to add to make "minute" plural */
|
||||||
|
#define L_MPLU "r"
|
||||||
|
|
||||||
|
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
|
||||||
|
See the file dosubst.c for more info. */
|
||||||
|
|
||||||
|
#endif /* L_IN_DOSUBST */
|
||||||
@@ -8,12 +8,10 @@
|
|||||||
/* It is Copyright (C) 1996 by Valerio Aimale */
|
/* It is Copyright (C) 1996 by Valerio Aimale */
|
||||||
/* */
|
/* */
|
||||||
/* Remind is copyright (C) 1992-1998 by David F. Skoll */
|
/* Remind is copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: italian.h,v 1.5 1999-04-05 17:35:09 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Italian"
|
#define L_LANGNAME "Italian"
|
||||||
|
|
||||||
@@ -108,23 +106,23 @@
|
|||||||
MonthName[m], y);
|
MonthName[m], y);
|
||||||
#define L_C_OVER sprintf(s, "%s", DayName[jul%7]);
|
#define L_C_OVER sprintf(s, "%s", DayName[jul%7]);
|
||||||
|
|
||||||
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DATESEP,\
|
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep,\
|
||||||
m+1, DATESEP, y);
|
m+1, DateSep, y);
|
||||||
|
|
||||||
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DATESEP, d, 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, %d %s", DayName[jul%7], d, MonthName[m]);
|
#define L_G_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, MonthName[m]);
|
||||||
|
|
||||||
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DATESEP, m+1);
|
#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_I_OVER sprintf(s, "%02d%c%02d", m+1, DateSep, d);
|
||||||
|
|
||||||
#define L_J_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, \
|
#define L_J_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, \
|
||||||
MonthName[m], y);
|
MonthName[m], y);
|
||||||
|
|
||||||
#define L_K_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, \
|
#define L_K_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, \
|
||||||
MonthName[m]);
|
MonthName[m]);
|
||||||
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
|
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
|
||||||
|
|
||||||
#define L_U_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, \
|
#define L_U_OVER sprintf(s, "%s, %d %s %d", DayName[jul%7], d, \
|
||||||
MonthName[m], y);
|
MonthName[m], y);
|
||||||
|
|||||||
@@ -7,12 +7,10 @@
|
|||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* This file is Copyright (C) 1993 by Trygve Randen. */
|
/* This file is Copyright (C) 1993 by Trygve Randen. */
|
||||||
/* Remind is Copyright (C) 1992-1998 by David F. Skoll */
|
/* Remind is Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: norwgian.h,v 1.5 1999-04-05 17:35:09 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Norwegian"
|
#define L_LANGNAME "Norwegian"
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: polish.h,v 1.7 1999-04-12 19:45:43 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Polish"
|
#define L_LANGNAME "Polish"
|
||||||
|
|
||||||
@@ -256,7 +254,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Po AT oczekiwany jest czas",
|
"Po AT oczekiwany jest czas",
|
||||||
"S\263owo UNTIL u\277yte dw\363krotnie",
|
"S\263owo UNTIL u\277yte dw\363krotnie",
|
||||||
"Niekompletna specyfikacja daty",
|
"Niekompletna specyfikacja daty",
|
||||||
"S\263owo SCANFROM u\277yte dw\363krotnie",
|
"S\263owo FROM/SCANFROM u\277yte dw\363krotnie",
|
||||||
"Zmienna",
|
"Zmienna",
|
||||||
"Warto\266\346",
|
"Warto\266\346",
|
||||||
"*NIE ZDEFINIOWANE*",
|
"*NIE ZDEFINIOWANE*",
|
||||||
@@ -280,7 +278,9 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Brak przypomnie\361.",
|
"Brak przypomnie\361.",
|
||||||
"%d Przypomnienia zakolejkowane na p\363\274niej.\n",
|
"%d Przypomnienia zakolejkowane na p\363\274niej.\n",
|
||||||
"Spodziewana liczba",
|
"Spodziewana liczba",
|
||||||
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)"
|
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
#else /* ISOLATIN1 */
|
#else /* ISOLATIN1 */
|
||||||
"OK",
|
"OK",
|
||||||
"Brakujacy ']'",
|
"Brakujacy ']'",
|
||||||
@@ -356,7 +356,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Po AT oczekiwany jest czas",
|
"Po AT oczekiwany jest czas",
|
||||||
"Slowo UNTIL uzyte dwokrotnie",
|
"Slowo UNTIL uzyte dwokrotnie",
|
||||||
"Niekompletna specyfikacja daty",
|
"Niekompletna specyfikacja daty",
|
||||||
"Slowo SCANFROM uzyte dwokrotnie",
|
"Slowo FROM/SCANFROM uzyte dwokrotnie",
|
||||||
"Zmienna",
|
"Zmienna",
|
||||||
"Wartosc",
|
"Wartosc",
|
||||||
"*UNDEFINED*",
|
"*UNDEFINED*",
|
||||||
@@ -380,7 +380,9 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Brak przypomnien.",
|
"Brak przypomnien.",
|
||||||
"%d Przypomnienia zakolejkowane na pozniej.\n",
|
"%d Przypomnienia zakolejkowane na pozniej.\n",
|
||||||
"Spodziewana liczba",
|
"Spodziewana liczba",
|
||||||
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)"
|
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
#endif /* ISOLATIN1 */
|
#endif /* ISOLATIN1 */
|
||||||
};
|
};
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
@@ -388,14 +390,10 @@ EXTERN char *ErrMsg[] =
|
|||||||
/* The following is only used in init.c */
|
/* The following is only used in init.c */
|
||||||
#ifdef L_IN_INIT
|
#ifdef L_IN_INIT
|
||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
#ifdef HAVE_PROTOS
|
void Usage(void)
|
||||||
PUBLIC void Usage(void)
|
|
||||||
#else
|
|
||||||
void Usage()
|
|
||||||
#endif /* HAVE_PROTOS */
|
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||||
fprintf(ErrFp, "Copyright 1999 by Roaring Penguin Software Inc.\n");
|
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,14 +9,12 @@
|
|||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* This file is Copyright (C) 1996 by Marco Paganini and */
|
/* This file is Copyright (C) 1996 by Marco Paganini and */
|
||||||
/* David F. Skoll. */
|
/* David F. Skoll. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: portbr.h,v 1.6 1999-04-12 19:45:43 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Brazilian Portuguese"
|
#define L_LANGNAME "Brazilian Portuguese"
|
||||||
|
|
||||||
@@ -222,7 +220,7 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Esperando hora apos AT",
|
"Esperando hora apos AT",
|
||||||
"Keyword UNTIL usada duas vezes",
|
"Keyword UNTIL usada duas vezes",
|
||||||
"Especificacao de data incompleta",
|
"Especificacao de data incompleta",
|
||||||
"Keyword SCANFROM usada duas vezes",
|
"Keyword FROM/SCANFROM usada duas vezes",
|
||||||
"Variavel",
|
"Variavel",
|
||||||
"Valor",
|
"Valor",
|
||||||
"*INDEFINIDO*",
|
"*INDEFINIDO*",
|
||||||
@@ -246,21 +244,19 @@ EXTERN char *ErrMsg[] =
|
|||||||
"Sem compromissos.",
|
"Sem compromissos.",
|
||||||
"%d compromisso(s) colocados na fila para mais tarde.\n",
|
"%d compromisso(s) colocados na fila para mais tarde.\n",
|
||||||
"Esperando numero",
|
"Esperando numero",
|
||||||
"Funcao ilegal na clausula WARN"
|
"Funcao ilegal na clausula WARN",
|
||||||
|
"Can't convert between time zones",
|
||||||
|
"No files matching *.rem"
|
||||||
};
|
};
|
||||||
#endif /* MK_GLOBALS */
|
#endif /* MK_GLOBALS */
|
||||||
|
|
||||||
/* The following is only used in init.c */
|
/* The following is only used in init.c */
|
||||||
#ifdef L_IN_INIT
|
#ifdef L_IN_INIT
|
||||||
#define L_USAGE_OVERRIDE 1
|
#define L_USAGE_OVERRIDE 1
|
||||||
#ifdef HAVE_PROTOS
|
void Usage(void)
|
||||||
PUBLIC void Usage(void)
|
|
||||||
#else
|
|
||||||
void Usage()
|
|
||||||
#endif /* HAVE_PROTOS */
|
|
||||||
{
|
{
|
||||||
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-1998 by David F. Skoll\n", VERSION, L_LANGNAME);
|
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
|
||||||
fprintf(ErrFp, "(C) 1999 by Roaring Penguin Software Inc.\n");
|
fprintf(ErrFp, "(C) 1999-2000 Roaring Penguin Software Inc.\n");
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
|
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -9,13 +9,11 @@
|
|||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* */
|
/* */
|
||||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
|
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: romanian.h,v 1.5 1999-04-05 17:35:10 dfs Exp $ */
|
|
||||||
|
|
||||||
/* The very first define in a language support file must be L_LANGNAME: */
|
/* The very first define in a language support file must be L_LANGNAME: */
|
||||||
#define L_LANGNAME "Romanian"
|
#define L_LANGNAME "Romanian"
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright 1999 by Roaring Penguin Software Inc. */
|
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: spanish.h,v 1.2 1999-04-05 17:35:11 dfs Exp $ */
|
|
||||||
|
|
||||||
#define L_LANGNAME "Spanish"
|
#define L_LANGNAME "Spanish"
|
||||||
|
|
||||||
/* Nombres de los di'as de la semana */
|
/* Nombres de los di'as de la semana */
|
||||||
|
|||||||
20
src/lnk.bcc
20
src/lnk.bcc
@@ -1,20 +0,0 @@
|
|||||||
calendar.obj
|
|
||||||
dorem.obj
|
|
||||||
dosubst.obj
|
|
||||||
expr.obj
|
|
||||||
files.obj
|
|
||||||
funcs.obj
|
|
||||||
globals.obj
|
|
||||||
hbcal.obj
|
|
||||||
init.obj
|
|
||||||
main.obj
|
|
||||||
moon.obj
|
|
||||||
omit.obj
|
|
||||||
os2func.obj
|
|
||||||
queue.obj
|
|
||||||
sort.obj
|
|
||||||
token.obj
|
|
||||||
trigger.obj
|
|
||||||
userfns.obj
|
|
||||||
utils.obj
|
|
||||||
var.obj
|
|
||||||
23
src/lnk.msc
23
src/lnk.msc
@@ -1,23 +0,0 @@
|
|||||||
calendar.obj +
|
|
||||||
dorem.obj +
|
|
||||||
dosubst.obj +
|
|
||||||
expr.obj +
|
|
||||||
files.obj +
|
|
||||||
funcs.obj +
|
|
||||||
globals.obj +
|
|
||||||
hbcal.obj +
|
|
||||||
init.obj +
|
|
||||||
main.obj +
|
|
||||||
moon.obj +
|
|
||||||
omit.obj +
|
|
||||||
sort.obj +
|
|
||||||
token.obj +
|
|
||||||
trigger.obj +
|
|
||||||
userfns.obj +
|
|
||||||
utils.obj +
|
|
||||||
var.obj
|
|
||||||
remind.exe
|
|
||||||
nul
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
19
src/lnk.tc
19
src/lnk.tc
@@ -1,19 +0,0 @@
|
|||||||
-eremind.exe
|
|
||||||
calendar.obj
|
|
||||||
dorem.obj
|
|
||||||
dosubst.obj
|
|
||||||
expr.obj
|
|
||||||
files.obj
|
|
||||||
funcs.obj
|
|
||||||
globals.obj
|
|
||||||
hbcal.obj
|
|
||||||
init.obj
|
|
||||||
main.obj
|
|
||||||
moon.obj
|
|
||||||
omit.obj
|
|
||||||
sort.obj
|
|
||||||
token.obj
|
|
||||||
trigger.obj
|
|
||||||
userfns.obj
|
|
||||||
utils.obj
|
|
||||||
var.obj
|
|
||||||
511
src/main.c
511
src/main.c
@@ -7,34 +7,18 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: main.c,v 1.10 1999-04-05 17:34:52 dfs Exp $";
|
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDARG_H
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#ifdef TIME_WITH_SYS_TIME
|
#ifdef TIME_WITH_SYS_TIME
|
||||||
@@ -48,17 +32,7 @@ static char const RCSID[] = "$Id: main.c,v 1.10 1999-04-05 17:34:52 dfs Exp $";
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AMIGA
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__MSDOS__) || defined(__OS2__)
|
|
||||||
#include <dos.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
|
||||||
#include <sys/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
@@ -66,21 +40,11 @@ static char const RCSID[] = "$Id: main.c,v 1.10 1999-04-05 17:34:52 dfs Exp $";
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
|
|
||||||
PRIVATE void DoReminders ARGS ((void));
|
static void DoReminders(void);
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
/* Whooo... the putchar/Putchar/PutChar macros are a mess...
|
/* Whooo... the putchar/Putchar/PutChar macros are a mess...
|
||||||
my apologies... */
|
my apologies... */
|
||||||
#ifdef OS2_POPUP
|
|
||||||
#define Putchar(c) {if (AsPopUp) PutcPopUp(c); else putchar(c);}
|
|
||||||
#else
|
|
||||||
#define Putchar(c) PutChar(c)
|
#define Putchar(c) PutChar(c)
|
||||||
#endif
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@@ -89,27 +53,19 @@ long timelocal ARGS((struct tm *tm));
|
|||||||
/** **/
|
/** **/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int main(int argc, char *argv[])
|
||||||
PUBLIC int main(int argc, char *argv[])
|
|
||||||
#else
|
|
||||||
int main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
int pid;
|
int pid;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The very first thing to do is to set up ErrFp to be stderr */
|
/* The very first thing to do is to set up ErrFp to be stderr */
|
||||||
ErrFp = stderr;
|
ErrFp = stderr;
|
||||||
|
|
||||||
/* Set up global vars */
|
/* Set up global vars */
|
||||||
ArgC = argc;
|
ArgC = argc;
|
||||||
ArgV = argv;
|
ArgV = (char const **) argv;
|
||||||
|
|
||||||
InitRemind(argc, argv);
|
InitRemind(argc, (char const **) argv);
|
||||||
if(DoCalendar || DoSimpleCalendar) {
|
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
|
||||||
ProduceCalendar();
|
ProduceCalendar();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -128,32 +84,17 @@ char *argv[];
|
|||||||
if (!Hush) {
|
if (!Hush) {
|
||||||
if (DestroyOmitContexts())
|
if (DestroyOmitContexts())
|
||||||
Eprint("%s", ErrMsg[E_PUSH_NOPOP]);
|
Eprint("%s", ErrMsg[E_PUSH_NOPOP]);
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
if (!Daemon && !NextMode && !NumTriggered && !NumQueued) {
|
if (!Daemon && !NextMode && !NumTriggered && !NumQueued) {
|
||||||
printf("%s\n", ErrMsg[E_NOREMINDERS]);
|
printf("%s\n", ErrMsg[E_NOREMINDERS]);
|
||||||
} else if (!Daemon && !NextMode && !NumTriggered) {
|
} else if (!Daemon && !NextMode && !NumTriggered) {
|
||||||
printf(ErrMsg[M_QUEUED], NumQueued);
|
printf(ErrMsg[M_QUEUED], NumQueued);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (!NextMode && !NumTriggered) {
|
|
||||||
printf("%s\n", ErrMsg[E_NOREMINDERS]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's MS-DOS, reset the file access date. */
|
|
||||||
/* Note that OS/2 and DOS bound programs have __MSDOS__ */
|
|
||||||
/* defined, so this test should probably be modified. */
|
|
||||||
#if defined(__MSDOS__)
|
|
||||||
if (!UseStdin && (RealToday == JulianToday))
|
|
||||||
SetAccessDate(InitialFile, RealToday);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If there are sorted reminders, handle them */
|
/* If there are sorted reminders, handle them */
|
||||||
if (SortByDate) IssueSortedReminders();
|
if (SortByDate) IssueSortedReminders();
|
||||||
|
|
||||||
/* If there are any background reminders queued up, handle them */
|
/* If there are any background reminders queued up, handle them */
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
if (NumQueued || Daemon) {
|
if (NumQueued || Daemon) {
|
||||||
|
|
||||||
if (DontFork) {
|
if (DontFork) {
|
||||||
@@ -171,7 +112,6 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (Iterations) {
|
if (Iterations) {
|
||||||
ClearGlobalOmits();
|
ClearGlobalOmits();
|
||||||
DestroyOmitContexts();
|
DestroyOmitContexts();
|
||||||
@@ -190,15 +130,11 @@ char *argv[];
|
|||||||
/* The normal case - we're not doing a calendar. */
|
/* The normal case - we're not doing a calendar. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void DoReminders(void)
|
||||||
PRIVATE void DoReminders(void)
|
|
||||||
#else
|
|
||||||
static void DoReminders()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
Token tok;
|
Token tok;
|
||||||
char *s;
|
char const *s;
|
||||||
Parser p;
|
Parser p;
|
||||||
|
|
||||||
if (!UseStdin) {
|
if (!UseStdin) {
|
||||||
@@ -212,7 +148,7 @@ static void DoReminders()
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
r=OpenFile(InitialFile);
|
r=IncludeFile(InitialFile);
|
||||||
if (r) {
|
if (r) {
|
||||||
fprintf(ErrFp, "%s %s: %s\n", ErrMsg[E_ERR_READING],
|
fprintf(ErrFp, "%s %s: %s\n", ErrMsg[E_ERR_READING],
|
||||||
InitialFile, ErrMsg[r]);
|
InitialFile, ErrMsg[r]);
|
||||||
@@ -308,12 +244,7 @@ static void DoReminders()
|
|||||||
/* 1 January 1990. */
|
/* 1 January 1990. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int Julian(int year, int month, int day)
|
||||||
PUBLIC int Julian(int year, int month, int day)
|
|
||||||
#else
|
|
||||||
int Julian(year, month, day)
|
|
||||||
int day, month, year;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y1 = BASE-1, y2 = year-1;
|
int y1 = BASE-1, y2 = year-1;
|
||||||
|
|
||||||
@@ -332,13 +263,7 @@ int day, month, year;
|
|||||||
/* Convert a Julian date to year, month, day. */
|
/* Convert a Julian date to year, month, day. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void FromJulian(int jul, int *y, int *m, int *d)
|
||||||
PUBLIC void FromJulian(int jul, int *y, int *m, int *d)
|
|
||||||
#else
|
|
||||||
void FromJulian(jul, y, m, d)
|
|
||||||
int jul;
|
|
||||||
int *y, *m, *d;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int try_yr = (jul / 365) + BASE;
|
int try_yr = (jul / 365) + BASE;
|
||||||
int try_mon = 0;
|
int try_mon = 0;
|
||||||
@@ -378,14 +303,7 @@ int *y, *m, *d;
|
|||||||
/* zero, then just peek ahead; don't advance pointer. */
|
/* zero, then just peek ahead; don't advance pointer. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ParseChar(ParsePtr p, int *err, int peek)
|
||||||
PUBLIC int ParseChar(ParsePtr p, int *err, int peek)
|
|
||||||
#else
|
|
||||||
int ParseChar(p, err, peek)
|
|
||||||
ParsePtr p;
|
|
||||||
int *err;
|
|
||||||
int peek;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value val;
|
Value val;
|
||||||
int r;
|
int r;
|
||||||
@@ -412,7 +330,7 @@ int peek;
|
|||||||
return *(p->epos++);
|
return *(p->epos++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(p->etext); /* End of substituted expression */
|
free((void *) p->etext); /* End of substituted expression */
|
||||||
p->etext = NULL;
|
p->etext = NULL;
|
||||||
p->epos = NULL;
|
p->epos = NULL;
|
||||||
p->isnested = 0;
|
p->isnested = 0;
|
||||||
@@ -427,6 +345,7 @@ int peek;
|
|||||||
return *(p->pos++);
|
return *(p->pos++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
p->expr_happened = 1;
|
||||||
p->pos++;
|
p->pos++;
|
||||||
r = EvalExpr(&(p->pos), &val);
|
r = EvalExpr(&(p->pos), &val);
|
||||||
if (r) {
|
if (r) {
|
||||||
@@ -457,14 +376,7 @@ int peek;
|
|||||||
/* Parse the next non-space character. */
|
/* Parse the next non-space character. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ParseNonSpaceChar(ParsePtr p, int *err, int peek)
|
||||||
PUBLIC int ParseNonSpaceChar(ParsePtr p, int *err, int peek)
|
|
||||||
#else
|
|
||||||
int ParseNonSpaceChar(p, err, peek)
|
|
||||||
ParsePtr p;
|
|
||||||
int *err;
|
|
||||||
int peek;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
@@ -487,13 +399,7 @@ int peek;
|
|||||||
/* Parse a token delimited by whitespace. */
|
/* Parse a token delimited by whitespace. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ParseToken(ParsePtr p, DynamicBuffer *dbuf)
|
||||||
PUBLIC int ParseToken(ParsePtr p, DynamicBuffer *dbuf)
|
|
||||||
#else
|
|
||||||
int ParseToken(p, dbuf)
|
|
||||||
ParsePtr p;
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int c, err;
|
int c, err;
|
||||||
|
|
||||||
@@ -529,13 +435,7 @@ DynamicBuffer *dbuf;
|
|||||||
/* invalid. */
|
/* invalid. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ParseIdentifier(ParsePtr p, DynamicBuffer *dbuf)
|
||||||
PUBLIC int ParseIdentifier(ParsePtr p, DynamicBuffer *dbuf)
|
|
||||||
#else
|
|
||||||
int ParseIdentifier(p, dbuf)
|
|
||||||
ParsePtr p;
|
|
||||||
DynamicBuffer *dbuf;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int c, err;
|
int c, err;
|
||||||
|
|
||||||
@@ -577,13 +477,7 @@ DynamicBuffer *dbuf;
|
|||||||
/* return the value. */
|
/* return the value. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int EvaluateExpr(ParsePtr p, Value *v)
|
||||||
PUBLIC int EvaluateExpr(ParsePtr p, Value *v)
|
|
||||||
#else
|
|
||||||
int EvaluateExpr(p, v)
|
|
||||||
ParsePtr p;
|
|
||||||
Value *v;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int bracketed = 0;
|
int bracketed = 0;
|
||||||
@@ -610,47 +504,28 @@ Value *v;
|
|||||||
/* Eprint - print an error message. */
|
/* Eprint - print an error message. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_STDARG_H
|
void Eprint(char const *fmt, ...)
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PUBLIC void Eprint(const char *fmt, ...)
|
|
||||||
#else
|
|
||||||
void Eprint(fmt)
|
|
||||||
char *fmt;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
/*VARARGS0*/
|
|
||||||
void Eprint(va_alist)
|
|
||||||
va_dcl
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
#ifndef HAVE_STDARG_H
|
|
||||||
char *fmt;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check if more than one error msg. from this line */
|
/* Check if more than one error msg. from this line */
|
||||||
if (!FreshLine && !ShowAllErrors) return;
|
if (!FreshLine && !ShowAllErrors) return;
|
||||||
|
|
||||||
if (FreshLine) {
|
if (FreshLine && FileName) {
|
||||||
FreshLine = 0;
|
FreshLine = 0;
|
||||||
if (strcmp(FileName, "-"))
|
if (strcmp(FileName, "-"))
|
||||||
(void) fprintf(ErrFp, "%s(%d): ", FileName, LineNo);
|
(void) fprintf(ErrFp, "%s(%d): ", FileName, LineNo);
|
||||||
else
|
else
|
||||||
(void) fprintf(ErrFp, "-stdin-(%d): ", LineNo);
|
(void) fprintf(ErrFp, "-stdin-(%d): ", LineNo);
|
||||||
if (DebugFlag & DB_PRTLINE) OutputLine(ErrFp);
|
if (DebugFlag & DB_PRTLINE) OutputLine(ErrFp);
|
||||||
} else fprintf(ErrFp, " ");
|
} else if (FileName) {
|
||||||
|
fprintf(ErrFp, " ");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_STDARG_H
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
#else
|
|
||||||
va_start(argptr);
|
|
||||||
fmt = va_arg(argptr, char *);
|
|
||||||
#endif
|
|
||||||
(void) vfprintf(ErrFp, fmt, argptr);
|
(void) vfprintf(ErrFp, fmt, argptr);
|
||||||
(void) fputc('\n', ErrFp);
|
(void) fputc('\n', ErrFp);
|
||||||
#ifndef HAVE_STDARG_H
|
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,15 +537,10 @@ va_dcl
|
|||||||
/* simply involves escaping newlines. */
|
/* simply involves escaping newlines. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void OutputLine(FILE *fp)
|
||||||
PUBLIC void OutputLine(FILE *fp)
|
|
||||||
#else
|
|
||||||
void OutputLine(fp)
|
|
||||||
FILE *fp;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register char *s = CurLine;
|
char const *s = CurLine;
|
||||||
register char c = 0;
|
char c = 0;
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
if (*s == '\n') Putc('\\', fp);
|
if (*s == '\n') Putc('\\', fp);
|
||||||
@@ -687,13 +557,7 @@ FILE *fp;
|
|||||||
/* Create a parser given a string buffer */
|
/* Create a parser given a string buffer */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void CreateParser(char const *s, ParsePtr p)
|
||||||
PUBLIC void CreateParser(char *s, ParsePtr p)
|
|
||||||
#else
|
|
||||||
void CreateParser(s, p)
|
|
||||||
char *s;
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
p->text = s;
|
p->text = s;
|
||||||
p->pos = s;
|
p->pos = s;
|
||||||
@@ -702,6 +566,7 @@ ParsePtr p;
|
|||||||
p->etext = NULL;
|
p->etext = NULL;
|
||||||
p->allownested = 1;
|
p->allownested = 1;
|
||||||
p->tokenPushed = NULL;
|
p->tokenPushed = NULL;
|
||||||
|
p->expr_happened = 0;
|
||||||
DBufInit(&p->pushedToken);
|
DBufInit(&p->pushedToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,15 +577,10 @@ ParsePtr p;
|
|||||||
/* Destroy a parser, freeing up resources used. */
|
/* Destroy a parser, freeing up resources used. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DestroyParser(ParsePtr p)
|
||||||
PUBLIC void DestroyParser(ParsePtr p)
|
|
||||||
#else
|
|
||||||
void DestroyParser(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (p->isnested && p->etext) {
|
if (p->isnested && p->etext) {
|
||||||
free(p->etext);
|
free((void *) p->etext);
|
||||||
p->etext = NULL;
|
p->etext = NULL;
|
||||||
p->isnested = 0;
|
p->isnested = 0;
|
||||||
}
|
}
|
||||||
@@ -733,16 +593,10 @@ ParsePtr p;
|
|||||||
/* on a per-parser basis. */
|
/* on a per-parser basis. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int PushToken(char const *tok, ParsePtr p)
|
||||||
PUBLIC int PushToken(const char *tok, ParsePtr p)
|
|
||||||
#else
|
|
||||||
int PushToken(tok, p)
|
|
||||||
char *tok;
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DBufFree(&p->pushedToken);
|
DBufFree(&p->pushedToken);
|
||||||
if (DBufPuts(&p->pushedToken, (char *) tok) != OK ||
|
if (DBufPuts(&p->pushedToken, tok) != OK ||
|
||||||
DBufPutc(&p->pushedToken, ' ') != OK) {
|
DBufPutc(&p->pushedToken, ' ') != OK) {
|
||||||
DBufFree(&p->pushedToken);
|
DBufFree(&p->pushedToken);
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
@@ -758,26 +612,8 @@ ParsePtr p;
|
|||||||
/* Return the system time in seconds past midnight */
|
/* Return the system time in seconds past midnight */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
long SystemTime(int realtime)
|
||||||
PUBLIC long SystemTime(int realtime)
|
|
||||||
#else
|
|
||||||
long SystemTime(realtime)
|
|
||||||
int realtime;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#if defined( __MSDOS__ ) && defined( __TURBOC__ )
|
|
||||||
/* Get time in Turbo C */
|
|
||||||
|
|
||||||
struct time t;
|
|
||||||
|
|
||||||
/* If time was supplied on command line, return it. */
|
|
||||||
if (!realtime && (SysTime != -1L)) return SysTime;
|
|
||||||
|
|
||||||
gettime(&t);
|
|
||||||
return (long) t.ti_hour * 3600L + (long) t.ti_min * 60L +
|
|
||||||
(long) t.ti_sec;
|
|
||||||
#else
|
|
||||||
/* Get time in Unix or with MSC */
|
|
||||||
time_t tloc;
|
time_t tloc;
|
||||||
struct tm *t;
|
struct tm *t;
|
||||||
|
|
||||||
@@ -787,8 +623,8 @@ int realtime;
|
|||||||
t = localtime(&tloc);
|
t = localtime(&tloc);
|
||||||
return (long) t->tm_hour * 3600L + (long) t->tm_min * 60L +
|
return (long) t->tm_hour * 3600L + (long) t->tm_min * 60L +
|
||||||
(long) t->tm_sec;
|
(long) t->tm_sec;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* SystemDate */
|
/* SystemDate */
|
||||||
@@ -798,25 +634,8 @@ int realtime;
|
|||||||
/* year.) */
|
/* year.) */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int SystemDate(int *y, int *m, int *d)
|
||||||
PUBLIC int SystemDate(int *y, int *m, int *d)
|
|
||||||
#else
|
|
||||||
int SystemDate(y, m, d)
|
|
||||||
int *d;
|
|
||||||
int *m;
|
|
||||||
int *y;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#if defined( __MSDOS__ ) && defined( __TURBOC__ )
|
|
||||||
/* Get today's date in Turbo C */
|
|
||||||
struct date da;
|
|
||||||
|
|
||||||
getdate(&da);
|
|
||||||
*y = da.da_year;
|
|
||||||
*m = da.da_mon - 1;
|
|
||||||
*d = da.da_day;
|
|
||||||
#else
|
|
||||||
/* Get today's date in UNIX or with MSC */
|
|
||||||
time_t tloc;
|
time_t tloc;
|
||||||
struct tm *t;
|
struct tm *t;
|
||||||
|
|
||||||
@@ -826,7 +645,7 @@ int *y;
|
|||||||
*d = t->tm_mday;
|
*d = t->tm_mday;
|
||||||
*m = t->tm_mon;
|
*m = t->tm_mon;
|
||||||
*y = t->tm_year + 1900;
|
*y = t->tm_year + 1900;
|
||||||
#endif
|
|
||||||
return Julian(*y, *m, *d);
|
return Julian(*y, *m, *d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,12 +655,7 @@ int *y;
|
|||||||
/* DoIf - handle the IF command. */
|
/* DoIf - handle the IF command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoIf(ParsePtr p)
|
||||||
PUBLIC int DoIf(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoIf(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v;
|
Value v;
|
||||||
int r;
|
int r;
|
||||||
@@ -875,12 +689,7 @@ ParsePtr p;
|
|||||||
/* DoElse - handle the ELSE command. */
|
/* DoElse - handle the ELSE command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoElse(ParsePtr p)
|
||||||
PUBLIC int DoElse(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoElse(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
unsigned syndrome;
|
unsigned syndrome;
|
||||||
|
|
||||||
@@ -899,12 +708,7 @@ ParsePtr p;
|
|||||||
/* DoEndif - handle the Endif command. */
|
/* DoEndif - handle the Endif command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoEndif(ParsePtr p)
|
||||||
PUBLIC int DoEndif(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoEndif(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (!NumIfs) return E_ENDIF_NO_IF;
|
if (!NumIfs) return E_ENDIF_NO_IF;
|
||||||
NumIfs--;
|
NumIfs--;
|
||||||
@@ -918,12 +722,7 @@ ParsePtr p;
|
|||||||
/* Handle the IFTRIG command. */
|
/* Handle the IFTRIG command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoIfTrig(ParsePtr p)
|
||||||
PUBLIC int DoIfTrig(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoIfTrig(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
unsigned syndrome;
|
unsigned syndrome;
|
||||||
@@ -959,11 +758,7 @@ ParsePtr p;
|
|||||||
/* stack, should we ignore the current line? */
|
/* stack, should we ignore the current line? */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ShouldIgnoreLine(void)
|
||||||
PUBLIC int ShouldIgnoreLine(void)
|
|
||||||
#else
|
|
||||||
int ShouldIgnoreLine()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int i, syndrome;
|
register int i, syndrome;
|
||||||
|
|
||||||
@@ -985,12 +780,7 @@ int ShouldIgnoreLine()
|
|||||||
/* Verify that current line contains no more tokens. */
|
/* Verify that current line contains no more tokens. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int VerifyEoln(ParsePtr p)
|
||||||
PUBLIC int VerifyEoln(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int VerifyEoln(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -1016,12 +806,7 @@ ParsePtr p;
|
|||||||
/* Set the debug options under program control. */
|
/* Set the debug options under program control. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoDebug(ParsePtr p)
|
||||||
PUBLIC int DoDebug(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoDebug(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int ch;
|
int ch;
|
||||||
@@ -1078,6 +863,11 @@ ParsePtr p;
|
|||||||
else DebugFlag &= ~DB_PRTLINE;
|
else DebugFlag &= ~DB_PRTLINE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
case 'F':
|
||||||
|
if (val) DebugFlag |= DB_TRACE_FILES;
|
||||||
|
else DebugFlag &= ~DB_TRACE_FILES;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1090,12 +880,7 @@ ParsePtr p;
|
|||||||
/* reminder is issued. */
|
/* reminder is issued. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoBanner(ParsePtr p)
|
||||||
PUBLIC int DoBanner(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoBanner(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int c;
|
int c;
|
||||||
@@ -1133,12 +918,7 @@ ParsePtr p;
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoRun(ParsePtr p)
|
||||||
PUBLIC int DoRun(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoRun(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -1170,12 +950,7 @@ ParsePtr p;
|
|||||||
/* Flush stdout and stderr */
|
/* Flush stdout and stderr */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoFlush(ParsePtr p)
|
||||||
PUBLIC int DoFlush(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoFlush(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@@ -1189,12 +964,7 @@ ParsePtr p;
|
|||||||
/* Handle the EXIT command. */
|
/* Handle the EXIT command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DoExit(ParsePtr p)
|
||||||
PUBLIC void DoExit(ParsePtr p)
|
|
||||||
#else
|
|
||||||
void DoExit(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
Value v;
|
Value v;
|
||||||
@@ -1211,17 +981,12 @@ ParsePtr p;
|
|||||||
/* Issue an error message under program control. */
|
/* Issue an error message under program control. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoErrMsg(ParsePtr p)
|
||||||
PUBLIC int DoErrMsg(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoErrMsg(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
TimeTrig tt;
|
TimeTrig tt;
|
||||||
Trigger t;
|
Trigger t;
|
||||||
int r;
|
int r;
|
||||||
char *s;
|
char const *s;
|
||||||
|
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
|
|
||||||
@@ -1258,12 +1023,7 @@ static int FoldArray[2][7] = {
|
|||||||
{2024, 2008, 2020, 2004, 2016, 2000, 2012}
|
{2024, 2008, 2020, 2004, 2016, 2000, 2012}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
int CalcMinsFromUTC(int jul, int tim, int *mins, int *isdst)
|
||||||
PUBLIC int CalcMinsFromUTC(int jul, int tim, int *mins, int *isdst)
|
|
||||||
#else
|
|
||||||
int CalcMinsFromUTC(jul, tim, mins, isdst)
|
|
||||||
int jul, tim, *mins, *isdst;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Convert jul and tim to an Unix tm struct */
|
/* Convert jul and tim to an Unix tm struct */
|
||||||
@@ -1291,11 +1051,6 @@ int jul, tim, *mins, *isdst;
|
|||||||
local.tm_isdst = -1; /* We don't know whether or not dst is in effect */
|
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 */
|
/* Horrible contortions to get minutes from UTC portably */
|
||||||
loc_t = mktime(&local);
|
loc_t = mktime(&local);
|
||||||
if (loc_t == -1) return 1;
|
if (loc_t == -1) return 1;
|
||||||
@@ -1308,21 +1063,10 @@ int jul, tim, *mins, *isdst;
|
|||||||
utc.tm_isdst = 0;
|
utc.tm_isdst = 0;
|
||||||
utc_t = mktime(&utc);
|
utc_t = mktime(&utc);
|
||||||
if (utc_t == -1) return 1;
|
if (utc_t == -1) return 1;
|
||||||
#endif
|
|
||||||
/* Compute difference between local time and UTC in seconds.
|
/* Compute difference between local time and UTC in seconds.
|
||||||
Be careful, since time_t might be unsigned. */
|
Be careful, since time_t might be unsigned. */
|
||||||
|
|
||||||
#ifdef HAVE_DIFFTIME
|
|
||||||
tdiff = (int) difftime(loc_t, utc_t);
|
tdiff = (int) difftime(loc_t, utc_t);
|
||||||
#else
|
|
||||||
/* 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_tmp) tdiff += 60*60;
|
if (isdst_tmp) tdiff += 60*60;
|
||||||
if (mins) *mins = (int)(tdiff / 60);
|
if (mins) *mins = (int)(tdiff / 60);
|
||||||
if (isdst) *isdst = isdst_tmp;
|
if (isdst) *isdst = isdst_tmp;
|
||||||
@@ -1344,22 +1088,7 @@ int jul, tim, *mins, *isdst;
|
|||||||
/* A macro safe ONLY if used with arg with no side effects! */
|
/* A macro safe ONLY if used with arg with no side effects! */
|
||||||
#define ISBLANK(c) (isspace(c) && (c) != '\n')
|
#define ISBLANK(c) (isspace(c) && (c) != '\n')
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
void FillParagraph(char const *s)
|
||||||
#ifdef OS2_POPUP
|
|
||||||
PUBLIC void FillParagraph(char *s, int AsPopUp)
|
|
||||||
#else
|
|
||||||
PUBLIC void FillParagraph(char *s)
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef OS2_POPUP
|
|
||||||
void FillParagraph(s, AsPopUp)
|
|
||||||
char *s;
|
|
||||||
int AsPopUp;
|
|
||||||
#else
|
|
||||||
void FillParagraph(s)
|
|
||||||
char *s;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int line = 0;
|
int line = 0;
|
||||||
@@ -1367,7 +1096,7 @@ char *s;
|
|||||||
int doublespace = 1;
|
int doublespace = 1;
|
||||||
int pendspace;
|
int pendspace;
|
||||||
int len;
|
int len;
|
||||||
char *t;
|
char const *t;
|
||||||
|
|
||||||
int roomleft;
|
int roomleft;
|
||||||
|
|
||||||
@@ -1433,81 +1162,6 @@ char *s;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(HAVE_TIMEGM) && !defined(HAVE_MKTIME)
|
|
||||||
#define TGM_SEC (1)
|
|
||||||
#define TGM_MIN (60 * TGM_SEC)
|
|
||||||
#define TGM_HR (60 * TGM_MIN)
|
|
||||||
#define TGM_DAY (24 * TGM_HR)
|
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PRIVATE long time_cheat(int year, int month)
|
|
||||||
#else
|
|
||||||
static long time_cheat (year, month)
|
|
||||||
int year;
|
|
||||||
int month;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
long guess = time((long *) NULL);
|
|
||||||
struct tm g;
|
|
||||||
int diff;
|
|
||||||
|
|
||||||
g = *gmtime (&guess);
|
|
||||||
while ((diff = year - g.tm_year) > 0)
|
|
||||||
{
|
|
||||||
guess += diff * (363 - TGM_DAY);
|
|
||||||
g = *gmtime (&guess);
|
|
||||||
}
|
|
||||||
g.tm_mday--;
|
|
||||||
guess -= g.tm_sec * TGM_SEC + g.tm_min * TGM_MIN +
|
|
||||||
g.tm_hour * TGM_HR + g.tm_mday * TGM_DAY;
|
|
||||||
return (guess);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PUBLIC long timegm (struct tm *tm)
|
|
||||||
#else
|
|
||||||
long timegm(tm)
|
|
||||||
struct tm *tm;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
long clock = time_cheat (tm->tm_year, tm->tm_mon);
|
|
||||||
|
|
||||||
return (clock + tm->tm_sec * TGM_SEC +
|
|
||||||
tm->tm_min * TGM_MIN +
|
|
||||||
tm->tm_hour * TGM_HR +
|
|
||||||
(tm->tm_mday - 1) * TGM_DAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PUBLIC long timelocal (struct tm *tm)
|
|
||||||
#else
|
|
||||||
long timelocal (tm)
|
|
||||||
struct tm *tm;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
long zero = 0;
|
|
||||||
struct tm epoch;
|
|
||||||
int tzmin;
|
|
||||||
long clock;
|
|
||||||
struct tm test;
|
|
||||||
|
|
||||||
epoch = *localtime (&zero);
|
|
||||||
tzmin = epoch.tm_hour * 60 + epoch.tm_min;
|
|
||||||
if (tzmin > 0)
|
|
||||||
{
|
|
||||||
tzmin = 24 * 60 - tzmin;
|
|
||||||
if (epoch.tm_year == 70)
|
|
||||||
tzmin -= 24 * 60;
|
|
||||||
}
|
|
||||||
clock = timegm (tm) + tzmin * TGM_MIN;
|
|
||||||
test = *localtime (&clock);
|
|
||||||
|
|
||||||
if (test.tm_hour != tm->tm_hour)
|
|
||||||
clock -= TGM_HR;
|
|
||||||
return (clock);
|
|
||||||
}
|
|
||||||
#endif /* NEED_TIMEGM */
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* LocalToUTC */
|
/* LocalToUTC */
|
||||||
@@ -1515,12 +1169,7 @@ struct tm *tm;
|
|||||||
/* Convert a local date/time to a UTC date/time. */
|
/* Convert a local date/time to a UTC date/time. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void LocalToUTC(int locdate, int loctime, int *utcdate, int *utctime)
|
||||||
PUBLIC void LocalToUTC(int locdate, int loctime, int *utcdate, int *utctime)
|
|
||||||
#else
|
|
||||||
void LocalToUTC(locdate, loctime, utcdate, utctime)
|
|
||||||
int locdate, loctime, *utcdate, *utctime;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int diff;
|
int diff;
|
||||||
int dummy;
|
int dummy;
|
||||||
@@ -1530,10 +1179,10 @@ int locdate, loctime, *utcdate, *utctime;
|
|||||||
|
|
||||||
loctime -= diff;
|
loctime -= diff;
|
||||||
if (loctime < 0) {
|
if (loctime < 0) {
|
||||||
loctime += 1440;
|
loctime += MINUTES_PER_DAY;
|
||||||
locdate--;
|
locdate--;
|
||||||
} else if (loctime >= 1440) {
|
} else if (loctime >= MINUTES_PER_DAY) {
|
||||||
loctime -= 1440;
|
loctime -= MINUTES_PER_DAY;
|
||||||
locdate++;
|
locdate++;
|
||||||
}
|
}
|
||||||
*utcdate = locdate;
|
*utcdate = locdate;
|
||||||
@@ -1547,12 +1196,7 @@ int locdate, loctime, *utcdate, *utctime;
|
|||||||
/* Convert a UTC date/time to a local date/time. */
|
/* Convert a UTC date/time to a local date/time. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
|
||||||
PUBLIC void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
|
|
||||||
#else
|
|
||||||
void UTCToLocal(utcdate, utctime, locdate, loctime)
|
|
||||||
int utcdate, utctime, *locdate, *loctime;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int diff;
|
int diff;
|
||||||
int dummy;
|
int dummy;
|
||||||
@@ -1563,10 +1207,10 @@ int utcdate, utctime, *locdate, *loctime;
|
|||||||
|
|
||||||
utctime += diff;
|
utctime += diff;
|
||||||
if (utctime < 0) {
|
if (utctime < 0) {
|
||||||
utctime += 1440;
|
utctime += MINUTES_PER_DAY;
|
||||||
utcdate--;
|
utcdate--;
|
||||||
} else if (utctime >= 1440) {
|
} else if (utctime >= MINUTES_PER_DAY) {
|
||||||
utctime -= 1440;
|
utctime -= MINUTES_PER_DAY;
|
||||||
utcdate++;
|
utcdate++;
|
||||||
}
|
}
|
||||||
*locdate = utcdate;
|
*locdate = utcdate;
|
||||||
@@ -1581,34 +1225,11 @@ int utcdate, utctime, *locdate, *loctime;
|
|||||||
/* contents of the queue. This does NOT work when the -f */
|
/* contents of the queue. This does NOT work when the -f */
|
||||||
/* command-line flag is supplied. */
|
/* command-line flag is supplied. */
|
||||||
/* */
|
/* */
|
||||||
/* For OS/2, this has to be in the main thread. */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
void SigIntHandler(int d)
|
||||||
void __cdecl SigIntHandler(int d)
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
RETSIGTYPE SigIntHandler(int d)
|
|
||||||
#else
|
|
||||||
RETSIGTYPE SigIntHandler()
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
signal(SIGINT, SigIntHandler);
|
signal(SIGINT, SigIntHandler);
|
||||||
#ifdef __BORLANDC__
|
|
||||||
signal(SIGINT, SIG_DFL);
|
|
||||||
#else
|
|
||||||
#ifdef __OS2__
|
|
||||||
signal(SIGINT, SIG_ACK);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
GotSigInt();
|
GotSigInt();
|
||||||
|
|
||||||
#ifndef UNIX
|
|
||||||
exit(0);
|
exit(0);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_QUEUED */
|
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
# Makefile for REMIND for Borland C++
|
|
||||||
# $Id: makefile.bcc,v 1.2 1998-03-01 20:43:56 dfs Exp $
|
|
||||||
|
|
||||||
VERSION= 03.00.19
|
|
||||||
|
|
||||||
MODEL=l
|
|
||||||
|
|
||||||
!if $d(__OS2__)
|
|
||||||
CFLAGS= -DOS2_POPUP -w-pia -O2
|
|
||||||
BINDIR= ..\OS2-EX
|
|
||||||
DELFLAG= /f
|
|
||||||
!else
|
|
||||||
CFLAGS= -w-pia -O2 -m$(MODEL)
|
|
||||||
BINDIR= ..\MSDOS-EX
|
|
||||||
DELFLAG=
|
|
||||||
!endif
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c init.c \
|
|
||||||
main.c omit.c sort.c token.c trigger.c userfns.c utils.c var.c hbcal.c \
|
|
||||||
queue.c moon.c os2func.c
|
|
||||||
|
|
||||||
OBJS=calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
|
|
||||||
globals.obj init.obj main.obj omit.obj sort.obj token.obj trigger.obj \
|
|
||||||
utils.obj userfns.obj var.obj hbcal.obj queue.obj moon.obj os2func.obj
|
|
||||||
|
|
||||||
all: exes test-rem.cmd test-rem.bat
|
|
||||||
test-rem
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-del $(DELFLAG) *.obj
|
|
||||||
-del $(DELFLAG) $(BINDIR)\*.exe
|
|
||||||
|
|
||||||
exes: $(BINDIR)\remind.exe $(BINDIR)\rem2ps.exe
|
|
||||||
|
|
||||||
..\os2-ex\remind.exe: $(OBJS)
|
|
||||||
bcc -e..\os2-ex\remind @lnk.bcc -lap;Toe
|
|
||||||
|
|
||||||
..\msdos-ex\remind.exe: $(OBJS)
|
|
||||||
bcc -e..\msdos-ex\remind -m$(MODEL) @lnk.bcc
|
|
||||||
|
|
||||||
..\os2-ex\rem2ps.exe: rem2ps.obj
|
|
||||||
bcc -e..\os2-ex\rem2ps rem2ps.obj -lap;Toe
|
|
||||||
|
|
||||||
..\msdos-ex\rem2ps.exe: rem2ps.obj
|
|
||||||
bcc -e..\msdos-ex\rem2ps -m$(MODEL) rem2ps.obj
|
|
||||||
|
|
||||||
.c.obj:
|
|
||||||
bcc $(CFLAGS) -c {$< }
|
|
||||||
|
|
||||||
rem2ps.obj: rem2ps.c rem2ps.h config.h lang.h
|
|
||||||
|
|
||||||
calendar.obj: calendar.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
dorem.obj: dorem.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
dosubst.obj: dosubst.c $(STDHDRS) $(LANGHDRS)
|
|
||||||
|
|
||||||
expr.obj: expr.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
files.obj: files.c $(STDHDRS)
|
|
||||||
|
|
||||||
funcs.obj: funcs.c $(STDHDRS) expr.h version.h
|
|
||||||
|
|
||||||
globals.obj: globals.c config.h types.h globals.h err.h lang.h
|
|
||||||
|
|
||||||
init.obj: init.c $(STDHDRS) expr.h version.h
|
|
||||||
|
|
||||||
main.obj: main.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
moon.obj: moon.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
omit.obj: omit.c $(STDHDRS)
|
|
||||||
|
|
||||||
os2func.obj: os2func.c $(STDHDRS)
|
|
||||||
|
|
||||||
queue.obj: queue.c $(STDHDRS)
|
|
||||||
|
|
||||||
sort.obj: sort.c $(STDHDRS)
|
|
||||||
|
|
||||||
token.obj: token.c $(STDHDRS)
|
|
||||||
|
|
||||||
trigger.obj: trigger.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
userfns.obj: userfns.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
utils.obj: utils.c $(STDHDRS)
|
|
||||||
|
|
||||||
var.obj: var.c $(STDHDRS) expr.h
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
# Makefile for REMIND for Microsoft C for MSDOS
|
|
||||||
# $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 \
|
|
||||||
utils.obj var.obj sort.obj hbcal.obj moon.obj
|
|
||||||
|
|
||||||
DEFINES= /D__MSDOS__ /D__MSC__
|
|
||||||
|
|
||||||
MODEL= /AM
|
|
||||||
|
|
||||||
calendar.obj: calendar.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Focalendar.obj calendar.c
|
|
||||||
|
|
||||||
dorem.obj: dorem.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fodorem.obj dorem.c
|
|
||||||
|
|
||||||
dosubst.obj: dosubst.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fodosubst.obj dosubst.c
|
|
||||||
|
|
||||||
expr.obj: expr.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Foexpr.obj expr.c
|
|
||||||
|
|
||||||
hbcal.obj: hbcal.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fohbcal.obj hbcal.c
|
|
||||||
|
|
||||||
sort.obj: sort.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fosort.obj sort.c
|
|
||||||
|
|
||||||
files.obj: files.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fofiles.obj files.c
|
|
||||||
|
|
||||||
funcs.obj: funcs.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fofuncs.obj funcs.c
|
|
||||||
|
|
||||||
globals.obj: globals.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Foglobals.obj globals.c
|
|
||||||
|
|
||||||
init.obj: init.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Foinit.obj init.c
|
|
||||||
|
|
||||||
main.obj: main.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fomain.obj main.c
|
|
||||||
|
|
||||||
moon.obj: moon.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fomoon.obj moon.c
|
|
||||||
|
|
||||||
omit.obj: omit.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Foomit.obj omit.c
|
|
||||||
|
|
||||||
token.obj: token.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fotoken.obj token.c
|
|
||||||
|
|
||||||
trigger.obj: trigger.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fotrigger.obj trigger.c
|
|
||||||
|
|
||||||
userfns.obj: userfns.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fouserfns.obj userfns.c
|
|
||||||
|
|
||||||
utils.obj: utils.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Foutils.obj utils.c
|
|
||||||
|
|
||||||
var.obj: var.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Fovar.obj var.c
|
|
||||||
|
|
||||||
remind.exe: $(OBJS)
|
|
||||||
link /NOI @lnk.msc
|
|
||||||
|
|
||||||
rem2ps.obj: rem2ps.c
|
|
||||||
cl /c $(DEFINES) $(MODEL) /Forem2ps.obj rem2ps.c
|
|
||||||
|
|
||||||
rem2ps.exe: rem2ps.obj
|
|
||||||
link /NOI rem2ps,rem2ps.exe,,,
|
|
||||||
|
|
||||||
122
src/makefile.os2
122
src/makefile.os2
@@ -1,122 +0,0 @@
|
|||||||
# Makefile for REMIND
|
|
||||||
#
|
|
||||||
# $Id: makefile.os2,v 1.1 1998-01-15 02:50:32 dfs Exp $
|
|
||||||
#
|
|
||||||
# THIS IS OUT OF DATE!
|
|
||||||
#
|
|
||||||
# - for GNU gcc (emx 0.8g kit) [executables for OS/2 2.x or DOS (32-bit)]
|
|
||||||
# - for Microsoft C 6.00A [executables for OS/2 or MSDOS (16-bit)]
|
|
||||||
|
|
||||||
# To use, enter "make -f Makefile.os2" (this makefile depends on its
|
|
||||||
# name being "Makefile.os2").
|
|
||||||
#
|
|
||||||
# Tested with dmake 3.8 and GNU make 3.68 under OS/2
|
|
||||||
|
|
||||||
default:
|
|
||||||
@echo "Enter $(MAKE) -f Makefile.os2 target "
|
|
||||||
@echo " where 'target' is chosen from "
|
|
||||||
@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:
|
|
||||||
$(MAKE) -f Makefile.os2 all \
|
|
||||||
CC="cl -nologo -AM" O=".obj" \
|
|
||||||
CFLAGS="-D__STDC__ -D__OS2__" \
|
|
||||||
LFLAGS="-Lp" \
|
|
||||||
LFLAGS2="setargv.obj remind.def -link /NOE"
|
|
||||||
|
|
||||||
mscbnd:
|
|
||||||
$(MAKE) -f Makefile.os2 all \
|
|
||||||
CC="cl -nologo -AM" O=".obj" \
|
|
||||||
CFLAGS="-D__STDC__ -D__OS2__ -D__MSDOS__" \
|
|
||||||
LFLAGS="-Lp" LBIND="-Fb" \
|
|
||||||
LFLAGS2="setargv.obj remind.def -link /NOE" \
|
|
||||||
BIND="bind remind /n DOSMAKEPIPE DOSCWAIT VIOENDPOPUP VIOPOPUP"
|
|
||||||
|
|
||||||
emx:
|
|
||||||
$(MAKE) -f Makefile.os2 all \
|
|
||||||
CC="gcc -O -s" O=".o" \
|
|
||||||
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 =
|
|
||||||
OS2_POPUP = -DOS2_POPUP
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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 os2func.c
|
|
||||||
|
|
||||||
MANIFEST= README.UNIX README.DOS COPYRIGHT $(HDRS) $(SRCS) Makefile rem rem.1 \
|
|
||||||
remind.1 remind-all.csh remind-all.sh test.rem test-rem test.cmp makefile.tc \
|
|
||||||
makefile.msc lnk.msc lnk.tc MANIFEST.UNX MANIFEST.DOS WHATSNEW.30 kall kall.1 \
|
|
||||||
defs.rem README.OS2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \
|
|
||||||
tstlang.rem README.BCC lnk.bcc makefile.bcc os2func.c \
|
|
||||||
test-rem.bat test-rem.cmd test1.cmp test2.cmp
|
|
||||||
|
|
||||||
|
|
||||||
OBJS= $(SRCS:.c=$O)
|
|
||||||
|
|
||||||
all: remind.exe rem2ps.exe
|
|
||||||
|
|
||||||
.SUFFIXES: $O
|
|
||||||
|
|
||||||
.c$O:
|
|
||||||
$(CC) -c $(CFLAGS) $(OS2_POPUP) $*.c
|
|
||||||
|
|
||||||
rem2ps.exe: rem2ps$O
|
|
||||||
$(CC) $(LFLAGS) $(LBIND) -o $@ rem2ps$O $(LFLAGS2)
|
|
||||||
|
|
||||||
remind.exe: $(OBJS)
|
|
||||||
$(CC) $(LFLAGS) -o $@ $(OBJS) $(LFLAGS2)
|
|
||||||
$(BIND)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o *.obj *~ core *.bak
|
|
||||||
|
|
||||||
clobber:
|
|
||||||
rm -f *.o *.obj *~ remind.exe rem2ps.exe test.out core *.bak
|
|
||||||
|
|
||||||
test:
|
|
||||||
test-rem.cmd
|
|
||||||
|
|
||||||
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 $(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
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
# Makefile for REMIND for Turbo C for MSDOS
|
|
||||||
# $Id: makefile.tc,v 1.2 1998-03-01 20:43:57 dfs Exp $
|
|
||||||
|
|
||||||
CC= tcc
|
|
||||||
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 \
|
|
||||||
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
|
|
||||||
|
|
||||||
SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c init.c \
|
|
||||||
moon.c main.c omit.c sort.c token.c trigger.c userfns.c utils.c var.c hbcal.c
|
|
||||||
|
|
||||||
OBJS=calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
|
|
||||||
globals.obj init.obj main.obj omit.obj sort.obj token.obj trigger.obj \
|
|
||||||
utils.obj userfns.obj var.obj hbcal.obj
|
|
||||||
|
|
||||||
all: remind.exe rem2ps.exe
|
|
||||||
|
|
||||||
remind.exe: $(OBJS)
|
|
||||||
$(CC) @lnk.tc
|
|
||||||
|
|
||||||
rem2ps.exe: rem2ps.obj
|
|
||||||
$(CC) -erem2ps.exe rem2ps.obj
|
|
||||||
|
|
||||||
.c.obj:
|
|
||||||
$(CC) -w-pia -c -O -mm {$< }
|
|
||||||
|
|
||||||
rem2ps.obj: rem2ps.c rem2ps.h config.h lang.h
|
|
||||||
|
|
||||||
calendar.obj: calendar.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
dorem.obj: dorem.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
dosubst.obj: dosubst.c $(STDHDRS) $(LANGHDRS)
|
|
||||||
|
|
||||||
expr.obj: expr.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
files.obj: files.c $(STDHDRS)
|
|
||||||
|
|
||||||
funcs.obj: funcs.c $(STDHDRS) expr.h version.h
|
|
||||||
|
|
||||||
globals.obj: globals.c config.h types.h globals.h err.h lang.h
|
|
||||||
|
|
||||||
init.obj: init.c $(STDHDRS) expr.h version.h
|
|
||||||
|
|
||||||
main.obj: main.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
moon.obj: moon.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
omit.obj: omit.c $(STDHDRS)
|
|
||||||
|
|
||||||
sort.obj: sort.c $(STDHDRS)
|
|
||||||
|
|
||||||
token.obj: token.c $(STDHDRS)
|
|
||||||
|
|
||||||
trigger.obj: trigger.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
userfns.obj: userfns.c $(STDHDRS) expr.h
|
|
||||||
|
|
||||||
utils.obj: utils.c $(STDHDRS)
|
|
||||||
|
|
||||||
var.obj: var.c $(STDHDRS) expr.h
|
|
||||||
249
src/md5.c
Normal file
249
src/md5.c
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
/*
|
||||||
|
* This code implements the MD5 message-digest algorithm.
|
||||||
|
* The algorithm is due to Ron Rivest. This code was
|
||||||
|
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||||
|
* This code is in the public domain; do with it what you wish.
|
||||||
|
*
|
||||||
|
* Equivalent code is available from RSA Data Security, Inc.
|
||||||
|
* This code has been tested against that, and is equivalent,
|
||||||
|
* except that you don't need to include two pages of legalese
|
||||||
|
* with every copy.
|
||||||
|
*
|
||||||
|
* LIC: GPL
|
||||||
|
*
|
||||||
|
* To compute the message digest of a chunk of bytes, declare an
|
||||||
|
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||||
|
* needed on buffers full of bytes, and then call MD5Final, which
|
||||||
|
* will fill a supplied 16-byte array with the digest.
|
||||||
|
*/
|
||||||
|
#include <string.h> /* for memcpy() */
|
||||||
|
#include "md5.h"
|
||||||
|
|
||||||
|
static void byteReverse(unsigned char *buf, unsigned longs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: this code is harmless on little-endian machines.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
byteReverse(unsigned char *buf, unsigned longs)
|
||||||
|
{
|
||||||
|
uint32 t;
|
||||||
|
do {
|
||||||
|
t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||||
|
((unsigned) buf[1] << 8 | buf[0]);
|
||||||
|
*(uint32 *) buf = t;
|
||||||
|
buf += 4;
|
||||||
|
} while (--longs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||||
|
* initialization constants.
|
||||||
|
*/
|
||||||
|
void MD5Init(struct MD5Context *ctx)
|
||||||
|
{
|
||||||
|
ctx->buf[0] = 0x67452301;
|
||||||
|
ctx->buf[1] = 0xefcdab89;
|
||||||
|
ctx->buf[2] = 0x98badcfe;
|
||||||
|
ctx->buf[3] = 0x10325476;
|
||||||
|
|
||||||
|
ctx->bits[0] = 0;
|
||||||
|
ctx->bits[1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update context to reflect the concatenation of another buffer full
|
||||||
|
* of bytes.
|
||||||
|
*/
|
||||||
|
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
||||||
|
{
|
||||||
|
uint32 t;
|
||||||
|
|
||||||
|
/* Update bitcount */
|
||||||
|
|
||||||
|
t = ctx->bits[0];
|
||||||
|
if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
|
||||||
|
ctx->bits[1]++; /* Carry from low to high */
|
||||||
|
ctx->bits[1] += len >> 29;
|
||||||
|
|
||||||
|
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||||
|
|
||||||
|
/* Handle any leading odd-sized chunks */
|
||||||
|
|
||||||
|
if (t) {
|
||||||
|
unsigned char *p = (unsigned char *) ctx->in + t;
|
||||||
|
|
||||||
|
t = 64 - t;
|
||||||
|
if (len < t) {
|
||||||
|
memcpy(p, buf, len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memcpy(p, buf, t);
|
||||||
|
byteReverse(ctx->in, 16);
|
||||||
|
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||||
|
buf += t;
|
||||||
|
len -= t;
|
||||||
|
}
|
||||||
|
/* Process data in 64-byte chunks */
|
||||||
|
|
||||||
|
while (len >= 64) {
|
||||||
|
memcpy(ctx->in, buf, 64);
|
||||||
|
byteReverse(ctx->in, 16);
|
||||||
|
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||||
|
buf += 64;
|
||||||
|
len -= 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle any remaining bytes of data. */
|
||||||
|
|
||||||
|
memcpy(ctx->in, buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||||
|
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||||
|
*/
|
||||||
|
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
||||||
|
{
|
||||||
|
unsigned count;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
|
/* Compute number of bytes mod 64 */
|
||||||
|
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||||
|
|
||||||
|
/* Set the first char of padding to 0x80. This is safe since there is
|
||||||
|
always at least one byte free */
|
||||||
|
p = ctx->in + count;
|
||||||
|
*p++ = 0x80;
|
||||||
|
|
||||||
|
/* Bytes of padding needed to make 64 bytes */
|
||||||
|
count = 64 - 1 - count;
|
||||||
|
|
||||||
|
/* Pad out to 56 mod 64 */
|
||||||
|
if (count < 8) {
|
||||||
|
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||||
|
memset(p, 0, count);
|
||||||
|
byteReverse(ctx->in, 16);
|
||||||
|
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||||
|
|
||||||
|
/* Now fill the next block with 56 bytes */
|
||||||
|
memset(ctx->in, 0, 56);
|
||||||
|
} else {
|
||||||
|
/* Pad block to 56 bytes */
|
||||||
|
memset(p, 0, count - 8);
|
||||||
|
}
|
||||||
|
byteReverse(ctx->in, 14);
|
||||||
|
|
||||||
|
/* Append length in bits and transform */
|
||||||
|
((uint32 *) ctx->in)[14] = ctx->bits[0];
|
||||||
|
((uint32 *) ctx->in)[15] = ctx->bits[1];
|
||||||
|
|
||||||
|
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||||
|
byteReverse((unsigned char *) ctx->buf, 4);
|
||||||
|
memcpy(digest, ctx->buf, 16);
|
||||||
|
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef ASM_MD5
|
||||||
|
|
||||||
|
/* The four core functions - F1 is optimized somewhat */
|
||||||
|
|
||||||
|
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||||
|
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||||
|
#define F2(x, y, z) F1(z, x, y)
|
||||||
|
#define F3(x, y, z) (x ^ y ^ z)
|
||||||
|
#define F4(x, y, z) (y ^ (x | ~z))
|
||||||
|
|
||||||
|
/* This is the central step in the MD5 algorithm. */
|
||||||
|
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||||
|
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||||
|
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||||
|
* the data and converts bytes into longwords for this routine.
|
||||||
|
*/
|
||||||
|
void MD5Transform(uint32 buf[4], uint32 const in[16])
|
||||||
|
{
|
||||||
|
register uint32 a, b, c, d;
|
||||||
|
|
||||||
|
a = buf[0];
|
||||||
|
b = buf[1];
|
||||||
|
c = buf[2];
|
||||||
|
d = buf[3];
|
||||||
|
|
||||||
|
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||||
|
|
||||||
|
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||||
|
|
||||||
|
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||||
|
|
||||||
|
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||||
|
|
||||||
|
buf[0] += a;
|
||||||
|
buf[1] += b;
|
||||||
|
buf[2] += c;
|
||||||
|
buf[3] += d;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
34
src/md5.h
Normal file
34
src/md5.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#ifndef MD5_H
|
||||||
|
#define MD5_H
|
||||||
|
/*
|
||||||
|
* LIC: GPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#if SIZEOF_UNSIGNED_INT == 4
|
||||||
|
typedef unsigned int uint32;
|
||||||
|
#elif SIZEOF_UNSIGNED_LONG == 4
|
||||||
|
typedef unsigned long uint32;
|
||||||
|
#else
|
||||||
|
# error Could not find a 32-bit integer type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct MD5Context {
|
||||||
|
uint32 buf[4];
|
||||||
|
uint32 bits[2];
|
||||||
|
unsigned char in[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
void MD5Init(struct MD5Context *context);
|
||||||
|
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
||||||
|
unsigned len);
|
||||||
|
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
||||||
|
void MD5Transform(uint32 buf[4], uint32 const in[16]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
||||||
|
*/
|
||||||
|
typedef struct MD5Context MD5_CTX;
|
||||||
|
|
||||||
|
#endif /* !MD5_H */
|
||||||
113
src/moon.c
113
src/moon.c
@@ -6,12 +6,11 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: moon.c,v 1.4 1999-04-05 17:34:53 dfs Exp $";
|
|
||||||
|
|
||||||
/* All of these routines were adapted from the program "moontool"
|
/* All of these routines were adapted from the program "moontool"
|
||||||
by John Walker, February 1988. Here's the blurb from moontool:
|
by John Walker, February 1988. Here's the blurb from moontool:
|
||||||
@@ -61,10 +60,7 @@ static char const RCSID[] = "$Id: moon.c,v 1.4 1999-04-05 17:34:53 dfs Exp $";
|
|||||||
that credit and blame may be properly apportioned.
|
that credit and blame may be properly apportioned.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -75,14 +71,14 @@ static char const RCSID[] = "$Id: moon.c,v 1.4 1999-04-05 17:34:53 dfs Exp $";
|
|||||||
#include "err.h"
|
#include "err.h"
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
PRIVATE long jdate ARGS((int y, int mon, int day));
|
static long jdate (int y, int mon, int day);
|
||||||
PRIVATE double jtime ARGS((int y, int mon, int day, int hour, int min, int sec));
|
static double jtime (int y, int mon, int day, int hour, int min, int sec);
|
||||||
PRIVATE void jyear ARGS((double td, int *yy, int *mm, int *dd));
|
static void jyear (double td, int *yy, int *mm, int *dd);
|
||||||
PRIVATE void jhms ARGS((double j, int *h, int *m, int *s));
|
static void jhms (double j, int *h, int *m, int *s);
|
||||||
PRIVATE double meanphase ARGS((double sdate, double phase, double *usek));
|
static double meanphase (double sdate, double phase, double *usek);
|
||||||
PRIVATE double truephase ARGS((double k, double phase));
|
static double truephase (double k, double phase);
|
||||||
PRIVATE double kepler ARGS((double m, double ecc));
|
static double kepler (double m, double ecc);
|
||||||
PRIVATE double phase ARGS((double, double *, double *, double *, double *, double *, double *));
|
static double phase (double, double *, double *, double *, double *, double *, double *);
|
||||||
|
|
||||||
|
|
||||||
/* Astronomical constants */
|
/* Astronomical constants */
|
||||||
@@ -151,12 +147,7 @@ PRIVATE double phase ARGS((double, double *, double *, double *, double *, doubl
|
|||||||
/* Convert a date and time to Julian day and fraction. */
|
/* Convert a date and time to Julian day and fraction. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static long jdate(int y, int mon, int day)
|
||||||
PRIVATE long jdate(int y, int mon, int day)
|
|
||||||
#else
|
|
||||||
static long jdate(y, mon, day)
|
|
||||||
int y, mon, day;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
long c, m;
|
long c, m;
|
||||||
|
|
||||||
@@ -180,12 +171,7 @@ int y, mon, day;
|
|||||||
/* i.e. Julian date plus day fraction, expressed as a double */
|
/* i.e. Julian date plus day fraction, expressed as a double */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static double jtime(int y, int mon, int day, int hour, int min, int sec)
|
||||||
PRIVATE double jtime(int y, int mon, int day, int hour, int min, int sec)
|
|
||||||
#else
|
|
||||||
static double jtime(y, mon, day, hour, min, sec)
|
|
||||||
int y, mon, day, hour, min, sec;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return (jdate(y, mon, day)-0.5) +
|
return (jdate(y, mon, day)-0.5) +
|
||||||
(sec + 60L * (long) min + 3600L * (long) hour) / 86400.0;
|
(sec + 60L * (long) min + 3600L * (long) hour) / 86400.0;
|
||||||
@@ -198,13 +184,7 @@ int y, mon, day, hour, min, sec;
|
|||||||
/* Convert a Julian date to year, month, day. */
|
/* Convert a Julian date to year, month, day. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void jyear(double td, int *yy, int *mm, int *dd)
|
||||||
PRIVATE void jyear(double td, int *yy, int *mm, int *dd)
|
|
||||||
#else
|
|
||||||
static void jyear(td, yy, mm, dd)
|
|
||||||
double td;
|
|
||||||
int *yy, *mm, *dd;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
double j, d, y, m;
|
double j, d, y, m;
|
||||||
|
|
||||||
@@ -239,13 +219,7 @@ int *yy, *mm, *dd;
|
|||||||
/* Convert a Julian time to hour, minutes and seconds. */
|
/* Convert a Julian time to hour, minutes and seconds. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void jhms(double j, int *h, int *m, int *s)
|
||||||
PRIVATE void jhms(double j, int *h, int *m, int *s)
|
|
||||||
#else
|
|
||||||
static void jhms(j, h, m, s)
|
|
||||||
double j;
|
|
||||||
int *h, *m, *s;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
long ij;
|
long ij;
|
||||||
|
|
||||||
@@ -273,13 +247,7 @@ int *h, *m, *s;
|
|||||||
/* than this calculation reveals. */
|
/* than this calculation reveals. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static double meanphase(double sdate, double phase, double *usek)
|
||||||
PRIVATE double meanphase(double sdate, double phase, double *usek)
|
|
||||||
#else
|
|
||||||
static double meanphase(sdate, phase, usek)
|
|
||||||
double sdate, phase;
|
|
||||||
double *usek;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
double k, t, t2, t3, nt1;
|
double k, t, t2, t3, nt1;
|
||||||
|
|
||||||
@@ -315,12 +283,7 @@ double *usek;
|
|||||||
/* the true, corrected phase time. */
|
/* the true, corrected phase time. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static double truephase(double k, double phase)
|
||||||
PRIVATE double truephase(double k, double phase)
|
|
||||||
#else
|
|
||||||
static double truephase(k, phase)
|
|
||||||
double k, phase;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
double t, t2, t3, pt, m, mprime, f;
|
double t, t2, t3, pt, m, mprime, f;
|
||||||
int apcor = 0;
|
int apcor = 0;
|
||||||
@@ -401,12 +364,7 @@ double k, phase;
|
|||||||
/* Solve the equation of Kepler. */
|
/* Solve the equation of Kepler. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static double kepler(double m, double ecc)
|
||||||
PRIVATE double kepler(double m, double ecc)
|
|
||||||
#else
|
|
||||||
static double kepler(m, ecc)
|
|
||||||
double m, ecc;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
double e, delta;
|
double e, delta;
|
||||||
#define EPSILON 1E-6
|
#define EPSILON 1E-6
|
||||||
@@ -434,24 +392,13 @@ double m, ecc;
|
|||||||
/* the centre of the Earth. */
|
/* the centre of the Earth. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static double phase(double pdate,
|
||||||
PRIVATE double phase(double pdate,
|
double *pphase,
|
||||||
double *pphase,
|
double *mage,
|
||||||
double *mage,
|
double *dist,
|
||||||
double *dist,
|
double *angdia,
|
||||||
double *angdia,
|
double *sudist,
|
||||||
double *sudist,
|
double *suangdia)
|
||||||
double *suangdia)
|
|
||||||
#else
|
|
||||||
static double phase(pdate, pphase, mage, dist, angdia, sudist, suangdia)
|
|
||||||
double pdate;
|
|
||||||
double *pphase; /* Illuminated fraction */
|
|
||||||
double *mage; /* Age of moon in days */
|
|
||||||
double *dist; /* Distance in kilometres */
|
|
||||||
double *angdia; /* Angular diameter in degrees */
|
|
||||||
double *sudist; /* Distance to Sun */
|
|
||||||
double *suangdia; /* Sun's angular diameter */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
double Day, N, M, Ec, Lambdasun, ml, MM, MN, Ev, Ae, A3, MmP,
|
double Day, N, M, Ec, Lambdasun, ml, MM, MN, Ev, Ae, A3, MmP,
|
||||||
@@ -564,12 +511,7 @@ double *suangdia; /* Sun's angular diameter */
|
|||||||
/* that date and time as a number from 0 to 360. */
|
/* that date and time as a number from 0 to 360. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int MoonPhase(int date, int time)
|
||||||
PUBLIC int MoonPhase(int date, int time)
|
|
||||||
#else
|
|
||||||
int MoonPhase(date, time)
|
|
||||||
int date, time;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int utcd, utct;
|
int utcd, utct;
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
@@ -599,12 +541,7 @@ int date, time;
|
|||||||
/* 0 to 3 for new, 1stq, full, 3rdq */
|
/* 0 to 3 for new, 1stq, full, 3rdq */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void HuntPhase(int startdate, int starttim, int phas, int *date, int *time)
|
||||||
PUBLIC void HuntPhase(int startdate, int starttim, int phas, int *date, int *time)
|
|
||||||
#else
|
|
||||||
void HuntPhase(startdate, starttim, phas, date, time)
|
|
||||||
int startdate, starttim, phas, *date, *time;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int utcd, utct;
|
int utcd, utct;
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
|||||||
79
src/omit.c
79
src/omit.c
@@ -7,30 +7,22 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: omit.c,v 1.5 1999-04-05 17:34:54 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
|
|
||||||
PRIVATE int BexistsIntArray ARGS ((int array[], int num, int key));
|
static int BexistsIntArray (int array[], int num, int key);
|
||||||
PRIVATE void InsertIntoSortedArray ARGS ((int *array, int num, int key));
|
static void InsertIntoSortedArray (int *array, int num, int key);
|
||||||
|
|
||||||
/* Arrays for the global omits */
|
/* Arrays for the global omits */
|
||||||
static int FullOmitArray[MAX_FULL_OMITS];
|
static int FullOmitArray[MAX_FULL_OMITS];
|
||||||
@@ -57,11 +49,7 @@ static OmitContext *SavedOmitContexts = NULL;
|
|||||||
/* Clear all the global OMIT context. */
|
/* Clear all the global OMIT context. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ClearGlobalOmits(void)
|
||||||
PUBLIC int ClearGlobalOmits(void)
|
|
||||||
#else
|
|
||||||
int ClearGlobalOmits()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
NumFullOmits = NumPartialOmits = 0;
|
NumFullOmits = NumPartialOmits = 0;
|
||||||
return OK;
|
return OK;
|
||||||
@@ -74,12 +62,7 @@ int ClearGlobalOmits()
|
|||||||
/* The command-line function CLEAR-OMIT-CONTEXT */
|
/* The command-line function CLEAR-OMIT-CONTEXT */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoClear(ParsePtr p)
|
||||||
PUBLIC int DoClear(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoClear(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
ClearGlobalOmits();
|
ClearGlobalOmits();
|
||||||
return VerifyEoln(p);
|
return VerifyEoln(p);
|
||||||
@@ -94,11 +77,7 @@ ParsePtr p;
|
|||||||
/* destroyed. */
|
/* destroyed. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DestroyOmitContexts(void)
|
||||||
PUBLIC int DestroyOmitContexts(void)
|
|
||||||
#else
|
|
||||||
int DestroyOmitContexts()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
OmitContext *c = SavedOmitContexts;
|
OmitContext *c = SavedOmitContexts;
|
||||||
OmitContext *d;
|
OmitContext *d;
|
||||||
@@ -123,12 +102,7 @@ int DestroyOmitContexts()
|
|||||||
/* Push the OMIT context on to the stack. */
|
/* Push the OMIT context on to the stack. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int PushOmitContext(ParsePtr p)
|
||||||
PUBLIC int PushOmitContext(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int PushOmitContext(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
OmitContext *context;
|
OmitContext *context;
|
||||||
@@ -139,12 +113,12 @@ ParsePtr p;
|
|||||||
|
|
||||||
context->numfull = NumFullOmits;
|
context->numfull = NumFullOmits;
|
||||||
context->numpart = NumPartialOmits;
|
context->numpart = NumPartialOmits;
|
||||||
context->fullsave = (int *) malloc(NumFullOmits * sizeof(int));
|
context->fullsave = malloc(NumFullOmits * sizeof(int));
|
||||||
if (NumFullOmits && !context->fullsave) {
|
if (NumFullOmits && !context->fullsave) {
|
||||||
free(context);
|
free(context);
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
}
|
}
|
||||||
context->partsave = (int *) malloc(NumPartialOmits * sizeof(int));
|
context->partsave = malloc(NumPartialOmits * sizeof(int));
|
||||||
if (NumPartialOmits && !context->partsave) {
|
if (NumPartialOmits && !context->partsave) {
|
||||||
free(context->fullsave);
|
free(context->fullsave);
|
||||||
free(context);
|
free(context);
|
||||||
@@ -171,12 +145,7 @@ ParsePtr p;
|
|||||||
/* Pop the OMIT context off of the stack. */
|
/* Pop the OMIT context off of the stack. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int PopOmitContext(ParsePtr p)
|
||||||
PUBLIC int PopOmitContext(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int PopOmitContext(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
register int i;
|
register int i;
|
||||||
@@ -211,12 +180,7 @@ ParsePtr p;
|
|||||||
/* Return non-zero if date is OMITted, zero if it is not. */
|
/* Return non-zero if date is OMITted, zero if it is not. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int IsOmitted(int jul, int localomit)
|
||||||
PUBLIC int IsOmitted(int jul, int localomit)
|
|
||||||
#else
|
|
||||||
int IsOmitted(jul, localomit)
|
|
||||||
int jul, localomit;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
|
|
||||||
@@ -243,12 +207,7 @@ int jul, localomit;
|
|||||||
/* element is found, 0 otherwise. */
|
/* element is found, 0 otherwise. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int BexistsIntArray(int array[], int num, int key)
|
||||||
PRIVATE int BexistsIntArray(int array[], int num, int key)
|
|
||||||
#else
|
|
||||||
static int BexistsIntArray(array, num, key)
|
|
||||||
int array[], num, key;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int top=num-1, bot=0, mid;
|
int top=num-1, bot=0, mid;
|
||||||
|
|
||||||
@@ -269,12 +228,7 @@ int array[], num, key;
|
|||||||
/* room in the array for it. */
|
/* room in the array for it. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void InsertIntoSortedArray(int *array, int num, int key)
|
||||||
PRIVATE void InsertIntoSortedArray(int *array, int num, int key)
|
|
||||||
#else
|
|
||||||
static void InsertIntoSortedArray(array, num, key)
|
|
||||||
int *array, num, key;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* num is number of elements CURRENTLY in the array. */
|
/* num is number of elements CURRENTLY in the array. */
|
||||||
int *cur = array+num;
|
int *cur = array+num;
|
||||||
@@ -293,12 +247,7 @@ int *array, num, key;
|
|||||||
/* Do a global OMIT command. */
|
/* Do a global OMIT command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoOmit(ParsePtr p)
|
||||||
PUBLIC int DoOmit(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoOmit(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y = NO_YR, m = NO_MON, d = NO_DAY, r;
|
int y = NO_YR, m = NO_MON, d = NO_DAY, r;
|
||||||
Token tok;
|
Token tok;
|
||||||
|
|||||||
159
src/os2func.c
159
src/os2func.c
@@ -1,159 +0,0 @@
|
|||||||
/***************************************************************/
|
|
||||||
/* */
|
|
||||||
/* OS2FUNC.C */
|
|
||||||
/* */
|
|
||||||
/* Functions to support OS/2. */
|
|
||||||
/* */
|
|
||||||
/* This file is part of REMIND. */
|
|
||||||
/* */
|
|
||||||
/* This file is Copyright (C) 1993 by Russ Herman. */
|
|
||||||
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
|
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
static char const RCSID[] = "$Id: os2func.c,v 1.3 1999-04-05 17:34:54 dfs Exp $";
|
|
||||||
|
|
||||||
#ifdef OS2_POPUP
|
|
||||||
#define INCL_VIO
|
|
||||||
#define INCL_KBD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define INCL_DOSPROCESS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(OS2_POPUP) || defined(_MSC_VER)
|
|
||||||
#include <os2.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef OS2_POPUP
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#ifdef OS2DBG
|
|
||||||
#include <dos.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
#include "globals.h"
|
|
||||||
|
|
||||||
/* EMX defines PS_TYPE, so we undefine it here to avoid
|
|
||||||
a redefinition warning when we include "types.h" */
|
|
||||||
#ifdef PS_TYPE
|
|
||||||
#undef PS_TYPE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
|
||||||
#include "protos.h"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef USHORT APIRET;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static APIRET apiret = 0;
|
|
||||||
static KBDKEYINFO kbci;
|
|
||||||
static char *pszPressAny = "\r\nPress any key to continue";
|
|
||||||
static USHORT pflags = VP_WAIT; /* | VP_TRANSPARENT; */
|
|
||||||
static HKBD hkbd = 0;
|
|
||||||
static char VioSubstBuffer[SHELLSIZE + 1];
|
|
||||||
|
|
||||||
void StartPopUp()
|
|
||||||
{
|
|
||||||
if (OS2MODE)
|
|
||||||
if (!(DebugFlag & DB_ECHO_LINE))
|
|
||||||
VioPopUp(&pflags, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EndPopUp()
|
|
||||||
{
|
|
||||||
if (DebugFlag & DB_ECHO_LINE)
|
|
||||||
return;
|
|
||||||
if (OS2MODE) {
|
|
||||||
VioWrtTTY(pszPressAny, strlen(pszPressAny), 0);
|
|
||||||
KbdCharIn(&kbci, IO_WAIT, hkbd);
|
|
||||||
VioEndPopUp(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int PutsPopUp(char *s)
|
|
||||||
{
|
|
||||||
char c, *os = VioSubstBuffer;
|
|
||||||
|
|
||||||
if (DebugFlag & DB_ECHO_LINE)
|
|
||||||
printf("%s", s);
|
|
||||||
else {
|
|
||||||
do {
|
|
||||||
/* Convert \n to \r\n in auxiliary buffer for VIO */
|
|
||||||
if ((c= *s++) == '\n')
|
|
||||||
*os++ = '\r';
|
|
||||||
*os++ = c;
|
|
||||||
} while (c > 0);
|
|
||||||
VioWrtTTY(VioSubstBuffer, strlen(VioSubstBuffer), 0);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int PutlPopUp(char *s)
|
|
||||||
{
|
|
||||||
StartPopUp();
|
|
||||||
PutsPopUp(s);
|
|
||||||
if (DebugFlag & DB_ECHO_LINE)
|
|
||||||
fputc('\n', stdout);
|
|
||||||
else
|
|
||||||
VioWrtTTY("\r\n", 2, 0);
|
|
||||||
EndPopUp();
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int PutcPopUp(int c)
|
|
||||||
{
|
|
||||||
char *s = " ";
|
|
||||||
|
|
||||||
if (DebugFlag & DB_ECHO_LINE)
|
|
||||||
fputc(c, stdout);
|
|
||||||
else {
|
|
||||||
switch (c) {
|
|
||||||
case '\n':
|
|
||||||
VioWrtTTY("\r\n", 2, 0);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
s[0] = c;
|
|
||||||
VioWrtTTY(s, 1, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef OS2DBG
|
|
||||||
#define DB_ECHO_LINE 16
|
|
||||||
int DebugFlag = 0;
|
|
||||||
void main(/* int argc, char **argv */)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = os2fputs("Test VIO PopUp Writing");
|
|
||||||
if (ret)
|
|
||||||
fprintf(stderr, "Test VIO PopUP Writing returned %d %ld",
|
|
||||||
ret, apiret);
|
|
||||||
exit(ret);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
unsigned sleep(unsigned sec)
|
|
||||||
{
|
|
||||||
return DosSleep(sec * 1000L);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __EMX__
|
|
||||||
int fork()
|
|
||||||
{
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
273
src/protos.h
273
src/protos.h
@@ -6,170 +6,129 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: protos.h,v 1.7 1999-04-05 17:34:54 dfs Exp $ */
|
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
#define ARGS(x) x
|
|
||||||
#else
|
|
||||||
#define ARGS(x) ()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define a string assignment macro - be careful!!! */
|
/* Define a string assignment macro - be careful!!! */
|
||||||
#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
|
#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
|
||||||
|
|
||||||
/* Define a general malloc routine for creating pointers to objects */
|
/* Define a general malloc routine for creating pointers to objects */
|
||||||
#define NEW(type) ((type *) malloc(sizeof(type)))
|
#define NEW(type) (malloc(sizeof(type)))
|
||||||
|
|
||||||
#include "dynbuf.h"
|
#include "dynbuf.h"
|
||||||
|
|
||||||
#ifndef HAVE_STRSTR
|
int CallUserFunc (char const *name, int nargs);
|
||||||
char *strstr ARGS ((char *s1, char *s2));
|
int DoFset (ParsePtr p);
|
||||||
#endif
|
void ProduceCalendar (void);
|
||||||
|
char const *SimpleTime (int tim);
|
||||||
int CallUserFunc ARGS ((char *name, int nargs));
|
char const *CalendarTime (int tim, int duration);
|
||||||
int DoFset ARGS ((ParsePtr p));
|
int DoRem (ParsePtr p);
|
||||||
void ProduceCalendar ARGS ((void));
|
int DoFlush (ParsePtr p);
|
||||||
char *SimpleTime ARGS ((int tim));
|
void DoExit (ParsePtr p);
|
||||||
int DoRem ARGS ((ParsePtr p));
|
int ParseRem (ParsePtr s, Trigger *trig, TimeTrig *tim);
|
||||||
int DoFlush ARGS ((ParsePtr p));
|
int TriggerReminder (ParsePtr p, Trigger *t, TimeTrig *tim, int jul);
|
||||||
void DoExit ARGS ((ParsePtr p));
|
int ShouldTriggerReminder (Trigger *t, TimeTrig *tim, int jul);
|
||||||
int ParseRem ARGS ((ParsePtr s, Trigger *trig, TimeTrig *tim));
|
int DoSubst (ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode);
|
||||||
#ifdef OS2_POPUP
|
int DoSubstFromString (char const *source, DynamicBuffer *dbuf, int jul, int tim);
|
||||||
int TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
|
int EvalExpr (char const **e, Value *v);
|
||||||
int AsPopUp));
|
int DoCoerce (char type, Value *v);
|
||||||
#else
|
void PrintValue (Value *v, FILE *fp);
|
||||||
int TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul));
|
int CopyValue (Value *dest, const Value *src);
|
||||||
#endif
|
int ReadLine (void);
|
||||||
int ShouldTriggerReminder ARGS ((Trigger *t, TimeTrig *tim, int jul));
|
int OpenFile (char const *fname);
|
||||||
int DoSubst ARGS ((ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode));
|
int DoInclude (ParsePtr p);
|
||||||
int DoSubstFromString ARGS ((char *source, DynamicBuffer *dbuf, int jul, int tim));
|
int IncludeFile (char const *fname);
|
||||||
int EvalExpr ARGS ((char **e, Value *v));
|
int GetAccessDate (char const *file);
|
||||||
int DoCoerce ARGS ((char type, Value *v));
|
int SetAccessDate (char const *fname, int jul);
|
||||||
void PrintValue ARGS ((Value *v, FILE *fp));
|
int TopLevel (void);
|
||||||
int CopyValue ARGS ((Value *dest, const Value *src));
|
int CallFunc (Operator *f, int nargs);
|
||||||
int ReadLine ARGS ((void));
|
void InitRemind (int argc, char const *argv[]);
|
||||||
int OpenFile ARGS ((const char *fname));
|
void Usage (void);
|
||||||
int PopFile ARGS ((void));
|
int Julian (int year, int month, int day);
|
||||||
int DoInclude ARGS ((ParsePtr p));
|
void FromJulian (int jul, int *y, int *m, int *d);
|
||||||
int IncludeFile ARGS ((const char *fname));
|
int ParseChar (ParsePtr p, int *err, int peek);
|
||||||
int GetAccessDate ARGS ((char *file));
|
int ParseToken (ParsePtr p, DynamicBuffer *dbuf);
|
||||||
int SetAccessDate ARGS ((char *fname, int jul));
|
int ParseIdentifier (ParsePtr p, DynamicBuffer *dbuf);
|
||||||
int TopLevel ARGS ((void));
|
int EvaluateExpr (ParsePtr p, Value *v);
|
||||||
int CallFunc ARGS ((Operator *f, int nargs));
|
int Evaluate (char const **s, Var *locals);
|
||||||
void InitRemind ARGS ((int argc, char *argv[]));
|
int FnPopValStack (Value *val);
|
||||||
void Usage ARGS ((void));
|
void Eprint (char const *fmt, ...);
|
||||||
int main ARGS ((int argc, char *argv[]));
|
void OutputLine (FILE *fp);
|
||||||
int Julian ARGS ((int year, int month, int day));
|
void CreateParser (char const *s, ParsePtr p);
|
||||||
void FromJulian ARGS ((int jul, int *y, int *m, int *d));
|
void DestroyParser (ParsePtr p);
|
||||||
int ParseChar ARGS ((ParsePtr p, int *err, int peek));
|
int PushToken (char const *tok, ParsePtr p);
|
||||||
int ParseToken ARGS ((ParsePtr p, DynamicBuffer *dbuf));
|
long SystemTime (int realtime);
|
||||||
int ParseIdentifier ARGS ((ParsePtr p, DynamicBuffer *dbuf));
|
int SystemDate (int *y, int *m, int *d);
|
||||||
int EvaluateExpr ARGS ((ParsePtr p, Value *v));
|
int DoIf (ParsePtr p);
|
||||||
int Evaluate ARGS ((char **s, Var *locals));
|
int DoElse (ParsePtr p);
|
||||||
int FnPopValStack ARGS ((Value *val));
|
int DoEndif (ParsePtr p);
|
||||||
void Eprint ARGS ((const char *fmt, ...));
|
int DoIfTrig (ParsePtr p);
|
||||||
void OutputLine ARGS ((FILE *fp));
|
int ShouldIgnoreLine (void);
|
||||||
void CreateParser ARGS ((char *s, ParsePtr p));
|
int VerifyEoln (ParsePtr p);
|
||||||
void DestroyParser ARGS ((ParsePtr p));
|
int DoDebug (ParsePtr p);
|
||||||
int PushToken ARGS ((const char *tok, ParsePtr p));
|
int DoBanner (ParsePtr p);
|
||||||
long SystemTime ARGS ((int realtime));
|
int DoRun (ParsePtr p);
|
||||||
int SystemDate ARGS ((int *y, int *m, int *d));
|
int DoErrMsg (ParsePtr p);
|
||||||
int DoIf ARGS ((ParsePtr p));
|
int ClearGlobalOmits (void);
|
||||||
int DoElse ARGS ((ParsePtr p));
|
int DoClear (ParsePtr p);
|
||||||
int DoEndif ARGS ((ParsePtr p));
|
int DestroyOmitContexts (void);
|
||||||
int DoIfTrig ARGS ((ParsePtr p));
|
int PushOmitContext (ParsePtr p);
|
||||||
int ShouldIgnoreLine ARGS ((void));
|
int PopOmitContext (ParsePtr p);
|
||||||
int VerifyEoln ARGS ((ParsePtr p));
|
int IsOmitted (int jul, int localomit);
|
||||||
int DoDebug ARGS ((ParsePtr p));
|
int DoOmit (ParsePtr p);
|
||||||
int DoBanner ARGS ((ParsePtr p));
|
int QueueReminder (ParsePtr p, Trigger *trig, TimeTrig *tim, char const *sched);
|
||||||
int DoRun ARGS ((ParsePtr p));
|
void HandleQueuedReminders (void);
|
||||||
int DoErrMsg ARGS ((ParsePtr p));
|
char const *FindInitialToken (Token *tok, char const *s);
|
||||||
int ClearGlobalOmits ARGS ((void));
|
void FindToken (char const *s, Token *tok);
|
||||||
int DoClear ARGS ((ParsePtr p));
|
void FindNumericToken (char const *s, Token *t);
|
||||||
int DestroyOmitContexts ARGS ((void));
|
int ComputeTrigger (int today, Trigger *trig, int *err);
|
||||||
int PushOmitContext ARGS ((ParsePtr p));
|
char *StrnCpy (char *dest, char const *source, int n);
|
||||||
int PopOmitContext ARGS ((ParsePtr p));
|
int StrMatch (char const *s1, char const *s2, int n);
|
||||||
int IsOmitted ARGS ((int jul, int localomit));
|
int StrinCmp (char const *s1, char const *s2, int n);
|
||||||
int DoOmit ARGS ((ParsePtr p));
|
char *StrDup (char const *s);
|
||||||
int QueueReminder ARGS ((ParsePtr p, Trigger *trig, TimeTrig *tim, const char *sched));
|
int StrCmpi (char const *s1, char const *s2);
|
||||||
void HandleQueuedReminders ARGS ((void));
|
Var *FindVar (char const *str, int create);
|
||||||
char *FindInitialToken ARGS ((Token *tok, char *s));
|
int DeleteVar (char const *str);
|
||||||
void FindToken ARGS ((const char *s, Token *tok));
|
int SetVar (char const *str, Value *val);
|
||||||
void FindNumericToken ARGS ((const char *s, Token *t));
|
int GetVarValue (char const *str, Value *val, Var *locals);
|
||||||
int ComputeTrigger ARGS ((int today, Trigger *trig, int *err));
|
int DoSet (Parser *p);
|
||||||
char *StrnCpy ARGS ((char *dest, const char *source, int n));
|
int DoUnset (Parser *p);
|
||||||
int StrMatch ARGS ((const char *s1, const char *s2, int n));
|
int DoDump (ParsePtr p);
|
||||||
int StrinCmp ARGS ((const char *s1, const char *s2, int n));
|
void DumpVarTable (void);
|
||||||
char *StrDup ARGS ((const char *s));
|
void DestroyVars (int all);
|
||||||
int StrCmpi ARGS ((const char *s1, const char *s2));
|
int PreserveVar (char const *name);
|
||||||
Var *FindVar ARGS ((const char *str, int create));
|
int DoPreserve (Parser *p);
|
||||||
int DeleteVar ARGS ((const char *str));
|
int DoSatRemind (Trigger *trig, TimeTrig *tim, ParsePtr p);
|
||||||
int SetVar ARGS ((const char *str, Value *val));
|
int DoMsgCommand (char const *cmd, char const *msg);
|
||||||
int GetVarValue ARGS ((const char *str, Value *val, Var *locals));
|
int ParseNonSpaceChar (ParsePtr p, int *err, int peek);
|
||||||
int DoSet ARGS ((Parser *p));
|
unsigned int HashVal (char const *str);
|
||||||
int DoUnset ARGS ((Parser *p));
|
int DateOK (int y, int m, int d);
|
||||||
int DoDump ARGS ((ParsePtr p));
|
Operator *FindFunc (char const *name, Operator where[], int num);
|
||||||
void DumpVarTable ARGS ((void));
|
int InsertIntoSortBuffer (int jul, int tim, char const *body, int typ, int prio);
|
||||||
void DestroyVars ARGS ((int all));
|
void IssueSortedReminders (void);
|
||||||
int PreserveVar ARGS ((char *name));
|
int UserFuncExists (char const *fn);
|
||||||
int DoPreserve ARGS ((Parser *p));
|
void JulToHeb (int jul, int *hy, int *hm, int *hd);
|
||||||
int DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
|
int HebNameToNum (char const *mname);
|
||||||
int DoMsgCommand ARGS ((char *cmd, char *msg));
|
char const *HebMonthName (int m, int y);
|
||||||
int ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
|
int RoshHashana (int i);
|
||||||
unsigned int HashVal ARGS ((const char *str));
|
long DaysToHebYear (int y);
|
||||||
int DateOK ARGS ((int y, int m, int d));
|
int DaysInHebYear (int y);
|
||||||
Operator *FindFunc ARGS ((char *name, Operator where[], int num));
|
char const *DaysInHebMonths (int ylen);
|
||||||
int InsertIntoSortBuffer ARGS ((int jul, int tim, char *body, int typ, int prio));
|
int HebToJul (int hy, int hm, int hd);
|
||||||
void IssueSortedReminders ARGS ((void));
|
int GetValidHebDate (int yin, int min, int din, int adarbehave, int *mout, int *dout, int yahr);
|
||||||
int UserFuncExists ARGS ((char *fn));
|
int GetNextHebrewDate (int julstart, int hm, int hd, int yahr, int adarbehave, int *ans);
|
||||||
void JulToHeb ARGS((int jul, int *hy, int *hm, int *hd));
|
int ComputeJahr (int y, int m, int d, int *ans);
|
||||||
int HebNameToNum ARGS((const char *mname));
|
int GetSysVar (char const *name, Value *val);
|
||||||
char *HebMonthName ARGS((int m, int y));
|
int SetSysVar (char const *name, Value *val);
|
||||||
int RoshHashana ARGS((int i));
|
void DumpSysVarByName (char const *name);
|
||||||
long DaysToHebYear ARGS((int y));
|
int CalcMinsFromUTC (int jul, int tim, int *mins, int *isdst);
|
||||||
int DaysInHebYear ARGS((int y));
|
void FillParagraph (char const *s);
|
||||||
char *DaysInHebMonths ARGS((int ylen));
|
void LocalToUTC (int locdate, int loctime, int *utcdate, int *utctime);
|
||||||
int HebToJul ARGS((int hy, int hm, int hd));
|
void UTCToLocal (int utcdate, int utctime, int *locdate, int *loctime);
|
||||||
int GetValidHebDate ARGS((int yin, int min, int din, int adarbehave, int *mout, int *dout, int yahr));
|
int MoonPhase (int date, int time);
|
||||||
int GetNextHebrewDate ARGS((int julstart, int hm, int hd, int yahr, int adarbehave, int *ans));
|
void HuntPhase (int startdate, int starttim, int phas, int *date, int *time);
|
||||||
int ComputeJahr ARGS ((int y, int m, int d, int *ans));
|
int CompareRems (int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio);
|
||||||
int GetSysVar ARGS ((const char *name, Value *val));
|
void SigIntHandler (int d);
|
||||||
int SetSysVar ARGS ((const char *name, Value *val));
|
void GotSigInt (void);
|
||||||
void DumpSysVarByName ARGS ((const char *name));
|
void SynthesizeTag(char *);
|
||||||
int CalcMinsFromUTC ARGS ((int jul, int tim, int *mins, int *isdst));
|
|
||||||
#ifdef OS2_POPUP
|
|
||||||
void FillParagraph ARGS ((char *s, int AsPopUp));
|
|
||||||
#else
|
|
||||||
void FillParagraph ARGS ((char *s));
|
|
||||||
#endif
|
|
||||||
void LocalToUTC ARGS ((int locdate, int loctime, int *utcdate, int *utctime));
|
|
||||||
void UTCToLocal ARGS ((int utcdate, int utctime, int *locdate, int *loctime));
|
|
||||||
int MoonPhase ARGS ((int date, int time));
|
|
||||||
void HuntPhase ARGS ((int startdate, int starttim, int phas, int *date, int *time));
|
|
||||||
int CompareRems ARGS ((int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio));
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
void __cdecl SigIntHandler ARGS ((int d));
|
|
||||||
#else
|
|
||||||
RETSIGTYPE SigIntHandler ARGS ((int d));
|
|
||||||
#endif
|
|
||||||
void GotSigInt ARGS ((void));
|
|
||||||
|
|
||||||
#if defined(__OS2__)
|
|
||||||
int fork ARGS ((void));
|
|
||||||
#if defined(OS2_POPUP)
|
|
||||||
void StartPopUp ARGS ((void));
|
|
||||||
void EndPopUp ARGS ((void));
|
|
||||||
int PutcPopUp ARGS ((int c));
|
|
||||||
int PutlPopUp ARGS ((char *s));
|
|
||||||
int PutsPopUp ARGS ((char *s));
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BROKEN_PUTC
|
|
||||||
int SafePutChar ARGS ((int ch));
|
|
||||||
int SafePutc ARGS ((int ch, FILE *fp));
|
|
||||||
#endif
|
|
||||||
|
|||||||
250
src/queue.c
250
src/queue.c
@@ -6,50 +6,27 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: queue.c,v 1.10 1999-04-05 17:34:55 dfs Exp $";
|
|
||||||
|
|
||||||
/* Solaris needs this to get select() prototype */
|
/* Solaris needs this to get select() prototype */
|
||||||
#ifdef __sun__
|
#ifdef __sun__
|
||||||
#define __EXTENSIONS__ 1
|
#define __EXTENSIONS__ 1
|
||||||
#undef _POSIX_SOURCE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We only want object code generated if we have queued reminders */
|
/* We only want object code generated if we have queued reminders */
|
||||||
#ifdef HAVE_QUEUED
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#include <sys/select.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__OS2__) || defined(__MSDOS__)
|
|
||||||
#include <io.h>
|
|
||||||
#if defined(__BORLANDC__)
|
|
||||||
#include <dos.h>
|
|
||||||
#endif
|
|
||||||
#include <process.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
@@ -63,7 +40,8 @@ typedef struct queuedrem {
|
|||||||
int typ;
|
int typ;
|
||||||
int RunDisabled;
|
int RunDisabled;
|
||||||
int ntrig;
|
int ntrig;
|
||||||
char *text;
|
char const *text;
|
||||||
|
char passthru[PASSTHRU_LEN+1];
|
||||||
char sched[VAR_NAME_LEN+1];
|
char sched[VAR_NAME_LEN+1];
|
||||||
char tag[TAG_LEN+1];
|
char tag[TAG_LEN+1];
|
||||||
TimeTrig tt;
|
TimeTrig tt;
|
||||||
@@ -75,12 +53,12 @@ static QueuedRem *QueueHead;
|
|||||||
static time_t FileModTime;
|
static time_t FileModTime;
|
||||||
static struct stat StatBuf;
|
static struct stat StatBuf;
|
||||||
|
|
||||||
PRIVATE void CheckInitialFile ARGS ((void));
|
static void CheckInitialFile (void);
|
||||||
PRIVATE int CalculateNextTime ARGS ((QueuedRem *q));
|
static int CalculateNextTime (QueuedRem *q);
|
||||||
PRIVATE QueuedRem *FindNextReminder ARGS ((void));
|
static QueuedRem *FindNextReminder (void);
|
||||||
PRIVATE int CalculateNextTimeUsingSched ARGS ((QueuedRem *q));
|
static int CalculateNextTimeUsingSched (QueuedRem *q);
|
||||||
PRIVATE void DaemonWait ARGS ((unsigned int sleeptime));
|
static void DaemonWait (unsigned int sleeptime);
|
||||||
PRIVATE void reread ARGS((void));
|
static void reread (void);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -90,16 +68,8 @@ PRIVATE void reread ARGS((void));
|
|||||||
/* enabled. */
|
/* enabled. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int QueueReminder(ParsePtr p, Trigger *trig,
|
||||||
PUBLIC int QueueReminder(ParsePtr p, Trigger *trig,
|
TimeTrig *tim, char const *sched)
|
||||||
TimeTrig *tim, const char *sched)
|
|
||||||
#else
|
|
||||||
int QueueReminder(p, trig, tim, sched)
|
|
||||||
ParsePtr p;
|
|
||||||
Trigger *trig,
|
|
||||||
TimeTrig *tim;
|
|
||||||
char *sched;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QueuedRem *qelem;
|
QueuedRem *qelem;
|
||||||
|
|
||||||
@@ -118,15 +88,19 @@ char *sched;
|
|||||||
free(qelem);
|
free(qelem);
|
||||||
return E_NO_MEM;
|
return E_NO_MEM;
|
||||||
}
|
}
|
||||||
|
NumQueued++;
|
||||||
qelem->typ = trig->typ;
|
qelem->typ = trig->typ;
|
||||||
|
strcpy(qelem->passthru, trig->passthru);
|
||||||
qelem->tt = *tim;
|
qelem->tt = *tim;
|
||||||
qelem->next = QueueHead;
|
qelem->next = QueueHead;
|
||||||
qelem->RunDisabled = RunDisabled;
|
qelem->RunDisabled = RunDisabled;
|
||||||
qelem->ntrig = 0;
|
qelem->ntrig = 0;
|
||||||
strcpy(qelem->sched, sched);
|
strcpy(qelem->sched, sched);
|
||||||
strcpy(qelem->tag, trig->tag);
|
strcpy(qelem->tag, trig->tag);
|
||||||
|
if (! *qelem->tag && SynthesizeTags) {
|
||||||
|
SynthesizeTag(qelem->tag);
|
||||||
|
}
|
||||||
QueueHead = qelem;
|
QueueHead = qelem;
|
||||||
NumQueued++;
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,14 +111,10 @@ char *sched;
|
|||||||
/* Handle the issuing of queued reminders in the background */
|
/* Handle the issuing of queued reminders in the background */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void HandleQueuedReminders(void)
|
||||||
PUBLIC void HandleQueuedReminders(void)
|
|
||||||
#else
|
|
||||||
void HandleQueuedReminders()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QueuedRem *q = QueueHead;
|
QueuedRem *q = QueueHead;
|
||||||
long TimeToSleep;
|
int TimeToSleep;
|
||||||
unsigned SleepTime;
|
unsigned SleepTime;
|
||||||
Parser p;
|
Parser p;
|
||||||
Trigger trig;
|
Trigger trig;
|
||||||
@@ -177,20 +147,16 @@ void HandleQueuedReminders()
|
|||||||
Daemon = 0;
|
Daemon = 0;
|
||||||
} else FileModTime = StatBuf.st_mtime;
|
} else FileModTime = StatBuf.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the queue - initialize all the entries time of issue */
|
/* Initialize the queue - initialize all the entries time of issue */
|
||||||
|
|
||||||
while (q) {
|
while (q) {
|
||||||
q->tt.nexttime = (int) (SystemTime(0)/60 - 1);
|
q->tt.nexttime = (int) (SystemTime(0)/60 - 1);
|
||||||
q->tt.nexttime = CalculateNextTime(q);
|
q->tt.nexttime = CalculateNextTime(q);
|
||||||
q = q->next;
|
q = q->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
signal(SIGINT, SigIntHandler);
|
|
||||||
#else
|
|
||||||
if (!DontFork || Daemon) signal(SIGINT, SigIntHandler);
|
if (!DontFork || Daemon) signal(SIGINT, SigIntHandler);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Sit in a loop, issuing reminders when necessary */
|
/* Sit in a loop, issuing reminders when necessary */
|
||||||
while(1) {
|
while(1) {
|
||||||
@@ -202,74 +168,100 @@ void HandleQueuedReminders()
|
|||||||
if (Daemon && !q) {
|
if (Daemon && !q) {
|
||||||
if (Daemon < 0) {
|
if (Daemon < 0) {
|
||||||
/* Sleep until midnight */
|
/* Sleep until midnight */
|
||||||
TimeToSleep = (long) 1440*60L - SystemTime(0);
|
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
|
||||||
} else {
|
} else {
|
||||||
TimeToSleep = (long) 60*Daemon;
|
TimeToSleep = 60*Daemon;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
|
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (TimeToSleep > 0L) {
|
while (TimeToSleep > 0L) {
|
||||||
SleepTime = (unsigned) ((TimeToSleep > 30000L) ? 30000 : TimeToSleep);
|
SleepTime = TimeToSleep;
|
||||||
|
|
||||||
if (Daemon > 0 && SleepTime > 60*Daemon) SleepTime = 60*Daemon;
|
if (Daemon > 0 && SleepTime > 60*Daemon) SleepTime = 60*Daemon;
|
||||||
|
|
||||||
|
/* Wake up once a minute to recalibrate sleep time in
|
||||||
|
case of laptop hibernation */
|
||||||
|
if (Daemon <= 0) {
|
||||||
|
if (SleepTime > 60) {
|
||||||
|
SleepTime = 60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Daemon >= 0) {
|
if (Daemon >= 0) {
|
||||||
sleep(SleepTime);
|
sleep(SleepTime);
|
||||||
} else {
|
} else {
|
||||||
DaemonWait(SleepTime);
|
DaemonWait(SleepTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Daemon> 0 && SleepTime) CheckInitialFile();
|
/* If not in daemon mode and day has rolled around,
|
||||||
|
exit -- not much we can do. */
|
||||||
|
if (!Daemon) {
|
||||||
|
int y, m, d;
|
||||||
|
if (RealToday != SystemDate(&y, &m, &d)) {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Daemon > 0 && SleepTime) CheckInitialFile();
|
||||||
|
|
||||||
if (Daemon && !q) {
|
if (Daemon && !q) {
|
||||||
if (Daemon < 0) {
|
if (Daemon < 0) {
|
||||||
/* Sleep until midnight */
|
/* Sleep until midnight */
|
||||||
TimeToSleep = (long) 1440*60L - SystemTime(0);
|
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
|
||||||
} else {
|
} else {
|
||||||
TimeToSleep = (long) 60*Daemon;
|
TimeToSleep = 60*Daemon;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
|
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trigger the reminder */
|
/* Do NOT trigger the reminder if tt.nexttime is more than a
|
||||||
CreateParser(q->text, &p);
|
minute in the past. This can happen if the clock is
|
||||||
trig.typ = q->typ;
|
changed or a laptop awakes from hibernation.
|
||||||
RunDisabled = q->RunDisabled;
|
However, DO triger if tt.nexttime == tt.ttime so all
|
||||||
if (Daemon < 0) {
|
queued reminders are triggered at least once. */
|
||||||
printf("NOTE reminder %s ",
|
if ((SystemTime(0) - (q->tt.nexttime * 60) <= 60) ||
|
||||||
SimpleTime(q->tt.ttime));
|
(q->tt.nexttime == q->tt.ttime)) {
|
||||||
printf("%s ", SimpleTime(SystemTime(0)/60));
|
/* Trigger the reminder */
|
||||||
if (!*q->tag) {
|
CreateParser(q->text, &p);
|
||||||
printf("*");
|
trig.typ = q->typ;
|
||||||
} else {
|
strcpy(trig.passthru, q->passthru);
|
||||||
printf("%s", q->tag);
|
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");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
|
/* Set up global variables so some functions like trigdate()
|
||||||
|
and trigtime() work correctly */
|
||||||
|
LastTriggerDate = JulianToday;
|
||||||
|
LastTriggerTime = q->tt.ttime;
|
||||||
|
LastTrigValid = 1;
|
||||||
|
(void) TriggerReminder(&p, &trig, &q->tt, JulianToday);
|
||||||
|
if (Daemon < 0) {
|
||||||
|
printf("NOTE endreminder\n");
|
||||||
|
}
|
||||||
|
fflush(stdout);
|
||||||
|
DestroyParser(&p);
|
||||||
}
|
}
|
||||||
#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 */
|
/* Calculate the next trigger time */
|
||||||
q->tt.nexttime = CalculateNextTime(q);
|
q->tt.nexttime = CalculateNextTime(q);
|
||||||
}
|
}
|
||||||
#ifdef __BORLANDC__
|
|
||||||
signal(SIGINT, SIG_DFL);
|
|
||||||
#endif
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -282,12 +274,7 @@ void HandleQueuedReminders()
|
|||||||
/* fails, revert to AT with delta and rep. */
|
/* fails, revert to AT with delta and rep. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int CalculateNextTime(QueuedRem *q)
|
||||||
PRIVATE int CalculateNextTime(QueuedRem *q)
|
|
||||||
#else
|
|
||||||
static int CalculateNextTime(q)
|
|
||||||
QueuedRem *q;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int tim = q->tt.ttime;
|
int tim = q->tt.ttime;
|
||||||
int rep = q->tt.rep;
|
int rep = q->tt.rep;
|
||||||
@@ -301,8 +288,13 @@ QueuedRem *q;
|
|||||||
r = CalculateNextTimeUsingSched(q);
|
r = CalculateNextTimeUsingSched(q);
|
||||||
if (r != NO_TIME) return r;
|
if (r != NO_TIME) return r;
|
||||||
}
|
}
|
||||||
if (delta == NO_DELTA)
|
if (delta == NO_DELTA) {
|
||||||
if (tim < curtime) return NO_TIME; else return tim;
|
if (tim < curtime) {
|
||||||
|
return NO_TIME;
|
||||||
|
} else {
|
||||||
|
return tim;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tim -= delta;
|
tim -= delta;
|
||||||
if (rep == NO_REP) rep = delta;
|
if (rep == NO_REP) rep = delta;
|
||||||
@@ -319,11 +311,7 @@ QueuedRem *q;
|
|||||||
/* Find the next reminder to trigger */
|
/* Find the next reminder to trigger */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static QueuedRem *FindNextReminder(void)
|
||||||
PRIVATE QueuedRem *FindNextReminder(void)
|
|
||||||
#else
|
|
||||||
static QueuedRem *FindNextReminder()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QueuedRem *q = QueueHead;
|
QueuedRem *q = QueueHead;
|
||||||
QueuedRem *ans = NULL;
|
QueuedRem *ans = NULL;
|
||||||
@@ -333,12 +321,12 @@ static QueuedRem *FindNextReminder()
|
|||||||
if (!ans) ans = q;
|
if (!ans) ans = q;
|
||||||
else if (q->tt.nexttime < ans->tt.nexttime) ans = q;
|
else if (q->tt.nexttime < ans->tt.nexttime) ans = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
q = q->next;
|
q = q->next;
|
||||||
}
|
}
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -348,11 +336,7 @@ static QueuedRem *FindNextReminder()
|
|||||||
/* This will be necessary for OS/2 multithreaded. */
|
/* This will be necessary for OS/2 multithreaded. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
void GotSigInt(void)
|
void GotSigInt(void)
|
||||||
#else
|
|
||||||
void GotSigInt()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
QueuedRem *q = QueueHead;
|
QueuedRem *q = QueueHead;
|
||||||
|
|
||||||
@@ -361,13 +345,16 @@ void GotSigInt()
|
|||||||
while (q) {
|
while (q) {
|
||||||
if (q->tt.nexttime != NO_TIME) {
|
if (q->tt.nexttime != NO_TIME) {
|
||||||
printf("Trigger: %02d%c%02d Activate: %02d%c%02d Rep: %d Delta: %d Sched: %s",
|
printf("Trigger: %02d%c%02d Activate: %02d%c%02d Rep: %d Delta: %d Sched: %s",
|
||||||
q->tt.ttime / 60, TIMESEP, q->tt.ttime % 60,
|
q->tt.ttime / 60, TimeSep, q->tt.ttime % 60,
|
||||||
q->tt.nexttime / 60, TIMESEP, q->tt.nexttime % 60,
|
q->tt.nexttime / 60, TimeSep, q->tt.nexttime % 60,
|
||||||
q->tt.rep, q->tt.delta, q->sched);
|
q->tt.rep, q->tt.delta, q->sched);
|
||||||
if (*q->sched) printf("(%d)", q->ntrig+1);
|
if (*q->sched) printf("(%d)", q->ntrig+1);
|
||||||
printf("%s", NL);
|
printf("%s", NL);
|
||||||
printf("Text: %s %s%s%s", ((q->typ == MSG_TYPE) ? "MSG" :
|
printf("Text: %s %s%s%s%s%s", ((q->typ == MSG_TYPE) ? "MSG" :
|
||||||
((q->typ == MSF_TYPE) ? "MSF" :"RUN")),
|
((q->typ == MSF_TYPE) ? "MSF" :
|
||||||
|
((q->typ == RUN_TYPE) ? "RUN" : "SPECIAL"))),
|
||||||
|
q->passthru,
|
||||||
|
(*(q->passthru)) ? " " : "",
|
||||||
q->text,
|
q->text,
|
||||||
NL, NL);
|
NL, NL);
|
||||||
}
|
}
|
||||||
@@ -384,11 +371,7 @@ void GotSigInt()
|
|||||||
/* daemon. */
|
/* daemon. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void CheckInitialFile(void)
|
||||||
PRIVATE void CheckInitialFile(void)
|
|
||||||
#else
|
|
||||||
static void CheckInitialFile()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* If date has rolled around, or file has changed, spawn a new version. */
|
/* If date has rolled around, or file has changed, spawn a new version. */
|
||||||
time_t tim = FileModTime;
|
time_t tim = FileModTime;
|
||||||
@@ -408,17 +391,12 @@ static void CheckInitialFile()
|
|||||||
/* Call the scheduling function. */
|
/* Call the scheduling function. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int CalculateNextTimeUsingSched(QueuedRem *q)
|
||||||
PRIVATE int CalculateNextTimeUsingSched(QueuedRem *q)
|
|
||||||
#else
|
|
||||||
static int CalculateNextTimeUsingSched(q)
|
|
||||||
QueuedRem *q;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* Use LineBuffer for temp. string storage. */
|
/* Use LineBuffer for temp. string storage. */
|
||||||
int r;
|
int r;
|
||||||
Value v;
|
Value v;
|
||||||
char *s;
|
char const *s;
|
||||||
int LastTime = -1;
|
int LastTime = -1;
|
||||||
int ThisTime;
|
int ThisTime;
|
||||||
|
|
||||||
@@ -438,10 +416,10 @@ QueuedRem *q;
|
|||||||
q->sched[0] = 0;
|
q->sched[0] = 0;
|
||||||
return NO_TIME;
|
return NO_TIME;
|
||||||
}
|
}
|
||||||
if (v.type == TIM_TYPE) {
|
if (v.type == TIME_TYPE) {
|
||||||
ThisTime = v.v.val;
|
ThisTime = v.v.val;
|
||||||
} else if (v.type == INT_TYPE) {
|
} else if (v.type == INT_TYPE) {
|
||||||
if (v.v.val > 0)
|
if (v.v.val > 0)
|
||||||
ThisTime = q->tt.nexttime + v.v.val;
|
ThisTime = q->tt.nexttime + v.v.val;
|
||||||
else
|
else
|
||||||
ThisTime = q->tt.ttime + v.v.val;
|
ThisTime = q->tt.ttime + v.v.val;
|
||||||
@@ -452,7 +430,7 @@ QueuedRem *q;
|
|||||||
return NO_TIME;
|
return NO_TIME;
|
||||||
}
|
}
|
||||||
if (ThisTime < 0) ThisTime = 0; /* Can't be less than 00:00 */
|
if (ThisTime < 0) ThisTime = 0; /* Can't be less than 00:00 */
|
||||||
if (ThisTime > 1439) ThisTime = 1439; /* or greater than 11:59 */
|
if (ThisTime > (MINUTES_PER_DAY-1)) ThisTime = (MINUTES_PER_DAY-1); /* or greater than 11:59 */
|
||||||
if (ThisTime > q->tt.nexttime) return ThisTime;
|
if (ThisTime > q->tt.nexttime) return ThisTime;
|
||||||
if (ThisTime <= LastTime) {
|
if (ThisTime <= LastTime) {
|
||||||
q->sched[0] = 0;
|
q->sched[0] = 0;
|
||||||
@@ -470,12 +448,7 @@ QueuedRem *q;
|
|||||||
/* Sleep or read command from stdin in "daemon -1" mode */
|
/* Sleep or read command from stdin in "daemon -1" mode */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void DaemonWait(unsigned int sleeptime)
|
||||||
PRIVATE void DaemonWait(unsigned int sleeptime)
|
|
||||||
#else
|
|
||||||
static DaemonWait(sleeptime)
|
|
||||||
unsigned int sleeptime
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
fd_set readSet;
|
fd_set readSet;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
@@ -542,13 +515,8 @@ unsigned int sleeptime
|
|||||||
/* Restarts Remind if date rolls over or REREAD cmd received */
|
/* Restarts Remind if date rolls over or REREAD cmd received */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void reread(void)
|
||||||
PRIVATE void reread(void)
|
|
||||||
#else
|
|
||||||
static reread()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
execvp(ArgV[0], ArgV);
|
execvp(ArgV[0], (char **) ArgV);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_QUEUED from way at the top */
|
|
||||||
|
|||||||
318
src/rem2ps.c
318
src/rem2ps.c
@@ -6,57 +6,45 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dynbuf.h"
|
#include "dynbuf.h"
|
||||||
static char const RCSID[] = "$Id: rem2ps.c,v 1.9 1999-04-05 17:34:55 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
#include <io.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "rem2ps.h"
|
#include "rem2ps.h"
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
#define NEW(type) (malloc(sizeof(type)))
|
||||||
#define ARGS(x) x
|
|
||||||
#else
|
#define SPECIAL_NORMAL 0
|
||||||
#define ARGS(x) ()
|
#define SPECIAL_POSTSCRIPT 1
|
||||||
#endif
|
#define SPECIAL_PSFILE 2
|
||||||
#define NEW(type) ((type *) malloc(sizeof(type)))
|
#define SPECIAL_MOON 3
|
||||||
|
#define SPECIAL_SHADE 4
|
||||||
|
#define SPECIAL_COLOR 5
|
||||||
|
|
||||||
typedef struct calentry {
|
typedef struct calentry {
|
||||||
struct calentry *next;
|
struct calentry *next;
|
||||||
|
int special;
|
||||||
char *entry;
|
char *entry;
|
||||||
} CalEntry;
|
} CalEntry;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char const *name;
|
||||||
int xsize, ysize;
|
int xsize, ysize;
|
||||||
} PageType;
|
} PageType;
|
||||||
|
|
||||||
char DayName[7][33];
|
char DayName[7][33];
|
||||||
|
|
||||||
char *SmallCalLoc[] = {
|
char const *SmallCalLoc[] = {
|
||||||
"",
|
"",
|
||||||
"bt",
|
"bt",
|
||||||
"tb",
|
"tb",
|
||||||
@@ -64,7 +52,7 @@ char *SmallCalLoc[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define NUMSMALL (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0]))
|
#define NUMSMALL (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0]))
|
||||||
char *SmallLocation;
|
char const *SmallLocation;
|
||||||
int SmallCol1, SmallCol2;
|
int SmallCol1, SmallCol2;
|
||||||
|
|
||||||
PageType Pages[] =
|
PageType Pages[] =
|
||||||
@@ -82,7 +70,8 @@ PageType Pages[] =
|
|||||||
{"B5", 519, 729},
|
{"B5", 519, 729},
|
||||||
{"Folio", 612, 936},
|
{"Folio", 612, 936},
|
||||||
{"Quarto", 612, 780},
|
{"Quarto", 612, 780},
|
||||||
{"10x14", 720, 1008}
|
{"10x14", 720, 1008},
|
||||||
|
{"-custom-", 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
PageType DefaultPage[1] =
|
PageType DefaultPage[1] =
|
||||||
@@ -99,20 +88,20 @@ char PortraitMode;
|
|||||||
char NoSmallCal;
|
char NoSmallCal;
|
||||||
char UseISO;
|
char UseISO;
|
||||||
|
|
||||||
char *HeadFont="Helvetica";
|
char const *HeadFont="Helvetica";
|
||||||
char *TitleFont="Helvetica";
|
char const *TitleFont="Helvetica";
|
||||||
char *DayFont="Helvetica-BoldOblique";
|
char const *DayFont="Helvetica-BoldOblique";
|
||||||
char *EntryFont="Helvetica";
|
char const *EntryFont="Helvetica";
|
||||||
char *SmallFont="Helvetica";
|
char const *SmallFont="Helvetica";
|
||||||
char *LineWidth = "1";
|
char const *LineWidth = "1";
|
||||||
|
|
||||||
char *HeadSize="14";
|
char const *HeadSize="14";
|
||||||
char *TitleSize="14";
|
char const *TitleSize="14";
|
||||||
char *DaySize="14";
|
char const *DaySize="14";
|
||||||
char *EntrySize="8";
|
char const *EntrySize="8";
|
||||||
char *BorderSize = "6";
|
char const *BorderSize = "6";
|
||||||
|
|
||||||
char *UserProlog = NULL;
|
char const *UserProlog = NULL;
|
||||||
|
|
||||||
int validfile = 0;
|
int validfile = 0;
|
||||||
|
|
||||||
@@ -126,29 +115,23 @@ int LeftMarg, RightMarg, TopMarg, BotMarg;
|
|||||||
int FillPage;
|
int FillPage;
|
||||||
int Verbose = 0;
|
int Verbose = 0;
|
||||||
|
|
||||||
void Init ARGS ((int argc, char *argv[]));
|
void Init (int argc, char *argv[]);
|
||||||
void Usage ARGS ((char *s));
|
void Usage (char const *s);
|
||||||
void DoPsCal ARGS ((void));
|
void DoPsCal (void);
|
||||||
int DoQueuedPs ARGS ((void));
|
int DoQueuedPs (void);
|
||||||
void DoSmallCal ARGS((char *m, int days, int first, int col, int which));
|
void DoSmallCal (char const *m, int days, int first, int col, int which);
|
||||||
void WriteProlog ARGS ((void));
|
void WriteProlog (void);
|
||||||
void WriteCalEntry ARGS ((void));
|
void WriteCalEntry (void);
|
||||||
void WriteOneEntry ARGS ((char *s));
|
void WriteOneEntry (CalEntry *c);
|
||||||
void GetSmallLocations ARGS ((void));
|
void GetSmallLocations (void);
|
||||||
char *EatToken(char *in, char *out, int maxlen);
|
char const *EatToken(char const *in, char *out, int maxlen);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* MAIN PROGRAM */
|
/* MAIN PROGRAM */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int main(int argc, char *argv[])
|
||||||
PUBLIC int main(int argc, char *argv[])
|
|
||||||
#else
|
|
||||||
int main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char argv[];
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* If stdin is a tty - probably wrong. */
|
/* If stdin is a tty - probably wrong. */
|
||||||
|
|
||||||
@@ -190,11 +173,7 @@ char argv[];
|
|||||||
/* DoPsCal - emit PostScript for the calendar. */
|
/* DoPsCal - emit PostScript for the calendar. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
void DoPsCal(void)
|
void DoPsCal(void)
|
||||||
#else
|
|
||||||
void DoPsCal()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char month[40], year[40];
|
char month[40], year[40];
|
||||||
char prevm[40], nextm[40];
|
char prevm[40], nextm[40];
|
||||||
@@ -203,7 +182,7 @@ void DoPsCal()
|
|||||||
int i;
|
int i;
|
||||||
int is_ps;
|
int is_ps;
|
||||||
int firstcol;
|
int firstcol;
|
||||||
char *startOfBody;
|
char const *startOfBody;
|
||||||
char passthru[PASSTHRU_LEN+1];
|
char passthru[PASSTHRU_LEN+1];
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
CalEntry *c, *d;
|
CalEntry *c, *d;
|
||||||
@@ -280,14 +259,18 @@ void DoPsCal()
|
|||||||
fprintf(stderr, "Input from REMIND is corrupt!\n");
|
fprintf(stderr, "Input from REMIND is corrupt!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBufGets(&buf, stdin);
|
DBufGets(&buf, stdin);
|
||||||
if (!strcmp(DBufValue(&buf), PSEND)) {
|
if (!strcmp(DBufValue(&buf), PSEND)) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the day number - a bit of a hack! */
|
/* Ignore lines beginning with '#' */
|
||||||
|
if (DBufValue(&buf)[0] == '#') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* Read the day number - a bit of a hack! */
|
||||||
DayNum = (DBufValue(&buf)[8] - '0') * 10 + DBufValue(&buf)[9] - '0';
|
DayNum = (DBufValue(&buf)[8] - '0') * 10 + DBufValue(&buf)[9] - '0';
|
||||||
if (DayNum != CurDay) {
|
if (DayNum != CurDay) {
|
||||||
for(; CurDay<DayNum; CurDay++) {
|
for(; CurDay<DayNum; CurDay++) {
|
||||||
@@ -295,13 +278,14 @@ void DoPsCal()
|
|||||||
WkDayNum = (WkDayNum + 1) % 7;
|
WkDayNum = (WkDayNum + 1) % 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Add the text */
|
/* Add the text */
|
||||||
c = NEW(CalEntry);
|
c = NEW(CalEntry);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
fprintf(stderr, "malloc failed - aborting.\n");
|
fprintf(stderr, "malloc failed - aborting.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
c->next = NULL;
|
c->next = NULL;
|
||||||
|
c->special = SPECIAL_NORMAL;
|
||||||
|
|
||||||
/* Skip the tag, duration and time */
|
/* Skip the tag, duration and time */
|
||||||
startOfBody = DBufValue(&buf)+10;
|
startOfBody = DBufValue(&buf)+10;
|
||||||
@@ -325,38 +309,45 @@ void DoPsCal()
|
|||||||
!strcmp(passthru, "SHADE")) {
|
!strcmp(passthru, "SHADE")) {
|
||||||
is_ps = 1;
|
is_ps = 1;
|
||||||
}
|
}
|
||||||
c->entry = malloc(strlen(startOfBody) + 1 + is_ps);
|
c->entry = malloc(strlen(startOfBody) + 1);
|
||||||
if (!c->entry) {
|
if (!c->entry) {
|
||||||
fprintf(stderr, "malloc failed - aborting.\n");
|
fprintf(stderr, "malloc failed - aborting.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
strcpy(c->entry+is_ps, startOfBody);
|
strcpy(c->entry, startOfBody);
|
||||||
|
|
||||||
if (is_ps) {
|
if (is_ps) {
|
||||||
/* Save the 'P' or 'F' flag */
|
/* Save the type of SPECIAL */
|
||||||
if (!strcmp(passthru, "PostScript")) {
|
if (!strcmp(passthru, "PostScript")) {
|
||||||
*(c->entry) = 'P';
|
c->special = SPECIAL_POSTSCRIPT;
|
||||||
} else if (!strcmp(passthru, "SHADE")) {
|
} else if (!strcmp(passthru, "SHADE")) {
|
||||||
*(c->entry) = 'S';
|
c->special = SPECIAL_SHADE;
|
||||||
} else if (!strcmp(passthru, "MOON")) {
|
} else if (!strcmp(passthru, "MOON")) {
|
||||||
*(c->entry) = 'M';
|
c->special = SPECIAL_MOON;
|
||||||
} else {
|
} else {
|
||||||
*(c->entry) = 'F';
|
c->special = SPECIAL_PSFILE;
|
||||||
}
|
}
|
||||||
if (!PsEntries[DayNum]) PsEntries[DayNum] = c;
|
|
||||||
else {
|
if (!PsEntries[DayNum]) {
|
||||||
|
PsEntries[DayNum] = c;
|
||||||
|
} else {
|
||||||
d = PsEntries[DayNum];
|
d = PsEntries[DayNum];
|
||||||
while(d->next) d = d->next;
|
while(d->next) d = d->next;
|
||||||
d->next = c;
|
d->next = c;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(passthru, "*")) {
|
} else if (!strcmp(passthru, "*") ||
|
||||||
/* Put on linked list */
|
!strcmp(passthru, "COLOR")) {
|
||||||
if (!CurEntries) CurEntries = c;
|
/* Put on linked list */
|
||||||
else {
|
if (!CurEntries) {
|
||||||
|
CurEntries = c;
|
||||||
|
} else {
|
||||||
d = CurEntries;
|
d = CurEntries;
|
||||||
while(d->next) d = d->next;
|
while(d->next) d = d->next;
|
||||||
d->next = c;
|
d->next = c;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(passthru, "COLOR")) {
|
||||||
|
c->special = SPECIAL_COLOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(; CurDay<=days; CurDay++) {
|
for(; CurDay<=days; CurDay++) {
|
||||||
@@ -392,16 +383,12 @@ void DoPsCal()
|
|||||||
/* WriteProlog - write the PostScript prologue */
|
/* WriteProlog - write the PostScript prologue */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
void WriteProlog(void)
|
void WriteProlog(void)
|
||||||
#else
|
|
||||||
void WriteProlog()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int x = CurPage->xsize;
|
int x = CurPage->xsize;
|
||||||
int y = CurPage->ysize;
|
int y = CurPage->ysize;
|
||||||
char *isostuff;
|
char const *isostuff;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int nread;
|
int nread;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
@@ -497,11 +484,7 @@ void WriteProlog()
|
|||||||
/* WriteCalEntry - write all entries for one day */
|
/* WriteCalEntry - write all entries for one day */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
void WriteCalEntry(void)
|
void WriteCalEntry(void)
|
||||||
#else
|
|
||||||
void WriteCalEntry()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
CalEntry *c = CurEntries;
|
CalEntry *c = CurEntries;
|
||||||
CalEntry *d;
|
CalEntry *d;
|
||||||
@@ -520,7 +503,7 @@ void WriteCalEntry()
|
|||||||
CurEntries = NULL;
|
CurEntries = NULL;
|
||||||
|
|
||||||
while(c) {
|
while(c) {
|
||||||
WriteOneEntry(c->entry);
|
WriteOneEntry(c);
|
||||||
free(c->entry);
|
free(c->entry);
|
||||||
d = c->next;
|
d = c->next;
|
||||||
free(c);
|
free(c);
|
||||||
@@ -540,7 +523,7 @@ void WriteCalEntry()
|
|||||||
/* If WkDayNum is a Sunday or Monday, depending on MondayFirst,
|
/* If WkDayNum is a Sunday or Monday, depending on MondayFirst,
|
||||||
move to next row. Also handle the queued PS and PSFILE reminders */
|
move to next row. Also handle the queued PS and PSFILE reminders */
|
||||||
if ((!MondayFirst && WkDayNum == 6) ||
|
if ((!MondayFirst && WkDayNum == 6) ||
|
||||||
(MondayFirst && WkDayNum == 0) || CurDay == MaxDay) {
|
(MondayFirst && WkDayNum == 0) || CurDay == MaxDay) {
|
||||||
HadQPS = 0;
|
HadQPS = 0;
|
||||||
if (MondayFirst) begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
|
if (MondayFirst) begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
|
||||||
else begin = CurDay - WkDayNum;
|
else begin = CurDay - WkDayNum;
|
||||||
@@ -588,37 +571,61 @@ void WriteCalEntry()
|
|||||||
/* WriteOneEntry - write an entry for one day */
|
/* WriteOneEntry - write an entry for one day */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void WriteOneEntry(CalEntry *c)
|
||||||
void WriteOneEntry(char *s)
|
|
||||||
#else
|
|
||||||
void WriteOneEntry(s)
|
|
||||||
char *s;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int c;
|
int ch, i;
|
||||||
|
char const *s = c->entry;
|
||||||
|
|
||||||
printf(" [");
|
printf(" [");
|
||||||
|
|
||||||
/* Chew up leading spaces */
|
/* Chew up leading spaces */
|
||||||
while(isspace((unsigned char) *s)) s++;
|
while(isspace((unsigned char) *s)) s++;
|
||||||
|
|
||||||
|
/* Skip three decimal numbers for COLOR special */
|
||||||
|
if (c->special == SPECIAL_COLOR) {
|
||||||
|
for (i=0; i<3; i++) {
|
||||||
|
while(*s && !isspace(*s)) s++;
|
||||||
|
while(*s && isspace(*s)) s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PutChar('(');
|
PutChar('(');
|
||||||
while(*s) {
|
while(*s) {
|
||||||
/* Use the "unsigned char" cast to fix problem on Solaris 2.5 */
|
/* Use the "unsigned char" cast to fix problem on Solaris 2.5 */
|
||||||
/* which treated some latin1 characters as white space. */
|
/* which treated some latin1 characters as white space. */
|
||||||
c = (unsigned char) *s++;
|
ch = (unsigned char) *s++;
|
||||||
if (c == '\\' || c == '(' || c == ')') PutChar('\\');
|
if (ch == '\\' || ch == '(' || ch == ')') PutChar('\\');
|
||||||
if (!isspace(c)) PutChar(c);
|
if (!isspace(ch)) PutChar(ch);
|
||||||
else {
|
else {
|
||||||
PutChar(')');
|
PutChar(')');
|
||||||
while(isspace((unsigned char)*s)) s++;
|
while(isspace((unsigned char)*s)) s++;
|
||||||
if (!*s) {
|
if (!*s) {
|
||||||
printf("]\n");
|
goto finish;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
PutChar('(');
|
PutChar('(');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf(")]\n");
|
printf(")\n");
|
||||||
|
finish:
|
||||||
|
if (c->special == SPECIAL_COLOR) {
|
||||||
|
int r, g, b;
|
||||||
|
if (sscanf(c->entry, "%d %d %d", &r, &g, &b) == 3) {
|
||||||
|
if (r < 0) r = 0;
|
||||||
|
else if (r > 255) r = 255;
|
||||||
|
if (g < 0) g = 0;
|
||||||
|
else if (g > 255) g = 255;
|
||||||
|
if (b < 0) b = 0;
|
||||||
|
else if (b > 255) b = 255;
|
||||||
|
printf("(gsave %f %f %f setrgbcolor)(grestore)",
|
||||||
|
r / 255.0, g / 255.0, b / 255.0);
|
||||||
|
} else {
|
||||||
|
/* Punt... unrecognized color is black */
|
||||||
|
printf("()()");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("()()");
|
||||||
|
}
|
||||||
|
printf("]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@@ -626,15 +633,10 @@ char *s;
|
|||||||
/* Init - set up parameters */
|
/* Init - set up parameters */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void Init(int argc, char *argv[])
|
||||||
PUBLIC void Init(int argc, char *argv[])
|
|
||||||
#else
|
|
||||||
void Init(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *s, *t;
|
char const *s;
|
||||||
|
char const *t;
|
||||||
int i=1;
|
int i=1;
|
||||||
int j;
|
int j;
|
||||||
int offset;
|
int offset;
|
||||||
@@ -676,9 +678,9 @@ char *argv[];
|
|||||||
case 'e': EntrySize = t; break;
|
case 'e': EntrySize = t; break;
|
||||||
case 'd': DaySize = t; break;
|
case 'd': DaySize = t; break;
|
||||||
case 't': TitleSize = t; break;
|
case 't': TitleSize = t; break;
|
||||||
default: Usage("Size must specify h, t, e, or d");
|
default: Usage("Size must specify h, t, e, or d");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
@@ -691,9 +693,9 @@ char *argv[];
|
|||||||
case 'd': DayFont = t; break;
|
case 'd': DayFont = t; break;
|
||||||
case 's': SmallFont = t; break;
|
case 's': SmallFont = t; break;
|
||||||
case 't': TitleFont = t; break;
|
case 't': TitleFont = t; break;
|
||||||
default: Usage("Font must specify s, h, t, e, or d");
|
default: Usage("Font must specify s, h, t, e, or d");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
@@ -704,20 +706,35 @@ char *argv[];
|
|||||||
if (i == argc) Usage("Media must be supplied");
|
if (i == argc) Usage("Media must be supplied");
|
||||||
t = argv[i++];
|
t = argv[i++];
|
||||||
CurPage = NULL;
|
CurPage = NULL;
|
||||||
for (j=0; j<NUMPAGES; j++)
|
for (j=0; j<NUMPAGES-1; j++)
|
||||||
if (!strcmp(t, Pages[j].name)) {
|
if (!strcmp(t, Pages[j].name)) {
|
||||||
CurPage = &Pages[j];
|
CurPage = &Pages[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CurPage) {
|
||||||
|
double w, h;
|
||||||
|
if (sscanf(t, "%lfx%lfin", &w, &h) == 2) {
|
||||||
|
CurPage = &Pages[NUMPAGES-1];
|
||||||
|
CurPage->xsize = (int) (w * 72.0);
|
||||||
|
CurPage->ysize = (int) (h * 72.0);
|
||||||
|
} else if (sscanf(t, "%lfx%lfcm", &w, &h) == 2) {
|
||||||
|
CurPage = &Pages[NUMPAGES-1];
|
||||||
|
CurPage->xsize = (int) ((double) w * 28.346457);
|
||||||
|
CurPage->ysize = (int) ((double) w * 28.346457);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!CurPage) {
|
if (!CurPage) {
|
||||||
fprintf(stderr, "\nUnknown media specified.\n");
|
fprintf(stderr, "\nUnknown media specified.\n");
|
||||||
fprintf(stderr, "\nAvailable media types:\n");
|
fprintf(stderr, "\nAvailable media types:\n");
|
||||||
for (j=0; j<NUMPAGES; j++)
|
for (j=0; j<NUMPAGES-1; j++) {
|
||||||
fprintf(stderr, " %s\n", Pages[j].name);
|
fprintf(stderr, " %s\n", Pages[j].name);
|
||||||
|
}
|
||||||
|
fprintf(stderr, " WxHin Specify size in inches (W and H are decimal numbers)\n");
|
||||||
|
fprintf(stderr, " WxHcm Specify size in centimetres (W and H are decimal numbers)\n");
|
||||||
fprintf(stderr, "Default media type is %s\n", DefaultPage[0].name);
|
fprintf(stderr, "Default media type is %s\n", DefaultPage[0].name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
@@ -775,12 +792,7 @@ char *argv[];
|
|||||||
/* Usage - print usage information */
|
/* Usage - print usage information */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void Usage(char const *s)
|
||||||
PUBLIC void Usage(char *s)
|
|
||||||
#else
|
|
||||||
void Usage(s)
|
|
||||||
char *s;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (s) fprintf(stderr, "Rem2PS: %s\n\n", s);
|
if (s) fprintf(stderr, "Rem2PS: %s\n\n", s);
|
||||||
|
|
||||||
@@ -809,13 +821,7 @@ char *s;
|
|||||||
/* month. */
|
/* month. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DoSmallCal(char const *m, int days, int first, int col, int which)
|
||||||
void DoSmallCal(char *m, int days, int first, int col, int which)
|
|
||||||
#else
|
|
||||||
void DoSmallCal(m, days, first, col, which)
|
|
||||||
char *m;
|
|
||||||
int days, first, col;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* Do the small calendar */
|
/* Do the small calendar */
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -843,7 +849,7 @@ int days, first, col;
|
|||||||
/* Move origin to upper-left hand corner of appropriate box */
|
/* Move origin to upper-left hand corner of appropriate box */
|
||||||
printf("%d xincr mul MinX add ysmall%d translate\n", col, which);
|
printf("%d xincr mul MinX add ysmall%d translate\n", col, which);
|
||||||
|
|
||||||
/* Print the month */
|
/* Print the month */
|
||||||
printf("SmallWidth 7 mul (%s) stringwidth pop sub 2 div Border add Border neg SmallFontSize sub moveto (%s) show\n", m, m);
|
printf("SmallWidth 7 mul (%s) stringwidth pop sub 2 div Border add Border neg SmallFontSize sub moveto (%s) show\n", m, m);
|
||||||
|
|
||||||
/* Print the days of the week */
|
/* Print the days of the week */
|
||||||
@@ -869,11 +875,7 @@ int days, first, col;
|
|||||||
/* DoQueuedPs - do the queued PS and PSFILE reminders. */
|
/* DoQueuedPs - do the queued PS and PSFILE reminders. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoQueuedPs(void)
|
||||||
PUBLIC int DoQueuedPs(void)
|
|
||||||
#else
|
|
||||||
int DoQueuedPs()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int HadPS = 0;
|
int HadPS = 0;
|
||||||
@@ -884,7 +886,7 @@ int DoQueuedPs()
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
int fnoff;
|
int fnoff;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
char *size, *extra;
|
char const *size, *extra;
|
||||||
int num, r, g, b, phase, fontsize, moonsize;
|
int num, r, g, b, phase, fontsize, moonsize;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
@@ -910,14 +912,14 @@ int DoQueuedPs()
|
|||||||
|
|
||||||
while (e) {
|
while (e) {
|
||||||
|
|
||||||
/* Now do the user's PostScript code */
|
/* Now do the PostScript SPECIAL */
|
||||||
fnoff = 1;
|
fnoff = 0;
|
||||||
while (isspace(*(e->entry+fnoff))) fnoff++;
|
while (isspace(*(e->entry+fnoff))) fnoff++;
|
||||||
switch(*e->entry) {
|
switch(e->special) {
|
||||||
case 'P': /* Send PostScript through */
|
case SPECIAL_POSTSCRIPT: /* Send PostScript through */
|
||||||
printf("%s\n", e->entry+fnoff);
|
printf("%s\n", e->entry+fnoff);
|
||||||
break;
|
break;
|
||||||
case 'F': /* PostScript from a file */
|
case SPECIAL_PSFILE: /* PostScript from a file */
|
||||||
fp = fopen(e->entry+fnoff, "r");
|
fp = fopen(e->entry+fnoff, "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
fprintf(stderr, "Could not open PostScript file `%s'\n", e->entry+1);
|
fprintf(stderr, "Could not open PostScript file `%s'\n", e->entry+1);
|
||||||
@@ -930,7 +932,7 @@ int DoQueuedPs()
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'S': /* Shading */
|
case SPECIAL_SHADE: /* Shading */
|
||||||
num = sscanf(e->entry+fnoff, "%d %d %d", &r, &g, &b);
|
num = sscanf(e->entry+fnoff, "%d %d %d", &r, &g, &b);
|
||||||
if (num == 1) {
|
if (num == 1) {
|
||||||
g = r;
|
g = r;
|
||||||
@@ -952,7 +954,7 @@ int DoQueuedPs()
|
|||||||
r/255.0, g/255.0, b/255.0);
|
r/255.0, g/255.0, b/255.0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M': /* Moon phase */
|
case SPECIAL_MOON: /* Moon phase */
|
||||||
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
|
||||||
&fontsize);
|
&fontsize);
|
||||||
if (num == 1) {
|
if (num == 1) {
|
||||||
@@ -975,7 +977,7 @@ int DoQueuedPs()
|
|||||||
sprintf(buffer, "%d", moonsize);
|
sprintf(buffer, "%d", moonsize);
|
||||||
size = buffer;
|
size = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("gsave 0 setgray newpath Border %s add BoxHeight Border sub %s sub\n", size, size);
|
printf("gsave 0 setgray newpath Border %s add BoxHeight Border sub %s sub\n", size, size);
|
||||||
printf(" %s 0 360 arc closepath\n", size);
|
printf(" %s 0 360 arc closepath\n", size);
|
||||||
switch(phase) {
|
switch(phase) {
|
||||||
@@ -1056,14 +1058,10 @@ int DoQueuedPs()
|
|||||||
/* Set up the locations for the small calendars. */
|
/* Set up the locations for the small calendars. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void GetSmallLocations(void)
|
||||||
PUBLIC void GetSmallLocations(void)
|
|
||||||
#else
|
|
||||||
void GetSmallLocations()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
char *s = SmallLocation;
|
char const *s = SmallLocation;
|
||||||
int colfirst, collast;
|
int colfirst, collast;
|
||||||
|
|
||||||
/* Figure out the first and last columns */
|
/* Figure out the first and last columns */
|
||||||
@@ -1079,14 +1077,14 @@ void GetSmallLocations()
|
|||||||
switch(c) {
|
switch(c) {
|
||||||
case 'b':
|
case 'b':
|
||||||
/* Adjust Feb. if we want it on the bottom */
|
/* Adjust Feb. if we want it on the bottom */
|
||||||
if (MaxDay == 28 && colfirst == 0) {
|
if (MaxDay == 28 && colfirst == 0) {
|
||||||
printf("/ysmallbot ymin def /ymin ysmallbot MinBoxSize sub def\n");
|
printf("/ysmallbot ymin def /ymin ysmallbot MinBoxSize sub def\n");
|
||||||
printf("MinX ymin MaxX ymin L\n");
|
printf("MinX ymin MaxX ymin L\n");
|
||||||
printf("/ysmall1 ysmallbot def /ysmall2 ysmallbot def\n");
|
printf("/ysmall1 ysmallbot def /ysmall2 ysmallbot def\n");
|
||||||
SmallCol1 = 5;
|
SmallCol1 = 5;
|
||||||
SmallCol2 = 6;
|
SmallCol2 = 6;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (collast <= 4) {
|
if (collast <= 4) {
|
||||||
printf("/ysmall1 ysmallbot def /ysmall2 ysmallbot def\n");
|
printf("/ysmall1 ysmallbot def /ysmall2 ysmallbot def\n");
|
||||||
SmallCol1 = 5;
|
SmallCol1 = 5;
|
||||||
@@ -1117,7 +1115,7 @@ void GetSmallLocations()
|
|||||||
NoSmallCal = 1;
|
NoSmallCal = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* EatToken */
|
/* EatToken */
|
||||||
@@ -1125,13 +1123,7 @@ void GetSmallLocations()
|
|||||||
/* Read a space-delimited token into an output buffer. */
|
/* Read a space-delimited token into an output buffer. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
char const *EatToken(char const *in, char *out, int maxlen)
|
||||||
PUBLIC char *EatToken(char *in, char *out, int maxlen)
|
|
||||||
#else
|
|
||||||
char *EatToken(in, out, maxlen)
|
|
||||||
char *in, *out;
|
|
||||||
int maxlen;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
|||||||
18
src/rem2ps.h
18
src/rem2ps.h
@@ -6,12 +6,10 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: rem2ps.h,v 1.3 1999-04-05 17:34:56 dfs Exp $ */
|
|
||||||
|
|
||||||
char *PSProlog1[] =
|
char *PSProlog1[] =
|
||||||
{
|
{
|
||||||
"% This file was produced by Remind and Rem2PS, written by",
|
"% This file was produced by Remind and Rem2PS, written by",
|
||||||
@@ -178,8 +176,22 @@ char *PSProlog2[] =
|
|||||||
" /width exch def",
|
" /width exch def",
|
||||||
" /xleft exch def",
|
" /xleft exch def",
|
||||||
" /curline () def",
|
" /curline () def",
|
||||||
|
" % The last two strings in the word array are actually the PostScript",
|
||||||
|
" % code to execute before and after the entry is printed.",
|
||||||
|
" dup dup",
|
||||||
|
" length 1 sub",
|
||||||
|
" get",
|
||||||
|
" exch",
|
||||||
|
" dup dup",
|
||||||
|
" length 2 sub",
|
||||||
|
" get",
|
||||||
|
" dup length 0 gt",
|
||||||
|
" {cvx exec} {pop} ifelse",
|
||||||
|
" dup length 2 sub 0 exch getinterval",
|
||||||
" {EnterOneWord} forall",
|
" {EnterOneWord} forall",
|
||||||
" FinishFormatting",
|
" FinishFormatting",
|
||||||
|
" dup length 0 gt",
|
||||||
|
" {cvx exec} {pop} ifelse",
|
||||||
" y",
|
" y",
|
||||||
"} bind def",
|
"} bind def",
|
||||||
"% Variables for calendar boxes:",
|
"% Variables for calendar boxes:",
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
NAME WINDOWCOMPAT NEWFILES
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
# $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!
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# THINGS FOR YOU TO EDIT START BELOW
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Uncomment the next line if you are running on a SYSV system
|
|
||||||
# SYSV= -DSYSV
|
|
||||||
|
|
||||||
# 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= SC
|
|
||||||
LD= SC
|
|
||||||
|
|
||||||
# Put any additional flags for the C compiler or linker here - if you
|
|
||||||
# are not using gcc, you probably want to remove '-ansi'.
|
|
||||||
CFLAGS= OPT NOSTKCHK NOSINT MATH=IEEE
|
|
||||||
CDEFS=
|
|
||||||
LDFLAGS= LINK
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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 amiga.c
|
|
||||||
|
|
||||||
OBJS= calendar.o dorem.o dosubst.o expr.o files.o funcs.o globals.o hbcal.o \
|
|
||||||
init.o main.o moon.o omit.o sort.o queue.o token.o trigger.o userfns.o \
|
|
||||||
utils.o var.o amiga.o
|
|
||||||
|
|
||||||
MANIFEST= README.UNIX README.DOS COPYRIGHT $(HDRS) $(SRCS) Makefile rem rem.1 \
|
|
||||||
remind.1 remind-all.csh remind-all.sh test.rem test-rem test.cmp makefile.tc \
|
|
||||||
makefile.msc lnk.msc lnk.tc MANIFEST.UNX MANIFEST.DOS WHATSNEW.30 kall kall.1 \
|
|
||||||
defs.rem README.OS2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \
|
|
||||||
tstlang.rem README.BCC lnk.bcc makefile.bcc os2func.c \
|
|
||||||
test-rem.bat test-rem.cmd test1.cmp test2.cmp
|
|
||||||
|
|
||||||
|
|
||||||
all: remind rem2ps
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(UNIX) $(SYSV) $(CFLAGS) $(CDEFS) $*.c
|
|
||||||
|
|
||||||
rem2ps: rem2ps.o
|
|
||||||
$(LD) MATH=IEEE $(LDFLAGS) PNAME=rem2ps rem2ps.o
|
|
||||||
|
|
||||||
remind: $(OBJS)
|
|
||||||
$(LD) MATH=IEEE $(LDFLAGS) PNAME=remind $(OBJS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o *~ core *.bak
|
|
||||||
|
|
||||||
clobber:
|
|
||||||
rm -f *.o *~ remind rem2ps test.out core *.bak
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
amiga.o: amiga.c
|
|
||||||
$(CC) OBJNAME=amiga.o $(CFLAGS) amiga.c
|
|
||||||
67
src/sort.c
67
src/sort.c
@@ -6,24 +6,16 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: sort.c,v 1.5 1999-04-05 17:34:56 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
@@ -33,7 +25,7 @@ static char const RCSID[] = "$Id: sort.c,v 1.5 1999-04-05 17:34:56 dfs Exp $";
|
|||||||
/* The structure of a sorted entry */
|
/* The structure of a sorted entry */
|
||||||
typedef struct sortrem {
|
typedef struct sortrem {
|
||||||
struct sortrem *next;
|
struct sortrem *next;
|
||||||
char *text;
|
char const *text;
|
||||||
int trigdate;
|
int trigdate;
|
||||||
int trigtime;
|
int trigtime;
|
||||||
int typ;
|
int typ;
|
||||||
@@ -43,8 +35,8 @@ typedef struct sortrem {
|
|||||||
/* The sorted reminder queue */
|
/* The sorted reminder queue */
|
||||||
static Sortrem *SortedQueue = (Sortrem *) NULL;
|
static Sortrem *SortedQueue = (Sortrem *) NULL;
|
||||||
|
|
||||||
PRIVATE Sortrem *MakeSortRem ARGS ((int jul, int tim, char *body, int typ, int prio));
|
static Sortrem *MakeSortRem (int jul, int tim, char const *body, int typ, int prio);
|
||||||
PRIVATE void IssueSortBanner ARGS ((int jul));
|
static void IssueSortBanner (int jul);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -53,14 +45,7 @@ PRIVATE void IssueSortBanner ARGS ((int jul));
|
|||||||
/* Create a new Sortrem entry - return NULL on failure. */
|
/* Create a new Sortrem entry - return NULL on failure. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static Sortrem *MakeSortRem(int jul, int tim, char const *body, int typ, int prio)
|
||||||
PRIVATE Sortrem *MakeSortRem(int jul, int tim, char *body, int typ, int prio)
|
|
||||||
#else
|
|
||||||
static Sortrem *MakeSortRem(jul, tim, body, typ, prio)
|
|
||||||
int jul, tim;
|
|
||||||
char *body;
|
|
||||||
int typ, prio;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Sortrem *new = NEW(Sortrem);
|
Sortrem *new = NEW(Sortrem);
|
||||||
if (!new) return NULL;
|
if (!new) return NULL;
|
||||||
@@ -86,15 +71,7 @@ int typ, prio;
|
|||||||
/* Insert a reminder into the sort buffer */
|
/* Insert a reminder into the sort buffer */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int InsertIntoSortBuffer(int jul, int tim, char const *body, int typ, int prio)
|
||||||
PUBLIC int InsertIntoSortBuffer(int jul, int tim, char *body, int typ, int prio)
|
|
||||||
#else
|
|
||||||
int InsertIntoSortBuffer(jul, tim, body, typ, prio)
|
|
||||||
int jul;
|
|
||||||
int tim;
|
|
||||||
char *body;
|
|
||||||
int typ, prio;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Sortrem *new = MakeSortRem(jul, tim, body, typ, prio);
|
Sortrem *new = MakeSortRem(jul, tim, body, typ, prio);
|
||||||
Sortrem *cur = SortedQueue, *prev = NULL;
|
Sortrem *cur = SortedQueue, *prev = NULL;
|
||||||
@@ -147,11 +124,7 @@ int typ, prio;
|
|||||||
/* Issue all of the sorted reminders and free memory. */
|
/* Issue all of the sorted reminders and free memory. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void IssueSortedReminders(void)
|
||||||
PUBLIC void IssueSortedReminders(void)
|
|
||||||
#else
|
|
||||||
void IssueSortedReminders()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Sortrem *cur = SortedQueue;
|
Sortrem *cur = SortedQueue;
|
||||||
Sortrem *next;
|
Sortrem *next;
|
||||||
@@ -173,11 +146,7 @@ void IssueSortedReminders()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MSF_TYPE:
|
case MSF_TYPE:
|
||||||
#ifdef OS2_POPUP
|
|
||||||
FillParagraph(cur->text, 0);
|
|
||||||
#else
|
|
||||||
FillParagraph(cur->text);
|
FillParagraph(cur->text);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RUN_TYPE:
|
case RUN_TYPE:
|
||||||
@@ -185,7 +154,7 @@ void IssueSortedReminders()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cur->text);
|
free((char *) cur->text);
|
||||||
free(cur);
|
free(cur);
|
||||||
cur = next;
|
cur = next;
|
||||||
}
|
}
|
||||||
@@ -199,17 +168,12 @@ void IssueSortedReminders()
|
|||||||
/* defined to take one argument. */
|
/* defined to take one argument. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void IssueSortBanner(int jul)
|
||||||
PRIVATE void IssueSortBanner(int jul)
|
|
||||||
#else
|
|
||||||
static void IssueSortBanner(jul)
|
|
||||||
int jul;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char BanExpr[64];
|
char BanExpr[64];
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
Value v;
|
Value v;
|
||||||
char *s = BanExpr;
|
char const *s = BanExpr;
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
|
|
||||||
if (UserFuncExists("sortbanner") != 1) return;
|
if (UserFuncExists("sortbanner") != 1) return;
|
||||||
@@ -237,14 +201,9 @@ int jul;
|
|||||||
/* sorting direction by date and time, resp. */
|
/* sorting direction by date and time, resp. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int CompareRems(int dat1, int tim1, int prio1,
|
||||||
PUBLIC int CompareRems(int dat1, int tim1, int prio1,
|
int dat2, int tim2, int prio2,
|
||||||
int dat2, int tim2, int prio2,
|
int bydate, int bytime, int byprio)
|
||||||
int bydate, int bytime, int byprio)
|
|
||||||
#else
|
|
||||||
int CompareRems(dat1, tim1, prio1, dat2, tim2, prio2, bydate, bytime, byprio)
|
|
||||||
int dat1, tim1, prio1, dat2, tim2, prio2, bydate, bytime, byprio;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int dafter, tafter, pafter;
|
int dafter, tafter, pafter;
|
||||||
|
|
||||||
|
|||||||
124
src/token.c
124
src/token.c
@@ -7,25 +7,17 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: token.c,v 1.8 1999-04-05 17:34:57 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
@@ -42,70 +34,69 @@ while (isdigit(*(string))) { \
|
|||||||
string++; \
|
string++; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UPPER(c) (islower(c) ? toupper(c) : c)
|
|
||||||
|
|
||||||
/* The big array holding all recognized (literal) tokens in reminder file.
|
/* The big array holding all recognized (literal) tokens in reminder file.
|
||||||
Keep this array sorted, or software will not work. */
|
Keep this array sorted, or software will not work. */
|
||||||
Token TokArray[] = {
|
Token TokArray[] = {
|
||||||
/* NAME MINLEN TYPE VALUE */
|
/* NAME MINLEN TYPE VALUE */
|
||||||
|
|
||||||
{ "after", 3, T_Skip, AFTER_SKIP },
|
{ "after", 3, T_Skip, AFTER_SKIP },
|
||||||
{ "april", 3, T_Month, 3 },
|
{ "april", 3, T_Month, 3 },
|
||||||
{ "at", 2, T_At, 0 },
|
{ "at", 2, T_At, 0 },
|
||||||
{ "august", 3, T_Month, 7 },
|
{ "august", 3, T_Month, 7 },
|
||||||
{ "banner", 3, T_Banner, 0 },
|
{ "banner", 3, T_Banner, 0 },
|
||||||
{ "before", 3, T_Skip, BEFORE_SKIP },
|
{ "before", 3, T_Skip, BEFORE_SKIP },
|
||||||
{ "cal", 3, T_RemType, CAL_TYPE },
|
{ "cal", 3, T_RemType, CAL_TYPE },
|
||||||
{ "clear-omit-context", 5, T_Clr, 0 },
|
{ "clear-omit-context", 5, T_Clr, 0 },
|
||||||
{ "debug", 5, T_Debug, 0 },
|
{ "debug", 5, T_Debug, 0 },
|
||||||
{ "december", 3, T_Month, 11 },
|
{ "december", 3, T_Month, 11 },
|
||||||
{ "dumpvars", 4, T_Dumpvars, 0 },
|
{ "dumpvars", 4, T_Dumpvars, 0 },
|
||||||
{ "duration", 3, T_Duration, 0 },
|
{ "duration", 3, T_Duration, 0 },
|
||||||
{ "else", 4, T_Else, 0 },
|
{ "else", 4, T_Else, 0 },
|
||||||
{ "endif", 5, T_EndIf, 0 },
|
{ "endif", 5, T_EndIf, 0 },
|
||||||
{ "errmsg", 6, T_ErrMsg, 0 },
|
{ "errmsg", 6, T_ErrMsg, 0 },
|
||||||
{ "exit", 4, T_Exit, 0 },
|
{ "exit", 4, T_Exit, 0 },
|
||||||
{ "february", 3, T_Month, 1 },
|
{ "february", 3, T_Month, 1 },
|
||||||
{ "flush", 5, T_Flush, 0 },
|
{ "flush", 5, T_Flush, 0 },
|
||||||
{ "friday", 3, T_WkDay, 4 },
|
{ "friday", 3, T_WkDay, 4 },
|
||||||
|
{ "from", 4, T_Scanfrom, FROM_TYPE },
|
||||||
{ "fset", 4, T_Fset, 0 },
|
{ "fset", 4, T_Fset, 0 },
|
||||||
{ "if", 2, T_If, 0 },
|
{ "if", 2, T_If, 0 },
|
||||||
{ "iftrig", 6, T_IfTrig, 0 },
|
{ "iftrig", 6, T_IfTrig, 0 },
|
||||||
{ "include", 3, T_Include, 0 },
|
{ "include", 3, T_Include, 0 },
|
||||||
{ "january", 3, T_Month, 0 },
|
{ "january", 3, T_Month, 0 },
|
||||||
{ "july", 3, T_Month, 6 },
|
{ "july", 3, T_Month, 6 },
|
||||||
{ "june", 3, T_Month, 5 },
|
{ "june", 3, T_Month, 5 },
|
||||||
{ "march", 3, T_Month, 2 },
|
{ "march", 3, T_Month, 2 },
|
||||||
{ "may", 3, T_Month, 4 },
|
{ "may", 3, T_Month, 4 },
|
||||||
{ "monday", 3, T_WkDay, 0 },
|
{ "monday", 3, T_WkDay, 0 },
|
||||||
{ "msf", 3, T_RemType, MSF_TYPE },
|
{ "msf", 3, T_RemType, MSF_TYPE },
|
||||||
{ "msg", 3, T_RemType, MSG_TYPE },
|
{ "msg", 3, T_RemType, MSG_TYPE },
|
||||||
{ "november", 3, T_Month, 10 },
|
{ "november", 3, T_Month, 10 },
|
||||||
{ "october", 3, T_Month, 9 },
|
{ "october", 3, T_Month, 9 },
|
||||||
{ "omit", 3, T_Omit, 0 },
|
{ "omit", 3, T_Omit, 0 },
|
||||||
{ "once", 3, T_Once, 0 },
|
{ "once", 3, T_Once, 0 },
|
||||||
{ "pop-omit-context", 3, T_Pop, 0 },
|
{ "pop-omit-context", 3, T_Pop, 0 },
|
||||||
{ "preserve", 8, T_Preserve, 0 },
|
{ "preserve", 8, T_Preserve, 0 },
|
||||||
{ "priority", 8, T_Priority, 0 },
|
{ "priority", 8, T_Priority, 0 },
|
||||||
{ "ps", 2, T_RemType, PS_TYPE },
|
{ "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 },
|
{ "push-omit-context", 4, T_Push, 0 },
|
||||||
{ "rem", 3, T_Rem, 0 },
|
{ "rem", 3, T_Rem, 0 },
|
||||||
{ "run", 3, T_RemType, RUN_TYPE },
|
{ "run", 3, T_RemType, RUN_TYPE },
|
||||||
{ "satisfy", 7, T_RemType, SAT_TYPE },
|
{ "satisfy", 7, T_RemType, SAT_TYPE },
|
||||||
{ "saturday", 3, T_WkDay, 5 },
|
{ "saturday", 3, T_WkDay, 5 },
|
||||||
{ "scanfrom", 4, T_Scanfrom, 0 },
|
{ "scanfrom", 4, T_Scanfrom, SCANFROM_TYPE },
|
||||||
{ "sched", 5, T_Sched, 0 },
|
{ "sched", 5, T_Sched, 0 },
|
||||||
{ "september", 3, T_Month, 8 },
|
{ "september", 3, T_Month, 8 },
|
||||||
{ "set", 3, T_Set, 0 },
|
{ "set", 3, T_Set, 0 },
|
||||||
{ "skip", 3, T_Skip, SKIP_SKIP },
|
{ "skip", 3, T_Skip, SKIP_SKIP },
|
||||||
{ "special", 7, T_RemType, PASSTHRU_TYPE },
|
{ "special", 7, T_RemType, PASSTHRU_TYPE },
|
||||||
{ "sunday", 3, T_WkDay, 6 },
|
{ "sunday", 3, T_WkDay, 6 },
|
||||||
{ "tag", 3, T_Tag, 0 },
|
{ "tag", 3, T_Tag, 0 },
|
||||||
{ "thursday", 3, T_WkDay, 3 },
|
{ "thursday", 3, T_WkDay, 3 },
|
||||||
{ "tuesday", 3, T_WkDay, 1 },
|
{ "tuesday", 3, T_WkDay, 1 },
|
||||||
{ "unset", 5, T_UnSet, 0 },
|
{ "unset", 5, T_UnSet, 0 },
|
||||||
{ "until", 3, T_Until, 0 },
|
{ "until", 3, T_Until, 0 },
|
||||||
{ "warn", 4, T_Warn, 0 },
|
{ "warn", 4, T_Warn, 0 },
|
||||||
{ "wednesday", 3, T_WkDay, 2 }
|
{ "wednesday", 3, T_WkDay, 2 }
|
||||||
};
|
};
|
||||||
@@ -137,7 +128,7 @@ Token NonEnglishToks[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRIVATE int TokStrCmp ARGS((const Token *t, const char *s));
|
static int TokStrCmp (Token const *t, char const *s);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -147,13 +138,7 @@ PRIVATE int TokStrCmp ARGS((const Token *t, const char *s));
|
|||||||
/* left square bracket, return a T_Illegal type. */
|
/* left square bracket, return a T_Illegal type. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
char const *FindInitialToken(Token *tok, char const *s)
|
||||||
PUBLIC char *FindInitialToken(Token *tok, char *s)
|
|
||||||
#else
|
|
||||||
char *FindInitialToken(tok, s)
|
|
||||||
Token *tok;
|
|
||||||
char *s;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DynamicBuffer buf;
|
DynamicBuffer buf;
|
||||||
DBufInit(&buf);
|
DBufInit(&buf);
|
||||||
@@ -171,7 +156,7 @@ char *s;
|
|||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -180,15 +165,9 @@ char *s;
|
|||||||
/* Given a string, which token is it? */
|
/* Given a string, which token is it? */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void FindToken(char const *s, Token *tok)
|
||||||
PUBLIC void FindToken(const char *s, Token *tok)
|
|
||||||
#else
|
|
||||||
void FindToken(s, tok)
|
|
||||||
char *s;
|
|
||||||
Token *tok;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int top, bot, mid, r;
|
int top, bot, mid, r, max;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
tok->type = T_Illegal;
|
tok->type = T_Illegal;
|
||||||
@@ -196,7 +175,7 @@ Token *tok;
|
|||||||
tok->type = T_Empty;
|
tok->type = T_Empty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*s == '#' || *s == ';') {
|
if (*s == '#' || *s == ';') {
|
||||||
tok->type = T_Comment;
|
tok->type = T_Comment;
|
||||||
return;
|
return;
|
||||||
@@ -216,6 +195,7 @@ Token *tok;
|
|||||||
}
|
}
|
||||||
bot = 0;
|
bot = 0;
|
||||||
top = sizeof(TokArray) / sizeof(TokArray[0]) - 1;
|
top = sizeof(TokArray) / sizeof(TokArray[0]) - 1;
|
||||||
|
max = sizeof(TokArray) / sizeof(TokArray[0]);
|
||||||
|
|
||||||
while(top >= bot) {
|
while(top >= bot) {
|
||||||
mid = (top + bot) / 2;
|
mid = (top + bot) / 2;
|
||||||
@@ -227,9 +207,13 @@ Token *tok;
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
while (mid && !TokStrCmp(&TokArray[mid-1],s)) mid--;
|
while (mid && !TokStrCmp(&TokArray[mid-1],s)) mid--;
|
||||||
while (!TokStrCmp(&TokArray[mid], s) && l < TokArray[mid].MinLen)
|
while (mid < max &&
|
||||||
|
!TokStrCmp(&TokArray[mid], s) &&
|
||||||
|
l < TokArray[mid].MinLen) {
|
||||||
mid++;
|
mid++;
|
||||||
if (!TokStrCmp(&TokArray[mid], s)) {
|
}
|
||||||
|
if (mid < max &&
|
||||||
|
!TokStrCmp(&TokArray[mid], s)) {
|
||||||
tok->type = TokArray[mid].type;
|
tok->type = TokArray[mid].type;
|
||||||
tok->val = TokArray[mid].val;
|
tok->val = TokArray[mid].val;
|
||||||
return;
|
return;
|
||||||
@@ -244,7 +228,7 @@ Token *tok;
|
|||||||
array. */
|
array. */
|
||||||
#if LANG != ENGLISH
|
#if LANG != ENGLISH
|
||||||
for (r=0; r<(sizeof(NonEnglishToks) / sizeof(Token)); r++) {
|
for (r=0; r<(sizeof(NonEnglishToks) / sizeof(Token)); r++) {
|
||||||
if (l >= NonEnglishToks[r].MinLen &&
|
if (l >= NonEnglishToks[r].MinLen &&
|
||||||
!TokStrCmp(&NonEnglishToks[r], s)) {
|
!TokStrCmp(&NonEnglishToks[r], s)) {
|
||||||
tok->type = NonEnglishToks[r].type;
|
tok->type = NonEnglishToks[r].type;
|
||||||
tok->val = NonEnglishToks[r].val;
|
tok->val = NonEnglishToks[r].val;
|
||||||
@@ -252,7 +236,7 @@ Token *tok;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,13 +252,7 @@ Token *tok;
|
|||||||
/* Rep - *n */
|
/* Rep - *n */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void FindNumericToken(char const *s, Token *t)
|
||||||
PUBLIC void FindNumericToken(const char *s, Token *t)
|
|
||||||
#else
|
|
||||||
void FindNumericToken(s, t)
|
|
||||||
char *s;
|
|
||||||
Token *t;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int mult = 1, hour, min;
|
int mult = 1, hour, min;
|
||||||
|
|
||||||
@@ -298,13 +276,17 @@ Token *t;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* If we hit a colon or a period, we've probably got a time hr:min */
|
/* If we hit a colon or a period, we've probably got a time hr:min */
|
||||||
if (*s == ':' || *s == '.' || *s == TIMESEP) {
|
if (*s == ':' || *s == '.' || *s == TimeSep) {
|
||||||
s++;
|
s++;
|
||||||
hour = t->val;
|
hour = t->val;
|
||||||
PARSENUM(min, s);
|
PARSENUM(min, s);
|
||||||
if (*s || hour > 23 || min > 59) return; /* Illegal time */
|
if (*s || min > 59) return; /* Illegal time */
|
||||||
t->val = hour*60 + min; /* Convert to minutes past midnight */
|
t->val = hour*60 + min; /* Convert to minutes past midnight */
|
||||||
t->type = T_Time;
|
if (hour <= 23) {
|
||||||
|
t->type = T_Time;
|
||||||
|
} else {
|
||||||
|
t->type = T_LongTime;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,18 +335,12 @@ Token *t;
|
|||||||
/* Compare a token to a string. */
|
/* Compare a token to a string. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int TokStrCmp(Token const *t, char const *s)
|
||||||
PRIVATE int TokStrCmp(const Token *t, const char *s)
|
|
||||||
#else
|
|
||||||
static int TokStrCmp(t, s)
|
|
||||||
Token *t;
|
|
||||||
char *s;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int r;
|
register int r;
|
||||||
char *tk = t->name;
|
char const *tk = t->name;
|
||||||
while(*tk && *s && !(*s == ',' && *(s+1) == 0)) {
|
while(*tk && *s && !(*s == ',' && *(s+1) == 0)) {
|
||||||
r = UPPER(*tk) - UPPER(*s);
|
r = *tk - tolower(*s);
|
||||||
tk++;
|
tk++;
|
||||||
s++;
|
s++;
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
|
|||||||
@@ -6,23 +6,14 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: trigger.c,v 1.4 1999-04-05 17:34:57 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
@@ -34,10 +25,10 @@ static char const RCSID[] = "$Id: trigger.c,v 1.4 1999-04-05 17:34:57 dfs Exp $"
|
|||||||
#define GOT_YR 4
|
#define GOT_YR 4
|
||||||
#define GOT_WD 8
|
#define GOT_WD 8
|
||||||
|
|
||||||
static int JYear ARGS((int jul));
|
static int JYear(int jul);
|
||||||
static int JMonth ARGS((int jul));
|
static int JMonth(int jul);
|
||||||
static int NextSimpleTrig ARGS((int startdate, Trigger *trig, int *err));
|
static int NextSimpleTrig(int startdate, Trigger *trig, int *err);
|
||||||
static int GetNextTriggerDate ARGS((Trigger *trig, int start, int *err, int *nextstart));
|
static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -51,14 +42,7 @@ static int GetNextTriggerDate ARGS((Trigger *trig, int start, int *err, int *nex
|
|||||||
/* so that dates with a REP can be handled properly. */
|
/* so that dates with a REP can be handled properly. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
|
||||||
PRIVATE int NextSimpleTrig(int startdate, Trigger *trig, int *err)
|
|
||||||
#else
|
|
||||||
static int NextSimpleTrig(startdate, trig, err)
|
|
||||||
int startdate;
|
|
||||||
Trigger *trig;
|
|
||||||
int *err;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int typ = 0;
|
int typ = 0;
|
||||||
int d, m, y, j, d2, m2, y2;
|
int d, m, y, j, d2, m2, y2;
|
||||||
@@ -271,12 +255,7 @@ int *err;
|
|||||||
/* JMonth - Given a Julian date, what's the month? */
|
/* JMonth - Given a Julian date, what's the month? */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int JMonth(int jul)
|
||||||
PRIVATE int JMonth(int jul)
|
|
||||||
#else
|
|
||||||
static int JMonth(jul)
|
|
||||||
int jul;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
FromJulian(jul, &y, &m, &d);
|
FromJulian(jul, &y, &m, &d);
|
||||||
@@ -288,12 +267,7 @@ int jul;
|
|||||||
/* JYear - Given a Julian date, what's the year? */
|
/* JYear - Given a Julian date, what's the year? */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int JYear(int jul)
|
||||||
PRIVATE int JYear(int jul)
|
|
||||||
#else
|
|
||||||
static int JYear(jul)
|
|
||||||
int jul;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int y, m, d;
|
int y, m, d;
|
||||||
FromJulian(jul, &y, &m, &d);
|
FromJulian(jul, &y, &m, &d);
|
||||||
@@ -310,15 +284,7 @@ int jul;
|
|||||||
/* expired, -2 if can't compute trigger date. */
|
/* expired, -2 if can't compute trigger date. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart)
|
||||||
PRIVATE int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart)
|
|
||||||
#else
|
|
||||||
static int GetNextTriggerDate(trig, start, err, nextstart)
|
|
||||||
Trigger *trig;
|
|
||||||
int start;
|
|
||||||
int *err;
|
|
||||||
int *nextstart;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int simple, mod;
|
int simple, mod;
|
||||||
|
|
||||||
@@ -380,22 +346,16 @@ int *nextstart;
|
|||||||
/* today's date. */
|
/* today's date. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int ComputeTrigger(int today, Trigger *trig, int *err)
|
||||||
PUBLIC int ComputeTrigger(int today, Trigger *trig, int *err)
|
|
||||||
#else
|
|
||||||
int ComputeTrigger(today, trig, err)
|
|
||||||
int today;
|
|
||||||
Trigger *trig;
|
|
||||||
int *err;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int nattempts = 0,
|
int nattempts = 0,
|
||||||
start = today,
|
start = today,
|
||||||
nextstart,
|
nextstart = 0,
|
||||||
y, m, d,
|
y, m, d,
|
||||||
result;
|
result;
|
||||||
|
|
||||||
LastTrigValid = 0;
|
LastTrigValid = 0;
|
||||||
|
|
||||||
/* Assume everything works */
|
/* Assume everything works */
|
||||||
*err = OK;
|
*err = OK;
|
||||||
|
|
||||||
@@ -459,6 +419,14 @@ int *err;
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trig->skip == SKIP_SKIP &&
|
||||||
|
IsOmitted(result, trig->localomit) &&
|
||||||
|
nextstart <= start &&
|
||||||
|
result >= start) {
|
||||||
|
nextstart = result + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Keep scanning... unless there's no point in doing it.*/
|
/* Keep scanning... unless there's no point in doing it.*/
|
||||||
if (nextstart <= start) {
|
if (nextstart <= start) {
|
||||||
if (result != -1) {
|
if (result != -1) {
|
||||||
|
|||||||
50
src/types.h
50
src/types.h
@@ -6,12 +6,11 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/* $Id: types.h,v 1.4 1999-04-05 17:34:58 dfs Exp $ */
|
#include <limits.h>
|
||||||
|
|
||||||
#include "dynbuf.h"
|
#include "dynbuf.h"
|
||||||
|
|
||||||
/* Values */
|
/* Values */
|
||||||
@@ -25,14 +24,10 @@ typedef struct {
|
|||||||
|
|
||||||
/* Define the type of operators */
|
/* Define the type of operators */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char const *name;
|
||||||
char prec;
|
char prec;
|
||||||
char type;
|
char type;
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
int (*func)(void);
|
int (*func)(void);
|
||||||
#else
|
|
||||||
int (*func) ();
|
|
||||||
#endif
|
|
||||||
} Operator;
|
} Operator;
|
||||||
|
|
||||||
/* Define the structure of a variable */
|
/* Define the structure of a variable */
|
||||||
@@ -76,14 +71,15 @@ typedef struct {
|
|||||||
|
|
||||||
/* The parse pointer */
|
/* The parse pointer */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char isnested; /* Is it a nested expression? */
|
char isnested; /* Is it a nested expression? */
|
||||||
char allownested;
|
char allownested;
|
||||||
char *text; /* Start of text */
|
char const *text; /* Start of text */
|
||||||
char *pos; /* Current position */
|
char const *pos; /* Current position */
|
||||||
char *etext; /* Substituted text */
|
char const *etext; /* Substituted text */
|
||||||
char *epos; /* Position in substituted text */
|
char const *epos; /* Position in substituted text */
|
||||||
DynamicBuffer pushedToken; /* Pushed-back token */
|
DynamicBuffer pushedToken; /* Pushed-back token */
|
||||||
char *tokenPushed; /* NULL if no pushed-back token */
|
char const *tokenPushed; /* NULL if no pushed-back token */
|
||||||
|
char expr_happened; /* Did we encounter an [expression] ? */
|
||||||
} Parser;
|
} Parser;
|
||||||
|
|
||||||
typedef Parser *ParsePtr; /* Pointer to parser structure */
|
typedef Parser *ParsePtr; /* Pointer to parser structure */
|
||||||
@@ -105,7 +101,7 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
|
|||||||
#define BEFORE_SKIP 2
|
#define BEFORE_SKIP 2
|
||||||
#define AFTER_SKIP 3
|
#define AFTER_SKIP 3
|
||||||
|
|
||||||
#define NO_TIME 1500 /* >1440, ie > than the largest possible legal time */
|
#define NO_TIME INT_MAX
|
||||||
|
|
||||||
#define NO_PRIORITY 5000 /* Default priority is midway between 0 and 9999 */
|
#define NO_PRIORITY 5000 /* Default priority is midway between 0 and 9999 */
|
||||||
|
|
||||||
@@ -121,11 +117,12 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
|
|||||||
|
|
||||||
|
|
||||||
/* DEFINES for debugging flags */
|
/* DEFINES for debugging flags */
|
||||||
#define DB_PRTLINE 1
|
#define DB_PRTLINE 1
|
||||||
#define DB_PRTEXPR 2
|
#define DB_PRTEXPR 2
|
||||||
#define DB_PRTTRIG 4
|
#define DB_PRTTRIG 4
|
||||||
#define DB_DUMP_VARS 8
|
#define DB_DUMP_VARS 8
|
||||||
#define DB_ECHO_LINE 16
|
#define DB_ECHO_LINE 16
|
||||||
|
#define DB_TRACE_FILES 32
|
||||||
|
|
||||||
/* Enumeration of the tokens */
|
/* Enumeration of the tokens */
|
||||||
enum TokTypes
|
enum TokTypes
|
||||||
@@ -150,7 +147,8 @@ enum TokTypes
|
|||||||
T_Sched,
|
T_Sched,
|
||||||
T_Warn,
|
T_Warn,
|
||||||
T_Tag,
|
T_Tag,
|
||||||
T_Duration
|
T_Duration,
|
||||||
|
T_LongTime
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The structure of a token */
|
/* The structure of a token */
|
||||||
@@ -171,8 +169,10 @@ typedef struct {
|
|||||||
#define IF_ELSE_MASK 2
|
#define IF_ELSE_MASK 2
|
||||||
|
|
||||||
/* Flags for the DoSubst function */
|
/* Flags for the DoSubst function */
|
||||||
#define NORMAL_MODE 0
|
#define NORMAL_MODE 0
|
||||||
#define CAL_MODE 1
|
#define CAL_MODE 1
|
||||||
|
#define ADVANCE_MODE 2
|
||||||
|
|
||||||
#define QUOTE_MARKER 1 /* Unlikely character to appear in reminder */
|
#define QUOTE_MARKER 1 /* Unlikely character to appear in reminder */
|
||||||
|
|
||||||
/* Flags for disabling run */
|
/* Flags for disabling run */
|
||||||
@@ -189,3 +189,7 @@ typedef struct {
|
|||||||
#define SORT_NONE 0
|
#define SORT_NONE 0
|
||||||
#define SORT_ASCEND 1
|
#define SORT_ASCEND 1
|
||||||
#define SORT_DESCEND 2
|
#define SORT_DESCEND 2
|
||||||
|
|
||||||
|
/* Flags for FROM / SCANFROM */
|
||||||
|
#define SCANFROM_TYPE 0
|
||||||
|
#define FROM_TYPE 1
|
||||||
|
|||||||
@@ -7,24 +7,16 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: userfns.c,v 1.5 1999-04-05 17:34:59 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
@@ -37,7 +29,7 @@ static char const RCSID[] = "$Id: userfns.c,v 1.5 1999-04-05 17:34:59 dfs Exp $"
|
|||||||
typedef struct udf_struct {
|
typedef struct udf_struct {
|
||||||
struct udf_struct *next;
|
struct udf_struct *next;
|
||||||
char name[VAR_NAME_LEN+1];
|
char name[VAR_NAME_LEN+1];
|
||||||
char *text;
|
char const *text;
|
||||||
Var *locals;
|
Var *locals;
|
||||||
char IsActive;
|
char IsActive;
|
||||||
int nargs;
|
int nargs;
|
||||||
@@ -54,11 +46,11 @@ extern Operator Func[];
|
|||||||
extern Value ValStack[];
|
extern Value ValStack[];
|
||||||
extern int ValStackPtr;
|
extern int ValStackPtr;
|
||||||
|
|
||||||
PRIVATE void DestroyUserFunc ARGS ((UserFunc *f));
|
static void DestroyUserFunc (UserFunc *f);
|
||||||
PRIVATE void FUnset ARGS ((char *name));
|
static void FUnset (char const *name);
|
||||||
PRIVATE void FSet ARGS ((UserFunc *f));
|
static void FSet (UserFunc *f);
|
||||||
PRIVATE int SetUpLocalVars ARGS ((UserFunc *f));
|
static int SetUpLocalVars (UserFunc *f);
|
||||||
PRIVATE void DestroyLocalVals ARGS ((UserFunc *f));
|
static void DestroyLocalVals (UserFunc *f);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -67,12 +59,7 @@ PRIVATE void DestroyLocalVals ARGS ((UserFunc *f));
|
|||||||
/* Define a user-defined function - the FSET command. */
|
/* Define a user-defined function - the FSET command. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoFset(ParsePtr p)
|
||||||
PUBLIC int DoFset(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoFset(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
int c;
|
int c;
|
||||||
@@ -155,6 +142,11 @@ ParsePtr p;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allow an optional = sign: FSET f(x) = x*x */
|
||||||
|
c = ParseNonSpaceChar(p, &r, 1);
|
||||||
|
if (c == '=') {
|
||||||
|
c = ParseNonSpaceChar(p, &r, 0);
|
||||||
|
}
|
||||||
/* Copy the text over */
|
/* Copy the text over */
|
||||||
if (p->isnested) {
|
if (p->isnested) {
|
||||||
Eprint("%s", ErrMsg[E_CANTNEST_FDEF]);
|
Eprint("%s", ErrMsg[E_CANTNEST_FDEF]);
|
||||||
@@ -183,12 +175,7 @@ ParsePtr p;
|
|||||||
/* Free up all the resources used by a user-defined function. */
|
/* Free up all the resources used by a user-defined function. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void DestroyUserFunc(UserFunc *f)
|
||||||
PRIVATE void DestroyUserFunc(UserFunc *f)
|
|
||||||
#else
|
|
||||||
static void DestroyUserFunc(f)
|
|
||||||
UserFunc *f;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Var *v, *prev;
|
Var *v, *prev;
|
||||||
|
|
||||||
@@ -202,7 +189,7 @@ UserFunc *f;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Free the function definition */
|
/* Free the function definition */
|
||||||
if (f->text) free(f->text);
|
if (f->text) free( (char *) f->text);
|
||||||
|
|
||||||
/* Free the data structure itself */
|
/* Free the data structure itself */
|
||||||
free(f);
|
free(f);
|
||||||
@@ -216,12 +203,7 @@ UserFunc *f;
|
|||||||
/* it exists. */
|
/* it exists. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void FUnset(char const *name)
|
||||||
PRIVATE void FUnset(char *name)
|
|
||||||
#else
|
|
||||||
static void FUnset(name)
|
|
||||||
char *name;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
UserFunc *cur, *prev;
|
UserFunc *cur, *prev;
|
||||||
int h;
|
int h;
|
||||||
@@ -247,12 +229,7 @@ char *name;
|
|||||||
/* Insert a user-defined function into the hash table. */
|
/* Insert a user-defined function into the hash table. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void FSet(UserFunc *f)
|
||||||
PRIVATE void FSet(UserFunc *f)
|
|
||||||
#else
|
|
||||||
static void FSet(f)
|
|
||||||
UserFunc *f;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int h = HashVal(f->name) % FUNC_HASH_SIZE;
|
int h = HashVal(f->name) % FUNC_HASH_SIZE;
|
||||||
f->next = FuncHash[h];
|
f->next = FuncHash[h];
|
||||||
@@ -266,18 +243,12 @@ UserFunc *f;
|
|||||||
/* Call a user-defined function. */
|
/* Call a user-defined function. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int CallUserFunc(char const *name, int nargs)
|
||||||
PUBLIC int CallUserFunc(char *name, int nargs)
|
|
||||||
#else
|
|
||||||
int CallUserFunc(name, nargs)
|
|
||||||
char *name;
|
|
||||||
int nargs;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
UserFunc *f;
|
UserFunc *f;
|
||||||
int h = HashVal(name) % FUNC_HASH_SIZE;
|
int h = HashVal(name) % FUNC_HASH_SIZE;
|
||||||
int i;
|
int i;
|
||||||
char *s;
|
char const *s;
|
||||||
|
|
||||||
/* Search for the function */
|
/* Search for the function */
|
||||||
f = FuncHash[h];
|
f = FuncHash[h];
|
||||||
@@ -351,12 +322,7 @@ int nargs;
|
|||||||
/* Set up the local variables from the stack frame. */
|
/* Set up the local variables from the stack frame. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static int SetUpLocalVars(UserFunc *f)
|
||||||
PRIVATE int SetUpLocalVars(UserFunc *f)
|
|
||||||
#else
|
|
||||||
static int SetUpLocalVars(f)
|
|
||||||
UserFunc *f;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i, r;
|
int i, r;
|
||||||
Var *var;
|
Var *var;
|
||||||
@@ -378,12 +344,7 @@ UserFunc *f;
|
|||||||
/* the function. */
|
/* the function. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void DestroyLocalVals(UserFunc *f)
|
||||||
PRIVATE void DestroyLocalVals(UserFunc *f)
|
|
||||||
#else
|
|
||||||
static void DestroyLocalVals(f)
|
|
||||||
UserFunc *f;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Var *v = f->locals;
|
Var *v = f->locals;
|
||||||
|
|
||||||
@@ -400,12 +361,7 @@ UserFunc *f;
|
|||||||
/* it is defined, or -1 if it is not defined. */
|
/* it is defined, or -1 if it is not defined. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int UserFuncExists(char const *fn)
|
||||||
PUBLIC int UserFuncExists(char *fn)
|
|
||||||
#else
|
|
||||||
int UserFuncExists(fn)
|
|
||||||
char *fn;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
UserFunc *f;
|
UserFunc *f;
|
||||||
int h = HashVal(fn) % FUNC_HASH_SIZE;
|
int h = HashVal(fn) % FUNC_HASH_SIZE;
|
||||||
|
|||||||
111
src/utils.c
111
src/utils.c
@@ -6,30 +6,22 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: utils.c,v 1.4 1999-04-05 17:34:59 dfs Exp $";
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#define UPPER(c) (islower(c) ? toupper(c) : c)
|
#define UPPER(c) toupper(c)
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
@@ -38,15 +30,9 @@ static char const RCSID[] = "$Id: utils.c,v 1.4 1999-04-05 17:34:59 dfs Exp $";
|
|||||||
/* Just like strncpy EXCEPT we ALWAYS copy the trailing 0. */
|
/* Just like strncpy EXCEPT we ALWAYS copy the trailing 0. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
char *StrnCpy(char *dest, char const *source, int n)
|
||||||
PUBLIC char *StrnCpy(char *dest, const char *source, int n)
|
|
||||||
#else
|
|
||||||
char *StrnCpy(dest, source, n)
|
|
||||||
char *dest, *source;
|
|
||||||
int n;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register char *odest = dest;
|
char *odest = dest;
|
||||||
|
|
||||||
while (n-- && (*dest++ = *source++)) ;
|
while (n-- && (*dest++ = *source++)) ;
|
||||||
if (*(dest-1)) *dest = 0;
|
if (*(dest-1)) *dest = 0;
|
||||||
@@ -62,13 +48,7 @@ int n;
|
|||||||
/* of the first string, whichever is greater. */
|
/* of the first string, whichever is greater. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int StrMatch(char const *s1, char const *s2, int n)
|
||||||
PUBLIC int StrMatch(const char *s1, const char *s2, int n)
|
|
||||||
#else
|
|
||||||
int StrMatch(s1, s2, n)
|
|
||||||
char *s1, *s2;
|
|
||||||
int n;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
if ((l = strlen(s1)) < n) return 0;
|
if ((l = strlen(s1)) < n) return 0;
|
||||||
@@ -80,13 +60,7 @@ int n;
|
|||||||
/* StrinCmp - compare strings, case-insensitive */
|
/* StrinCmp - compare strings, case-insensitive */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int StrinCmp(char const *s1, char const *s2, int n)
|
||||||
PUBLIC int StrinCmp(const char *s1, const char *s2, int n)
|
|
||||||
#else
|
|
||||||
int StrinCmp(s1, s2, n)
|
|
||||||
char *s1, *s2;
|
|
||||||
int n;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int r;
|
register int r;
|
||||||
while (n && *s1 && *s2) {
|
while (n && *s1 && *s2) {
|
||||||
@@ -106,15 +80,10 @@ int n;
|
|||||||
/* Like ANSI strdup */
|
/* Like ANSI strdup */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
char *StrDup(char const *s)
|
||||||
PUBLIC char *StrDup(const char *s)
|
|
||||||
#else
|
|
||||||
char *StrDup(s)
|
|
||||||
char *s;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *ret = (char *) malloc(strlen(s)+1);
|
char *ret = malloc(strlen(s)+1);
|
||||||
if (!ret) return (char *) NULL;
|
if (!ret) return NULL;
|
||||||
strcpy(ret, s);
|
strcpy(ret, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -126,12 +95,7 @@ char *s;
|
|||||||
/* Compare strings, case insensitive. */
|
/* Compare strings, case insensitive. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int StrCmpi(char const *s1, char const *s2)
|
||||||
PUBLIC int StrCmpi(const char *s1, const char *s2)
|
|
||||||
#else
|
|
||||||
int StrCmpi(s1, s2)
|
|
||||||
char *s1, *s2;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
while (*s1 && *s2) {
|
while (*s1 && *s2) {
|
||||||
@@ -143,26 +107,6 @@ char *s1, *s2;
|
|||||||
return UPPER(*s1) - UPPER(*s2);
|
return UPPER(*s1) - UPPER(*s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_STRSTR
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PUBLIC char *strstr(char *s1, char *s2)
|
|
||||||
#else
|
|
||||||
char *strstr(s1, s2)
|
|
||||||
char *s1, *s2;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
char *s = s1;
|
|
||||||
int len2 = strlen(s2);
|
|
||||||
int len1 = strlen(s1);
|
|
||||||
|
|
||||||
while (s-s1 <= len1-len2) {
|
|
||||||
if (!strncmp(s, s2, len2)) return s;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* DateOK */
|
/* DateOK */
|
||||||
@@ -170,12 +114,7 @@ char *s1, *s2;
|
|||||||
/* Return 1 if the date is OK, 0 otherwise. */
|
/* Return 1 if the date is OK, 0 otherwise. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DateOK(int y, int m, int d)
|
||||||
PUBLIC int DateOK(int y, int m, int d)
|
|
||||||
#else
|
|
||||||
int DateOK(y, m, d)
|
|
||||||
int y, m, d;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (d < 1 ||
|
if (d < 1 ||
|
||||||
m < 0 ||
|
m < 0 ||
|
||||||
@@ -185,31 +124,3 @@ int y, m, d;
|
|||||||
d > DaysInMonth(m, y) ) return 0;
|
d > DaysInMonth(m, y) ) return 0;
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BROKEN_PUTC
|
|
||||||
/***************************************************************/
|
|
||||||
/* */
|
|
||||||
/* Safe versions of putc and putchar */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PUBLIC int SafePutChar(int c)
|
|
||||||
#else
|
|
||||||
int SafePutChar(c)
|
|
||||||
int c;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return putchar(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_PROTOS
|
|
||||||
PUBLIC int SafePutc(int c, FILE *fp)
|
|
||||||
#else
|
|
||||||
int SafePutc(c, fp)
|
|
||||||
int c;
|
|
||||||
FILE *fp;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
return putc(c, fp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
242
src/var.c
242
src/var.c
@@ -7,25 +7,17 @@
|
|||||||
/* */
|
/* */
|
||||||
/* This file is part of REMIND. */
|
/* This file is part of REMIND. */
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
/* Copyright (C) 1992-1998 by David F. Skoll */
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
static char const RCSID[] = "$Id: var.c,v 1.6 1999-04-05 17:34:59 dfs Exp $";
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
@@ -42,18 +34,53 @@ static char const RCSID[] = "$Id: var.c,v 1.6 1999-04-05 17:34:59 dfs Exp $";
|
|||||||
|
|
||||||
static Var *VHashTbl[VAR_HASH_SIZE];
|
static Var *VHashTbl[VAR_HASH_SIZE];
|
||||||
|
|
||||||
|
typedef int (*SysVarFunc)(int, Value *);
|
||||||
|
|
||||||
|
static int date_sep_func(int do_set, Value *val)
|
||||||
|
{
|
||||||
|
if (!do_set) {
|
||||||
|
val->v.str = malloc(2);
|
||||||
|
if (!val->v.str) return E_NO_MEM;
|
||||||
|
val->v.str[0] = DateSep;
|
||||||
|
val->v.str[1] = 0;
|
||||||
|
val->type = STR_TYPE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||||
|
if (strcmp(val->v.str, "/") &&
|
||||||
|
strcmp(val->v.str, "-")) {
|
||||||
|
return E_BAD_TYPE;
|
||||||
|
}
|
||||||
|
DateSep = val->v.str[0];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int time_sep_func(int do_set, Value *val)
|
||||||
|
{
|
||||||
|
if (!do_set) {
|
||||||
|
val->v.str = malloc(2);
|
||||||
|
if (!val->v.str) return E_NO_MEM;
|
||||||
|
val->v.str[0] = TimeSep;
|
||||||
|
val->v.str[1] = 0;
|
||||||
|
val->type = STR_TYPE;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
if (val->type != STR_TYPE) return E_BAD_TYPE;
|
||||||
|
if (strcmp(val->v.str, ":") &&
|
||||||
|
strcmp(val->v.str, ".")) {
|
||||||
|
return E_BAD_TYPE;
|
||||||
|
}
|
||||||
|
TimeSep = val->v.str[0];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* HashVal */
|
/* HashVal */
|
||||||
/* Given a string, compute the hash value. */
|
/* Given a string, compute the hash value. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
unsigned int HashVal(char const *str)
|
||||||
PUBLIC unsigned int HashVal(const char *str)
|
|
||||||
#else
|
|
||||||
unsigned int HashVal(str)
|
|
||||||
char *str;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register unsigned int i=0;
|
register unsigned int i=0;
|
||||||
register unsigned int j=1;
|
register unsigned int j=1;
|
||||||
@@ -75,13 +102,7 @@ char *str;
|
|||||||
/* string. If create is 1, create the variable. */
|
/* string. If create is 1, create the variable. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
Var *FindVar(char const *str, int create)
|
||||||
PUBLIC Var *FindVar(const char *str, int create)
|
|
||||||
#else
|
|
||||||
Var *FindVar(str, create)
|
|
||||||
char *str;
|
|
||||||
int create;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int h;
|
register int h;
|
||||||
register Var *v;
|
register Var *v;
|
||||||
@@ -118,12 +139,7 @@ int create;
|
|||||||
/* string and delete it. */
|
/* string and delete it. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DeleteVar(char const *str)
|
||||||
PUBLIC int DeleteVar(const char *str)
|
|
||||||
#else
|
|
||||||
int DeleteVar(str)
|
|
||||||
char *str;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register int h;
|
register int h;
|
||||||
register Var *v;
|
register Var *v;
|
||||||
@@ -152,13 +168,7 @@ char *str;
|
|||||||
/* Set the indicate variable to the specified value. */
|
/* Set the indicate variable to the specified value. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int SetVar(char const *str, Value *val)
|
||||||
PUBLIC int SetVar(const char *str, Value *val)
|
|
||||||
#else
|
|
||||||
int SetVar(str, val)
|
|
||||||
char *str;
|
|
||||||
Value *val;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Var *v = FindVar(str, 1);
|
Var *v = FindVar(str, 1);
|
||||||
|
|
||||||
@@ -176,14 +186,7 @@ Value *val;
|
|||||||
/* Get a copy of the value of the variable. */
|
/* Get a copy of the value of the variable. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int GetVarValue(char const *str, Value *val, Var *locals)
|
||||||
PUBLIC int GetVarValue(const char *str, Value *val, Var *locals)
|
|
||||||
#else
|
|
||||||
int GetVarValue(str, val, locals)
|
|
||||||
char *str;
|
|
||||||
Value *val;
|
|
||||||
Var *locals;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Var *v;
|
Var *v;
|
||||||
|
|
||||||
@@ -209,12 +212,7 @@ Var *locals;
|
|||||||
/* DoSet - set a variable. */
|
/* DoSet - set a variable. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoSet (Parser *p)
|
||||||
PUBLIC int DoSet (Parser *p)
|
|
||||||
#else
|
|
||||||
int DoSet (p)
|
|
||||||
Parser *p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Value v;
|
Value v;
|
||||||
int r;
|
int r;
|
||||||
@@ -225,6 +223,11 @@ Parser *p;
|
|||||||
r = ParseIdentifier(p, &buf);
|
r = ParseIdentifier(p, &buf);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
|
|
||||||
|
/* Allow option equals-sign: SET var = value */
|
||||||
|
if (ParseNonSpaceChar(p, &r, 1) == '=') {
|
||||||
|
ParseNonSpaceChar(p, &r, 0);
|
||||||
|
}
|
||||||
|
|
||||||
r = EvaluateExpr(p, &v);
|
r = EvaluateExpr(p, &v);
|
||||||
if (r) {
|
if (r) {
|
||||||
DBufFree(&buf);
|
DBufFree(&buf);
|
||||||
@@ -242,12 +245,7 @@ Parser *p;
|
|||||||
/* DoUnset - delete a bunch of variables. */
|
/* DoUnset - delete a bunch of variables. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoUnset (Parser *p)
|
||||||
PUBLIC int DoUnset (Parser *p)
|
|
||||||
#else
|
|
||||||
int DoUnset (p)
|
|
||||||
Parser *p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -282,12 +280,7 @@ Parser *p;
|
|||||||
/* Command file command to dump variable table. */
|
/* Command file command to dump variable table. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoDump(ParsePtr p)
|
||||||
PUBLIC int DoDump(ParsePtr p)
|
|
||||||
#else
|
|
||||||
int DoDump(p)
|
|
||||||
ParsePtr p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
Var *v;
|
Var *v;
|
||||||
@@ -336,11 +329,7 @@ ParsePtr p;
|
|||||||
/* Dump the variable table to stderr. */
|
/* Dump the variable table to stderr. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DumpVarTable(void)
|
||||||
PUBLIC void DumpVarTable(void)
|
|
||||||
#else
|
|
||||||
void DumpVarTable()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register Var *v;
|
register Var *v;
|
||||||
register int i;
|
register int i;
|
||||||
@@ -366,12 +355,7 @@ void DumpVarTable()
|
|||||||
/* preserved variables unless ALL is non-zero. */
|
/* preserved variables unless ALL is non-zero. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DestroyVars(int all)
|
||||||
PUBLIC void DestroyVars(int all)
|
|
||||||
#else
|
|
||||||
void DestroyVars(all)
|
|
||||||
int all;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Var *v, *next, *prev;
|
Var *v, *next, *prev;
|
||||||
@@ -404,12 +388,7 @@ int all;
|
|||||||
/* Given the name of a variable, "preserve" it. */
|
/* Given the name of a variable, "preserve" it. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int PreserveVar(char const *name)
|
||||||
PUBLIC int PreserveVar(char *name)
|
|
||||||
#else
|
|
||||||
int PreserveVar(name)
|
|
||||||
char *name;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Var *v;
|
Var *v;
|
||||||
|
|
||||||
@@ -424,12 +403,7 @@ char *name;
|
|||||||
/* DoPreserve - preserve a bunch of variables. */
|
/* DoPreserve - preserve a bunch of variables. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int DoPreserve (Parser *p)
|
||||||
PUBLIC int DoPreserve (Parser *p)
|
|
||||||
#else
|
|
||||||
int DoPreserve (p)
|
|
||||||
Parser *p;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -471,7 +445,7 @@ Parser *p;
|
|||||||
|
|
||||||
/* The structure of a system variable */
|
/* The structure of a system variable */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char const *name;
|
||||||
char modifiable;
|
char modifiable;
|
||||||
int type;
|
int type;
|
||||||
void *value;
|
void *value;
|
||||||
@@ -484,14 +458,17 @@ typedef struct {
|
|||||||
#define been_malloced min
|
#define been_malloced min
|
||||||
|
|
||||||
/* Flag for no min/max constraint */
|
/* Flag for no min/max constraint */
|
||||||
#define ANY 4532
|
#define ANY -31415926
|
||||||
|
|
||||||
/* All of the system variables sorted alphabetically */
|
/* All of the system variables sorted alphabetically */
|
||||||
static SysVar SysVarArr[] = {
|
static SysVar SysVarArr[] = {
|
||||||
/* name mod type value min/mal max */
|
/* name mod type value min/mal max */
|
||||||
{ "CalcUTC", 1, INT_TYPE, &CalculateUTC, 0, 1 },
|
{ "CalcUTC", 1, INT_TYPE, &CalculateUTC, 0, 1 },
|
||||||
{ "CalMode", 0, INT_TYPE, &DoCalendar, 0, 0 },
|
{ "CalMode", 0, INT_TYPE, &DoCalendar, 0, 0 },
|
||||||
{ "Daemon", 0, INT_TYPE, &Daemon, 0, 0 },
|
{ "Daemon", 0, INT_TYPE, &Daemon, 0, 0 },
|
||||||
|
{ "DateSep", 1, SPECIAL_TYPE, date_sep_func, 0, 0 },
|
||||||
{ "DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999 },
|
{ "DefaultPrio", 1, INT_TYPE, &DefaultPrio, 0, 9999 },
|
||||||
|
{ "DeltaOffset", 0, INT_TYPE, &DeltaOffset, 0, 0 },
|
||||||
{ "DontFork", 0, INT_TYPE, &DontFork, 0, 0 },
|
{ "DontFork", 0, INT_TYPE, &DontFork, 0, 0 },
|
||||||
{ "DontQueue", 0, INT_TYPE, &DontQueue, 0, 0 },
|
{ "DontQueue", 0, INT_TYPE, &DontQueue, 0, 0 },
|
||||||
{ "DontTrigAts", 0, INT_TYPE, &DontIssueAts, 0, 0 },
|
{ "DontTrigAts", 0, INT_TYPE, &DontIssueAts, 0, 0 },
|
||||||
@@ -515,18 +492,20 @@ static SysVar SysVarArr[] = {
|
|||||||
{ "NextMode", 0, INT_TYPE, &NextMode, 0, 0 },
|
{ "NextMode", 0, INT_TYPE, &NextMode, 0, 0 },
|
||||||
{ "NumQueued", 0, INT_TYPE, &NumQueued, 0, 0 },
|
{ "NumQueued", 0, INT_TYPE, &NumQueued, 0, 0 },
|
||||||
{ "NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 },
|
{ "NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 },
|
||||||
{ "PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
|
{ "PrefixLineNo", 0, INT_TYPE, &DoPrefixLineNo,0, 0 },
|
||||||
|
{ "PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
|
||||||
{ "RunOff", 0, INT_TYPE, &RunDisabled, 0, 0 },
|
{ "RunOff", 0, INT_TYPE, &RunDisabled, 0, 0 },
|
||||||
{ "SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0 },
|
{ "SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0 },
|
||||||
{ "SortByDate", 0, INT_TYPE, &SortByDate, 0, 0},
|
{ "SortByDate", 0, INT_TYPE, &SortByDate, 0, 0},
|
||||||
{ "SortByPrio", 0, INT_TYPE, &SortByPrio, 0, 0},
|
{ "SortByPrio", 0, INT_TYPE, &SortByPrio, 0, 0},
|
||||||
{ "SortByTime", 0, INT_TYPE, &SortByTime, 0, 0},
|
{ "SortByTime", 0, INT_TYPE, &SortByTime, 0, 0},
|
||||||
{ "SubsIndent", 1, INT_TYPE, &SubsIndent, 0, 132}
|
{ "SubsIndent", 1, INT_TYPE, &SubsIndent, 0, 132},
|
||||||
|
{ "TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
|
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
|
||||||
PRIVATE SysVar *FindSysVar ARGS((const char *name));
|
static SysVar *FindSysVar (char const *name);
|
||||||
PRIVATE void DumpSysVar ARGS((const char *name, const SysVar *v));
|
static void DumpSysVar (char const *name, const SysVar *v);
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* SetSysVar */
|
/* SetSysVar */
|
||||||
@@ -534,24 +513,22 @@ PRIVATE void DumpSysVar ARGS((const char *name, const SysVar *v));
|
|||||||
/* Set a system variable to the indicated value. */
|
/* Set a system variable to the indicated value. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int SetSysVar(char const *name, Value *value)
|
||||||
PUBLIC int SetSysVar(const char *name, Value *value)
|
|
||||||
#else
|
|
||||||
int SetSysVar(name, value)
|
|
||||||
char *name;
|
|
||||||
Value *value;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
SysVar *v = FindSysVar(name);
|
SysVar *v = FindSysVar(name);
|
||||||
if (!v) return E_NOSUCH_VAR;
|
if (!v) return E_NOSUCH_VAR;
|
||||||
if (v->type != value->type) return E_BAD_TYPE;
|
if (v->type != SPECIAL_TYPE &&
|
||||||
|
v->type != value->type) return E_BAD_TYPE;
|
||||||
if (!v->modifiable) {
|
if (!v->modifiable) {
|
||||||
Eprint("%s: `$%s'", ErrMsg[E_CANT_MODIFY], name);
|
Eprint("%s: `$%s'", ErrMsg[E_CANT_MODIFY], name);
|
||||||
return E_CANT_MODIFY;
|
return E_CANT_MODIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's a string variable, special measures must be taken */
|
if (v->type == SPECIAL_TYPE) {
|
||||||
if (v->type == STR_TYPE) {
|
SysVarFunc f = (SysVarFunc) v->value;
|
||||||
|
return f(1, value);
|
||||||
|
} else if (v->type == STR_TYPE) {
|
||||||
|
/* If it's a string variable, special measures must be taken */
|
||||||
if (v->been_malloced) free(*((char **)(v->value)));
|
if (v->been_malloced) free(*((char **)(v->value)));
|
||||||
v->been_malloced = 1;
|
v->been_malloced = 1;
|
||||||
*((char **) v->value) = value->v.str;
|
*((char **) v->value) = value->v.str;
|
||||||
@@ -571,19 +548,16 @@ Value *value;
|
|||||||
/* Get the value of a system variable */
|
/* Get the value of a system variable */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
int GetSysVar(char const *name, Value *val)
|
||||||
PUBLIC int GetSysVar(const char *name, Value *val)
|
|
||||||
#else
|
|
||||||
int GetSysVar(name, val)
|
|
||||||
char *name;
|
|
||||||
Value *val;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
SysVar *v = FindSysVar(name);
|
SysVar *v = FindSysVar(name);
|
||||||
|
|
||||||
val->type = ERR_TYPE;
|
val->type = ERR_TYPE;
|
||||||
if (!v) return E_NOSUCH_VAR;
|
if (!v) return E_NOSUCH_VAR;
|
||||||
if (v->type == STR_TYPE) {
|
if (v->type == SPECIAL_TYPE) {
|
||||||
|
SysVarFunc f = (SysVarFunc) v->value;
|
||||||
|
return f(0, val);
|
||||||
|
} else if (v->type == STR_TYPE) {
|
||||||
val->v.str = StrDup(*((char **) v->value));
|
val->v.str = StrDup(*((char **) v->value));
|
||||||
if (!val->v.str) return E_NO_MEM;
|
if (!val->v.str) return E_NO_MEM;
|
||||||
} else {
|
} else {
|
||||||
@@ -609,12 +583,7 @@ Value *val;
|
|||||||
/* Find a system var with specified name. */
|
/* Find a system var with specified name. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static SysVar *FindSysVar(char const *name)
|
||||||
PRIVATE SysVar *FindSysVar(const char *name)
|
|
||||||
#else
|
|
||||||
static SysVar *FindSysVar(name)
|
|
||||||
char *name;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int top=NUMSYSVARS-1, bottom=0;
|
int top=NUMSYSVARS-1, bottom=0;
|
||||||
int mid=(top + bottom) / 2;
|
int mid=(top + bottom) / 2;
|
||||||
@@ -629,7 +598,7 @@ char *name;
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* DumpSysVarByName */
|
/* DumpSysVarByName */
|
||||||
@@ -638,12 +607,7 @@ char *name;
|
|||||||
/* If name is "", dump all system variables. */
|
/* If name is "", dump all system variables. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
void DumpSysVarByName(char const *name)
|
||||||
PUBLIC void DumpSysVarByName(const char *name)
|
|
||||||
#else
|
|
||||||
void DumpSysVarByName(name)
|
|
||||||
char *name;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SysVar *v;
|
SysVar *v;
|
||||||
@@ -652,7 +616,7 @@ char *name;
|
|||||||
for (i=0; i<NUMSYSVARS; i++) DumpSysVar(name, SysVarArr + i);
|
for (i=0; i<NUMSYSVARS; i++) DumpSysVar(name, SysVarArr + i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
v = FindSysVar(name);
|
v = FindSysVar(name);
|
||||||
DumpSysVar(name, v);
|
DumpSysVar(name, v);
|
||||||
return;
|
return;
|
||||||
@@ -665,28 +629,37 @@ char *name;
|
|||||||
/* Dump the system variable. */
|
/* Dump the system variable. */
|
||||||
/* */
|
/* */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#ifdef HAVE_PROTOS
|
static void DumpSysVar(char const *name, const SysVar *v)
|
||||||
PRIVATE void DumpSysVar(const char *name, const SysVar *v)
|
|
||||||
#else
|
|
||||||
static void DumpSysVar(name, v)
|
|
||||||
char *name;
|
|
||||||
SysVar *v;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char buffer[VAR_NAME_LEN+10];
|
char buffer[VAR_NAME_LEN+10];
|
||||||
|
|
||||||
if (name && !*name) name=NULL;
|
if (name && !*name) name=NULL;
|
||||||
if (!v && !name) return; /* Shouldn't happen... */
|
if (!v && !name) return; /* Shouldn't happen... */
|
||||||
|
|
||||||
buffer[0]='$'; buffer[1] = 0;
|
buffer[0]='$'; buffer[1] = 0;
|
||||||
if (name) strcat(buffer, name); else strcat(buffer, v->name);
|
if (name) strcat(buffer, name); else strcat(buffer, v->name);
|
||||||
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, buffer);
|
fprintf(ErrFp, "%*s ", VAR_NAME_LEN+1, buffer);
|
||||||
if (v) {
|
if (v) {
|
||||||
if (v->type == STR_TYPE) {
|
if (v->type == SPECIAL_TYPE) {
|
||||||
char *s = *((char **)v->value);
|
Value val;
|
||||||
|
SysVarFunc f = (SysVarFunc) v->value;
|
||||||
|
f(0, &val);
|
||||||
|
if (DoCoerce(STR_TYPE, &val) == OK) {
|
||||||
|
fprintf(ErrFp, "\"%s\"\n", val.v.str);
|
||||||
|
}
|
||||||
|
DestroyValue(val);
|
||||||
|
} else if (v->type == STR_TYPE) {
|
||||||
|
char const *s = *((char **)v->value);
|
||||||
int y;
|
int y;
|
||||||
Putc('"', ErrFp);
|
Putc('"', ErrFp);
|
||||||
for (y=0; y<MAX_PRT_LEN && *s; y++) Putc(*s++, ErrFp);
|
for (y=0; y<MAX_PRT_LEN && *s; y++) {
|
||||||
|
if (*s == '"') {
|
||||||
|
fprintf(ErrFp, "\" + char(34) + \"");
|
||||||
|
s++;
|
||||||
|
} else {
|
||||||
|
Putc(*s++, ErrFp);
|
||||||
|
}
|
||||||
|
}
|
||||||
Putc('"', ErrFp);
|
Putc('"', ErrFp);
|
||||||
if (*s) fprintf(ErrFp, "...");
|
if (*s) fprintf(ErrFp, "...");
|
||||||
Putc('\n', ErrFp);
|
Putc('\n', ErrFp);
|
||||||
@@ -704,4 +677,3 @@ SysVar *v;
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
/***************************************************************/
|
|
||||||
/* */
|
|
||||||
/* VERSION.H */
|
|
||||||
/* */
|
|
||||||
/* What version of remind do we have? */
|
|
||||||
/* */
|
|
||||||
/* This file is part of REMIND. */
|
|
||||||
/* Copyright (C) 1992-1998 by David F. Skoll */
|
|
||||||
/* Copyright (C) 1999 by Roaring Penguin Software Inc. */
|
|
||||||
/* */
|
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/* $Id: version.h,v 1.7 1999-04-05 17:35:00 dfs Exp $ */
|
|
||||||
#define VERSION "03.00.20"
|
|
||||||
1
src/version.h.in
Normal file
1
src/version.h.in
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#define VERSION "@VERSION@"
|
||||||
17
tests/colors.rem
Normal file
17
tests/colors.rem
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
REM 28 SPECIAL COLOR 0 0 0 Black
|
||||||
|
REM 28 SPECIAL COLOR 65 0 0 Dim Red
|
||||||
|
REM 28 SPECIAL COLOR 0 65 0 Dim Green
|
||||||
|
REM 28 SPECIAL COLOR 0 0 65 Dim Blue
|
||||||
|
REM 28 SPECIAL COLOR 0 65 65 Dim Cyan
|
||||||
|
REM 28 SPECIAL COLOR 65 0 65 Dim Magenta
|
||||||
|
REM 28 SPECIAL COLOR 65 65 0 Dim Yellow
|
||||||
|
REM 28 SPECIAL COLOR 65 65 65 Dim White
|
||||||
|
|
||||||
|
REM 28 SPECIAL COLOR 129 0 0 Bright Red
|
||||||
|
REM 28 SPECIAL COLOR 0 129 0 Bright Green
|
||||||
|
REM 28 SPECIAL COLOR 0 0 129 Bright Blue
|
||||||
|
REM 28 SPECIAL COLOR 0 129 129 Bright Cyan
|
||||||
|
REM 28 SPECIAL COLOR 129 0 129 Bright Magenta
|
||||||
|
REM 28 SPECIAL COLOR 129 129 0 Bright Yellow
|
||||||
|
REM 28 SPECIAL COLOR 129 129 129 Bright White
|
||||||
|
|
||||||
1
tests/include_dir/01.rem
Normal file
1
tests/include_dir/01.rem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
REM 15 MSG 01
|
||||||
1
tests/include_dir/02.rem
Normal file
1
tests/include_dir/02.rem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
REM 15 MSG 02
|
||||||
1
tests/include_dir/03.notrem
Normal file
1
tests/include_dir/03.notrem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
REM MSG IGNORE
|
||||||
1
tests/include_dir/04cantread.rem
Normal file
1
tests/include_dir/04cantread.rem
Normal file
@@ -0,0 +1 @@
|
|||||||
|
REM 15 MSG You can't read this file.
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user