Compare commits

..

269 Commits

Author SHA1 Message Date
David F. Skoll
a146a0c819 Update WHATSNEW; fix typo in man page. 2008-11-16 11:01:01 -05:00
David F. Skoll
0f5a93cdf1 Fix up man page. 2008-11-16 10:51:10 -05:00
David F. Skoll
7db51e913e Clarify WEEK example. 2008-11-15 09:24:09 -05:00
David F. Skoll
93ac1aebf7 Document WEEK special. Clean up rem2ps handling of WEEK. 2008-11-15 09:20:54 -05:00
David F. Skoll
56ebedb9de Proper implementation of WEEK special. 2008-11-14 17:02:51 -05:00
David F. Skoll
e87d33de50 Handle the WEEK special. 2008-11-14 16:56:08 -05:00
David F. Skoll
a5774fd793 Document weekno() function. 2008-11-14 16:16:13 -05:00
David F. Skoll
adb60f3400 Fix example in man page. 2008-11-14 16:07:25 -05:00
David F. Skoll
47a0f63caa Fix tests. 2008-10-05 14:29:31 -04:00
David F. Skoll
30a385a7bb Fix bug in IsTopLevel. 2008-10-05 14:29:03 -04:00
David F. Skoll
9f2ae1773c Document evaltrig. 2008-10-05 14:11:58 -04:00
David F. Skoll
f470297958 Make max. string length controllable with $MaxStringLen system variable. 2008-10-05 13:49:45 -04:00
David F. Skoll
93dfc7995c Fix man page. 2008-09-23 22:39:12 -04:00
David F. Skoll
c96869817f Rejigger infrastructure to detect recursive OMITFUNC calls in evaltrig() 2008-09-23 22:21:39 -04:00
David F. Skoll
1bffa0e00b Allow any of the args to date() function to be a date,
in which case we just extract the appropriate part.
2008-09-20 11:07:33 -04:00
David F. Skoll
36035dda01 Issue a warning if we detect a SCANFROM used in two-arg evaltrig(). 2008-09-20 00:14:13 -04:00
David F. Skoll
50a15cf089 Make evaltrig return a DATETIME if there's an AT clause. 2008-09-20 00:03:38 -04:00
David F. Skoll
b59d4ed4a4 Add "evaltrig" function. 2008-09-19 23:49:11 -04:00
David F. Skoll
4c53710279 Set maximum string length to 65535 to minimize chances of self-DOS. 2008-09-19 23:28:19 -04:00
David F. Skoll
2274e88485 Remove extraneous semicolon 2008-09-19 23:10:57 -04:00
David F. Skoll
984a4677f2 Clean up funcs.c; add weekno function for ISO week number. 2008-09-19 23:08:15 -04:00
David F. Skoll
5e3dc54725 Document sorting of timed vs. untimed reminders.
Add an $UntimedFirst system variable.
2008-09-18 17:30:31 -04:00
David F. Skoll
53a7bf9773 Make tests pass. 2008-09-18 17:20:09 -04:00
David F. Skoll
1dcc3897d6 Allow sorting of untimed before timed. 2008-09-18 17:17:38 -04:00
David F. Skoll
fbc0375739 Fix bug if MON DAY WKDAY crosses year boundary. 2008-09-16 22:10:09 -04:00
David F. Skoll
4a74c03fa4 Small man-page fix. 2008-08-31 15:51:25 -04:00
David F. Skoll
d8833e6ce2 Updated man page. 2008-08-31 15:44:57 -04:00
David F. Skoll
2b8b9a56aa Fix typo. 2008-08-31 10:32:25 -04:00
David F. Skoll
85a8ebb357 Slight efficiency improvement in OMIT testing. 2008-08-31 10:30:59 -04:00
David F. Skoll
a67d9e2524 Change behaviour: OMITFUNC ignores local/global OMIT context. Only sane
way to solve garbage-day problem; also allows for more flexibility.
2008-08-31 10:29:28 -04:00
David F. Skoll
6845e72fd5 Communicate errors back for bad OMITFUNCs. 2008-08-30 22:10:06 -04:00
David F. Skoll
0ab977fa05 Whitespace cleanup 2008-08-30 21:43:38 -04:00
David F. Skoll
ad64a12b2a Update man page. 2008-08-30 16:35:48 -04:00
David F. Skoll
cfde4b50bb Updated man page. 2008-08-29 21:28:25 -04:00
David F. Skoll
f302c8eb95 Document OMITFUNC and fix huge bug. :-) 2008-08-29 21:22:48 -04:00
David F. Skoll
7ecc355358 Add test for OMITFUNC. 2008-08-29 21:03:01 -04:00
David F. Skoll
a52216d7e7 Update test.cmp for version. 2008-08-29 20:56:22 -04:00
David F. Skoll
8d8d4b667d Implement OMITFUNC clause in REM command. 2008-08-29 20:48:58 -04:00
David F. Skoll
670369121e Remove -a flag from "ShowTodaysReminders" 2008-08-28 12:29:38 -04:00
David F. Skoll
4365e580ee If main reminder file is a directory and AppendFile does not exist,
create AppendFile.
2008-04-16 21:54:05 -04:00
David F. Skoll
a8a09a905e Update test.cmp for new version. 2008-04-16 21:45:58 -04:00
David F. Skoll
dbb7381eb1 Update version number in configure. 2008-04-16 21:44:44 -04:00
David F. Skoll
aa3531a6bf Merge branch 'master' of ssh://source.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2008-04-16 13:35:36 -04:00
David F. Skoll
2848203d75 Note new behaviour: set var [expr] no longer works. 2008-04-16 13:34:38 -04:00
David F. Skoll
f0aef0703c Update WHATSNEW file. 2008-04-15 18:26:25 -04:00
David F. Skoll
7356a511e0 Update release notes and man page. 2008-04-14 21:30:35 -04:00
David F. Skoll
5be26a3cff Add "c" flag to -c option that causes Remind to approximate
SPECIAL COLOR reminders with vt100 escape sequences.
2008-04-14 21:03:45 -04:00
David F. Skoll
36a80acb0c Make tkremind handle the case when ~/.reminders is a directory better.
It uses ~/.reminders/100-tkremind.rem as the append file.
2008-03-31 14:00:09 -04:00
David F. Skoll
37ab03b49d Make tkremind work better on small-screen devices like eeepc. 2008-03-30 12:11:07 -04:00
David F. Skoll
75209cb40e Update tkremind copyright date. 2008-03-27 22:13:24 -04:00
David F. Skoll
4b2d274748 Add "l" flag to -c to draw calendar
using VT100 line-drawing characters.
2008-03-27 22:04:06 -04:00
David F. Skoll
1423495b88 Document -tn option
Implement "-ca" which is analagous to "-pa" and "-sa".
2008-03-26 21:51:30 -04:00
David F. Skoll
42e4ec8890 Make DEBUG command handle "f" flag. 2008-03-25 17:21:07 -04:00
David F. Skoll
58fbd51ef4 Call globfree to free memory used by glob. 2008-03-24 23:12:27 -04:00
David F. Skoll
7552dbb812 Update copyright. Put -df in online usage blurb. 2008-03-24 21:36:29 -04:00
David F. Skoll
31e0ecb71d Fix tests for version change. 2008-03-24 20:42:19 -04:00
David F. Skoll
f6743a4f87 Bump version to 03.01.05. 2008-03-24 20:41:12 -04:00
David F. Skoll
5f574949e6 Nicer -df output. Document -df. 2008-03-24 20:39:47 -04:00
David F. Skoll
724bce4fb9 Add "-df" debugging flag to track file opens. 2008-03-24 20:22:00 -04:00
David F. Skoll
8d59f025af Patch from Ian! Allen. 2008-03-24 14:10:01 -04:00
David F. Skoll
aad44f4716 Spit out errors if we can't open a non-readable file in a dir/*.rem. 2008-03-24 14:02:39 -04:00
David F. Skoll
0a38d7d213 Output fileinfo lines in tests. 2008-03-24 13:56:51 -04:00
David F. Skoll
4fcd60fd95 Increase INCLUDE_DEPTH to account for (wasted) top-of-stack entry.
Document that filename argument for INCLUDE and command-line can be a directory.
2008-03-24 13:54:21 -04:00
David F. Skoll
38beeb8cb0 Add some tests for INCLUDE functionality. 2008-03-24 13:29:31 -04:00
David F. Skoll
26f0acab35 Opening of directories works properly. 2008-03-24 13:16:28 -04:00
David F. Skoll
3897973bc1 Improve error messages. 2008-03-24 13:11:21 -04:00
David F. Skoll
7b3da27461 Fix parse error bug in calendar mode. 2008-03-24 13:02:05 -04:00
David F. Skoll
a85ee5f31c INCLUDE /directory works. Still need more futzing to fix parse error. 2008-03-24 12:58:23 -04:00
David F. Skoll
b272863aa0 Prep for push. 2008-03-24 10:00:34 -04:00
David F. Skoll
8249964380 Start coding feature allowing "INCLUDE /directory" which basically
includes "/directory/*.rem" files in glob-order.
2008-03-22 23:28:51 -04:00
David F. Skoll
af81bbb299 Preserve "\n" in continued lines.
Set a flag if parser encounters [expr].
2008-03-15 14:06:12 -04:00
David F. Skoll
d818dd9c80 Fix bug in AM/PM option setting for existing reminders. 2008-03-09 11:23:27 -04:00
David F. Skoll
fe8e34dece Better error message if nonsensical -i option given. 2008-02-06 23:42:12 -05:00
David F. Skoll
ba928989f7 Make expression parser accept backslashes in strings so we can do:
SET a "Some \"embedded\" quotes"
2008-02-06 23:35:46 -05:00
David F. Skoll
742f973028 Allow command-line '-i' option to define a function as well as a var.
Example:  remind ... '-isquare(x)=x*x' ...

Also, allow the syntax:

      SET var = expr
      FSET func(args) = defn

Old syntax still works, of course:

      SET var expr
      FSET func(args) defn
2008-02-06 23:12:51 -05:00
David F. Skoll
043932fcbe Add a $DeltaOffset read-only system variable that is set by "-tNNN" option. 2008-02-06 22:24:45 -05:00
David F. Skoll
ad5e096caa Make '-t' take a numeric argument that sets the "DeltaOffset" to that
value.  We trigger any reminder that will trigger between today and
today+DeltaOffset days.  A bare '-t' sets InfiniteDelta as before.
2008-02-06 22:16:47 -05:00
David F. Skoll
06c8fc8f78 Oops... forgot a release note. 2008-02-03 17:14:31 -05:00
David F. Skoll
487338d10c Updated for 3.1.4 release. 2008-02-03 17:12:16 -05:00
David F. Skoll
3d1c0e5667 Fix awful bug in rem2html for a 28-day February that starts on Sunday... 2008-01-31 23:31:45 -05:00
David F. Skoll
ce3bb191c4 More code cleanups and const-correctness. 2008-01-30 21:37:19 -05:00
David F. Skoll
03e9dbf364 More const qualification. 2008-01-28 11:39:15 -05:00
David F. Skoll
518aab3d02 Don't trash argv[] so reread works properly. 2008-01-28 11:28:17 -05:00
David F. Skoll
f055664f77 More const-correctness. 2008-01-27 11:02:03 -05:00
David F. Skoll
ba3e01f2ce Add a bunch of const qualifiers. 2008-01-26 21:55:58 -05:00
David F. Skoll
b6883c8a45 Keep version number in ONE place (configure.in) instead of two. 2008-01-26 15:34:32 -05:00
David F. Skoll
9e49ee3acb Make tkremind obey -b1 option (24-hour mode.) 2008-01-26 12:01:43 -05:00
David F. Skoll
7481f68bb2 Make tkremind work better with Tk8.5. 2007-12-24 11:40:22 -05:00
David F. Skoll
99792eec03 Add a test. 2007-11-05 11:52:50 -05:00
David F. Skoll
91458c7845 Better patch for parsing bug. 2007-11-05 11:44:48 -05:00
David F. Skoll
cad5849dc0 Merge branch 'master' of ssh://magnesium.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2007-11-05 11:38:17 -05:00
David F. Skoll
a38e120e99 Fix weird parsing bug if you have a SKIP on an omitted day with a SATISFY. 2007-11-05 11:37:48 -05:00
David F. Skoll
0b31a78cf2 Patch to clean up HTML output (Jorey Bump) 2007-10-16 11:46:58 -04:00
David F. Skoll
861858c1a6 Bump version to 03.01.04. 2007-10-15 14:17:09 -04:00
David F. Skoll
d43a2277da Updated WHATSNEW. 2007-10-15 14:00:09 -04:00
David F. Skoll
f678dc96b8 Write man page for rem2html 2007-10-07 22:24:35 -04:00
David F. Skoll
c2e371904e Update distclean target. 2007-10-07 22:10:25 -04:00
David F. Skoll
2a1cbff22e Add www/Makfile to gitignore. 2007-10-07 22:09:47 -04:00
David F. Skoll
a2d9f277c4 Minor tweaks to Makefile.in 2007-10-07 22:09:37 -04:00
David F. Skoll
d939059417 Improve www/Makefile stuff. 2007-10-07 22:05:35 -04:00
David F. Skoll
740cd4cfed Update README. 2007-10-06 11:41:40 -04:00
David F. Skoll
91a5306a67 Fix typo. 2007-10-06 11:38:23 -04:00
David F. Skoll
b78ffcbffd Tidy up option processing. 2007-10-06 11:35:57 -04:00
David F. Skoll
4f72f557b7 Minor fix to --nostyle output. 2007-10-05 11:52:16 -04:00
David F. Skoll
e3b21d6d0d More tweaks. 2007-10-04 22:02:27 -04:00
David F. Skoll
af28c49d8d Fixed up the www stuff. 2007-10-04 22:01:09 -04:00
David F. Skoll
67f4635573 Fix DST rules. 2007-10-04 13:41:42 -04:00
David F. Skoll
5f8d10908d Minor cleanups. 2007-10-03 12:32:41 -04:00
David F. Skoll
7307421812 Add --nostyle option to rem2html so it can produce basic HTML that does
not rely on an external stylesheet.
2007-10-02 18:47:38 -04:00
David F. Skoll
5cd3b628c5 Minor tweaks. 2007-10-02 14:03:19 -04:00
David F. Skoll
29e483ab64 Updated Makefile and rem2html to use IMGBASE for stylesheet also. 2007-10-02 11:31:06 -04:00
David F. Skoll
66ddba45af Add support for HTMLCLASS special. Add CSS code for rem-today class to
highlight "today".
2007-10-02 11:21:40 -04:00
David F. Skoll
9325b3f035 Minor tweaks to CSS. 2007-10-01 18:03:21 -04:00
David F. Skoll
522c4c94e1 Add --imgbase option. 2007-10-01 17:59:33 -04:00
David F. Skoll
730505cff3 Less verbose. 2007-10-01 17:27:58 -04:00
David F. Skoll
019783e1fa Redo rem2html. Uses CSS instead of hard-coded stuff. 2007-10-01 17:21:59 -04:00
David F. Skoll
8612bb6480 Do not evaluate SATISFY expression if reminder has expired. 2007-09-26 08:41:34 -04:00
David F. Skoll
7f1e6d21d9 Update version number and copyright year. 2007-09-24 10:32:06 -04:00
David F. Skoll
e6c0371be1 Make calendar times show duration. 2007-09-16 17:44:33 -04:00
David F. Skoll
58feaa7e0c Update version in test.cmp 2007-09-12 10:08:04 -04:00
David F. Skoll
a828378466 Update version. 2007-09-12 09:55:40 -04:00
David F. Skoll
53316e8b06 Update WHATSNEW for 3.1.2 release. 2007-09-11 21:41:00 -04:00
David F. Skoll
6127e390a1 Make tkremind notify when firing up editor. 2007-09-10 16:56:10 -04:00
David F. Skoll
4caa77f6b1 Make PgUp and PgDn work like Left and Right, respectively. 2007-09-06 14:25:52 -04:00
David F. Skoll
70419e8757 Found dates for almost all releases. 2007-09-05 17:25:50 -04:00
David F. Skoll
21d8bd1406 Add dates (where known) to releases. 2007-09-05 17:07:48 -04:00
David F. Skoll
25abee3259 Ensure that tkremind draws moons before anything else. 2007-09-05 16:20:33 -04:00
David F. Skoll
2d490c2b7a Clarify WHATSNEW 2007-09-05 15:52:57 -04:00
David F. Skoll
902b7895b7 Merge branch 'master' of ssh://magnesium.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2007-09-05 07:04:36 -04:00
David F. Skoll
1c80bb649f Trigger queued reminders at least once even if we hibernate past trigger time. 2007-09-05 07:04:11 -04:00
David F. Skoll
4508215617 Merge branch 'master' of ssh://magnesium.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2007-09-04 21:58:37 -04:00
David F. Skoll
739b68347a Update WHATSNEW 2007-09-04 21:53:33 -04:00
David F. Skoll
d834760cda Merge branch 'master' of ssh://magnesium.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2007-09-04 21:46:16 -04:00
David F. Skoll
1bc78650bf Exit in queue mode if date rolls over. 2007-09-04 21:44:59 -04:00
David F. Skoll
ec4e203099 Fix typo that caused SEGV. 2007-09-04 14:38:46 -04:00
David F. Skoll
d23528da82 Don't trigger reminders if they are more than 60 seconds in the past.
We want to avoid a huge flurry of triggering up emerging from suspend
or hibernation on a laptop.
2007-09-04 14:24:32 -04:00
David F. Skoll
7401a0ba23 In queue mode, wake up once a minute to recalibrate sleep time. Required
for laptops that hibernate or suspend.
2007-09-04 14:16:12 -04:00
David F. Skoll
b14b4f08b1 build.tk tries to reuse existing settings if an installed version of Remind
is found.
2007-09-03 21:37:58 -04:00
David F. Skoll
70ece81340 Flash buttons before invoking. 2007-09-03 10:23:15 -04:00
David F. Skoll
19ac350527 Silence gcc warning on Ubuntu Feisty. 2007-09-03 10:09:07 -04:00
David F. Skoll
a9b08d7db8 Updated docs. 2007-09-03 07:06:53 -04:00
David F. Skoll
df8fa05632 Note that psmoon and psshade are deprecated. 2007-09-03 06:48:38 -04:00
David F. Skoll
6556137aad Warn about deprecated psmoon and psshade functions. 2007-09-03 06:46:58 -04:00
David F. Skoll
aa1ab2bbb4 Don't sort SPECIALs ahead of normal reminders. Allow all SPECIALs to include
times; back-ends can use or ignore them as they see fit.
2007-09-03 06:28:34 -04:00
David F. Skoll
be38d86521 Make non-PSFile and non-PostScript SPECIALs preserve time
in -p field.
2007-09-02 23:02:25 -04:00
David F. Skoll
3931afb6b1 Remove all mention of remind-all. 2007-08-31 23:37:19 -04:00
David F. Skoll
7d2df86b75 Remove mention of remind-all 2007-08-31 23:36:06 -04:00
David F. Skoll
5a3bd5839b Tweak "make distro" 2007-08-31 23:29:39 -04:00
David F. Skoll
b91ce9a3f7 Incorporate rem's functionality directly into Remind. 2007-08-31 23:10:40 -04:00
David F. Skoll
ac889dd329 Corrections to Jewish Holidays from Art Werschulz. 2007-08-31 11:37:40 -04:00
David F. Skoll
420df9b6ed Bump version to 03.01.02. 2007-08-31 11:06:19 -04:00
David F. Skoll
f862b6811d Add test for REM AT ... SPECIAL COLOR ... 2007-08-31 11:02:26 -04:00
David F. Skoll
c072698927 Handle queued SPECIAL COLOR reminders properly. 2007-08-31 11:00:49 -04:00
David F. Skoll
d22895831b Fix enter/leave events. 2007-08-31 10:32:01 -04:00
David F. Skoll
3c41f4ade4 add rem2ps to gitignore. 2007-08-30 23:31:42 -04:00
David F. Skoll
335d5fb984 Don't include .gitignore when making distro. 2007-08-30 23:30:51 -04:00
David F. Skoll
66bd2b8fac Add a .gitignore file. 2007-08-30 23:29:20 -04:00
David F. Skoll
fed3cad3b8 Fix regression that broke non-COLOR specials. 2007-08-30 23:23:45 -04:00
David F. Skoll
b20578f24f Add and document keyboard shortcuts to tkremind. 2007-08-30 22:31:11 -04:00
David F. Skoll
7a86e7f777 Use spacing rather than "....." to separate reminders in TkRemind. 2007-08-30 22:19:50 -04:00
David F. Skoll
16c93fcad6 Add rem.1 man page to install target. 2007-08-30 21:58:28 -04:00
David F. Skoll
edd66d8d89 Added man page for rem script.
Added more tests.
2007-08-30 21:57:30 -04:00
David F. Skoll
3ba39b6efe Add "rem" Perl script. 2007-08-30 17:33:26 -04:00
David F. Skoll
c656a1a169 Make SPECIAL COLOR always output color triplet in calendar mode even with %"%" escapes. 2007-08-30 15:40:25 -04:00
David F. Skoll
19f03e419a Fix test.cmp for new version. 2007-08-22 20:32:49 -04:00
David F. Skoll
5a281d5999 Updated changelog. 2007-08-22 20:29:35 -04:00
David F. Skoll
d80d14f585 Better placement of moons 2007-08-22 16:34:35 -04:00
David F. Skoll
520b8511bd Make moon images transparent. 2007-08-22 16:31:04 -04:00
David F. Skoll
91627d4f22 Fix typo 2007-08-22 15:57:27 -04:00
David F. Skoll
a21147c7a5 Prune a whole bunch of obsolete files. 2007-08-22 15:54:41 -04:00
David F. Skoll
d22c1dee49 Fix README to reflect reality. 2007-08-22 15:50:58 -04:00
David F. Skoll
95b0fc7480 Update version to 03.01.01; document changes in WHATSNEW 2007-08-22 15:31:17 -04:00
David F. Skoll
b40d5d7984 Performance improvements. 2007-08-22 12:00:12 -04:00
David F. Skoll
2df93c9df3 Fixed wording of man page. 2007-08-22 11:29:35 -04:00
David F. Skoll
51cdea4b17 better definition of prev_monday 2007-08-21 22:03:31 -04:00
David F. Skoll
f229e64744 Fix typo 2007-08-21 18:58:00 -04:00
David F. Skoll
0f15955a41 Better definition of prev_monday in man page. 2007-08-21 18:54:53 -04:00
David F. Skoll
390e6c2eed Fixed typo 2007-08-21 18:49:49 -04:00
David F. Skoll
877eaccd6d Documented nonomitted() 2007-08-21 18:47:51 -04:00
David F. Skoll
6424e655a1 Allow cycle modulus to be zero. 2007-08-21 17:34:46 -04:00
David F. Skoll
176037082b Add cycle function to handle Elizabeth's school schedule. 2007-08-21 17:10:04 -04:00
David F. Skoll
a361c7e426 Note that we always use "/" in rem2ps input. 2007-08-17 09:07:32 -04:00
David F. Skoll
caba0c1695 Make "-n" mode use / (always) in dates to match Simple Calendar output. 2007-08-15 23:26:41 -04:00
David F. Skoll
71b3f9fefc Remove kall, rem from install target. 2007-08-15 23:20:57 -04:00
David F. Skoll
91f8507e51 Remove obsolete scripts. Apply some Debian-maintainer patches. 2007-08-15 23:18:48 -04:00
David F. Skoll
b68e81a126 Fix trailing "s" bug (Debian patch) 2007-08-15 23:06:21 -04:00
David F. Skoll
72658025f1 Prevent warning with fcc 2.95 2007-08-15 15:14:18 -04:00
David F. Skoll
93aea240d6 Updated docs. 2007-08-14 21:25:09 -04:00
David F. Skoll
7717b37c36 Updated for 3.1.0 release. 2007-08-14 21:21:52 -04:00
David F. Skoll
e1b2990fb0 Prevent possible memory leak. 2007-08-12 20:01:50 -04:00
David F. Skoll
e49194c6ee Clean up man page. 2007-08-12 19:48:52 -04:00
David F. Skoll
79ab150546 Modify "make dist" target to use git-ls-files instead of peekentry into CVS. 2007-08-12 19:15:57 -04:00
David F. Skoll
fc658d15d4 Fix typos. Document -y option. 2007-08-11 22:22:12 -04:00
David F. Skoll
76d130ef82 Add -y option to synthesize tags. 2007-08-11 22:03:48 -04:00
David F. Skoll
3e9a55fbdb Working version of e-mail if you don't close timed reminder popup. 2007-08-10 22:27:08 -04:00
David F. Skoll
b071397d46 Fix typo. 2007-08-10 22:08:02 -04:00
David F. Skoll
df0dd55635 Add code to make tkremind mail reminders if dialog not dismissed. Untested! 2007-08-10 14:15:12 -04:00
David F. Skoll
960d08fd24 Start adding feature that e-mails reminders if popup not dismissed. 2007-08-10 09:08:06 -04:00
David F. Skoll
38603916a2 Fix typo. 2007-08-08 12:07:05 -04:00
David F. Skoll
0ed1bb4017 Remove $Id$ tags. 2007-08-08 12:05:28 -04:00
David F. Skoll
b4ac0c9f6c Remove CVS $Id$ tag. 2007-08-08 11:11:18 -04:00
David F. Skoll
b136af88ad Remove $Id$ tag. 2007-08-07 10:02:18 -04:00
David F. Skoll
508b5f9aae ? 2007-08-07 10:01:22 -04:00
David F. Skoll
43dff67a60 Modify "make dist" target to use git-ls-files instead of peekentry into CVS. 2007-08-02 22:27:12 -04:00
David F. Skoll
41b850321f Fix warning about unused variables. 2007-08-02 22:17:27 -04:00
David F. Skoll
523237007b Remove CVS ident tags. 2007-08-02 22:15:58 -04:00
dfs
a3f6c5fd9c Fix range of years allowed by tkremind. 2007-07-29 03:17:58 +00:00
dfs
785cdc8726 Increase YR_RANGE from 88 to 4000. 2007-07-29 03:16:40 +00:00
dfs
cbf12b5601 Save screen real-estate. 2007-07-17 08:57:38 +00:00
dfs
1a6d59d9c0 Updated man page. 2007-07-17 01:30:10 +00:00
dfs
23ae054abb Add missing DestroyParser call. 2007-07-14 17:18:11 +00:00
dfs
b57852d3d8 Properly handle timed reminders in -sa mode. 2007-07-13 12:19:13 +00:00
dfs
c0e1be2f3a Fixed custom.h.in 2007-07-13 03:43:30 +00:00
dfs
a442a15a8d Fix typo. 2007-07-13 03:40:24 +00:00
dfs
f91bf634ad Add FROM keyword.
Make Calendar delta calculations use ShouldTriggerReminder for proper
delta calculation.
2007-07-13 03:36:15 +00:00
dfs
ce4311c3df Add support for FROM keyword (a slight variation on SCANFROM) 2007-07-12 23:36:03 +00:00
dfs
08e69cb541 Fix compile error. 2007-07-12 12:12:25 +00:00
dfs
f8e2eaed73 Suppress time on timed-reminders in "advanced" trigger in -sa mode. 2007-07-12 04:31:52 +00:00
dfs
e68a16e73d Update docs. 2007-07-12 04:27:44 +00:00
dfs
ca191fbd92 Remove ACKNOWLEDGEMENTS 2007-07-12 04:26:36 +00:00
dfs
10276826c0 Fix docs. 2007-07-12 04:25:38 +00:00
dfs
02c9129903 Added WHATSNEW 2007-07-12 03:46:29 +00:00
dfs
04e4c902bd Write wrappers for setenv/unsetenv for Solaris 9. 2007-07-12 03:29:14 +00:00
dfs
0663ae77de Fix more bugs in -sa mode. 2007-07-12 03:14:36 +00:00
dfs
0c0f5ea093 Fix bug in -sa option. 2007-07-12 03:09:44 +00:00
dfs
f450fd633e Check for setenv and unsetenv. 2007-07-09 01:55:45 +00:00
dfs
59cdd35f61 Adjust spacing for longer variable names. 2007-07-08 18:48:32 +00:00
dfs
eab67cbda4 Increase some limits. 2007-07-08 18:46:23 +00:00
dfs
b3c4a48641 In normal mode, convert SPECIAL COLOR to MSG. 2007-07-08 18:42:13 +00:00
dfs
07ac8ed341 Error-checking for out-of-range dates in tzconvert. 2007-07-08 18:32:07 +00:00
dfs
e32aa218fc Documented tzconvert. 2007-07-08 18:21:39 +00:00
dfs
09d11d36c3 Added tzconvert function. 2007-07-08 16:57:47 +00:00
dfs
629e287526 More man-page tweaks. 2007-07-05 02:05:41 +00:00
dfs
e2cd29c824 Documented built-in funcs that can take a DATETIME. 2007-07-05 02:02:01 +00:00
dfs
69e597dbe7 Kill off HAVE_PROTOS. 2007-07-03 03:42:46 +00:00
dfs
152e7ebac9 More man page updates. 2007-07-03 03:36:52 +00:00
dfs
8d4451ed85 Remove obsolete files. 2007-07-01 20:22:52 +00:00
dfs
5b8836d4b8 Make default datesep '-' in build.tk 2007-07-01 20:13:37 +00:00
dfs
be7086579e Make DateSep and TimeSep into system variables that can be changed
at runtime.
2007-07-01 20:12:15 +00:00
dfs
ab16c8f1fe More work on Remind. 2007-07-01 14:49:44 +00:00
dfs
6bb71ee5e3 In simple calendar and normal mode, treat SPECIAL COLOR the same as MSG 2007-06-29 02:11:02 +00:00
dfs
ebb4ebea97 Change trigdate, trigtime, trigdatetime to return 0 if trigger was not
valid.
2007-06-29 01:52:36 +00:00
dfs
bf97e62d56 Bump version to 3.1.0 2007-06-29 01:23:36 +00:00
dfs
47645cddb6 Added full support for DATETIME data type. 2007-06-29 01:17:39 +00:00
dfs
cf2af56a05 Allow DATETIME - DATETIME 2007-06-28 21:57:07 +00:00
dfs
50d1ae42c9 More work on a unified DATETIME type. 2007-06-28 03:20:37 +00:00
dfs
9501498a7e Add DATETIME type. 2007-06-28 03:04:44 +00:00
dfs
614ab08099 Apply sorting patch so SPECIAL HTMLs sort with MSG-type reminders
(from Ian! Allen)
2007-06-05 02:44:30 +00:00
dfs
64ee338433 Sort "today's" reminder popup. 2007-04-24 14:34:48 +00:00
dfs
43556238d0 Fix Yom Ha'atzmaut and Yom Hazikaron. 2007-04-24 14:34:41 +00:00
dfs
58d7ac0520 Make "distclean" remove test.out 2007-03-26 19:37:56 +00:00
dfs
0754678ce7 Update copyright year 2007-01-25 02:33:18 +00:00
dfs
2bea176816 Update usage output. 2007-01-25 02:32:25 +00:00
dfs
fa90333219 Add "a" modifier to -s and -p options (Frank Terbeck) 2007-01-25 02:28:53 +00:00
dfs
e007b3bc0f Change per Tony Morel. 2006-11-02 20:50:16 +00:00
dfs
978e83567b Incorporate patch at http://bugs.debian.org/cgi-bin/bugreport.cgi/03-broken-postscript.patch?bug=320415;msg=26;att=1 2005-12-31 23:05:24 +00:00
dfs
d01c1190cd Fix incorrect sizes for Ledger vs. Legal 2005-12-01 14:37:10 +00:00
dfs
0b1855df9b Updated WHATSNEW file. 2005-11-20 01:43:25 +00:00
dfs
951f2785cc Support arbitrarily-long DURATIONs 2005-11-20 01:26:59 +00:00
dfs
30090d3f8d Fix segmentation fault (Stan Tobias) 2005-11-20 00:40:51 +00:00
dfs
b6ad67891c Implement Paul Pelzl's patch for combining -n with -s/-p 2005-10-16 14:48:02 +00:00
dfs
b61c9db6e6 Noted removal of non-UNIX support. 2005-09-30 03:36:19 +00:00
dfs
29368ec2ee Documented $PrefixLineNo variable. 2005-09-30 03:33:52 +00:00
dfs
88ff86c910 Removed old non-ANSI, non-UNIX cruft. 2005-09-30 03:29:32 +00:00
dfs
0cc5ae521c Start getting rid of non-ANSI cruft. 2005-09-28 02:43:09 +00:00
dfs
da1b5ed9a0 Remove OS2_POPUP crap. 2005-09-28 02:39:11 +00:00
dfs
f786d05c04 More Makefile tweaks. 2005-07-02 04:10:15 +00:00
dfs
0bcbe9047e Make Makefile obey DESTDIR 2005-07-02 04:08:36 +00:00
dfs
585346f753 Prep for 3.0.24 release. 2005-04-15 16:30:11 +00:00
139 changed files with 13453 additions and 10577 deletions

15
.gitignore vendored Normal file
View 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

View File

@@ -1,54 +0,0 @@
$Id: ACKNOWLEDGEMENTS,v 1.2 2000-02-18 03:45:11 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@roaringpenguin.com> <aa775@freenet.carleton.ca>
986 Eiffel Avenue
Ottawa, Ontario K2C 0J2
CANADA
Tel. (613) 225-8687

View File

@@ -1,10 +1,9 @@
$Id: COPYRIGHT,v 1.16 2005-04-12 01:27:52 dfs Exp $
THE REMIND COPYRIGHT
1. REMIND refers to the entire set of files and documentation in the
REMIND package.
2. REMIND is Copyright 1999-2005 Roaring Penguin Software Inc.,
2. REMIND is Copyright 1999-2008 Roaring Penguin Software Inc.,
except where noted in individual files.
3. DISTRIBUTION AND USE

View File

@@ -1,7 +1,5 @@
# Top-level Makefile for Remind.
# $Id: Makefile,v 1.28 1998-05-06 01:51:12 dfs Exp $
all: src/Makefile
@echo ""
@echo "*******************"
@@ -26,8 +24,14 @@ clean:
find . -name '*~' -exec rm {} \;
cd src; $(MAKE) clean
test:
cd src && $(MAKE) test
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
./configure
# DO NOT DELETE

4
README
View File

@@ -34,7 +34,5 @@ If you do NOT have Tcl/Tk or are NOT running X Windows:
5) Type: "make install" -- you may need to be root to do this.
$Id: README,v 1.7 2000-06-26 14:43:25 dfs Exp $
Contact info: mailto:dfs@roaringpenguin.com
Home page: http://www.roaringpenguin.com/remind.html
Home page: http://www.roaringpenguin.com/remind

View File

@@ -1,5 +1,3 @@
$Id: WINDOWS,v 1.1 1999-04-05 17:34:28 dfs Exp $
MICROSOFT WINDOWS
I used to prohibit porting Remind to Microsoft Windows. However, this

124
build.tk
View File

@@ -12,8 +12,6 @@
#
#--------------------------------------------------------------
# $Id: build.tk,v 1.13 2005-04-14 17:33:26 dfs Exp $
# the next line restarts using wish \
exec wish "$0" "$@"
@@ -34,7 +32,7 @@ proc SetConfigDefaults {} {
set Config(LON_MIN) 39
set Config(LOCATION) "Ottawa"
set Config(DEFAULT_PAGE) "Letter"
set Config(DATESEP) "/"
set Config(DATESEP) "-"
set Config(TIMESEP) ":"
set Config(ISOLATIN1) 0
set Config(IBMEXTENDED) 0
@@ -43,6 +41,8 @@ proc SetConfigDefaults {} {
set Config(NORTHERN_HEMISPHERE) 1
set Config(WESTERN_HEMISPHERE) 1
set Config(LANGUAGE) "English"
set Config(INST_DIR) "/usr/local/bin"
set Config(MAN_DIR) "/usr/local/man"
}
#***********************************************************************
@@ -99,7 +99,7 @@ proc CreateMainDialog {} {
destroy .c
update idletasks
SetConfigDefaults
SetConfigFromRemind
tabnotebook_create .tn
set Instdir [tabnotebook_page .tn "Installation Directories"]
@@ -130,13 +130,14 @@ proc CreateMainDialog {} {
# Creates the "installation directories" dialog.
#***********************************************************************
proc CreateInstallDirDialog { w } {
global Config
label $w.binlabel -text "Location for programs: "
entry $w.bin -width 30
$w.bin insert end "/usr/local/bin"
$w.bin insert end $Config(INST_DIR)
label $w.manlabel -text "Location for man pages: "
entry $w.man -width 30
$w.man insert end "/usr/local/man"
$w.man insert end $Config(MAN_DIR)
text $w.blurb -width 1 -height 5 -wrap word -relief flat -takefocus 0
$w.blurb insert end "\n(Tabbed-notebook Tcl code taken from \"Effective Tcl/Tk Programming\" by Mark Harrison and Michael McLennan, Addison-Wesley Professional Computing Series.)"
@@ -865,10 +866,121 @@ proc doLogo {} {
.c create text 4 28 -anchor nw -text "http://www.roaringpenguin.com" \
-fill red -font {-family courier -size -14 -weight bold}
set rem [FindRemind]
if {$rem != ""} {
.c create text 4 52 -anchor nw -text "Found existing Remind... reusing settings" -fill red -font {-family courier -size -14 -weight bold}
.c create text 4 66 -anchor nw -text "from $rem" -fill red -font {-family courier -size -14 -weight bold}
}
update idletasks
after 2500
}
#***********************************************************************
# %PROCEDURE: FindRemind
# %ARGUMENTS:
# None
# %RETURNS:
# Full path to an existing "remind" if one is found. Otherwise,
# empty string.
#***********************************************************************
proc FindRemind {} {
global env
set path [concat [split $env(PATH) ":"] "/bin" "/usr/bin" "/usr/local/bin"]
foreach thing $path {
if [file executable [file join $thing "remind"]] {
return [file join $thing "remind"]
}
}
return {}
}
#***********************************************************************
# %PROCEDURE: SetConfigFromRemind
# %ARGUMENTS:
# None
# %RETURNS:
# Sets config settings based on existing remind (if one found) or else
# sensible defaults.
#***********************************************************************
proc SetConfigFromRemind {} {
global Config
SetConfigDefaults
set rem [FindRemind]
if {"$rem" == ""} {
return
}
set dir [file dirname $rem]
set Config(INST_DIR) $dir
if {"$dir" == "/usr/local/bin"} {
set Config(MAN_DIR) "/usr/local/man"
} elseif {$dir == "/usr/bin"} {
set Config(MAN_DIR) "/usr/share/man"
}
# Check for existing man page
if {[file readable "/usr/share/man/man1/remind.1"]} {
set Config(MAN_DIR) "/usr/share/man"
} elseif {[file readable "/usr/man/man1/remind.1"]} {
set Config(MAN_DIR) "/usr/man"
} elseif {[file readable "/usr/local/man/man1/remind.1"]} {
set Config(MAN_DIR) "/usr/local/man"
}
# Query Remind for the rest
QueryRemind $rem LAT_DEG {$LatDeg}
QueryRemind $rem LAT_MIN {$LatMin}
QueryRemind $rem LON_DEG {$LongDeg}
QueryRemind $rem LON_MIN {$LongMin}
QueryRemind $rem LOCATION {$Location}
QueryRemind $rem DATESEP {$DateSep}
QueryRemind $rem TIMESEP {$TimeSep}
QueryRemind $rem LANGUAGE {language()}
set $Config(LAT_MIN) [expr abs($Config(LAT_MIN))]
if {$Config(LAT_DEG) >= 0} {
set Config(NORTHERN_HEMISPHERE) 1
} else {
set Config(NORTHERN_HEMISPHERE) 0
set Config(LAT_DEG) [expr abs($Config(LAT_DEG))]
}
set $Config(LON_MIN) [expr abs($Config(LON_MIN))]
if {$Config(LON_DEG) >= 0} {
set Config(WESTERN_HEMISPHERE) 1
} else {
set Config(WESTERN_HEMISPHERE) 0
set Config(LON_DEG) [expr abs($Config(LON_DEG))]
}
# Get default page from rem2ps
set rem2ps [file join $dir "rem2ps"]
catch {
exec $rem2ps -m help
} err
set errlist [split $err "\n"]
set err [lindex $errlist end]
if {[string match "Default media type is*" $err]} {
set Config(DEFAULT_PAGE) [lindex $err end]
}
}
proc QueryRemind { rem symbol rem_msg } {
global Config
catch {
set fp [open "| $rem -" "r+"]
puts $fp "banner %\nMSG \[$rem_msg\]%\nFLUSH\n"
flush $fp
gets $fp line
catch { close $fp }
}
if {"$line" == ""} {
return
}
set Config($symbol) $line
}
CheckSanity
CreateMainDialog

7110
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,4 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.in,v 1.8 2000-03-15 16:05:19 dfs Exp $
AC_INIT(src/queue.c)
@@ -26,25 +25,26 @@ dnl Replace `main' with a function in -lm:
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.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/file.h sys/select.h sys/time.h sys/types.h unistd.h malloc.h stdarg.h stdlib.h pwd.h)
AC_CHECK_HEADERS(sys/file.h glob.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_FUNC_UTIME_NULL
AC_HEADER_TIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(mktime putenv strstr timegm difftime)
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
fi
AC_OUTPUT(src/Makefile)
AC_CHECK_FUNCS(setenv unsetenv glob)
VERSION=03.01.06
AC_SUBST(VERSION)
AC_OUTPUT(src/Makefile www/Makefile src/version.h)

View File

@@ -1,34 +0,0 @@
$Id: README.AMIGA,v 1.4 2005-04-12 01:18:22 dfs Exp $
REMIND version 3.0 for AmigaDOS
I DO NOT SUPPORT REMIND ON AmigaDOS. THE AmigaDOS PORT HAS NOT BEEN MAINTAINED
FOR QUITE A WHILE. IT MOST LIKELY NO LONGER WORKS.
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@roaringpenguin.com>
986 Eiffel Avenue
Ottawa, Ontario K2C 0J2
CANADA
Tel. (613) 225-8687
http://www.roaringpenguin.com/remind.html

View File

@@ -1,33 +0,0 @@
$Id: README.BCC,v 1.4 2005-04-12 01:18:22 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. IT MOST LIKELY NO LONGER WORKS.
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@roaringpenguin.com>
986 Eiffel Avenue
Ottawa, Ontario K2C 0J2
CANADA
Tel. (613) 225-8687
http://www.roaringpenguin.com/remind.html

View File

@@ -1,38 +0,0 @@
$Id: README.DOS,v 1.4 2005-04-12 01:18:22 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. IT MOST LIKELY NO LONGER WORKS.
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@roaringpenguin.com>
986 Eiffel Avenue
Ottawa, Ontario K2C 0J2
CANADA
Tel. (613) 225-8687
http://www.roaringpenguin.com/remind.html

View File

@@ -1,114 +0,0 @@
$Id: README.OS2,v 1.4 2005-04-12 01:18:22 dfs Exp $
REMIND version 3.0 for OS/2
I DO NOT SUPPORT REMIND ON OS/2. THE OS/2 PORT HAS NOT BEEN MAINTAINED
FOR QUITE A WHILE. IT MOST LIKELY NO LONGER WORKS.
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@roaringpenguin.com>
986 Eiffel Avenue
Ottawa, Ontario K2C 0J2
CANADA
Tel. (613) 225-8687
http://www.roaringpenguin.com/remind.html

View File

@@ -1,5 +1,4 @@
$Id: README.UNIX,v 1.5 2000-02-18 03:45:33 dfs Exp $
REMIND version 3.0 for UNIX
REMIND version 3.1 for UNIX
REMIND is a sophisticated alarm/calendar program. Details are given
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
web server. See the files README and Makefile in that directory.
Two shell scripts, "scripts/remind-all.csh" and
"scripts/remind-all.sh" are provided. These allow automatic mailing of
reminders to all users who create a $HOME/.reminders file. These two
scripts are equivalent; one is a "sh" script and the other is a "csh"
script. Pick the one you want to use, and follow the instructions in
the opening comments of the script.
A shell script called "scripts/rem" is provided for those who like to have
'remind' assume a default reminders file. A man page for this script
is provided. You should examine the script to ensure that the defaults
are correct.
Many people have asked me why I supply the "rem" script instead of
having Remind assume a default file. The answer is: That's how I like
it! My personal preference is for a program which normally takes
parameters to display usage information when invoked with no
parameters. I like that behaviour so I can quickly get an idea of
what a program does without poring through the man page. And I think
I'll keep Remind that way. Sorry to all who dislike it. :-)
A shell script called "scripts/kall" is provided so you can kill your
background remind processes when you log out. See the man page. Note
that kall depends on the output of "ps", and may not be portable.
The file "examples/defs.rem" has some sample Remind definitions and
commands, as well as U.S. and Jewish holidays.
@@ -126,9 +101,4 @@ exit
--
David F. Skoll <dfs@roaringpenguin.com>
986 Eiffel Avenue
Ottawa, Ontario K2C 0J2
CANADA
Tel. (613) 225-8687
http://www.roaringpenguin.com/remind.html
http://www.roaringpenguin.com/remind/

View File

@@ -1,53 +0,0 @@
$Id: README_QDOS,v 1.5 2005-04-12 01:18:22 dfs Exp $
REMIND version 3.0.19 for QDOS / SMSQ
I DO NOT SUPPORT REMIND ON QDOS. THE QDOS PORT HAS NOT BEEN MAINTAINED
FOR QUITE A WHILE. IT MOST LIKELY NO LONGER WORKS.
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

View File

@@ -1,6 +1,275 @@
CHANGES TO REMIND
* Version 3.0 Patch 23
* Version 3.1 Patch 6 - 2008-11-16
- MAJOR ENHANCEMENT: A new OMITFUNC clause gives you additional
control and flexibility over "omitted days" calculations. This is
useful when holidays influence the timing of events several days
later. See "COMPUTED LOCAL OMITS" in the man page.
- ENHANCEMENT: The new evaltrig() built-in function lets you evaluate triggers
from within an expression.
- ENHANCEMENT: The new weekno() built-in function returns the ISO 8601
week number of a date.
- ENHANCEMENT: The "WEEK" special lets you annotate calendar output with the
week number. The TkRemind, rem2ps and rem2html back-ends support WEEK.
- MINOR ENHANCEMENT: You can control whether timed reminders come before or
after non-timed reminders with the "-g" flag.
- BUG FIX: TkRemind did not work correctly if ~/.reminders was a directory.
- BUG FIX: TkRemind incorrectly invoked Remind with the "-a" flag when
showing today's reminders.
- BUG FIX: In certain cases, a trigger containing a day, month and
weekday would fail if it needed to cross a year boundary. This has
been fixed.
* 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
@@ -24,7 +293,7 @@ CHANGES TO REMIND
- Fixed parser error for unterminated date constant: '2005/01/01
* Version 3.0 Patch 22
* Version 3.0 Patch 22 - 2000-06-16
+ MINOR ENHANCEMENTS
@@ -46,7 +315,7 @@ CHANGES TO REMIND
- Fixed serious bug in which background queued reminders were ignored and
Remind simply exited. Doh! Sorry about that.
* Version 3.0 Patch 21
* Version 3.0 Patch 21 - 2000-03-15
+ MINOR ENHANCEMENTS
@@ -77,7 +346,7 @@ CHANGES TO REMIND
- Fixed compilation problem on FreeBSD, IRIX, Tru64 and other UNIXes.
* Version 3.0 Patch 20
* Version 3.0 Patch 20 - 1999-04-12
+ NEWS
@@ -106,7 +375,7 @@ CHANGES TO REMIND
- 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
@@ -148,7 +417,7 @@ CHANGES TO REMIND
- Lots more silly little bugs squashed -- too many to go into in
detail.
* Version 3.0 Patch 18
* Version 3.0 Patch 18 - 1998-02-15
+ MAJOR ENHANCEMENTS
@@ -212,7 +481,7 @@ CHANGES TO REMIND
- Getting rid of fixed-sized buffers meant lots of changes to code.
No doubt, I missed a few regression tests.
* Version 3.0 Patch 17
* Version 3.0 Patch 17 - 1997-09-07
+ MINOR ENHANCEMENTS
@@ -253,7 +522,7 @@ CHANGES TO REMIND
library. All three of these fixes are courtesy of Christopher
J. Madsen <madsen@iglobal.net>. Thanks, Christopher.
* Version 3.0 Patch 16
* Version 3.0 Patch 16 - 1997-02-11
+ MINOR ENHANCEMENTS
@@ -281,7 +550,7 @@ CHANGES TO REMIND
- Fixed a problem under Solaris 2.5 whereby rem2ps was skipping some
latin1 characters which it interpreted as white space.
* Version 3.0 Patch 15
* Version 3.0 Patch 15 - 1996-10-27
+ IMPORTANT NOTES
@@ -311,7 +580,7 @@ CHANGES TO REMIND
- Fixed bug in TkRemind which caused a crash if the "-m" option was used
for a month beginning on Sunday. Doh!!!
* Version 3.0 Patch 14
* Version 3.0 Patch 14 - 1996-05-25
+ CHANGE IN COPYING POLICY
@@ -370,7 +639,7 @@ CHANGES TO REMIND
_not_ support MS Windows, and in fact do not allow Remind to run
under Windows (see COPYRIGHT).
* Version 3.0 Patch 13
* Version 3.0 Patch 13 - 1994-05-06
+ MINOR ENHANCEMENTS
@@ -405,7 +674,7 @@ CHANGES TO REMIND
- Updated the copyright notices everywhere.
* Version 3.0 Patch 12
* Version 3.0 Patch 12 - 1994-02-01
+ MINOR ENHANCEMENTS
@@ -424,7 +693,7 @@ CHANGES TO REMIND
- Fixed a problem with the '-k' option which resulted in a newline being
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
@@ -504,7 +773,7 @@ CHANGES TO REMIND
- 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
@@ -561,7 +830,7 @@ CHANGES TO REMIND
so that newlines in the body start new paragraphs, rather than being
swallowed as white-space.
* Version 3.0 Patch 8
* Version 3.0 Patch 8 - 1993-09-08
+ MAJOR ENHANCEMENTS
@@ -613,7 +882,7 @@ CHANGES TO REMIND
range [-128, 255] (but not 0) so that char(asc(s)) works even
on machines with signed char types.
* Version 3.0 Patch 7
* Version 3.0 Patch 7 - 1993-07-22
+ MAJOR ENHANCEMENTS
@@ -656,7 +925,7 @@ CHANGES TO REMIND
- Changed kall so that "kall sh" doesn't commit suicide - patch courtesy
of Michael Salmon.
* Version 3.0 Patch 6
* Version 3.0 Patch 6 - 1993-05-05
+ MINOR ENHANCEMENTS
@@ -679,7 +948,7 @@ CHANGES TO REMIND
- Fixed a bug in the -u option which sometimes caused a core dump
(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:
@@ -714,7 +983,7 @@ CHANGES TO REMIND
- 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
issuing them. (You can see I'm running out of letters to
@@ -773,13 +1042,13 @@ CHANGES TO REMIND
- 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
should NOT use patch level 2 - either stick to 3.0.1 or upgrade to
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.
This simplifies the remind-all scripts, and makes them more efficient.
@@ -819,7 +1088,7 @@ CHANGES TO REMIND
- Changed Remind so that supplying the -a option causes timed reminders
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
@@ -859,7 +1128,7 @@ CHANGES TO REMIND
- Re-formatted the WHATSNEW.30 file.
* Version 3.0
* Version 3.0 - 1992-11-09
- Total rewrite from previous versions
@@ -880,23 +1149,23 @@ CHANGES TO REMIND
- Fixed a lurking bug in trigger date calculation which, amazingly, had not
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
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
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
queued reminders in the foreground. This makes automatic termination
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
in cursor not starting from left side of screen on some systems.
@@ -913,7 +1182,7 @@ CHANGES TO REMIND
- 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
to trigger all non-expired reminders.
@@ -927,7 +1196,7 @@ CHANGES TO REMIND
- 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.
@@ -949,28 +1218,28 @@ CHANGES TO REMIND
- Modified the calendar and SimpleCalendar formats so that the % escape
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
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
allowed RUN-type reminders to be explicitly included in the calendar by
using the %" escape sequence.
* Version 2.2
* Version 2.2 - 1990-11-16
- Added the AT keyword, the timed reminders daemon, and the
calendar facility.
* Version 2.1
* Version 2.1 - 1990-11-06
- Added the "repeat" token for repeating reminders with a period
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,
character substitution, and the RUN keyword.

View File

@@ -22,17 +22,13 @@
# #
#############################################################################
#
# $Id: defs.rem,v 1.5 2001-05-07 14:06:17 dfs Exp $
#
RUN OFF
################################################
# Ensure required version of remind is used... #
################################################
IF version() < "03.00.19"
ERRMSG This file requires at least version 03.00.19 of Remind.%
IF version() < "03.01.02"
ERRMSG This file requires at least version 03.01.02 of Remind.%
ERRMSG This version is version [version()].
EXIT
ENDIF
@@ -97,7 +93,7 @@ SET Week_1 1
SET Week_2 8
SET Week_3 15
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...
FSET _trig() TRIGGER(TRIGDATE())
@@ -105,46 +101,6 @@ FSET _trig() TRIGGER(TRIGDATE())
# Handy function to provide SCANFROM dates...
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 #
# 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
OMIT [_trig()] MSG %"President'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 Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
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%"
REM Mon Oct [Week_2] MSG %"Columbus 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 31 MSG %"Halloween%"
REM Tue Nov 2 SCANFROM [_back(7)] \
@@ -472,8 +438,9 @@ SET Reform 0
FSET _h(x, y) TRIGGER(HEBDATE(x,y))
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 _BackTwoFri(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=5, _h2(x,y), _h2(x,y)-2))
FSET _BackTwoSat(x, y) TRIGGER(IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)-2))
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
SET InIsrael VALUE("InIsrael", 0)
SET Reform VALUE("Reform", 0)
@@ -493,7 +460,7 @@ IF !InIsrael
[_h(16, "Tishrey")] MSG %"Sukkot 2%"
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.
IF InIsrael
@@ -521,7 +488,8 @@ IF !Reform
ENDIF
[_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 WKDAYNUM(_h2(13, "Adar")) != 6
@@ -530,6 +498,7 @@ ELSE
REM [TRIGGER(_h2(11, "Adar"))] ++4 MSG %"Fast of Esther%" is %b.
ENDIF
[_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.
IF !InIsrael
@@ -542,9 +511,24 @@ IF !InIsrael && !Reform
[_h(22, "Nisan")] MSG %"Pesach 8%"
ENDIF
[_h(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
[_BackTwoFri(4, "Iyar")] ++4 MSG %"Yom HaZikaron%" is %b.
[_BackTwoSat(5, "Iyar")] ++4 MSG %"Yom Ha'atzmaut%" is %b.
[_PastSun(27, "Nisan")] ++4 MSG %"Yom HaShoah%" 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
IF !Reform

View File

@@ -1,4 +1,3 @@
.\" $Id: cm2rem.1,v 1.2 2000-03-15 15:51:36 dfs Exp $
.TH CM2REM 1 "18 October 1999"
.UC4
.SH NAME

View File

@@ -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

View File

@@ -1,35 +1,20 @@
.\" $Id: rem.1,v 1.2 1998-02-16 02:35:09 dfs Exp $
.TH REM 1 "15 February 1998"
.UC 4
.TH REM 1 "30 August 2007"
.UC4
.SH NAME
rem \- run 'remind' with a default reminder file
rem \- Invoke Remind with a default filename
.SH SYNOPSIS
.B rem
[\-F \fIfilename\fR] [\fIremind_options\fR] [\fIremind_params\fR]
.B rem [\fIoptions\fR] [\fIdate\fR] [\fI*rep\fR] [\fItime\fR]
.SH DESCRIPTION
.B Rem
runs the \fBremind\fR program with a default reminder file of
"$HOME/.reminders". You can supply remind options on the command line,
as well as a date specification, just as with \fBremind\fR.
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)
\fBrem\fR is a symbolic link to \fBremind\fR. When \fBremind\fR
determines that it has been invoked as \fBrem\fR, it uses a default
filename rather than expecting a filename to be supplied on the command
line.
.PP
For example, typing:
.PP
.nf
rem -c 1 jan 1992
.fi
.PP
has the same effect as typing:
.PP
.nf
remind -c $HOME/.reminders 1 jan 1992
.fi
If the environment variable DOTREMINDERS is set, \fBremind\fR uses the
value of DOTREMINDERS as the filename. Otherwise, \fBremind\fR uses
the filename $HOME/.reminders
.PP
.SH AUTHOR
David F. Skoll
Remind was written by David F. Skoll <dfs@roaringpenguin.com>
.SH SEE ALSO
remind, kall
\fBremind\fR

View File

@@ -1,4 +1,3 @@
.\" $Id: rem2ps.1,v 1.6 2005-04-12 00:57:48 dfs Exp $
.TH REM2PS 1 "11 April 2005"
.UC4
.SH NAME
@@ -78,10 +77,10 @@ Letter
8.5 x 11 in.
.TP
Legal
11 x 17 in.
8.5 x 14 in.
.TP
Ledger
8.5 x 14 in.
11 x 17 in.
.TP
Statement
5.5 x 8.5 in.
@@ -122,10 +121,10 @@ numbers.
numbers.
.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
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.
.RE
.TP
@@ -138,7 +137,7 @@ specifying:
.RS
.PP
.nf
-ftshe Helvetica -fd Helvetica-BoldOblique
\-ftshe Helvetica \-fd Helvetica-BoldOblique
.fi
.PP
In other words, the heading, entry and small-calendar fonts are set
@@ -154,7 +153,7 @@ are equivalent to specifying:
.RS
.PP
.nf
-sthd 14 -se 8
\-sthd 14 \-se 8
.fi
.PP
In other words, the heading and day numbers are 14-point fonts, and the
@@ -180,7 +179,7 @@ for good output:
.PP
.nf
# This gives good results for putting into a binder
rem2ps -ol 72 -sh 12
rem2ps \-ol 72 \-sh 12
.fi
.SH USAGE
To use \fBRem2ps\fR, you should pipe the output of \fBRemind\fR with the \fB\-p\fR
@@ -188,14 +187,14 @@ option to \fBRem2ps\fR, and then send the result to a printer. This is most eas
illustrated with examples:
.PP
.nf
remind -p12 /dev/null 1 jan 1994 | rem2ps | lpr -Plaser
remind \-p12 /dev/null 1 jan 1994 | rem2ps | lpr \-Plaser
.fi
.PP
That example creates a blank calendar for the entire year of 1994, and
sends it the the printer named "laser."
.PP
.nf
remind -p ~/.reminders | rem2ps -l -sd 18 > cal.ps
remind \-p ~/.reminders | rem2ps \-l \-sd 18 > cal.ps
.fi
.PP
This reminder creates a calendar for the current month, filling in
@@ -351,7 +350,9 @@ The remaining data consists of calendar entries, in the following format:
\fIyyyy/mm/dd special tag dur time body\fR
.PP
Here, \fIyyyy\fR is the year, \fImm\fR is the month (01-12) and
\fIdd\fR is the day of the month.
\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
\fIspecial\fR is a string used
for "out-of-band" communication with back-ends. If the reminder
@@ -406,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,
but again, the PostScript output will probably not work.
.SH SEE ALSO
\fBRemind\fR
\fBremind\fR

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,3 @@
.\" $Id: tkremind.1,v 1.11 2005-04-12 13:41:27 dfs Exp $ "
.TH TKREMIND 1 "15 February 1998"
.UC 4
.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
\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.
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.
It is in standard \fBRemind\fR format. \fIWrite_file\fR is the file
@@ -211,6 +212,18 @@ background reminder pops up.
If selected, feeds the text of the reminder to the command described
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.
@@ -224,6 +237,22 @@ press \fBApply Options\fR to put them into effect, \fBSave Options\fR
to put them into effect and save them in $HOME/.tkremindrc, or
\fBCancel\fR to cancel any changes you made.
.SH 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
\fBTkRemind\fR performs some basic consistency checks when you add or
preview a reminder. However, if you edit a reminder in the previewer,
@@ -257,7 +286,7 @@ for \fBTkRemind\fR (for example).
script file. It also places special comments in the reminder
file to store additional state. You can certainly mix
"hand-crafted" reminders with reminders created by \fBTkRemind\fR
if you are awared of the following rules and limitations:
if you are aware of the following rules and limitations:
.TP
o
Do not use the \fBTAG\fR keyword in hand-crafted reminders.

View File

@@ -1,23 +0,0 @@
Begin3
Title: Remind
Version: 03.00.22
Entered-date: 12 Apr 1999
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: dskoll@iname.com (David F. Skoll)
Maintained-by: dskoll@iname.com (David F. Skoll)
Primary-site: http://www.roaringpenguin.com/remind.html
304kB remind-3.0.22.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
End

View File

@@ -1,10 +1,4 @@
Files in this directory:
kall -- Kills a program by command name, as in "kall remind"
rem -- Starts Remind with a default file of $HOME/.reminders
remind-all.csh -- Mails reminders to all users (C-Shell version)
remind-all.sh -- Mails reminders to all users (Bourne Shell version)
tkremind* -- Tcl/Tk graphical calendar using Remind as engine
$Id: README,v 1.1 1998-01-15 02:50:20 dfs Exp $
tkremind -- Tcl/Tk graphical calendar using Remind as engine
cm2rem.tcl -- Convert Sun's "cm" calendar manager files to Remind.

View File

@@ -13,8 +13,6 @@
#
#--------------------------------------------------------------
# $Id: cm2rem.tcl,v 1.3 2000-02-18 03:45:38 dfs Exp $
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.4 2000-02-18 03:45:39 dfs Exp $
#
# REMIND is Copyright (C) 1992-1998 by David F. Skoll
# Copyright (C) 1999-2000 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

View File

@@ -8,17 +8,29 @@
#
# This file is part of REMIND.
# Copyright (C) 1992-1998 David F. Skoll
# Copyright (C) 1999-2005 Roaring Penguin Software Inc.
# Copyright (C) 1999-2008 Roaring Penguin Software Inc.
#
#--------------------------------------------------------------
# $Id: tkremind,v 1.40 2005-04-14 17:34:34 dfs Exp $
# the next line restarts using wish \
exec wish "$0" "$@"
wm withdraw .
proc missing_tcllib { pkg } {
catch { puts stderr "Could not find the '$pkg' package -- you must install tcllib.\nPlease see http://tcllib.sourceforge.net/" }
tk_dialog .err "Error: tcllib not installed" "Could not find the '$pkg' package -- you must install tcllib. Please see http://tcllib.sourceforge.net/" error 0 OK
exit 1
}
if {[catch {package require mime}]} {
missing_tcllib mime
}
if {[catch {package require smtp}]} {
missing_tcllib smtp
}
# Check that we have the right version of wish
if {$tcl_version < 8.0} {
tk_dialog .error Error "You need wish version 8.0 or higher to run TkRemind; you have $tcl_version" error 0 OK
@@ -58,6 +70,12 @@ set OptDescr(FeedReminder) "(0/1) If 1, feed the reminder to RunCmd on standard
set Option(Editor) "emacs +%d %s"
set OptDescr(Editor) "(String) Specify command to edit a file. %d is replaced with line number and %s with filename"
set Option(MailAddr) ""
set OptDescr(MailAddr) "(String) Specify an e-mail address to which reminders should be sent if the popup window is not manually dismissed"
set Option(SMTPServer) "127.0.0.1"
set OptDescr(SMTPServer) "(String) IP address or host name of SMTP server to use for sending e-mail"
# Remind program to execute -- supply full path if you want
set Remind "remind"
#set Remind "/home/dfs/Remind/src/remind"
@@ -75,8 +93,12 @@ set EditorPid -1
set AppendFile {NOSUCHFILE}
catch {set AppendFile $ReminderFile}
set SetFontsWorked 0
#---------------- DON'T CHANGE STUFF BELOW HERE ------------------
# 24-hour clock mode
set TwentyFourHourMode 0
# Is Monday in first column?
set MondayFirst 0
@@ -135,9 +157,9 @@ set HighestTagSoFar 0
proc Initialize {} {
global DayNames argc argv CommandLine ReminderFile AppendFile Remind PSCmd
global MondayFirst
global MondayFirst TwentyFourHourMode
set CommandLine "|$Remind -itkremind=1 -p -l"
set CommandLine "|$Remind -itkremind=1 -p -y -l"
set PSCmd "$Remind -p -l"
set i 0
while {$i < $argc} {
@@ -147,6 +169,9 @@ proc Initialize {} {
if {[regexp -- {m} [lindex $argv $i]]} {
set MondayFirst 1
}
if {"[lindex $argv $i]" == "-b1"} {
set TwentyFourHourMode 1
}
} else {
break
}
@@ -162,6 +187,14 @@ proc Initialize {} {
}
}
# If reminder file is a directory and appendfile is the same as
# reminder file, choose append file to be $ReminderFile/100-tkremind.rem
if {[file isdirectory $ReminderFile]} {
if {"$ReminderFile" == "$AppendFile"} {
set AppendFile [file join $ReminderFile "100-tkremind.rem"]
}
}
# Check system sanity
if {! [file readable $ReminderFile]} {
set ans [tk_dialog .error "TkRemind: Warning" "Can't read reminder file `$ReminderFile'" warning 0 "Create it and continue" "Exit"]
@@ -175,6 +208,12 @@ proc Initialize {} {
exit 1
}
if {[file isdirectory $ReminderFile] && ! [file exists $AppendFile]} {
if {![catch {close [open "$AppendFile" "a"]}]} {
tk_dialog .error "Created File" "Created blank file `$AppendFile'" info 0 "OK"
}
}
if {! [file writable $AppendFile]} {
tk_dialog .error Error "Can't write reminder file `$AppendFile'" error 0 Ok
exit 1
@@ -253,9 +292,14 @@ proc CalEntryOffset { firstDay } {
#***********************************************************************
proc CreateCalFrame { w dayNames } {
# Figure out reasonable height for text frames
global SetFontsWorked
set h [winfo screenheight .]
if {$h <= 480} {
set h 2
if {$SetFontsWorked} {
set h 3
} else {
set h 2
}
} elseif {$h <= 600} {
set h 4
} else {
@@ -271,7 +315,7 @@ proc CreateCalFrame { w dayNames } {
set index $i
}
label $w.day$i -text [lindex $dayNames $index] -justify center
label $w.day$i -border 1 -text [lindex $dayNames $index] -justify center
grid configure $w.day$i -row 0 -column $i -sticky ew
}
for {set i 0} {$i < 6} {incr i} {
@@ -279,11 +323,9 @@ proc CreateCalFrame { w dayNames } {
for {set j 0} {$j < 7} {incr j} {
set f [expr $n+$j]
button $w.l$f -text "" -justify center -command "" \
-state disabled -relief flat
text $w.t$f -width 12 -height $h -wrap word -relief flat \
-state disabled -takefocus 0 -cursor {}
$w.t$f tag bind TAGGED <Enter> "TaggedEnter $w.t$f"
$w.t$f tag bind TAGGED <Leave> "TaggedLeave $w.t$f"
-state disabled -relief flat -border 0 -padx 0 -pady 0
text $w.t$f -width 12 -height $h -border 1 -spacing3 3 -wrap word -relief flat \
-state disabled -takefocus 0 -cursor {}
$w.t$f tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$f"
$w.t$f tag bind REM <ButtonPress-3> "FireEditor $w.t$f"
@@ -313,10 +355,17 @@ proc CreateCalFrame { w dayNames } {
#***********************************************************************
proc ConfigureCalFrame { w firstDay numDays } {
global CurMonth CurYear TodayMonth TodayYear TodayDay
global tk_version
set offset [CalEntryOffset $firstDay]
set first [expr $offset+1]
set last [expr $offset+$numDays]
if {$tk_version >= 8.5} {
set bg "#d9d9d9"
} else {
set bg [lindex [$w.t0 configure -background] 3]
}
for {set i 0} {$i < $first} {incr i} {
grid $w.l$i $w.t$i
$w.l$i configure -text "" -command "" -state disabled -relief flat
@@ -325,13 +374,11 @@ proc ConfigureCalFrame { w firstDay numDays } {
foreach t [$w.t$i tag names] {
$w.t$i tag delete $t
}
$w.t$i tag bind TAGGED <Enter> "TaggedEnter $w.t$i"
$w.t$i tag bind TAGGED <Leave> "TaggedLeave $w.t$i"
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
$w.t$i configure -state disabled
$w.t$i configure -background [lindex [$w.t$i configure -background] 3]
$w.l$i configure -background [lindex [$w.l$i configure -background] 3]
$w.t$i configure -background $bg
$w.l$i configure -background $bg
}
for {set i $first} {$i <= $last} {incr i} {
grid $w.l$i $w.t$i
@@ -343,13 +390,11 @@ proc ConfigureCalFrame { w firstDay numDays } {
foreach t [$w.t$i tag names] {
$w.t$i tag delete $t
}
$w.t$i tag bind TAGGED <Enter> "TaggedEnter $w.t$i"
$w.t$i tag bind TAGGED <Leave> "TaggedLeave $w.t$i"
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
$w.t$i configure -state disabled
$w.t$i configure -background [lindex [$w.t$i configure -background] 3]
$w.l$i configure -background [lindex [$w.l$i configure -background] 3]
$w.t$i configure -background $bg
$w.l$i configure -background $bg
}
set forgetIt 0
for {set i [expr $last+1]} {$i < 42} {incr i} {
@@ -370,13 +415,11 @@ proc ConfigureCalFrame { w firstDay numDays } {
foreach t [$w.t$i tag names] {
$w.t$i tag delete $t
}
$w.t$i tag bind TAGGED <Enter> "TaggedEnter $w.t$i"
$w.t$i tag bind TAGGED <Leave> "TaggedLeave $w.t$i"
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
$w.t$i configure -state disabled
$w.t$i configure -background [lindex [$w.t$i configure -background] 3]
$w.l$i configure -background [lindex [$w.l$i configure -background] 3]
$w.t$i configure -background $bg
$w.l$i configure -background $bg
}
if { $CurMonth == $TodayMonth && $CurYear == $TodayYear } {
set n [expr $TodayDay + $offset]
@@ -392,22 +435,22 @@ proc ConfigureCalFrame { w firstDay numDays } {
proc CreateCalWindow { dayNames } {
global Option
frame .h
label .h.title -text "" -justify center -pady 2 -relief raised
label .h.title -text "" -justify center -pady 1 -border 1 -relief raised
pack .h.title -side top -fill x
pack .h -side top -expand 0 -fill x
CreateCalFrame .cal $dayNames
frame .b
button .b.prev -text {<-} -command {MoveMonth -1}
button .b.this -text {Today} -command {ThisMonth}
button .b.next -text {->} -command {MoveMonth 1}
button .b.goto -text {Go To Date...} -command {GotoDialog}
button .b.print -text {Print...} -command {DoPrint}
button .b.quit -text {Quit} -command {Quit}
button .b.options -text {Options...} -command EditOptions
label .b.status -text "" -width 25 -relief sunken
label .b.nqueued -text "" -width 20 -relief sunken
button .b.prev -text {<-} -command {MoveMonth -1} -border 1
button .b.this -text {Today} -command {ThisMonth} -border 1
button .b.next -text {->} -command {MoveMonth 1} -border 1
button .b.goto -text {Go To Date...} -command {GotoDialog} -border 1
button .b.print -text {Print...} -command {DoPrint} -border 1
button .b.quit -text {Quit} -command {Quit} -border 1
button .b.options -text {Options...} -command EditOptions -border 1
label .b.status -text "" -width 25 -relief sunken -border 1
label .b.nqueued -text "" -width 20 -relief sunken -border 1
pack .b.prev .b.this .b.next .b.goto .b.print .b.options .b.quit -side left -fill x
pack .b.status -side left -fill x -expand 1
pack .b.nqueued -side left -fill x
@@ -417,6 +460,13 @@ proc CreateCalWindow { dayNames } {
wm iconname . ""
wm protocol . WM_DELETE_WINDOW Quit
wm deiconify .
bind . <Control-KeyPress-q> Quit
bind . <KeyPress-Left> ".b.prev flash; .b.prev invoke"
bind . <KeyPress-Right> ".b.next flash; .b.next invoke"
bind . <KeyPress-Prior> ".b.prev flash; .b.prev invoke"
bind . <KeyPress-Next> ".b.next flash; .b.next invoke"
bind . <KeyPress-Home> ".b.this flash; .b.this invoke"
if {$Option(StartIconified)} {
wm iconify .
}
@@ -486,6 +536,22 @@ proc EditOptions {} {
pack $w.cmd -in $w.rf -side left -expand 1 -fill x
$w.cmd insert 0 $tmpOpt(RunCmd)
frame $w.sep3 -border 1 -relief sunken
# E-mail reminder if popup not dismissed
frame $w.eml
label $w.lab_email_address -text "E-mail reminders here if popup not dismissed:" -anchor w -justify left
entry $w.email_address -width 30
pack $w.lab_email_address -in $w.eml -side left -expand 0 -fill none
pack $w.email_address -in $w.eml -side left -expand 1 -fill x
$w.email_address insert 0 $tmpOpt(MailAddr)
frame $w.fsmtp
label $w.lab_smtp -text "Name or IP address of SMTP server:" -anchor w -justify left
entry $w.smtp -width 30
pack $w.lab_smtp -in $w.fsmtp -side left -expand 0 -fill none
pack $w.smtp -in $w.fsmtp -side left -expand 1 -fill x
$w.smtp insert 0 $tmpOpt(SMTPServer)
# Editor
frame $w.ef
label $w.el -text "Text Editor:" -anchor w -justify left
@@ -510,6 +576,9 @@ proc EditOptions {} {
pack $w.sep1 -in $w.f -side top -expand 0 -fill x -ipady 1
pack $w.rf -in $w.f -side top -expand 0 -fill x
pack $w.feed -in $w.f -side top -expand 0 -fill x
pack $w.sep3 -in $w.f -side top -expand 0 -fill x -ipady 1
pack $w.eml -in $w.f -side top -expand 0 -fill x
pack $w.fsmtp -in $w.f -side top -expand 0 -fill x
pack $w.ef -in $w.f -side top -expand 0 -fill x
pack $w.sep2 -in $w.f -side top -expand 0 -fill x -ipady 1
@@ -534,6 +603,9 @@ proc ApplyOptions { w } {
global Option tmpOpt
set tmpOpt(RunCmd) [$w.cmd get]
set tmpOpt(Editor) [$w.editor get]
set tmpOpt(MailAddr) [$w.email_address get]
set tmpOpt(SMTPServer) [$w.smtp get]
# Copy working copy to real option set
foreach name [array names tmpOpt] {
set Option($name) $tmpOpt($name)
@@ -623,7 +695,7 @@ proc LoadOptions {} {
#***********************************************************************
proc ConfigureCalWindow { month year firstDay numDays } {
.h.title configure -text "$month $year"
wm title . "TkRemind - $month $year"
wm title . "$month $year - TkRemind"
wm iconname . "$month $year"
ConfigureCalFrame .cal $firstDay $numDays
}
@@ -661,10 +733,6 @@ proc FillCalWindow {} {
ConfigureCalWindow $monthName $year $firstWkday $daysInMonth
set offset [CalEntryOffset $firstWkday]
for {set i 1} {$i <= 31} {incr i} {
set didSomething($i) 0
}
set fntag "x"
while { [gets $file line] >= 0 } {
# File info
@@ -685,6 +753,13 @@ proc FillCalWindow {} {
set month [string trimleft $month 0]
set extratags ""
switch -exact -- $type {
"WEEK" {
set stuff [string trimleft $stuff]
set stuff [string trimright $stuff]
set label [expr $firstWkday + $day - 1]
.cal.l$label configure -text "$day $stuff"
continue
}
"SHADE" {
DoShadeSpecial $n $stuff
continue
@@ -723,12 +798,10 @@ proc FillCalWindow {} {
continue
}
.cal.t$n configure -state normal
if { $didSomething($day) } {
.cal.t$n insert end " .....\n"
}
set didSomething($day) 1
if {[regexp {TKTAG([0-9]+)} $tag all tagno]} {
.cal.t$n insert end [string trim $stuff] [list REM TAGGED "TKTAG$tagno" $extratags $fntag]
.cal.t$n tag bind "TKTAG$tagno" <Enter> "TaggedEnter .cal.t$n"
.cal.t$n tag bind "TKTAG$tagno" <Leave> "TaggedLeave .cal.t$n"
} else {
.cal.t$n insert end [string trim $stuff] [list REM $extratags $fntag]
}
@@ -990,11 +1063,11 @@ proc DoGoto {} {
global CurYear CurMonth MonthNames
set year [.g.y.e get]
if { ! [regexp {^[0-9]+$} $year] } {
tk_dialog .error Error {Illegal year specified (1990-2078)} error 0 Ok
tk_dialog .error Error {Illegal year specified (1990-5990)} error 0 Ok
return
}
if { $year < 1990 || $year > 2078 } {
tk_dialog .error Error {Illegal year specified (1990-2078)} error 0 Ok
if { $year < 1990 || $year > 5990 } {
tk_dialog .error Error {Illegal year specified (1990-5990)} error 0 Ok
return
}
set month [lsearch -exact $MonthNames [.g.mon cget -text]]
@@ -1034,7 +1107,7 @@ proc CreateModifyDialog {w day firstDay args} {
# Set up: Year, Month, Day, WeekdayName
global CurYear CurMonth EnglishDayNames MonthNames OptionType SkipType
global ModifyDialogResult
global ModifyDialogResult TwentyFourHourMode
set OptionType 1
set SkipType 1
@@ -1154,7 +1227,11 @@ proc CreateModifyDialog {w day firstDay args} {
checkbutton $w.timebut -text "Timed reminder at"
$w.timebut deselect
menubutton $w.timehour -text "12" -menu $w.timehour.menu -relief raised
CreateDayMenu $w.timehour 1 12 0
if {$TwentyFourHourMode} {
CreateDayMenu $w.timehour 0 23 0
} else {
CreateDayMenu $w.timehour 1 12 0
}
menubutton $w.timemin -text "00" -menu $w.timemin.menu -relief raised
menu $w.timemin.menu -tearoff 0
foreach i {00 05 10 15 20 25 30 35 40 45 50 55} {
@@ -1162,10 +1239,12 @@ proc CreateModifyDialog {w day firstDay args} {
-command "$w.timemin configure -text $i"
}
menubutton $w.ampm -text "PM" -menu $w.ampm.menu -relief raised
menu $w.ampm.menu -tearoff 0
$w.ampm.menu add command -label "AM" -command "$w.ampm configure -text {AM}"
$w.ampm.menu add command -label "PM" -command "$w.ampm configure -text {PM}"
if {!$TwentyFourHourMode} {
menubutton $w.ampm -text "PM" -menu $w.ampm.menu -relief raised
menu $w.ampm.menu -tearoff 0
$w.ampm.menu add command -label "AM" -command "$w.ampm configure -text {AM}"
$w.ampm.menu add command -label "PM" -command "$w.ampm configure -text {PM}"
}
checkbutton $w.timeadvbut -text "with"
$w.timeadvbut deselect
@@ -1184,7 +1263,11 @@ proc CreateModifyDialog {w day firstDay args} {
$w.timerep.menu add command -label $i -command "$w.timerep configure -text $i"
}
label $w.timelab2 -text "minutes"
pack $w.timebut $w.timehour $w.timemin $w.ampm $w.timeadvbut $w.timeadv $w.timelab1 $w.timerepbut $w.timerep $w.timelab2 -side left -anchor w -in $w.time
if {$TwentyFourHourMode} {
pack $w.timebut $w.timehour $w.timemin $w.timeadvbut $w.timeadv $w.timelab1 $w.timerepbut $w.timerep $w.timelab2 -side left -anchor w -in $w.time
} else {
pack $w.timebut $w.timehour $w.timemin $w.ampm $w.timeadvbut $w.timeadv $w.timelab1 $w.timerepbut $w.timerep $w.timelab2 -side left -anchor w -in $w.time
}
# SKIP TYPE
label $w.labhol -text "On holidays or weekends:"
@@ -1208,7 +1291,10 @@ proc CreateModifyDialog {w day firstDay args} {
pack $w.but$nbut -side left -anchor w -in $w.buttons -expand 1 -fill x
}
bind $w <KeyPress-Escape> "$w.but1 invoke"
bind $w <KeyPress-Escape> "$w.but1 flash; $w.but1 invoke"
if {$nbut >= 2} {
bind $w.entry <KeyPress-Return> "$w.but2 flash; $w.but2 invoke"
}
set ModifyDialogResult 0
# Center the window on the root
@@ -1240,7 +1326,7 @@ proc RemindDialogToOptions { w } {
lappend ans "-global-$winstem" [eval set $winstem]
}
"Entry" {
lappend ans "-entry-$winstem" [$win get]
lappend ans "-entry-$winstem" [string map -nocase {"\n" " "} [$win get]]
}
}
}
@@ -1259,13 +1345,20 @@ proc RemindDialogToOptions { w } {
#***********************************************************************
proc OptionsToRemindDialog { w opts } {
global OptionType SkipType repbut expbut advbut advcount
global timebut timeadvbut timerepbut
global timebut timeadvbut timerepbut TwentyFourHourMode
global dSaturday dSunday dMonday dTuesday dWednesday dThursday dFriday
set hour ""
set ampm ""
foreach {flag value} $opts {
switch -glob -- $flag {
"-text-*" {
set win [string range $flag 6 end]
$w.$win configure -text $value
catch { $w.$win configure -text $value }
if {"$flag" == "-text-ampm"} {
set ampm $value
} elseif {"$flag" == "-text-timehour"} {
set hour $value
}
}
"-global-*" {
set win [string range $flag 8 end]
@@ -1278,6 +1371,26 @@ proc OptionsToRemindDialog { w opts } {
}
}
}
if {"$hour" != ""} {
if {$TwentyFourHourMode} {
if {"$ampm" != ""} {
if {"$ampm" == "PM" && $hour < 12} {
incr hour 12;
$w.timehour configure -text $hour
}
}
} else {
if {$hour > 12} {
incr hour -12
$w.timehour configure -text $hour
$w.ampm configure -text "PM"
} else {
if {"$ampm" == ""} {
$w.ampm configure -text "AM"
}
}
}
}
}
#---------------------------------------------------------------------------
@@ -1431,7 +1544,7 @@ proc CenterWindow {w} {
# The reminder as a string.
#---------------------------------------------------------------------------
proc CreateReminder {w} {
global DidOmit
global DidOmit TwentyFourHourMode
set body [string trim [$w.entry get]]
@@ -1468,13 +1581,15 @@ proc CreateReminder {w} {
if {$timebut} {
set hour [$w.timehour cget -text]
set min [$w.timemin cget -text]
if {[$w.ampm cget -text] == "PM"} {
if {$hour < 12} {
incr hour 12
}
} else {
if {$hour == 12} {
set hour 0
if {!$TwentyFourHourMode} {
if {[$w.ampm cget -text] == "PM"} {
if {$hour < 12} {
incr hour 12
}
} else {
if {$hour == 12} {
set hour 0
}
}
}
append rem " AT $hour:$min"
@@ -1519,7 +1634,7 @@ proc CreateReminder {w} {
regsub -- {^-stdin-\([0-9]*\): } $err {} err
error "Error from Remind: $err"
}
append rem " MSG $body"
append rem " MSG " [string map -nocase {"\n" " "} $body]
return $rem
}
@@ -1694,7 +1809,7 @@ proc EditReminder {rem args} {
}
pack .edit.t -side top -fill both -expand 1
pack .edit.f -side top -fill x -expand 1
bind .edit <KeyPress-Escape> ".edit.but1 invoke"
bind .edit <KeyPress-Escape> ".edit.but1 flash; .edit.but1 invoke"
set ModifyDialogResult 0
CenterWindow .edit
tkwait visibility .edit
@@ -2070,12 +2185,15 @@ proc IssueBackgroundReminder { file time now tag } {
label $w.l -text "Reminder for $time issued at $now"
message $w.msg -width 6i -text $msg
frame $w.b
button $w.ok -text "OK" -command "destroy $w"
# Automatically shut down window after a minute if option says so
set after_token [after 60000 [list ClosePopup $w "" $Option(MailAddr) $Option(AutoClose) "" $tag $msg $time]]
wm protocol $w WM_DELETE_WINDOW [list ClosePopup $w $after_token "" 1 "" $tag $msg $time]
button $w.ok -text "OK" -command [list ClosePopup $w $after_token "" 1 "" $tag $msg $time]
if {$tag != "*"} {
button $w.nomore -text "Don't remind me again today" -command \
"destroy $w; set Ignore($tag) 1"
button $w.kill -text "Delete this reminder completely" -command \
"destroy $w; InteractiveDeleteReminder $tag"
button $w.nomore -text "Don't remind me again today" -command [list ClosePopup $w $after_token "" 1 "ignore" $tag $msg $time]
button $w.kill -text "Delete this reminder completely" -command [list ClosePopup $w $after_token "" 1 "kill" $tag $msg $time]
}
pack $w.l -side top
pack $w.msg -side top -expand 1 -fill both
@@ -2087,11 +2205,6 @@ proc IssueBackgroundReminder { file time now tag } {
CenterWindow $w
# Automatically shut down window after a minute if option says so
if {$Option(AutoClose)} {
after 60000 "catch { destroy $w }"
}
update
if {$Option(RingBell)} {
bell
@@ -2156,8 +2269,11 @@ proc main {} {
}
global AppendFile HighestTagSoFar DayNames
puts "\nTkRemind Copyright (C) 1996-1998 David F. Skoll"
puts "Copyright (C) 1999-2000 Roaring Penguin Software Inc."
catch {
puts "\nTkRemind Copyright (C) 1996-1998 David F. Skoll"
puts "Copyright (C) 1999-2008 Roaring Penguin Software Inc."
}
catch { SetFonts }
LoadOptions
CreateMoonImages
Initialize
@@ -2249,6 +2365,8 @@ proc FireEditor { w } {
return
}
}
Status "Firing up editor..."
after 1500 DisplayTime
set EditorPid [exec sh -c $editor &]
}
@@ -2590,12 +2708,13 @@ proc DoMoonSpecial { n stuff } {
3 { set image last }
}
.cal.t$n configure -state normal
.cal.t$n image create end -image $image
.cal.t$n image create 1.0 -image $image
if {$msg != ""} {
.cal.t$n insert end " $msg"
.cal.t$n insert 1.1 " $msg\n"
} else {
.cal.t$n insert 1.1 "\n"
}
.cal.t$n insert end "\n"
.cal.t$n configure -state disabled
}
#***********************************************************************
@@ -2608,7 +2727,12 @@ proc DoMoonSpecial { n stuff } {
# Displays current date and time in status window
#***********************************************************************
proc DisplayTime {} {
set msg [clock format [clock seconds] -format "%e %b %Y %I:%M%p"]
global TwentyFourHourMode
if {$TwentyFourHourMode} {
set msg [clock format [clock seconds] -format "%e %b %Y %H:%M"]
} else {
set msg [clock format [clock seconds] -format "%e %b %Y %I:%M%p"]
}
Status $msg
}
@@ -2685,7 +2809,7 @@ proc ShowTodaysReminders {} {
CenterWindow $w
# Grab the reminders
set stuff [exec -keepnewline $Remind -q -a -r $ReminderFile 2>/dev/null]
set stuff [exec -keepnewline $Remind -g -q -r $ReminderFile 2>/dev/null]
$w.text insert end $stuff
$w.text configure -state disabled
}
@@ -2708,4 +2832,53 @@ proc InteractiveDeleteReminder { tag } {
}
}
proc SendMail { recipient subject body } {
global Option
if {"$Option(MailAddr)" == ""} {
return
}
if {[catch {set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
mime::setheader $token From "Reminder Service <>"
mime::setheader $token To "<$recipient>"
mime::setheader $token Auto-Submitted "auto-generated"
smtp::sendmessage $token -originator "" -servers $Option(SMTPServer) -recipients $Option(MailAddr)} err]} {
puts stderr "ERROR sending mail: $err"
}
}
proc ClosePopup { w after_token mail_addr close_win ignore_or_kill tag reminder rem_time } {
global Ignore
if {"$after_token" != ""} {
catch { after cancel $after_token }
}
if {$close_win} {
catch { destroy $w }
}
if {"$mail_addr" != ""} {
SendMail $mail_addr "Reminder for $rem_time" "Hello,\n\nThe following reminder is scheduled for $rem_time:\n\n$reminder\nRegards,\n\nTkRemind\n"
}
if {"$ignore_or_kill" == "ignore"} {
set Ignore($tag) 1
}
if {"$ignore_or_kill" == "kill"} {
InteractiveDeleteReminder $tag
}
}
# Adjust font defaults for screen size
proc SetFonts {} {
global SetFontsWorked
set h [winfo screenheight .]
if {$h <= 480} {
# Small screen (maybe eeepc?)
font configure TkDefaultFont -size 6
font configure TkFixedFont -size 6
}
set SetFontsWorked 1
}
main

View File

@@ -1,37 +1,38 @@
# Makefile.in for REMIND
#
# $Id: Makefile.in,v 1.20 2005-04-12 13:41:54 dfs Exp $
#
VERSION=03.00.23
SHELL= /bin/sh
BETA = 1
srcdir=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
mandir=@mandir@
bindir=@bindir@
datadir=@datadir@
datarootdir=@datarootdir@
VPATH=$(srcdir)
VERSION=@VERSION@
INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
PROGS= remind rem2ps
SCRIPTS= $(srcdir)/../scripts/kall $(srcdir)/../scripts/rem \
$(srcdir)/../scripts/tkremind $(srcdir)/../scripts/cm2rem.tcl
SCRIPTS= $(srcdir)/../scripts/tkremind $(srcdir)/../scripts/cm2rem.tcl
MANS= $(srcdir)/../man/kall.1 $(srcdir)/../man/rem.1 \
$(srcdir)/../man/rem2ps.1 $(srcdir)/../man/remind.1 \
$(srcdir)/../man/tkremind.1 $(srcdir)/../man/cm2rem.1
MANS= $(srcdir)/../man/rem2ps.1 $(srcdir)/../man/remind.1 \
$(srcdir)/../man/tkremind.1 $(srcdir)/../man/cm2rem.1 \
$(srcdir)/../man/rem.1
.SUFFIXES:
.SUFFIXES: .c .o
REMINDSRCS= calendar.c dynbuf.c dorem.c dosubst.c expr.c files.c funcs.c \
globals.c hbcal.c init.c main.c moon.c omit.c queue.c sort.c \
token.c trigger.c userfns.c utils.c var.c
globals.c hbcal.c init.c main.c md5.c moon.c omit.c queue.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)
all: remind rem2ps
@@ -40,26 +41,30 @@ test: remind
sh ../tests/test-rem
.c.o:
@CC@ -c @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -DUNIX -I. -I$(srcdir) $<
@CC@ -c @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -I. -I$(srcdir) $<
rem2ps: rem2ps.o dynbuf.o
@CC@ @LDFLAGS@ -o rem2ps rem2ps.o dynbuf.o
@CC@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o
remind: $(REMINDOBJS)
@CC@ @LDFLAGS@ -o remind $(REMINDOBJS) @LIBS@
@CC@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
install: all
-mkdir -p $(bindir)
install-nostripped: all
-mkdir -p $(DESTDIR)$(bindir) || true
for prog in $(PROGS) $(SCRIPTS) ; do \
$(INSTALL_PROGRAM) $$prog $(bindir) ; \
$(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir) || exit 1; \
done
-strip $(bindir)/remind
-strip $(bindir)/rem2ps
-mkdir -p $(mandir)/man1
rm -f $(DESTDIR)$(bindir)/rem > /dev/null 2>&1 || true
ln -s remind $(DESTDIR)$(bindir)/rem
-mkdir -p $(DESTDIR)$(mandir)/man1 || true
for man in $(MANS) ; do \
$(INSTALL_DATA) $$man $(mandir)/man1 ; \
$(INSTALL_DATA) $$man $(DESTDIR)$(mandir)/man1 || exit 1; \
done
install: install-nostripped
strip $(DESTDIR)$(bindir)/remind || true
strip $(DESTDIR)$(bindir)/rem2ps || true
clean:
rm -f *.o *~ core *.bak $(PROGS)
@@ -67,22 +72,24 @@ clobber:
rm -f *.o *~ remind rem2ps test.out core *.bak
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
# distributions, etc.
# Build a tar file based on all files checked into CVS.
# Build a tar file based on all files checked into git.
distro:
ln -s .. remind-$(VERSION)
peekentry `find remind-$(VERSION) -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION).tar
ln -s . ../remind-$(VERSION)
(cd ..; git-ls-files -x .gitignore) | sed -e 's/^/remind-$(VERSION)\//' | xargs tar -C .. -cvf remind-$(VERSION).tar
gzip -f -v -9 remind-$(VERSION).tar
rm -f remind-$(VERSION)
rm -f ../remind-$(VERSION)
beta-tgz:
ln -s .. remind-$(VERSION)-BETA
peekentry `find remind-$(VERSION)-BETA -depth -follow -name 'Entries' -print` | xargs tar cvf remind-$(VERSION)-BETA.tar
gzip -f -v -9 remind-$(VERSION)-BETA.tar
rm -f remind-$(VERSION)-BETA
ln -s . ../remind-$(VERSION)-BETA-$(BETA)
(cd ..; git-ls-files -x .gitignore) | sed -e 's/^/remind-$(VERSION)-BETA-$(BETA)\//' | xargs tar -C .. -cvf remind-$(VERSION)-BETA-$(BETA).tar
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
rm -f ../remind-$(VERSION)-BETA-$(BETA)
#---------------- Stuff after this added by "make depend" -----------------

View File

@@ -1,85 +0,0 @@
#$Id: Makefile_QDOS,v 1.1 2000-03-15 16:03:57 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'.
#-----------------------------------------------------------------------------
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

View File

@@ -1,7 +0,0 @@
IGNORE=154
IGNORE=161
IGNORE=100
IGNORE=85
LINKOPT SC
LINKOPT SD
LINKOPT NOICONS

View File

@@ -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-2000 by Roaring Penguin Software Inc. */
/* */
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: amiga.c,v 1.1 2000-03-15 16:03:57 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);
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,95 +0,0 @@
# Makefile for REMIND for Borland C++
# $Id: makefile.bcc,v 1.1 2000-03-15 16:03:57 dfs Exp $
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

View File

@@ -1,74 +0,0 @@
# Makefile for REMIND for Microsoft C for MSDOS
# $Id: makefile.msc,v 1.1 2000-03-15 16:03:57 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,,,

View File

@@ -1,122 +0,0 @@
# Makefile for REMIND
#
# $Id: makefile.os2,v 1.1 2000-03-15 16:03:57 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

View File

@@ -1,67 +0,0 @@
# Makefile for REMIND for Turbo C for MSDOS
# $Id: makefile.tc,v 1.1 2000-03-15 16:03:57 dfs Exp $
CC= tcc
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

View File

@@ -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-2000 by Roaring Penguin Software Inc. */
/* */
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: os2func.c,v 1.1 2000-03-15 16:03:57 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

View File

@@ -1 +0,0 @@
NAME WINDOWCOMPAT NEWFILES

View File

@@ -1,94 +0,0 @@
# $Id: smakefile,v 1.1 2000-03-15 16:03:57 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,83 +1,31 @@
/* src/config.h.in. Generated automatically from configure.in by autoheader. */
/* $Id: config.h.in,v 1.4 2000-02-18 03:45:44 dfs Exp $ */
/* Define to empty if the keyword does not work. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if utime(file, NULL) sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the timegm function. */
#undef HAVE_TIMEGM
/* Define if you have the difftime function. */
#undef HAVE_DIFFTIME
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <glob.h> header file */
#undef HAVE_GLOB_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
#undef HAVE_GLOB
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
#undef HAVE_SETENV
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
#undef HAVE_UNSETENV
/* Define if you have the m library (-lm). */
#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"

View File

@@ -11,8 +11,6 @@
/* */
/***************************************************************/
/* $Id: custom.h,v 1.31 2005-04-12 00:59:41 dfs Exp $ */
/*---------------------------------------------------------------------*/
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
@@ -41,11 +39,11 @@
/* #define DEFAULT_PAGE {"A4", 595, 842} */
/*---------------------------------------------------------------------*/
/* DATESEP: The default date separator. North American usage is '/'; */
/* others may prefer '-'. */
/* DATESEP: The default date separator. Standard usage is '-'; */
/* others may prefer '/'. */
/*---------------------------------------------------------------------*/
#define DATESEP '/'
/* #define DATESEP '-' */
#define DATESEP '-'
/* #define DATESEP '/' */
/*---------------------------------------------------------------------*/
/* TIMESEP: The default time separator. North American usage is ':'; */
@@ -89,8 +87,7 @@
/*---------------------------------------------------------------------*/
/* WANT_U_OPTION: Comment out the next define to permanently disable */
/* the -u option. If you do this, however, remind-all.[c]sh will not */
/* work. */
/* the -u option. */
/*---------------------------------------------------------------------*/
#define WANT_U_OPTION 1
@@ -134,19 +131,16 @@
#define BASE 1990
/*---------------------------------------------------------------------*/
/* YR_RANGE: The range of years allowed. Computers with 16-bit */
/* integers can handle about 89 years worth of reminders; if */
/* you use 32-bit integers, you can handle over 5 867 000 */
/* years. Note that YR_RANGE is set to 88 rather than 89 */
/* because we can range up to the last day of the 88th year. */
/* YR_RANGE: The range of years allowed. With 32-bit signed integers, */
/* the DATETIME type can store 2^31 minutes or about 4074 years. */
/*---------------------------------------------------------------------*/
#define YR_RANGE 88
#define YR_RANGE 4000
/*---------------------------------------------------------------------*/
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
/* 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 */
@@ -154,6 +148,12 @@
/*---------------------------------------------------------------------*/
#define MAX_PRT_LEN 40
/*---------------------------------------------------------------------*/
/* MAX_STR_LEN: If non-zero, Remind will limit the maximum length */
/* of string values to avoid eating up all of memory... */
/*---------------------------------------------------------------------*/
#define MAX_STR_LEN 65535
/*---------------------------------------------------------------------*/
/* OP_STACK_SIZE: The size of the operator stack for expr. parsing */
/*---------------------------------------------------------------------*/
@@ -167,7 +167,7 @@
/*---------------------------------------------------------------------*/
/* 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 */
@@ -175,35 +175,20 @@
/*---------------------------------------------------------------------*/
#define IF_NEST (4*sizeof(unsigned int))
/*---------------------------------------------------------------------*/
/* Do we handle queued reminders? */
/*---------------------------------------------------------------------*/
#if defined(UNIX) || defined(__OS2__)
#define HAVE_QUEUED 1
#endif
/*---------------------------------------------------------------------*/
/* Does our C compiler have prototypes? Override this test if you */
/* are using a non-ANSI compiler that nevertheless has prototypes. */
/*---------------------------------------------------------------------*/
#if defined(__STDC__) || defined(__TURBOC__) || defined(__BORLANDC__)
#define HAVE_PROTOS 1
#endif
/*---------------------------------------------------------------------*/
/* How many attempts to resolve a weird date spec? */
/*---------------------------------------------------------------------*/
#define TRIG_ATTEMPTS 25
#define TRIG_ATTEMPTS 50
/*---------------------------------------------------------------------*/
/* 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? */
/*---------------------------------------------------------------------*/
#define MAX_PARTIAL_OMITS 75
#define MAX_PARTIAL_OMITS 250
/*---------------------------------------------------------------------*/
/* A newline - some systems need "\n\r" */
@@ -222,12 +207,9 @@
/*---------------------------------------------------------------------*/
/* TAG_LEN: The maximum length of tags. Don't change it */
/*---------------------------------------------------------------------*/
#define TAG_LEN 32
#define TAG_LEN 48
#define PASSTHRU_LEN 24
#define PUBLIC
#define PRIVATE static
#define PASSTHRU_LEN 32
#define PSBEGIN "# rem2ps begin"
#define PSEND "# rem2ps end"

View File

@@ -11,8 +11,6 @@
/* */
/***************************************************************/
/* $Id: custom.h.in,v 1.7 2000-02-18 03:45:46 dfs Exp $ */
/*---------------------------------------------------------------------*/
/* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */
/* LON_DEG, LON_MIN and LON_SEC: Longitude of your location */
@@ -41,11 +39,11 @@
/* #define DEFAULT_PAGE {"A4", 595, 842} */
/*---------------------------------------------------------------------*/
/* DATESEP: The default date separator. North American usage is '/'; */
/* others may prefer '-'. */
/* DATESEP: The default date separator. Standard usage is '-'; */
/* others may prefer '/'. */
/*---------------------------------------------------------------------*/
#define DATESEP '/'
/* #define DATESEP '-' */
#define DATESEP '-'
/* #define DATESEP '/' */
/*---------------------------------------------------------------------*/
/* TIMESEP: The default time separator. North American usage is ':'; */
@@ -89,8 +87,7 @@
/*---------------------------------------------------------------------*/
/* WANT_U_OPTION: Comment out the next define to permanently disable */
/* the -u option. If you do this, however, remind-all.[c]sh will not */
/* work. */
/* the -u option. */
/*---------------------------------------------------------------------*/
#define WANT_U_OPTION 1
@@ -134,19 +131,16 @@
#define BASE 1990
/*---------------------------------------------------------------------*/
/* YR_RANGE: The range of years allowed. Computers with 16-bit */
/* integers can handle about 89 years worth of reminders; if */
/* you use 32-bit integers, you can handle over 5 867 000 */
/* years. Note that YR_RANGE is set to 88 rather than 89 */
/* because we can range up to the last day of the 88th year. */
/* YR_RANGE: The range of years allowed. With 32-bit signed integers, */
/* the DATETIME type can store 2^31 minutes or about 4074 years. */
/*---------------------------------------------------------------------*/
#define YR_RANGE 88
#define YR_RANGE 4000
/*---------------------------------------------------------------------*/
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
/* 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 */
@@ -154,6 +148,12 @@
/*---------------------------------------------------------------------*/
#define MAX_PRT_LEN 40
/*---------------------------------------------------------------------*/
/* MAX_STR_LEN: If non-zero, Remind will limit the maximum length */
/* of string values to avoid eating up all of memory... */
/*---------------------------------------------------------------------*/
#define MAX_STR_LEN 65535
/*---------------------------------------------------------------------*/
/* OP_STACK_SIZE: The size of the operator stack for expr. parsing */
/*---------------------------------------------------------------------*/
@@ -167,7 +167,7 @@
/*---------------------------------------------------------------------*/
/* 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 */
@@ -175,35 +175,20 @@
/*---------------------------------------------------------------------*/
#define IF_NEST (4*sizeof(unsigned int))
/*---------------------------------------------------------------------*/
/* Do we handle queued reminders? */
/*---------------------------------------------------------------------*/
#if defined(UNIX) || defined(__OS2__)
#define HAVE_QUEUED 1
#endif
/*---------------------------------------------------------------------*/
/* Does our C compiler have prototypes? Override this test if you */
/* are using a non-ANSI compiler that nevertheless has prototypes. */
/*---------------------------------------------------------------------*/
#if defined(__STDC__) || defined(__TURBOC__) || defined(__BORLANDC__)
#define HAVE_PROTOS 1
#endif
/*---------------------------------------------------------------------*/
/* How many attempts to resolve a weird date spec? */
/*---------------------------------------------------------------------*/
#define TRIG_ATTEMPTS 25
#define TRIG_ATTEMPTS 50
/*---------------------------------------------------------------------*/
/* 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? */
/*---------------------------------------------------------------------*/
#define MAX_PARTIAL_OMITS 75
#define MAX_PARTIAL_OMITS 250
/*---------------------------------------------------------------------*/
/* A newline - some systems need "\n\r" */
@@ -222,12 +207,9 @@
/*---------------------------------------------------------------------*/
/* TAG_LEN: The maximum length of tags. Don't change it */
/*---------------------------------------------------------------------*/
#define TAG_LEN 32
#define TAG_LEN 48
#define PASSTHRU_LEN 24
#define PUBLIC
#define PRIVATE static
#define PASSTHRU_LEN 32
#define PSBEGIN "# rem2ps begin"
#define PSEND "# rem2ps end"

View File

@@ -13,19 +13,11 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: dorem.c,v 1.10 2005-04-12 01:49:45 dfs Exp $";
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "globals.h"
#include "err.h"
@@ -33,20 +25,16 @@ static char const RCSID[] = "$Id: dorem.c,v 1.10 2005-04-12 01:49:45 dfs Exp $";
#include "protos.h"
#include "expr.h"
/* Define the shell characters to escape */
static char const EscapeMe[] =
#ifdef QDOS
"\"'!$%^&*()|<>[]{}\x9F~;?\\";
#else
"\"'!$%^&*()|<>[]{}`~;?\\";
#endif
/* Define the shell characters not to escape */
static char const DontEscapeMe[] =
"1234567890_-=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@.,";
PRIVATE int ParseTimeTrig ARGS ((ParsePtr s, TimeTrig *tim));
PRIVATE int ParseLocalOmit ARGS ((ParsePtr s, Trigger *t));
PRIVATE int ParseScanFrom ARGS ((ParsePtr s, Trigger *t));
PRIVATE int ParsePriority ARGS ((ParsePtr s, Trigger *t));
PRIVATE int ParseUntil ARGS ((ParsePtr s, Trigger *t));
PRIVATE int ShouldTriggerBasedOnWarn ARGS ((Trigger *t, int jul));
static int ParseTimeTrig (ParsePtr s, TimeTrig *tim, int save_in_globals);
static int ParseLocalOmit (ParsePtr s, Trigger *t);
static int ParseScanFrom (ParsePtr s, Trigger *t, int type);
static int ParsePriority (ParsePtr s, Trigger *t);
static int ParseUntil (ParsePtr s, Trigger *t);
static int ShouldTriggerBasedOnWarn (Trigger *t, int jul, int *err);
/***************************************************************/
/* */
@@ -55,17 +43,12 @@ PRIVATE int ShouldTriggerBasedOnWarn ARGS ((Trigger *t, int jul));
/* Do the REM command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoRem(ParsePtr p)
#else
int DoRem(p)
ParsePtr p;
#endif
int DoRem(ParsePtr p)
{
Trigger trig;
TimeTrig tim;
int r;
int r, err;
int jul;
DynamicBuffer buf;
Token tok;
@@ -73,12 +56,13 @@ ParsePtr p;
DBufInit(&buf);
/* Parse the trigger date and time */
if ( (r=ParseRem(p, &trig, &tim)) ) return r;
if ( (r=ParseRem(p, &trig, &tim, 1)) ) return r;
if (trig.typ == NO_TYPE) return E_EOLN;
if (trig.typ == SAT_TYPE) {
r=DoSatRemind(&trig, &tim, p);
if (r) return r;
if (!LastTrigValid) return OK;
r=ParseToken(p, &buf);
if (r) return r;
FindToken(DBufValue(&buf), &tok);
@@ -106,12 +90,11 @@ ParsePtr p;
if (!LastTrigValid) return OK;
} else {
/* Calculate the trigger date */
jul = ComputeTrigger(trig.scanfrom, &trig, &r);
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 1);
if (r) return r;
}
/* Queue the reminder, if necessary */
#ifdef HAVE_QUEUED
if (jul == JulianToday &&
!(!IgnoreOnce &&
trig.once != NO_ONCE &&
@@ -119,15 +102,9 @@ ParsePtr p;
QueueReminder(p, &trig, &tim, trig.sched);
/* If we're in daemon mode, do nothing over here */
if (Daemon) return OK;
#endif
if (ShouldTriggerReminder(&trig, &tim, jul)) {
#ifdef OS2_POPUP
if ( (r=TriggerReminder(p, &trig, &tim, jul, 0)) )
#else
if ( (r=TriggerReminder(p, &trig, &tim, jul)) )
#endif
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
if ( (r=TriggerReminder(p, &trig, &tim, jul)) )
{
return r;
}
@@ -144,14 +121,7 @@ ParsePtr p;
/* trigger structure. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
#else
int ParseRem(s, trig, tim)
ParsePtr s;
Trigger *trig;
TimeTrig *tim;
#endif
int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
{
register int r;
DynamicBuffer buf;
@@ -175,11 +145,16 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
trig->priority = DefaultPrio;
trig->sched[0] = 0;
trig->warn[0] = 0;
trig->omitfunc[0] = 0;
trig->tag[0] = 0;
trig->passthru[0] = 0;
tim->ttime = NO_TIME;
tim->delta = NO_DELTA;
tim->rep = NO_REP;
tim->duration = NO_TIME;
if (save_in_globals) {
LastTriggerTime = NO_TIME;
}
while(1) {
/* Read space-delimited string */
@@ -215,13 +190,13 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
case T_At:
DBufFree(&buf);
r=ParseTimeTrig(s, tim);
r=ParseTimeTrig(s, tim, save_in_globals);
if (r) return r;
break;
case T_Scanfrom:
DBufFree(&buf);
r=ParseScanFrom(s, trig);
r=ParseScanFrom(s, trig, tok.val);
if (r) return r;
break;
@@ -285,6 +260,10 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
case T_Omit:
DBufFree(&buf);
if (trig->omitfunc[0]) {
Eprint("Warning: OMIT is ignored if you use OMITFUNC");
}
r = ParseLocalOmit(s, trig);
if (r) return r;
break;
@@ -294,6 +273,16 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
if (trig->scanfrom == NO_DATE) trig->scanfrom = JulianToday;
return OK;
case T_OmitFunc:
if (trig->localomit) {
Eprint("Warning: OMIT is ignored if you use OMITFUNC");
}
r=ParseToken(s, &buf);
if (r) return r;
StrnCpy(trig->omitfunc, DBufValue(&buf), VAR_NAME_LEN);
DBufFree(&buf);
break;
case T_Warn:
r=ParseToken(s, &buf);
if(r) return r;
@@ -314,6 +303,7 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
DBufFree(&buf);
switch(tok.type) {
case T_Time:
case T_LongTime:
tim->duration = tok.val;
break;
default:
@@ -328,6 +318,11 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
DBufFree(&buf);
break;
case T_LongTime:
DBufFree(&buf);
return E_BAD_TIME;
break;
default:
PushToken(DBufValue(&buf), s);
DBufFree(&buf);
@@ -344,13 +339,7 @@ PUBLIC int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
/* ParseTimeTrig - parse the AT part of a timed reminder */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
#else
static int ParseTimeTrig(s, tim)
ParsePtr s;
TimeTrig *tim;
#endif
static int ParseTimeTrig(ParsePtr s, TimeTrig *tim, int save_in_globals)
{
Token tok;
int r;
@@ -382,7 +371,9 @@ PRIVATE int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
if (tim->ttime == NO_TIME) return E_EXPECT_TIME;
/* Save trigger time in global variable */
LastTriggerTime = tim->ttime;
if (save_in_globals) {
LastTriggerTime = tim->ttime;
}
PushToken(DBufValue(&buf), s);
DBufFree(&buf);
return OK;
@@ -396,13 +387,7 @@ PRIVATE int ParseTimeTrig(ParsePtr s, TimeTrig *tim)
/* reminder. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int ParseLocalOmit(ParsePtr s, Trigger *t)
#else
static int ParseLocalOmit(s, t)
ParsePtr s;
Trigger *t;
#endif
static int ParseLocalOmit(ParsePtr s, Trigger *t)
{
Token tok;
int r;
@@ -432,13 +417,7 @@ PRIVATE int ParseLocalOmit(ParsePtr s, Trigger *t)
/* ParseUntil - parse the UNTIL portion of a reminder */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int ParseUntil(ParsePtr s, Trigger *t)
#else
static int ParseUntil(s, t)
ParsePtr s;
Trigger *t;
#endif
static int ParseUntil(ParsePtr s, Trigger *t)
{
int y = NO_YR,
m = NO_MON,
@@ -503,16 +482,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
PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
#else
static int ParseScanFrom(s, t)
ParsePtr s;
Trigger *t;
#endif
static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
{
int y = NO_YR,
m = NO_MON,
@@ -521,7 +494,14 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
Token tok;
int r;
DynamicBuffer buf;
char const *word;
DBufInit(&buf);
if (type == SCANFROM_TYPE) {
word = "SCANFROM";
} else {
word = "FROM";
}
if (t->scanfrom != NO_DATE) return E_SCAN_TWICE;
@@ -533,7 +513,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
case T_Year:
DBufFree(&buf);
if (y != NO_YR) {
Eprint("SCANFROM: %s", ErrMsg[E_YR_TWICE]);
Eprint("%s: %s", word, ErrMsg[E_YR_TWICE]);
return E_YR_TWICE;
}
y = tok.val;
@@ -542,7 +522,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
case T_Month:
DBufFree(&buf);
if (m != NO_MON) {
Eprint("SCANFROM: %s", ErrMsg[E_MON_TWICE]);
Eprint("%s: %s", word, ErrMsg[E_MON_TWICE]);
return E_MON_TWICE;
}
m = tok.val;
@@ -551,7 +531,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
case T_Day:
DBufFree(&buf);
if (d != NO_DAY) {
Eprint("SCANFROM: %s", ErrMsg[E_DAY_TWICE]);
Eprint("%s: %s", word, ErrMsg[E_DAY_TWICE]);
return E_DAY_TWICE;
}
d = tok.val;
@@ -559,7 +539,7 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
default:
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);
return E_INCOMPLETE;
}
@@ -568,6 +548,12 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
return E_BAD_DATE;
}
t->scanfrom = Julian(y, m, d);
if (type == FROM_TYPE) {
if (t->scanfrom < JulianToday) {
t->scanfrom = JulianToday;
}
}
PushToken(DBufValue(&buf), s);
DBufFree(&buf);
return OK;
@@ -581,57 +567,53 @@ PRIVATE int ParseScanFrom(ParsePtr s, Trigger *t)
/* Trigger the reminder if it's a RUN or MSG type. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
#ifdef OS2_POPUP
PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
int AsPopUp)
#else /* ! OS2_POPUP */
PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
#endif /* OS2_POPUP */
#else /* ! HAVE_PROTOS */
#ifdef OS2_POPUP
int TriggerReminder(p, t, tim, jul, AsPopUp)
ParsePtr p;
Trigger *t;
TimeTrig *tim;
int jul;
int AsPopUp;
#else /* ! OS2_POPUP */
int TriggerReminder(p, t, tim, jul)
ParsePtr p;
Trigger *t;
TimeTrig *tim;
int jul;
#endif /* OS2_POPUP */
#endif /* HAVE_PROTOS */
int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
{
int r, y, m, d;
char PrioExpr[25];
DynamicBuffer buf;
char *s;
char PrioExpr[VAR_NAME_LEN+25];
char tmpBuf[64];
DynamicBuffer buf, calRow;
DynamicBuffer pre_buf;
char const *s;
Value v;
DBufInit(&buf);
DBufInit(&calRow);
DBufInit(&pre_buf);
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 == PS_TYPE ||
t->typ == PSF_TYPE)
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 ((t->typ == MSG_TYPE || t->typ == MSF_TYPE)
&& !NumTriggered && !NextMode && !MsgCommand) {
if (!DoSubstFromString(DBufValue(&Banner), &buf,
JulianToday, NO_TIME) &&
DBufLen(&buf)) {
#ifdef OS2_POPUP
if (AsPopUp)
PutlPopUp(DBufValue(&buf));
else
printf("%s\n", DBufValue(&buf));
#else
printf("%s\n", DBufValue(&buf));
#endif
}
DBufFree(&buf);
}
@@ -642,28 +624,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 (!DBufLen(&buf)) {
DBufFree(&buf);
DBufFree(&pre_buf);
return OK;
}
FromJulian(jul, &y, &m, &d);
#ifdef OS2_POPUP
if (AsPopUp) {
char tmpBuf[64];
sprintf(tmpBuf, "%04d%c%02d%c%02d %s", y, DATESEP, m+1, DATESEP, d,
SimpleTime(tim->ttime));
StartPopUp();
PutsPopUp(tmpBuf);
PutlPopUp(DBufValue(&buf));
}
else
printf("%04d%c%02d%c%02d %s%s\n", y, DATESEP, m+1, DATESEP, d,
SimpleTime(tim->ttime),
DBufValue(&buf));
#else
printf("%04d%c%02d%c%02d %s%s\n", y, DATESEP, m+1, DATESEP, d,
SimpleTime(tim->ttime),
DBufValue(&buf));
#endif
sprintf(tmpBuf, "%04d/%02d/%02d ", y, m+1, d);
if (DBufPuts(&calRow, tmpBuf) != OK) {
DBufFree(&calRow);
DBufFree(&pre_buf);
return E_NO_MEM;
}
/* If DoSimpleCalendar==1, output *all* simple calendar fields */
if (DoSimpleCalendar) {
/* ignore passthru field when in NextMode */
if (DBufPuts(&calRow, "* ") != OK) {
DBufFree(&calRow);
DBufFree(&pre_buf);
return E_NO_MEM;
}
if (t->tag[0]) {
sprintf(tmpBuf, "%s ", t->tag);
} else {
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(&pre_buf);
DBufFree(&calRow);
return OK;
}
@@ -720,32 +739,16 @@ PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
reminder now. */
switch(t->typ) {
case MSG_TYPE:
case PASSTHRU_TYPE:
if (MsgCommand) {
DoMsgCommand(MsgCommand, DBufValue(&buf));
} else {
#ifdef OS2_POPUP
if (AsPopUp)
PutlPopUp(DBufValue(&buf));
else
printf("%s", DBufValue(&buf));
#else
printf("%s", DBufValue(&buf));
#endif
}
break;
case MSF_TYPE:
#ifdef OS2_POPUP
if (AsPopUp) {
StartPopUp();
FillParagraph(DBufValue(&buf), 1);
EndPopUp();
} else {
FillParagraph(DBufValue(&buf), 0);
}
#else
FillParagraph(DBufValue(&buf));
#endif
break;
case RUN_TYPE:
@@ -760,7 +763,7 @@ PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
DBufFree(&buf);
NumTriggered++;
return OK;
}
}
/***************************************************************/
/* */
@@ -768,35 +771,23 @@ PUBLIC int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
/* */
/* Return 1 if we should trigger a reminder, based on today's */
/* date and the trigger. Return 0 if reminder should not be */
/* triggered. */
/* triggered. Sets *err non-zero in event of an error. */
/* */
/***************************************************************/
#ifdef __TURBOC__
#pragma argsused
#endif
#ifdef HAVE_PROTOS
PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
#else
int ShouldTriggerReminder(t, tim, jul)
Trigger *t;
TimeTrig *tim;
int jul;
#endif
int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err)
{
int r;
int r, omit;
*err = 0;
/* Handle the ONCE modifier in the reminder. */
if (!IgnoreOnce && t->once !=NO_ONCE && FileAccessDate == JulianToday)
return 0;
if (jul < JulianToday) return 0;
/* Don't trigger timed reminders if DontIssueAts is true, and if the
reminder is for today */
#ifdef HAVE_QUEUED
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0;
#endif
/* Don't trigger "old" timed reminders */
/*** REMOVED...
@@ -810,7 +801,12 @@ PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
/* If there's a "warn" function, it overrides any deltas */
if (t->warn[0] != 0) {
return ShouldTriggerBasedOnWarn(t, jul);
if (DeltaOffset) {
if (jul <= JulianToday + DeltaOffset) {
return 1;
}
}
return ShouldTriggerBasedOnWarn(t, jul, err);
}
/* Move back by delta days, if any */
@@ -819,15 +815,28 @@ PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
jul = jul + t->delta;
else {
r = t->delta;
while(r && jul > JulianToday) {
int iter = 0;
int max = MaxSatIter;
if (max < r*2) max = r*2;
while(iter++ < max) {
if (!r || (jul <= JulianToday)) {
break;
}
jul--;
if (!IsOmitted(jul, t->localomit)) r--;
*err = IsOmitted(jul, t->localomit, t->omitfunc, &omit);
if (*err) return 0;
if (!omit) r--;
}
if (iter > max) {
*err = E_CANT_TRIG;
Eprint("Delta: Bad OMITFUNC? %s", ErrMsg[E_CANT_TRIG]);
return 0;
}
}
}
/* Should we trigger the reminder? */
return (jul <= JulianToday);
return (jul <= JulianToday + DeltaOffset);
}
/***************************************************************/
@@ -837,30 +846,24 @@ PUBLIC int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul)
/* Do the "satisfying..." remind calculation. */
/* */
/***************************************************************/
#ifdef __TURBOC__
#pragma argsused
#endif
#ifdef HAVE_PROTOS
PUBLIC int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
#else
int DoSatRemind(trig, tim, p)
Trigger *trig;
TimeTrig *tim;
ParsePtr p;
#endif
int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
{
int iter, jul, r;
Value v;
char *s, *t;
char const *s;
char const *t;
t = p->pos;
iter = 0;
jul = trig->scanfrom;
while (iter++ < MaxSatIter) {
jul = ComputeTrigger(jul, trig, &r);
jul = ComputeTrigger(jul, trig, &r, 1);
if (r) {
if (r == E_CANT_TRIG) return OK; else return r;
}
if (jul == -1) {
return OK;
}
s = p->pos;
r = EvaluateExpr(p, &v);
t = p->pos;
@@ -881,16 +884,10 @@ PUBLIC int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
/* ParsePriority - parse the PRIORITY portion of a reminder */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int ParsePriority(ParsePtr s, Trigger *t)
#else
static int ParsePriority(s, t)
ParsePtr s;
Trigger *t;
#endif
static int ParsePriority(ParsePtr s, Trigger *t)
{
int p, r;
char *u;
char const *u;
DynamicBuffer buf;
DBufInit(&buf);
@@ -928,28 +925,21 @@ PRIVATE int ParsePriority(ParsePtr s, Trigger *t)
/* Execute the '-k' command, escaping shell chars in message. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoMsgCommand(char *cmd, char *msg)
#else
int DoMsgCommand(cmd, msg)
char *cmd;
char *msg;
#endif
int DoMsgCommand(char const *cmd, char const *msg)
{
int r;
int i, l;
DynamicBuffer execBuffer;
#ifdef WANT_SHELL_ESCAPING
DynamicBuffer buf;
char *s;
char const *s;
DBufInit(&buf);
DBufInit(&execBuffer);
/* Escape shell characters in msg INCLUDING WHITESPACE! */
for (s=msg; *s; s++) {
if (isspace(*s) || strchr(EscapeMe, *s)) {
if (isspace(*s) || !strchr(DontEscapeMe, *s)) {
if (DBufPutc(&buf, '\\') != OK) {
r = E_NO_MEM;
goto finished;
@@ -961,12 +951,9 @@ PUBLIC int DoMsgCommand(char *cmd, char *msg)
}
}
msg = DBufValue(&buf);
#else
DBufInit(&execBuffer);
#endif
/* Do "%s" substitution */
l = strlen(cmd)-1;
l = strlen(cmd);
for (i=0; i<l; i++) {
if (cmd[i] == '%' && cmd[i+1] == 's') {
++i;
@@ -981,19 +968,12 @@ PUBLIC int DoMsgCommand(char *cmd, char *msg)
}
}
}
if (l >= 0 && DBufPutc(&execBuffer, cmd[l]) != OK) {
r = E_NO_MEM;
goto finished;
}
r = OK;
system(DBufValue(&execBuffer));
finished:
#ifdef WANT_SHELL_ESCAPING
DBufFree(&buf);
#endif
DBufFree(&execBuffer);
return r;
}
@@ -1006,18 +986,12 @@ finished:
/* function. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int ShouldTriggerBasedOnWarn(Trigger *t, int jul)
#else
static int ShouldTriggerBasedOnWarn(t, jul)
Trigger *t;
int jul;
#endif
static int ShouldTriggerBasedOnWarn(Trigger *t, int jul, int *err)
{
char buffer[VAR_NAME_LEN+32];
int i;
char *s;
int r;
char const *s;
int r, omit;
Value v;
int lastReturnVal = 0; /* Silence compiler warning */
@@ -1055,9 +1029,21 @@ PRIVATE int ShouldTriggerBasedOnWarn(Trigger *t, int jul)
if (JulianToday + v.v.val == jul) return 1;
} else {
int j = jul;
while (v.v.val) {
int iter = 0;
int max = MaxSatIter;
if (max < v.v.val * 2) max = v.v.val*2;
while(iter++ <= max) {
j--;
if (!IsOmitted(j, t->localomit)) v.v.val++;
*err = IsOmitted(j, t->localomit, t->omitfunc, &omit);
if (*err) return 0;
if (!omit) v.v.val++;
if (!v.v.val) {
break;
}
}
if (iter > max) {
Eprint("Delta: Bad OMITFUNC? %s", ErrMsg[E_CANT_TRIG]);
return 0;
}
if (j == JulianToday) return 1;
}

View File

@@ -12,20 +12,12 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: dosubst.c,v 1.10 2000-02-18 03:45:48 dfs Exp $";
#define L_IN_DOSUBST
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "globals.h"
#include "err.h"
@@ -50,18 +42,10 @@ static char TOMORROW[] = L_TOMORROW;
/* Process the % escapes in the reminder. If */
/* mode==NORMAL_MODE, ignore the %" sequence. If */
/* mode==CAL_MODE, process the %" sequence. */
/* If mode==ADVANCE_MODE, ignore %" but don't add newline */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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 DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode)
{
int diff = jul - JulianToday;
int curtime = SystemTime(0) / 60;
@@ -70,11 +54,12 @@ int jul, mode;
int d, m, y;
int tim = tt->ttime;
int h, min, hh, ch, cmin, chh;
char *pm, *cpm;
char const *pm, *cpm;
int tdiff, adiff, mdiff, hdiff;
char *mplu, *hplu, *when, *plu;
char const *mplu, *hplu, *when, *plu;
int has_quote = 0;
char *ss, *os;
char *ss;
char *os;
char s[256];
int origLen = DBufLen(dbuf);
@@ -92,14 +77,14 @@ int jul, mode;
mplu = (mdiff == 1 ? "" : L_MPLU);
#endif /* L_MPLU_OVER */
#ifdef L_HPLU_OVER
#ifdef L_HPLU_OVER
L_HPLU_OVER
#else /* L_HPLU_OVER */
hplu = (hdiff == 1 ? "" : L_HPLU);
#endif /* L_HPLU_OVER */
when = (tdiff < 0 ? L_AGO : L_FROMNOW);
h = tim / 60;
min = tim % 60;
@@ -109,7 +94,7 @@ int jul, mode;
pm = (h < 12) ? L_AM : L_PM;
#endif
hh = (h == 12) ? 12 : h % 12;
ch = curtime / 60;
cmin = curtime % 60;
@@ -127,17 +112,17 @@ int jul, mode;
case 1:
case 21:
case 31: plu = "st"; break;
case 2:
case 22: plu = "nd"; break;
case 3:
case 23: plu = "rd"; break;
default: plu = "th"; break;
}
#endif
#endif
while(1) {
c = ParseChar(p, &err, 0);
if (err) {
@@ -146,7 +131,8 @@ int jul, mode;
}
if (c == '\n') continue;
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;
}
break;
@@ -168,10 +154,10 @@ int jul, mode;
if (diff <= 1) {
switch(UPPER(c)) {
#ifndef L_NOTOMORROW_A
case 'A':
case 'A':
#endif
#ifndef L_NOTOMORROW_B
case 'B':
case 'B':
#endif
#ifndef L_NOTOMORROW_C
case 'C':
@@ -210,35 +196,35 @@ int jul, mode;
SHIP_OUT(s);
done = 1;
break;
default: done = 0;
default: done = 0;
}
}
if (!done) switch(UPPER(c)) {
case 'A':
#ifdef L_A_OVER
L_A_OVER
#else
#else
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
MonthName[m], y);
#endif
SHIP_OUT(s);
SHIP_OUT(s);
break;
case 'B':
#ifdef L_B_OVER
L_B_OVER
#else
#else
sprintf(s, L_INXDAYS, diff);
#endif
SHIP_OUT(s);
break;
break;
case 'C':
#ifdef L_C_OVER
L_C_OVER
#else
#else
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
#endif
SHIP_OUT(s);
@@ -247,7 +233,7 @@ int jul, mode;
case 'D':
#ifdef L_D_OVER
L_D_OVER
#else
#else
sprintf(s, "%d", d);
#endif
SHIP_OUT(s);
@@ -256,9 +242,9 @@ int jul, mode;
case 'E':
#ifdef L_E_OVER
L_E_OVER
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DATESEP,
m+1, DATESEP, y);
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DateSep,
m+1, DateSep, y);
#endif
SHIP_OUT(s);
break;
@@ -266,8 +252,8 @@ int jul, mode;
case 'F':
#ifdef L_F_OVER
L_F_OVER
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DATESEP, d, DATESEP, y);
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DateSep, d, DateSep, y);
#endif
SHIP_OUT(s);
break;
@@ -275,7 +261,7 @@ int jul, mode;
case 'G':
#ifdef L_G_OVER
L_G_OVER
#else
#else
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
#endif
SHIP_OUT(s);
@@ -284,8 +270,8 @@ int jul, mode;
case 'H':
#ifdef L_H_OVER
L_H_OVER
#else
sprintf(s, "%s %02d%c%02d", L_ON, d, DATESEP, m+1);
#else
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
#endif
SHIP_OUT(s);
break;
@@ -293,8 +279,8 @@ int jul, mode;
case 'I':
#ifdef L_I_OVER
L_I_OVER
#else
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DATESEP, d);
#else
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
#endif
SHIP_OUT(s);
break;
@@ -323,7 +309,7 @@ int jul, mode;
#ifdef L_L_OVER
L_L_OVER
#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
SHIP_OUT(s);
break;
@@ -461,9 +447,9 @@ int jul, mode;
#ifdef L_1_OVER
L_1_OVER
#else
if (tdiff == 0)
if (tdiff == 0)
sprintf(s, "%s", L_NOW);
else if (hdiff == 0)
else if (hdiff == 0)
sprintf(s, "%d %s%s %s", mdiff, L_MINUTE, mplu, when);
else if (mdiff == 0)
sprintf(s, "%d %s%s %s", hdiff, L_HOUR, hplu, when);
@@ -478,7 +464,7 @@ int jul, mode;
#ifdef L_2_OVER
L_2_OVER
#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
SHIP_OUT(s);
break;
@@ -488,7 +474,7 @@ int jul, mode;
L_3_OVER
#else
sprintf(s, "%s %02d%c%02d", L_AT, h, TIMESEP, min);
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
#endif
SHIP_OUT(s);
break;
@@ -569,7 +555,7 @@ int jul, mode;
#ifdef L_AT_OVER
L_AT_OVER
#else
sprintf(s, "%d%c%02d%s", chh, TIMESEP, cmin, cpm);
sprintf(s, "%d%c%02d%s", chh, TimeSep, cmin, cpm);
#endif
SHIP_OUT(s);
break;
@@ -578,15 +564,15 @@ int jul, mode;
#ifdef L_HASH_OVER
L_HASH_OVER
#else
sprintf(s, "%02d%c%02d", ch, TIMESEP, cmin);
sprintf(s, "%02d%c%02d", ch, TimeSep, cmin);
#endif
SHIP_OUT(s);
break;
case '_':
if (mode != CAL_MODE && !MsgCommand)
case '_':
if (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)
sprintf(s, "%s", NL);
else
else
sprintf(s, " ");
SHIP_OUT(s);
break;
@@ -617,7 +603,7 @@ int jul, mode;
/* If there are NO quotes, then: If CAL_MODE && RUN_TYPE, we don't want the
reminder in the calendar. Zero the output buffer and quit. */
if (!has_quote) {
if (mode == CAL_MODE && t->typ == RUN_TYPE) {
if ((mode == ADVANCE_MODE || mode == CAL_MODE) && t->typ == RUN_TYPE) {
*DBufValue(dbuf) = 0;
dbuf->len = 0;
}
@@ -629,7 +615,7 @@ int jul, mode;
ss = DBufValue(dbuf) + origLen;
os = ss;
if (mode == NORMAL_MODE) {
if (mode == NORMAL_MODE || mode == ADVANCE_MODE) {
while (*ss) {
if (*ss != QUOTE_MARKER) *os++ = *ss;
ss++;
@@ -653,7 +639,7 @@ int jul, mode;
return OK;
}
/***************************************************************/
/* */
@@ -664,16 +650,8 @@ int jul, mode;
/* default triggers and a mode of NORMAL_MODE. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoSubstFromString(char *source, DynamicBuffer *dbuf,
int DoSubstFromString(char const *source, DynamicBuffer *dbuf,
int jul, int tim)
#else
int DoSubstFromString(source, dbuf, jul, tim)
char *source;
DynamicBuffer *dbuf;
int jul;
int tim;
#endif
{
Trigger tempTrig;
TimeTrig tempTime;
@@ -686,7 +664,7 @@ int tim;
tempP.allownested = 0;
tempTrig.typ = MSG_TYPE;
tempTime.ttime = tim;
r = DoSubst(&tempP, dbuf, &tempTrig, &tempTime, jul, NORMAL_MODE);
DestroyParser(&tempP);
return r;

View File

@@ -11,21 +11,11 @@
/* */
/***************************************************************/
static char const RCSID[] =
"$Id: dynbuf.c,v 1.5 2000-02-18 03:45:49 dfs Exp $";
#include "config.h"
#include "dynbuf.h"
#include "err.h"
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
/**********************************************************************
%FUNCTION: DBufMakeRoom
@@ -38,13 +28,7 @@ static char const RCSID[] =
Doubles the size of dynamic buffer until it has room for at least
'n' characters, not including trailing '\0'
**********************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int DBufMakeRoom(DynamicBuffer *dbuf, int n)
#else
static int DBufMakeRoom(dbuf, n)
DynamicBuffer *dbuf;
int n;
#endif
static int DBufMakeRoom(DynamicBuffer *dbuf, int n)
{
/* Double size until it's greater than n (strictly > to leave room
for trailing '\0' */
@@ -58,7 +42,7 @@ int n;
}
/* Allocate memory */
buf = (char *) malloc(size);
buf = malloc(size);
if (!buf) return E_NO_MEM;
/* Copy contents */
@@ -80,12 +64,7 @@ int n;
%DESCRIPTION:
Initializes a dynamic buffer
**********************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void DBufInit(DynamicBuffer *dbuf)
#else
void DBufInit(dbuf)
DynamicBuffer *dbuf;
#endif
void DBufInit(DynamicBuffer *dbuf)
{
dbuf->buffer = dbuf->staticBuf;
dbuf->len = 0;
@@ -94,7 +73,7 @@ DynamicBuffer *dbuf;
}
/**********************************************************************
%FUNCTION: DBufPutc
%FUNCTION: DBufPutcFN
%ARGUMENTS:
dbuf -- pointer to a dynamic buffer
c -- character to append to buffer
@@ -103,13 +82,7 @@ DynamicBuffer *dbuf;
%DESCRIPTION:
Appends a character to the buffer.
**********************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DBufPutc(DynamicBuffer *dbuf, char c)
#else
int DBufPutc(dbuf, c)
DynamicBuffer *dbuf;
char c;
#endif
int DBufPutcFN(DynamicBuffer *dbuf, char c)
{
if (dbuf->allocatedLen == dbuf->len+1) {
if (DBufMakeRoom(dbuf, dbuf->len+1) != OK) return E_NO_MEM;
@@ -129,13 +102,7 @@ char c;
%DESCRIPTION:
Appends a string to the buffer.
**********************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DBufPuts(DynamicBuffer *dbuf, char *str)
#else
int DBufPuts(dbuf, str)
DynamicBuffer *dbuf;
char *str;
#endif
int DBufPuts(DynamicBuffer *dbuf, char const *str)
{
int l = strlen(str);
if (!l) return OK;
@@ -155,12 +122,7 @@ char *str;
%DESCRIPTION:
Frees and reinitializes a dynamic buffer
**********************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void DBufFree(DynamicBuffer *dbuf)
#else
void DBufFree(dbuf)
DynamicBuffer *dbuf;
#endif
void DBufFree(DynamicBuffer *dbuf)
{
if (dbuf->buffer != dbuf->staticBuf) free(dbuf->buffer);
DBufInit(dbuf);
@@ -177,13 +139,7 @@ DynamicBuffer *dbuf;
Reads an entire line from a file and appends to dbuf. Does not include
trailing newline.
**********************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DBufGets(DynamicBuffer *dbuf, FILE *fp)
#else
int DBufGets(dbuf, fp)
DynamicBuffer *dbuf;
FILE *fp;
#endif
int DBufGets(DynamicBuffer *dbuf, FILE *fp)
{
char tmp[256]; /* Safe to hard-code */
int busy = 1;

View File

@@ -10,8 +10,6 @@
/* */
/***************************************************************/
/* $Id: dynbuf.h,v 1.3 2000-02-18 03:45:50 dfs Exp $ */
#ifndef DYNBUF_H
#define DYNBUF_H
@@ -25,21 +23,15 @@ typedef struct {
char staticBuf[DBUF_STATIC_SIZE];
} DynamicBuffer;
#ifndef ARGS
#ifdef HAVE_PROTOS
#define ARGS(x) x
#else
#define ARGS(x) ()
#endif
#endif
void DBufInit(DynamicBuffer *dbuf);
int DBufPutc(DynamicBuffer *dbuf, char c);
int DBufPuts(DynamicBuffer *dbuf, char *str);
int DBufPutcFN(DynamicBuffer *dbuf, char c);
int DBufPuts(DynamicBuffer *dbuf, char const *str);
void DBufFree(DynamicBuffer *dbuf);
int DBufGets(DynamicBuffer *dbuf, FILE *fp);
#define DBufValue(bufPtr) ((bufPtr)->buffer)
#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 */

View File

@@ -10,8 +10,6 @@
/* */
/***************************************************************/
/* $Id: err.h,v 1.4 2000-02-18 03:45:51 dfs Exp $ */
/* Note that not all of the "errors" are really errors - some are just
messages for information purposes. Constants beginning with M_ should
never be returned as error indicators - they should only be used to
@@ -118,6 +116,9 @@
#define M_QUEUED 96
#define E_EXPECTING_NUMBER 97
#define M_BAD_WARN_FUNC 98
#define E_CANT_CONVERT_TZ 99
#define E_NO_MATCHING_REMS 100
#define E_STRING_TOO_LONG 101
#ifdef MK_GLOBALS
#undef EXTERN
@@ -190,7 +191,7 @@ EXTERN char *ErrMsg[]
"Too many partial OMITs",
"Too many full OMITs",
"Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT",
"Error reading file",
"Error reading",
"Expecting end-of-line",
"Invalid Hebrew date",
"IIF needs odd number of arguments",
@@ -206,7 +207,7 @@ EXTERN char *ErrMsg[]
"Expecting time after AT",
"UNTIL keyword used twice",
"Incomplete date specification",
"SCANFROM keyword used twice",
"FROM/SCANFROM keyword used twice",
"Variable",
"Value",
"*UNDEFINED*",
@@ -230,7 +231,10 @@ EXTERN char *ErrMsg[]
"No reminders.",
"%d reminder(s) queued for later today.\n",
"Expecting number",
"Bad function in WARN clause"
"Bad function in WARN clause",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
}
#endif /* MK_GLOBALS */
;

View File

@@ -11,19 +11,11 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: expr.c,v 1.9 2004-09-04 03:17:09 dfs Exp $";
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "err.h"
#include "types.h"
@@ -42,23 +34,15 @@ static char const RCSID[] = "$Id: expr.c,v 1.9 2004-09-04 03:17:09 dfs Exp $";
static char CoerceBuf[512];
extern int NumFuncs;
#ifdef HAVE_PROTOS
PRIVATE int Multiply(void), Divide(void), Mod(void), Add(void),
static int Multiply(void), Divide(void), Mod(void), Add(void),
Subtract(void), GreaterThan(void), LessThan(void),
EqualTo(void), NotEqual(void), LessOrEqual(void),
GreaterOrEqual(void), LogAND(void), LogOR(void),
UnMinus(void), LogNot(void),
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));
PRIVATE int ParseLiteralDate ARGS ((char **s, int *jul));
static int MakeValue (char const *s, Value *v, Var *locals);
static int ParseLiteralDate (char const **s, int *jul, int *tim);
/* Binary operators - all left-associative */
@@ -104,12 +88,7 @@ int OpStackPtr, ValStackPtr;
/* Execute an operator or function with debugging. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int DebugPerform(Operator *op)
#else
static int DebugPerform(op)
Operator *op;
#endif
static int DebugPerform(Operator *op)
{
int r;
@@ -140,11 +119,7 @@ Operator *op;
/* Clean the stack after an error occurs. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void CleanStack(void)
#else
static void CleanStack()
#endif
static void CleanStack(void)
{
int i;
@@ -157,14 +132,9 @@ static void CleanStack()
/* PeekChar - peek ahead to next char. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE char PeekChar(char **s)
#else
static char PeekChar(s)
char **s;
#endif
static char PeekChar(char const **s)
{
char *t = *s;
char const *t = *s;
while (*t && isspace(*t)) t++;
return *t;
}
@@ -176,13 +146,7 @@ char **s;
/* Read a token. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int ParseExprToken(DynamicBuffer *buf, char **in)
#else
static int ParseExprToken(buf, in)
DynamicBuffer *buf;
char **in;
#endif
static int ParseExprToken(DynamicBuffer *buf, char const **in)
{
char c;
@@ -240,6 +204,46 @@ char **in;
if (c == '\"') {
if (!**in) return E_MISS_QUOTE;
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)++;
if (DBufPutc(buf, c) != OK) {
DBufFree(buf);
@@ -274,7 +278,7 @@ char **in;
}
/* 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) {
DBufFree(buf);
return E_NO_MEM;
@@ -302,13 +306,7 @@ char **in;
/* Put the result into value pointed to by v. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int EvalExpr(char **e, Value *v)
#else
int EvalExpr(e, v)
char **e;
Value *v;
#endif
int EvalExpr(char const **e, Value *v)
{
int r;
@@ -331,13 +329,7 @@ Value *v;
}
/* Evaluate - do the actual work of evaluation. */
#ifdef HAVE_PROTOS
PUBLIC int Evaluate(char **s, Var *locals)
#else
int Evaluate(s, locals)
char **s;
Var *locals;
#endif
int Evaluate(char const **s, Var *locals)
{
int OpBase, ValBase;
int r;
@@ -345,7 +337,7 @@ Var *locals;
int args; /* Number of function arguments */
Operator op, op2;
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;
ValBase = ValStackPtr;
@@ -387,7 +379,7 @@ Var *locals;
if (f) r = CallFunc(f, 0);
else {
r = CallUserFunc(ufname, 0);
free(ufname);
free((char *) ufname);
}
if (r) return r;
r = ParseExprToken(&ExprBuf, s); /* Guaranteed to be right paren. */
@@ -397,12 +389,12 @@ Var *locals;
args++;
r = Evaluate(s, locals);
if (r) {
if (!f) free(ufname);
if (!f) free((char *) ufname);
return r;
}
if (*DBufValue(&ExprBuf) == ')') break;
else if (*DBufValue(&ExprBuf) != ',') {
if (!f) free(ufname);
if (!f) free((char *) ufname);
Eprint("%s: `%c'", ErrMsg[E_EXPECT_COMMA],
*DBufValue(&ExprBuf));
DBufFree(&ExprBuf);
@@ -412,10 +404,10 @@ Var *locals;
if (f) r = CallFunc(f, args);
else {
r = CallUserFunc(ufname, args);
free(ufname);
free((char *) ufname);
}
if (r) return r;
DBufFree(&ExprBuf);
if (r) return r;
}
} else { /* Unary operator */
f = FindFunc(DBufValue(&ExprBuf), UnOp, NUM_UN_OPS);
@@ -496,14 +488,7 @@ Var *locals;
/* a date or the value of a symbol. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int MakeValue(char *s, Value *v, Var *locals)
#else
static int MakeValue(s, v, locals)
char *s;
Value *v;
Var *locals;
#endif
static int MakeValue(char const *s, Value *v, Var *locals)
{
int len;
int h, m, r;
@@ -511,7 +496,7 @@ Var *locals;
if (*s == '\"') { /* It's a literal string "*/
len = strlen(s)-1;
v->type = STR_TYPE;
v->v.str = (char *) malloc(len);
v->v.str = malloc(len);
if (! v->v.str) {
v->type = ERR_TYPE;
return E_NO_MEM;
@@ -521,10 +506,15 @@ Var *locals;
return OK;
} else if (*s == '\'') { /* It's a literal date */
s++;
if ((r=ParseLiteralDate(&s, &h))) return r;
if ((r=ParseLiteralDate(&s, &h, &m))) return r;
if (*s != '\'') return E_BAD_DATE;
v->type = DATE_TYPE;
v->v.val = h;
if (m == NO_TIME) {
v->type = DATE_TYPE;
v->v.val = h;
} else {
v->type = DATETIME_TYPE;
v->v.val = (h * MINUTES_PER_DAY) + m;
}
return OK;
} else if (isdigit(*s)) { /* It's a number - use len to hold it.*/
len = 0;
@@ -532,7 +522,7 @@ Var *locals;
len *= 10;
len += (*s++ - '0');
}
if (*s == ':' || *s == '.' || *s == TIMESEP) { /* Must be a literal time */
if (*s == ':' || *s == '.' || *s == TimeSep) { /* Must be a literal time */
s++;
if (!isdigit(*s)) return E_BAD_TIME;
h = len;
@@ -543,7 +533,7 @@ Var *locals;
s++;
}
if (*s || h>23 || m>59) return E_BAD_TIME;
v->type = TIM_TYPE;
v->type = TIME_TYPE;
v->v.val = h*60 + m;
return OK;
}
@@ -580,30 +570,54 @@ Var *locals;
/* DoCoerce - actually coerce a value to the specified type. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoCoerce(char type, Value *v)
#else
int DoCoerce(type, v)
char type;
Value *v;
#endif
int DoCoerce(char type, Value *v)
{
int h, d, m, y, i;
char *s;
int h, d, m, y, i, k;
char const *s;
/* Do nothing if value is already the right type */
if (type == v->type) return OK;
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:
switch(v->type) {
case INT_TYPE: sprintf(CoerceBuf, "%d", v->v.val); break;
case TIM_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
TIMESEP, v->v.val % 60);
case TIME_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
TimeSep, v->v.val % 60);
break;
case DATE_TYPE: FromJulian(v->v.val, &y, &m, &d);
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;
default: return E_CANT_COERCE;
}
@@ -640,7 +654,8 @@ Value *v;
return OK;
case DATE_TYPE:
case TIM_TYPE:
case TIME_TYPE:
case DATETIME_TYPE:
v->type = INT_TYPE;
return OK;
@@ -657,22 +672,28 @@ Value *v;
case STR_TYPE:
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;
v->type = DATE_TYPE;
free(v->v.str);
v->v.val = i;
return OK;
case DATETIME_TYPE:
v->type = DATE_TYPE;
v->v.val /= MINUTES_PER_DAY;
return OK;
default: return E_CANT_COERCE;
}
case TIM_TYPE:
case TIME_TYPE:
switch(v->type) {
case INT_TYPE:
v->type = TIM_TYPE;
v->v.val %= 1440;
if (v->v.val < 0) v->v.val += 1440;
case DATETIME_TYPE:
v->type = TIME_TYPE;
v->v.val %= MINUTES_PER_DAY;
if (v->v.val < 0) v->v.val += MINUTES_PER_DAY;
return OK;
case STR_TYPE:
@@ -684,7 +705,7 @@ Value *v;
h *= 10;
h += *s++ - '0';
}
if (*s != ':' && *s != '.' && *s != TIMESEP)
if (*s != ':' && *s != '.' && *s != TimeSep)
return E_CANT_COERCE;
s++;
if (!isdigit(*s)) return E_CANT_COERCE;
@@ -693,7 +714,7 @@ Value *v;
m += *s++ - '0';
}
if (*s || h>23 || m>59) return E_CANT_COERCE;
v->type = TIM_TYPE;
v->type = TIME_TYPE;
free(v->v.str);
v->v.val = h*60+m;
return OK;
@@ -711,15 +732,13 @@ Value *v;
/* Perform addition. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int Add(void)
#else
static int Add()
#endif
static int Add(void)
{
Value v1, v2, v3;
int r;
size_t l1, l2;
PopValStack(v2);
if ( (r = FnPopValStack(&v1)) ) {
DestroyValue(v2);
@@ -743,12 +762,22 @@ static int Add()
return OK;
}
/* If it's a time plus an int, add 'em mod 1440 */
if ((v1.type == TIM_TYPE && v2.type == INT_TYPE) ||
(v1.type == INT_TYPE && v2.type == TIM_TYPE)) {
v1.v.val = (v1.v.val + v2.v.val) % 1440;
if (v1.v.val < 0) v1.v.val += 1440;
v1.type = TIM_TYPE;
/* If it's a datetime plus an int, add 'em */
if ((v1.type == DATETIME_TYPE && v2.type == INT_TYPE) ||
(v1.type == INT_TYPE && v2.type == DATETIME_TYPE)) {
v1.v.val += v2.v.val;
if (v1.v.val < 0) return E_DATE_OVER;
v1.type = DATETIME_TYPE;
PushValStack(v1);
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;
}
@@ -764,7 +793,13 @@ static int Add()
return r;
}
v3.type = STR_TYPE;
v3.v.str = (char *) malloc(strlen(v1.v.str) + strlen(v2.v.str) + 1);
l1 = strlen(v1.v.str);
l2 = strlen(v2.v.str);
if (MaxStringLen && (l1 + l2 > MaxStringLen)) {
DestroyValue(v1); DestroyValue(v2);
return E_STRING_TOO_LONG;
}
v3.v.str = malloc(l1 + l2 + 1);
if (!v3.v.str) {
DestroyValue(v1); DestroyValue(v2);
return E_NO_MEM;
@@ -787,11 +822,7 @@ static int Add()
/* Perform subtraction. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int Subtract(void)
#else
static int Subtract()
#endif
static int Subtract(void)
{
Value v1, v2;
int r;
@@ -817,16 +848,25 @@ static int Subtract()
return OK;
}
/* If it's a time minus an int, do subtraction mod 1440 */
if (v1.type == TIM_TYPE && v2.type == INT_TYPE) {
v1.v.val = (v1.v.val - v2.v.val) % 1440;
if (v1.v.val < 0) v1.v.val += 1440;
/* If it's a datetime minus an int, do subtraction, checking for underflow */
if (v1.type == DATETIME_TYPE && v2.type == INT_TYPE) {
v1.v.val -= v2.v.val;
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);
return OK;
}
/* 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.v.val -= v2.v.val;
v1.type = INT_TYPE;
@@ -846,11 +886,7 @@ static int Subtract()
/* Perform multiplication. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int Multiply(void)
#else
static int Multiply()
#endif
static int Multiply(void)
{
Value v1, v2;
int r;
@@ -877,11 +913,7 @@ static int Multiply()
/* Perform division. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int Divide(void)
#else
static int Divide()
#endif
static int Divide(void)
{
Value v1, v2;
int r;
@@ -909,11 +941,7 @@ static int Divide()
/* Perform modulus function. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int Mod(void)
#else
static int Mod()
#endif
static int Mod(void)
{
Value v1, v2;
int r;
@@ -943,21 +971,12 @@ static int Mod()
/* All the comparison functions. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int GreaterThan(void) {return Compare(GT);}
PRIVATE int LessThan(void) {return Compare(LT);}
PRIVATE int EqualTo(void) {return Compare(EQ);}
PRIVATE int NotEqual(void) {return Compare(NE);}
PRIVATE int LessOrEqual(void) {return Compare(LE);}
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
static int GreaterThan(void) {return Compare(GT);}
static int LessThan(void) {return Compare(LT);}
static int EqualTo(void) {return Compare(EQ);}
static int NotEqual(void) {return Compare(NE);}
static int LessOrEqual(void) {return Compare(LE);}
static int GreaterOrEqual(void) {return Compare(GE);}
/***************************************************************/
/* */
@@ -965,12 +984,7 @@ static int GreaterOrEqual() {return Compare(GE);}
/* Do the actual work of comparison. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int Compare(int how)
#else
static int Compare(how)
int how;
#endif
static int Compare(int how)
{
Value v1, v2, v3;
int r;
@@ -1028,11 +1042,7 @@ int how;
/* Do logical OR */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int LogOR(void)
#else
static int LogOR()
#endif
static int LogOR(void)
{
Value v1, v2;
int r;
@@ -1059,11 +1069,7 @@ static int LogOR()
/* Do logical AND */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int LogAND(void)
#else
static int LogAND()
#endif
static int LogAND(void)
{
Value v1, v2;
int r;
@@ -1090,11 +1096,7 @@ static int LogAND()
/* Unary Minus */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int UnMinus(void)
#else
static int UnMinus()
#endif
static int UnMinus(void)
{
Value *v = &ValStack[ValStackPtr-1];
if (v->type != INT_TYPE) return E_BAD_TYPE;
@@ -1109,11 +1111,7 @@ static int UnMinus()
/* Logical NOT */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int LogNot(void)
#else
static int LogNot()
#endif
static int LogNot(void)
{
Value *v = &ValStack[ValStackPtr-1];
if (v->type != INT_TYPE) return E_BAD_TYPE;
@@ -1128,14 +1126,7 @@ static int LogNot()
/* Find a function. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
Operator *FindFunc(char *name, Operator where[], int num)
#else
Operator *FindFunc(name, where, num)
char *name;
Operator where[];
int num;
#endif
Operator *FindFunc(char const *name, Operator where[], int num)
{
int top=num-1, bot=0;
int mid, r;
@@ -1156,16 +1147,10 @@ int num;
/* Print a value to stdout for debugging purposes. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void PrintValue (Value *v, FILE *fp)
#else
void PrintValue(v, fp)
Value *v;
FILE *fp;
#endif
void PrintValue (Value *v, FILE *fp)
{
int y, m, d;
char *s;
char const *s;
if (v->type == STR_TYPE) {
s=v->v.str;
@@ -1175,11 +1160,16 @@ FILE *fp;
if (*s) fprintf(fp, "...");
}
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,
TIMESEP, v->v.val % 60);
else if (v->type == TIME_TYPE) fprintf(fp, "%02d%c%02d", v->v.val / 60,
TimeSep, v->v.val % 60);
else if (v->type == DATE_TYPE) {
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");
}
@@ -1191,12 +1181,7 @@ FILE *fp;
/* Copy a value. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int CopyValue(Value *dest, const Value *src)
#else
int CopyValue(dest, src)
Value *dest, *src;
#endif
int CopyValue(Value *dest, const Value *src)
{
dest->type = ERR_TYPE;
if (src->type == STR_TYPE) {
@@ -1213,27 +1198,25 @@ Value *dest, *src;
/* */
/* 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
PRIVATE int ParseLiteralDate(char **s, int *jul)
#else
static int ParseLiteralDate(s, jul)
char **s;
int *jul;
#endif
static int ParseLiteralDate(char const **s, int *jul, int *tim)
{
int y, m, d;
int hour, min;
y=0; m=0; d=0;
hour=0; min=0;
*tim = NO_TIME;
if (!isdigit(**s)) return E_BAD_DATE;
while (isdigit(**s)) {
y *= 10;
y += *(*s)++ - '0';
}
if (**s != '/' && **s != '-' && **s != DATESEP) return E_BAD_DATE;
if (**s != '/' && **s != '-' && **s != DateSep) return E_BAD_DATE;
(*s)++;
if (!isdigit(**s)) return E_BAD_DATE;
while (isdigit(**s)) {
@@ -1241,7 +1224,7 @@ int *jul;
m += *(*s)++ - '0';
}
m--;
if (**s != '/' && **s != '-' && **s != DATESEP) return E_BAD_DATE;
if (**s != '/' && **s != '-' && **s != DateSep) return E_BAD_DATE;
(*s)++;
if (!isdigit(**s)) return E_BAD_DATE;
while (isdigit(**s)) {
@@ -1252,6 +1235,23 @@ int *jul;
*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;
}
@@ -1264,12 +1264,7 @@ int *jul;
/* return upon failure. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int FnPopValStack(Value *val)
#else
int FnPopValStack(val)
Value *val;
#endif
int FnPopValStack(Value *val)
{
if (ValStackPtr <= 0)
return E_VA_STK_UNDER;

View File

@@ -10,14 +10,14 @@
/* */
/***************************************************************/
/* $Id: expr.h,v 1.4 2000-02-18 03:45:53 dfs Exp $ */
/* Define the types of values */
#define ERR_TYPE 0
#define INT_TYPE 1
#define TIM_TYPE 2
#define DATE_TYPE 3
#define STR_TYPE 4
#define ERR_TYPE 0
#define INT_TYPE 1
#define TIME_TYPE 2
#define DATE_TYPE 3
#define STR_TYPE 4
#define DATETIME_TYPE 5
#define SPECIAL_TYPE 6 /* Only for system variables */
/* Define stuff for parsing expressions */
#define BEG_OF_EXPR '['

View File

@@ -13,7 +13,6 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: files.c,v 1.10 2000-02-18 03:45:54 dfs Exp $";
#include <stdio.h>
@@ -27,28 +26,12 @@ static char const RCSID[] = "$Id: files.c,v 1.10 2000-02-18 03:45:54 dfs Exp $";
#include <time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined(__MSDOS__)
#include <io.h>
#endif
#ifdef __MSC__
#include <dos.h>
#ifdef HAVE_GLOB_H
#include <glob.h>
#endif
#include "types.h"
@@ -63,44 +46,72 @@ static char const RCSID[] = "$Id: files.c,v 1.10 2000-02-18 03:45:54 dfs Exp $";
/* Define the structures needed by the file caching system */
typedef struct cache {
struct cache *next;
char *text;
char const *text;
int LineNo;
} CachedLine;
typedef struct cheader {
struct cheader *next;
char *filename;
char const *filename;
CachedLine *cache;
#ifdef UNIX
int ownedByMe;
#endif
} 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 */
typedef struct {
char *filename;
char const *filename;
FilenameChain *chain;
int LineNo;
unsigned int IfFlags;
int NumIfs;
long offset;
CachedLine *CLine;
#ifdef UNIX
int ownedByMe;
#endif
} IncludeStruct;
static CachedFile *CachedFiles = (CachedFile *) NULL;
static CachedLine *CLine = (CachedLine *) NULL;
static DirectoryFilenameChain *CachedDirectoryChains = NULL;
static FILE *fp;
static IncludeStruct IStack[INCLUDE_NEST];
static int IStackPtr = 0;
PRIVATE int ReadLineFromFile ARGS ((void));
PRIVATE int CacheFile ARGS ((const char *fname));
PRIVATE void DestroyCache ARGS ((CachedFile *cf));
PRIVATE int CheckSafety ARGS ((void));
static int ReadLineFromFile (void);
static int CacheFile (char const *fname);
static void DestroyCache (CachedFile *cf);
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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ReadLine(void)
#else
int ReadLine()
#endif
int ReadLine(void)
{
int r;
@@ -144,11 +151,7 @@ int ReadLine()
/* Read a line from the file pointed to by fp. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int ReadLineFromFile(void)
#else
static int ReadLineFromFile()
#endif
static int ReadLineFromFile(void)
{
int l;
@@ -173,7 +176,7 @@ static int ReadLineFromFile()
}
l = DBufLen(&buf);
if (l && (DBufValue(&buf)[l-1] == '\\')) {
DBufValue(&buf)[l-1] = 0;
DBufValue(&buf)[l-1] = '\n';
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
DBufFree(&buf);
DBufFree(&LineBuffer);
@@ -204,12 +207,7 @@ static int ReadLineFromFile()
/* ShouldCache is 1, cache the file */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int OpenFile(const char *fname)
#else
int OpenFile(fname)
char *fname;
#endif
int OpenFile(char const *fname)
{
CachedFile *h = CachedFiles;
int r;
@@ -221,14 +219,15 @@ char *fname;
while (h) {
if (!strcmp(fname, h->filename)) {
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Reading `%s': Found in cache\n", fname);
}
CLine = h->cache;
STRSET(FileName, fname);
LineNo = 0;
#ifdef UNIX
if (!h->ownedByMe) {
RunDisabled |= RUN_NOTOWNER;
}
#endif
if (FileName) return OK; else return E_NO_MEM;
}
h = h->next;
@@ -237,8 +236,14 @@ char *fname;
/* If it's a dash, then it's stdin */
if (!strcmp(fname, "-")) {
fp = stdin;
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Reading `-': Reading stdin\n");
}
} else {
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;
CLine = NULL;
@@ -270,18 +275,16 @@ char *fname;
/* Returns an indication of success or failure. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int CacheFile(const char *fname)
#else
static int CacheFile(fname)
char *fname;
#endif
static int CacheFile(char const *fname)
{
int r;
CachedFile *cf;
CachedLine *cl;
char *s;
char const *s;
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Caching file `%s' in memory\n", fname);
}
cl = NULL;
/* Create a file header */
cf = NEW(CachedFile);
@@ -295,13 +298,12 @@ char *fname;
return E_NO_MEM;
}
#ifdef UNIX
if (RunDisabled & RUN_NOTOWNER) {
cf->ownedByMe = 0;
} else {
cf->ownedByMe = 1;
}
#endif
/* Read the file */
while(fp) {
r = ReadLineFromFile();
@@ -357,17 +359,33 @@ char *fname;
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 */
/* file, or return E_EOF */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int PopFile(void)
#else
int PopFile()
#endif
static int PopFile(void)
{
IncludeStruct *i;
@@ -376,8 +394,21 @@ int PopFile()
if (!Hush && NumIfs) Eprint("%s", ErrMsg[E_MISS_ENDIF]);
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--;
i = &IStack[IStackPtr];
LineNo = i->LineNo;
IfFlags = i->IfFlags;
@@ -385,11 +416,9 @@ int PopFile()
CLine = i->CLine;
fp = NULL;
STRSET(FileName, i->filename);
#ifdef UNIX
if (!i->ownedByMe) {
RunDisabled |= RUN_NOTOWNER;
}
#endif
if (!CLine && (i->offset != -1L)) {
/* We must open the file, then seek to specified position */
if (strcmp(i->filename, "-")) {
@@ -401,7 +430,7 @@ int PopFile()
if (fp != stdin)
(void) fseek(fp, i->offset, 0); /* Trust that it works... */
}
free(i->filename);
free((char *) i->filename);
return OK;
}
@@ -412,19 +441,14 @@ int PopFile()
/* The INCLUDE command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoInclude(ParsePtr p)
#else
int DoInclude(p)
ParsePtr p;
#endif
{
int DoInclude(ParsePtr p)
{
DynamicBuffer buf;
int r, e;
DBufInit(&buf);
if ( (r=ParseToken(p, &buf)) ) return r;
e = VerifyEoln(p);
e = VerifyEoln(p);
if (e) Eprint("%s", ErrMsg[e]);
if ( (r=IncludeFile(DBufValue(&buf))) ) {
DBufFree(&buf);
@@ -436,6 +460,114 @@ ParsePtr p;
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 */
@@ -444,34 +576,33 @@ ParsePtr p;
/* inclusion. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int IncludeFile(const char *fname)
#else
int IncludeFile(fname)
char *fname;
#endif
int IncludeFile(char const *fname)
{
IncludeStruct *i;
int r;
int oldRunDisabled;
struct stat statbuf;
FreshLine = 1;
if (IStackPtr+1 >= INCLUDE_NEST) return E_NESTED_INCLUDE;
i = &IStack[IStackPtr];
i->filename = StrDup(FileName);
if (!i->filename) return E_NO_MEM;
if (FileName) {
i->filename = StrDup(FileName);
if (!i->filename) return E_NO_MEM;
} else {
i->filename = NULL;
}
i->LineNo = LineNo;
i->NumIfs = NumIfs;
i->IfFlags = IfFlags;
i->CLine = CLine;
i->offset = -1L;
#ifdef UNIX
i->chain = NULL;
if (RunDisabled & RUN_NOTOWNER) {
i->ownedByMe = 0;
} else {
i->ownedByMe = 1;
}
#endif
if (fp) {
i->offset = ftell(fp);
FCLOSE(fp);
@@ -479,15 +610,55 @@ char *fname;
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;
/* Try to open the new file */
if (!OpenFile(fname)) {
return OK;
}
RunDisabled = oldRunDisabled;
/* Ugh! We failed! */
if ( (r=PopFile()) ) return r;
Eprint("%s: %s", ErrMsg[E_CANT_OPEN], fname);
/* Ugh! We failed! */
PopFile();
return E_CANT_OPEN;
}
@@ -496,22 +667,13 @@ char *fname;
/* GetAccessDate - get the access date of a file. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int GetAccessDate(char *file)
#else
int GetAccessDate(file)
char *file;
#endif
int GetAccessDate(char const *file)
{
struct stat statbuf;
struct tm *t1;
if (stat(file, &statbuf)) return -1;
#ifdef __TURBOC__
t1 = localtime( (time_t *) &(statbuf.st_atime) );
#else
t1 = localtime(&(statbuf.st_atime));
#endif
if (t1->tm_year + 1900 < BASE)
return 0;
@@ -519,71 +681,6 @@ char *file;
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 */
@@ -591,19 +688,14 @@ int jul;
/* Free all the memory used by a cached file. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void DestroyCache(CachedFile *cf)
#else
static void DestroyCache(cf)
CachedFile *cf;
#endif
static void DestroyCache(CachedFile *cf)
{
CachedLine *cl, *cnext;
CachedFile *temp;
if (cf->filename) free(cf->filename);
if (cf->filename) free((char *) cf->filename);
cl = cf->cache;
while (cl) {
if (cl->text) free (cl->text);
if (cl->text) free ((char *) cl->text);
cnext = cl->next;
free(cl);
cl = cnext;
@@ -629,13 +721,9 @@ CachedFile *cf;
/* Returns 1 if current file is top level, 0 otherwise. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int TopLevel(void)
#else
int TopLevel()
#endif
int TopLevel(void)
{
return !IStackPtr;
return IStackPtr <= 1;
}
/***************************************************************/
@@ -649,13 +737,8 @@ int TopLevel()
/* who we're running as. */
/* As a side effect, if we don't own the file, we disable RUN */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int CheckSafety(void)
#else
static int CheckSafety()
#endif
static int CheckSafety(void)
{
#ifdef UNIX
struct stat statbuf;
if (fp == stdin) {
@@ -695,6 +778,5 @@ static int CheckSafety()
RunDisabled |= RUN_NOTOWNER;
}
#endif
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@@ -14,10 +14,10 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: globals.c,v 1.4 2000-02-18 03:45:56 dfs Exp $";
#include <stdio.h> /* For defintion of FILE - sigh! */
#include "types.h"
#include "custom.h"
#define MK_GLOBALS
#include "globals.h"
#include "err.h"

View File

@@ -12,8 +12,6 @@
/* */
/***************************************************************/
/* $Id: globals.h,v 1.8 2005-04-12 00:44:08 dfs Exp $ */
#ifdef MK_GLOBALS
#undef EXTERN
#define EXTERN
@@ -24,6 +22,8 @@
#define INIT(var, val) var
#endif
#define MINUTES_PER_DAY 1440
#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 DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
@@ -37,11 +37,12 @@ EXTERN int CurMon;
EXTERN int CurYear;
EXTERN int LineNo;
EXTERN int FreshLine;
EXTERN INIT( char *MsgCommand, NULL);
EXTERN INIT( char const *MsgCommand, NULL);
EXTERN INIT( int ShowAllErrors, 0);
EXTERN INIT( int DebugFlag, 0);
EXTERN INIT( int DoCalendar, 0);
EXTERN INIT( int DoSimpleCalendar, 0);
EXTERN INIT( int DoSimpleCalDelta, 0);
EXTERN INIT( int DoPrefixLineNo, 0);
EXTERN INIT( int MondayFirst, 0);
EXTERN INIT( int Iterations, 1);
@@ -52,15 +53,17 @@ EXTERN INIT( int CalMonths, 0);
EXTERN INIT( int Hush, 0);
EXTERN INIT( int NextMode, 0);
EXTERN INIT( int InfiniteDelta, 0);
EXTERN INIT( int DeltaOffset, 0);
EXTERN INIT( int RunDisabled, 0);
EXTERN INIT( int IgnoreOnce, 0);
EXTERN INIT( int SortByTime, 0);
EXTERN INIT( int SortByDate, 0);
EXTERN INIT( int SortByPrio, 0);
EXTERN INIT( int UntimedBeforeTimed, 0);
EXTERN INIT( int DefaultPrio, NO_PRIORITY);
EXTERN INIT( long SysTime, -1L);
EXTERN char *InitialFile;
EXTERN char const *InitialFile;
EXTERN int FileAccessDate;
EXTERN INIT( int DontFork, 0);
@@ -68,10 +71,12 @@ EXTERN INIT( int DontQueue, 0);
EXTERN INIT( int NumQueued, 0);
EXTERN INIT( int DontIssueAts, 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 MaxSatIter, 150);
EXTERN INIT( int MaxStringLen, MAX_STR_LEN);
EXTERN INIT( char *FileName, NULL);
EXTERN INIT( int UseStdin, 0);
EXTERN FILE *ErrFp;
@@ -81,12 +86,14 @@ EXTERN INIT( int LastTriggerDate, 0);
EXTERN INIT( int LastTrigValid, 0);
EXTERN INIT( int LastTriggerTime, 0);
EXTERN INIT( int ShouldCache, 0);
EXTERN char *CurLine;
EXTERN char const *CurLine;
EXTERN INIT( int NumTriggered, 0);
EXTERN int ArgC;
EXTERN char **ArgV;
EXTERN char const **ArgV;
EXTERN INIT( int CalLines, CAL_LINES);
EXTERN INIT( int CalPad, 1);
EXTERN INIT( int UseVTChars, 0);
EXTERN INIT( int UseVTColors, 0);
/* Latitude and longitude */
EXTERN INIT( int LatDeg, LAT_DEG);
@@ -172,12 +179,3 @@ EXTERN int MonthIndex[2][12]
#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

View File

@@ -14,7 +14,6 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: hbcal.c,v 1.4 2000-02-18 03:45:58 dfs Exp $";
#include <stdio.h> /* For FILE used by protos.h - sigh. */
#include "types.h"
@@ -56,7 +55,7 @@ static char const RCSID[] = "$Id: hbcal.c,v 1.4 2000-02-18 03:45:58 dfs Exp $";
#define ADAR2ADARA 1
#define ADAR2BOTH 2
static char *HebMonthNames[] = {
static char const *HebMonthNames[] = {
"Tishrey", "Heshvan", "Kislev", "Tevet", "Shvat", "Adar A", "Adar B",
"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};
static char HebIsLeap[] = {0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,1,0,1};
/***************************************************************/
/* */
/* 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) */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int RoshHashana(int i)
#else
int RoshHashana(i)
int i;
#endif
int RoshHashana(int i)
{
long j;
j = DaysToHebYear(i-3744) - CORRECTION;
@@ -93,12 +87,7 @@ int i;
/* from new moon before Tishrey 1 5701. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC long DaysToHebYear(int y)
#else
long DaysToHebYear(y)
int y;
#endif
long DaysToHebYear(int y)
{
long m, nm, dw, s, l;
@@ -131,12 +120,7 @@ int y;
/* */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DaysInHebYear(int y)
#else
int DaysInHebYear(y)
int y;
#endif
int DaysInHebYear(int y)
{
long thisyear, nextyear;
@@ -153,12 +137,7 @@ int y;
/* given the LENGTH of the Hebrew year. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC char *DaysInHebMonths(int ylen)
#else
char *DaysInHebMonths(ylen)
int ylen;
#endif
char const *DaysInHebMonths(int ylen)
{
static char monlen[13] =
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29};
@@ -184,15 +163,10 @@ int ylen;
/* non-leap-years. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int HebToJul(int hy, int hm, int hd)
#else
int HebToJul(hy, hm, hd)
int hy, hm, hd;
#endif
int HebToJul(int hy, int hm, int hd)
{
int ylen;
char *monlens;
char const *monlens;
int rh;
int m;
@@ -222,17 +196,12 @@ int hy, hm, hd;
/* non-leap-years. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void JulToHeb(int jul, int *hy, int *hm, int *hd)
#else
void JulToHeb(jul, hy, hm, hd)
int jul, *hy, *hm, *hd;
#endif
void JulToHeb(int jul, int *hy, int *hm, int *hd)
{
int y, m, d;
int rh;
int ylen;
char *monlen;
char const *monlen;
/* Get the common year */
FromJulian(jul, &y, &m, &d);
y += 3763; /* Over-estimate a bit to be on the safe side below... */
@@ -263,12 +232,7 @@ int jul, *hy, *hm, *hd;
/* year. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int HebNameToNum(const char *mname)
#else
int HebNameToNum(mname)
char *mname;
#endif
int HebNameToNum(char const *mname)
{
int i;
int m=-1;
@@ -290,12 +254,7 @@ char *mname;
/* year. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC char *HebMonthName(int m, int y)
#else
char *HebMonthName(m, y)
int m, y;
#endif
char const *HebMonthName(int m, int y)
{
if (m != ADARA && m != ADARB) return HebMonthNames[m];
@@ -331,15 +290,10 @@ int m, y;
/* Change 30 Adar A to 30 Shvat in nonleap */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int GetValidHebDate(int yin, int min, int din, int adarbehave,
int GetValidHebDate(int yin, int min, int din, int adarbehave,
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;
*mout = min;
@@ -436,13 +390,8 @@ int yin, min, din, adarbehave, *mout, *dout, jahr;
/* Returns 0 for success, non-zero for failure. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int GetNextHebrewDate(int julstart, int hm, int hd,
int GetNextHebrewDate(int julstart, int hm, int hd,
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 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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ComputeJahr(int y, int m, int d, int *ans)
#else
int ComputeJahr(y, m, d, ans)
int y, m, d, *ans;
#endif
int ComputeJahr(int y, int m, int d, int *ans)
{
char *monlen;
char const *monlen;
int len;
*ans = JAHR_NONE;

View File

@@ -8,43 +8,27 @@
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright (C) 1999-2005 by Roaring Penguin Software Inc. */
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
/* */
/***************************************************************/
#include "version.h"
#include "config.h"
static char const RCSID[] = "$Id: init.c,v 1.15 2005-04-12 01:27:56 dfs Exp $";
#define L_IN_INIT 1
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "types.h"
#include "protos.h"
#include "expr.h"
#include "err.h"
#include "version.h"
#include "globals.h"
/***************************************************************
@@ -68,6 +52,7 @@ static char const RCSID[] = "$Id: init.c,v 1.15 2005-04-12 01:27:56 dfs Exp $";
* -h = Hush mode
* -f = Do not fork
* -dchars = Debugging mode: Chars are:
* f = Trace file openings
* e = Echo input lines
* x = Display expression evaluation
* t = Display trigger dates
@@ -95,13 +80,41 @@ while (isdigit(*(s))) { \
s++; \
}
#ifdef UNIX
PRIVATE void ChgUser ARGS((char *uname));
#endif
static void ChgUser(char const *u);
static void InitializeVar(char const *str);
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);
}
/***************************************************************/
/* */
@@ -110,18 +123,15 @@ static char *BadDate = "Illegal date on command line\n";
/* Initialize the system - called only once at beginning! */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void InitRemind(int argc, char *argv[])
#else
void InitRemind(argc, argv)
int argc;
char *argv[];
#endif
void InitRemind(int argc, char const *argv[])
{
char *arg;
char const *arg;
int i;
int y, m, d, rep;
Token tok;
int InvokedAsRem = 0;
char const *s;
int weeks;
/* Initialize global dynamic buffers */
DBufInit(&Banner);
@@ -131,13 +141,11 @@ char *argv[];
DBufPuts(&Banner, L_BANNER);
/* Make sure remind is not installed set-uid or set-gid */
#ifdef UNIX
if (getgid() != getegid() ||
getuid() != geteuid()) {
fprintf(ErrFp, "\nRemind should not be installed set-uid or set-gid.\nCHECK YOUR SYSTEM SECURITY.\n");
exit(1);
}
#endif
y = NO_YR;
m = NO_MON;
@@ -152,18 +160,18 @@ char *argv[];
JulianToday = RealToday;
FromJulian(JulianToday, &CurYear, &CurMon, &CurDay);
#if !defined(HAVE_QUEUED)
DontFork = 1;
DontQueue = 1;
NumQueued = 0;
DontIssueAts = 0;
Daemon = 0;
#elif defined(_MSC_VER) || defined(__BORLANDC__)
DontFork = 1;
#elif defined(__OS2__) && defined (__MSDOS__)
if (DOSMODE)
DontFork = 1;
#endif
/* See if we were invoked as "rem" rather than "remind" */
if (argv[0]) {
s = strrchr(argv[0], '/');
if (!s) {
s = argv[0];
} else {
s++;
}
if (!strcmp(s, "rem")) {
InvokedAsRem = 1;
}
}
/* Parse the command-line options */
i = 1;
@@ -186,14 +194,12 @@ char *argv[];
InitializeVar(arg);
while(*arg) arg++;
break;
case 'n':
case 'N':
NextMode = 1;
#ifdef HAVE_QUEUED
DontQueue = 1;
Daemon = 0;
#endif
break;
case 'r':
@@ -211,11 +217,22 @@ char *argv[];
IgnoreOnce = 1;
break;
case 't':
case 'T':
InfiniteDelta = 1;
case 'y':
case 'Y':
SynthesizeTags = 1;
break;
case 't':
case 'T':
if (!*arg) {
InfiniteDelta = 1;
} else {
PARSENUM(DeltaOffset, arg);
if (DeltaOffset < 0) {
DeltaOffset = 0;
}
}
break;
case 'e':
case 'E':
ErrFp = stdout;
@@ -231,6 +248,7 @@ char *argv[];
SortByDate = SORT_ASCEND;
SortByTime = SORT_ASCEND;
SortByPrio = SORT_ASCEND;
UntimedBeforeTimed = 0;
if (*arg) {
if (*arg == 'D' || *arg == 'd')
SortByDate = SORT_DESCEND;
@@ -246,29 +264,30 @@ char *argv[];
SortByPrio = SORT_DESCEND;
arg++;
}
if (*arg) {
if (*arg == 'D' || *arg == 'd')
UntimedBeforeTimed = 1;
arg++;
}
break;
#if defined(UNIX) && defined(WANT_U_OPTION)
case 'u':
case 'U':
ChgUser(arg);
RunDisabled = RUN_CMDLINE;
while (*arg) arg++;
break;
#endif
#ifdef HAVE_QUEUED
case 'z':
case 'Z':
DontFork = 1;
if (*arg == '0') {
PARSENUM(Daemon, arg);
if (Daemon == 0) Daemon = -1;
else if (Daemon < 5) Daemon = 5;
else if (Daemon < 1) Daemon = 1;
else if (Daemon > 60) Daemon = 60;
} else {
PARSENUM(Daemon, arg);
if (Daemon<5) Daemon=5;
if (Daemon<1) Daemon=1;
else if (Daemon>60) Daemon=60;
}
break;
@@ -287,12 +306,36 @@ char *argv[];
case 'F':
DontFork = 1;
break;
#endif
case 'c':
case 'C':
DoCalendar = 1;
if (*arg == '+') {
arg++;
weeks = 0;
/* 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);
if (!CalWeeks) CalWeeks = 1;
} else {
@@ -304,8 +347,21 @@ char *argv[];
case 's':
case 'S':
DoSimpleCalendar = 1;
if (*arg == '+') {
arg++;
weeks = 0;
while(*arg) {
if (*arg == 'a' || *arg == 'A') {
DoSimpleCalDelta = 1;
arg++;
continue;
}
if (*arg == '+') {
arg++;
weeks = 1;
continue;
}
break;
}
if (weeks) {
PARSENUM(CalWeeks, arg);
if (!CalWeeks) CalWeeks = 1;
} else {
@@ -318,6 +374,10 @@ char *argv[];
case 'P':
DoSimpleCalendar = 1;
PsCal = 1;
if (*arg == 'a' || *arg == 'A') {
DoSimpleCalDelta = 1;
arg++;
}
PARSENUM(CalMonths, arg);
if (!CalMonths) CalMonths = 1;
break;
@@ -351,11 +411,12 @@ char *argv[];
case 'D':
while (*arg) {
switch(*arg++) {
case 'e': case 'E': DebugFlag |= DB_ECHO_LINE; break;
case 'x': case 'X': DebugFlag |= DB_PRTEXPR; break;
case 't': case 'T': DebugFlag |= DB_PRTTRIG; break;
case 'v': case 'V': DebugFlag |= DB_DUMP_VARS; break;
case 'l': case 'L': DebugFlag |= DB_PRTLINE; break;
case 'e': case 'E': DebugFlag |= DB_ECHO_LINE; break;
case 'x': case 'X': DebugFlag |= DB_PRTEXPR; break;
case 't': case 'T': DebugFlag |= DB_PRTTRIG; break;
case 'v': case 'V': DebugFlag |= DB_DUMP_VARS; break;
case 'l': case 'L': DebugFlag |= DB_PRTLINE; break;
case 'f': case 'F': DebugFlag |= DB_TRACE_FILES; break;
default:
fprintf(ErrFp, ErrMsg[M_BAD_DB_FLAG], *(arg-1));
}
@@ -394,11 +455,15 @@ char *argv[];
}
/* Get the filename. */
if (i >= argc) {
Usage();
exit(1);
if (!InvokedAsRem) {
if (i >= argc) {
Usage();
exit(1);
}
InitialFile = argv[i++];
} else {
InitialFile = DefaultFilename();
}
InitialFile = argv[i++];
/* Get the date, if any */
if (i < argc) {
@@ -410,10 +475,8 @@ char *argv[];
if (SysTime != -1L) Usage();
else {
SysTime = (long) tok.val * 60L;
#ifdef HAVE_QUEUED
DontQueue = 1;
Daemon = 0;
#endif
}
break;
@@ -489,14 +552,10 @@ char *argv[];
/* */
/***************************************************************/
#ifndef L_USAGE_OVERRIDE
#ifdef HAVE_PROTOS
PUBLIC void Usage(void)
#else
void Usage()
#endif /* HAVE_PROTOS */
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "Copyright 1999-2005 Roaring Penguin Software Inc.\n");
fprintf(ErrFp, "Copyright 1999-2008 Roaring Penguin Software Inc.\n");
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif
@@ -504,30 +563,29 @@ void Usage()
fprintf(ErrFp, "Options:\n");
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
fprintf(ErrFp, " -r Disable RUN directives\n");
fprintf(ErrFp, " -c[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) months\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, " -s[+][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, " -s[a][+][n] Produce `simple calendar' for n (1) months (weeks)\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, " -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");
#ifdef HAVE_QUEUED
fprintf(ErrFp, " -a Don't trigger timed reminders immediately - just queue them\n");
fprintf(ErrFp, " -q Don't queue timed reminders\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");
#endif
fprintf(ErrFp, " -d... Debug: e=echo x=expr-eval t=trig v=dumpvars l=showline\n");
fprintf(ErrFp, " -d... Debug: e=echo x=expr-eval t=trig v=dumpvars l=showline f=tracefiles\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, " -x[n] Iteration limit for SATISFY clause (def=150)\n");
fprintf(ErrFp, " -kcmd Run `cmd' for MSG-type reminders\n");
fprintf(ErrFp, " -g[ddd] Sort reminders by date, time and priority before issuing\n");
fprintf(ErrFp, " -g[dddd] Sort reminders by date, time, priority, and 'timedness'\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, " -y Synthesize tags for tagless reminders\n");
exit(1);
}
#endif /* L_USAGE_OVERRIDE */
@@ -541,18 +599,15 @@ void Usage()
/* USER environment variables. */
/* */
/***************************************************************/
#if defined(UNIX) && defined(WANT_U_OPTION)
#ifdef HAVE_PROTOS
PRIVATE void ChgUser(char *user)
#else
static void ChgUser(user)
char *user;
#endif /* HAVE_PROTOS */
static void ChgUser(char const *user)
{
uid_t myuid;
struct passwd *pwent;
static char *home, *shell, *username, *logname;
static char *home;
static char *shell;
static char *username;
static char *logname;
myuid = getuid();
@@ -606,8 +661,20 @@ char *user;
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 */
@@ -615,27 +682,34 @@ char *user;
/* Initialize and preserve a variable */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void InitializeVar(char *str)
#else
static void InitializeVar(str)
char *str;
#endif
static void InitializeVar(char const *str)
{
char *varname, *expr;
char const *expr;
char const *ostr = str;
char varname[VAR_NAME_LEN+1];
Value val;
int r;
/* Scan for an '=' sign */
varname = str;
while (*str && *str != '=') str++;
r = 0;
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) {
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_EQ]);
return;
}
*str = 0;
if (!*varname) {
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_VAR]);
return;

View File

@@ -10,8 +10,6 @@
/* */
/***************************************************************/
/* $Id: lang.h,v 1.6 2000-12-18 14:05:32 dfs Exp $ */
/* I'm chauvinistic and name each language with its English name... */
#define ENGLISH 0 /* original by David F. Skoll */

View File

@@ -12,8 +12,6 @@
/* */
/***************************************************************/
/* $Id: danish.h,v 1.7 2000-02-18 03:46:17 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#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_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_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_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_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_I_OVER sprintf(s, "den %02d%c%02d", m+1, DATESEP, d);
#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_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER

View File

@@ -16,8 +16,6 @@
/* */
/***************************************************************/
/* $Id: dutch.h,v 1.5 2000-02-18 03:46:18 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "Dutch"

View File

@@ -10,8 +10,6 @@
/* */
/***************************************************************/
/* $Id: english.h,v 1.5 2000-02-18 03:46:19 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "English"

View File

@@ -16,8 +16,6 @@
/* */
/***************************************************************/
/* $Id: finnish.h,v 1.10 2000-02-18 03:53:49 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#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, \
MonthName[m], L_PARTIT, y);
#define L_C_OVER sprintf(s, "%s%s", DayName[jul%7], L_ON);
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DATESEP, m+1, DATESEP, \
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep, m+1, DateSep, \
y);
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DATESEP, d, DATESEP, y);
#define L_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, \
MonthName[m], L_PARTIT);
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DATESEP, m+1);
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DATESEP, d);
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DateSep, m+1);
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DateSep, d);
#define L_J_OVER sprintf(s, "%s%s %sn %d%s %d", DayName[jul%7], L_ON, \
MonthName[m], d, plu, y);
#define L_K_OVER sprintf(s, "%s%s %sn %d%s", DayName[jul%7], L_ON, \
MonthName[m], d, plu);
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DATESEP, m+1, DATESEP, d);
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
#define L_Q_OVER sprintf(s, "n");
#define L_U_OVER sprintf(s, "%s%s %d%s %s%s %d", DayName[jul%7], L_ON, \
d, plu, MonthName[m], L_PARTIT, y);
@@ -284,7 +282,7 @@ EXTERN char *ErrMsg[] =
"AT-sanan per\xE4st\xE4 puuttuu aika",
"UNTIL-sanaa k\xE4ytetty kahdesti",
"Ep\xE4t\xE4ydellinen p\xE4iv\xE4ys",
"SCANFROM-sanaa k\xE4ytetty kahdesti",
"FROM/SCANFROM-sanaa k\xE4ytetty kahdesti",
"Muuttuja",
"Arvo",
"*M\xC4\xC4RITTELEM\xC4T\xD6N*",
@@ -308,7 +306,10 @@ EXTERN char *ErrMsg[] =
"Ei viestej\xE4.",
"%d viesti(\xE4) t\xE4m\xE4n p\xE4iv\xE4n jonossa.\n",
"Numero puuttuu",
"Virheellinen funktio WARN-lausekkeessa"
"Virheellinen funktio WARN-lausekkeessa",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
#elif IBMEXTENDED
"Ok",
@@ -385,7 +386,7 @@ EXTERN char *ErrMsg[] =
"AT-sanan per\x84st\x84 puuttuu aika",
"UNTIL-sanaa k\x84ytetty kahdesti",
"Ep\x84t\x84ydellinen p\x84iv\x84ys",
"SCANFROM-sanaa k\x84ytetty kahdesti",
"FROM/SCANFROM-sanaa k\x84ytetty kahdesti",
"Muuttuja",
"Arvo",
"*M\x8E\x8ERITTELEM\x8ET\x99N*",
@@ -409,7 +410,11 @@ EXTERN char *ErrMsg[] =
"Ei viestej\x84.",
"%d viesti(\x84) t\x84m\x84n p\x84iv\x84n jonossa.\n",
"Numero puuttuu"
"Virheellinen funktio WARN-lausekkeessa"
"Virheellinen funktio WARN-lausekkeessa",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
#else
"Ok",
"Puuttuva ']'",
@@ -485,7 +490,7 @@ EXTERN char *ErrMsg[] =
"AT-sanan per{st{ puuttuu aika",
"UNTIL-sanaa k{ytetty kahdesti",
"Ep{t{ydellinen p{iv{ys",
"SCANFROM-sanaa k{ytetty kahdesti",
"FROM/SCANFROM-sanaa k{ytetty kahdesti",
"Muuttuja",
"Arvo",
"*M[[RITTELEM[T\\N*",
@@ -509,7 +514,12 @@ EXTERN char *ErrMsg[] =
"Ei viestej{.",
"%d viesti({) t{m{n p{iv{n jonossa.\n",
"Numero puuttuu",
"Virheellinen funktio WARN-lausekkeessa"
"Virheellinen funktio WARN-lausekkeessa",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
#endif
};
#endif /* MK_GLOBALS */
@@ -517,11 +527,7 @@ EXTERN char *ErrMsg[] =
/* The following is only used in init.c */
#ifdef L_IN_INIT
#define L_USAGE_OVERRIDE 1
#ifdef HAVE_PROTOS
PUBLIC void Usage(void)
#else
void Usage()
#endif /* HAVE_PROTOS */
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");

View File

@@ -15,8 +15,6 @@
/* */
/***************************************************************/
/* $Id: french.h,v 1.9 2000-02-18 03:53:50 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "French"
@@ -221,7 +219,7 @@ EXTERN char *ErrMsg[] =
"Heure attendue apr\350s AT",
"Mot-cl\351 UNTIL utilis\351 deux fois",
"Sp\351cification de date incompl\350te",
"Mot-cl\351 SCANFROM utilis\351 deux fois",
"Mot-cl\351 FROM/SCANFROM utilis\351 deux fois",
"Variable",
"Valeur",
"*NON-DEFINI*",
@@ -245,7 +243,11 @@ EXTERN char *ErrMsg[] =
"Pas de rappels.",
"%d rappel(s) en file pour aujourd'hui.\n",
"Nombre attendu",
"Fonction ill\351gale apr\350s WARN"
"Fonction ill\351gale apr\350s WARN",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
#else /* ISOLATIN1 */
"Ok",
"']' manquant",
@@ -321,7 +323,7 @@ EXTERN char *ErrMsg[] =
"Heure attendue apres AT",
"Mot-cle UNTIL utilise deux fois",
"Specification de date incomplete",
"Mot-cle SCANFROM utilise deux fois",
"Mot-cle FROM/SCANFROM utilise deux fois",
"Variable",
"Valeur",
"*NON-DEFINI*",
@@ -345,7 +347,10 @@ EXTERN char *ErrMsg[] =
"Pas de rappels.",
"%d rappel(s) en file pour aujourd'hui.\n",
"Nombre attendu",
"Fonction illegale apres WARN"
"Fonction illegale apres WARN",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
#endif /* ISOLATIN1 */
};
#endif /* MK_GLOBALS */
@@ -353,11 +358,7 @@ EXTERN char *ErrMsg[] =
/* The following is only used in init.c */
#ifdef L_IN_INIT
#define L_USAGE_OVERRIDE 1
#ifdef HAVE_PROTOS
PUBLIC void Usage(void)
#else
void Usage()
#endif /* HAVE_PROTOS */
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");

View File

@@ -14,8 +14,6 @@
/* */
/***************************************************************/
/* $Id: german.h,v 1.6 2000-02-18 03:46:22 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "German"

View File

@@ -11,8 +11,6 @@
/* */
/***************************************************************/
/* $Id: icelandic.h,v 1.1 2000-12-18 14:05:33 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "Icelandic"

View File

@@ -12,8 +12,6 @@
/* */
/***************************************************************/
/* $Id: italian.h,v 1.6 2000-02-18 03:46:23 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "Italian"
@@ -108,23 +106,23 @@
MonthName[m], y);
#define L_C_OVER sprintf(s, "%s", DayName[jul%7]);
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DATESEP,\
m+1, DATESEP, y);
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep,\
m+1, DateSep, y);
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DATESEP, d, DATESEP, y);
#define L_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_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, \
MonthName[m], y);
#define L_K_OVER sprintf(s, "%s, %d %s", DayName[jul%7], d, \
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, \
MonthName[m], y);

View File

@@ -11,8 +11,6 @@
/* */
/***************************************************************/
/* $Id: norwgian.h,v 1.6 2000-02-18 03:46:24 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "Norwegian"

View File

@@ -14,8 +14,6 @@
/* */
/***************************************************************/
/* $Id: polish.h,v 1.9 2000-02-18 03:53:51 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "Polish"
@@ -256,7 +254,7 @@ EXTERN char *ErrMsg[] =
"Po AT oczekiwany jest czas",
"S\263owo UNTIL u\277yte dw\363krotnie",
"Niekompletna specyfikacja daty",
"S\263owo SCANFROM u\277yte dw\363krotnie",
"S\263owo FROM/SCANFROM u\277yte dw\363krotnie",
"Zmienna",
"Warto\266\346",
"*NIE ZDEFINIOWANE*",
@@ -280,7 +278,10 @@ EXTERN char *ErrMsg[] =
"Brak przypomnie\361.",
"%d Przypomnienia zakolejkowane na p\363\274niej.\n",
"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",
"String too long"
#else /* ISOLATIN1 */
"OK",
"Brakujacy ']'",
@@ -356,7 +357,7 @@ EXTERN char *ErrMsg[] =
"Po AT oczekiwany jest czas",
"Slowo UNTIL uzyte dwokrotnie",
"Niekompletna specyfikacja daty",
"Slowo SCANFROM uzyte dwokrotnie",
"Slowo FROM/SCANFROM uzyte dwokrotnie",
"Zmienna",
"Wartosc",
"*UNDEFINED*",
@@ -380,7 +381,10 @@ EXTERN char *ErrMsg[] =
"Brak przypomnien.",
"%d Przypomnienia zakolejkowane na pozniej.\n",
"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",
"String too long"
#endif /* ISOLATIN1 */
};
#endif /* MK_GLOBALS */
@@ -388,11 +392,7 @@ EXTERN char *ErrMsg[] =
/* The following is only used in init.c */
#ifdef L_IN_INIT
#define L_USAGE_OVERRIDE 1
#ifdef HAVE_PROTOS
PUBLIC void Usage(void)
#else
void Usage()
#endif /* HAVE_PROTOS */
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "Copyright 1999-2000 Roaring Penguin Software Inc.\n");

View File

@@ -15,8 +15,6 @@
/* */
/***************************************************************/
/* $Id: portbr.h,v 1.8 2000-02-18 03:53:52 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "Brazilian Portuguese"
@@ -222,7 +220,7 @@ EXTERN char *ErrMsg[] =
"Esperando hora apos AT",
"Keyword UNTIL usada duas vezes",
"Especificacao de data incompleta",
"Keyword SCANFROM usada duas vezes",
"Keyword FROM/SCANFROM usada duas vezes",
"Variavel",
"Valor",
"*INDEFINIDO*",
@@ -246,18 +244,17 @@ EXTERN char *ErrMsg[] =
"Sem compromissos.",
"%d compromisso(s) colocados na fila para mais tarde.\n",
"Esperando numero",
"Funcao ilegal na clausula WARN"
"Funcao ilegal na clausula WARN",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
};
#endif /* MK_GLOBALS */
/* The following is only used in init.c */
#ifdef L_IN_INIT
#define L_USAGE_OVERRIDE 1
#ifdef HAVE_PROTOS
PUBLIC void Usage(void)
#else
void Usage()
#endif /* HAVE_PROTOS */
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "(C) 1999-2000 Roaring Penguin Software Inc.\n");

View File

@@ -14,8 +14,6 @@
/* */
/***************************************************************/
/* $Id: romanian.h,v 1.6 2000-02-18 03:46:27 dfs Exp $ */
/* The very first define in a language support file must be L_LANGNAME: */
#define L_LANGNAME "Romanian"

View File

@@ -12,8 +12,6 @@
/* */
/***************************************************************/
/* $Id: spanish.h,v 1.3 2000-02-18 03:46:28 dfs Exp $ */
#define L_LANGNAME "Spanish"
/* Nombres de los di'as de la semana */

View File

@@ -12,29 +12,13 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: main.c,v 1.11 2000-02-18 03:46:01 dfs Exp $";
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <signal.h>
#include <string.h>
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <ctype.h>
#ifdef TIME_WITH_SYS_TIME
@@ -48,17 +32,7 @@ static char const RCSID[] = "$Id: main.c,v 1.11 2000-02-18 03:46:01 dfs Exp $";
#endif
#endif
#ifdef AMIGA
#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 "protos.h"
@@ -66,21 +40,11 @@ static char const RCSID[] = "$Id: main.c,v 1.11 2000-02-18 03:46:01 dfs Exp $";
#include "globals.h"
#include "err.h"
PRIVATE void DoReminders ARGS ((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
static void DoReminders(void);
/* Whooo... the putchar/Putchar/PutChar macros are a mess...
my apologies... */
#ifdef OS2_POPUP
#define Putchar(c) {if (AsPopUp) PutcPopUp(c); else putchar(c);}
#else
#define Putchar(c) PutChar(c)
#endif
/***************************************************************/
/***************************************************************/
@@ -89,27 +53,19 @@ long timelocal ARGS((struct tm *tm));
/** **/
/***************************************************************/
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int main(int argc, char *argv[])
#else
int main(argc, argv)
int argc;
char *argv[];
#endif
int main(int argc, char *argv[])
{
#ifdef HAVE_QUEUED
int pid;
#endif
/* The very first thing to do is to set up ErrFp to be stderr */
ErrFp = stderr;
/* Set up global vars */
ArgC = argc;
ArgV = argv;
ArgV = (char const **) argv;
InitRemind(argc, argv);
if(DoCalendar || DoSimpleCalendar) {
InitRemind(argc, (char const **) argv);
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
ProduceCalendar();
return 0;
}
@@ -128,32 +84,17 @@ char *argv[];
if (!Hush) {
if (DestroyOmitContexts())
Eprint("%s", ErrMsg[E_PUSH_NOPOP]);
#ifdef HAVE_QUEUED
if (!Daemon && !NextMode && !NumTriggered && !NumQueued) {
printf("%s\n", ErrMsg[E_NOREMINDERS]);
} else if (!Daemon && !NextMode && !NumTriggered) {
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 (SortByDate) IssueSortedReminders();
/* If there are any background reminders queued up, handle them */
#ifdef HAVE_QUEUED
if (NumQueued || Daemon) {
if (DontFork) {
@@ -171,7 +112,6 @@ char *argv[];
}
}
}
#endif
if (Iterations) {
ClearGlobalOmits();
DestroyOmitContexts();
@@ -190,15 +130,11 @@ char *argv[];
/* The normal case - we're not doing a calendar. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void DoReminders(void)
#else
static void DoReminders()
#endif
static void DoReminders(void)
{
int r;
Token tok;
char *s;
char const *s;
Parser p;
if (!UseStdin) {
@@ -212,7 +148,7 @@ static void DoReminders()
exit(1);
}
r=OpenFile(InitialFile);
r=IncludeFile(InitialFile);
if (r) {
fprintf(ErrFp, "%s %s: %s\n", ErrMsg[E_ERR_READING],
InitialFile, ErrMsg[r]);
@@ -308,12 +244,7 @@ static void DoReminders()
/* 1 January 1990. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int Julian(int year, int month, int day)
#else
int Julian(year, month, day)
int day, month, year;
#endif
int Julian(int year, int month, int day)
{
int y1 = BASE-1, y2 = year-1;
@@ -332,13 +263,7 @@ int day, month, year;
/* Convert a Julian date to year, month, day. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
void FromJulian(int jul, int *y, int *m, int *d)
{
int try_yr = (jul / 365) + BASE;
int try_mon = 0;
@@ -378,14 +303,7 @@ int *y, *m, *d;
/* zero, then just peek ahead; don't advance pointer. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ParseChar(ParsePtr p, int *err, int peek)
#else
int ParseChar(p, err, peek)
ParsePtr p;
int *err;
int peek;
#endif
int ParseChar(ParsePtr p, int *err, int peek)
{
Value val;
int r;
@@ -412,7 +330,7 @@ int peek;
return *(p->epos++);
}
}
free(p->etext); /* End of substituted expression */
free((void *) p->etext); /* End of substituted expression */
p->etext = NULL;
p->epos = NULL;
p->isnested = 0;
@@ -427,6 +345,7 @@ int peek;
return *(p->pos++);
}
}
p->expr_happened = 1;
p->pos++;
r = EvalExpr(&(p->pos), &val);
if (r) {
@@ -457,14 +376,7 @@ int peek;
/* Parse the next non-space character. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ParseNonSpaceChar(ParsePtr p, int *err, int peek)
#else
int ParseNonSpaceChar(p, err, peek)
ParsePtr p;
int *err;
int peek;
#endif
int ParseNonSpaceChar(ParsePtr p, int *err, int peek)
{
int ch;
@@ -487,13 +399,7 @@ int peek;
/* Parse a token delimited by whitespace. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ParseToken(ParsePtr p, DynamicBuffer *dbuf)
#else
int ParseToken(p, dbuf)
ParsePtr p;
DynamicBuffer *dbuf;
#endif
int ParseToken(ParsePtr p, DynamicBuffer *dbuf)
{
int c, err;
@@ -529,13 +435,7 @@ DynamicBuffer *dbuf;
/* invalid. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ParseIdentifier(ParsePtr p, DynamicBuffer *dbuf)
#else
int ParseIdentifier(p, dbuf)
ParsePtr p;
DynamicBuffer *dbuf;
#endif
int ParseIdentifier(ParsePtr p, DynamicBuffer *dbuf)
{
int c, err;
@@ -577,13 +477,7 @@ DynamicBuffer *dbuf;
/* return the value. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int EvaluateExpr(ParsePtr p, Value *v)
#else
int EvaluateExpr(p, v)
ParsePtr p;
Value *v;
#endif
int EvaluateExpr(ParsePtr p, Value *v)
{
int bracketed = 0;
@@ -610,47 +504,28 @@ Value *v;
/* Eprint - print an error message. */
/* */
/***************************************************************/
#ifdef HAVE_STDARG_H
#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
void Eprint(char const *fmt, ...)
{
va_list argptr;
#ifndef HAVE_STDARG_H
char *fmt;
#endif
/* Check if more than one error msg. from this line */
if (!FreshLine && !ShowAllErrors) return;
if (FreshLine) {
if (FreshLine && FileName) {
FreshLine = 0;
if (strcmp(FileName, "-"))
(void) fprintf(ErrFp, "%s(%d): ", FileName, LineNo);
else
(void) fprintf(ErrFp, "-stdin-(%d): ", LineNo);
if (DebugFlag & DB_PRTLINE) OutputLine(ErrFp);
} else fprintf(ErrFp, " ");
} else if (FileName) {
fprintf(ErrFp, " ");
}
#ifdef HAVE_STDARG_H
va_start(argptr, fmt);
#else
va_start(argptr);
fmt = va_arg(argptr, char *);
#endif
(void) vfprintf(ErrFp, fmt, argptr);
(void) fputc('\n', ErrFp);
#ifndef HAVE_STDARG_H
va_end(argptr);
#endif
return;
}
@@ -662,15 +537,10 @@ va_dcl
/* simply involves escaping newlines. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void OutputLine(FILE *fp)
#else
void OutputLine(fp)
FILE *fp;
#endif
void OutputLine(FILE *fp)
{
register char *s = CurLine;
register char c = 0;
char const *s = CurLine;
char c = 0;
while (*s) {
if (*s == '\n') Putc('\\', fp);
@@ -687,13 +557,7 @@ FILE *fp;
/* Create a parser given a string buffer */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void CreateParser(char *s, ParsePtr p)
#else
void CreateParser(s, p)
char *s;
ParsePtr p;
#endif
void CreateParser(char const *s, ParsePtr p)
{
p->text = s;
p->pos = s;
@@ -702,6 +566,7 @@ ParsePtr p;
p->etext = NULL;
p->allownested = 1;
p->tokenPushed = NULL;
p->expr_happened = 0;
DBufInit(&p->pushedToken);
}
@@ -712,15 +577,10 @@ ParsePtr p;
/* Destroy a parser, freeing up resources used. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void DestroyParser(ParsePtr p)
#else
void DestroyParser(p)
ParsePtr p;
#endif
void DestroyParser(ParsePtr p)
{
if (p->isnested && p->etext) {
free(p->etext);
free((void *) p->etext);
p->etext = NULL;
p->isnested = 0;
}
@@ -733,16 +593,10 @@ ParsePtr p;
/* on a per-parser basis. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int PushToken(const char *tok, ParsePtr p)
#else
int PushToken(tok, p)
char *tok;
ParsePtr p;
#endif
int PushToken(char const *tok, ParsePtr p)
{
DBufFree(&p->pushedToken);
if (DBufPuts(&p->pushedToken, (char *) tok) != OK ||
if (DBufPuts(&p->pushedToken, tok) != OK ||
DBufPutc(&p->pushedToken, ' ') != OK) {
DBufFree(&p->pushedToken);
return E_NO_MEM;
@@ -758,26 +612,8 @@ ParsePtr p;
/* Return the system time in seconds past midnight */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC long SystemTime(int realtime)
#else
long SystemTime(realtime)
int realtime;
#endif
long SystemTime(int realtime)
{
#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;
struct tm *t;
@@ -787,8 +623,8 @@ int realtime;
t = localtime(&tloc);
return (long) t->tm_hour * 3600L + (long) t->tm_min * 60L +
(long) t->tm_sec;
#endif
}
/***************************************************************/
/* */
/* SystemDate */
@@ -798,25 +634,8 @@ int realtime;
/* year.) */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int SystemDate(int *y, int *m, int *d)
#else
int SystemDate(y, m, d)
int *d;
int *m;
int *y;
#endif
int SystemDate(int *y, int *m, int *d)
{
#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;
struct tm *t;
@@ -826,7 +645,7 @@ int *y;
*d = t->tm_mday;
*m = t->tm_mon;
*y = t->tm_year + 1900;
#endif
return Julian(*y, *m, *d);
}
@@ -836,12 +655,7 @@ int *y;
/* DoIf - handle the IF command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoIf(ParsePtr p)
#else
int DoIf(p)
ParsePtr p;
#endif
int DoIf(ParsePtr p)
{
Value v;
int r;
@@ -875,12 +689,7 @@ ParsePtr p;
/* DoElse - handle the ELSE command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoElse(ParsePtr p)
#else
int DoElse(p)
ParsePtr p;
#endif
int DoElse(ParsePtr p)
{
unsigned syndrome;
@@ -899,12 +708,7 @@ ParsePtr p;
/* DoEndif - handle the Endif command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoEndif(ParsePtr p)
#else
int DoEndif(p)
ParsePtr p;
#endif
int DoEndif(ParsePtr p)
{
if (!NumIfs) return E_ENDIF_NO_IF;
NumIfs--;
@@ -918,14 +722,9 @@ ParsePtr p;
/* Handle the IFTRIG command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoIfTrig(ParsePtr p)
#else
int DoIfTrig(p)
ParsePtr p;
#endif
int DoIfTrig(ParsePtr p)
{
int r;
int r, err;
unsigned syndrome;
Trigger trig;
TimeTrig tim;
@@ -935,12 +734,12 @@ ParsePtr p;
if (NumIfs >= IF_NEST) return E_NESTED_IF;
if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE;
else {
if ( (r=ParseRem(p, &trig, &tim)) ) return r;
if ( (r=ParseRem(p, &trig, &tim, 1)) ) return r;
if (trig.typ != NO_TYPE) return E_PARSE_ERR;
jul = ComputeTrigger(trig.scanfrom, &trig, &r);
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 1);
if (r) syndrome = IF_TRUE | BEFORE_ELSE;
else {
if (ShouldTriggerReminder(&trig, &tim, jul))
if (ShouldTriggerReminder(&trig, &tim, jul, &err))
syndrome = IF_TRUE | BEFORE_ELSE;
else
syndrome = IF_FALSE | BEFORE_ELSE;
@@ -959,11 +758,7 @@ ParsePtr p;
/* stack, should we ignore the current line? */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ShouldIgnoreLine(void)
#else
int ShouldIgnoreLine()
#endif
int ShouldIgnoreLine(void)
{
register int i, syndrome;
@@ -985,12 +780,7 @@ int ShouldIgnoreLine()
/* Verify that current line contains no more tokens. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int VerifyEoln(ParsePtr p)
#else
int VerifyEoln(p)
ParsePtr p;
#endif
int VerifyEoln(ParsePtr p)
{
int r;
@@ -1016,12 +806,7 @@ ParsePtr p;
/* Set the debug options under program control. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoDebug(ParsePtr p)
#else
int DoDebug(p)
ParsePtr p;
#endif
int DoDebug(ParsePtr p)
{
int err;
int ch;
@@ -1078,6 +863,11 @@ ParsePtr p;
else DebugFlag &= ~DB_PRTLINE;
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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoBanner(ParsePtr p)
#else
int DoBanner(p)
ParsePtr p;
#endif
int DoBanner(ParsePtr p)
{
int err;
int c;
@@ -1133,12 +918,7 @@ ParsePtr p;
/* */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoRun(ParsePtr p)
#else
int DoRun(p)
ParsePtr p;
#endif
int DoRun(ParsePtr p)
{
int r;
@@ -1170,12 +950,7 @@ ParsePtr p;
/* Flush stdout and stderr */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoFlush(ParsePtr p)
#else
int DoFlush(p)
ParsePtr p;
#endif
int DoFlush(ParsePtr p)
{
fflush(stdout);
fflush(stderr);
@@ -1189,12 +964,7 @@ ParsePtr p;
/* Handle the EXIT command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void DoExit(ParsePtr p)
#else
void DoExit(p)
ParsePtr p;
#endif
void DoExit(ParsePtr p)
{
int r;
Value v;
@@ -1211,17 +981,12 @@ ParsePtr p;
/* Issue an error message under program control. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoErrMsg(ParsePtr p)
#else
int DoErrMsg(p)
ParsePtr p;
#endif
int DoErrMsg(ParsePtr p)
{
TimeTrig tt;
Trigger t;
int r;
char *s;
char const *s;
DynamicBuffer buf;
@@ -1258,12 +1023,7 @@ static int FoldArray[2][7] = {
{2024, 2008, 2020, 2004, 2016, 2000, 2012}
};
#ifdef HAVE_PROTOS
PUBLIC int CalcMinsFromUTC(int jul, int tim, int *mins, int *isdst)
#else
int CalcMinsFromUTC(jul, tim, mins, isdst)
int jul, tim, *mins, *isdst;
#endif
int CalcMinsFromUTC(int jul, int tim, int *mins, int *isdst)
{
/* 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 */
#if !defined(HAVE_MKTIME)
loc_t = timelocal(&local);
local.tm_isdst = 0;
utc_t = timegm(&local);
#else
/* Horrible contortions to get minutes from UTC portably */
loc_t = mktime(&local);
if (loc_t == -1) return 1;
@@ -1308,21 +1063,10 @@ int jul, tim, *mins, *isdst;
utc.tm_isdst = 0;
utc_t = mktime(&utc);
if (utc_t == -1) return 1;
#endif
/* Compute difference between local time and UTC in seconds.
Be careful, since time_t might be unsigned. */
#ifdef HAVE_DIFFTIME
tdiff = (int) difftime(loc_t, utc_t);
#else
/* 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 (mins) *mins = (int)(tdiff / 60);
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! */
#define ISBLANK(c) (isspace(c) && (c) != '\n')
#ifdef HAVE_PROTOS
#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
void FillParagraph(char const *s)
{
int line = 0;
@@ -1367,7 +1096,7 @@ char *s;
int doublespace = 1;
int pendspace;
int len;
char *t;
char const *t;
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 */
@@ -1515,12 +1169,7 @@ struct tm *tm;
/* Convert a local date/time to a UTC date/time. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void LocalToUTC(int locdate, int loctime, int *utcdate, int *utctime)
#else
void LocalToUTC(locdate, loctime, utcdate, utctime)
int locdate, loctime, *utcdate, *utctime;
#endif
void LocalToUTC(int locdate, int loctime, int *utcdate, int *utctime)
{
int diff;
int dummy;
@@ -1530,10 +1179,10 @@ int locdate, loctime, *utcdate, *utctime;
loctime -= diff;
if (loctime < 0) {
loctime += 1440;
loctime += MINUTES_PER_DAY;
locdate--;
} else if (loctime >= 1440) {
loctime -= 1440;
} else if (loctime >= MINUTES_PER_DAY) {
loctime -= MINUTES_PER_DAY;
locdate++;
}
*utcdate = locdate;
@@ -1547,12 +1196,7 @@ int locdate, loctime, *utcdate, *utctime;
/* Convert a UTC date/time to a local date/time. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
#else
void UTCToLocal(utcdate, utctime, locdate, loctime)
int utcdate, utctime, *locdate, *loctime;
#endif
void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
{
int diff;
int dummy;
@@ -1563,10 +1207,10 @@ int utcdate, utctime, *locdate, *loctime;
utctime += diff;
if (utctime < 0) {
utctime += 1440;
utctime += MINUTES_PER_DAY;
utcdate--;
} else if (utctime >= 1440) {
utctime -= 1440;
} else if (utctime >= MINUTES_PER_DAY) {
utctime -= MINUTES_PER_DAY;
utcdate++;
}
*locdate = utcdate;
@@ -1581,34 +1225,11 @@ int utcdate, utctime, *locdate, *loctime;
/* contents of the queue. This does NOT work when the -f */
/* command-line flag is supplied. */
/* */
/* For OS/2, this has to be in the main thread. */
/* */
/***************************************************************/
#ifdef HAVE_QUEUED
#ifdef __BORLANDC__
void __cdecl SigIntHandler(int d)
#else
#ifdef HAVE_PROTOS
RETSIGTYPE SigIntHandler(int d)
#else
RETSIGTYPE SigIntHandler()
#endif
#endif
void SigIntHandler(int d)
{
signal(SIGINT, SigIntHandler);
#ifdef __BORLANDC__
signal(SIGINT, SIG_DFL);
#else
#ifdef __OS2__
signal(SIGINT, SIG_ACK);
#endif
#endif
GotSigInt();
#ifndef UNIX
exit(0);
#endif
}
#endif /* HAVE_QUEUED */

249
src/md5.c Normal file
View 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
View 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 */

View File

@@ -11,7 +11,6 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: moon.c,v 1.5 2000-02-18 03:46:02 dfs Exp $";
/* All of these routines were adapted from the program "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.5 2000-02-18 03:46:02 dfs Exp $";
that credit and blame may be properly apportioned.
*/
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdio.h>
#include <math.h>
#include <time.h>
@@ -75,14 +71,14 @@ static char const RCSID[] = "$Id: moon.c,v 1.5 2000-02-18 03:46:02 dfs Exp $";
#include "err.h"
/* Function prototypes */
PRIVATE long jdate ARGS((int y, int mon, int day));
PRIVATE double jtime ARGS((int y, int mon, int day, int hour, int min, int sec));
PRIVATE void jyear ARGS((double td, int *yy, int *mm, int *dd));
PRIVATE void jhms ARGS((double j, int *h, int *m, int *s));
PRIVATE double meanphase ARGS((double sdate, double phase, double *usek));
PRIVATE double truephase ARGS((double k, double phase));
PRIVATE double kepler ARGS((double m, double ecc));
PRIVATE double phase ARGS((double, double *, double *, double *, double *, double *, double *));
static long jdate (int y, int mon, int day);
static double jtime (int y, int mon, int day, int hour, int min, int sec);
static void jyear (double td, int *yy, int *mm, int *dd);
static void jhms (double j, int *h, int *m, int *s);
static double meanphase (double sdate, double phase, double *usek);
static double truephase (double k, double phase);
static double kepler (double m, double ecc);
static double phase (double, double *, double *, double *, double *, double *, double *);
/* 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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE long jdate(int y, int mon, int day)
#else
static long jdate(y, mon, day)
int y, mon, day;
#endif
static long jdate(int y, int mon, int day)
{
long c, m;
@@ -180,12 +171,7 @@ int y, mon, day;
/* i.e. Julian date plus day fraction, expressed as a double */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
static double jtime(int y, int mon, int day, int hour, int min, int sec)
{
return (jdate(y, mon, day)-0.5) +
(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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
static void jyear(double td, int *yy, int *mm, int *dd)
{
double j, d, y, m;
@@ -239,13 +219,7 @@ int *yy, *mm, *dd;
/* Convert a Julian time to hour, minutes and seconds. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
static void jhms(double j, int *h, int *m, int *s)
{
long ij;
@@ -273,13 +247,7 @@ int *h, *m, *s;
/* than this calculation reveals. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE double meanphase(double sdate, double phase, double *usek)
#else
static double meanphase(sdate, phase, usek)
double sdate, phase;
double *usek;
#endif
static double meanphase(double sdate, double phase, double *usek)
{
double k, t, t2, t3, nt1;
@@ -315,12 +283,7 @@ double *usek;
/* the true, corrected phase time. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE double truephase(double k, double phase)
#else
static double truephase(k, phase)
double k, phase;
#endif
static double truephase(double k, double phase)
{
double t, t2, t3, pt, m, mprime, f;
int apcor = 0;
@@ -401,12 +364,7 @@ double k, phase;
/* Solve the equation of Kepler. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE double kepler(double m, double ecc)
#else
static double kepler(m, ecc)
double m, ecc;
#endif
static double kepler(double m, double ecc)
{
double e, delta;
#define EPSILON 1E-6
@@ -434,24 +392,13 @@ double m, ecc;
/* the centre of the Earth. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE double phase(double pdate,
double *pphase,
double *mage,
double *dist,
double *angdia,
double *sudist,
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
static double phase(double pdate,
double *pphase,
double *mage,
double *dist,
double *angdia,
double *sudist,
double *suangdia)
{
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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int MoonPhase(int date, int time)
#else
int MoonPhase(date, time)
int date, time;
#endif
int MoonPhase(int date, int time)
{
int utcd, utct;
int y, m, d;
@@ -599,12 +541,7 @@ int date, time;
/* 0 to 3 for new, 1stq, full, 3rdq */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
void HuntPhase(int startdate, int starttim, int phas, int *date, int *time)
{
int utcd, utct;
int y, m, d;

View File

@@ -12,25 +12,18 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: omit.c,v 1.6 2000-02-18 03:46:03 dfs Exp $";
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "types.h"
#include "protos.h"
#include "globals.h"
#include "err.h"
#include "expr.h"
PRIVATE int BexistsIntArray ARGS ((int array[], int num, int key));
PRIVATE void InsertIntoSortedArray ARGS ((int *array, int num, int key));
static int BexistsIntArray (int array[], int num, int key);
static void InsertIntoSortedArray (int *array, int num, int key);
/* Arrays for the global omits */
static int FullOmitArray[MAX_FULL_OMITS];
@@ -57,11 +50,7 @@ static OmitContext *SavedOmitContexts = NULL;
/* Clear all the global OMIT context. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ClearGlobalOmits(void)
#else
int ClearGlobalOmits()
#endif
int ClearGlobalOmits(void)
{
NumFullOmits = NumPartialOmits = 0;
return OK;
@@ -74,12 +63,7 @@ int ClearGlobalOmits()
/* The command-line function CLEAR-OMIT-CONTEXT */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoClear(ParsePtr p)
#else
int DoClear(p)
ParsePtr p;
#endif
int DoClear(ParsePtr p)
{
ClearGlobalOmits();
return VerifyEoln(p);
@@ -94,11 +78,7 @@ ParsePtr p;
/* destroyed. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DestroyOmitContexts(void)
#else
int DestroyOmitContexts()
#endif
int DestroyOmitContexts(void)
{
OmitContext *c = SavedOmitContexts;
OmitContext *d;
@@ -123,12 +103,7 @@ int DestroyOmitContexts()
/* Push the OMIT context on to the stack. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int PushOmitContext(ParsePtr p)
#else
int PushOmitContext(p)
ParsePtr p;
#endif
int PushOmitContext(ParsePtr p)
{
register int i;
OmitContext *context;
@@ -139,12 +114,12 @@ ParsePtr p;
context->numfull = NumFullOmits;
context->numpart = NumPartialOmits;
context->fullsave = (int *) malloc(NumFullOmits * sizeof(int));
context->fullsave = malloc(NumFullOmits * sizeof(int));
if (NumFullOmits && !context->fullsave) {
free(context);
return E_NO_MEM;
}
context->partsave = (int *) malloc(NumPartialOmits * sizeof(int));
context->partsave = malloc(NumPartialOmits * sizeof(int));
if (NumPartialOmits && !context->partsave) {
free(context->fullsave);
free(context);
@@ -171,12 +146,7 @@ ParsePtr p;
/* Pop the OMIT context off of the stack. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int PopOmitContext(ParsePtr p)
#else
int PopOmitContext(p)
ParsePtr p;
#endif
int PopOmitContext(ParsePtr p)
{
register int i;
@@ -208,31 +178,57 @@ ParsePtr p;
/* */
/* IsOmitted */
/* */
/* Return non-zero if date is OMITted, zero if it is not. */
/* Set *omit to non-zero if date is omitted, else 0. Returns */
/* OK or an error code. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int IsOmitted(int jul, int localomit)
#else
int IsOmitted(jul, localomit)
int jul, localomit;
#endif
int IsOmitted(int jul, int localomit, char const *omitfunc, int *omit)
{
int y, m, d;
/* If we have an omitfunc, we *only* use it and ignore local/global
OMITs */
if (omitfunc && *omitfunc && UserFuncExists(omitfunc)) {
char expr[VAR_NAME_LEN + 32];
char const *s;
int r;
Value v;
FromJulian(jul, &y, &m, &d);
sprintf(expr, "%s('%04d-%02d-%02d')",
omitfunc, y, m+1, d);
s = expr;
r = EvalExpr(&s, &v);
if (r) return r;
if (v.type == INT_TYPE && v.v.val != 0) {
*omit = 1;
} else {
*omit = 0;
}
return OK;
}
/* Is it omitted because of local omits? */
if (localomit & (1 << (jul % 7))) return 1;
if (localomit & (1 << (jul % 7))) {
*omit = 1;
return OK;
}
/* Is it omitted because of fully-specified omits? */
if (BexistsIntArray(FullOmitArray, NumFullOmits, jul)) return 1;
if (BexistsIntArray(FullOmitArray, NumFullOmits, jul)) {
*omit = 1;
return OK;
}
/* Get the syndrome */
FromJulian(jul, &y, &m, &d);
if (BexistsIntArray(PartialOmitArray, NumPartialOmits, (m << 5) + d))
return 1;
if (BexistsIntArray(PartialOmitArray, NumPartialOmits, (m << 5) + d)) {
*omit = 1;
return OK;
}
/* Not omitted */
return 0;
*omit = 0;
return OK;
}
/***************************************************************/
@@ -243,12 +239,7 @@ int jul, localomit;
/* element is found, 0 otherwise. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int BexistsIntArray(int array[], int num, int key)
#else
static int BexistsIntArray(array, num, key)
int array[], num, key;
#endif
static int BexistsIntArray(int array[], int num, int key)
{
int top=num-1, bot=0, mid;
@@ -269,12 +260,7 @@ int array[], num, key;
/* room in the array for it. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void InsertIntoSortedArray(int *array, int num, int key)
#else
static void InsertIntoSortedArray(array, num, key)
int *array, num, key;
#endif
static void InsertIntoSortedArray(int *array, int num, int key)
{
/* num is number of elements CURRENTLY in the array. */
int *cur = array+num;
@@ -293,12 +279,7 @@ int *array, num, key;
/* Do a global OMIT command. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoOmit(ParsePtr p)
#else
int DoOmit(p)
ParsePtr p;
#endif
int DoOmit(ParsePtr p)
{
int y = NO_YR, m = NO_MON, d = NO_DAY, r;
Token tok;

View File

@@ -10,166 +10,125 @@
/* */
/***************************************************************/
/* $Id: protos.h,v 1.8 2000-02-18 03:46:05 dfs Exp $ */
#ifdef HAVE_PROTOS
#define ARGS(x) x
#else
#define ARGS(x) ()
#endif
/* Define a string assignment macro - be careful!!! */
#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
/* 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"
#ifndef HAVE_STRSTR
char *strstr ARGS ((char *s1, char *s2));
#endif
int CallUserFunc ARGS ((char *name, int nargs));
int DoFset ARGS ((ParsePtr p));
void ProduceCalendar ARGS ((void));
char *SimpleTime ARGS ((int tim));
int DoRem ARGS ((ParsePtr p));
int DoFlush ARGS ((ParsePtr p));
void DoExit ARGS ((ParsePtr p));
int ParseRem ARGS ((ParsePtr s, Trigger *trig, TimeTrig *tim));
#ifdef OS2_POPUP
int TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul,
int AsPopUp));
#else
int TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul));
#endif
int ShouldTriggerReminder ARGS ((Trigger *t, TimeTrig *tim, int jul));
int DoSubst ARGS ((ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode));
int DoSubstFromString ARGS ((char *source, DynamicBuffer *dbuf, int jul, int tim));
int EvalExpr ARGS ((char **e, Value *v));
int DoCoerce ARGS ((char type, Value *v));
void PrintValue ARGS ((Value *v, FILE *fp));
int CopyValue ARGS ((Value *dest, const Value *src));
int ReadLine ARGS ((void));
int OpenFile ARGS ((const char *fname));
int PopFile ARGS ((void));
int DoInclude ARGS ((ParsePtr p));
int IncludeFile ARGS ((const char *fname));
int GetAccessDate ARGS ((char *file));
int SetAccessDate ARGS ((char *fname, int jul));
int TopLevel ARGS ((void));
int CallFunc ARGS ((Operator *f, int nargs));
void InitRemind ARGS ((int argc, char *argv[]));
void Usage ARGS ((void));
int main ARGS ((int argc, char *argv[]));
int Julian ARGS ((int year, int month, int day));
void FromJulian ARGS ((int jul, int *y, int *m, int *d));
int ParseChar ARGS ((ParsePtr p, int *err, int peek));
int ParseToken ARGS ((ParsePtr p, DynamicBuffer *dbuf));
int ParseIdentifier ARGS ((ParsePtr p, DynamicBuffer *dbuf));
int EvaluateExpr ARGS ((ParsePtr p, Value *v));
int Evaluate ARGS ((char **s, Var *locals));
int FnPopValStack ARGS ((Value *val));
void Eprint ARGS ((const char *fmt, ...));
void OutputLine ARGS ((FILE *fp));
void CreateParser ARGS ((char *s, ParsePtr p));
void DestroyParser ARGS ((ParsePtr p));
int PushToken ARGS ((const char *tok, ParsePtr p));
long SystemTime ARGS ((int realtime));
int SystemDate ARGS ((int *y, int *m, int *d));
int DoIf ARGS ((ParsePtr p));
int DoElse ARGS ((ParsePtr p));
int DoEndif ARGS ((ParsePtr p));
int DoIfTrig ARGS ((ParsePtr p));
int ShouldIgnoreLine ARGS ((void));
int VerifyEoln ARGS ((ParsePtr p));
int DoDebug ARGS ((ParsePtr p));
int DoBanner ARGS ((ParsePtr p));
int DoRun ARGS ((ParsePtr p));
int DoErrMsg ARGS ((ParsePtr p));
int ClearGlobalOmits ARGS ((void));
int DoClear ARGS ((ParsePtr p));
int DestroyOmitContexts ARGS ((void));
int PushOmitContext ARGS ((ParsePtr p));
int PopOmitContext ARGS ((ParsePtr p));
int IsOmitted ARGS ((int jul, int localomit));
int DoOmit ARGS ((ParsePtr p));
int QueueReminder ARGS ((ParsePtr p, Trigger *trig, TimeTrig *tim, const char *sched));
void HandleQueuedReminders ARGS ((void));
char *FindInitialToken ARGS ((Token *tok, char *s));
void FindToken ARGS ((const char *s, Token *tok));
void FindNumericToken ARGS ((const char *s, Token *t));
int ComputeTrigger ARGS ((int today, Trigger *trig, int *err));
char *StrnCpy ARGS ((char *dest, const char *source, int n));
int StrMatch ARGS ((const char *s1, const char *s2, int n));
int StrinCmp ARGS ((const char *s1, const char *s2, int n));
char *StrDup ARGS ((const char *s));
int StrCmpi ARGS ((const char *s1, const char *s2));
Var *FindVar ARGS ((const char *str, int create));
int DeleteVar ARGS ((const char *str));
int SetVar ARGS ((const char *str, Value *val));
int GetVarValue ARGS ((const char *str, Value *val, Var *locals));
int DoSet ARGS ((Parser *p));
int DoUnset ARGS ((Parser *p));
int DoDump ARGS ((ParsePtr p));
void DumpVarTable ARGS ((void));
void DestroyVars ARGS ((int all));
int PreserveVar ARGS ((char *name));
int DoPreserve ARGS ((Parser *p));
int DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
int DoMsgCommand ARGS ((char *cmd, char *msg));
int ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
unsigned int HashVal ARGS ((const char *str));
int DateOK ARGS ((int y, int m, int d));
Operator *FindFunc ARGS ((char *name, Operator where[], int num));
int InsertIntoSortBuffer ARGS ((int jul, int tim, char *body, int typ, int prio));
void IssueSortedReminders ARGS ((void));
int UserFuncExists ARGS ((char *fn));
void JulToHeb ARGS((int jul, int *hy, int *hm, int *hd));
int HebNameToNum ARGS((const char *mname));
char *HebMonthName ARGS((int m, int y));
int RoshHashana ARGS((int i));
long DaysToHebYear ARGS((int y));
int DaysInHebYear ARGS((int y));
char *DaysInHebMonths ARGS((int ylen));
int HebToJul ARGS((int hy, int hm, int hd));
int GetValidHebDate ARGS((int yin, int min, int din, int adarbehave, int *mout, int *dout, int yahr));
int GetNextHebrewDate ARGS((int julstart, int hm, int hd, int yahr, int adarbehave, int *ans));
int ComputeJahr ARGS ((int y, int m, int d, int *ans));
int GetSysVar ARGS ((const char *name, Value *val));
int SetSysVar ARGS ((const char *name, Value *val));
void DumpSysVarByName ARGS ((const char *name));
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
int CallUserFunc (char const *name, int nargs);
int DoFset (ParsePtr p);
void ProduceCalendar (void);
char const *SimpleTime (int tim);
char const *CalendarTime (int tim, int duration);
int DoRem (ParsePtr p);
int DoFlush (ParsePtr p);
void DoExit (ParsePtr p);
int ParseRem (ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals);
int TriggerReminder (ParsePtr p, Trigger *t, TimeTrig *tim, int jul);
int ShouldTriggerReminder (Trigger *t, TimeTrig *tim, int jul, int *err);
int DoSubst (ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode);
int DoSubstFromString (char const *source, DynamicBuffer *dbuf, int jul, int tim);
int EvalExpr (char const **e, Value *v);
int DoCoerce (char type, Value *v);
void PrintValue (Value *v, FILE *fp);
int CopyValue (Value *dest, const Value *src);
int ReadLine (void);
int OpenFile (char const *fname);
int DoInclude (ParsePtr p);
int IncludeFile (char const *fname);
int GetAccessDate (char const *file);
int SetAccessDate (char const *fname, int jul);
int TopLevel (void);
int CallFunc (Operator *f, int nargs);
void InitRemind (int argc, char const *argv[]);
void Usage (void);
int Julian (int year, int month, int day);
void FromJulian (int jul, int *y, int *m, int *d);
int ParseChar (ParsePtr p, int *err, int peek);
int ParseToken (ParsePtr p, DynamicBuffer *dbuf);
int ParseIdentifier (ParsePtr p, DynamicBuffer *dbuf);
int EvaluateExpr (ParsePtr p, Value *v);
int Evaluate (char const **s, Var *locals);
int FnPopValStack (Value *val);
void Eprint (char const *fmt, ...);
void OutputLine (FILE *fp);
void CreateParser (char const *s, ParsePtr p);
void DestroyParser (ParsePtr p);
int PushToken (char const *tok, ParsePtr p);
long SystemTime (int realtime);
int SystemDate (int *y, int *m, int *d);
int DoIf (ParsePtr p);
int DoElse (ParsePtr p);
int DoEndif (ParsePtr p);
int DoIfTrig (ParsePtr p);
int ShouldIgnoreLine (void);
int VerifyEoln (ParsePtr p);
int DoDebug (ParsePtr p);
int DoBanner (ParsePtr p);
int DoRun (ParsePtr p);
int DoErrMsg (ParsePtr p);
int ClearGlobalOmits (void);
int DoClear (ParsePtr p);
int DestroyOmitContexts (void);
int PushOmitContext (ParsePtr p);
int PopOmitContext (ParsePtr p);
int IsOmitted (int jul, int localomit, char const *omitfunc, int *omit);
int DoOmit (ParsePtr p);
int QueueReminder (ParsePtr p, Trigger *trig, TimeTrig *tim, char const *sched);
void HandleQueuedReminders (void);
char const *FindInitialToken (Token *tok, char const *s);
void FindToken (char const *s, Token *tok);
void FindNumericToken (char const *s, Token *t);
int ComputeTrigger (int today, Trigger *trig, int *err, int save_in_globals);
char *StrnCpy (char *dest, char const *source, int n);
int StrMatch (char const *s1, char const *s2, int n);
int StrinCmp (char const *s1, char const *s2, int n);
char *StrDup (char const *s);
int StrCmpi (char const *s1, char const *s2);
Var *FindVar (char const *str, int create);
int DeleteVar (char const *str);
int SetVar (char const *str, Value *val);
int GetVarValue (char const *str, Value *val, Var *locals);
int DoSet (Parser *p);
int DoUnset (Parser *p);
int DoDump (ParsePtr p);
void DumpVarTable (void);
void DestroyVars (int all);
int PreserveVar (char const *name);
int DoPreserve (Parser *p);
int DoSatRemind (Trigger *trig, TimeTrig *tim, ParsePtr p);
int DoMsgCommand (char const *cmd, char const *msg);
int ParseNonSpaceChar (ParsePtr p, int *err, int peek);
unsigned int HashVal (char const *str);
int DateOK (int y, int m, int d);
Operator *FindFunc (char const *name, Operator where[], int num);
int InsertIntoSortBuffer (int jul, int tim, char const *body, int typ, int prio);
void IssueSortedReminders (void);
int UserFuncExists (char const *fn);
void JulToHeb (int jul, int *hy, int *hm, int *hd);
int HebNameToNum (char const *mname);
char const *HebMonthName (int m, int y);
int RoshHashana (int i);
long DaysToHebYear (int y);
int DaysInHebYear (int y);
char const *DaysInHebMonths (int ylen);
int HebToJul (int hy, int hm, int hd);
int GetValidHebDate (int yin, int min, int din, int adarbehave, int *mout, int *dout, int yahr);
int GetNextHebrewDate (int julstart, int hm, int hd, int yahr, int adarbehave, int *ans);
int ComputeJahr (int y, int m, int d, int *ans);
int GetSysVar (char const *name, Value *val);
int SetSysVar (char const *name, Value *val);
void DumpSysVarByName (char const *name);
int CalcMinsFromUTC (int jul, int tim, int *mins, int *isdst);
void FillParagraph (char const *s);
void LocalToUTC (int locdate, int loctime, int *utcdate, int *utctime);
void UTCToLocal (int utcdate, int utctime, int *locdate, int *loctime);
int MoonPhase (int date, int time);
void HuntPhase (int startdate, int starttim, int phas, int *date, int *time);
int CompareRems (int dat1, int tim1, int prio1, int dat2, int tim2, int prio2, int bydate, int bytime, int byprio, int untimed_first);
void SigIntHandler (int d);
void GotSigInt (void);
void SynthesizeTag(char *);

View File

@@ -11,7 +11,6 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: queue.c,v 1.16 2000-06-26 14:44:07 dfs Exp $";
/* Solaris needs this to get select() prototype */
#ifdef __sun__
@@ -19,40 +18,15 @@ static char const RCSID[] = "$Id: queue.c,v 1.16 2000-06-26 14:44:07 dfs Exp $";
#endif
/* We only want object code generated if we have queued reminders */
#ifdef HAVE_QUEUED
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_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 "err.h"
@@ -66,7 +40,8 @@ typedef struct queuedrem {
int typ;
int RunDisabled;
int ntrig;
char *text;
char const *text;
char passthru[PASSTHRU_LEN+1];
char sched[VAR_NAME_LEN+1];
char tag[TAG_LEN+1];
TimeTrig tt;
@@ -78,12 +53,12 @@ static QueuedRem *QueueHead;
static time_t FileModTime;
static struct stat StatBuf;
PRIVATE void CheckInitialFile ARGS ((void));
PRIVATE int CalculateNextTime ARGS ((QueuedRem *q));
PRIVATE QueuedRem *FindNextReminder ARGS ((void));
PRIVATE int CalculateNextTimeUsingSched ARGS ((QueuedRem *q));
PRIVATE void DaemonWait ARGS ((unsigned int sleeptime));
PRIVATE void reread ARGS((void));
static void CheckInitialFile (void);
static int CalculateNextTime (QueuedRem *q);
static QueuedRem *FindNextReminder (void);
static int CalculateNextTimeUsingSched (QueuedRem *q);
static void DaemonWait (unsigned int sleeptime);
static void reread (void);
/***************************************************************/
/* */
@@ -93,16 +68,8 @@ PRIVATE void reread ARGS((void));
/* enabled. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int QueueReminder(ParsePtr p, Trigger *trig,
TimeTrig *tim, const char *sched)
#else
int QueueReminder(p, trig, tim, sched)
ParsePtr p;
Trigger *trig,
TimeTrig *tim;
char *sched;
#endif
int QueueReminder(ParsePtr p, Trigger *trig,
TimeTrig *tim, char const *sched)
{
QueuedRem *qelem;
@@ -123,12 +90,16 @@ char *sched;
}
NumQueued++;
qelem->typ = trig->typ;
strcpy(qelem->passthru, trig->passthru);
qelem->tt = *tim;
qelem->next = QueueHead;
qelem->RunDisabled = RunDisabled;
qelem->ntrig = 0;
strcpy(qelem->sched, sched);
strcpy(qelem->tag, trig->tag);
if (! *qelem->tag && SynthesizeTags) {
SynthesizeTag(qelem->tag);
}
QueueHead = qelem;
return OK;
}
@@ -140,14 +111,10 @@ char *sched;
/* Handle the issuing of queued reminders in the background */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void HandleQueuedReminders(void)
#else
void HandleQueuedReminders()
#endif
void HandleQueuedReminders(void)
{
QueuedRem *q = QueueHead;
long TimeToSleep;
int TimeToSleep;
unsigned SleepTime;
Parser p;
Trigger trig;
@@ -180,20 +147,16 @@ void HandleQueuedReminders()
Daemon = 0;
} else FileModTime = StatBuf.st_mtime;
}
/* Initialize the queue - initialize all the entries time of issue */
while (q) {
q->tt.nexttime = (int) (SystemTime(0)/60 - 1);
q->tt.nexttime = CalculateNextTime(q);
q = q->next;
}
#ifdef __BORLANDC__
signal(SIGINT, SigIntHandler);
#else
if (!DontFork || Daemon) signal(SIGINT, SigIntHandler);
#endif
/* Sit in a loop, issuing reminders when necessary */
while(1) {
@@ -205,80 +168,100 @@ void HandleQueuedReminders()
if (Daemon && !q) {
if (Daemon < 0) {
/* Sleep until midnight */
TimeToSleep = (long) 1440*60L - SystemTime(0);
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
} else {
TimeToSleep = (long) 60*Daemon;
TimeToSleep = 60*Daemon;
}
} else {
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
}
while (TimeToSleep > 0L) {
SleepTime = (unsigned) ((TimeToSleep > 30000L) ? 30000 : TimeToSleep);
SleepTime = TimeToSleep;
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) {
sleep(SleepTime);
} else {
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 < 0) {
/* Sleep until midnight */
TimeToSleep = (long) 1440*60L - SystemTime(0);
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
} else {
TimeToSleep = (long) 60*Daemon;
TimeToSleep = 60*Daemon;
}
} else {
TimeToSleep = (long) q->tt.nexttime * 60L - SystemTime(0);
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
}
}
/* Trigger the reminder */
CreateParser(q->text, &p);
trig.typ = q->typ;
RunDisabled = q->RunDisabled;
if (Daemon < 0) {
printf("NOTE reminder %s ",
SimpleTime(q->tt.ttime));
printf("%s ", SimpleTime(SystemTime(0)/60));
if (!*q->tag) {
printf("*");
} else {
printf("%s", q->tag);
/* Do NOT trigger the reminder if tt.nexttime is more than a
minute in the past. This can happen if the clock is
changed or a laptop awakes from hibernation.
However, DO triger if tt.nexttime == tt.ttime so all
queued reminders are triggered at least once. */
if ((SystemTime(0) - (q->tt.nexttime * 60) <= 60) ||
(q->tt.nexttime == q->tt.ttime)) {
/* Trigger the reminder */
CreateParser(q->text, &p);
trig.typ = q->typ;
strcpy(trig.passthru, q->passthru);
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);
}
/* Set up global variables so some functions like trigdate()
and trigtime() work correctly */
LastTriggerDate = JulianToday;
LastTriggerTime = q->tt.ttime;
LastTrigValid = 1;
#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 */
q->tt.nexttime = CalculateNextTime(q);
}
#ifdef __BORLANDC__
signal(SIGINT, SIG_DFL);
#endif
exit(0);
}
/***************************************************************/
/* */
@@ -291,12 +274,7 @@ void HandleQueuedReminders()
/* fails, revert to AT with delta and rep. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int CalculateNextTime(QueuedRem *q)
#else
static int CalculateNextTime(q)
QueuedRem *q;
#endif
static int CalculateNextTime(QueuedRem *q)
{
int tim = q->tt.ttime;
int rep = q->tt.rep;
@@ -312,7 +290,7 @@ QueuedRem *q;
}
if (delta == NO_DELTA) {
if (tim < curtime) {
return NO_TIME;
return NO_TIME;
} else {
return tim;
}
@@ -333,11 +311,7 @@ QueuedRem *q;
/* Find the next reminder to trigger */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE QueuedRem *FindNextReminder(void)
#else
static QueuedRem *FindNextReminder()
#endif
static QueuedRem *FindNextReminder(void)
{
QueuedRem *q = QueueHead;
QueuedRem *ans = NULL;
@@ -347,12 +321,12 @@ static QueuedRem *FindNextReminder()
if (!ans) ans = q;
else if (q->tt.nexttime < ans->tt.nexttime) ans = q;
}
q = q->next;
}
return ans;
}
/***************************************************************/
/* */
@@ -362,11 +336,7 @@ static QueuedRem *FindNextReminder()
/* This will be necessary for OS/2 multithreaded. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
void GotSigInt(void)
#else
void GotSigInt()
#endif
{
QueuedRem *q = QueueHead;
@@ -375,13 +345,16 @@ void GotSigInt()
while (q) {
if (q->tt.nexttime != NO_TIME) {
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.nexttime / 60, TIMESEP, q->tt.nexttime % 60,
q->tt.ttime / 60, TimeSep, q->tt.ttime % 60,
q->tt.nexttime / 60, TimeSep, q->tt.nexttime % 60,
q->tt.rep, q->tt.delta, q->sched);
if (*q->sched) printf("(%d)", q->ntrig+1);
printf("%s", NL);
printf("Text: %s %s%s%s", ((q->typ == MSG_TYPE) ? "MSG" :
((q->typ == MSF_TYPE) ? "MSF" :"RUN")),
printf("Text: %s %s%s%s%s%s", ((q->typ == MSG_TYPE) ? "MSG" :
((q->typ == MSF_TYPE) ? "MSF" :
((q->typ == RUN_TYPE) ? "RUN" : "SPECIAL"))),
q->passthru,
(*(q->passthru)) ? " " : "",
q->text,
NL, NL);
}
@@ -398,11 +371,7 @@ void GotSigInt()
/* daemon. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void CheckInitialFile(void)
#else
static void CheckInitialFile()
#endif
static void CheckInitialFile(void)
{
/* If date has rolled around, or file has changed, spawn a new version. */
time_t tim = FileModTime;
@@ -422,17 +391,12 @@ static void CheckInitialFile()
/* Call the scheduling function. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int CalculateNextTimeUsingSched(QueuedRem *q)
#else
static int CalculateNextTimeUsingSched(q)
QueuedRem *q;
#endif
static int CalculateNextTimeUsingSched(QueuedRem *q)
{
/* Use LineBuffer for temp. string storage. */
int r;
Value v;
char *s;
char const *s;
int LastTime = -1;
int ThisTime;
@@ -452,10 +416,10 @@ QueuedRem *q;
q->sched[0] = 0;
return NO_TIME;
}
if (v.type == TIM_TYPE) {
if (v.type == TIME_TYPE) {
ThisTime = v.v.val;
} else if (v.type == INT_TYPE) {
if (v.v.val > 0)
if (v.v.val > 0)
ThisTime = q->tt.nexttime + v.v.val;
else
ThisTime = q->tt.ttime + v.v.val;
@@ -466,7 +430,7 @@ QueuedRem *q;
return NO_TIME;
}
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 <= LastTime) {
q->sched[0] = 0;
@@ -484,12 +448,7 @@ QueuedRem *q;
/* Sleep or read command from stdin in "daemon -1" mode */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void DaemonWait(unsigned int sleeptime)
#else
static DaemonWait(sleeptime)
unsigned int sleeptime;
#endif
static void DaemonWait(unsigned int sleeptime)
{
fd_set readSet;
struct timeval timeout;
@@ -556,13 +515,8 @@ unsigned int sleeptime;
/* Restarts Remind if date rolls over or REREAD cmd received */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void reread(void)
#else
static reread()
#endif
static void reread(void)
{
execvp(ArgV[0], ArgV);
execvp(ArgV[0], (char **) ArgV);
}
#endif /* HAVE_QUEUED from way at the top */

View File

@@ -10,39 +10,19 @@
/* */
/***************************************************************/
#include "version.h"
#include "config.h"
#include "dynbuf.h"
static char const RCSID[] = "$Id: rem2ps.c,v 1.13 2005-04-12 00:49:07 dfs Exp $";
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef __TURBOC__
#include <io.h>
#endif
#include "rem2ps.h"
#include "version.h"
#ifdef HAVE_PROTOS
#define ARGS(x) x
#else
#define ARGS(x) ()
#endif
#define NEW(type) ((type *) malloc(sizeof(type)))
#define NEW(type) (malloc(sizeof(type)))
#define SPECIAL_NORMAL 0
#define SPECIAL_POSTSCRIPT 1
@@ -50,6 +30,7 @@ static char const RCSID[] = "$Id: rem2ps.c,v 1.13 2005-04-12 00:49:07 dfs Exp $"
#define SPECIAL_MOON 3
#define SPECIAL_SHADE 4
#define SPECIAL_COLOR 5
#define SPECIAL_WEEK 6
typedef struct calentry {
struct calentry *next;
@@ -58,13 +39,13 @@ typedef struct calentry {
} CalEntry;
typedef struct {
char *name;
char const *name;
int xsize, ysize;
} PageType;
char DayName[7][33];
char *SmallCalLoc[] = {
char const *SmallCalLoc[] = {
"",
"bt",
"tb",
@@ -72,7 +53,7 @@ char *SmallCalLoc[] = {
};
#define NUMSMALL (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0]))
char *SmallLocation;
char const *SmallLocation;
int SmallCol1, SmallCol2;
PageType Pages[] =
@@ -108,20 +89,20 @@ char PortraitMode;
char NoSmallCal;
char UseISO;
char *HeadFont="Helvetica";
char *TitleFont="Helvetica";
char *DayFont="Helvetica-BoldOblique";
char *EntryFont="Helvetica";
char *SmallFont="Helvetica";
char *LineWidth = "1";
char const *HeadFont="Helvetica";
char const *TitleFont="Helvetica";
char const *DayFont="Helvetica-BoldOblique";
char const *EntryFont="Helvetica";
char const *SmallFont="Helvetica";
char const *LineWidth = "1";
char *HeadSize="14";
char *TitleSize="14";
char *DaySize="14";
char *EntrySize="8";
char *BorderSize = "6";
char const *HeadSize="14";
char const *TitleSize="14";
char const *DaySize="14";
char const *EntrySize="8";
char const *BorderSize = "6";
char *UserProlog = NULL;
char const *UserProlog = NULL;
int validfile = 0;
@@ -135,29 +116,23 @@ int LeftMarg, RightMarg, TopMarg, BotMarg;
int FillPage;
int Verbose = 0;
void Init ARGS ((int argc, char *argv[]));
void Usage ARGS ((char *s));
void DoPsCal ARGS ((void));
int DoQueuedPs ARGS ((void));
void DoSmallCal ARGS((char *m, int days, int first, int col, int which));
void WriteProlog ARGS ((void));
void WriteCalEntry ARGS ((void));
void WriteOneEntry ARGS ((CalEntry *c));
void GetSmallLocations ARGS ((void));
char *EatToken(char *in, char *out, int maxlen);
void Init (int argc, char *argv[]);
void Usage (char const *s);
void DoPsCal (void);
int DoQueuedPs (void);
void DoSmallCal (char const *m, int days, int first, int col, int which);
void WriteProlog (void);
void WriteCalEntry (void);
void WriteOneEntry (CalEntry *c);
void GetSmallLocations (void);
char const *EatToken(char const *in, char *out, int maxlen);
/***************************************************************/
/* */
/* MAIN PROGRAM */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int main(int argc, char *argv[])
#else
int main(argc, argv)
int argc;
char argv[];
#endif
int main(int argc, char *argv[])
{
/* If stdin is a tty - probably wrong. */
@@ -199,11 +174,7 @@ char argv[];
/* DoPsCal - emit PostScript for the calendar. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
void DoPsCal(void)
#else
void DoPsCal()
#endif
{
char month[40], year[40];
char prevm[40], nextm[40];
@@ -212,7 +183,7 @@ void DoPsCal()
int i;
int is_ps;
int firstcol;
char *startOfBody;
char const *startOfBody;
char passthru[PASSTHRU_LEN+1];
DynamicBuffer buf;
CalEntry *c, *d;
@@ -336,6 +307,7 @@ void DoPsCal()
if (!strcmp(passthru, "PostScript") ||
!strcmp(passthru, "PSFile") ||
!strcmp(passthru, "MOON") ||
!strcmp(passthru, "WEEK") ||
!strcmp(passthru, "SHADE")) {
is_ps = 1;
}
@@ -354,6 +326,8 @@ void DoPsCal()
c->special = SPECIAL_SHADE;
} else if (!strcmp(passthru, "MOON")) {
c->special = SPECIAL_MOON;
} else if (!strcmp(passthru, "WEEK")) {
c->special = SPECIAL_WEEK;
} else {
c->special = SPECIAL_PSFILE;
}
@@ -413,16 +387,12 @@ void DoPsCal()
/* WriteProlog - write the PostScript prologue */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
void WriteProlog(void)
#else
void WriteProlog()
#endif
{
int i;
int x = CurPage->xsize;
int y = CurPage->ysize;
char *isostuff;
char const *isostuff;
FILE *fp;
int nread;
char buffer[512];
@@ -518,11 +488,7 @@ void WriteProlog()
/* WriteCalEntry - write all entries for one day */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
void WriteCalEntry(void)
#else
void WriteCalEntry()
#endif
{
CalEntry *c = CurEntries;
CalEntry *d;
@@ -609,15 +575,10 @@ void WriteCalEntry()
/* WriteOneEntry - write an entry for one day */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
void WriteOneEntry(CalEntry *c)
#else
void WriteOneEntry(c)
CalEntry *c;
#endif
{
int ch, i;
char *s = c->entry;
char const *s = c->entry;
printf(" [");
@@ -643,7 +604,6 @@ CalEntry *c;
PutChar(')');
while(isspace((unsigned char)*s)) s++;
if (!*s) {
printf("]\n");
goto finish;
}
PutChar('(');
@@ -677,15 +637,10 @@ CalEntry *c;
/* Init - set up parameters */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void Init(int argc, char *argv[])
#else
void Init(argc, argv)
int argc;
char *argv[];
#endif
void Init(int argc, char *argv[])
{
char *s, *t;
char const *s;
char const *t;
int i=1;
int j;
int offset;
@@ -841,12 +796,7 @@ char *argv[];
/* Usage - print usage information */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void Usage(char *s)
#else
void Usage(s)
char *s;
#endif
void Usage(char const *s)
{
if (s) fprintf(stderr, "Rem2PS: %s\n\n", s);
@@ -875,13 +825,7 @@ char *s;
/* month. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
void DoSmallCal(char const *m, int days, int first, int col, int which)
{
/* Do the small calendar */
int i, j;
@@ -935,11 +879,7 @@ int days, first, col;
/* DoQueuedPs - do the queued PS and PSFILE reminders. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoQueuedPs(void)
#else
int DoQueuedPs()
#endif
int DoQueuedPs(void)
{
int i;
int HadPS = 0;
@@ -950,7 +890,8 @@ int DoQueuedPs()
FILE *fp;
int fnoff;
char buffer[512];
char *size, *extra;
char const *size, *extra;
char const *s;
int num, r, g, b, phase, fontsize, moonsize;
unsigned char c;
@@ -1018,6 +959,22 @@ int DoQueuedPs()
r/255.0, g/255.0, b/255.0);
break;
case SPECIAL_WEEK: /* Week number */
printf("gsave Border Border 2 div moveto /EntryFont findfont EntrySize 1.2 div scalefont setfont (");
s = e->entry+fnoff;
while(*s && isspace(*s)) {
s++;
}
while(*s) {
if (*s == '\\' || *s == '(' || *s == ')') {
PutChar('\\');
}
PutChar(*s);
s++;
}
printf(") show grestore\n");
break;
case SPECIAL_MOON: /* Moon phase */
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
&fontsize);
@@ -1122,14 +1079,10 @@ int DoQueuedPs()
/* Set up the locations for the small calendars. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void GetSmallLocations(void)
#else
void GetSmallLocations()
#endif
void GetSmallLocations(void)
{
char c;
char *s = SmallLocation;
char const *s = SmallLocation;
int colfirst, collast;
/* Figure out the first and last columns */
@@ -1191,13 +1144,7 @@ void GetSmallLocations()
/* Read a space-delimited token into an output buffer. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC char *EatToken(char *in, char *out, int maxlen)
#else
char *EatToken(in, out, maxlen)
char *in, *out;
int maxlen;
#endif
char const *EatToken(char const *in, char *out, int maxlen)
{
int i = 0;

View File

@@ -10,8 +10,6 @@
/* */
/***************************************************************/
/* $Id: rem2ps.h,v 1.5 2004-08-11 01:55:32 dfs Exp $ */
char *PSProlog1[] =
{
"% This file was produced by Remind and Rem2PS, written by",

View File

@@ -11,19 +11,11 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: sort.c,v 1.6 2000-02-18 03:46:09 dfs Exp $";
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "types.h"
#include "protos.h"
#include "expr.h"
@@ -33,7 +25,7 @@ static char const RCSID[] = "$Id: sort.c,v 1.6 2000-02-18 03:46:09 dfs Exp $";
/* The structure of a sorted entry */
typedef struct sortrem {
struct sortrem *next;
char *text;
char const *text;
int trigdate;
int trigtime;
int typ;
@@ -43,8 +35,8 @@ typedef struct sortrem {
/* The sorted reminder queue */
static Sortrem *SortedQueue = (Sortrem *) NULL;
PRIVATE Sortrem *MakeSortRem ARGS ((int jul, int tim, char *body, int typ, int prio));
PRIVATE void IssueSortBanner ARGS ((int jul));
static Sortrem *MakeSortRem (int jul, int tim, char const *body, int typ, int prio);
static void IssueSortBanner (int jul);
/***************************************************************/
/* */
@@ -53,14 +45,7 @@ PRIVATE void IssueSortBanner ARGS ((int jul));
/* Create a new Sortrem entry - return NULL on failure. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
static Sortrem *MakeSortRem(int jul, int tim, char const *body, int typ, int prio)
{
Sortrem *new = NEW(Sortrem);
if (!new) return NULL;
@@ -86,15 +71,7 @@ int typ, prio;
/* Insert a reminder into the sort buffer */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
int InsertIntoSortBuffer(int jul, int tim, char const *body, int typ, int prio)
{
Sortrem *new = MakeSortRem(jul, tim, body, typ, prio);
Sortrem *cur = SortedQueue, *prev = NULL;
@@ -106,6 +83,7 @@ int typ, prio;
SortByDate = 0;
SortByTime = 0;
SortByPrio = 0;
UntimedBeforeTimed = 0;
return E_NO_MEM;
}
@@ -117,8 +95,8 @@ int typ, prio;
while (cur) {
ShouldGoAfter = CompareRems(new->trigdate, new->trigtime, new->priority,
cur->trigdate, cur->trigtime, cur->priority,
SortByDate, SortByTime, SortByPrio);
SortByDate, SortByTime, SortByPrio, UntimedBeforeTimed);
if (ShouldGoAfter <= 0) {
prev = cur;
cur = cur->next;
@@ -147,11 +125,7 @@ int typ, prio;
/* Issue all of the sorted reminders and free memory. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void IssueSortedReminders(void)
#else
void IssueSortedReminders()
#endif
void IssueSortedReminders(void)
{
Sortrem *cur = SortedQueue;
Sortrem *next;
@@ -173,11 +147,7 @@ void IssueSortedReminders()
break;
case MSF_TYPE:
#ifdef OS2_POPUP
FillParagraph(cur->text, 0);
#else
FillParagraph(cur->text);
#endif
break;
case RUN_TYPE:
@@ -185,7 +155,7 @@ void IssueSortedReminders()
break;
}
free(cur->text);
free((char *) cur->text);
free(cur);
cur = next;
}
@@ -199,17 +169,12 @@ void IssueSortedReminders()
/* defined to take one argument. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void IssueSortBanner(int jul)
#else
static void IssueSortBanner(jul)
int jul;
#endif
static void IssueSortBanner(int jul)
{
char BanExpr[64];
int y, m, d;
Value v;
char *s = BanExpr;
char const *s = BanExpr;
DynamicBuffer buf;
if (UserFuncExists("sortbanner") != 1) return;
@@ -237,26 +202,29 @@ int jul;
/* sorting direction by date and time, resp. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int CompareRems(int dat1, int tim1, int prio1,
int dat2, int tim2, int prio2,
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 CompareRems(int dat1, int tim1, int prio1,
int dat2, int tim2, int prio2,
int bydate, int bytime, int byprio,
int untimed_first)
{
int dafter, tafter, pafter;
int dafter, tafter, pafter, uafter;
dafter = (bydate != SORT_DESCEND) ? 1 : -1;
tafter = (bytime != SORT_DESCEND) ? 1 : -1;
pafter = (byprio != SORT_DESCEND) ? 1 : -1;
uafter = (untimed_first) ? -1 : 1;
if (dat1 < dat2) return dafter;
if (dat1 > dat2) return -dafter;
if (tim1 == NO_TIME && tim2 != NO_TIME) return -1;
if (tim1 != NO_TIME && tim2 == NO_TIME) return 1;
if (tim1 == NO_TIME && tim2 != NO_TIME) {
return -uafter;
}
if (tim1 != NO_TIME && tim2 == NO_TIME) {
return uafter;
}
if (tim1 < tim2) return tafter;
if (tim1 > tim2) return -tafter;

View File

@@ -12,20 +12,12 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: token.c,v 1.10 2001-11-06 15:51:37 dfs Exp $";
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "types.h"
#include "globals.h"
#include "protos.h"
@@ -42,8 +34,6 @@ while (isdigit(*(string))) { \
string++; \
}
#define UPPER(c) (islower(c) ? toupper(c) : c)
/* The big array holding all recognized (literal) tokens in reminder file.
Keep this array sorted, or software will not work. */
Token TokArray[] = {
@@ -68,6 +58,7 @@ Token TokArray[] = {
{ "february", 3, T_Month, 1 },
{ "flush", 5, T_Flush, 0 },
{ "friday", 3, T_WkDay, 4 },
{ "from", 4, T_Scanfrom, FROM_TYPE },
{ "fset", 4, T_Fset, 0 },
{ "if", 2, T_If, 0 },
{ "iftrig", 6, T_IfTrig, 0 },
@@ -83,6 +74,7 @@ Token TokArray[] = {
{ "november", 3, T_Month, 10 },
{ "october", 3, T_Month, 9 },
{ "omit", 3, T_Omit, 0 },
{ "omitfunc", 8, T_OmitFunc, 0 },
{ "once", 3, T_Once, 0 },
{ "pop-omit-context", 3, T_Pop, 0 },
{ "preserve", 8, T_Preserve, 0 },
@@ -94,7 +86,7 @@ Token TokArray[] = {
{ "run", 3, T_RemType, RUN_TYPE },
{ "satisfy", 7, T_RemType, SAT_TYPE },
{ "saturday", 3, T_WkDay, 5 },
{ "scanfrom", 4, T_Scanfrom, 0 },
{ "scanfrom", 4, T_Scanfrom, SCANFROM_TYPE },
{ "sched", 5, T_Sched, 0 },
{ "september", 3, T_Month, 8 },
{ "set", 3, T_Set, 0 },
@@ -137,7 +129,7 @@ Token NonEnglishToks[] = {
};
#endif
PRIVATE int TokStrCmp ARGS((const Token *t, const char *s));
static int TokStrCmp (Token const *t, char const *s);
/***************************************************************/
/* */
@@ -147,13 +139,7 @@ PRIVATE int TokStrCmp ARGS((const Token *t, const char *s));
/* left square bracket, return a T_Illegal type. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC char *FindInitialToken(Token *tok, char *s)
#else
char *FindInitialToken(tok, s)
Token *tok;
char *s;
#endif
char const *FindInitialToken(Token *tok, char const *s)
{
DynamicBuffer buf;
DBufInit(&buf);
@@ -180,15 +166,9 @@ char *s;
/* Given a string, which token is it? */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void FindToken(const char *s, Token *tok)
#else
void FindToken(s, tok)
char *s;
Token *tok;
#endif
void FindToken(char const *s, Token *tok)
{
register int top, bot, mid, r;
int top, bot, mid, r, max;
int l;
tok->type = T_Illegal;
@@ -216,6 +196,7 @@ Token *tok;
}
bot = 0;
top = sizeof(TokArray) / sizeof(TokArray[0]) - 1;
max = sizeof(TokArray) / sizeof(TokArray[0]);
while(top >= bot) {
mid = (top + bot) / 2;
@@ -227,9 +208,13 @@ Token *tok;
return;
} else {
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++;
if (!TokStrCmp(&TokArray[mid], s)) {
}
if (mid < max &&
!TokStrCmp(&TokArray[mid], s)) {
tok->type = TokArray[mid].type;
tok->val = TokArray[mid].val;
return;
@@ -268,13 +253,7 @@ Token *tok;
/* Rep - *n */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void FindNumericToken(const char *s, Token *t)
#else
void FindNumericToken(s, t)
char *s;
Token *t;
#endif
void FindNumericToken(char const *s, Token *t)
{
int mult = 1, hour, min;
@@ -298,13 +277,17 @@ Token *t;
return;
}
/* 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++;
hour = t->val;
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->type = T_Time;
if (hour <= 23) {
t->type = T_Time;
} else {
t->type = T_LongTime;
}
return;
}
@@ -353,18 +336,12 @@ Token *t;
/* Compare a token to a string. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int TokStrCmp(const Token *t, const char *s)
#else
static int TokStrCmp(t, s)
Token *t;
char *s;
#endif
static int TokStrCmp(Token const *t, char const *s)
{
register int r;
char *tk = t->name;
char const *tk = t->name;
while(*tk && *s && !(*s == ',' && *(s+1) == 0)) {
r = UPPER(*tk) - UPPER(*s);
r = *tk - tolower(*s);
tk++;
s++;
if (r) return r;

View File

@@ -11,18 +11,9 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: trigger.c,v 1.5 2000-02-18 03:46:11 dfs Exp $";
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "types.h"
#include "expr.h"
#include "protos.h"
@@ -34,10 +25,10 @@ static char const RCSID[] = "$Id: trigger.c,v 1.5 2000-02-18 03:46:11 dfs Exp $"
#define GOT_YR 4
#define GOT_WD 8
static int JYear ARGS((int jul));
static int JMonth ARGS((int jul));
static int NextSimpleTrig ARGS((int startdate, Trigger *trig, int *err));
static int GetNextTriggerDate ARGS((Trigger *trig, int start, int *err, int *nextstart));
static int JYear(int jul);
static int JMonth(int jul);
static int NextSimpleTrig(int startdate, Trigger *trig, int *err);
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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int NextSimpleTrig(int startdate, Trigger *trig, int *err)
#else
static int NextSimpleTrig(startdate, trig, err)
int startdate;
Trigger *trig;
int *err;
#endif
static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
{
int typ = 0;
int d, m, y, j, d2, m2, y2;
@@ -222,16 +206,27 @@ int *err;
*err = E_BAD_DATE;
return -1;
}
/* Back up a year in case we'll cross a year boundary*/
if (y > BASE) {
y--;
}
/* Move up to the first valid year */
while (trig->d > DaysInMonth(trig->m, y)) y++;
/* Try last year */
j = Julian(y, trig->m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
if (j >= startdate) return j;
/* Try this year */
y++;
j = Julian(y, trig->m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
if (j >= startdate) return j;
/* Must be next year */
y = y + 1;
y++;
while (trig->d > DaysInMonth(trig->m, y)) y++;
j = Julian(y, trig->m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
@@ -271,12 +266,7 @@ int *err;
/* JMonth - Given a Julian date, what's the month? */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int JMonth(int jul)
#else
static int JMonth(jul)
int jul;
#endif
static int JMonth(int jul)
{
int y, m, d;
FromJulian(jul, &y, &m, &d);
@@ -288,12 +278,7 @@ int jul;
/* JYear - Given a Julian date, what's the year? */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int JYear(int jul)
#else
static int JYear(jul)
int jul;
#endif
static int JYear(int jul)
{
int y, m, d;
FromJulian(jul, &y, &m, &d);
@@ -310,17 +295,9 @@ int jul;
/* expired, -2 if can't compute trigger date. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
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
static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart)
{
int simple, mod;
int simple, mod, omit;
/* First: Have we passed the UNTIL date? */
if (trig->until != NO_UNTIL &&
@@ -328,8 +305,22 @@ int *nextstart;
/* Next: If it's an "AFTER"-type skip, back up
until we're at the start of a block of holidays */
if (trig->skip == AFTER_SKIP)
while (IsOmitted(start-1, trig->localomit)) start--;
if (trig->skip == AFTER_SKIP) {
int iter = 0;
while (iter++ <= MaxSatIter) {
*err = IsOmitted(start-1, trig->localomit, trig->omitfunc, &omit);
if (*err) return -2;
if (!omit) {
break;
}
start--;
}
if (iter > MaxSatIter) {
/* omitfunc must have returned "true" too often */
*err = E_CANT_TRIG;
return -2;
}
}
/* Find the next simple trigger */
simple = NextSimpleTrig(start, trig, err);
@@ -343,12 +334,29 @@ int *nextstart;
/* If there's a BACK, back up... */
if (trig->back != NO_BACK) {
mod = trig->back;
if (mod < 0) simple += mod;
else
while(mod) {
simple--;
if (!IsOmitted(simple, trig->localomit)) mod--;
if (mod < 0) {
simple += mod;
}
else {
int iter = 0;
int max = MaxSatIter;
if (max < mod*2) {
max = mod*2;
}
while(iter++ <= max) {
if (!mod) {
break;
}
simple--;
*err = IsOmitted(simple, trig->localomit, trig->omitfunc, &omit);
if (*err) return -2;
if (!omit) mod--;
}
if (iter > max) {
*err = E_CANT_TRIG;
return -2;
}
}
}
/* If there's a REP, calculate the next occurrence */
@@ -361,12 +369,38 @@ int *nextstart;
}
/* If it's a "BEFORE"-type skip, back up */
if (trig->skip == BEFORE_SKIP)
while(IsOmitted(simple, trig->localomit)) simple--;
if (trig->skip == BEFORE_SKIP) {
int iter = 0;
while(iter++ <= MaxSatIter) {
*err = IsOmitted(simple, trig->localomit, trig->omitfunc, &omit);
if (*err) return -2;
if (!omit) {
break;
}
simple--;
}
if (iter > MaxSatIter) {
*err = E_CANT_TRIG;
return -2;
}
}
/* If it's an "AFTER"-type skip, jump ahead */
if (trig->skip == AFTER_SKIP)
while (IsOmitted(simple, trig->localomit)) simple++;
if (trig->skip == AFTER_SKIP) {
int iter = 0;
while (iter++ <= MaxSatIter) {
*err = IsOmitted(simple, trig->localomit, trig->omitfunc, &omit);
if (*err) return -2;
if (!omit) {
break;
}
simple++;
}
if (iter > MaxSatIter) {
*err = E_CANT_TRIG;
return -2;
}
}
/* Return the date */
return simple;
@@ -380,22 +414,16 @@ int *nextstart;
/* today's date. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int ComputeTrigger(int today, Trigger *trig, int *err)
#else
int ComputeTrigger(today, trig, err)
int today;
Trigger *trig;
int *err;
#endif
int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
{
int nattempts = 0,
start = today,
nextstart,
y, m, d,
nextstart = 0,
y, m, d, omit,
result;
LastTrigValid = 0;
if (save_in_globals) LastTrigValid = 0;
/* Assume everything works */
*err = OK;
@@ -413,8 +441,8 @@ int *err;
*err = E_REP_FULSPEC;
return -1;
}
while (nattempts++ < TRIG_ATTEMPTS) {
result = GetNextTriggerDate(trig, start, err, &nextstart);
@@ -429,10 +457,18 @@ int *err;
}
/* If result is >= today, great! */
if (trig->skip == SKIP_SKIP) {
*err = IsOmitted(result, trig->localomit, trig->omitfunc, &omit);
if (*err) return -1;
} else {
omit = 0;
}
if (result >= today &&
(trig->skip != SKIP_SKIP || !IsOmitted(result, trig->localomit))) {
LastTriggerDate = result; /* Save in global var */
LastTrigValid = 1;
(trig->skip != SKIP_SKIP || !omit)) {
if (save_in_globals) {
LastTriggerDate = result; /* Save in global var */
LastTrigValid = 1;
}
if (DebugFlag & DB_PRTTRIG) {
FromJulian(result, &y, &m, &d);
fprintf(ErrFp, "%s(%d): Trig = %s, %d %s, %d\n",
@@ -454,16 +490,28 @@ int *err;
FileName, LineNo, ErrMsg[E_EXPIRED]);
}
if (result != -1) {
LastTriggerDate = result;
LastTrigValid = 1;
if (save_in_globals) {
LastTriggerDate = result;
LastTrigValid = 1;
}
}
return -1;
}
if (trig->skip == SKIP_SKIP &&
omit &&
nextstart <= start &&
result >= start) {
nextstart = result + 1;
}
/* Keep scanning... unless there's no point in doing it.*/
if (nextstart <= start) {
if (result != -1) {
LastTriggerDate = result;
LastTrigValid = 1;
if (save_in_globals) {
LastTriggerDate = result;
LastTrigValid = 1;
}
}
if (DebugFlag & DB_PRTTRIG) {
fprintf(ErrFp, "%s(%d): %s\n",

View File

@@ -10,8 +10,7 @@
/* */
/***************************************************************/
/* $Id: types.h,v 1.5 2000-02-18 03:46:12 dfs Exp $ */
#include <limits.h>
#include "dynbuf.h"
/* Values */
@@ -25,14 +24,10 @@ typedef struct {
/* Define the type of operators */
typedef struct {
char *name;
char const *name;
char prec;
char type;
#ifdef HAVE_PROTOS
int (*func)(void);
#else
int (*func) ();
#endif
} Operator;
/* Define the structure of a variable */
@@ -61,6 +56,7 @@ typedef struct {
int priority;
char sched[VAR_NAME_LEN+1]; /* Scheduling function */
char warn[VAR_NAME_LEN+1]; /* Warning function */
char omitfunc[VAR_NAME_LEN+1]; /* OMITFUNC function */
char tag[TAG_LEN+1];
char passthru[PASSTHRU_LEN+1];
} Trigger;
@@ -76,14 +72,15 @@ typedef struct {
/* The parse pointer */
typedef struct {
char isnested; /* Is it a nested expression? */
char isnested; /* Is it a nested expression? */
char allownested;
char *text; /* Start of text */
char *pos; /* Current position */
char *etext; /* Substituted text */
char *epos; /* Position in substituted text */
char const *text; /* Start of text */
char const *pos; /* Current position */
char const *etext; /* Substituted text */
char const *epos; /* Position in substituted text */
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;
typedef Parser *ParsePtr; /* Pointer to parser structure */
@@ -105,7 +102,7 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
#define BEFORE_SKIP 2
#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 */
@@ -121,11 +118,12 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
/* DEFINES for debugging flags */
#define DB_PRTLINE 1
#define DB_PRTEXPR 2
#define DB_PRTTRIG 4
#define DB_DUMP_VARS 8
#define DB_ECHO_LINE 16
#define DB_PRTLINE 1
#define DB_PRTEXPR 2
#define DB_PRTTRIG 4
#define DB_DUMP_VARS 8
#define DB_ECHO_LINE 16
#define DB_TRACE_FILES 32
/* Enumeration of the tokens */
enum TokTypes
@@ -150,7 +148,9 @@ enum TokTypes
T_Sched,
T_Warn,
T_Tag,
T_Duration
T_Duration,
T_LongTime,
T_OmitFunc
};
/* The structure of a token */
@@ -171,8 +171,10 @@ typedef struct {
#define IF_ELSE_MASK 2
/* Flags for the DoSubst function */
#define NORMAL_MODE 0
#define CAL_MODE 1
#define NORMAL_MODE 0
#define CAL_MODE 1
#define ADVANCE_MODE 2
#define QUOTE_MARKER 1 /* Unlikely character to appear in reminder */
/* Flags for disabling run */
@@ -189,3 +191,7 @@ typedef struct {
#define SORT_NONE 0
#define SORT_ASCEND 1
#define SORT_DESCEND 2
/* Flags for FROM / SCANFROM */
#define SCANFROM_TYPE 0
#define FROM_TYPE 1

View File

@@ -12,19 +12,11 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: userfns.c,v 1.6 2000-02-18 03:46:13 dfs Exp $";
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "types.h"
#include "globals.h"
#include "protos.h"
@@ -37,7 +29,7 @@ static char const RCSID[] = "$Id: userfns.c,v 1.6 2000-02-18 03:46:13 dfs Exp $"
typedef struct udf_struct {
struct udf_struct *next;
char name[VAR_NAME_LEN+1];
char *text;
char const *text;
Var *locals;
char IsActive;
int nargs;
@@ -54,11 +46,11 @@ extern Operator Func[];
extern Value ValStack[];
extern int ValStackPtr;
PRIVATE void DestroyUserFunc ARGS ((UserFunc *f));
PRIVATE void FUnset ARGS ((char *name));
PRIVATE void FSet ARGS ((UserFunc *f));
PRIVATE int SetUpLocalVars ARGS ((UserFunc *f));
PRIVATE void DestroyLocalVals ARGS ((UserFunc *f));
static void DestroyUserFunc (UserFunc *f);
static void FUnset (char const *name);
static void FSet (UserFunc *f);
static int SetUpLocalVars (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. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoFset(ParsePtr p)
#else
int DoFset(p)
ParsePtr p;
#endif
int DoFset(ParsePtr p)
{
int r;
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 */
if (p->isnested) {
Eprint("%s", ErrMsg[E_CANTNEST_FDEF]);
@@ -183,12 +175,7 @@ ParsePtr p;
/* Free up all the resources used by a user-defined function. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void DestroyUserFunc(UserFunc *f)
#else
static void DestroyUserFunc(f)
UserFunc *f;
#endif
static void DestroyUserFunc(UserFunc *f)
{
Var *v, *prev;
@@ -202,7 +189,7 @@ UserFunc *f;
}
/* Free the function definition */
if (f->text) free(f->text);
if (f->text) free( (char *) f->text);
/* Free the data structure itself */
free(f);
@@ -216,12 +203,7 @@ UserFunc *f;
/* it exists. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void FUnset(char *name)
#else
static void FUnset(name)
char *name;
#endif
static void FUnset(char const *name)
{
UserFunc *cur, *prev;
int h;
@@ -247,12 +229,7 @@ char *name;
/* Insert a user-defined function into the hash table. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void FSet(UserFunc *f)
#else
static void FSet(f)
UserFunc *f;
#endif
static void FSet(UserFunc *f)
{
int h = HashVal(f->name) % FUNC_HASH_SIZE;
f->next = FuncHash[h];
@@ -266,18 +243,12 @@ UserFunc *f;
/* Call a user-defined function. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int CallUserFunc(char *name, int nargs)
#else
int CallUserFunc(name, nargs)
char *name;
int nargs;
#endif
int CallUserFunc(char const *name, int nargs)
{
UserFunc *f;
int h = HashVal(name) % FUNC_HASH_SIZE;
int i;
char *s;
char const *s;
/* Search for the function */
f = FuncHash[h];
@@ -351,12 +322,7 @@ int nargs;
/* Set up the local variables from the stack frame. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE int SetUpLocalVars(UserFunc *f)
#else
static int SetUpLocalVars(f)
UserFunc *f;
#endif
static int SetUpLocalVars(UserFunc *f)
{
int i, r;
Var *var;
@@ -378,12 +344,7 @@ UserFunc *f;
/* the function. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void DestroyLocalVals(UserFunc *f)
#else
static void DestroyLocalVals(f)
UserFunc *f;
#endif
static void DestroyLocalVals(UserFunc *f)
{
Var *v = f->locals;
@@ -400,12 +361,7 @@ UserFunc *f;
/* it is defined, or -1 if it is not defined. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int UserFuncExists(char *fn)
#else
int UserFuncExists(fn)
char *fn;
#endif
int UserFuncExists(char const *fn)
{
UserFunc *f;
int h = HashVal(fn) % FUNC_HASH_SIZE;

View File

@@ -11,25 +11,17 @@
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: utils.c,v 1.5 2000-02-18 03:46:14 dfs Exp $";
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "types.h"
#include "globals.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.5 2000-02-18 03:46:14 dfs Exp $";
/* Just like strncpy EXCEPT we ALWAYS copy the trailing 0. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC char *StrnCpy(char *dest, const char *source, int n)
#else
char *StrnCpy(dest, source, n)
char *dest, *source;
int n;
#endif
char *StrnCpy(char *dest, char const *source, int n)
{
register char *odest = dest;
char *odest = dest;
while (n-- && (*dest++ = *source++)) ;
if (*(dest-1)) *dest = 0;
@@ -62,13 +48,7 @@ int n;
/* of the first string, whichever is greater. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int StrMatch(const char *s1, const char *s2, int n)
#else
int StrMatch(s1, s2, n)
char *s1, *s2;
int n;
#endif
int StrMatch(char const *s1, char const *s2, int n)
{
int l;
if ((l = strlen(s1)) < n) return 0;
@@ -80,13 +60,7 @@ int n;
/* StrinCmp - compare strings, case-insensitive */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int StrinCmp(const char *s1, const char *s2, int n)
#else
int StrinCmp(s1, s2, n)
char *s1, *s2;
int n;
#endif
int StrinCmp(char const *s1, char const *s2, int n)
{
register int r;
while (n && *s1 && *s2) {
@@ -106,15 +80,10 @@ int n;
/* Like ANSI strdup */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC char *StrDup(const char *s)
#else
char *StrDup(s)
char *s;
#endif
char *StrDup(char const *s)
{
char *ret = (char *) malloc(strlen(s)+1);
if (!ret) return (char *) NULL;
char *ret = malloc(strlen(s)+1);
if (!ret) return NULL;
strcpy(ret, s);
return ret;
}
@@ -126,12 +95,7 @@ char *s;
/* Compare strings, case insensitive. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int StrCmpi(const char *s1, const char *s2)
#else
int StrCmpi(s1, s2)
char *s1, *s2;
#endif
int StrCmpi(char const *s1, char const *s2)
{
int r;
while (*s1 && *s2) {
@@ -143,26 +107,6 @@ char *s1, *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 */
@@ -170,12 +114,7 @@ char *s1, *s2;
/* Return 1 if the date is OK, 0 otherwise. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DateOK(int y, int m, int d)
#else
int DateOK(y, m, d)
int y, m, d;
#endif
int DateOK(int y, int m, int d)
{
if (d < 1 ||
m < 0 ||
@@ -185,31 +124,3 @@ int y, m, d;
d > DaysInMonth(m, y) ) return 0;
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

243
src/var.c
View File

@@ -7,25 +7,17 @@
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
/* */
/***************************************************************/
#include "config.h"
static char const RCSID[] = "$Id: var.c,v 1.8 2005-04-12 00:44:08 dfs Exp $";
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "types.h"
#include "expr.h"
#include "globals.h"
@@ -42,18 +34,53 @@ static char const RCSID[] = "$Id: var.c,v 1.8 2005-04-12 00:44:08 dfs Exp $";
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 */
/* Given a string, compute the hash value. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC unsigned int HashVal(const char *str)
#else
unsigned int HashVal(str)
char *str;
#endif
unsigned int HashVal(char const *str)
{
register unsigned int i=0;
register unsigned int j=1;
@@ -75,13 +102,7 @@ char *str;
/* string. If create is 1, create the variable. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC Var *FindVar(const char *str, int create)
#else
Var *FindVar(str, create)
char *str;
int create;
#endif
Var *FindVar(char const *str, int create)
{
register int h;
register Var *v;
@@ -118,12 +139,7 @@ int create;
/* string and delete it. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DeleteVar(const char *str)
#else
int DeleteVar(str)
char *str;
#endif
int DeleteVar(char const *str)
{
register int h;
register Var *v;
@@ -152,13 +168,7 @@ char *str;
/* Set the indicate variable to the specified value. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int SetVar(const char *str, Value *val)
#else
int SetVar(str, val)
char *str;
Value *val;
#endif
int SetVar(char const *str, Value *val)
{
Var *v = FindVar(str, 1);
@@ -176,14 +186,7 @@ Value *val;
/* Get a copy of the value of the variable. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int GetVarValue(const char *str, Value *val, Var *locals)
#else
int GetVarValue(str, val, locals)
char *str;
Value *val;
Var *locals;
#endif
int GetVarValue(char const *str, Value *val, Var *locals)
{
Var *v;
@@ -209,12 +212,7 @@ Var *locals;
/* DoSet - set a variable. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoSet (Parser *p)
#else
int DoSet (p)
Parser *p;
#endif
int DoSet (Parser *p)
{
Value v;
int r;
@@ -225,6 +223,11 @@ Parser *p;
r = ParseIdentifier(p, &buf);
if (r) return r;
/* Allow optional equals-sign: SET var = value */
if (ParseNonSpaceChar(p, &r, 1) == '=') {
ParseNonSpaceChar(p, &r, 0);
}
r = EvaluateExpr(p, &v);
if (r) {
DBufFree(&buf);
@@ -242,12 +245,7 @@ Parser *p;
/* DoUnset - delete a bunch of variables. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoUnset (Parser *p)
#else
int DoUnset (p)
Parser *p;
#endif
int DoUnset (Parser *p)
{
int r;
@@ -282,12 +280,7 @@ Parser *p;
/* Command file command to dump variable table. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoDump(ParsePtr p)
#else
int DoDump(p)
ParsePtr p;
#endif
int DoDump(ParsePtr p)
{
int r;
Var *v;
@@ -336,11 +329,7 @@ ParsePtr p;
/* Dump the variable table to stderr. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void DumpVarTable(void)
#else
void DumpVarTable()
#endif
void DumpVarTable(void)
{
register Var *v;
register int i;
@@ -366,12 +355,7 @@ void DumpVarTable()
/* preserved variables unless ALL is non-zero. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void DestroyVars(int all)
#else
void DestroyVars(all)
int all;
#endif
void DestroyVars(int all)
{
int i;
Var *v, *next, *prev;
@@ -404,12 +388,7 @@ int all;
/* Given the name of a variable, "preserve" it. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int PreserveVar(char *name)
#else
int PreserveVar(name)
char *name;
#endif
int PreserveVar(char const *name)
{
Var *v;
@@ -424,12 +403,7 @@ char *name;
/* DoPreserve - preserve a bunch of variables. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int DoPreserve (Parser *p)
#else
int DoPreserve (p)
Parser *p;
#endif
int DoPreserve (Parser *p)
{
int r;
@@ -471,7 +445,7 @@ Parser *p;
/* The structure of a system variable */
typedef struct {
char *name;
char const *name;
char modifiable;
int type;
void *value;
@@ -484,14 +458,17 @@ typedef struct {
#define been_malloced min
/* Flag for no min/max constraint */
#define ANY 4532
#define ANY -31415926
/* All of the system variables sorted alphabetically */
static SysVar SysVarArr[] = {
/* name mod type value min/mal max */
{ "CalcUTC", 1, INT_TYPE, &CalculateUTC, 0, 1 },
{ "CalMode", 0, INT_TYPE, &DoCalendar, 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 },
{ "DeltaOffset", 0, INT_TYPE, &DeltaOffset, 0, 0 },
{ "DontFork", 0, INT_TYPE, &DontFork, 0, 0 },
{ "DontQueue", 0, INT_TYPE, &DontQueue, 0, 0 },
{ "DontTrigAts", 0, INT_TYPE, &DontIssueAts, 0, 0 },
@@ -511,23 +488,26 @@ static SysVar SysVarArr[] = {
{ "LongMin", 1, INT_TYPE, &LongMin, -59, 59 },
{ "LongSec", 1, INT_TYPE, &LongSec, -59, 59 },
{ "MaxSatIter", 1, INT_TYPE, &MaxSatIter, 10, ANY },
{ "MaxStringLen", 1, INT_TYPE, &MaxStringLen, -1, ANY },
{ "MinsFromUTC", 1, INT_TYPE, &MinsFromUTC, -13*60, 13*60 },
{ "NextMode", 0, INT_TYPE, &NextMode, 0, 0 },
{ "NumQueued", 0, INT_TYPE, &NumQueued, 0, 0 },
{ "NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 },
{ "PrefixLineNo", 0, INT_TYPE, &DoPrefixLineNo,0, 0 },
{ "PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
{ "PSCal", 0, INT_TYPE, &PsCal, 0, 0 },
{ "RunOff", 0, INT_TYPE, &RunDisabled, 0, 0 },
{ "SimpleCal", 0, INT_TYPE, &DoSimpleCalendar, 0, 0 },
{ "SortByDate", 0, INT_TYPE, &SortByDate, 0, 0},
{ "SortByPrio", 0, INT_TYPE, &SortByPrio, 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 },
{ "UntimedFirst", 0, INT_TYPE, &UntimedBeforeTimed, 0, 0 }
};
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
PRIVATE SysVar *FindSysVar ARGS((const char *name));
PRIVATE void DumpSysVar ARGS((const char *name, const SysVar *v));
static SysVar *FindSysVar (char const *name);
static void DumpSysVar (char const *name, const SysVar *v);
/***************************************************************/
/* */
/* SetSysVar */
@@ -535,24 +515,22 @@ PRIVATE void DumpSysVar ARGS((const char *name, const SysVar *v));
/* Set a system variable to the indicated value. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int SetSysVar(const char *name, Value *value)
#else
int SetSysVar(name, value)
char *name;
Value *value;
#endif
int SetSysVar(char const *name, Value *value)
{
SysVar *v = FindSysVar(name);
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) {
Eprint("%s: `$%s'", ErrMsg[E_CANT_MODIFY], name);
return E_CANT_MODIFY;
}
/* If it's a string variable, special measures must be taken */
if (v->type == STR_TYPE) {
if (v->type == SPECIAL_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)));
v->been_malloced = 1;
*((char **) v->value) = value->v.str;
@@ -572,19 +550,16 @@ Value *value;
/* Get the value of a system variable */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC int GetSysVar(const char *name, Value *val)
#else
int GetSysVar(name, val)
char *name;
Value *val;
#endif
int GetSysVar(char const *name, Value *val)
{
SysVar *v = FindSysVar(name);
val->type = ERR_TYPE;
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));
if (!val->v.str) return E_NO_MEM;
} else {
@@ -610,12 +585,7 @@ Value *val;
/* Find a system var with specified name. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE SysVar *FindSysVar(const char *name)
#else
static SysVar *FindSysVar(name)
char *name;
#endif
static SysVar *FindSysVar(char const *name)
{
int top=NUMSYSVARS-1, bottom=0;
int mid=(top + bottom) / 2;
@@ -630,7 +600,7 @@ char *name;
}
return NULL;
}
/***************************************************************/
/* */
/* DumpSysVarByName */
@@ -639,12 +609,7 @@ char *name;
/* If name is "", dump all system variables. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void DumpSysVarByName(const char *name)
#else
void DumpSysVarByName(name)
char *name;
#endif
void DumpSysVarByName(char const *name)
{
int i;
SysVar *v;
@@ -653,7 +618,7 @@ char *name;
for (i=0; i<NUMSYSVARS; i++) DumpSysVar(name, SysVarArr + i);
return;
}
v = FindSysVar(name);
DumpSysVar(name, v);
return;
@@ -666,28 +631,37 @@ char *name;
/* Dump the system variable. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PRIVATE void DumpSysVar(const char *name, const SysVar *v)
#else
static void DumpSysVar(name, v)
char *name;
SysVar *v;
#endif
static void DumpSysVar(char const *name, const SysVar *v)
{
char buffer[VAR_NAME_LEN+10];
if (name && !*name) name=NULL;
if (!v && !name) return; /* Shouldn't happen... */
buffer[0]='$'; buffer[1] = 0;
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->type == STR_TYPE) {
char *s = *((char **)v->value);
if (v->type == SPECIAL_TYPE) {
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;
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);
if (*s) fprintf(ErrFp, "...");
Putc('\n', ErrFp);
@@ -705,4 +679,3 @@ SysVar *v;
return;
}

View File

@@ -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-2000 by Roaring Penguin Software Inc. */
/* */
/***************************************************************/
/* $Id: version.h,v 1.11 2001-05-07 14:08:09 dfs Exp $ */
#define VERSION "03.00.23"

1
src/version.h.in Normal file
View File

@@ -0,0 +1 @@
#define VERSION "@VERSION@"

17
tests/colors.rem Normal file
View 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
View File

@@ -0,0 +1 @@
REM 15 MSG 01

1
tests/include_dir/02.rem Normal file
View File

@@ -0,0 +1 @@
REM 15 MSG 02

View File

@@ -0,0 +1 @@
REM MSG IGNORE

View File

@@ -0,0 +1 @@
REM 15 MSG You can't read this file.

View File

@@ -0,0 +1 @@
REM MSG IGNORE

Some files were not shown because too many files have changed in this diff Show More