Compare commits

..

559 Commits

Author SHA1 Message Date
Dianne Skoll
e3297fe751 Prep for 3.3.9 release. 2021-10-14 21:20:05 -04:00
Dianne Skoll
58ca741a1c Update docs. 2021-10-14 10:38:11 -04:00
Dianne Skoll
14dbbc7bb4 Fix help text. 2021-10-14 10:24:58 -04:00
Dianne Skoll
df55c4032b Use external .png images for moon phases. 2021-10-14 10:23:58 -04:00
Dianne Skoll
3768155a20 Add "--pngs" option 2021-10-14 10:21:51 -04:00
Dianne Skoll
2f3b9cadf4 Add a generated file to unconfigure 2021-10-12 22:06:03 -04:00
Dianne Skoll
2c79a6531a Fix typo. 2021-10-12 22:05:12 -04:00
Dianne Skoll
be5c856f4b Remove "cm2rem". It's waaaay obsolete. 2021-10-12 22:04:00 -04:00
Dianne Skoll
712a333f08 Substitute full path to `rem2html' 2021-10-12 21:58:10 -04:00
Dianne Skoll
b753e84c8c Update README 2021-10-12 21:55:18 -04:00
Dianne Skoll
4b4acaadbb Don't install rem2html if we don't have Perl. 2021-10-12 21:54:38 -04:00
Dianne Skoll
8a52f9b67d Silence Perl warning. 2021-10-12 21:51:04 -04:00
Dianne Skoll
e372606281 Pass --stylesheet option 2021-10-12 21:46:03 -04:00
Dianne Skoll
c443d0a9da Make imgbase and stylesheet options behave rationally. 2021-10-12 21:44:25 -04:00
Dianne Skoll
42c9ae9ea8 Add generated file to .gitignore. 2021-10-12 21:33:06 -04:00
Dianne Skoll
dac9bb4187 Pass proper --imgbase argument 2021-10-12 21:32:46 -04:00
Dianne Skoll
812d926f66 Move rem2html into its own directory and install it by default. 2021-10-12 21:28:14 -04:00
Dianne Skoll
45831ea69f Fix error in man page courtesy of Richard Ulmer. 2021-10-11 19:54:38 -04:00
Dianne Skoll
354e1d236b Update test-for-backends.rem with comments. 2021-10-08 15:27:32 -04:00
Dianne Skoll
ac478039cf Remove unnecessary spaces from JSON output. 2021-10-06 17:47:31 -04:00
Dianne Skoll
96f5799e6f Fix typo 2021-10-06 17:41:15 -04:00
Dianne Skoll
e21479f696 Add test reminder file for seeing how back-ends handle SPECIALs 2021-10-06 09:39:52 -04:00
Dianne Skoll
25dc883e15 Fix bug in calendar display: Would sometimes highlight wrong day as "today" 2021-10-06 09:39:08 -04:00
Dianne Skoll
bfb1374ee3 Document that "-pp" is the preferred Remind output format. 2021-10-05 23:31:34 -04:00
Dianne Skoll
cacd8f9792 Tweak stylesheet 2021-10-05 23:13:22 -04:00
Dianne Skoll
3e9053a3c6 No need to install the .png images. 2021-10-05 23:10:34 -04:00
Dianne Skoll
5fa357fec2 Use data: URLs for the moon images. 2021-10-05 23:08:41 -04:00
Dianne Skoll
f109c3d696 Remove C99-ism. 2021-10-05 13:54:04 -04:00
Dianne Skoll
b097ce7279 Fix docs. 2021-10-05 12:18:50 -04:00
Dianne Skoll
1297854935 Allow "-u+whatever" to change users without disabling RUN. 2021-10-05 12:17:42 -04:00
Dianne Skoll
0a1d0011f6 Add "-+username" option to trust "username" for the purpose of allowing RUN. 2021-10-05 12:04:44 -04:00
Dianne Skoll
20db1be0a0 Add missing #ifdef...#endif courtesy of Nomen Nescio 2021-10-04 08:39:27 -04:00
Dianne Skoll
143f1d6144 Prep for 3.3.8 release. 2021-09-13 19:14:03 -04:00
Dianne Skoll
358f6c9497 Fix error in TkRemind reverse-engineering of Reminder. 2021-09-13 18:11:32 -04:00
Dianne Skoll
ca26544be8 Don't use YYYY-MM-DD form of full date.
We get better error messages from Remind this way.
2021-09-13 17:54:36 -04:00
Dianne Skoll
5ceffddd5b Add "shellescape" built-in function. 2021-09-08 09:33:47 -04:00
Dianne Skoll
8e3ddb96b3 Add another couple of tests. 2021-09-07 12:16:36 -04:00
Dianne Skoll
377de36b35 More doc about INCLUDECMD. 2021-09-07 10:06:20 -04:00
Dianne Skoll
4395e2f7ed Use "pclose" rather than "fclose" to close descriptors opened with "popen" 2021-09-05 11:45:55 -04:00
Dianne Skoll
1d0cc31b10 Clarify how we determine uniqueness of INCLUDECMD commands. 2021-09-05 11:38:13 -04:00
Dianne Skoll
4b4b2ddcd4 Add test case for line-continuation in INCLUDECMD lines. 2021-09-05 11:30:35 -04:00
Dianne Skoll
3c9b5b786e Convert \n from continuation lines in INCLUDECMD to ' ' to make it a little friendlier. 2021-09-05 11:28:54 -04:00
Dianne Skoll
08f1bea6ce Make TkRemind refuse to attempt to edit reminders issued by an INCLUDECMD 2021-09-05 11:13:11 -04:00
Dianne Skoll
a2cc5943e0 Fix test case 2021-09-05 10:54:56 -04:00
Dianne Skoll
895ac6f0f7 Fix bugs in INCLUDECMD. Improve INCLUDECMD documentation. Add ! feature
If you use:

    INCLUDECMD !some_command

then RUN is disabled for the outptu of some_command.
2021-09-05 10:49:04 -04:00
Dianne Skoll
759ca0253e Strip leading spaces from arg to INCLUDECMD. 2021-09-05 10:05:18 -04:00
Dianne Skoll
0ca368c8d9 Parse arg to INCLUDECMD as a character string, not a sequence of tokens. 2021-09-05 10:02:59 -04:00
Dianne Skoll
a467cc1b84 Document that results of INCLUDECMD commands are cached. 2021-09-04 23:27:17 -04:00
Dianne Skoll
c65fd826a5 Use cached results of commands. 2021-09-04 23:25:37 -04:00
Dianne Skoll
bd6f4e1b43 Add test for includecmd 2021-09-04 23:11:46 -04:00
Dianne Skoll
169520914f Document INCLUDECMD 2021-09-04 23:06:59 -04:00
Dianne Skoll
a163a0c446 Add INCLUDECMD command
Executes a shell command and reads the resulting output as a Remind script.
2021-09-04 23:00:03 -04:00
Dianne Skoll
295aeb0ed8 Prevent floating-point exception if we evaluate $IntMin * (-1) 2021-08-30 12:31:43 -04:00
Dianne Skoll
9b2fdad56c Remove obsolete script. 2021-07-12 13:14:44 -04:00
Dianne Skoll
7a1184d3c5 Don't set LC_ALL to en_US.utf-8 if it's already set to a UTF-8 locale 2021-06-27 13:03:59 -04:00
Dianne Skoll
b036244316 Document that -n causes -g to be ignored. 2021-06-01 14:29:48 -04:00
Dianne Skoll
5ad5366e8a Doc fix: *num should be *rep 2021-05-25 10:24:21 -04:00
Dianne Skoll
244677e524 Prep for 3.3.7 release. 2021-05-10 16:53:16 -04:00
Dianne Skoll
f5a094a973 Fix bug in handling of WKDAY DAY YEAR date specification. 2021-04-15 12:29:30 -04:00
Dianne Skoll
5681ebdb12 Simplify "REM MSG ..." case. 2021-04-13 20:54:54 -04:00
Dianne Skoll
664fa5f08f Fix bug: Remind would sometimes compute incorrect trigger date for:
REM 29 Feb SOME_WEEKDAY MSG ...
2021-04-13 12:21:37 -04:00
Dianne Skoll
14edec5eae Pass in wd to macro explicitly. 2021-04-13 12:11:13 -04:00
Dianne Skoll
6adfd2e739 Wrap code to advance to next specified weekday in a macro. 2021-04-13 12:08:20 -04:00
Dianne Skoll
34409f7a7d Update copyright year. 2021-04-02 10:43:54 -04:00
Dianne Skoll
7e13d1052c Don't run test suite as "root". 2021-04-01 19:41:19 -04:00
Dianne Skoll
eb1998c888 Update version 2021-03-30 16:34:24 -04:00
Dianne Skoll
543252cbaf Update docs. 2021-03-30 16:28:54 -04:00
Dianne Skoll
6df7c59876 Don't change locale to en_US.utf-8 if it is already a UTF-8 locale. 2021-03-25 09:43:42 -04:00
Dianne Skoll
f780e0afc3 Fix typo. 2021-02-28 10:03:05 -05:00
Dianne Skoll
310e8d3287 Clarify comment. 2021-02-15 16:37:20 -05:00
Dianne Skoll
ba51bdf258 Add tests for arithmetic overflow. 2021-02-15 16:35:23 -05:00
Dianne Skoll
ef88b844fb Catch integer overflow with "/". 2021-02-15 10:50:56 -05:00
Dianne Skoll
67b96b0a26 Send error messages to stderr 2021-02-09 12:13:21 -05:00
Dianne Skoll
562da30fb5 Update TkRemind requirements. 2021-02-09 12:08:43 -05:00
Dianne Skoll
21175e8cf6 Add $IntMax and $IntMin special variables. 2021-02-02 17:10:17 -05:00
Dianne Skoll
80d01f7158 Check for overflow in abs() 2021-02-02 17:04:14 -05:00
Dianne Skoll
90cac447e4 Document how Remind handles overflow. 2021-02-01 19:54:31 -05:00
Dianne Skoll
04bf5b0a8b Add explanatory comments about overflow-checking functions 2021-01-30 21:04:44 -05:00
Dianne Skoll
d667c15b25 Add overflow checks for unary minus. 2021-01-30 21:02:56 -05:00
Dianne Skoll
2123bf4b18 Check all Subtract implementations for overflow. 2021-01-30 15:15:02 -05:00
Dianne Skoll
429a64f29e Make all + implementations consistent 2021-01-30 15:12:46 -05:00
Dianne Skoll
f39381dd6c Check for overflow on addition of all integer types. 2021-01-30 15:07:55 -05:00
Dianne Skoll
0a9eb07f6f Check for overflow on addition, subtraction, multiplication of integers 2021-01-30 12:56:37 -05:00
Dianne Skoll
9c287e3fd7 Check for overflow when parsing integer constant. 2021-01-29 18:09:35 -05:00
Dianne Skoll
cce4b2cb14 Update docs. 2021-01-21 15:48:26 -05:00
Dianne Skoll
e49d9f8ab6 Bump version to 03.03.05 2021-01-21 15:44:18 -05:00
Dianne Skoll
48cbeb28f4 Make options file configurable. 2021-01-16 09:49:44 -05:00
Dianne Skoll
57d5c54559 Tidy up color options. 2021-01-15 21:16:44 -05:00
Dianne Skoll
3b2260f67e Tweak appearance 2021-01-15 19:19:13 -05:00
Dianne Skoll
d423a62327 Add ability to change fg/bg colors. 2021-01-15 18:55:38 -05:00
Dianne Skoll
ac8da00030 Update man page for new font-change options; document keyboard shortcuts for navigating. 2021-01-15 09:52:40 -05:00
Dianne Skoll
77eb7fb99d Update copyright date. 2021-01-15 09:46:55 -05:00
Dianne Skoll
a751149dd3 Fix typo. 2021-01-15 08:15:58 -05:00
Dianne Skoll
69d45618c6 Ensure we have Tcl/Tk 8.5 or newer. 2021-01-13 19:56:23 -05:00
Dianne Skoll
22fa1a28e5 Get rid of "Apply Options". "Save Options" is all that's needed. 2021-01-13 19:49:33 -05:00
Dianne Skoll
f4cc233009 Make the month heading also use HeadingFont. 2021-01-13 13:57:55 -05:00
Dianne Skoll
1d6e4edd0f Add dialog box for changing calendar fonts. 2021-01-13 13:08:31 -05:00
Dianne Skoll
daffa8cba0 Add missing release note. 2021-01-12 10:47:30 -05:00
Dianne Skoll
2e161a1bc1 Rebuild configure from configure.in 2021-01-12 10:13:13 -05:00
Dianne Skoll
204bb00060 Update docs; prep 3.3.4 release. 2021-01-12 10:13:00 -05:00
Dianne Skoll
d6029a54aa Remove unnecessary line of code; add space after "sub" operator. 2021-01-10 17:38:25 -05:00
Dianne Skoll
f99b5c5a66 Update man page date. 2021-01-05 21:30:21 -05:00
Dianne Skoll
2df4119c1a Fix test. 2021-01-05 19:14:16 -05:00
Dianne Skoll
d06b4e5dcd Update copyright date 2021-01-05 19:13:11 -05:00
Dianne Skoll
bf8a25137d Right-align moon indicators when day numbers are left-aligned. 2021-01-05 19:08:10 -05:00
Dianne Skoll
0f302ad0fc Add clarifying comment. 2021-01-05 17:38:33 -05:00
Dianne Skoll
e3d6b283c5 Fix setpagedevice for landscape mode. 2021-01-05 17:23:47 -05:00
Dianne Skoll
2e3ed09039 Update test for setpagedevice patch. 2021-01-05 17:20:27 -05:00
Dianne Skoll
37971a3f07 Set page size (patch from Jonathan Kamens) 2021-01-05 17:19:20 -05:00
Dianne Skoll
2a1960f257 Add TkRemind option for drawing day numbers on left. 2021-01-05 16:39:57 -05:00
Dianne Skoll
350564c304 Add "-x" option to rem2ps to put day numbers at the top-left of each box.
By default, day numbers are placed at the top-right.
2021-01-05 16:32:20 -05:00
Dianne Skoll
9e2a9fea37 Use "-q" option with inotifywait 2020-12-30 11:01:25 -05:00
Dianne Skoll
3592b43629 If inotifywait is available, use it to react instantly to changes to reminder file/dir. 2020-12-30 10:59:00 -05:00
Dianne Skoll
becf1fc459 Wait 100ms to update after changes. 2020-12-29 12:48:24 -05:00
Dianne Skoll
2bccd058ed Refactor code in TkRemind to prepare for possibly using inotify to react to changes. 2020-12-29 12:46:23 -05:00
Dianne Skoll
12c6621051 Fix typo 2020-11-09 17:32:16 -05:00
Dianne Skoll
504bc6a875 Update docs 2020-11-09 08:25:28 -05:00
Dianne Skoll
9cfdd0b53f Bump version to 3.3.3. 2020-11-09 07:26:14 -05:00
Dianne Skoll
d59024f399 Fix startup crash if ShowTodaysReminders option is set. 2020-11-09 07:23:19 -05:00
Dianne Skoll
24e0178d1a Fix tests for 3.3.2 release. 2020-11-08 16:01:57 -05:00
Dianne Skoll
1ede5775f2 Prep for 3.3.2 release. 2020-11-08 16:01:39 -05:00
Dianne Skoll
a5c9b07052 Fix for calendar alignment for reminders with embedded tabs.
Convert all whitespace chars to space in calendar mode.
2020-11-03 08:41:24 -05:00
Dianne Skoll
22353d4833 Fix typo (patch from Yigit Sever) 2020-11-02 08:31:28 -05:00
Dianne Skoll
7499ada891 Properly fix combining-char-word-wrapping. 2020-11-01 12:05:21 -05:00
Dianne Skoll
3f0a4e5c39 Fix another instance of mis-counting display width. 2020-11-01 10:13:51 -05:00
Dianne Skoll
b8d6472974 Add UTF-8 test. 2020-11-01 10:06:48 -05:00
Dianne Skoll
6358297724 Fix column misalignment with UTF-8 text. 2020-11-01 10:03:32 -05:00
Dianne Skoll
4f6dcde980 Upper-case section references.
Prevent potential null pointer dereference.
2020-10-31 16:57:13 -04:00
Dianne Skoll
8a7985c48e Highlight that longitude sign is opposite from the usual convention. 2020-10-12 18:54:26 -04:00
Dianne Skoll
4ddbe54e55 Fix typo 2020-09-25 22:27:48 -04:00
Dianne Skoll
ef0bf73a29 Document MAYBE-UNCOMPUTABLE. 2020-09-25 22:20:16 -04:00
Dianne Skoll
beda9014d8 Add test for MAYBE-UNCOMPUTABLE 2020-09-25 22:11:56 -04:00
Dianne Skoll
498a429b2c Add MAYBE-UNCOMPUTABLE modifier to trigger. 2020-09-25 22:08:49 -04:00
Dianne Skoll
6aa2aa0fb3 Align system vars in output. 2020-09-20 17:43:51 -04:00
Dianne Skoll
1bef88fccd Update released notes. 2020-09-20 17:40:58 -04:00
Dianne Skoll
8308068067 Don't bother aligning "DUMP" output.
It looks ridiculous with 64-char long variable names.
2020-09-20 17:39:33 -04:00
Dianne Skoll
8385c7f1b0 Update custom.h 2020-09-20 17:35:24 -04:00
Dianne Skoll
0537d02fef Increase max variable length from 16 to 64 characters.
Modern computers have plenty of memory, so meh.
2020-09-20 17:32:22 -04:00
Dianne Skoll
c33a1a3b0b Mention that variables are global. 2020-09-20 12:45:29 -04:00
Dianne Skoll
fd39999128 Fix bugs where month numbers with leading zeros are misinterpreted as octal instead of decimal.
Reported by Peter Geddes.
2020-09-13 12:34:27 -04:00
Dianne Skoll
0aa40094fa Make TwentyFourHourMode global. 2020-08-18 15:24:19 -04:00
Dianne Skoll
e3bbbe07be Respect 24-hour mode option. 2020-08-18 15:24:13 -04:00
Dianne Skoll
5633798d33 Document that time is fed to reminder command. 2020-08-18 15:24:09 -04:00
Dianne Skoll
0e7e1b1b75 When feeding reminder on stdin, prefix with "$time: " 2020-08-18 15:24:04 -04:00
Dianne Skoll
4d3790bc1a More tweaking of defs.rem to remove cruft and modernize usage. 2020-08-18 15:24:00 -04:00
Dianne Skoll
2002c7f1f8 Fix up defs.rem. 2020-08-18 15:23:51 -04:00
Dianne Skoll
1be14e99a2 Update docs for -itkremind=1 and -itkprint=1 options in TkRemind. 2020-06-11 15:06:09 -04:00
Dianne Skoll
78efdaf85f Fix bug that broke printing by putting cmdline options in wrong spot. 2020-06-10 10:26:06 -04:00
Dianne Skoll
0e98a1c656 Always set tkremind=1; set tkprint=1 if we're printing. 2020-06-10 10:22:46 -04:00
Dianne Skoll
7aa483e201 Fix bug reported by Jurgen Bollerhey
I have a
"REM Mon SPECIAL WEEK (W[weekno()])"
in my reminders file.
With tkremind -m the week number is displayed on the 2nd column which is
Tuesday and the date of this Tuesday is taken from the monday of the
next week, sometimes of Monday the same week.
2020-03-30 11:29:19 -04:00
Dianne Skoll
a6dbf05af4 Update WHATSNEW. 2020-03-20 09:18:48 -04:00
Dianne Skoll
8ab78fd8be Suppress compile warnings on Ubuntu 18.04 2020-03-19 20:27:45 -04:00
Dianne Skoll
4f119031a4 One more warning to suppress. 2020-03-19 20:24:53 -04:00
Dianne Skoll
19bdd6c2db Avoid warning about ignoring return value of fgets. 2020-03-19 20:24:01 -04:00
Dianne Skoll
f1557b8243 Try to suppress fallthrough warning. 2020-03-19 20:21:29 -04:00
Dianne Skoll
85f96e2e01 Update man page. 2020-03-14 11:37:11 -04:00
Dianne Skoll
47331cd919 Make ampm() function accept a DATETIME and obey $TimeSep, $DateSep and $DateTimeSep 2020-03-14 11:32:35 -04:00
Dianne Skoll
d9f18ed6a7 Don't use many-json2dict 2020-03-03 11:43:54 -05:00
Dianne Skoll
efa4816371 Properly-form JSON output. 2020-03-03 10:36:01 -05:00
Dianne Skoll
2dc8c63adb Proper prefix for beta versions. 2020-02-29 09:38:51 -05:00
Dianne Skoll
c3c1781021 Update COPYRIGHT date. 2020-02-28 08:56:49 -05:00
Dianne Skoll
cd39480a98 Remove extraneous spaces. 2020-02-27 16:50:44 -05:00
Dianne Skoll
281a1a206e Implement JSONQUEUE daemon command. 2020-02-27 15:18:23 -05:00
Dianne Skoll
cbff2a7bf2 Document ampm() 2020-02-27 08:39:21 -05:00
Dianne Skoll
2a08be8fd0 Fix up unit tests. 2020-02-26 17:43:47 -05:00
Dianne Skoll
0826678209 Make coerce from string to time and datetime accept ampm 2020-02-26 17:41:51 -05:00
Dianne Skoll
f2e421bfa5 Add acceptance tests for ampm() function. 2020-02-26 17:25:09 -05:00
Dianne Skoll
ce53a9b91a Add "ampm" built-in function. 2020-02-26 17:21:34 -05:00
Dianne Skoll
b166b1cf82 Fix up test file. 2020-02-24 15:17:07 -05:00
Dianne Skoll
d09fbb03b2 Bump version to 3.3.1. 2020-02-24 15:16:20 -05:00
Dianne Skoll
7a835f3b10 Update docs. 2020-02-23 16:02:59 -05:00
Dianne Skoll
6b991cdf9c Refactor saving of trigger info. 2020-02-23 11:38:17 -05:00
Dianne Skoll
018e9d0323 JSON can handle newlines (the literal newlines will be escaped to "\n" by the JSON writer.) 2020-02-23 11:17:59 -05:00
Dianne Skoll
f499ae096f Don't include filename or line number in synthesized tag. 2020-02-23 11:15:38 -05:00
Dianne Skoll
725e046a15 Fix bug in recording trigdate() for SATISFY-type reminders. :( 2020-02-22 19:15:24 -05:00
Dianne Skoll
275b1f62b6 For overlapping reminders, prefer the *later* version. 2020-02-22 16:50:42 -05:00
Dianne Skoll
6e58dea198 Handle overlapping events better. 2020-02-22 16:30:08 -05:00
Dianne Skoll
ad4e62c8c3 Test specifying DURATION as an integer. 2020-02-22 12:48:07 -05:00
Dianne Skoll
a5768d55d8 Update man page to document integer form of DURATION. 2020-02-22 12:46:57 -05:00
Dianne Skoll
7db49971c8 Update man page. 2020-02-22 12:40:32 -05:00
Dianne Skoll
45ca6631ac Make sure AM/PM is case-insensitive. 2020-02-22 12:32:52 -05:00
Dianne Skoll
d51944f36c Allow duration to be specified as a single number, meaning minutes.
Don't convert 90-99 to 1990-1999 when parsing numbers.
2020-02-22 12:31:17 -05:00
Dianne Skoll
037c79fb0f Allow times to have am/pm specifications. 2020-02-22 12:24:37 -05:00
Dianne Skoll
993373414f Parse times and datetimes with trailing am/pm 2020-02-22 12:14:18 -05:00
Dianne Skoll
38a0a9992a Leave a space after the asterisk row. 2020-02-12 11:19:30 -05:00
Dianne Skoll
a82bbe3776 Highlight today in month mode also. 2020-02-12 11:17:21 -05:00
Dianne Skoll
a32ba217ba Update man page. 2020-02-08 15:11:15 -05:00
Dianne Skoll
d322cf54ac Allow $FormWidth to be as large as 500. 2020-02-08 15:10:48 -05:00
Dianne Skoll
b1d07a231d Document $FormWidth. 2020-02-08 15:06:09 -05:00
Dianne Skoll
97851a08e6 Clamp min cal width at 72 2020-02-08 15:04:59 -05:00
Dianne Skoll
8547b30a8f Set $FormWidth to terminal width - 8 on startup. 2020-02-08 15:04:48 -05:00
Dianne Skoll
405c7d9ed0 Set release date. 2020-01-31 11:17:55 -05:00
Dianne Skoll
ac5b641d93 Note that back-ends MUST ignore unknown SPECIALs. 2020-01-30 16:07:57 -05:00
Dianne Skoll
06a79989c0 Minor tweaks. 2020-01-28 15:16:41 -05:00
Dianne Skoll
671db64436 Fix various typos. 2020-01-28 09:51:12 -05:00
Dianne Skoll
33344cefe6 Fix typo 2020-01-28 09:47:06 -05:00
Dianne Skoll
5ef0341537 Avoid memory leak. 2020-01-28 09:43:42 -05:00
Dianne Skoll
6abca08189 Add test to ensure rem2ps ignores unknown SPECIALs. 2020-01-28 09:42:13 -05:00
Dianne Skoll
35670ce651 Update docs 2020-01-28 09:38:06 -05:00
Dianne Skoll
e230d53d84 Ignore unknown SPECIALs in rem2ps. 2020-01-28 09:37:35 -05:00
Dianne Skoll
88537a3471 Remove ancient pointer to doe.carleton.ca 2020-01-28 09:29:42 -05:00
Dianne Skoll
7c9d74da73 Fix typo 2020-01-27 16:46:57 -05:00
Dianne Skoll
3b582935ee Sign beta tarballs too. 2020-01-27 16:46:07 -05:00
Dianne Skoll
508fafb875 Update WHATSNEW. 2020-01-27 16:28:57 -05:00
Dianne Skoll
6f718f0fe5 Update rem2ps man page. 2020-01-27 13:29:33 -05:00
Dianne Skoll
53acbf2052 Don't swallow %" %" markers in -ppp mode. 2020-01-27 13:21:48 -05:00
Dianne Skoll
1606dbbe77 Rework -@ option and tests. 2020-01-27 11:49:41 -05:00
Dianne Skoll
adced3ac6c Rework -@ option to be n,m 2020-01-27 11:44:16 -05:00
Dianne Skoll
14f207140a Better clamping algorithm for true colors 2020-01-27 11:31:57 -05:00
Dianne Skoll
d2da32de6c Don't hard-code number. 2020-01-26 18:26:03 -05:00
Dianne Skoll
e5d6a36f05 Update WHATSNEW 2020-01-26 18:10:11 -05:00
Dianne Skoll
68ecfcf876 Update test for change to rem2ps 2020-01-26 18:09:27 -05:00
Dianne Skoll
fcb14b9dfe Add PageBoundingBox comment. 2020-01-26 18:09:06 -05:00
Dianne Skoll
6a4b4257a6 Fix compilation failure on pre-C99 compilers. 2020-01-26 17:47:00 -05:00
Dianne Skoll
385b57e269 Update whatsnew 2020-01-25 17:43:10 -05:00
Dianne Skoll
a8e81e3984 Update WHATSNEW. 2020-01-25 17:41:47 -05:00
Dianne Skoll
46c5f0e752 Update man page for exact color setting. 2020-01-25 16:18:09 -05:00
Dianne Skoll
454d859fdd Support true RGB coloring. 2020-01-25 16:16:51 -05:00
Dianne Skoll
57134a182c Make SPECIALs case-insensitive. 2020-01-25 16:07:18 -05:00
Dianne Skoll
5801e143ea Make specials case-insensitive. 2020-01-25 16:04:53 -05:00
Dianne Skoll
4e0d0ff98b Test Xterm 256-color mode. 2020-01-25 15:16:30 -05:00
Dianne Skoll
d4ac1849ae Add comment for Xterm 256 colors. 2020-01-25 15:12:13 -05:00
Dianne Skoll
c16ac1bd8c Support 256-color mode on XTerm and other terminals. 2020-01-25 15:06:43 -05:00
Dianne Skoll
16222ac3bc Fix to man page. 2020-01-25 14:35:20 -05:00
Dianne Skoll
8d88931fb1 Fix indentation. 2020-01-25 14:27:25 -05:00
Dianne Skoll
63f0356e70 Fix man page wording. 2020-01-25 14:26:32 -05:00
Dianne Skoll
786b0dee6f Add test for =@ 2020-01-25 14:23:52 -05:00
Dianne Skoll
e7ef9dc295 Document -@ 2020-01-25 14:12:56 -05:00
Dianne Skoll
f59461b95d Convert black-on-black or white-on-white to grey. 2020-01-25 14:00:28 -05:00
Dianne Skoll
566a86b9fd Obey default color settings. 2020-01-25 11:29:06 -05:00
Dianne Skoll
8589a3730d Put -@[n] in help. 2020-01-25 11:13:50 -05:00
Dianne Skoll
c05fd366df Implement -@, -@0 and -@1 options to colorize reminders. 2020-01-25 11:12:10 -05:00
Dianne Skoll
fc9fd1e53c Start adding support for colored reminders in Agenda Mode. 2020-01-24 16:31:01 -05:00
Dianne Skoll
a5e6eb9f7c Add -@ commandline option. Yuck. 2020-01-24 16:26:55 -05:00
Dianne Skoll
a9430fea5f Make Remind adjust calendar to fit terminal. 2020-01-18 15:11:28 -05:00
Dianne Skoll
828a0d6589 Emit prevmonthyear and nextmonthyear items in -ppp format. 2020-01-18 14:52:17 -05:00
Dianne Skoll
32601da748 Update tests. 2020-01-18 14:48:27 -05:00
Dianne Skoll
ac50f119cf Document that -pp and -ppp enable -l 2020-01-18 14:45:23 -05:00
Dianne Skoll
7622ebaa0a Document remind -ppp format. 2020-01-18 14:43:21 -05:00
Dianne Skoll
a586d5cd37 Fix bug that incorrectly printed # fileinfo lines for -ppp format. 2020-01-18 14:43:04 -05:00
Dianne Skoll
edbc88bd19 Reformat error message. 2020-01-16 20:00:38 -05:00
Dianne Skoll
94f99f3414 Make rem2ps bail out if fed "-ppp"-format. 2020-01-16 19:59:30 -05:00
Dianne Skoll
fd4f84349e Include filename and lineno in tag synthesis. 2020-01-16 19:19:13 -05:00
Dianne Skoll
f86350b2ff More man page tweakage. 2020-01-16 18:56:28 -05:00
Dianne Skoll
564b72066a Document $DefaultColor 2020-01-16 18:53:30 -05:00
Dianne Skoll
2890c52090 Fix typo in man page 2020-01-15 11:27:43 -05:00
Dianne Skoll
c1d45485c1 Update test suite. 2020-01-15 09:20:31 -05:00
Dianne Skoll
8b2a69cf8d Do a small bit of refactoring to get rid of some copy/paste code. 2020-01-15 09:18:32 -05:00
Dianne Skoll
034c1341b3 Fix typos. 2020-01-14 21:47:26 -05:00
Dianne Skoll
29bbf1a030 Be strict in what we accept for SET $DefaultColor "r g b" 2020-01-14 21:44:08 -05:00
Dianne Skoll
be6661d6be Don't assume a potentially-colored reminder unless it's MSG/MSF/CAL type. 2020-01-14 21:43:46 -05:00
Dianne Skoll
3f876e792c Reset $DefaultColor each time we iterate. 2020-01-14 21:15:27 -05:00
Dianne Skoll
f2457b90ff Add patch for $DefaultColor, courtesy of Tim Chase. 2020-01-14 21:07:20 -05:00
Dianne Skoll
e999e9009b Minor formatting tweak. 2020-01-14 20:17:38 -05:00
Dianne Skoll
46326c001b Output true JSON if you invoke as "remind -ppp" 2020-01-14 20:09:24 -05:00
Dianne Skoll
b84c2c403c Add more balloon help. 2020-01-13 21:19:45 -05:00
Dianne Skoll
861ad72187 Add popup help. 2020-01-13 18:26:40 -05:00
Dianne Skoll
7dbbc34ccc Make Remind compile on older gcc that doesn't allow declarations in for(...) 2020-01-13 10:00:25 -05:00
Dianne Skoll
4ea45d1d14 Update rem2ps man page. 2020-01-12 20:03:43 -05:00
Dianne Skoll
c1b9243e2f Document new REM2PS format. 2020-01-12 19:56:45 -05:00
Dianne Skoll
a41c40c7a4 Document -pp option. 2020-01-12 19:24:21 -05:00
Dianne Skoll
318d4547ef Use r, g, b settings from SHADE special. 2020-01-12 18:11:35 -05:00
Dianne Skoll
6f98b60a6a Output "r", "g", "b" for shade-style reminders. 2020-01-12 18:09:41 -05:00
Dianne Skoll
baa8f7f3c4 Add test that OMITFUNC raises nonconst_expr indicator. 2020-01-12 17:51:06 -05:00
Dianne Skoll
6297622072 Write JSON using English day names. 2020-01-12 17:47:41 -05:00
Dianne Skoll
9f3ba0bf2b More intelligent filling out of GUI. 2020-01-12 17:27:50 -05:00
Dianne Skoll
9591dec708 Write out fully-specified dates in Reminders more compactly. 2020-01-12 17:15:38 -05:00
Dianne Skoll
ee2d0b7518 Production file location! 2020-01-12 14:05:55 -05:00
Dianne Skoll
2d46749c58 Add blank line when *first* creating AppendFile. 2020-01-12 14:01:20 -05:00
Dianne Skoll
494664d1b6 Take out blank line from warning header lines. 2020-01-12 14:00:04 -05:00
Dianne Skoll
49686210ae Better reverse-engineering of ordinal. 2020-01-12 13:57:25 -05:00
Dianne Skoll
ddfa44188b Reset HighestTagSoFar when we rewrite the appendfile after deletion. 2020-01-12 13:52:17 -05:00
Dianne Skoll
73cf93d27b Renumber tags when we delete a tagged reminder. 2020-01-12 13:34:22 -05:00
Dianne Skoll
60d1a34bf0 Fix up AM/PM handling; delete old comment lines. 2020-01-12 13:28:45 -05:00
Dianne Skoll
6f80986801 New version of tkremind seems to be decent... 2020-01-12 13:14:32 -05:00
Dianne Skoll
2078f087b2 An OMITFUNC should set the nonconst_expr flag. 2020-01-12 13:06:55 -05:00
Dianne Skoll
68d110826e First version of TkRemind that can reverse-engineer reminder without needing comments to set up GUI. 2020-01-12 12:45:34 -05:00
Dianne Skoll
9fb04c54ae Start work on reverse-engineering reminder dialog from JSON instead of relying on comments. 2020-01-11 19:08:35 -05:00
Dianne Skoll
d82314594b Make rem2html understand JSON interchange format. 2020-01-10 15:06:59 -05:00
Dianne Skoll
ad169a5248 Eliminate compiler warnings. 2020-01-10 13:57:13 -05:00
Dianne Skoll
a9bab81226 Test that rem2ps can parse "remind -pp" output. 2020-01-10 13:48:58 -05:00
Dianne Skoll
fa63a9ba51 Add comments. 2020-01-10 13:46:20 -05:00
Dianne Skoll
1e7a630737 rem2ps can read the new-style JSON output of "remind -pp" 2020-01-10 13:41:27 -05:00
Dianne Skoll
de1afce8da Suppress unused param warnings. 2020-01-09 18:53:00 -05:00
Dianne Skoll
ac3cb19c26 Simplify code. 2020-01-09 18:42:14 -05:00
Dianne Skoll
af0479d11d Start preparing rem2ps for parsing JSON input. 2020-01-09 18:38:08 -05:00
Dianne Skoll
0d9c04707f Output nonconst_expr and if_depth indicators in JSON mode. 2020-01-08 08:42:23 -05:00
Dianne Skoll
c2218f133b Preserve RGB info for a COLOR reminder. 2020-01-07 13:27:22 -05:00
Dianne Skoll
1ad0645fab Only print rawbody if it differs from body. 2020-01-06 22:25:49 -05:00
Dianne Skoll
3c16f6839a Pass raw body through to back-end in JSON mode. 2020-01-06 22:19:22 -05:00
Dianne Skoll
e8bac1e469 More info over JSON via -pp commandline switch. 2020-01-05 17:15:37 -05:00
Dianne Skoll
b3b69596f4 Output SKIP value in JSON. 2020-01-05 12:18:10 -05:00
Dianne Skoll
6a7bcb0956 Print the "wd" entry as array of weekday names. 2020-01-05 12:15:20 -05:00
Dianne Skoll
f18a0704c1 More work on emitting JSON. 2020-01-05 12:10:05 -05:00
Dianne Skoll
d6f24b7c1e rem2ps will only support "remind -p" protocol and not "remind -pp" 2020-01-03 18:00:21 -05:00
Dianne Skoll
e2c9bbf94c Start working on JSON-based alternate "remind -p" protocol. 2020-01-03 17:24:01 -05:00
Dianne Skoll
f53aa4f656 Start working on Version 2 of Rem2PS protocol. 2020-01-03 16:51:47 -05:00
Dianne Skoll
a7ab9b8bf8 Update release date. :( 2020-01-03 13:14:53 -05:00
Dianne Skoll
4448271166 Update WHATSNEW. 2020-01-03 13:05:33 -05:00
Dianne Skoll
4861b535a2 Use nicer moon graphics. 2020-01-03 13:02:16 -05:00
Dianne Skoll
167f0100c7 Minor tweaks. 2020-01-03 12:43:22 -05:00
Dianne Skoll
b0367c7a5c Update README.UNIX. 2020-01-02 14:45:31 -05:00
Dianne Skoll
4ae8ad52f5 Update WHATSNEW. 2020-01-02 14:42:46 -05:00
Dianne Skoll
dbd64828ab Use nicer moon images. 2020-01-02 11:39:29 -05:00
Dianne Skoll
158ca882ba Fix typo 2020-01-01 18:32:24 -05:00
Dianne Skoll
623ed44608 Update man page. 2020-01-01 18:30:46 -05:00
Dianne Skoll
f13b867626 Update WHATSNEW 2020-01-01 18:04:20 -05:00
Dianne Skoll
ff85325886 Support DATETIME - TIME 2020-01-01 18:00:22 -05:00
Dianne Skoll
aa830116ea Update copyright dates, etc. 2020-01-01 10:13:50 -05:00
Dianne Skoll
1a4504ba28 Catch date overflow if we use a crazy-long DURATION. 2020-01-01 10:01:02 -05:00
Dianne Skoll
20365c4627 Document DURATION 00:00 2020-01-01 09:50:13 -05:00
Dianne Skoll
fae8f89ed6 Handle self-overlapping events correctly; avoid 0-duration events; document
self-overlapping behaviour.
2020-01-01 09:45:28 -05:00
Dianne Skoll
a0689999fe Adjust duration_days to not include zero-duration tails. 2020-01-01 09:31:55 -05:00
Dianne Skoll
a42a0ab032 Update WHATSNEW. 2019-12-31 23:32:18 -05:00
Dianne Skoll
b66eb5d3ec Suppress printing subdirectory entry for "make test" 2019-12-31 23:11:55 -05:00
Dianne Skoll
8b4bc0f56e Print warning if we truncate a function name. 2019-12-31 22:54:22 -05:00
Dianne Skoll
c9d984983f Add a warning if we truncate variable names. 2019-12-31 22:50:42 -05:00
Dianne Skoll
47125b051a Clarify that IFTRIG can't take SATISFY 2019-12-31 22:41:34 -05:00
Dianne Skoll
e5e6ff6031 Return "Can't compute trigger" if SATISFY uses up too many iterations. 2019-12-31 22:26:23 -05:00
Dianne Skoll
9f0aedb608 Don't suppress errors in trigger computation. 2019-12-31 22:13:53 -05:00
Dianne Skoll
08af33ece5 Don't allow DURATION without an AT. 2019-12-31 21:51:34 -05:00
Dianne Skoll
9b421d0b94 Fix typo 2019-12-31 21:44:49 -05:00
Dianne Skoll
7bd8d2dd25 Tweak formatting. 2019-12-31 21:40:32 -05:00
Dianne Skoll
a7c4879a0a Update man page and WHATSNEW. 2019-12-31 21:38:18 -05:00
Dianne Skoll
8b3585a6b8 Add test for trigeventstart() and trigeventduration() 2019-12-31 21:12:44 -05:00
Dianne Skoll
a223149aee Add trigeventstart() and trigeventduration() functions. 2019-12-31 21:09:21 -05:00
Dianne Skoll
9185341b0c Add a test. 2019-12-31 19:14:15 -05:00
Dianne Skoll
bf2d707e13 Skip duration_days at least in each SATISFY loop. 2019-12-31 18:51:22 -05:00
Dianne Skoll
f081e5c54d Update test. 2019-12-31 18:42:10 -05:00
Dianne Skoll
18a3db0f31 Fix interation between multi-day events and SATISFY. 2019-12-31 18:41:25 -05:00
Dianne Skoll
d2c115127d Add a FIXME. 2019-12-31 18:02:49 -05:00
Dianne Skoll
c12e7e1b8f Update tests with new version. 2019-12-31 17:47:40 -05:00
Dianne Skoll
d3495ab3aa Update version to 3.2.0. Events spanning >1 day are a major new feature. 2019-12-31 17:46:40 -05:00
Dianne Skoll
b93a7a6195 Update tests. 2019-12-31 17:43:46 -05:00
Dianne Skoll
e5519a8498 Handle events that span >1 day. 2019-12-31 17:39:26 -05:00
Dianne Skoll
eb2256f873 Use proper arrow icons instead of text <- and -> 2019-12-30 20:51:37 -05:00
Dianne Skoll
637b137b1c Use open |foo rather than exec to handle cmdline option parsing more uniformly. 2019-12-30 20:27:12 -05:00
Dianne Skoll
e2d14e73bf Update copyright date. 2019-12-30 11:18:01 -05:00
Dianne Skoll
fbbffb4672 Bump version to 3.1.18 and copyright year to 2020. 2019-12-30 11:15:00 -05:00
Dianne Skoll
422e098727 Don't use a static coerce_buf 2019-12-30 11:02:09 -05:00
Dianne Skoll
87347e30b2 Make string concatenation more efficient. 2019-12-30 10:59:32 -05:00
Dianne Skoll
3314ce9823 Update WHATSNEW 2019-12-30 10:42:17 -05:00
Dianne Skoll
402c1fe614 Proper fix. 2019-12-30 10:37:30 -05:00
Dianne Skoll
1d57856aa8 Avoid startup error if ShowTodaysReminders is true and ExtraRemindArgs is empty. 2019-12-30 10:34:37 -05:00
Dianne Skoll
c027c215d6 Update WHATSNEW 2019-12-29 21:03:27 -05:00
Dianne Skoll
fa0428b9fe Fix compile error for Romanian language; avoid compiler warning for non-English languages. 2019-12-29 19:08:48 -05:00
Dianne Skoll
b01c499ce5 Tweak man page. 2019-12-29 18:53:29 -05:00
Dianne Skoll
4e5033dd24 Implement adding DATETIME+TIME, TIME+DATETIME and TIME+TIME 2019-12-29 18:46:10 -05:00
Dianne Skoll
00863f3830 Add header file dependency. 2019-12-28 17:46:17 -05:00
Dianne Skoll
2d4b35e8b9 Add tests for introspection functions. 2019-12-28 17:28:31 -05:00
Dianne Skoll
6e4f2b9466 Implement remaining trigger introspection functions. 2019-12-28 17:09:05 -05:00
Dianne Skoll
9a6fc0253b Clear last triggers in all necessary spots. 2019-12-28 16:42:10 -05:00
Dianne Skoll
3180c781ed Start working on making bits of the trigger and time trigger introspectable. 2019-12-28 16:37:47 -05:00
Dianne Skoll
632152e8b6 Remember the last trigger and time trigger. 2019-12-28 16:24:16 -05:00
Dianne Skoll
1048f7e98d Add TAGS to omitted files. 2019-12-28 16:17:32 -05:00
Dianne Skoll
3de265216e Document $MaxStringLen 2019-11-21 11:41:25 -05:00
Dianne Skoll
2bdcadc7ab Minor cleanups. 2019-11-21 11:36:49 -05:00
Dianne Skoll
421ddfc68e Catch date overflow in slide() function. 2019-11-21 11:06:00 -05:00
Dianne Skoll
41594bc1ac Update release notes. 2019-11-15 11:14:23 -05:00
Dianne Skoll
e85199d464 Remove obsolete line. 2019-11-15 11:08:04 -05:00
Dianne Skoll
a6ee3bc704 Use git-archive to create tarball. 2019-11-15 11:06:19 -05:00
Dianne Skoll
2909106f30 Update copyright date. 2019-11-15 10:57:01 -05:00
Dianne Skoll
05b97aabb2 Sign releases. 2019-11-15 10:56:40 -05:00
Dianne Skoll
84af60d817 Delete COMMIT_EDITMSG when syncing to public git repo. 2019-11-14 17:04:43 -05:00
Dianne Skoll
72403a2512 Warn if "OMIT a THROUGH b" has a > b 2019-11-14 11:09:51 -05:00
Dianne Skoll
4ec619d646 Update copyright date. 2019-11-07 20:52:38 -05:00
Dianne Skoll
6178a627a0 Fix bug that prevented warning if we redefine a built-in function. 2019-11-07 20:50:35 -05:00
Dianne Skoll
3095fd7e4a Enable warning-free compilation even with -Wextra. 2019-11-04 16:35:14 -05:00
Dianne Skoll
74a6041760 Update version to 03.01.17. 2019-11-04 16:18:56 -05:00
Dianne Skoll
96127e37ff Update man page. 2019-11-04 16:16:15 -05:00
Dianne Skoll
df5484ea35 Add test for "SCANFROM -n" form. 2019-11-04 16:10:53 -05:00
Dianne Skoll
0ae3dae030 Allow shortand: SCANFROM -n meaning SCANFROM [today() - n] 2019-11-04 16:08:44 -05:00
Dianne Skoll
e5979139ac Fix typo. 2019-02-13 11:04:20 -05:00
Dianne Skoll
f81f6deb20 Apply patch from Dov Feldstern to fix Adar behaviour. 2018-12-11 10:05:11 -05:00
Dianne Skoll
f9951909d8 First part of patch to fix ADAR behaviour 2018-12-11 10:04:05 -05:00
Dianne Skoll
bbda972b05 Properly react to changes in extra remind args. 2018-12-07 14:54:02 -05:00
Dianne Skoll
4445e9c434 Add "Extra remind options" option. 2018-12-07 14:47:47 -05:00
Dianne Skoll
709adacac2 Add helper script to sync to dianne.skoll.ca git repo 2018-11-29 11:18:35 -05:00
Dianne Skoll
9841cdd355 When dumping queue contents, omit expired reminders. 2018-11-28 14:27:40 -05:00
Dianne Skoll
4cabe5fd71 Update docs/WHATSNEW with release notes. 2018-11-09 08:27:21 -05:00
Dianne Skoll
0db239f8a0 Bump version to 03.01.16. 2018-11-09 08:20:08 -05:00
Dianne Skoll
32fb1706c8 Fix a few more SystemTime calls. 2018-11-04 13:47:18 -05:00
Dianne Skoll
c9e6cd9796 Queue should use actual clock in computer. 2018-11-04 13:45:23 -05:00
Dianne Skoll
81677528a5 In -z0 mode, wake up exactly on the minute. 2018-11-04 13:39:00 -05:00
Dianne Skoll
7761baba10 ? 2018-11-04 13:29:59 -05:00
Dianne Skoll
52d252723f Depenguinization. 2018-11-04 10:56:47 -05:00
Dianne Skoll
d476709b59 Update DST rules. 2018-10-31 10:44:44 -04:00
Dianne Skoll
0910e3da74 Center popups over cal window. 2018-10-29 13:22:33 -04:00
Dianne Skoll
2cc7b7c817 Make queue grid resize gracefully. 2018-04-19 14:06:52 -04:00
Dianne Skoll
011a95ebbd Format the queue output better. 2018-04-19 14:01:09 -04:00
Dianne Skoll
bbdc086a1f Correct definitions for Yom Hazikaron and Yom Ha'atzmaut. 2018-04-19 14:00:46 -04:00
Dianne Skoll
7d6617d21e Finish adding queue feature. 2018-04-18 10:57:51 -04:00
Dianne Skoll
f684baeeb9 Add a QUEUE daemon command to dump the queue. 2018-04-18 10:43:49 -04:00
Dianne Skoll
308104853b Redraw window if file time is updated. 2018-04-13 08:46:26 -04:00
Dianne Skoll
6953bcac35 Monitor .reminders for mtime changes and restart daemon if it changes. 2018-04-12 11:44:04 -04:00
Dianne Skoll
69e9fa4721 Put hostname in tkremind window. Silence gcc warning. 2017-07-18 10:36:08 -04:00
Dianne Skoll
72d154c5e0 Patch from Stephen Morgan to calculate astronomical and nautical twilight in addition to civil twilight. 2017-01-19 10:11:54 -05:00
Dianne Skoll
84b0a96170 Accept datetimes in ISO-8601 format on input.
Add $DateTimeSep system variable to select T or @ as separator
on output.
2016-07-25 10:05:25 -04:00
Dianne Skoll
6d3b8f7a09 Handle the "SHADE nnn" special with just one number.
Pointed out by hymie@lactose.homelinux.net
2016-01-15 10:16:02 -05:00
Dianne Skoll
81749ac1c9 Update release notes. 2015-07-27 15:41:14 -04:00
Dianne Skoll
65989c29b7 Add test for bug found by Alexander Keller 2015-07-27 15:38:11 -04:00
Dianne Skoll
ec4e58f25c Proper fix for overflow. 2015-07-27 13:20:00 -04:00
Dianne Skoll
0c699c2a19 Fix potential buffer overflow. 2015-07-27 13:18:16 -04:00
Dianne Skoll
739a938d32 Don't permit repeated DELTA or REPEATs either. 2015-05-27 13:21:33 -04:00
Dianne Skoll
61ad405b4a Reject AT clause with more than one following TIME. 2015-05-27 13:19:25 -04:00
Dianne Skoll
700e649e76 Fix typo in year. Pointed out by hymie@lactose.homelinux.net 2015-04-24 15:33:35 -04:00
Dianne Skoll
7bfdb1f0eb Document the magic __EOF__ marker. 2015-04-24 14:42:48 -04:00
Dianne Skoll
0c0280b2a9 Add test for __EOF__ 2015-04-24 14:40:12 -04:00
Dianne Skoll
57a1871077 Fix test output. 2015-04-24 14:37:32 -04:00
Dianne Skoll
ee972ad29f Update version to 3.1.14 2015-04-24 14:37:06 -04:00
David F. Skoll
29c8475ea9 s/David/Dianne/ 2015-04-17 02:07:18 -04:00
David F. Skoll
6dd0f6ed63 Fix typo. 2014-11-06 14:32:30 -05:00
David F. Skoll
fc2d7ae446 Add support for __EOF__ to make Remind stop reading a file. 2014-05-22 14:19:06 -04:00
David F. Skoll
d232ac0334 Clear out MD5 context correctly. 2014-02-14 12:46:12 -05:00
David F. Skoll
6e8dd68c8a Use ADVANCE_MODE rather than CAL_MODE for "-n" cmdline option. 2013-04-30 15:58:02 -04:00
David F. Skoll
495cc1b38d Improve PNG images. 2013-03-22 16:21:52 -04:00
David F. Skoll
d90e74b1a3 Update release notes. 2013-03-22 15:48:04 -04:00
David F. Skoll
bbd8a4b729 Bump version to 3.1.13. 2013-03-22 15:44:03 -04:00
David F. Skoll
cae3e18717 Two cleanup patches from Simon Ruderich. 2013-03-18 14:07:09 -04:00
David F. Skoll
0e989a7422 Use atan2 instead of atan. 2013-03-10 18:00:36 -04:00
David F. Skoll
7b7ce5bb57 Remove dead code and dead variable. 2013-03-08 10:27:38 -05:00
David F. Skoll
df95cdaad0 Final sunrise/sunset tweakage. 2013-03-08 10:26:48 -05:00
David F. Skoll
3026b6e5c2 Tweak sun stuff per John McGowan ticket #27369. 2013-03-07 13:49:53 -05:00
David F. Skoll
b3306c5572 Revert change: TrigAttempts too hard to define. 2012-12-09 11:23:02 -05:00
David F. Skoll
9ef3be33e5 Add new $TrigAttempts special var. 2012-12-09 11:17:16 -05:00
David F. Skoll
292262c128 -z defaults to 1, not 5, so correct man page and help output.
Thanks to Simon Ruderich for pointing out the bug.
2012-11-01 13:07:42 -04:00
David F. Skoll
e54bfe9197 Minor patches from Simon Ruderich 2012-10-18 09:31:12 -04:00
David F. Skoll
c56cfe9e1d Fix test harness failure. 2012-05-08 16:54:54 -04:00
David F. Skoll
f6b6a3285c Apply patch from Jonathan Kamens to allow 0-point margins. 2012-04-26 08:57:37 -04:00
David F. Skoll
6b031b0fdf Change "Daylight Savings" to "Daylight Saving" 2012-03-23 15:45:49 -04:00
David F. Skoll
2dab7025ba Fix incorrect info in man page. 2012-03-14 11:47:43 -04:00
David F. Skoll
7403114897 Patch to allow compilation with gcc 2.95. 2012-02-13 10:23:53 -05:00
David F. Skoll
82cbeec560 Update tests to skip sun-tests by default. 2012-01-23 13:21:50 -05:00
David F. Skoll
df6b4ac566 Update release notes. 2012-01-23 13:08:22 -05:00
David F. Skoll
4ba21ab526 Fix test-all-languages.sh. 2012-01-23 12:01:11 -05:00
David F. Skoll
acac7a7b31 Add shell script to test all languages. Add %* substitutions to tstlang.rem 2012-01-23 11:58:07 -05:00
David F. Skoll
2290fd09f5 Add altmode to various languages. 2012-01-23 11:49:32 -05:00
David F. Skoll
f02b6a1773 "-x" flag to git-ls-files doesn't work, apparently. 2012-01-23 11:14:00 -05:00
David F. Skoll
efffe05d42 Merge branch 'master' of ssh://source.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2012-01-20 15:49:27 -05:00
David F. Skoll
950d67c522 Update Finnish translation for altmode. 2012-01-20 15:49:03 -05:00
David F. Skoll
a1aa61f54e Fix comment. 2012-01-12 13:12:59 -05:00
David F. Skoll
3c2bd66460 Clarify wording. 2012-01-12 13:05:46 -05:00
David F. Skoll
245cebee56 If multiple -a options are supplied, then *do* trigger timed reminders
that are in the future.
2012-01-12 13:04:53 -05:00
David F. Skoll
c45364fdb3 More WIP on PHP stuff. 2012-01-12 12:48:36 -05:00
David F. Skoll
e380308604 More sunstuff tweaking. 2011-12-28 13:14:24 -05:00
David F. Skoll
bd019524dd Update test output 2011-12-28 08:50:03 -05:00
David F. Skoll
895536d7d3 Use proper value of cos(6 degrees) for dusk/dawn 2011-12-28 08:49:37 -05:00
David F. Skoll
3a0e41afd1 Round off sun times to nearest minute. 2011-12-27 12:34:17 -05:00
David F. Skoll
23dd28471e Update sunrise/sunset calculations with different formula for mean anomaly. 2011-12-27 12:20:36 -05:00
David F. Skoll
761217d403 Add dawn/sunrise/sunset/dusk tests. 2011-12-26 17:44:34 -05:00
David F. Skoll
77ed694111 Use proper formula for dusk/dawn. 2011-12-26 14:41:21 -05:00
David F. Skoll
61bcce3104 Add tests for %*x and upper-case %*X substitutions. 2011-12-25 11:43:07 -05:00
David F. Skoll
bf41b12ccd Paranoia. 2011-12-24 11:04:21 -05:00
David F. Skoll
5eabd7d8d8 Fix dumb error. :) 2011-12-24 11:02:52 -05:00
David F. Skoll
0c66f5f3af Add "alternate" substitution mode: %*X is the same as %x but it leaves
out the preposition "at" or "on".
2011-12-24 10:58:37 -05:00
David F. Skoll
3190f784d9 Update copyright year. 2011-12-16 16:00:13 -05:00
David F. Skoll
394ff55879 Bump version number. 2011-12-16 15:58:30 -05:00
David F. Skoll
9b846835bc Bump version to 03.01.11 2011-12-16 15:56:34 -05:00
David F. Skoll
01776af167 Update WHATSNEW 2011-12-16 15:51:26 -05:00
David F. Skoll
0db10424ad Make sure COLOUR works just as well as COLOR. 2011-12-16 15:47:46 -05:00
David F. Skoll
bafd7ea073 Apply Debian fixes from Kurt B. Kaiser. 2011-12-11 17:43:26 -05:00
David F. Skoll
0ab27fcb4b Fix typo. 2011-12-05 16:47:21 -05:00
David F. Skoll
95d016712e Merge branch 'master' of ssh://source.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2011-12-05 16:43:19 -05:00
David F. Skoll
fcb55001bb Allow the color special to be spelled COLOR or COLOUR. 2011-12-05 16:42:57 -05:00
David F. Skoll
7bc6961101 Apply some minor cleanup patches from Debian 2011-07-28 14:31:18 -04:00
David F. Skoll
450e88fad8 Fix typo. 2011-03-16 15:49:03 -04:00
David F. Skoll
3222b4c311 More work on PHP front/back-end. 2011-03-16 13:00:35 -04:00
David F. Skoll
1e0cc3605d Add THROUGH to vim syntax file. 2011-03-16 13:00:28 -04:00
David F. Skoll
129b7bfeb7 Fix typos. 2011-01-21 17:01:57 -05:00
David F. Skoll
388811b684 Handle MOON specials. 2011-01-21 16:59:03 -05:00
David F. Skoll
f83257407b Yet more hacking. 2011-01-21 16:20:17 -05:00
David F. Skoll
e4ced77340 Key entries by day. 2011-01-20 16:50:24 -05:00
David F. Skoll
92e0bc316a Parse out day/mon/yr 2011-01-20 16:40:11 -05:00
David F. Skoll
a4a55f35b2 Start on PHP front-end to Remind. 2011-01-20 16:35:00 -05:00
David F. Skoll
ed1150c189 Clarify sign of longitude components. 2011-01-03 09:42:15 -05:00
David F. Skoll
08080f4e86 Use 6-degree definition (Civil Dawn) instead of older 14-degree below horizon. 2010-12-16 09:00:12 -05:00
David F. Skoll
de4ebb8be6 Update WHATSNEW. 2010-10-30 17:13:17 -04:00
David F. Skoll
11e2ce5093 Document multiple tag clauses. 2010-10-29 13:09:12 -04:00
David F. Skoll
2c560e6f2b Merge branches 'master' and 'master' of ssh://vanadium.roaringpenguin.com/home/dfs/personal-git-repos/Remind 2010-10-24 14:15:01 -04:00
David F. Skoll
643f394e6a Bug fix: If there are no tags, emit a "*" when doing NOTE reminder ... 2010-10-12 15:39:08 -04:00
David F. Skoll
6d047c2856 Use a dynamic buffer to accumulate tags instead of a special-purpose data structure. 2010-09-29 14:07:14 -04:00
David F. Skoll
be86746685 Support multiple TAGs in a single REM. 2010-09-23 15:47:22 -04:00
David F. Skoll
da429b9629 Avoid leaving running processes in the background when doing "make test" 2010-09-16 12:46:06 -04:00
David F. Skoll
b21a206c26 Fix token comparisons to be case-insensitive. 2010-09-13 20:17:02 -04:00
David F. Skoll
85bde8ba3a Make PrintCentered handle multi-byte characters. 2010-09-13 10:11:28 -04:00
David F. Skoll
f84e658e6b Update remind.vim to latest. 2010-09-12 12:48:39 -04:00
David F. Skoll
8f0eba8bcd Fix corner (UTF-8 had a typo.) 2010-09-10 17:37:49 -04:00
David F. Skoll
2faaaf78a8 Add support for UTF-8 line-drawing characters. 2010-09-10 10:18:22 -04:00
David F. Skoll
7f659dace2 Add support for multibyte chars in -c output. But that breaks line-drawing. :( 2010-09-09 17:17:18 -04:00
David F. Skoll
54cdd566c7 Shrink executable on non-Apple/non-MS platforms. 2010-09-02 15:30:56 -04:00
David F. Skoll
e212df87f9 Bump version to 03.01.10. 2010-09-01 17:15:37 -04:00
David F. Skoll
4fb4db15e8 Stricter syntax check - reject extra cruft afer "OMIT DUMP" 2010-09-01 17:12:55 -04:00
David F. Skoll
9a15a25a7b Don't hard-code text box background. 2010-09-01 12:07:41 -04:00
David F. Skoll
c02cfb9b17 Add THROUGH keyword to editor syntax files. 2010-08-31 16:57:27 -04:00
David F. Skoll
3e726f21f7 Improve error message. 2010-08-31 14:02:17 -04:00
David F. Skoll
21d4faa26f Allow OMIT ... THROUGH ... to be re-parsed as a REM command. 2010-08-31 13:51:13 -04:00
David F. Skoll
1d13d0ee07 Update tests to handle OMIT ... THROUGH ... 2010-08-31 13:44:57 -04:00
David F. Skoll
329d13e480 Fix typo 2010-08-31 13:34:55 -04:00
David F. Skoll
2161c09b1d Update man page. 2010-08-31 13:33:51 -04:00
David F. Skoll
3f2e396c3c Change "omit debug" to "omit dump" 2010-08-31 12:37:10 -04:00
David F. Skoll
412e242109 Don't create any OMITs with THROUGH if there would be too many.
Bump max full omits to 500 and partial omits to 366.
2010-08-31 12:27:23 -04:00
David F. Skoll
e827516b72 Add "OMIT start THROUGH end" syntax. Also add "OMIT DEBUG"
Add syntactic sugar:

REM start THROUGH end   is converted to REM start *1 UNTIL end
2010-08-31 12:19:08 -04:00
David F. Skoll
7f953e98d7 Clarify manual: Line continuations are processed before comments. 2010-08-20 13:47:51 -04:00
David F. Skoll
821d3fe783 Conform to older C spec that prohibits declaration of variables in the middle of a block. 2010-06-21 21:32:21 -04:00
David F. Skoll
fdb4b302ac Update WHATSNEW with release date. 2010-06-20 16:38:44 -04:00
David F. Skoll
760d5d4a09 Fix trap to reset signal disposition to default. 2010-06-02 09:05:11 -04:00
David F. Skoll
d561f98c42 Fix syntax error. 2010-05-18 20:45:36 -04:00
David F. Skoll
ea74f276dc Don't rkrphgvba more than once. 2010-05-18 12:46:34 -04:00
David F. Skoll
42cf82a5d5 More Apple / Cygwin detection. 2010-05-17 09:32:50 -04:00
David F. Skoll
825a6700da Make "trap" command follow POSIX standard. 2010-05-17 06:59:41 -04:00
David F. Skoll
2f27645dac Handle SPECIAL COLOR correctly with -n commandline option. 2010-05-01 20:52:25 -04:00
David F. Skoll
1e5b44d063 Make handling of continued lines same as in 3.1.8. 2010-04-25 10:07:12 -04:00
David F. Skoll
099ad9945d Fix huge bug in handling of continued lines. 2010-04-25 10:03:13 -04:00
David F. Skoll
540ce3d946 Allow "timepart" to take a TIME or DATETIME. Allow "datepart" to take a
DATE or DATETIME.  Update docs.
2010-04-25 09:50:39 -04:00
David F. Skoll
ac2efcc993 Document timepart() and datepart(). 2010-04-25 09:40:01 -04:00
David F. Skoll
b4bb1d9e37 Update copyright date. 2010-04-25 09:34:49 -04:00
David F. Skoll
9ec8b30934 Update copyright date. 2010-04-22 11:45:19 -04:00
David F. Skoll
fb38e5b35b Update WHATSNEW. 2010-04-21 16:01:04 -04:00
David F. Skoll
5fa10e9d84 Document Purge Mode. 2010-04-21 14:55:28 -04:00
David F. Skoll
3bc1b5bd46 Clean up tests; add test for non-parseable line in purge mode. 2010-04-21 13:30:10 -04:00
David F. Skoll
b266b399ba Test for fix of parse error.
Try REALLY hard to detect constant expressions...
2010-04-21 13:23:26 -04:00
David F. Skoll
0e827a457d Fix YomHashoah date and bug in DoSatReminder. 2010-04-21 09:49:33 -04:00
David F. Skoll
d05d85b243 More tests. 2010-04-21 09:04:48 -04:00
David F. Skoll
a1faa8d804 Finish up Purge Mode:
o Make it recognize constant expressions (yay!)
o Make it not add a blank line to end of *.purged files.
o Make it nuke #!P comments in the source files.
2010-04-21 09:02:25 -04:00
David F. Skoll
70adbf90c2 Add tests for purge mode. 2010-04-20 15:20:49 -04:00
David F. Skoll
501c04f4b6 More work on purge mode. 2010-04-20 14:01:54 -04:00
David F. Skoll
d294e62be1 More work on purge mode. 2010-04-20 11:34:07 -04:00
David F. Skoll
31f90b6c53 Add purge mode. 2010-04-20 10:59:57 -04:00
David F. Skoll
184d29c592 More work on -j ("Purge Mode") option. 2010-04-19 15:57:35 -04:00
David F. Skoll
2d798bc4ec Add support for DURATION in TkRemind. Patch from Marek Marczykowski. 2010-04-19 14:13:48 -04:00
David F. Skoll
bd9a3761a6 Sort PSFILE and PS reminders with same priority (Ticket #17581) 2010-04-19 13:17:00 -04:00
David F. Skoll
b1063b0a9e More purge-mode work. 2010-04-09 11:01:45 -04:00
David F. Skoll
cb2fffab92 Don't expire lines containing expressions. 2010-04-07 15:32:20 -04:00
David F. Skoll
55cca49428 Start implementing a "-j" mode to purge old reminders. 2010-04-07 15:30:29 -04:00
David F. Skoll
5a0ab9ed8a Fix shade.rem to be independent of location and time zone of test machine. 2010-03-10 11:14:36 -05:00
David F. Skoll
1f2cfdfd84 Bump version to 03.01.09. 2010-03-09 10:05:56 -05:00
David F. Skoll
dfd688caa6 Update WHATSNEW date. 2010-03-09 09:55:00 -05:00
David F. Skoll
830e3e339c Make it only mildly annoying to compile on Windows and Mac OS X. 2010-03-06 17:39:39 -05:00
David F. Skoll
bc9f560950 Update WHATSNEW file. 2010-03-03 11:18:35 -05:00
David F. Skoll
f91b748f50 I don't like Microsoft or Apple. So the ./configure script will bail out on those platforms. 2010-03-02 19:15:40 -05:00
David F. Skoll
3adbd7468c Update "WINDOWS" file; rename it to MICROSOFT-AND-APPLE. 2010-03-02 19:06:06 -05:00
David F. Skoll
b66039ee24 Ignore msgprefix()/msgsuffix() on RUN-type reminders. 2010-02-26 09:48:18 -05:00
David F. Skoll
27371f6475 Document new $T, $U system variables. 2009-12-29 21:26:11 -05:00
David F. Skoll
19e7c34b47 Bump version to 03.01.08. 2009-12-29 10:52:06 -05:00
David F. Skoll
3375aff3a7 Add $U, $Um, $Ud, $Uy and $Uw special variables. Just like the $T.. versions,
but using today() instead of trigdate().
2009-12-29 08:47:07 -05:00
David F. Skoll
41e9cb5ca3 Clean up handling of SPECIAL_TYPE variales. Make
$T return 1990-01-01 if last trigger date was not valid.
2009-12-26 13:06:50 -05:00
David F. Skoll
6348860adf Update test for new debugging output. 2009-12-26 00:28:16 -05:00
David F. Skoll
4e9d401002 Add $T, $Td, $Tm, $Tw and $Ty system variables as shorthands for
trigdate(), day(tridate()), month(trigdate()), wkdayno(trigdate()) and
year(trigdate())
2009-12-26 00:26:14 -05:00
David F. Skoll
3db2fc7d0f Make "$t" a synonym for "trigdate()" 2009-12-22 18:25:01 -05:00
David F. Skoll
0101d76113 Better -df output. 2009-11-16 00:09:40 -05:00
David F. Skoll
6fabab6d4b Add remind-conf-mode 2009-11-03 13:32:10 -05:00
David F. Skoll
905f1b0aaf Add some scripts in contrib/ 2009-11-03 13:25:17 -05:00
David F. Skoll
6a5ab8e70c Update man page. 2009-11-01 09:54:28 -05:00
David F. Skoll
943b037589 Better iconphoto. 2009-10-30 22:08:26 -04:00
David F. Skoll
5624cd44de Set a nice iconphoto. 2009-10-30 13:52:19 -04:00
David F. Skoll
8529f8b843 Fix bugs in Makefile.in 2009-10-15 15:19:56 -04:00
David F. Skoll
08be7c43cf Don't make SHADE specials obliterate MOON specials. Fixes ticket 15068. 2009-10-05 14:33:51 -04:00
David F. Skoll
aae76207ec Fix bug in SCHED function calculation (RT #15644) 2009-09-06 18:36:34 -04:00
David F. Skoll
5434f8330e Sort specials. 2009-09-06 18:36:27 -04:00
120 changed files with 19598 additions and 6427 deletions

4
.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
.gitignore export-ignore
.gitattributes export-ignore
remind.php export-ignore
sync-to-dianne-git export-ignore

18
.gitignore vendored
View File

@@ -1,15 +1,17 @@
*.bak
*.o
*~
.gitignore
TAGS
autom4te.cache
config.log
config.status
src/Makefile
www/Makefile
*.o
src/config.h
src/remind
rem2html/Makefile
src/*.tar.gz*
tests/test.out
.gitignore
*~
src/Makefile
src/config.h
src/rem2ps
src/remind
src/version.h
tests/test.out
www/Makefile

View File

@@ -3,8 +3,8 @@ THE REMIND COPYRIGHT
1. REMIND refers to the entire set of files and documentation in the
REMIND package.
2. REMIND is Copyright 1999-2008 Roaring Penguin Software Inc.,
except where noted in individual files.
2. REMIND is Copyright 1992-2021 Dianne Skoll, except where noted in
individual files.
3. DISTRIBUTION AND USE
@@ -293,8 +293,8 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
--
David F. Skoll <dfs@roaringpenguin.com>
Dianne Skoll <dianne@skoll.ca>
https://dianne.skoll.ca/projects/remind
Tel. (613) 231-6599
http://www.roaringpenguin.com

30
MICROSOFT-AND-APPLE Normal file
View File

@@ -0,0 +1,30 @@
MICROSOFT WINDOWS
=================
I used to prohibit porting Remind to Microsoft Windows. However, this
may cause problems with the GPL, so I have removed that restriction.
Although I cannot prevent you from porting Remind to Windows, I appeal
to you not to do it. I am trying to encourage the growth of free
software, not proprietary software.
If you port Remind to Windows, I will not provide support or answers to
questions -- you're on your own. On the other hand, I will feel no guilt
in taking enhancements and merging them into the UNIX stream.
APPLE
=====
I can't prevent you from using Remind on Apple's products, but I hope
you don't. Apple's corporate culture is the very antithesis of Free
Software. Rather than using Mac OS X, I encourage you to switch to
Linux or FreeBSD, two Free Software operating systems that are every
bit as capable as Mac OS X and which are unencumbered by Apple's
arbitrary restrictions.
And if you're looking to port Remind to other Apple products like the
iPhone or iPad, please don't. Those products enforce Apple's rigorous
controls much more stringently than Mac OS X on an Apple PC.
--
Dianne Skoll

View File

@@ -8,7 +8,7 @@ all: src/Makefile
@echo "* *"
@echo "*******************"
@echo ""
@cd src; $(MAKE) all LANGDEF=$(LANGDEF)
@cd src && $(MAKE) all LANGDEF=$(LANGDEF)
install:
@echo ""
@@ -18,14 +18,15 @@ install:
@echo "* *"
@echo "*********************"
@echo ""
cd src; $(MAKE) install
@$(MAKE) -C src install
@$(MAKE) -C rem2html install
clean:
find . -name '*~' -exec rm {} \;
cd src; $(MAKE) clean
cd src && $(MAKE) clean
test:
cd src && $(MAKE) test
@cd src && $(MAKE) -s test
distclean: clean
rm -f config.cache config.log config.status src/Makefile src/config.h tests/test.out www/Makefile

4
README
View File

@@ -34,5 +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.
Contact info: mailto:dfs@roaringpenguin.com
Home page: http://www.roaringpenguin.com/remind
Contact info: mailto:dianne@skoll.ca
Home page: https://dianne.skoll.ca/projects/remind/

15
WINDOWS
View File

@@ -1,15 +0,0 @@
MICROSOFT WINDOWS
I used to prohibit porting Remind to Microsoft Windows. However, this
may cause problems with the GPL, so I have removed that restriction.
Although I cannot prevent you from porting Remind to Windows, I appeal
to you not to do it. I am trying to encourage the growth of free
software, not proprietary software.
If you port Remind to Windows, I will not provide support or answers to
questions -- you're on your own. On the other hand, I will feel no guilt
in taking enhancements and merging them into the UNIX stream.
--
David F. Skoll.

126
build.tk Executable file → Normal file
View File

@@ -7,8 +7,7 @@
# A cheesy graphical front-end for building and installing REMIND.
#
# This file is part of REMIND.
# Copyright (C) 1992-1999 David F. Skoll
# Copyright (C) 1999-2000 Roaring Penguin Software Inc.
# Copyright (C) 1992-2018 Dianne Skoll
#
#--------------------------------------------------------------
@@ -95,10 +94,6 @@ proc CreateMainDialog {} {
wm title . "Remind Configuration"
wm iconname . "Remind Config"
doLogo
destroy .c
update idletasks
SetConfigFromRemind
tabnotebook_create .tn
@@ -757,125 +752,6 @@ proc notebook_fix_size {win} {
$win configure -width $maxw -height $maxh
}
#***********************************************************************
# %PROCEDURE: drawLogo
# %ARGUMENTS:
# c -- canvas to draw logo in
# bg -- background color of canvas
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Draws Roaring Penguin logo in a Tcl canvas
#***********************************************************************
proc drawLogo { c bg } {
set logo_objs {
{polygon 558 0 557 0 556 0 554 0 551 0 550 0 549 0 547 0 546 0 544 0 542 1 539 1 537 2 535 3 534 3 533 3 532 3 530 4 528 5 525 6 523 6 522 7 521 7 519 8 516 9 514 10 512 11 510 11 509 12 507 12 507 13 506 13 505 12 502 12 500 11 498 11 497 11 496 11 495 11 493 11 491 12 489 12 488 12 488 13 487 13 485 14 483 15 482 16 481 17 480 19 478 21 477 22 476 23 476 24 475 25 474 26 473 28 472 30 470 33 467 37 464 41 462 45 459 48 457 52 456 54 455 55 454 56 454 57 453 58 452 59 452 61 451 63 449 65 448 68 447 71 445 74 443 77 442 81 440 86 438 90 436 95 435 99 434 103 433 105 433 106 432 107 432 108 432 109 431 111 431 113 430 116 429 121 428 125 427 130 425 135 425 138 424 140 424 142 424 143 424 144 424 145 423 147 423 149 423 152 422 157 421 162 421 167 420 172 420 176 419 180 419 183 419 187 419 189 419 192 418 195 418 196 418 198 418 199 417 199 416 199 415 199 414 199 413 200 412 200 411 200 411 201 410 201 410 202 409 202 409 203 408 203 407 204 407 205 408 205 410 206 413 208 416 209 418 210 419 210 419 211 420 211 421 211 422 212 424 212 426 212 429 213 432 213 435 214 439 214 442 214 444 214 445 214 446 214 447 214 449 214 452 214 457 214 461 214 464 214 466 214 467 214 468 214 469 214 470 214 472 214 474 214 477 213 482 213 486 213 490 212 494 212 497 212 500 211 502 211 505 211 507 211 508 210 509 210 510 210 510 208 511 206 512 203 513 198 514 194 515 189 516 185 517 182 517 179 518 178 518 177 518 176 518 175 519 174 519 171 520 169 520 166 521 163 522 160 522 157 523 153 524 149 524 144 525 139 526 135 526 132 526 130 526 129 526 128 526 127 527 127 527 126 527 124 527 122 527 119 527 115 527 110 527 106 527 102 527 99 527 96 527 95 527 94 527 93 527 92 527 91 527 88 527 85 526 81 526 77 525 72 524 67 524 64 523 60 522 57 521 54 521 51 520 49 520 47 519 45 519 44 518 43 520 42 521 42 523 41 524 40 525 40 526 40 527 40 528 39 530 39 532 39 533 38 534 38 536 38 538 37 539 37 540 37 541 36 543 35 544 34 545 33 546 32 545 32 543 33 542 33 541 34 540 34 539 34 537 34 536 34 534 34 532 34 531 34 530 34 529 34 527 33 525 33 524 33 523 33 522 33 520 32 518 32 517 32 515 31 514 31 514 30 516 29 517 27 519 25 520 24 521 23 521 22 522 22 523 21 524 20 526 19 528 17 530 15 533 14 534 13 535 12 536 12 537 11 538 10 541 9 543 7 545 6 546 6 546 5 547 5 549 4 551 3 553 2 555 1 556 0 557 0 -outline {} -fill \#000000 -width 0}
{line 558 0 557 0 556 0 554 0 551 0 550 0 549 0 547 0 546 0 544 0 542 1 539 1 537 2 535 3 534 3 533 3 532 3 530 4 528 5 525 6 523 6 522 7 521 7 519 8 516 9 514 10 512 11 510 11 509 12 507 12 507 13 506 13 505 12 502 12 500 11 498 11 497 11 496 11 495 11 493 11 491 12 489 12 488 12 488 13 487 13 485 14 483 15 482 16 481 17 480 19 478 21 477 22 476 23 476 24 475 25 474 26 473 28 472 30 470 33 467 37 464 41 462 45 459 48 457 52 456 54 455 55 454 56 454 57 453 58 452 59 452 61 451 63 449 65 448 68 447 71 445 74 443 77 442 81 440 86 438 90 436 95 435 99 434 103 433 105 433 106 432 107 432 108 432 109 431 111 431 113 430 116 429 121 428 125 427 130 425 135 425 138 424 140 424 142 424 143 424 144 424 145 423 147 423 149 423 152 422 157 421 162 421 167 420 172 420 176 419 180 419 183 419 187 419 189 419 192 418 195 418 196 418 198 418 199 417 199 416 199 415 199 414 199 413 200 412 200 411 200 411 201 410 201 410 202 409 202 409 203 408 203 407 204 407 205 408 205 410 206 413 208 416 209 418 210 419 210 419 211 420 211 421 211 422 212 424 212 426 212 429 213 432 213 435 214 439 214 442 214 444 214 445 214 446 214 447 214 449 214 452 214 457 214 461 214 464 214 466 214 467 214 468 214 469 214 470 214 472 214 474 214 477 213 482 213 486 213 490 212 494 212 497 212 500 211 502 211 505 211 507 211 508 210 509 210 510 210 510 208 511 206 512 203 513 198 514 194 515 189 516 185 517 182 517 179 518 178 518 177 518 176 518 175 519 174 519 171 520 169 520 166 521 163 522 160 522 157 523 153 524 149 524 144 525 139 526 135 526 132 526 130 526 129 526 128 526 127 527 127 527 126 527 124 527 122 527 119 527 115 527 110 527 106 527 102 527 99 527 96 527 95 527 94 527 93 527 92 527 91 527 88 527 85 526 81 526 77 525 72 524 67 524 64 523 60 522 57 521 54 521 51 520 49 520 47 519 45 519 44 518 43 520 42 521 42 523 41 524 40 525 40 526 40 527 40 528 39 530 39 532 39 533 38 534 38 536 38 538 37 539 37 540 37 541 36 543 35 544 34 545 33 546 32 545 32 543 33 542 33 541 34 540 34 539 34 537 34 536 34 534 34 532 34 531 34 530 34 529 34 527 33 525 33 524 33 523 33 522 33 520 32 518 32 517 32 515 31 514 31 514 30 516 29 517 27 519 25 520 24 521 23 521 22 522 22 523 21 524 20 526 19 528 17 530 15 533 14 534 13 535 12 536 12 537 11 538 10 541 9 543 7 545 6 546 6 546 5 547 5 549 4 551 3 553 2 555 1 556 0 557 0 558 0 -joinstyle bevel}
{polygon 490 94 490 95 490 96 489 99 489 103 489 106 488 109 488 111 488 112 488 113 488 115 487 117 487 119 487 121 486 123 485 126 485 130 484 133 483 136 483 137 483 138 483 139 482 139 482 140 482 141 481 144 480 147 479 150 478 153 477 154 477 155 477 156 476 157 476 159 475 161 473 164 472 167 471 170 470 172 468 175 467 176 467 178 466 179 466 180 465 180 465 179 464 177 463 174 462 171 461 169 461 168 461 167 460 166 460 165 460 163 459 161 458 158 458 155 457 152 457 151 457 150 457 149 457 148 456 146 456 143 456 141 456 139 456 138 456 137 456 136 456 134 456 132 456 129 457 126 457 124 457 123 457 121 458 121 458 120 458 121 458 123 458 125 458 127 457 129 457 130 457 131 457 132 458 134 458 136 458 139 458 141 458 143 458 144 459 145 459 148 460 150 460 151 460 152 460 153 461 154 461 155 462 158 462 160 463 162 464 164 464 166 465 167 465 168 465 169 466 169 466 168 467 166 468 163 470 160 470 158 471 157 471 156 472 155 472 154 473 152 474 150 475 147 476 144 477 141 478 139 478 138 479 137 479 136 480 134 480 132 481 129 482 126 483 124 483 122 483 121 484 121 484 120 484 118 485 116 486 112 487 109 487 106 488 103 488 101 489 99 489 97 490 95 490 94 -outline {} -fill $bg -width 0}
{line 490 94 490 95 490 96 489 99 489 103 489 106 488 109 488 111 488 112 488 113 488 115 487 117 487 119 487 121 486 123 485 126 485 130 484 133 483 136 483 137 483 138 483 139 482 139 482 140 482 141 481 144 480 147 479 150 478 153 477 154 477 155 477 156 476 157 476 159 475 161 473 164 472 167 471 170 470 172 468 175 467 176 467 178 466 179 466 180 465 180 465 179 464 177 463 174 462 171 461 169 461 168 461 167 460 166 460 165 460 163 459 161 458 158 458 155 457 152 457 151 457 150 457 149 457 148 456 146 456 143 456 141 456 139 456 138 456 137 456 136 456 134 456 132 456 129 457 126 457 124 457 123 457 121 458 121 458 120 458 121 458 123 458 125 458 127 457 129 457 130 457 131 457 132 458 134 458 136 458 139 458 141 458 143 458 144 459 145 459 148 460 150 460 151 460 152 460 153 461 154 461 155 462 158 462 160 463 162 464 164 464 166 465 167 465 168 465 169 466 169 466 168 467 166 468 163 470 160 470 158 471 157 471 156 472 155 472 154 473 152 474 150 475 147 476 144 477 141 478 139 478 138 479 137 479 136 480 134 480 132 481 129 482 126 483 124 483 122 483 121 484 121 484 120 484 118 485 116 486 112 487 109 487 106 488 103 488 101 489 99 489 97 490 95 490 94 -joinstyle bevel}
{polygon 503 22 503 23 504 23 504 24 505 24 505 25 505 26 505 27 505 28 505 29 504 29 504 30 503 30 502 30 502 31 501 31 501 30 500 30 499 30 499 29 499 28 499 27 499 26 499 25 499 24 500 24 500 23 501 23 502 22 503 22 -outline {} -fill $bg -width 0}
{line 503 22 503 23 504 23 504 24 505 24 505 25 505 26 505 27 505 28 505 29 504 29 504 30 503 30 502 30 502 31 501 31 501 30 500 30 499 30 499 29 499 28 499 27 499 26 499 25 499 24 500 24 500 23 501 23 502 22 503 22 -joinstyle bevel}
{polygon 517 44 516 45 515 46 513 47 513 48 512 48 511 48 510 49 508 49 506 50 505 50 504 50 503 50 501 50 498 50 497 51 496 51 495 50 492 50 490 50 487 50 486 49 484 49 483 49 482 48 481 48 481 49 480 51 479 53 479 54 478 55 478 56 477 58 477 59 477 61 477 62 477 63 477 65 477 67 476 68 476 69 477 71 477 72 477 74 477 75 477 76 478 76 479 77 481 77 484 78 485 79 486 79 487 79 488 80 490 81 491 82 493 83 494 84 495 85 496 87 498 88 498 89 499 90 500 92 500 94 500 96 501 98 501 99 501 100 501 101 500 102 500 103 500 104 500 105 499 106 499 107 498 108 498 109 498 110 497 111 497 112 497 113 497 114 497 115 498 115 498 116 499 117 499 118 500 118 500 119 501 120 502 121 502 122 503 122 503 123 502 125 502 128 501 132 501 136 500 139 500 141 500 142 499 143 499 144 499 146 498 148 497 151 496 153 495 156 494 160 493 163 492 165 491 167 491 168 491 169 490 169 490 171 489 174 487 177 486 180 485 182 484 184 484 185 483 185 483 186 482 188 481 190 479 193 478 197 477 199 476 202 475 204 474 206 473 208 472 209 472 210 474 210 476 209 479 209 483 209 488 208 492 207 496 207 499 206 502 206 503 206 504 205 504 204 505 201 506 198 507 193 509 188 510 183 512 179 513 176 514 173 514 172 514 171 514 170 515 169 515 167 516 165 516 162 517 160 518 157 518 154 519 150 520 146 521 142 521 137 522 133 523 129 523 126 523 124 523 122 524 122 524 121 524 120 524 118 524 116 524 113 524 109 524 105 525 101 525 97 525 94 525 92 525 91 525 90 525 89 525 88 525 87 524 85 524 82 524 78 523 74 523 70 522 66 522 62 521 59 521 56 520 54 519 51 519 49 518 47 518 46 518 45 518 44 -outline {} -fill $bg -width 0}
{line 517 44 516 45 515 46 513 47 513 48 512 48 511 48 510 49 508 49 506 50 505 50 504 50 503 50 501 50 498 50 497 51 496 51 495 50 492 50 490 50 487 50 486 49 484 49 483 49 482 48 481 48 481 49 480 51 479 53 479 54 478 55 478 56 477 58 477 59 477 61 477 62 477 63 477 65 477 67 476 68 476 69 477 71 477 72 477 74 477 75 477 76 478 76 479 77 481 77 484 78 485 79 486 79 487 79 488 80 490 81 491 82 493 83 494 84 495 85 496 87 498 88 498 89 499 90 500 92 500 94 500 96 501 98 501 99 501 100 501 101 500 102 500 103 500 104 500 105 499 106 499 107 498 108 498 109 498 110 497 111 497 112 497 113 497 114 497 115 498 115 498 116 499 117 499 118 500 118 500 119 501 120 502 121 502 122 503 122 503 123 502 125 502 128 501 132 501 136 500 139 500 141 500 142 499 143 499 144 499 146 498 148 497 151 496 153 495 156 494 160 493 163 492 165 491 167 491 168 491 169 490 169 490 171 489 174 487 177 486 180 485 182 484 184 484 185 483 185 483 186 482 188 481 190 479 193 478 197 477 199 476 202 475 204 474 206 473 208 472 209 472 210 474 210 476 209 479 209 483 209 488 208 492 207 496 207 499 206 502 206 503 206 504 205 504 204 505 201 506 198 507 193 509 188 510 183 512 179 513 176 514 173 514 172 514 171 514 170 515 169 515 167 516 165 516 162 517 160 518 157 518 154 519 150 520 146 521 142 521 137 522 133 523 129 523 126 523 124 523 122 524 122 524 121 524 120 524 118 524 116 524 113 524 109 524 105 525 101 525 97 525 94 525 92 525 91 525 90 525 89 525 88 525 87 524 85 524 82 524 78 523 74 523 70 522 66 522 62 521 59 521 56 520 54 519 51 519 49 518 47 518 46 518 45 518 44 517 44 -joinstyle bevel}
{polygon 11 126 12 126 13 126 16 126 19 126 23 126 27 126 32 126 36 126 39 126 41 126 43 126 45 126 47 126 50 127 51 127 52 127 53 128 54 128 56 129 57 130 58 132 59 132 59 133 60 134 61 135 61 137 62 138 62 139 62 140 62 142 62 144 62 145 62 147 62 148 62 149 62 150 61 152 61 154 61 155 61 156 60 157 60 158 59 159 58 161 57 162 57 163 56 164 55 165 54 166 53 167 51 168 49 169 48 169 47 170 46 170 47 171 49 171 51 172 52 172 53 173 54 174 55 175 56 177 56 178 57 180 57 181 57 182 57 183 57 184 57 185 57 187 57 189 57 190 57 191 56 192 56 194 56 196 56 199 56 200 56 201 56 202 55 203 55 205 55 206 55 207 55 208 55 209 56 209 56 210 56 211 57 212 58 212 58 213 57 213 56 213 55 213 51 213 47 213 43 213 40 213 38 213 37 213 37 212 37 211 36 210 36 209 36 208 36 207 36 206 36 205 37 204 37 203 37 202 37 201 37 199 37 198 37 197 37 196 37 195 37 194 38 192 38 189 38 188 38 187 38 186 38 185 38 184 38 182 37 181 37 180 37 179 36 179 36 178 35 178 34 177 33 177 32 177 31 177 30 177 28 177 26 177 24 177 24 178 24 179 24 182 23 186 23 190 22 195 22 200 21 205 21 208 20 211 20 213 19 213 17 213 14 213 10 213 7 213 4 213 2 213 1 213 1 212 1 211 2 208 2 205 2 201 3 196 4 190 4 184 5 177 6 169 7 162 8 155 9 149 9 143 10 138 10 134 11 131 11 129 11 127 11 126 -outline {} -fill \#000000 -width 0}
{polygon 26 163 27 163 29 163 31 163 32 163 33 162 35 162 36 162 37 161 38 161 39 160 40 159 40 158 41 157 42 156 42 154 43 153 43 152 43 151 43 150 43 149 43 148 43 147 43 146 42 145 42 144 42 143 41 143 41 142 40 142 40 141 39 141 38 141 37 141 36 140 35 140 34 140 33 140 31 140 30 140 29 140 28 141 28 142 28 145 28 148 27 151 27 155 26 158 26 161 26 162 26 163 -outline {} -fill \#000000 -width 0}
{line 11 126 12 126 13 126 16 126 19 126 23 126 27 126 32 126 36 126 39 126 41 126 43 126 45 126 47 126 50 127 51 127 52 127 53 128 54 128 56 129 57 130 58 132 59 132 59 133 60 134 61 135 61 137 62 138 62 139 62 140 62 142 62 144 62 145 62 147 62 148 62 149 62 150 61 152 61 154 61 155 61 156 60 157 60 158 59 159 58 161 57 162 57 163 56 164 55 165 54 166 53 167 51 168 49 169 48 169 47 170 46 170 47 171 49 171 51 172 52 172 53 173 54 174 55 175 56 177 56 178 57 180 57 181 57 182 57 183 57 184 57 185 57 187 57 189 57 190 57 191 56 192 56 194 56 196 56 199 56 200 56 201 56 202 55 203 55 205 55 206 55 207 55 208 55 209 56 209 56 210 56 211 57 212 58 212 58 213 57 213 56 213 55 213 51 213 47 213 43 213 40 213 38 213 37 213 37 212 37 211 36 210 36 209 36 208 36 207 36 206 36 205 37 204 37 203 37 202 37 201 37 199 37 198 37 197 37 196 37 195 37 194 38 192 38 189 38 188 38 187 38 186 38 185 38 184 38 182 37 181 37 180 37 179 36 179 36 178 35 178 34 177 33 177 32 177 31 177 30 177 28 177 26 177 24 177 24 178 24 179 24 182 23 186 23 190 22 195 22 200 21 205 21 208 20 211 20 213 19 213 17 213 14 213 10 213 7 213 4 213 2 213 1 213 1 212 1 211 2 208 2 205 2 201 3 196 4 190 4 184 5 177 6 169 7 162 8 155 9 149 9 143 10 138 10 134 11 131 11 129 11 127 11 126 -joinstyle bevel}
{polygon 26 163 27 163 29 163 31 163 32 163 33 162 35 162 36 162 37 161 38 161 39 160 40 159 40 158 41 157 42 156 42 154 43 153 43 152 43 151 43 150 43 149 43 148 43 147 43 146 42 145 42 144 42 143 41 143 41 142 40 142 40 141 39 141 38 141 37 141 36 140 35 140 34 140 33 140 31 140 30 140 29 140 28 141 28 142 28 145 28 148 27 151 27 155 26 158 26 161 26 162 26 163 -outline {} -fill $bg -width 0}
{polygon 90 215 89 215 86 214 84 214 81 213 79 213 78 213 77 213 77 212 75 212 74 211 72 209 70 207 69 205 68 204 68 203 68 202 67 202 67 200 66 198 66 195 66 193 66 192 66 191 66 190 66 188 66 185 66 182 66 180 66 177 66 175 66 174 67 172 67 171 67 170 67 169 67 167 68 165 68 162 68 159 69 156 69 155 69 154 70 152 70 151 70 149 71 147 72 144 73 142 74 139 75 138 75 137 76 136 76 135 77 134 79 132 81 130 82 129 83 129 83 128 84 128 85 127 88 126 91 125 93 125 95 124 97 124 99 124 100 124 101 124 102 124 104 125 107 125 110 126 112 126 113 126 114 127 115 127 116 128 117 129 118 130 120 131 121 133 122 135 123 136 123 137 123 138 123 139 124 141 124 143 125 146 125 148 125 149 125 150 125 152 125 156 125 159 124 162 124 164 124 166 124 168 124 169 123 169 123 170 123 171 123 173 122 177 122 180 122 182 121 183 121 184 121 185 121 187 120 189 120 191 119 193 118 196 117 199 116 200 116 201 116 202 115 203 114 204 112 206 111 208 109 209 109 210 108 210 107 211 106 211 103 213 100 213 98 214 96 214 94 215 92 215 91 215 90 215 -outline {} -fill \#000000 -width 0}
{polygon 91 201 92 201 94 200 95 200 96 200 96 199 97 198 98 197 99 196 99 195 100 194 100 193 100 191 101 189 101 188 101 187 102 185 102 182 103 179 103 177 103 175 103 173 104 171 104 170 104 169 104 168 104 166 104 163 105 160 105 158 105 157 105 156 105 154 105 153 106 150 106 148 105 146 105 145 105 144 105 143 105 142 104 141 104 140 103 139 101 138 100 138 99 138 98 138 96 138 95 139 94 139 94 140 93 141 92 142 91 143 91 144 91 145 91 146 90 148 89 150 89 151 89 152 89 154 88 157 88 160 87 162 87 164 87 166 87 168 86 169 86 170 86 171 86 173 86 176 85 179 85 181 85 182 85 183 85 185 85 186 85 189 85 191 85 193 85 194 85 195 85 196 86 197 86 198 86 199 87 199 88 200 89 201 90 201 91 201 -outline {} -fill $bg -width 0}
{line 90 215 89 215 86 214 84 214 81 213 79 213 78 213 77 213 77 212 75 212 74 211 72 209 70 207 69 205 68 204 68 203 68 202 67 202 67 200 66 198 66 195 66 193 66 192 66 191 66 190 66 188 66 185 66 182 66 180 66 177 66 175 66 174 67 172 67 171 67 170 67 169 67 167 68 165 68 162 68 159 69 156 69 155 69 154 70 152 70 151 70 149 71 147 72 144 73 142 74 139 75 138 75 137 76 136 76 135 77 134 79 132 81 130 82 129 83 129 83 128 84 128 85 127 88 126 91 125 93 125 95 124 97 124 99 124 100 124 101 124 102 124 104 125 107 125 110 126 112 126 113 126 114 127 115 127 116 128 117 129 118 130 120 131 121 133 122 135 123 136 123 137 123 138 123 139 124 141 124 143 125 146 125 148 125 149 125 150 125 152 125 156 125 159 124 162 124 164 124 166 124 168 124 169 123 169 123 170 123 171 123 173 122 177 122 180 122 182 121 183 121 184 121 185 121 187 120 189 120 191 119 193 118 196 117 199 116 200 116 201 116 202 115 203 114 204 112 206 111 208 109 209 109 210 108 210 107 211 106 211 103 213 100 213 98 214 96 214 94 215 92 215 91 215 90 215 -joinstyle bevel}
{polygon 149 126 173 126 182 213 163 213 162 197 142 197 138 213 118 213 -outline {} -fill \#000000 -width 0}
{polygon 158 142 147 181 161 181 -outline {} -fill \#000000 -width 0}
{line 149 126 173 126 182 213 163 213 162 197 142 197 138 213 118 213 149 126}
{polygon 158 142 147 181 161 181 -outline {} -fill $bg -width 0}
{polygon 196 126 197 126 198 126 201 126 204 126 208 126 212 126 217 126 221 126 224 126 226 126 228 126 230 126 232 126 235 127 236 127 237 127 238 128 239 128 241 129 242 130 244 132 244 133 245 133 245 134 246 135 246 137 247 138 247 139 247 140 247 142 247 144 247 145 247 147 247 148 247 149 247 150 246 152 246 154 246 155 246 156 245 157 245 158 244 159 244 161 242 162 242 163 241 164 240 165 239 166 238 167 236 168 235 169 233 169 232 169 232 170 231 170 232 171 234 171 236 172 237 172 238 172 238 173 239 174 240 175 241 177 241 178 242 180 242 181 242 182 242 183 242 184 242 185 242 187 242 189 242 190 242 191 241 192 241 194 241 196 241 199 241 200 241 201 241 202 241 203 240 205 240 206 240 207 240 208 241 208 241 209 241 210 241 211 242 212 243 212 243 213 242 213 240 213 236 213 232 213 228 213 225 213 223 213 222 213 222 212 222 211 221 210 221 209 221 208 221 207 221 206 221 205 221 204 221 203 221 202 222 201 222 199 222 198 222 197 222 196 222 195 222 194 223 192 223 189 223 188 223 187 223 186 223 185 223 184 223 182 222 181 222 180 222 179 221 178 220 178 218 177 217 177 216 177 215 177 213 177 211 177 209 177 209 178 209 179 209 182 208 186 208 190 207 195 206 200 206 205 206 208 205 211 205 213 204 213 202 213 199 213 196 213 192 213 189 213 187 213 186 213 186 212 186 211 187 208 187 205 188 201 188 196 189 190 190 184 190 177 191 169 192 162 193 155 194 149 194 143 195 138 196 134 196 131 196 129 196 127 196 126 -outline {} -fill \#000000 -width 0}
{polygon 211 163 212 163 214 163 216 163 217 163 218 162 220 162 221 162 222 161 223 161 224 160 225 159 225 158 226 157 227 157 227 156 227 154 228 153 228 152 228 151 228 150 228 149 228 148 228 147 228 146 227 145 227 144 227 143 226 142 225 142 225 141 224 141 223 141 222 141 221 140 220 140 219 140 218 140 217 140 215 140 214 140 214 141 213 142 213 145 213 148 212 151 212 155 212 158 211 161 211 162 211 163 -outline {} -fill \#000000 -width 0}
{line 196 126 197 126 198 126 201 126 204 126 208 126 212 126 217 126 221 126 224 126 226 126 228 126 230 126 232 126 235 127 236 127 237 127 238 128 239 128 241 129 242 130 244 132 244 133 245 133 245 134 246 135 246 137 247 138 247 139 247 140 247 142 247 144 247 145 247 147 247 148 247 149 247 150 246 152 246 154 246 155 246 156 245 157 245 158 244 159 244 161 242 162 242 163 241 164 240 165 239 166 238 167 236 168 235 169 233 169 232 169 232 170 231 170 232 171 234 171 236 172 237 172 238 172 238 173 239 174 240 175 241 177 241 178 242 180 242 181 242 182 242 183 242 184 242 185 242 187 242 189 242 190 242 191 241 192 241 194 241 196 241 199 241 200 241 201 241 202 241 203 240 205 240 206 240 207 240 208 241 208 241 209 241 210 241 211 242 212 243 212 243 213 242 213 240 213 236 213 232 213 228 213 225 213 223 213 222 213 222 212 222 211 221 210 221 209 221 208 221 207 221 206 221 205 221 204 221 203 221 202 222 201 222 199 222 198 222 197 222 196 222 195 222 194 223 192 223 189 223 188 223 187 223 186 223 185 223 184 223 182 222 181 222 180 222 179 221 178 220 178 218 177 217 177 216 177 215 177 213 177 211 177 209 177 209 178 209 179 209 182 208 186 208 190 207 195 206 200 206 205 206 208 205 211 205 213 204 213 202 213 199 213 196 213 192 213 189 213 187 213 186 213 186 212 186 211 187 208 187 205 188 201 188 196 189 190 190 184 190 177 191 169 192 162 193 155 194 149 194 143 195 138 196 134 196 131 196 129 196 127 196 126 -joinstyle bevel}
{polygon 211 163 212 163 214 163 216 163 217 163 218 162 220 162 221 162 222 161 223 161 224 160 225 159 225 158 226 157 227 157 227 156 227 154 228 153 228 152 228 151 228 150 228 149 228 148 228 147 228 146 227 145 227 144 227 143 226 142 225 142 225 141 224 141 223 141 222 141 221 140 220 140 219 140 218 140 217 140 215 140 214 140 214 141 213 142 213 145 213 148 212 151 212 155 212 158 211 161 211 162 211 163 -outline {} -fill $bg -width 0}
{polygon 259 126 278 126 268 213 249 213 -outline {} -fill \#000000 -width 0}
{line 259 126 278 126 268 213 249 213 259 126}
{polygon 288 126 310 126 319 183 326 126 343 126 333 213 311 213 302 153 295 213 278 213 -outline {} -fill \#000000 -width 0}
{line 288 126 310 126 319 183 326 126 343 126 333 213 311 213 302 153 295 213 278 213 288 126}
{polygon 383 152 384 151 384 150 384 149 384 148 384 147 384 146 384 145 384 144 383 143 383 142 383 141 382 140 382 139 381 139 380 138 379 138 378 138 377 138 376 138 375 139 374 139 373 139 373 140 372 141 371 142 370 144 370 145 369 145 369 146 368 148 368 151 368 152 368 153 367 154 367 157 366 160 366 162 366 164 366 166 365 168 365 169 365 170 365 171 365 173 365 176 364 179 364 181 364 182 364 183 364 185 364 186 364 189 364 191 364 193 364 194 364 195 364 196 364 197 365 198 365 199 366 199 366 200 368 201 369 201 370 201 371 201 373 201 373 200 374 200 375 200 375 199 376 198 377 197 377 196 378 196 378 195 379 193 379 192 379 191 380 189 380 187 380 186 381 185 381 184 381 183 381 182 381 181 381 180 380 180 377 180 374 180 373 180 372 180 373 179 373 176 373 173 374 170 374 168 374 166 375 166 376 166 379 166 383 166 387 166 392 166 395 166 398 166 400 166 401 166 401 167 400 168 400 171 400 174 399 179 398 184 398 190 397 196 397 201 396 205 395 209 395 211 395 213 394 213 392 213 389 213 385 213 383 213 382 213 382 212 382 209 382 207 383 205 382 205 381 206 380 208 380 209 379 209 378 210 377 211 376 212 375 213 374 213 372 214 371 214 370 214 368 215 367 215 365 215 364 215 363 215 361 214 359 214 356 213 355 213 354 213 353 213 352 212 351 211 349 209 348 207 346 205 346 204 346 203 345 201 345 198 344 196 344 194 344 193 344 192 344 190 344 186 344 184 344 181 345 179 345 177 345 175 345 174 345 172 345 171 346 171 346 169 346 166 347 163 347 160 347 158 347 156 348 156 348 155 348 153 348 152 349 150 349 148 350 145 351 142 352 140 353 138 353 137 354 137 354 136 355 134 357 132 359 131 360 130 361 129 362 128 364 127 366 126 369 125 371 125 374 124 376 124 378 124 379 124 380 124 381 124 383 125 386 125 388 125 390 126 391 126 392 126 392 127 394 127 395 128 397 129 398 131 400 133 400 134 400 135 401 136 401 138 402 140 402 141 402 142 402 143 402 146 402 148 402 150 402 151 402 152 401 152 399 152 396 152 393 152 389 152 386 152 384 152 -outline {} -fill \#000000 -width 0}
{line 383 152 384 151 384 150 384 149 384 148 384 147 384 146 384 145 384 144 383 143 383 142 383 141 382 140 382 139 381 139 380 138 379 138 378 138 377 138 376 138 375 139 374 139 373 139 373 140 372 141 371 142 370 144 370 145 369 145 369 146 368 148 368 151 368 152 368 153 367 154 367 157 366 160 366 162 366 164 366 166 365 168 365 169 365 170 365 171 365 173 365 176 364 179 364 181 364 182 364 183 364 185 364 186 364 189 364 191 364 193 364 194 364 195 364 196 364 197 365 198 365 199 366 199 366 200 368 201 369 201 370 201 371 201 373 201 373 200 374 200 375 200 375 199 376 198 377 197 377 196 378 196 378 195 379 193 379 192 379 191 380 189 380 187 380 186 381 185 381 184 381 183 381 182 381 181 381 180 380 180 377 180 374 180 373 180 372 180 373 179 373 176 373 173 374 170 374 168 374 166 375 166 376 166 379 166 383 166 387 166 392 166 395 166 398 166 400 166 401 166 401 167 400 168 400 171 400 174 399 179 398 184 398 190 397 196 397 201 396 205 395 209 395 211 395 213 394 213 392 213 389 213 385 213 383 213 382 213 382 212 382 209 382 207 383 205 382 205 381 206 380 208 380 209 379 209 378 210 377 211 376 212 375 213 374 213 372 214 371 214 370 214 368 215 367 215 365 215 364 215 363 215 361 214 359 214 356 213 355 213 354 213 353 213 352 212 351 211 349 209 348 207 346 205 346 204 346 203 345 201 345 198 344 196 344 194 344 193 344 192 344 190 344 186 344 184 344 181 345 179 345 177 345 175 345 174 345 172 345 171 346 171 346 169 346 166 347 163 347 160 347 158 347 156 348 156 348 155 348 153 348 152 349 150 349 148 350 145 351 142 352 140 353 138 353 137 354 137 354 136 355 134 357 132 359 131 360 130 361 129 362 128 364 127 366 126 369 125 371 125 374 124 376 124 378 124 379 124 380 124 381 124 383 125 386 125 388 125 390 126 391 126 392 126 392 127 394 127 395 128 397 129 398 131 400 133 400 134 400 135 401 136 401 138 402 140 402 141 402 142 402 143 402 146 402 148 402 150 402 151 402 152 401 152 399 152 396 152 393 152 389 152 386 152 384 152 383 152 -joinstyle bevel}
{polygon 118 229 119 229 121 229 124 229 128 229 133 229 137 229 142 229 145 229 146 229 147 229 148 229 150 229 152 230 155 230 156 230 157 231 158 231 159 231 160 232 162 233 163 235 165 236 165 237 166 237 166 238 166 239 167 241 167 243 168 243 168 244 168 245 168 247 168 249 168 251 168 252 168 253 168 254 167 255 167 258 166 261 166 262 166 263 165 264 165 265 164 267 162 269 161 271 160 272 159 273 157 274 155 275 154 276 153 276 153 277 152 277 149 278 147 278 145 279 143 279 142 279 140 279 139 279 137 279 135 279 132 279 131 279 130 280 130 281 130 283 130 286 129 291 128 295 128 300 127 304 127 307 127 309 127 310 127 311 126 311 124 311 121 311 117 311 113 311 110 311 109 311 108 311 108 310 108 308 108 305 109 301 109 297 110 291 111 284 112 277 113 270 114 263 115 255 115 249 116 243 117 238 117 235 118 232 118 230 118 229 -outline {} -fill \#1892ff -width 0}
{polygon 132 265 133 265 134 265 136 265 137 265 138 265 139 265 140 264 141 264 142 264 143 264 143 263 144 263 145 262 146 262 146 261 146 260 147 259 148 258 148 256 148 255 148 254 148 253 148 252 148 251 148 250 148 249 148 248 147 247 147 246 146 245 145 244 144 244 143 243 142 243 141 243 140 243 138 243 137 243 135 243 135 244 135 245 134 247 134 250 134 254 133 257 133 261 133 263 133 264 132 265 -outline {} -fill \#1892ff -width 0}
{line 118 229 119 229 121 229 124 229 128 229 133 229 137 229 142 229 145 229 146 229 147 229 148 229 150 229 152 230 155 230 156 230 157 231 158 231 159 231 160 232 162 233 163 235 165 236 165 237 166 237 166 238 166 239 167 241 167 243 168 243 168 244 168 245 168 247 168 249 168 251 168 252 168 253 168 254 167 255 167 258 166 261 166 262 166 263 165 264 165 265 164 267 162 269 161 271 160 272 159 273 157 274 155 275 154 276 153 276 153 277 152 277 149 278 147 278 145 279 143 279 142 279 140 279 139 279 137 279 135 279 132 279 131 279 130 280 130 281 130 283 130 286 129 291 128 295 128 300 127 304 127 307 127 309 127 310 127 311 126 311 124 311 121 311 117 311 113 311 110 311 109 311 108 311 108 310 108 308 108 305 109 301 109 297 110 291 111 284 112 277 113 270 114 263 115 255 115 249 116 243 117 238 117 235 118 232 118 230 118 229 -joinstyle bevel -fill \#1892ff}
{polygon 176 229 223 229 221 244 193 244 191 261 217 261 215 277 189 277 187 295 215 295 214 311 166 311 -outline {} -fill \#1892ff -width 0}
{line 176 229 223 229 221 244 193 244 191 261 217 261 215 277 189 277 187 295 215 295 214 311 166 311 176 229 -fill \#1892ff}
{polygon 232 229 254 229 263 282 270 229 288 229 277 311 256 311 246 254 239 311 222 311 -outline {} -fill \#1892ff -width 0}
{line 232 229 254 229 263 282 270 229 288 229 277 311 256 311 246 254 239 311 222 311 232 229 -fill \#1892ff}
{polygon 328 254 328 253 328 251 328 250 328 249 328 248 328 247 328 246 328 245 328 244 327 243 327 242 326 242 325 241 324 241 323 240 322 240 321 240 319 241 318 241 317 242 316 243 315 244 314 246 314 247 314 248 313 250 312 252 312 253 312 254 312 256 311 259 311 261 311 263 310 265 310 267 310 268 310 270 310 271 309 273 309 276 309 279 308 281 308 282 308 283 308 284 308 286 308 288 308 290 308 292 308 293 308 294 309 296 309 297 310 298 311 299 312 300 313 300 314 300 315 300 316 300 317 299 318 299 319 299 319 298 320 298 321 297 322 296 322 295 323 293 323 292 324 291 324 289 325 287 325 285 325 284 325 283 325 282 326 282 326 281 326 280 325 280 324 280 321 280 319 280 317 280 317 279 317 276 318 273 318 270 318 268 319 267 321 267 324 267 327 267 332 267 336 267 340 267 343 267 344 267 345 267 345 268 345 269 344 271 344 274 343 279 343 284 342 289 341 294 341 300 340 304 340 307 340 309 339 310 339 311 338 311 336 311 333 311 330 311 328 311 327 311 326 311 327 310 327 307 327 305 327 304 327 303 326 304 325 306 324 307 324 308 323 308 322 309 321 310 320 311 319 311 318 311 317 312 316 312 315 312 314 312 313 312 311 313 310 313 309 313 308 313 307 313 306 312 303 312 301 311 299 311 298 311 298 310 296 310 295 309 294 308 292 306 291 304 290 302 290 301 290 300 289 297 289 295 289 293 289 292 289 291 289 289 289 286 289 283 289 280 289 278 289 275 290 274 290 273 290 272 290 271 290 270 291 267 291 264 291 261 292 259 292 258 292 257 292 256 292 255 293 253 293 252 294 249 295 247 296 244 297 242 298 240 298 239 299 238 300 237 301 235 303 234 304 232 305 232 306 231 308 230 311 229 313 228 316 228 318 227 320 227 322 227 323 227 324 227 325 227 327 228 330 228 333 229 335 229 336 229 337 229 338 230 340 231 341 232 343 234 344 236 345 237 345 238 346 240 346 242 347 244 347 246 347 247 347 250 347 251 346 252 346 253 346 254 345 254 343 254 341 254 337 254 334 254 331 254 329 254 328 254 -outline {} -fill \#1892ff -width 0}
{line 328 254 328 253 328 251 328 250 328 249 328 248 328 247 328 246 328 245 328 244 327 243 327 242 326 242 325 241 324 241 323 240 322 240 321 240 319 241 318 241 317 242 316 243 315 244 314 246 314 247 314 248 313 250 312 252 312 253 312 254 312 256 311 259 311 261 311 263 310 265 310 267 310 268 310 270 310 271 309 273 309 276 309 279 308 281 308 282 308 283 308 284 308 286 308 288 308 290 308 292 308 293 308 294 309 296 309 297 310 298 311 299 312 300 313 300 314 300 315 300 316 300 317 299 318 299 319 299 319 298 320 298 321 297 322 296 322 295 323 293 323 292 324 291 324 289 325 287 325 285 325 284 325 283 325 282 326 282 326 281 326 280 325 280 324 280 321 280 319 280 317 280 317 279 317 276 318 273 318 270 318 268 319 267 321 267 324 267 327 267 332 267 336 267 340 267 343 267 344 267 345 267 345 268 345 269 344 271 344 274 343 279 343 284 342 289 341 294 341 300 340 304 340 307 340 309 339 310 339 311 338 311 336 311 333 311 330 311 328 311 327 311 326 311 327 310 327 307 327 305 327 304 327 303 326 304 325 306 324 307 324 308 323 308 322 309 321 310 320 311 319 311 318 311 317 312 316 312 315 312 314 312 313 312 311 313 310 313 309 313 308 313 307 313 306 312 303 312 301 311 299 311 298 311 298 310 296 310 295 309 294 308 292 306 291 304 290 302 290 301 290 300 289 297 289 295 289 293 289 292 289 291 289 289 289 286 289 283 289 280 289 278 289 275 290 274 290 273 290 272 290 271 290 270 291 267 291 264 291 261 292 259 292 258 292 257 292 256 292 255 293 253 293 252 294 249 295 247 296 244 297 242 298 240 298 239 299 238 300 237 301 235 303 234 304 232 305 232 306 231 308 230 311 229 313 228 316 228 318 227 320 227 322 227 323 227 324 227 325 227 327 228 330 228 333 229 335 229 336 229 337 229 338 230 340 231 341 232 343 234 344 236 345 237 345 238 346 240 346 242 347 244 347 246 347 247 347 250 347 251 346 252 346 253 346 254 345 254 343 254 341 254 337 254 334 254 331 254 329 254 328 254 -joinstyle bevel -fill \#1892ff}
{polygon 405 284 404 286 404 289 403 291 403 293 403 294 402 295 402 297 401 299 400 301 398 303 397 304 397 305 396 306 394 307 392 309 391 309 391 310 390 310 389 310 386 311 384 312 381 312 380 312 378 313 376 313 375 313 374 313 372 312 369 312 367 312 365 311 364 311 363 311 362 310 360 310 358 309 356 307 355 306 354 305 354 304 353 303 353 301 352 299 352 298 352 297 351 295 351 293 351 290 351 288 352 286 352 285 352 284 352 283 352 282 352 280 353 277 353 273 354 268 355 262 355 256 356 250 357 245 357 240 358 236 358 233 359 231 359 229 360 229 362 229 365 229 368 229 372 229 375 229 377 229 378 229 377 230 377 232 377 234 376 238 376 242 375 247 375 253 374 259 373 265 372 271 372 276 371 280 371 284 370 287 370 288 370 289 370 290 370 291 370 292 370 293 370 294 370 295 370 296 371 297 372 298 372 299 373 299 374 299 374 300 375 300 376 300 377 300 378 300 379 299 380 299 381 299 381 298 382 297 383 297 383 296 383 295 384 295 384 294 384 293 385 292 385 291 385 290 385 289 385 288 386 287 386 284 386 280 387 276 388 271 388 265 389 259 390 253 390 247 391 242 392 238 392 234 392 232 393 230 393 229 394 229 396 229 399 229 402 229 406 229 409 229 411 229 412 229 412 231 411 233 411 236 410 240 410 245 409 250 408 256 407 262 407 268 406 273 406 277 405 280 405 282 405 283 -outline {} -fill \#1892ff -width 0}
{line 405 284 404 286 404 289 403 291 403 293 403 294 402 295 402 297 401 299 400 301 398 303 397 304 397 305 396 306 394 307 392 309 391 309 391 310 390 310 389 310 386 311 384 312 381 312 380 312 378 313 376 313 375 313 374 313 372 312 369 312 367 312 365 311 364 311 363 311 362 310 360 310 358 309 356 307 355 306 354 305 354 304 353 303 353 301 352 299 352 298 352 297 351 295 351 293 351 290 351 288 352 286 352 285 352 284 352 283 352 282 352 280 353 277 353 273 354 268 355 262 355 256 356 250 357 245 357 240 358 236 358 233 359 231 359 229 360 229 362 229 365 229 368 229 372 229 375 229 377 229 378 229 377 230 377 232 377 234 376 238 376 242 375 247 375 253 374 259 373 265 372 271 372 276 371 280 371 284 370 287 370 288 370 289 370 290 370 291 370 292 370 293 370 294 370 295 370 296 371 297 372 298 372 299 373 299 374 299 374 300 375 300 376 300 377 300 378 300 379 299 380 299 381 299 381 298 382 297 383 297 383 296 383 295 384 295 384 294 384 293 385 292 385 291 385 290 385 289 385 288 386 287 386 284 386 280 387 276 388 271 388 265 389 259 390 253 390 247 391 242 392 238 392 234 392 232 393 230 393 229 394 229 396 229 399 229 402 229 406 229 409 229 411 229 412 229 412 231 411 233 411 236 410 240 410 245 409 250 408 256 407 262 407 268 406 273 406 277 405 280 405 282 405 283 405 284 -joinstyle bevel -fill \#1892ff}
{polygon 421 229 439 229 429 311 410 311 -outline {} -fill \#1892ff -width 0}
{line 421 229 439 229 429 311 410 311 421 229 -fill \#1892ff}
{polygon 449 229 471 229 480 282 487 229 504 229 494 311 473 311 463 254 456 311 439 311 -outline {} -fill \#1892ff -width 0}
{line 449 229 471 229 480 282 487 229 504 229 494 311 473 311 463 254 456 311 439 311 449 229 -fill \#1892ff}
{polygon 114 354 114 355 114 356 114 357 114 358 114 359 115 359 115 360 116 360 117 360 118 360 119 359 119 358 120 358 120 357 120 356 119 355 119 354 118 353 117 352 116 352 115 351 114 350 113 350 112 349 110 348 109 347 109 346 108 345 108 343 107 342 107 341 107 340 107 339 107 338 108 337 108 336 108 335 109 334 109 333 110 333 110 332 111 331 112 331 113 331 114 330 115 330 116 330 117 330 118 330 119 330 120 330 121 331 122 331 123 332 124 332 124 333 125 334 125 335 125 336 126 336 126 337 126 338 126 339 126 340 125 340 123 340 121 340 119 340 119 339 119 338 119 337 119 336 118 336 118 335 117 335 116 335 116 336 115 336 115 337 114 337 114 338 114 339 115 340 115 341 115 342 116 343 117 343 118 344 120 345 121 345 122 346 123 347 124 347 124 348 125 349 126 351 126 352 126 353 126 354 126 355 126 356 126 358 126 359 126 360 125 361 125 362 124 363 123 364 122 364 122 365 121 365 120 365 119 366 118 366 117 366 116 366 115 366 114 365 113 365 112 365 111 364 110 364 109 363 108 362 108 361 108 360 107 359 107 358 107 357 107 356 107 355 107 354 108 354 110 354 112 354 113 354 -outline {} -fill \#000000 -width 0}
{polygon 152 366 151 365 149 365 148 365 147 364 146 364 145 363 144 361 143 360 143 359 143 357 142 357 142 356 142 354 142 352 142 351 142 349 142 348 142 347 142 345 142 343 142 342 142 341 142 340 143 339 143 337 143 336 144 335 144 334 145 333 146 332 146 331 148 331 149 330 150 330 151 330 152 330 154 330 155 331 157 331 158 332 159 333 160 334 161 335 161 336 161 337 162 339 162 340 162 341 162 342 162 344 162 345 162 346 162 347 162 348 162 349 162 351 162 352 162 353 162 354 162 355 162 357 161 358 161 360 161 361 160 362 159 363 159 364 158 364 157 365 155 365 154 366 153 366 152 366 -outline {} -fill \#000000 -width 0}
{polygon 152 360 153 360 154 360 154 359 155 358 155 357 155 356 155 355 155 354 155 353 155 351 155 350 155 349 155 348 155 346 155 344 155 343 155 342 155 341 155 339 155 338 154 337 154 336 153 336 153 335 152 335 152 336 151 336 150 336 150 337 150 338 149 338 149 339 149 340 149 341 149 342 149 343 149 345 149 346 149 347 149 348 149 349 149 351 149 352 149 353 149 354 149 355 149 356 149 357 149 358 150 358 150 359 151 360 152 360 -outline {} -fill $bg -width 0}
{polygon 179 331 195 331 195 337 185 337 185 344 195 344 195 351 185 351 185 365 179 365 -outline {} -fill \#000000 -width 0}
{polygon 215 337 209 337 209 331 228 331 228 337 222 337 222 365 215 365 -outline {} -fill \#000000 -width 0}
{polygon 241 331 248 331 251 355 254 331 260 331 263 355 266 331 272 331 267 365 260 365 257 341 254 365 247 365 -outline {} -fill \#000000 -width 0}
{polygon 293 331 301 331 308 365 302 365 301 358 294 358 293 365 286 365 -outline {} -fill \#000000 -width 0}
{polygon 297 337 295 352 299 352 -outline {} -fill $bg -width 0}
{polygon 324 331 325 331 327 331 329 331 332 331 334 331 335 331 336 331 337 331 338 331 339 332 340 332 340 333 341 333 341 334 342 334 342 335 342 336 343 337 343 338 343 339 343 340 343 341 343 342 343 343 342 343 342 344 342 345 341 345 341 346 340 347 339 348 338 348 339 349 340 349 341 349 341 350 342 351 342 352 342 353 342 354 342 355 343 356 343 357 343 358 343 359 343 360 343 361 343 362 343 363 343 364 344 364 344 365 342 365 340 365 338 365 337 365 336 365 336 364 336 363 336 362 336 361 336 360 336 359 336 358 336 357 336 356 336 355 336 354 335 353 335 352 335 351 334 351 333 351 332 351 331 351 330 351 330 352 330 355 330 358 330 361 330 364 330 365 329 365 327 365 325 365 324 365 324 364 324 363 324 360 324 357 324 353 324 348 324 343 324 339 324 335 324 333 324 331 -outline {} -fill \#000000 -width 0}
{polygon 330 345 331 345 332 345 333 345 334 345 335 345 335 344 335 343 336 343 336 342 336 341 336 340 336 339 335 338 335 337 334 337 333 336 332 336 331 336 330 336 330 337 330 338 330 341 330 343 330 345 -outline {} -fill $bg -width 0}
{polygon 360 331 376 331 376 337 367 337 367 344 376 344 376 351 367 351 367 358 377 358 377 365 360 365 -outline {} -fill \#000000 -width 0}
{polygon 416 331 423 331 423 365 416 365 -outline {} -fill \#000000 -width 0}
{polygon 440 331 448 331 454 353 454 331 460 331 460 365 452 365 446 341 446 365 440 365 -outline {} -fill \#000000 -width 0}
{polygon 485 343 485 342 485 341 485 340 485 339 485 338 485 337 484 337 484 336 483 336 483 335 482 335 482 336 481 336 480 337 480 338 480 339 480 340 480 341 479 341 479 343 479 344 479 346 479 347 479 348 479 349 479 351 479 352 479 353 480 354 480 355 480 356 480 357 480 358 480 359 481 359 481 360 482 360 483 360 484 360 484 359 485 359 485 358 485 357 485 356 485 355 485 354 485 353 485 352 487 352 489 352 491 352 492 352 492 353 492 354 492 356 492 357 491 357 491 358 491 359 491 360 490 361 490 362 490 363 489 363 488 364 487 364 486 365 485 365 484 366 482 366 480 365 479 365 478 365 477 365 477 364 476 364 476 363 475 362 474 361 474 360 473 358 473 357 473 356 473 355 473 353 472 352 472 350 472 349 472 348 472 347 472 346 473 344 473 343 473 342 473 341 473 339 473 338 474 336 474 335 475 334 476 333 476 332 478 331 479 330 481 330 482 330 483 330 485 330 486 330 486 331 487 331 488 332 489 332 489 333 490 333 490 334 491 335 491 336 491 337 491 338 492 340 492 341 492 342 492 343 491 343 490 343 488 343 486 343 485 343 -outline {} -fill \#000000 -width 0}
{polygon 500 356 506 356 506 365 500 365 -outline {} -fill \#000000 -width 0}
{polygon 132 265 133 265 134 265 136 265 137 265 138 265 139 265 140 264 141 264 142 264 143 264 143 263 144 263 145 262 146 262 146 261 146 260 147 259 148 258 148 256 148 255 148 254 148 253 148 252 148 251 148 250 148 249 148 248 147 247 147 246 146 245 145 244 144 244 143 243 142 243 141 243 140 243 138 243 137 243 135 243 135 244 135 245 134 247 134 250 134 254 133 257 133 261 133 263 133 264 132 265 -outline {} -fill $bg -width 0}
}
foreach obj $logo_objs {
eval $c create $obj -tags logo
}
}
#***********************************************************************
# %PROCEDURE: doLogo
# %ARGUMENTS:
# None
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Does the logo thing
#***********************************************************************
proc doLogo {} {
canvas .c -width 600 -height 400 -bg #FFFFFF
pack .c
drawLogo .c #FFFFFF
# Funky effect
.c create text 4 4 -anchor nw -text "Welcome to Remind" \
-fill red -font {-family times -size -24 -weight bold} -tags remind
.c lower remind
.c move logo -300 20
update idletasks
for {set i 0} {$i < 16} {incr i} {
.c move logo 20 0
update idletasks
after 30
}
.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:

6122
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -14,11 +14,42 @@ EOF
AC_CONFIG_HEADER(src/config.h)
if test "`uname -s`" = "Darwin" ; then
trap 'echo Be patient...' INT TERM
cat <<'EOF'
Please don't use Apple products. This script will continue in 30 seconds
if you insist on compiling Remind on Mac OS X.
EOF
for i in 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 ; do
sleep 1
done
trap - INT
trap - TERM
fi
if uname -s | grep -i -q 'cygwin' ; then
trap 'echo Be patient...' INT TERM
cat <<'EOF'
Please don't use Microsoft products. This script will continue in 30
seconds if you insist on compiling Remind on Cygwin.
EOF
for i in 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 ; do
sleep 1
done
trap - INT
trap - TERM
fi
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PATH_PROG([PERL], [perl])
dnl Checks for libraries.
dnl Replace `main' with a function in -lm:
@@ -31,7 +62,7 @@ AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
dnl Checks for header files.
AC_CHECK_HEADERS(sys/file.h glob.h)
AC_CHECK_HEADERS(sys/types.h sys/file.h glob.h wctype.h locale.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_STRUCT_TM
@@ -41,10 +72,11 @@ AC_FUNC_UTIME_NULL
AC_HEADER_TIME
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes"
fi
AC_CHECK_FUNCS(setenv unsetenv glob)
VERSION=03.01.07
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale)
VERSION=03.03.09
AC_SUBST(VERSION)
AC_OUTPUT(src/Makefile www/Makefile src/version.h)
AC_SUBST(PERL)
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile)

9
contrib/README Normal file
View File

@@ -0,0 +1,9 @@
This directory contains contributed scripts. They are provided
"as-is" with no warranty. Please do not contact Dianne Skoll for help
with these scripts; instead, contact the script authors.
You should check the upstream sources; there may be newer versions
of these scripts available.
--
Dianne Skoll

279
contrib/ical2rem.pl Executable file
View File

@@ -0,0 +1,279 @@
#!/usr/bin/perl -w
#
# ical2rem.pl -
# Reads iCal files and outputs remind-compatible files. Tested ONLY with
# calendar files created by Mozilla Calendar/Sunbird. Use at your own risk.
# Copyright (c) 2005, 2007, Justin B. Alcorn
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# version 0.5.2 2007-03-23
# - BUG: leadtime for recurring events had a max of 4 instead of DEFAULT_LEAD_TIME
# - remove project-lead-time, since Category was a non-standard attribute
# - NOTE: There is a bug in iCal::Parser v1.14 that causes multiple calendars to
# fail if a calendar with recurring events is followed by a calendar with no
# recurring events. This has been reported to the iCal::Parser author.
# version 0.5.1 2007-03-21
# - BUG: Handle multiple calendars on STDIN
# - add --heading option for priority on section headers
# version 0.5 2007-03-21
# - Add more help options
# - --project-lead-time option
# - Supress printing of heading if there are no todos to print
# version 0.4
# - Version 0.4 changes all written or inspired by, and thanks to Mark Stosberg
# - Change to GetOptions
# - Change to pipe
# - Add --label, --help options
# - Add Help Text
# - Change to subroutines
# - Efficiency and Cleanup
# version 0.3
# - Convert to GPL (Thanks to Mark Stosberg)
# - Add usage
# version 0.2
# - add command line switches
# - add debug code
# - add SCHED _sfun keyword
# - fix typos
# version 0.1 - ALPHA CODE.
=head1 SYNOPSIS
cat /path/to/file*.ics | ical2rem.pl > ~/.ical2rem
All options have reasonable defaults:
--label Calendar name (Default: Calendar)
--lead-time Advance days to start reminders (Default: 3)
--todos, --no-todos Process Todos? (Default: Yes)
--heading Define a priority for static entries
--help Usage
--man Complete man page
Expects an ICAL stream on STDIN. Converts it to the format
used by the C<remind> script and prints it to STDOUT.
=head2 --label
ical2rem.pl --label "Bob's Calendar"
The syntax generated includes a label for the calendar parsed.
By default this is "Calendar". You can customize this with
the "--label" option.
=head2 --lead-time
ical2rem.pl --lead-time 3
How may days in advance to start getting reminders about the events. Defaults to 3.
=head2 --no-todos
ical2rem.pl --no-todos
If you don't care about the ToDos the calendar, this will surpress
printing of the ToDo heading, as well as skipping ToDo processing.
=head2 --heading
ical2rem.pl --heading "PRIORITY 9999"
Set an option on static messages output. Using priorities can made the static messages look different from
the calendar entries. See the file defs.rem from the remind distribution for more information.
=cut
use strict;
use iCal::Parser;
use DateTime;
use Getopt::Long 2.24 qw':config auto_help';
use Pod::Usage;
use Data::Dumper;
use vars '$VERSION';
$VERSION = "0.5.2";
# Declare how many days in advance to remind
my $DEFAULT_LEAD_TIME = 3;
my $PROCESS_TODOS = 1;
my $HEADING = "";
my $help;
my $man;
my $label = 'Calendar';
GetOptions (
"label=s" => \$label,
"lead-time=i" => \$DEFAULT_LEAD_TIME,
"todos!" => \$PROCESS_TODOS,
"heading=s" => \$HEADING,
"help|?" => \$help,
"man" => \$man
);
pod2usage(1) if $help;
pod2usage(-verbose => 2) if $man;
my $month = ['None','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
my @calendars;
my $in;
while (<>) {
$in .= $_;
if (/END:VCALENDAR/) {
push(@calendars,$in);
$in = "";
}
}
my $parser = iCal::Parser->new();
my $hash = $parser->parse_strings(@calendars);
##############################################################
#
# Subroutines
#
#############################################################
#
# _process_todos()
# expects 'todos' hashref from iCal::Parser is input
# returns String to output
sub _process_todos {
my $todos = shift;
my ($todo, @newtodos, $leadtime);
my $output = "";
$output .= 'REM '.$HEADING.' MSG '.$label.' ToDos:%"%"%'."\n";
# For sorting, make sure everything's got something
# To sort on.
my $now = DateTime->now;
for $todo (@{$todos}) {
# remove completed items
if ($todo->{'STATUS'} && $todo->{'STATUS'} eq 'COMPLETED') {
next;
} elsif ($todo->{'DUE'}) {
# All we need is a due date, everything else is sugar
$todo->{'SORT'} = $todo->{'DUE'}->clone;
} elsif ($todo->{'DTSTART'}) {
# for sorting, sort on start date if there's no due date
$todo->{'SORT'} = $todo->{'DTSTART'}->clone;
} else {
# if there's no due or start date, just make it now.
$todo->{'SORT'} = $now;
}
push(@newtodos,$todo);
}
if (! (scalar @newtodos)) {
return "";
}
# Now sort on the new Due dates and print them out.
for $todo (sort { DateTime->compare($a->{'SORT'}, $b->{'SORT'}) } @newtodos) {
my $due = $todo->{'SORT'}->clone();
my $priority = "";
if (defined($todo->{'PRIORITY'})) {
if ($todo->{'PRIORITY'} == 1) {
$priority = "PRIORITY 1000";
} elsif ($todo->{'PRIORITY'} == 3) {
$priority = "PRIORITY 7500";
}
}
if (defined($todo->{'DTSTART'}) && defined($todo->{'DUE'})) {
# Lead time is duration of task + lead time
my $diff = ($todo->{'DUE'}->delta_days($todo->{'DTSTART'})->days())+$DEFAULT_LEAD_TIME;
$leadtime = "+".$diff;
} else {
$leadtime = "+".$DEFAULT_LEAD_TIME;
}
$output .= "REM ".$due->month_abbr." ".$due->day." ".$due->year." $leadtime $priority MSG \%a $todo->{'SUMMARY'}\%\"\%\"\%\n";
}
$output .= 'REM '.$HEADING.' MSG %"%"%'."\n";
return $output;
}
#######################################################################
#
# Main Program
#
######################################################################
print _process_todos($hash->{'todos'}) if $PROCESS_TODOS;
my ($leadtime, $yearkey, $monkey, $daykey,$uid,%eventsbyuid);
print 'REM '.$HEADING.' MSG '.$label.' Events:%"%"%'."\n";
my $events = $hash->{'events'};
foreach $yearkey (sort keys %{$events} ) {
my $yearevents = $events->{$yearkey};
foreach $monkey (sort {$a <=> $b} keys %{$yearevents}){
my $monevents = $yearevents->{$monkey};
foreach $daykey (sort {$a <=> $b} keys %{$monevents} ) {
my $dayevents = $monevents->{$daykey};
foreach $uid (sort {
DateTime->compare($dayevents->{$a}->{'DTSTART'}, $dayevents->{$b}->{'DTSTART'})
} keys %{$dayevents}) {
my $event = $dayevents->{$uid};
if ($eventsbyuid{$uid}) {
my $curreventday = $event->{'DTSTART'}->clone;
$curreventday->truncate( to => 'day' );
$eventsbyuid{$uid}{$curreventday->epoch()} =1;
for (my $i = 0;$i < $DEFAULT_LEAD_TIME && !defined($event->{'LEADTIME'});$i++) {
if ($eventsbyuid{$uid}{$curreventday->subtract( days => $i+1 )->epoch() }) {
$event->{'LEADTIME'} = $i;
}
}
} else {
$eventsbyuid{$uid} = $event;
my $curreventday = $event->{'DTSTART'}->clone;
$curreventday->truncate( to => 'day' );
$eventsbyuid{$uid}{$curreventday->epoch()} =1;
}
}
}
}
}
foreach $yearkey (sort keys %{$events} ) {
my $yearevents = $events->{$yearkey};
foreach $monkey (sort {$a <=> $b} keys %{$yearevents}){
my $monevents = $yearevents->{$monkey};
foreach $daykey (sort {$a <=> $b} keys %{$monevents} ) {
my $dayevents = $monevents->{$daykey};
foreach $uid (sort {
DateTime->compare($dayevents->{$a}->{'DTSTART'}, $dayevents->{$b}->{'DTSTART'})
} keys %{$dayevents}) {
my $event = $dayevents->{$uid};
if (exists($event->{'LEADTIME'})) {
$leadtime = "+".$event->{'LEADTIME'};
} else {
$leadtime = "+".$DEFAULT_LEAD_TIME;
}
my $start = $event->{'DTSTART'};
print "REM ".$start->month_abbr." ".$start->day." ".$start->year." $leadtime ";
if ($start->hour > 0) {
print " AT ";
print $start->strftime("%H:%M");
print " SCHED _sfun MSG %a %2 ";
} else {
print " MSG %a ";
}
print "%\"$event->{'SUMMARY'}";
print " at $event->{'LOCATION'}" if $event->{'LOCATION'};
print "\%\"%\n";
}
}
}
}
exit 0;
#:vim set ft=perl ts=4 sts=4 expandtab :

View File

@@ -0,0 +1,13 @@
DESTDIR?=
PREFIX?=/usr
BINDIR?=$(PREFIX)/bin
MANDIR?=$(PREFIX)/share/man
default: rem2ics.1
rem2ics.1:
pod2man -c "" rem2ics > rem2ics.1
install: rem2ics.1
install -p -D rem2ics $(DESTDIR)$(BINDIR)/rem2ics
install -p -D -m 0644 rem2ics.1 $(DESTDIR)$(MANDIR)/man1/rem2ics.1

847
contrib/rem2ics-0.93/rem2ics Executable file
View File

@@ -0,0 +1,847 @@
#!/usr/bin/perl -w
# rem2ics -- convert the output of "remind -s" into RFC2445 iCalendar format.
# Copyright 2007,2008,2009
# Mark Atwood <me@mark.atwood.name>
# Paul Hinze <paul dot t dot hinze at gmail dot com>
# Michael Schultz <mjschultz at gmail dot com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor
# Boston MA 02110-1301 USA
use strict;
use warnings;
=head1 NAME
rem2ics - convert the output of "remind -s" into RFC2445 iCalendar format.
=head1 SYNOPSIS
TZ=I<timezone> B<rem2ics> [B<-man>] [B<-do>] [B<-norecur>] [B<-usetag>] E<lt>input E<gt>output
=head1 OPTIONS AND ARGUMENTS
=over 8
=item B<-man>
Print the manual page and exit.
=item B<-do>
Actually do the conversion. Otherwise just print a brief help message
and usage example, and then exit.
=item B<-norecur>
Do not attempt to detect and fold together recurring events.
=item B<-usetag>
Generate UIDs using remind TAG clauses.
=back
Input is from standard input
Output is to standard output.
=head1 USAGE
remind -s360 -irem2ics=1 ~/.reminders 1 Jan 1991 | TZ=PST8PDT rem2ics -do >reminders.ics
This tells B<remind> to use ~/.reminders, and to process the entire
range of dates it can handle (from Jan 1 1991 to Dec 31 2020), and to
define a variable named C<rem2ics>, which can be used in
C<IF !defined("rem2ics")> / C<ENDIF> pairs.
B<rem2ics> will use a timezone of PST8PDT, and will fold events that
have the same name and duration into a single iCalendar VEVENT object.
=head1 NOTES
=head2 Timezones and the TZ environment variable.
B<rem2ics> uses the TZ environment variable to determine the value of
the RFC2445 TZID property. If you are running on a Linux or other GNU
libc based system, you probably don't (and probably shouldn't)
normally have TZ set. You can confirm this by running C<printenv TZ>
at a shell prompt. If your remind data is in your "local time", and
it probably is, you should probably set TZ to a good name for your
local timezone just for the run of this script. You probably should
NOT set TZ in your login scripts.
You can use TZ like this:
remind -s ~/.reminders | TZ=PST8PDT rem2ics -do >reminders.ics
or
remind -s ~/.reminders | TZ=US/Pacific rem2ics -do >reminders.ics
If, for some reason, your remind files are all in GMT instead of
localtime (you smart person you!), you can do this:
remind -s ~/.reminders | TZ=GMT rem2ics -do >reminders.ics
or
remind -s ~/.reminders | TZ=0 rem2ics -do >reminders.ics
and B<rem2ics> will use the ISO8601 "Z" notation for GMT time in the ics
file. (Other synonyms for GMT are the empty string (not the same as
the TZ not set), "I<0>", "I<Z>", "I<Zulu>", "I<Greenwitch>", "I<GMT>",
"I<GMT+0>, and "I<GMT-0>".)
If you leave TZ undefined and unset, B<rem2ics> will use the ISO8601
"T" notation date strings with no TZID property, which RFC2445 calls a
"floating time". Who knows, it might work for you!
The TZ string value is literally incorporated into the iCalendar
stream, so whatever your iCalendar-using application needs is what you
should use. You may have to experiment a bit.
You can look around in C</usr/share/zoneinfo> to get the names of
every timezone anywhere. This is the "Olson database" that RFC2445
refers to. Read the man page for L<tzfile(5)> for more than you ever
wanted to know about the format of these files, and about GNU libc's
handling of timezones. As complex as it is, it's certainly better
than what POSIX defines or what most legacy UNIX systems do, and most
certainly better than Microsoft, who in their "cutting edge" "state of
the art" "server" OS, still hasn't figured out that daylight time
rules might be different in different years.
If you just ran B<rem2ics> without reading all this stuff, or if you
don't want to worry about it at all, and somehow your iCalendar
application manager is able to guess the proper timezone for you, just
leave TZ undefined, and B<rem2ics> will use the ISO8601 "T" notation
date strings with no TZID property, which RFC2445 calls a "floating
time". Who knows, it might work for you!
=head2 Detecting recurring events
B<rem2ics> tries to detect recurring events. If any multiple events
appear with exactly the text and exactly the same duration (including
"no duration"), instead of multiple VEVENT objects, there will be just
one VEVENT object, that will have a RFC2445 C<RDATE> property.
B<rem2ics> is not yet smart enough to derive an C<RRULE> based
recurrance. If you really want that feature, either implement it and
send in a patch, or contact the author and convince him to do it.
=head2 Other iCalendar Properties
B<rem2ics> does not generate C<DESCRIPTION> or C<LOCATION>. One
would have to heuristically parse them out of the text, and everyone
uses a idiosyncratic way of putting things in B<remind>.
If the B<-usetag> option is not used or no C<TAG> is set for a
reminder, B<rem2ics> will synthesize C<UID> properties for each
VEVENT, but the UIDs will be different (and unique) for each run of
B<rem2ics>. If you run rem2ics twice and import the two resulting ICS
streams into your new scheduling program, your appointments will
appear twice. If, however, you have set C<TAG> clauses in your
reminders and activated B<-usetag>, these will be used. The same
applies for tags synthesized by B<remind>'s B<-y> option. Hence, it
is more useful to use the B<-y> option than to let B<rem2ics>
synthesize UIDs, because the UIDs will stay the same across multiple
runs.
=head2 Other iCalendar Perl objects
Why does't B<rem2ics> use any of the iCalendar Perl stuff in CPAN?
Because I don't trust them, and they are too big for this app. One
links to a binary library. Another hasn't been maintained since 1991,
and is full of notes as to how buggy and incomplete it is. And so
forth. I am not at this moment interested in groveling around in
L<Net::iCal>, L<DateTime::Format::iCal>, L<Tie::iCal>,
L<iCal::Parser>, or C<libical>.
=head2 Previous implementation
There is a working quick & dirty rem2ics written in awk
by Anthony J. Chivetta E<lt>achivetta@gmail.comE<gt>.
But it has the following problems: it doesn't escape the text, it
doesn't handle events that cross over midnight, it doesn't do
timezones, it doesn't enforce the correct EOL sequence, and it doesn't
fold long lines. This is a replacement for that script.
=head1 TODO
If TZ not set, grab out of system config somewhere
Detect recurring events.
If I'm REALLY smart, derive RRULE
Handle characters not in US-ASCII. Latin1? UTF8?
=head1 VERSION HISTORY
=over 8
=item version 0.1 2007-02-08
First cut.
=item version 0.2 2007-02-09
Reorg into multipass over a data structure.
=item version 0.3 2007-02-10
Collapse repeating events. Fold output lines.
=item version 0.9 2007-02-11
POD. Command line options. First public release.
=item version 0.91 2007-02-14
Bug fix, error message for non-recurring events
=item version 0.92 2008-01-28
Bug fix,
rem2ics 0.91 chokes on timed reminders with
duration using `remind -s` as it functions in remind-03.01.03.
Remind 3.01 changed how the -s data is formated for events that have a duration
Patch by Paul Hinze E<lt>paul dot t dot hinze at gmail dot comE<gt>
and Michael Schultz E<lt>mjschultz at gmail dot comE<gt>
=item version 0.93 2009-06-25
Add B<-usetag> option to allow for UIDs to stay the same across multiple runs
by using the remind TAG clause.
Patch by Tim Weber E<lt>scy at scytale dot nameE<gt>
=back
=head1 SEE ALSO
L<http://mark.atwood.name/code/rem2ics>
L<http://en.wikipedia.org/wiki/ICalendar>
L<http://tools.ietf.org/html/rfc2445>
L<https://dianne.skoll.ca/projects/remind/>
L<remind(1)>
=head1 AUTHOR
Copyright 2007,2008,2009 by Mark Atwood E<lt>me+rem2ics@mark.atwood.nameE<gt>. L<http://mark.atwood.name/>.
Please report bugs (with patches, if possible).
Inspired by Anthony J. Chivetta E<lt>achivetta@gmail.comE<gt>'s
rem2ics in awk.
Thank you to Dianne Skoll E<lt>dianne@skoll.ca<gt> for Remind,
and to the IETF calsch wg for the iCalendar specification.
=cut
use Getopt::Long;
use Pod::Usage;
my $app_name = "rem2ics";
my $app_version = "0.93";
# process the command line
my %options;
GetOptions(\%options, qw(man do norecurr usetag)) || pod2usage(2);
pod2usage(-verbose => 2) if ($options{man});
unless ($options{do}) {
print STDERR "Run \"$0 -man\" for information and usage examples.\n"
. "Pay special attention to information about timezone.\n";
exit(99);
}
# grab the hostname
# this is used as part of the UID property of each VEVENT
my $ical_uid_hostname = $ENV{'HOSTNAME'};
unless ($ical_uid_hostname) {
print STDERR "Warning! "
. "The environment variable HOSTNAME was not properly set.\n"
. "Will use \"localhost\" in the RFC2445 UID property\n";
$ical_uid_hostname = "localhost";
}
# look for the TZ
my $ical_tzid = undef;
if (exists $ENV{'TZ'}) {
$ical_tzid = $ENV{'TZ'};
my %synonyms_for_gmt = (
'' => 1, '0' => 1, 'z' => 1, 'zulu' => 1, 'greenwitch' => 1,
'gmt' => 1, 'gmt+0' => 1, 'gmt-0' => 1, );
if (exists $synonyms_for_gmt{lc($ical_tzid)}) {
$ical_tzid = ''; # empty means GMT, below
}
} else {
# leave it undefined, that has a meaning below
}
# RFC2445 DTSTAMP property will be the time we started running ($^T)
my ($ical_dtstamp);
{
my @gt = gmtime($^T);
$ical_dtstamp = sprintf("%04d%02d%02dZ%02d%02d%02dZ",
1900+$gt[5], $gt[4]+1, $gt[3],
$gt[2], $gt[1], $gt[0]);
}
my ($cnt, $v, @events);
$cnt = 0;
foreach (<STDIN>) {
$cnt++;
s/#.*//; # toss comments
next if /^\s*$/; # skip blank lines
chomp;
$v = undef;
# store the raw line
$v->{src} = $_;
$v->{cnt} = $cnt;
# split and parse the line
# if we don't like it, skip it and go around again
# sf[0] = date, in yyyy/mm/dd format
# sf[1] = special, usually "*"
# sf[2] = tag, usually "*"
# sf[3] = duration, in minutes
# sf[4] = time, since midnight, in minutes
# sf[5] = text
my @sf = split(' ', $_, 6);
next unless ($sf[1] eq '*'); # ignore SPECIAL lines
next unless (($sf[3] eq '*') or ($sf[3] =~ m/\d+/));
next unless (($sf[4] eq '*') or ($sf[4] =~ m/\d+/));
next unless (length($sf[5]) > 0);
my @dt = split('/', $sf[0], 3);
next unless ($dt[0] =~ m/^\d{4}$/); # year
next unless ($dt[1] =~ m/^\d{2}$/); # month
next unless ($dt[2] =~ m/^\d{2}$/); # day
if ($sf[4] ne "*") { # a time was given
# When an event has a time, remind -s "helpfully" also
# puts it as text at the start of the text portion.
# This takes the following form:
# ##:##[a|p]m <rest of MSG>
# or, if the event has a duration:
# ##:##[a|p]m-##:##[a|p]m <rest of MSG>
# Rather than a nasty regex, just splitting at the
# first space does the trick.
my($extra_time, $textmsg) = split(' ', $sf[5], 2);
$sf[5] = $textmsg;
}
$v->{sf} = \@sf;
$v->{dt} = \@dt;
push @events, $v;
}
# generate the "date time string" for each event
foreach $v (@events) {
if (${$v->{sf}}[4] eq "*") { # no time was given
$v->{dts} = sprintf("%04d%02d%02d", @{$v->{dt}});
} else { # a time was given
my ($t_hr, $t_mn) = &idiv(${$v->{sf}}[4], 60);
$v->{dts} = sprintf("%04d%02d%02dT%02d%02d00",
@{$v->{dt}}, $t_hr, $t_mn);
}
}
my(%grovel);
# if the user doesnt want recurrance detection
unless ($options{norecurr}) {
# then dont put events in the grovel hash
foreach $v (@events) {
# key is duration followed by text
# \036 is "ASCII RS Record Separator"
my $k = ${$v->{sf}}[3] . "\036" . ${$v->{sf}}[5];
push @{$grovel{$k}}, $v;
}
foreach my $k (keys %grovel) {
if ((scalar @{$grovel{$k}}) > 1) {
$v = ${$grovel{$k}}[0];
$v->{recurlist} = \@{$grovel{$k}};
foreach my $v0 (@{$grovel{$k}}) {
$v0->{is_recurrance} = $v;
}
}
}
}
# All of the individual events are in the @events array. All of the
# unique combinations of duration/event name are the keys in the
# %grovel hash, the elements of which are references to an arrays of
# references to the events, in the same ordering as they we read by
# us, which *ought* to be in datewise order. I don't know if "remind
# -s" actually sorts into true chronological order. If it doesn't, we
# might have a problem if a recurring event has two instances both on
# the first day.
# Every event that is recurring has a "is_recurrance" property.
# Additionally, (hopefully) the first/earliest event in a set of
# recurrances has a "recurlist" property. The "recurlist" is a
# reference to a list of references to each of the events. The first
# one on that list will be the same event that has the "recurlist"
# property. The "is_recurrance" property is a reference back to the
# event that has the "recurlist" property.
foreach my $k (keys %grovel) {
next if ((scalar @{$grovel{$k}}) <= 1);
my $recur_str = "";
foreach $v (@{$grovel{$k}}) {
if (${$v->{sf}}[4] eq "*") { # no time was given
$recur_str .= ($v->{dts} . ",");
} else {
if (defined($ical_tzid)) {
if ($ical_tzid eq '') { # tz is defined but empty, so in GMT
$recur_str .= $v->{dts} . "Z,";
} else { # tz is non-zero, so output the tz as well
$recur_str .= $v->{dts} . ",";
}
} else { # undefined tz, just floating time
$recur_str .= $v->{dts} . ",";
}
}
}
# the recur_str now has an extra comma at the end. chop it off
chop($recur_str);
${$grovel{$k}}[0]->{recur_str} = $recur_str;
}
foreach my $k (keys %grovel) {
next if ((scalar @{$grovel{$k}}) <= 1);
my $v = ${$grovel{$k}}[0]; # grab the head of each list
if (${$v->{sf}}[4] eq "*") { # no time was given
# the default value type for an RDATE is DATE-TIME,
# we much change the type to DATE
$v->{i_rdate} = sprintf("RDATE;VALUE=DATE:");
} else {
if (defined($ical_tzid)) {
if ($ical_tzid eq '') { # tz is defined but empty, so in GMT
$v->{i_rdate} = sprintf("RDATE:");
} else { # tz is non-zero, so output the tz as well
$v->{i_rdate} = sprintf("RDATE;TZID=%s:", $ical_tzid);
}
} else { # undefined tz, just floating time
$v->{i_rdate} = sprintf("RDATE:");
}
}
# now stick the recur_str onto the end
$v->{i_rdate} .= $v->{recur_str};
# if we ever get memory tight, we can probably undef($v->{recur_str})
}
foreach $v (@events) {
# for recurrant events, skip those that arnt the "head"
next if ($v->{is_recurrance} and (not $v->{recurlist}));
if (${$v->{sf}}[4] eq "*") { # no time was given
$v->{i_dtstart} = sprintf("DTSTART:%s", $v->{dts});
} else {
if (defined($ical_tzid)) {
if ($ical_tzid eq '') { # tz is defined but empty, so in GMT
$v->{i_dtstart} = sprintf("DTSTART:%sZ", $v->{dts});
} else { # tz is non-zero, so output the tz as well
$v->{i_dtstart} = sprintf("DTSTART;TZID=%s:%s",
$ical_tzid, $v->{dts});
}
} else { # undefined tz, just floating time
$v->{i_dtstart} = sprintf("DTSTART:%s", $v->{dts});
}
}
if (${$v->{sf}}[3] ne "*") { # a duration was given
# It's convienient that RFC2445 defines DURATION, thus we
# don't need to calculate DTEND, with awkward figuring out
# crossing hours, days, months, year, etc. Instead we
# will let the iCalendar consuming application worry about it.
$v->{i_duration} = sprintf("PT%dM", ${$v->{sf}}[3]);
}
}
# output header
print "BEGIN:VCALENDAR\015\012"
. "VERSION:2.0\015\012"
. "PRODID:http://mark.atwood.name/code/rem2ics"
. " $app_name $app_version\015\012";
# output each vevent
foreach $v (@events) {
# for recurrant events, only output the "head", skip the others
next if ($v->{is_recurrance} and (not $v->{recurlist}));
print "BEGIN:VEVENT\015\012";
my $tag = ${$v->{sf}}[2];
# if $tag is not set, fake up a UID from start time, process id & input line count
if ($tag eq "*" || !$options{usetag}) {
$tag = sprintf("%x.%x.%x", $^T, $$, $v->{cnt});
}
# add rem2ics and hostname to UID
print &lineify(sprintf("UID:rem2ics.%s@%s",
$tag, $ical_uid_hostname));
print &lineify("SUMMARY:" . &quotify(${$v->{sf}}[5]));
print &lineify($v->{i_dtstart});
print &lineify("DURATION:" . $v->{i_duration})
if ($v->{i_duration});
print &lineify($v->{i_rdate})
if ($v->{i_rdate});
print &lineify("DTSTAMP:" . $ical_dtstamp);
print &lineify("COMMENT: generated by $app_name $app_version\\n"
. " http://mark.atwood.name/code/rem2ics\\n"
. " data[" . $v->{cnt} . "]=|" . &quotify($v->{src}) . "|");
print "END:VEVENT\015\012";
}
# output trailer
print "END:VCALENDAR\015\012";
# integer division, return both quotient and remainder
sub idiv {
my $n = shift; my $d = shift;
my $r = $n; my $q = 0;
while ($r >= $d) {
$r = $r - $d;
$q = $q + 1;
}
return ($q, $r);
}
# todo, perl5 version that defines ()*, need to specify a requires up top
sub lineify {
return join("\015\012 ", unpack('(A72)*', shift)) . "\015\012";
}
sub quotify {
my $s = shift;
return $s if $s =~ m/^(\w| )*$/;
$s =~ s/\\/\\\\/gso;
$s =~ s/\n/\\n/gso;
$s =~ s/\s/ /gso;
$s =~ s/\"/\\"/gso;
$s =~ s/\,/\\,/gso;
$s =~ s/\:/\\:/gso;
$s =~ s/\;/\\;/gso;
return $s;
}
__END__
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
EOF

View File

@@ -0,0 +1,50 @@
Name: rem2ics
Version: 0.93
Release: 1%{?dist}
Summary: Converts the output of "remind -s" into RFC2445 iCalendar format
Group: Applications/Productivity
License: GPLv2+
URL: http://mark.atwood.name/code/rem2ics/
Source0: http://mark.atwood.name/code/rem2ics/rem2ics-%{version}.tar.gz
Source1: rem2ics-Makefile
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: perl
%description
rem2ics converts the output of "remind -s" into RFC2445 iCalendar format.
You may want to install remind if you install this package.
%prep
%setup -q -c
cp -a %SOURCE1 Makefile
%build
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc
%{_bindir}/rem2ics
%{_mandir}/man1/rem2ics.1*
%changelog
* Tue Mar 25 2008 Till Maas <opensource till name> - 0.92-1
- initial spec for Fedora

View File

@@ -0,0 +1,56 @@
;;; setup for remind autocompletion (totally optional)
;; put something like
;; (add-hook 'remind-conf-mode '(load-library "ac-remind")) in your .emacs file.
(require 'auto-complete)
(define-key ac-complete-mode-map "\r" nil)
(defvar ac-remind-keywords
'((candidates
. (lambda ()
(all-completions ac-target remind-keywords ))))
"Source for remind-conf completion keywords.")
(defvar ac-remind-time-words
'((candidates
. (lambda ()
(all-completions ac-target remind-time-words))))
"Source for remind-conf time words completions.")
(defvar ac-remind-builtin-variables
'((candidates
. (lambda ()
(all-completions ac-target remind-builtin-variables))))
"Source for remind-conf builtin variables.")
(defvar ac-remind-type-keywords
'((candidates
. (lambda ()
(all-completions ac-target remind-type-keywords))))
"Source for remind-conf type keywords.")
(defvar ac-remind-builtin-functions
'((candidates
. (lambda ()
(all-completions ac-target remind-builtin-functions))))
"Source for remind-conf completion builtin functions.")
(add-hook 'remind-conf-mode-hook
(lambda () "Makes auto-completion work in remind-conf-mode"
(make-local-variable 'ac-sources)
(setq ac-sources '(ac-remind-keywords
ac-remind-builtin-variables
ac-remind-builtin-functions
ac-remind-type-keywords
ac-remind-time-words
ac-source-abbrev))
(auto-complete-mode 1)))
(provide 'ac-remind)
;; (define-skeleton ac-look
;; ""
;; (skeleton-read "well? ")
;; "(when (looking-at (regexp-opt remind-" str " 'words))" \n
;; >"(setq ac-sources '(ac-remind-" str ")))"
;; )

View File

@@ -0,0 +1,444 @@
;;; remind-conf-mode.el --- A mode to help configure remind.
;; Copyright (C) 2008 Shelagh Manton <shelagh.manton@gmail.com>
;; Author: Shelagh Manton <shelagh.manton@gmail.com> with help from
;; Dianne Skoll
;; Keywords: remind configure mode
;; Version: .04
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Commentary:
;; Use this mode to help with the configuration of remind configuration files.
;; Put (require 'remind-conf-mode) in your .emacs file
;; or (autoload 'remind-conf-mode "remind-conf-mode" "Mode to help with remind files" t)
;; also put (add-to-list 'auto-mode-alist '("\\.rem\\'" . remind-conf-mode)) and
;; (setq auto-mode-alist
;; (cons '(".reminders$" . remind-conf-mode) auto-mode-alist))
;; if you want to have the mode work automatically when you open a remind configuration file.
;; If you want to use the auto-complete stuff, you will need to download and install the
;; auto-complete library from http://www.cx4a.org/pub/auto-complete.el and put
;; (require 'auto-complete) in your emacs with
;; (add-hook 'remind-conf-mode-hook
;; (lambda ()
;; (make-local-variable 'ac-sources)
;; (setq ac-sources '(ac-remind-conf ac-remind-builtin-variables ac-remind-builtin-functions))
;; (auto-complete t)))
;; in your .emacs file
;; PS. you could add ac-source-abbrev ac-source-words-in-buffer to have abbrevs and
;; other words in buffer auto-complete too
;;; History:
;; Thu, Feb 14, 2008
;; Based mode on wpld-mode tutorial and sample-mode on emacs wiki.
;; Ideas from mupad.el for font-lock styles.
;; Mon, Jan 26, 2008
;; Added rem-setup-colors to make it easy for colourised remind output.
;; Added a demo skeleton for people to copy for easy entry of coloured remind entries.
;; tried to hook in the auto-complete library so that all known functions and keywords can be easily entered.
;; EXPERIMENTAL, but seems to work well here (emacs cvs).
;; Seems to work without case folding which is nice. wonder why it didn't yesterday?
;;; Code:
(require 'font-lock); this goes in the define-derived-mode part.
(when (featurep 'xemacs)
(require 'overlay)) ;I wonder if this will help with font-lock and xemacs?
(defgroup remind-conf nil
"Options for remind-conf-mode."
:group 'remind-conf
:prefix "remind-conf-")
(defvar remind-conf-mode-hook nil
"Hook to run in `remind-conf-mode'.")
;; keymap
(defvar remind-conf-mode-map
(let ((remind-conf-mode-map (make-sparse-keymap)))
remind-conf-mode-map)
"Keymap for `remind-conf-mode'.")
(define-key remind-conf-mode-map "\C-cr" 'rem-skel)
(define-key remind-conf-mode-map "\C-ct" 'rem-today)
(define-key remind-conf-mode-map "\C-cd" 'rem-today-skel)
(define-key remind-conf-mode-map "\C-cw" 'rem-week-away)
(define-key remind-conf-mode-map "\C-cx" 'rem-tomorrow)
(define-key remind-conf-mode-map "\C-ca" 'rem-days-away)
(define-key remind-conf-mode-map "\M-j" 'remind-indent-line)
(define-key remind-conf-mode-map (kbd "RET") 'remind-indent-line)
(define-key remind-conf-mode-map "\C-c\C-c" 'rem-save-file)
;; syntax-table
(defvar remind-conf-syntax-table
(let ((remind-conf-syntax-table (make-syntax-table text-mode-syntax-table)))
(modify-syntax-entry ?\; ". 1b" remind-conf-syntax-table)
(modify-syntax-entry ?\# ". 1b" remind-conf-syntax-table)
(modify-syntax-entry ?\n "> b" remind-conf-syntax-table)
;Names with _ are still one word.
(modify-syntax-entry ?_ "w" remind-conf-syntax-table)
(modify-syntax-entry ?. "w" remind-conf-syntax-table)
remind-conf-syntax-table)
"Syntax table for `remind-conf-mode'.")
;;; keyword sets
(defconst remind-keywords
(sort
(list "RUN" "REM" "ONCE" "SATISFY" "BEFORE" "UNSET" "OMIT"
"OMIT" "DATE" "SKIP" "ONCE" "AFTER" "WARN" "PRIORITY" "AT" "SCHED" "IF" "ELSE" "ENDIF"
"WARN" "UNTIL" "THROUGH" "SCANFROM" "DURATION" "TAG" "MSG" "MSF" "CAL" "SPECIAL" "IFTRIG"
"PS" "PSFILE" "BANNER" "INCLUDE" "PUSH-OMIT-CONTEXT" "DEBUG" "DUMPVARS"
"CLEAR-OMIT-CONTEXT" "POP-OMIT-CONTEXT" "SET" "ERRMSG" "FSET"
"EXIT" "FLUSH" "PRESERVE" "MOON" "COLOR" "COLOUR")
#'(lambda (a b) (> (length a) (length b)))))
(defconst remind-type-keywords
(sort
(list "INT" "STRING" "TIME" "DATE" "SHADE")
#'(lambda (a b) (> (length a) (length b)))))
(defconst remind-builtin-variables
(sort
(list "$CalcUTC" "$CalMode" "$DefaultPrio" "$EndSent" "$EndSentIg" "$NumTrig"
"$FirstIndent" "$FoldYear" "$FormWidth" "$MinsFromUTC" "$LatDeg" "$LatMin" "$LatSec"
"$Location" "$LongDeg" "$LongMin" "$LongSec" "$MaxSatIter" "$SubsIndent")
#'(lambda (a b) (> (length a) (length b)))))
(defconst remind-time-words
(sort
(list "Jan" "January" "Feb" "Mar" "Apr" "Jun" "Jul" "Aug" "Sept" "Sep" "Oct" "Nov" "Dec" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December" "Mon" "Monday" "Tue" "Tues" "Tuesday" "Wed" "Wednesday" "Thu" "Thursday" "Fri" "Friday" "Saturday" "Sat" "Sun" "Sunday")
#'(lambda (a b) (> (length a) (length b)))))
(defconst remind-builtin-functions
(sort
(list "abs" "access" "shell" "args" "asc" "baseyr" "char" "choose" "coerce" "date"
"dawn" "today" "day" "daysinmon" "defined" "dosubst" "dusk" "easterdate" "easter"
"filedir" "filename" "getenv" "hour" "iif" "trigger" "index" "isdst" "isleap"
"isomitted" "hebdate" "hebday" "hebmon" "hebyear" "language" "ord" "thisyear"
"sunrise" "sunset" "lower" "max" "min" "minute" "mon" "moondate" "moontime"
"moonphase" "now" "ostype" "plural" "realnow" "realtoday" "sgn" "strlen" "psshade"
"substr" "trigdate" "trigger" "trigtime" "trigvalid" "typeof" "upper" "psmoon"
"value" "version" "wkday" "wkdaynum" "msgprefix" "msgsuffix" "year")
#'(lambda (a b) (> (length a) (length b)))))
;;; faces
;;example of setting up special faces for a mode.
(defvar remind-conf-command-face 'remind-conf-command-face
"Remind commands.")
(defface remind-conf-command-face
'((t :foreground "SeaGreen4" :bold t))
"Font Lock mode face used to highlight commands."
:group 'remind-conf)
(defvar remind-conf-keyword-face 'remind-conf-keyword-face
"Remind keywords.")
(defface remind-conf-keyword-face
'((t :foreground "blue violet"))
"Font Lock mode face used to highlight keywords."
:group 'remind-conf)
(defvar remind-conf-substitutes-face 'remind-conf-substitutes-face
"Remind substitutes.")
(defface remind-conf-substitutes-face
'((t :foreground "blue2"))
"Font Lock mode face used to highlight substitutes."
:group 'remind-conf)
(defvar remind-conf-endline-face 'remind-conf-endline-face
"Remind endline.")
(defface remind-conf-endline-face
'((t :foreground "goldenrod2" :bold t))
"Font Lock mode face used to highlight commands."
:group 'remind-conf)
(defvar remind-conf-variable-face 'remind-conf-variable-face
"Remind variable.")
(defface remind-conf-variable-face
'((t :foreground "DeepPink2" :bold t))
"Font Lock mode face used to highlight commands."
:group 'remind-conf)
(defvar remind-conf-color-face 'remind-conf-color-face
"Remind color variables.")
(defface remind-conf-color-face
'((t :foreground "gold" :bold t))
"Font Lock mode face used to highlight color changes."
:group 'remind-conf)
(defvar remind-conf-delta-face 'remind-conf-delta-face
"Remind deltas.")
(defface remind-conf-delta-face
'((t :foreground "sandy brown" :bold t))
"Font Lock mode face used to highlight deltas."
:group 'remind-conf)
(defvar remind-comment-face 'remind-comment-face
"Remind comments.")
(defface remind-comment-face
'((t :foreground "brown"))
"Font-lock face for highlighting comments."
:group 'remind-conf)
(defvar remind-string-face 'remind-string-face
"Remind strings.")
(defface remind-string-face
'((t :foreground "tomato"))
"Font lock mode face used to highlight strings."
:group 'remind-conf)
(defvar remind-time-face 'remind-time-face
"Remind time words.")
(defface remind-time-face
'((t :foreground "LightSeaGreen" :bold t))
"Font lock mode face to highlight time phrases."
:group 'remind-conf)
(defvar remind-conf-type-face 'remind-conf-type-face
"Remind type keywords.")
(defface remind-conf-type-face
'((t :foreground "orange" :bold t))
"Font lock mode face to highlight type keywords."
:group 'remind-conf)
(defcustom rem-post-save-function ""
"Name of shell function that can be run when you save and close a remind file.
If you put a & after the name of the function, it will run asyncronously. This might
be useful if the process takes a long time."
:type 'string
:group 'remind-conf
)
;; keywords
(defconst remind-conf-font-lock-keywords-1
(list
'("^[\;\#]\\s-+.*$" . remind-comment-face)
(cons (regexp-opt remind-keywords 'words) remind-conf-keyword-face)
'("%[\"_]" . font-lock-warning-face)
'("\\(%[a-mops-w]\\)" . remind-conf-substitutes-face)
'("\"[^\"]*\"" . remind-string-face))
"Minimal font-locking for `remind-conf-mode'.")
(defconst remind-conf-font-lock-keywords-2
(append remind-conf-font-lock-keywords-1
(list
(cons (regexp-opt remind-time-words 'words) remind-time-face)
(cons (regexp-opt remind-builtin-functions 'words) remind-conf-command-face)
'("%$" . remind-conf-endline-face)))
"Additional commands to highlight in `remind-conf-mode'.")
(defconst remind-conf-font-lock-keywords-3
(append remind-conf-font-lock-keywords-2
(list
(cons (regexp-opt remind-type-keywords 'words) remind-conf-type-face)
'("\[[a-zA-Z]\\{3,6\\}\]" . remind-conf-color-face)
'("\\s-+\\([12][0-9]\\|3[01]\\|0?[0-9]\\)\\s-+" . remind-conf-substitutes-face);better date regexp
'("\\s-+\\(\\(?:20\\|19\\)[0-9][0-9]\\)\\s-+" . remind-conf-substitutes-face);years
'("\\s-+\\(2[0-4]\\|[01]?[0-9][.:][0-5][0-9]\\)\\s-+" . remind-conf-substitutes-face);24hour clock, more precise
'("\\s-+\\([+-][+-]?[1-9][0-9]*\\)\\s-+" 1 remind-conf-delta-face prepend)
(cons (regexp-opt remind-builtin-variables 'words) remind-conf-variable-face)))
"The ultimate in highlighting experiences for `remind-conf-mode'.")
(defcustom remind-conf-font-lock-keywords 'remind-conf-font-lock-keywords-3
"Font-lock highlighting level for `remind-conf-mode'."
:group 'remind-conf
:type '(choice (const :tag "Barest minimum of highlighting." remind-conf-font-lock-keywords-1)
(const :tag "Medium highlighting." remind-conf-font-lock-keywords-2)
(const :tag "Highlighting deluxe." remind-conf-font-lock-keywords-3)))
;;; Indentation (I'm sure this could be made more simple. But at least it works.)
(defcustom remind-indent-level 4
"User definable indentation."
:group 'remind-conf
:type '(integer)
)
(defun remind-indent-line ()
"Indent current line for remind configuration files."
(interactive)
(forward-line 0) ;remember this happens on every line as it is done per line basis
(if (bobp)
(indent-line-to 0)
(let ((not-indented t) cur-indent)
(if (looking-at "^[ \t]*\\<\\(ENDIF\\|POP\\(?:-OMIT-CONTEXT\\)?\\)\\>")
(progn
(save-excursion
(forward-line -1)
(setq cur-indent (- (current-indentation) remind-indent-level))) ;note that not-indented is still t
(if (< cur-indent 0) (setq cur-indent 0)))
(save-excursion
(while not-indented
(forward-line -1)
(if (looking-at "^[ \t]*\\<\\(ENDIF\\|POP\\(?:-OMIT-CONTEXT\\)?\\)\\>")
(progn
(setq cur-indent 0)
(delete-horizontal-space) ;don't know why I need this when other similar indent functions don't.
(setq not-indented nil))
(if (looking-at "\\<\\(IF\\(?:TRIG\\)?\\|PUSH\\(?:-OMIT-CONTEXT\\)?\\)\\>")
(progn
(setq cur-indent remind-indent-level)
(setq not-indented nil))
(if (bobp)
(setq not-indented nil))))))
(if cur-indent
(indent-line-to cur-indent)
(indent-line-to 0))))))
;;; Convenience functions
(define-skeleton rem-skel
"Skeleton to insert a rem line in a remind configuration file."
nil
"REM "(skeleton-read "Date? " )
("Optional: How many days ahead? " " +" str )
resume:
("Optional: At what time? Format eg 13:00. " " AT " str)
resume:
("Optional: How many minutes ahead? " " +" str )
resume:
("Optional: At what priority? eg 0-9999" " PRIORITY " str )
resume:
" MSG %\"" (skeleton-read "Your message? " )"%b%\"%" \n
)
(define-skeleton rem-today-skel
"Skeleton to insert a line for today's date."
nil
"REM " (format-time-string "%d %b %Y")
("Optional: At what time? Format eg 13:20. " " AT " str)
resume:
("Optional: How many minutes ahead? " " +" str )
resume:
("Optional: At what priority? eg 0-9999" " PRIORITY " str )
resume:
" MSG " (skeleton-read "Your message? " )"%b.%" \n
)
(defun rem-today ()
"Insert the date for today in a remind friendly style."
(interactive)
(insert (format-time-string "%e %b %Y")))
(defun rem-tomorrow ()
"Insert tomorrow's date in a remind friendly style."
(interactive)
(insert (format-time-string "%e %b %Y" (time-add (current-time) (days-to-time 1)))))
(defun rem-days-away (arg)
"Insert a day N number of days in the future.
Takes a prefix argument, but defaults to 4."
(interactive "nHow many Days?: ")
(insert (format-time-string "%e %b %Y" (time-add (current-time) (days-to-time arg)))))
(defun rem-week-away ()
"Insert a day 7 days in the future."
(interactive)
(insert (format-time-string "%e %b %Y" (time-add (current-time) (days-to-time 7)))))
(setq skeleton-end-hook nil) ; so the skeletons will not automatically go to a new line.
;;; private function
;; could make it useful for others. Put somethin like the following in your .emacs
;(setq rem-post-save-function "~/bin/dailypic &")
(defun rem-save-file ()
"Save the file and start the shell function in one go.
This function will close the window after running. It needs the
variable `rem-post-save-function' to be set. It will be most
useful to people who have some sort of function they run to use
remind data ie procucing calendars."
(interactive)
(if (boundp 'rem-post-save-function)
(progn (save-buffer)
(shell-command rem-post-save-function)
(kill-buffer-and-window))
(error "`rem-post-save-function' variable is not set")))
(defun rem-setup-colors ()
"Insert set of variables for coloured output in remind messages."
(interactive)
(find-file (expand-file-name "~/.reminders"))
(goto-char 0) ;we do want it somewhere near the top of the file.
(save-excursion
(re-search-forward "\n\n"); squeeze it in where you have a free line.
(insert "\nSET Esc CHAR(27)
SET Nrm Esc + \"[0m\"
SET Blk Esc + \"[0;30m\"
SET Red Esc + \"[0;31m\"
SET Grn Esc + \"[0;32m\"
SET Ylw Esc + \"[0;33m\"
SET Blu Esc + \"[0;34m\"
SET Mag Esc + \"[0;35m\"
SET Cyn Esc + \"[0;36m\"
SET Wht Esc + \"[0;37m\"
SET Gry Esc + \"[30;1m\"
SET BrRed Esc + \"[31;1m\"
SET BrGrn Esc + \"[32;1m\"
SET BrYlw Esc + \"[33;1m\"
SET BrBlu Esc + \"[34;1m\"
SET BrMag Esc + \"[35;1m\"
SET BrCyn Esc + \"[36;1m\"
SET BrWht Esc + \"[37;1m\" \n \n")))
;; So now you can do things like:
(define-skeleton birthcol
"Make birthdays magenta.
Acts on the region or places point where it needs to be."
nil
"[Mag]" _ " [Nrm]")
;; finally the derived mode.
;;;###autoload
(define-derived-mode remind-conf-mode text-mode "REM"
"Major mode for editing remind calendar configuration files.
\\{remind-conf-mode-map}"
:syntax-table remind-conf-syntax-table
(set (make-local-variable 'font-lock-keywords-case-fold-search) t) ;this is not working atm 2009-04-13
(set (make-local-variable 'font-lock-defaults) '(remind-conf-font-lock-keywords))
(set (make-local-variable 'comment-start) ";")
(set (make-local-variable 'comment-start) "#")
(set (make-local-variable 'comment-end) "\n")
(set (make-local-variable 'fill-column) '100);cause I was having problems with autofill.
(set (make-local-variable 'indent-line-function) 'remind-indent-line)
(use-local-map remind-conf-mode-map)
)
(provide 'remind-conf-mode)
;;; remind-conf-mode.el ends here
;;; Indentation code
;;; work out how to make the syntax highlighting work only before the (MSG|MSF)
;;; keywords and not after.
;;; for my own use. keymap to save file and do dailypic C-c C-c in time honoured tradition?

View File

@@ -1,4 +1,4 @@
REMIND version 3.1 for UNIX
REMIND version 3.2 for UNIX
REMIND is a sophisticated alarm/calendar program. Details are given
in the man page, "remind.1".
@@ -6,16 +6,16 @@ in the man page, "remind.1".
INSTALLING REMIND:
-----------------
If you have Tcl/Tk (wish 4.1 or higher) installed and are running X Windows:
--------------------------------------------------------------
If you have Tcl/Tk (wish 4.1 or higher) installed and are running X11:
----------------------------------------------------------------------
1) Type: wish ./build.tk from the top-level Remind directory.
Fill in the various options and hit "Build Remind"
2) Type: "make install" -- you may need to be root to do this.
If you do NOT have Tcl/Tk or are NOT running X Windows:
-------------------------------------------------------
If you do NOT have Tcl/Tk or are NOT running X11:
-------------------------------------------------
1) Edit the file "src/custom.h" according to your preferences.
@@ -73,12 +73,12 @@ RELEASE NOTES -- miscellaneous info that couldn't go anywhere else!
1. POPUP REMINDERS
If you're running under X-Windows and you have the TCL tools,
you can create simple pop-up reminders by creating the following
TCL script called 'popup'. It pops a message on to the screen and
waits for you to press the 'OK' button. If you don't press the OK button
within 15 seconds, it exits anyway. To use it, you can use the '-k' option
for Remind as follows:
If you're running under X11 and you have the Tcl tools, you can create
simple pop-up reminders by creating the following Tcl script called
'popup'. It pops a message on to the screen and waits for you to
press the 'OK' button. If you don't press the OK button within 15
seconds, it exits anyway. To use it, you can use the '-k' option for
Remind as follows:
remind "-kpopup '%s'&" .reminders
@@ -93,12 +93,12 @@ Norman Walsh.
#!/usr/local/bin/wish
wm withdraw .
after 15000 { destroy . ; exit }
tk_dialog .d { Message } $argv warning 0 { OK }
tk_dialog .d { Message } $argv warning 0 { OK }
destroy .
exit
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
--
David F. Skoll <dfs@roaringpenguin.com>
http://www.roaringpenguin.com/remind/
Dianne Skoll <dianne@skoll.ca>
https://dianne.skoll.ca/projects/remind/

View File

@@ -1,5 +1,428 @@
CHANGES TO REMIND
* VERSION 3.3 Patch 9 - 2021-10-14
- NEW FEATURE: Add "-+username" option to tell Remind to trust files owned by
"username" and allow RUN directives in them. Idea courtesy of Ian! D. Allen
- NEW FEATURE: Add "-u+username" variant to tell Remind to switch users to
"username" without disabling RUN directices. Idea courtesy of Ian! D. Allen
- CHANGE: rem2html: rem2html has been moved out of the www/ directory into
its own rem2html/ directory. If your system has the prerequisites
(namely Perl, Getopt::Long and JSON::Any) then rem2html will be installed
by "make install".
- CHANGE: Remove "cm2rem". It was about 20 years obsolete.
- CHANGE: rem2html: Use inline data: URL images for moon images by default,
thus producing a completely stand-alone HTML file.
- CHANGE: Remove unnecessary spaces from "remind -pp" JSON output.
- DOCUMENTATION FIX: Various man page fixes and tweaks.
- BUG FIX: rem2html: Tweak the default CSS stylesheet; more rational
handling of rem2html command-line options.
- BUG FIX: remind: "remind -c" would sometimes highlight *two* days as
"today"; this has been fixed.
- BUG FIX: Add a missing #ifdef...#endif and remove a C99-ism. This once again
allows Remind to be compiled with some very old C compilers.
* VERSION 3.3 Patch 8 - 2021-09-13
- NEW FEATURE: remind: Add INCLUDECMD command
- NEW FEATURE: remind: Add shellescape() built-in function
- BUG FIX: tkremind: TkRemind would sometimes fill in incorrect initial
values for the reminder-editing form if you clicked on a TkRemind-created
reminder to edit it. This has been fixed.
- BUG FIX: tkremind: Get back better error messages from Remind if you
try to create a reminder with an invalid date specification.
- BUG FIX: remind: Catch integer overflow if we try to evaluate $IntMin * -1
- DOC UPDATES: remind: Minor man page fixes
* VERSION 3.3 Patch 7 - 2021-05-10
- MINOR FIX: Refuse to run "make test" as root --- it would fail
anyway with an obscure message.
- BUG FIX: Remind would sometimes compute incorrect trigger date for:
REM Tue 29 Feb MSG ...
- BUG FIX: Remind would sometimes compute incorrect trigger date for
a date spec like: Tue 31 2021 MSG ...
* VERSION 3.3 Patch 6 - 2021-03-30
- test/test.rem: Change local to en_US.utf-8 only if current locale
is not a UTF-8 locale.
- MINOR CHANGE: Remind's arithemtic operators (+, -, *, /) give errors
on overflow rather than silently giving the wrong answer.
- MINOR CHANGE: Add $IntMin and $IntMax system variables.
- DOCUMENTATION FIX: Document that TkRemind now requires Tcl/Tk version
8.5 or newer.
* VERSION 3.3 Patch 5 - 2021-01-21
- NEW FEATURE: tkremind: Add ability to change fonts and colors from
within TkRemind "Options" dialog.
- CHANGE: tkremind: TkRemind now requires Tcl/Tk 8.5 or newer.
- CHANGE: tkremind: You can specify the location of the options
file on the command-line if you want to use one other than ~/.tkremindrc
- CLEANUP: tkremind: Remove "Apply Options" from Options dialog; we only
need "Save Options".
- DOC FIX: Add missing release note in 3.3.4 notes regarding
setpagedevice patch
- DOC FIX: tkremind: Document shortcut keys.
* VERSION 3.3 Patch 4 - 2021-01-12
- NEW FEATURE: If "inotifywait" is installed, TkRemind uses it to refresh
the calendar display right away when the reminders file/directory is updated.
This makes TkRemind react almost instantly if external tools are editing
or updating reminders.
- MINOR NEW FEATURE: rem2ps has a new '-x' option; this puts the day numbers
on the top-left of the day's box instead of the top-right.
- MINOR FIXES: A typo in remind.1 was fixed; additional comments regarding
UNTIL were added.
- BUG FIX: rem2ps: Call setpagedevice to set page size. Based on a patch
from Jonathan Kamens.
* VERSION 3.3 Patch 3 - 2020-11-09
- BUG FIX: Fix startup crash in TkRemind if "Show Today's Reminders on
Startup" is enabled (which, unfortunately, is the default.) Bug reported
by Martin Ziemer.
* VERSION 3.3 Patch 2 - 2020-11-08
- MINOR NEW FEATURE: Add MAYBE-UNCOMPUTABLE keyword; see the man page
and discussion at
https://dianne.skoll.ca/pipermail/remind-fans/2020/003745.html
- CHANGE: TkRemind always invokes Remind with the "-itkremind=1" option,
even when printing. NOTE INCOMPATIBILITY: This is a behavior change!
When you print from TkRemind, we also invoke Remind with "-itkprint=1"
so you can detect that PostScript is being generated.
- CHANGE: The maxmimum length of a variable name has been increased from
16 characters to 64 characters. Modern computers have plenty of memory.
- BUG FIXES: Minor documentation updates, typo fixes, clarifications, etc.
- BUG FIX: Fix calendar-drawing alignment errors when displaying UTF-8
strings with zero-width combining characters and strings with tabs.
- BUG FIX: TkRemind would mess up placement of the WEEK special if invoked
with the "-m" option. This has been fixed.
- BUG FIX: TkRemind would sometimes fail with an error message when editing
a reminder; this is because it was interpreting months 08 and 09 as
illegal octal numbers. This has been fixed.
* VERSION 3.3 Patch 1 - 2020-03-20
- CHANGE: For overlapping multi-day events, issue a reminder for the
most *recent* event rather than the earliest event. NOTE
INCOMPATIBILITY: This is a behavior change!
- CHANGE: Do not convert 90-99 to 1990-1999 when parsing numbers to
recognize years. NOTE INCOMPATIBILITY: This is a behavior change!
- CHANGE: Revert change to -y option that included filename and line
number in the hash.
- CHANGE: Retain newlines (produced by %_) in JSON output.
- FIX: Document $FormWidth system variable
- FIX: Highlight today's date in "remind -c" output
- FIX: Eliminate compiler warnings on Ubuntu 18.04.
- IMPROVEMENT: Allow times to be specified either in 24-hour mode
(HH:MM or HH.MM) or AM/PM mode (HH:MMam; HH:MMpm, etc.)
- IMPROVEMENT: Allow DURATION to be specified as a time (1:30) or a
number of minutes (90).
- IMPROVEMENT: If terminal size can be determined, set $FormWidth to
terminal width - 8; if not, set $FormWidth to 72.
- MINOR IMPROVEMENT: Add the "ampm()" built-in function.
* Version 3.3 Patch 0 - 2020-01-31
- FIX: rem2ps: Add a %%PageBoundingBox: document structuring convention
comment.
- FIX: rem2ps: Ignore unknown SPECIAL-type reminders.
- IMPROVEMENT: In calendar mode ("-c" option), Remind automatically adjusts
the width of the calendar to fit the terminal window if standard output
is a TTY.
- IMPROVEMENT: Add JSON-based output with "remind -pp" and "remind -ppp"
The JSON-based intermediate format preserves a lot more information
about the original reminder, allowing back-ends more insight into
the intent of the reminder, the recurrence used, etc. See the documentation
in "man rem2ps"
- IMPROVEMENT: TkRemind can "reverse-engineer" reminders that it creates
using the additional information in the "remind -pp" format, so it
doesn't create or use ugly comment blocks to delimit the reminders
it creates.
- IMPROVEMENT: TkRemind: Add popup help to most buttons and controls.
- NEW FEATURE: Add support for $DefaultColor system variable, suggested
by Tim Chase.
- NEW FEATURE: The "-@[n][,m]" command-line option allows colored reminders
in Agenda Mode as well as in Calendar Mode. It also adds support for
terminal emulators that can handle the xterm 256-color escape sequences
as well as the true 24-bit color escape sequences.
- CHANGE: SPECIALs are now case-insensitive. Before, only SPECIAL COLOR
would work. Now you can use Special Color, special color, etc.
* Version 3.2 Patch 0 - 2020-01-03
- IMPROVEMENT: Add support for events spanning multiple days (with AT
and DURATION). Add trigeventstart() and trigeventduration()
introspection functions; see "MULTI-DAY EVENTS" in the man page.
- IMPROVEMENT: Add introspection functions trigback(), trigdelta(),
trigduration(), trigfrom(), trigpriority(), trigrep(),
trigscanfrom(), trigtimedelta(), trigtimerep(), and triguntil(). See
man page for details; thanks to Tim Chase for the suggestion.
- IMPROVEMENT: TkRemind: Use PNG images for the next month / previous
month buttons rather than -> and <-. Also use nice anti-aliased
moon phase images instead of ugly blocky bitmaps.
- CHANGE: Modify addition so that previously-illegal combinations
TIME + TIME, TIME + DATETIME and DATETIME + TIME are now allowed.
Also allow DATETIME - TIME. If t1 and t2 are expressions of type TIME
and dt is an expression of type DATETIME, then the following are now
equivalent (before, the expressions on the left-hand side would fail
with a "Type mismatch" error.)
t1 + t2 == t1 + coerce("INT", t2)
dt + t2 == dt + coerce("INT", t2)
t1 + dt == coerce("INT", t1) + dt
dt - t2 == dt - coerce("INT", t2)
- DOC FIX: Document previously-undocumented $MaxStringLen system variable
- DOC FIX: Various minor documentation fixes.
- BUG FIX: Specifying a DURATION without an AT clause results in an error.
Before, it would be accepted but not do anything useful.
- BUG FIX: Catch potential date overflow in slide() function
- BUG FIX: Fix compile error when compiling Romanian version; eliminate
compiler warning when compiling non-English versions.
- BUG FIX: TkRemind: Fix startup failure of TkRemind if options are at
default. :(
* Version 3.1 Patch 17 - 2019-11-15
- IMPROVEMENT: Add "Extra Remind Options" setting to TkRemind.
- IMPROVEMENT: Enable warning-free compilation even with gcc -Wextra flag.
- IMPROVEMENT: Warn if "OMIT a THROUGH b" has a > b.
- SYNTACTIC SUGAR: Make "SCANFROM -n" the same as "SCANFROM [today() - n]"
- BUG FIX: Don't dump expired reminders when dumping queue.
- BUG FIX: Fix failure when specifying a Jahrzeit in Adar. Fix
courtesy of Dov Feldstern
- BUG FIX: Fix various documentation errors and update man page.
* Version 3.1 Patch 16 - 2018-11-09
- IMPROVEMENT: Add patch from Stephen Morgan to calculate astronomical and
nautical twilight in addition to civil twilight.
- BUG FIX: The rem2html script correctly handles a SHADE special with only
one number (a grey level).
- IMPROVEMENT: Remind accepts DATETIME constants in ISO-8601 format and can
optionally be configured to output them that way too.
- MINOR IMPROVEMENT: TkRemind puts its hostname in the window title bar.
- MINOR IMPROVEMENT: TkRemind restarts the background remind daemon if
the .reminders file changes
- MINOR IMPROVEMENT: TkRemind has a "Queue" button that lets you see details
of upcoming queued reminders. This is mostly for debugging and the output
is not particularly readable.
- BUG FIX: The definitions form Yom Hazikaron and Yom Ha'atzmaut were not
quite right; they have been fixed.
- MINOR IMPROVEMENT: TkRemind centers popups over the main calendar
window rather than over the desktop background. This is better
behavior in multi-monitor setups.
- BUG FIX: In "remind -z0" mode, remind wakes up exactly on the minute instead
of sleeping for 60 seconds each time, which could cause it to fall behind.
* Version 3.1 Patch 15 - 2015-07-27
- BUG FIX: Fix a buffer overflow found by Alexander Keller
- BUG FIX: Fix a typo in this file: was 2014 instead of 2015.
- BUG FIX: Make parser reject an AT followed by more than one time.
- BUG FIX: Make parser reject epeated delta or *repeat values.
* Version 3.1 Patch 14 - 2015-04-24
- NEW FEATURE: Putting the line __EOF__ in a .rem file causes Remind
to treat it as end-of-file.
- IMPROVEMENT: Use better PNG images for moons in the HTML display
- CHANGE: Author name updated from "David" to "Dianne"
- BUG FIX: The "-n" command-line option should really run in "ADVANCE_MODE"
rather than "CAL_MODE" internally; otherwise, the substitution sequences
may be misinterpreted.
- BUG FIX: A typo in clearing out MD5 sum context has been fixed.
- BUG FIX: Typo in Spanish translation was fixed.
* Version 3.1 Patch 13 - 2013-03-22
- BUG FIX: Sunrise/Sunset calculations greatly improved thanks to John
McGowan. Accuracy should now be within a couple of minutes in most
places.
- BUG FIX: Allow specification of margins as low as 0 points in rem2ps,
courtesy of Jonathan Kamens.
- BUG FIX: Permit compilation with gcc 2.95 (which doesn't allow variable
declarations after non-declaration statements in a block.)
- BUG FIX: Several minor documentation errors corrected courtesy of
Simon Ruderich.
- BUG FIX: Spurious test harness failure was fixed.
* Version 3.1 Patch 12 - 2012-01-23
- NEW FEATURE: Many substitution sequences "%x" have an alternate mode
denoted by "%*x". This alternate mode leaves out prepositions. For
example, in English "%i" might yield "on 01-25" while "%*i" yields only
"01-25".
- BUG FIX: The "dusk" and "dawn" calculations were completely wrong. They
have been fixed. Also, sunrise/sunset calculations have been tweaked,
so the results may be off by a minute or two compared to previous versions
of Remind.
* Version 3.1 Patch 11 - 2011-12-16
- BUG FIX: For some inexplicable reason, dawn was considered to happen when
the sun was 14 degrees below the horizon instead of the standard 6
degrees for Civil Dawn. This has been fixed.
- BUG FIXES: Clarified the man pages and fixed some typos.
- BUG FIX: Add THROUGH to the remind.vim syntax highlighting file.
- ENHANCEMENT (?): Allow SPECIAL COLOR to be spelled SPECIAL COLOUR.
- BUG FIX: Apply minor Debian cleanups reported by Kurt B. Kaiser.
* Version 3.1 Patch 10 - 2010-11-01
- NOTE: This is the 20th anniversary of Remind's first public release.
- ENHANCEMENT: Add the THROUGH keyword. You can omit blocks of dates with:
OMIT start THROUGH end
and the syntax REM start THROUGH end is equivalent to REM start *1 UNTIL end
- ENHANCEMENT: Add support for multibyte characters (eg, UTF-8) in calendar
output. Note that UTF-8 strings are still not supported in PostScript
output.
- ENHANCEMENT: Add support for UTF-8 line-drawing characters in calendar
output.
- ENHANCEMENT: You can have multiple TAG clauses in a REM statement.
- BUG FIX: Avoid spawning long-running background processes in "make test".
- BUG FIX: Don't declare variables in the middle of statements (old C
compilers choke.)
* Version 3.1 Patch 9 - 2010-06-20
- MAJOR ENHANCEMENT: New "purge mode" to delete expired reminders. See
the PURGE MODE section of the remind man page.
- ENHANCEMENT: Support DURATION in TkRemind. Thanks to Marek Marczykowski.
- BUG FIX: Don't change the order of PS and PSFILE reminders. Bug found
by John McGowan.
- BUG FIX: "REM 1990-01-01 SATISFY 1" would yield a spurious parse error
in earlier versions of Remind.
- BUG FIX: Yom HaShoah is moved to Thursday if it would normally fall on
a Friday. Thanks to Jonathan Kamens for pointing this out.
* Version 3.1 Patch 8 - 2010-03-09
- ENHANCEMENT: Include some useful scripts in contrib/
- ENHANCEMENT: Add the $T, $Td, $Tm, $Tw, $Ty, $U, $Ud, $Um, $Uw, $Uy
special variables to make reminder files less wordy. See man page
for details.
- MINOR ENHANCEMENT: Set an icon photo window manager resource on TkRemind.
- POLICY CHANGE: Discourage use of Remind on MS Windows or Apple Mac OS X.
- BUG FIX: Ignore msgprefix() and msgsuffix() on RUN-type reminders.
- BUG FIX: Adjust Remind and Rem2PS so that SHADE specials don't obliterate
earlier MOON specials.
- BUG FIX: Fix bug in SCHED calculations if Remind is started in the middle
of a SCHED interval.
* Version 3.1 Patch 7 - 2009-05-31
- ENHANCEMENT: Wherever you could write "day Mon year", the parser now
@@ -136,7 +559,7 @@ CHANGES TO REMIND
*** THIS MAY AFFECT BACKENDS ***
Backends supplied by Roaring Penguin (rem2ps, rem2html and tkremind)
Backends supplied with Remind (rem2ps, rem2html and tkremind)
are known to work properly.
- "remind -p" no longer suppresses any AT-time associated with SPECIAL
@@ -144,7 +567,7 @@ CHANGES TO REMIND
*** THIS MAY AFFECT BACKENDS ***
Backends supplied by Roaring Penguin (rem2ps, rem2html and tkremind)
Backends supplied with Remind (rem2ps, rem2html and tkremind)
are known to work properly.
+ BUG FIXES
@@ -357,11 +780,6 @@ CHANGES TO REMIND
* Version 3.0 Patch 20 - 1999-04-12
+ NEWS
- I have started a company, Roaring Penguin Software
Inc. (http://www.roaringpenguin.com) and it now holds the Remind copyright.
+ LICENSE CHANGE
- Remind is now distributed under the pure GPL. See the file WINDOWS for my
@@ -377,8 +795,6 @@ CHANGES TO REMIND
+ BUG FIXES
- Changed copyright notices to Roaring Penguin Software Inc.
- Rem2PS was passing specials like HTML, etc. in PostScript output.
YECH! Fix courtesty of Derek J. Decker.
@@ -476,7 +892,7 @@ CHANGES TO REMIND
+ BUG FIXES
- Fixed sunset(), sunrise() and minsfromutc() functions which were broken
by 3.0.17. (In 3.0.17, they did not account for daylight savings time.)
by 3.0.17. (In 3.0.17, they did not account for daylight saving time.)
- Updated "finnish.h" to include proper URL and translation of all
error messages.

View File

@@ -17,8 +17,7 @@
# "#COLORS" for examples of ANSI color escape sequences. #
# #
# This file is part of REMIND. #
# Copyright (C) 1992-1997 David F. Skoll #
# Copyright (C) 1999-2000 Roaring Penguin Software Inc. #
# Copyright (C) 1992-2018 Dianne Skoll #
# #
#############################################################################
@@ -27,8 +26,8 @@ RUN OFF
################################################
# Ensure required version of remind is used... #
################################################
IF version() < "03.01.07"
ERRMSG This file requires at least version 03.01.07 of Remind.%
IF version() < "03.01.09"
ERRMSG This file requires at least version 03.01.09 of Remind.%
ERRMSG This version is version [version()].
EXIT
ENDIF
@@ -85,7 +84,6 @@ SET December 12
###########################################################
# Other symbolic constants and functions for "pasting"... #
###########################################################
SET Quote CHAR(34)
# Handy constants/function for specifing week of month...
@@ -96,29 +94,17 @@ SET Week_4 22
FSET _last(mo) "1 " + MON((mo%12)+1) + " --7"
# Handy function to provide SCANFROM dates...
FSET _back(days) TODAY()-days
###########################################################
# Function which returns a string in "am/pm" format based #
# on the time. For example, set a am_pm(NOW())... #
###########################################################
FSET _am_pm(tm) IIF(tm<01:00, tm+12*60+"am", \
tm<12:00, tm+"am", \
tm<13:00, tm+"pm", \
tm-12*60+"pm")
FSET _back(days) $U-days
#################################################################
# Function which removes a single leading zero from a string... #
# Function that removes a single leading zero from a string... #
#################################################################
FSET _no_lz(s) IIF(SUBSTR(s, 1, 1)=="0", SUBSTR(s, 2), s)
#################################################################
# Return the length of the daylight/night portion of a date, #
# in minutes. #
#################################################################
FSET _light_len(date) MAX(SUNSET(date)-SUNRISE(date), 0)
FSET _dark_len(date) 1440-_light_len(date)
@@ -126,26 +112,12 @@ FSET _dark_len(date) 1440-_light_len(date)
# Function to calculate number of years since a given year #
# or number of months since a given month and year... #
############################################################
FSET _yr_num(yr) ORD(YEAR(TRIGDATE()) - yr)
FSET _mo_num(mo, yr) ORD(12 * (YEAR(TRIGDATE()) - yr) + \
MONNUM(TRIGDATE()) - mo)
FSET _yr_num(yr) ORD($Ty - yr)
FSET _mo_num(mo, yr) ORD(12 * ($Ty - yr) + $Tm - mo)
# Here's an example of how to use them:
REM 1 Nov ++12 MSG %"Dean's [_yr_num(1984)] birthday%" is %b.
REM 1 MSG Dean's [_mo_num(11, 1984)] 'monthly' anniversary
###########################################################
# Function to send mail via elm's "fastmail" (by GMS!)... #
###########################################################
#FSET _mail(from, subj) "mailx -s " + \
# Quote + from + " : " + subj + Quote \
# GETENV("LOGNAME") + " < /dev/null 1>&0"
FSET _mail(from, subj) "fastmail -f " + \
Quote + from + Quote + \
" -s " + Quote + subj + Quote + \
" /dev/null " + GETENV("LOGNAME")
REM 1 Nov ++12 MSG %"John's [_yr_num(1984)] birthday%" is %b.
REM 1 MSG John's [_mo_num(11, 1984)] 'monthly' anniversary
#############################################################################
# Here's a tricky problem: The 4th of July is a holiday in the U.S.
@@ -159,29 +131,28 @@ FSET _mail(from, subj) "fastmail -f " + \
# dependent upon the current date, it's tricky and results may not be
# what you expect. You should try to make sure that the OMIT context
# "near" any current reminders will not change during a calendar run.
# The SCANFROM clause should help make these OMITs very safe.
# The SCANFROM clause will make these OMITs safe.
############################################################################
# Calculate the weekday of the holiday.
REM 4 July SCANFROM [_back(7)] SATISFY 1
IF WKDAYNUM(TRIGDATE()) == Sat
REM [TRIGDATE()] MSG Independence day (actual)
OMIT [TRIGDATE()-1] MSG Independence day (observed)
SET iday $T
IF WKDAYNUM(iday) == Sat
REM [iday] MSG Independence day (actual)
OMIT [iday-1] MSG Independence day (observed)
ELSE
IF WKDAYNUM(TRIGDATE()) == Sun
REM [TRIGDATE()] MSG Independence day (actual)
OMIT [TRIGDATE()+1] MSG Independence day (observed)
IF WKDAYNUM(iday) == Sun
REM [iday] MSG Independence day (actual)
OMIT [iday+1] MSG Independence day (observed)
ELSE
OMIT [TRIGDATE()] MSG Independence day
OMIT [iday] MSG Independence day
ENDIF
ENDIF
############################################################################
# #
# A meeting on the first Monday of every month which is moved to the #
# second Monday in the event of a holiday. #
# #
############################################################################
# First, the normal meeting. However, the SKIP keyword means this
@@ -193,68 +164,21 @@ REM Mon 8 SATISFY 1
# But only actually trigger the delayed meeting if the previous
# Monday was a holiday
IF ISOMITTED(TRIGDATE()-7)
REM [TRIGDATE()] MSG Delayed meeting
IF ISOMITTED($T-7)
REM [$T] MSG Delayed meeting
ENDIF
############################################################################
# #
# A very complicated reminder sent in by a Remind user. #
# This person gets paid every two weeks, starting from 8 January 1993. #
# If a pay date occurs before the twelfth of a month, then that #
# he pays his mortgage on that pay date. Otherwise, he pays the mortgage #
# on the previous pay date. Furthermore, he has to schedule his #
# mortgage payment six days before it is due. He wants to be reminded #
# a further four days before the scheduling deadline. He also #
# wants to be mailed a notice two weeks before the scheduling deadline. #
# #
# Here's the solution - if you can follow this, consider yourself a #
# Remind programmer extraordinaire! #
# #
############################################################################
# A function to determine whether or not a pay-date is a mortgage-date.
FSET _IsMortDate(x) DAY(x) < 12 || (DAY(x+14) >= 12 && DAY(x+14) <= 14)
# Paydays - for reference
REM 8 Jan 1993 *14 MSG Payday
# Calculate the mortgage payment six days ahead of time. Note that this
# is done "implicitly" by subtracting 6 from the starting date - we start
# on 2 Jan rather than 8 Jan. We add 6 to TRIGDATE() in _IsMortDate to
# compensate.
REM 2 Jan 1993 *14 ++4 SATISFY [_IsMortDate(TRIGDATE()+6)] \
MSG %"Schedule mortgage payment%" for %a.
# Now the mail reminder two weeks before the payment date - because two
# weeks before a payment date is also a payment date, no pre-compensation
# in the starting date of 8 Jan is necessary - convince yourself of this!
# This uses the _mail() function defined earlier.
REM ONCE 8 Jan 1993 *14 SATISFY [_IsMortDate(TRIGDATE()+14)] \
RUN [_mail("Decatur Federal", \
"Pay mortgage by the " + ORD(DAY(TRIGDATE()+14)))]
# Make an entry on the calendar when the mortgage should be paid
REM 8 Jan 1993 *14 SATISFY [_IsMortDate(TRIGDATE())] \
CAL Mortgage payment
##########################################################################
# #
# On our UNIX system, I run a program which queries the university #
# On our UNIX system, I run a program that queries the university #
# library and creates a file called ".booksdue". This file is #
# a REMIND script to tell me when my library books are due. Here's #
# an example from my reminder file - it shows the use of filedate(). #
# When the .booksdue file is at least 7 days old, I create a new version #
# by querying the library computer. Note the use of realtoday() rather #
# than today. #
# than today(). #
# #
##########################################################################
IF !$RunOff && !$CalMode && !$SimpleCal
IF REALTODAY()-FILEDATE("/home/dfs/.booksdue") >= 7
REM RUN /home/dfs/bilge/library/getbooks
@@ -284,7 +208,7 @@ REM Sat Sun SPECIAL SHADE 220
#############################################################################
SET SaveTrig $NumTrig
SET easter EASTERDATE(YEAR(TODAY()))
SET easter EASTERDATE($Uy)
REM [easter-46] MSG %"Ash Wednesday%"
REM [easter-7] MSG %"Palm Sunday%"
OMIT [easter-2] MSG %"Good Friday%"
@@ -302,13 +226,16 @@ REM Mon Jan [Week_3] MSG Martin Luther King - %"MLK Day%"
REM Feb 2 MSG %"Ground Hog Day%"
REM Feb 14 MSG %"Valentine's%" Day
REM Mon Feb [Week_3] SCANFROM [_back(7)] SATISFY 1
OMIT [trigdate()] MSG %"President's Day%"
OMIT [$T] MSG %"President's Day%"
REM Mar 17 MSG %"St. Patrick's%" Day
# 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 Sun Apr 1 ++2 UNTIL 1 Jan 2007 MSG Daylight Saving Time - %"DST starts%" %b
REM Sun Mar 8 ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST starts%" %b
REM Sun [_last(Oct)] ++2 UNTIL 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
REM Sun 1 Nov ++2 FROM 1 Jan 2007 MSG Daylight Saving Time - %"DST ends%" %b
REM Apr 1 MSG %"April Fool's%" Day
REM Mon Tue Wed Thu Fri Sat 15 Apr MSG %"Income tax%" due
@@ -317,28 +244,23 @@ REM Sat May [Week_1] MSG %"Kentucky Derby%"
REM Sun May [Week_2] MSG %"Mother's Day%"
REM Sat May [Week_3] MSG %"Armed Forces Day%"
REM Mon [_last(May)] SCANFROM [_back(7)] SATISFY 1
OMIT [trigdate()] MSG %"Memorial Day%"
OMIT [$T] MSG %"Memorial Day%"
REM Jun 14 MSG %"Flag Day%"
REM Sun Jun [Week_3] MSG %"Father's Day%"
REM Mon Sep [Week_1] SCANFROM [_back(7)] SATISFY 1
OMIT [trigdate()] MSG %"Labor Day%"
OMIT [$T] MSG %"Labor Day%"
REM Mon Oct [Week_2] MSG %"Columbus Day%"
REM Nov 11 MSG %"Veterans Day%"
# 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)] \
SATISFY [(YEAR(TRIGDATE()) % 4) == 0] \
SATISFY [($Ty % 4) == 0] \
MSG %"Election%" Day
REM Thu Nov [Week_4] SCANFROM [_back(7)] SATISFY 1
OMIT [trigdate()] MSG %"Thanksgiving%" Day
OMIT [$T] MSG %"Thanksgiving%" Day
REM Fri Nov [Week_4+1] SCANFROM [_back(7)] SATISFY 1
OMIT [trigdate()] MSG %"Thanksgiving%" (cont.)
OMIT [$T] MSG %"Thanksgiving%" (cont.)
OMIT Dec 24 MSG %"Christmas Eve%"
OMIT Dec 25 MSG %"Christmas%" Day
@@ -353,13 +275,6 @@ if $NumTrig > SaveTrig
REM SPECIAL SHADE 220
endif
# Seasons (valid from 1992 to 2000)...
REM Mar 20 MSG %"Spring%" begins
REM Jun [IIF(YEAR(TODAY())%4, 21, 20)] MSG %"Summer%" begins
REM Sep [CHOOSE(YEAR(TODAY())-1991, 22,22,23,23,22,22,22,23,22)] \
MSG %"Fall%" begins
REM Dec [IIF((YEAR(TODAY())+1)%4, 21, 22)] MSG %"Winter%" begins
#PSSTUFF2
##########################################################################
# #
@@ -373,7 +288,7 @@ REM Dec [IIF((YEAR(TODAY())+1)%4, 21, 22)] MSG %"Winter%" begins
# example, I recommend that you use the -sd 10 option for Rem2PS.
REM PS Border Border moveto \
/DayFont findfont DaySize scalefont setfont \
([hebday(today())] [hebmon(today())]) show
([hebday($U)] [hebmon($U)]) show
# Fill in the phases of the moon on the PostScript calendar
[moondate(0)] SPECIAL MOON 0
@@ -385,7 +300,7 @@ REM PS Border Border moveto \
# calendar - the sizes are hard-coded, however, and work best in landscape.
REM PS Border Border 5 sub moveto \
/SmallFont findfont 4 scalefont setfont \
(Sunrise: [sunrise(trigdate())] Sunset: [sunset(trigdate())]) show
(Sunrise: [sunrise($T)] Sunset: [sunset($T)]) show
# The next one puts the day number (1-366) and days left in the year at the
# bottom of the post-script calendar. Again, the hard-coded sizes work best
@@ -393,7 +308,7 @@ REM PS Border Border 5 sub moveto \
FSET _DayOfYear(x) x-(date(year(x),1,1) - 1)
REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
/SmallFont findfont 4 scalefont setfont \
([_DayOfYear(today())]([365+isleap(today())-_DayOfYear(today())])) show
([_DayOfYear($U)]([365+isleap($U)-_DayOfYear($U)])) show
#JHOLS
##########################################################################
@@ -402,7 +317,7 @@ REM PS BoxWidth 3 mul 4 div Border 5 sub moveto \
# dates were obtained from "The First Jewish Catalog" by Richard Siegel #
# and Michael and Sharon Strassfeld, published by the Jewish Publication #
# Society of America. The Reform version of the calendar was guessed #
# at by David Skoll based on experience. There is probably no standard #
# at by Dianne Skoll based on experience. There is probably no standard #
# Reform position on many of the holidays, so you may have to adjust #
# the file as required. #
# #
@@ -433,7 +348,7 @@ SET Reform 0
# Convenient function definition to save typing
FSET _h(x, y) HEBDATE(x,y)
FSET _h2(x, y) HEBDATE(x, y, TODAY()-7)
FSET _h2(x, y) HEBDATE(x, y, $U-7)
FSET _PastSat(x, y) IIF(WKDAYNUM(_h2(x,y))!=6, _h2(x,y), _h2(x,y)+1)
FSET _PastSun(x, y) IIF(WKDAYNUM(_h2(x,y))!=0, _h2(x,y), _h2(x,y)+1)
FSET _PastMon(x, y) IIF(WKDAYNUM(_h2(x,y))!=1, _h2(x,y), _h2(x,y)+1)
@@ -467,7 +382,7 @@ ELSE
ENDIF
# Because Kislev can change length, we must be more careful about Chanukah
FSET _chan(x) HEBDATE(24, "Kislev", today()-9)+x
FSET _chan(x) HEBDATE(24, "Kislev", $U-9)+x
[_chan(1)] ++4 MSG %"Chanukah 1%" is %b.
[_chan(2)] MSG %"Chanukah 2%"
[_chan(3)] MSG %"Chanukah 3%"
@@ -508,13 +423,19 @@ IF !InIsrael && !Reform
[_h(22, "Nisan")] MSG %"Pesach 8%"
ENDIF
[_PastSun(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
REM [_PastSun(27, "Nisan")] SATISFY 1
# If 4 Iyar is a Friday, then Yom Hazikaron is
IF $Tw == 5
REM [_PastSun(26, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
ELSE
REM [_PastSun(27, "Nisan")] ++4 MSG %"Yom HaShoah%" is %b.
ENDIF
# If 4 Iyar is a Thursday or 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
IF WKDAYNUM(_h2(4, "Iyar")) == 4 || 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
@@ -550,9 +471,9 @@ ENDIF
# Counting the omer - do the whole spiel, i.e:
# "This is the xth day of the omer, being y weeks and z days of the omer."
# Nice Remind programming example here!
SET ostart HEBDATE(16, "Nisan", TODAY()-50)
IF ostart <= TODAY() && (TODAY() - ostart < 49)
SET odays TODAY()-ostart+1
SET ostart HEBDATE(16, "Nisan", $U-50)
IF ostart <= $U && ($U - ostart < 49)
SET odays $U-ostart+1
IF odays < 7
MSG %"%"Today is the [ORD(odays)] day of the Omer.
ELSE
@@ -570,8 +491,8 @@ ENDIF
### for Friday and Saturday. Note: You must set your latitude, longitude
### and possibly time zone for these to work properly!
REM Friday CAL Candle lighting at [sunset(trigdate())-18]
REM Saturday CAL Havdalah at [sunset(trigdate())+42]
REM Friday CAL Candle lighting at [sunset($T)-18]
REM Saturday CAL Havdalah at [sunset($T)+42]
#COLORS
##########################################################################

View File

@@ -1,53 +1,79 @@
" Vim syntax file
" Language: Remind
" Maintainer: Davide Alberani <alberanid@bigfoot.com>
" Last change: 03 Dec 1999
" Version: 0.1
" URL: http://members.xoom.com/alberanid/vim/syntax/remind.vim
" Maintainer: Davide Alberani <alberanid@libero.it>
" Last Change: 18 Sep 2009
" Version: 0.5
" URL: http://erlug.linux.it/~da/vim/syntax/remind.vim
"
" remind is a sophisticated reminder service
" you can download remind from ftp://ftp.doe.carleton.ca/pub/remind-3.0/
" you can download remind from:
" https://dianne.skoll.ca/projects/remind/
" clear any unwanted syntax defs
syn clear
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" shut case off
" shut case off.
syn case ignore
syn keyword remindCommands REM OMIT SET FSET UNSET
syn keyword remindExpiry UNTIL SCANFROM SCAN WARN SCHED
syn keyword remindExpiry UNTIL FROM SCANFROM SCAN WARN SCHED THROUGH
syn keyword remindTag PRIORITY TAG
syn keyword remindTimed AT DURATION
syn keyword remindMove ONCE SKIP BEFORE AFTER
syn keyword remindSpecial INCLUDE INC BANNER PUSH-OMIT-CONTEXT PUSH CLEAR-OMIT-CONTEXT CLEAR POP-OMIT-CONTEXT POP
syn keyword remindSpecial INCLUDE INC BANNER PUSH-OMIT-CONTEXT PUSH CLEAR-OMIT-CONTEXT CLEAR POP-OMIT-CONTEXT POP COLOR COLOUR
syn keyword remindRun MSG MSF RUN CAL SATISFY SPECIAL PS PSFILE SHADE MOON
syn keyword remindConditional IF ELSE ENDIF IFTRIG
syn keyword remindDebug DEBUG DUMPVARS DUMP ERRMSG FLUSH PRESERVE
syn match remindComment "#.*$"
syn region remindString start=+'+ end=+'+ skip=+\\\\\|\\'+ oneline
syn region remindString start=+"+ end=+"+ skip=+\\\\\|\\"+ oneline
syn keyword remindDebug DEBUG DUMPVARS DUMP ERRMSG FLUSH PRESERVE
syn match remindVar "\$[_a-zA-Z][_a-zA-Z0-9]*"
syn match remindSubst "%[^ ]"
syn match remindAdvanceNumber "\(\*\|+\|-\|++\|--\)[0-9]\+"
" XXX: use different separators for dates and times?
syn match remindDateSeparators "[/:@\.-]" contained
syn match remindTimes "[0-9]\{1,2}[:\.][0-9]\{1,2}" contains=remindDateSeparators
" XXX: why not match only valid dates? Ok, checking for 'Feb the 30' would
" be impossible, but at least check for valid months and times.
syn match remindDates "'[0-9]\{4}[/-][0-9]\{1,2}[/-][0-9]\{1,2}\(@[0-9]\{1,2}[:\.][0-9]\{1,2}\)\?'" contains=remindDateSeparators
" This will match trailing whitespaces that seem to break rem2ps.
" Courtesy of Michael Dunn.
syn match remindWarning display excludenl "\S\s\+$"ms=s+1
if !exists("did_remind_syntax_inits")
let did_remind_syntax_inits = 1
hi link remindCommands Function
hi link remindExpiry Repeat
hi link remindTag Label
hi link remindTimed Statement
hi link remindMove Statement
hi link remindSpecial Include
hi link remindRun Function
hi link remindConditional Conditional
hi link remindComment Comment
hi link remindString String
hi link remindDebug Debug
hi link remindVar Identifier
hi link remindSubst Constant
hi link remindAdvanceNumber Number
if version >= 508 || !exists("did_remind_syn_inits")
if version < 508
let did_remind_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink remindCommands Function
HiLink remindExpiry Repeat
HiLink remindTag Label
HiLink remindTimed Statement
HiLink remindMove Statement
HiLink remindSpecial Include
HiLink remindRun Function
HiLink remindConditional Conditional
HiLink remindComment Comment
HiLink remindTimes String
HiLink remindString String
HiLink remindDebug Debug
HiLink remindVar Identifier
HiLink remindSubst Constant
HiLink remindAdvanceNumber Number
HiLink remindDateSeparators Comment
HiLink remindDates String
HiLink remindWarning Error
delcommand HiLink
endif
let b:current_syntax = "remind"
"EOF vim: ts=8 noet tw=100 sw=8 sts=0
" vim: ts=8 sw=2

View File

@@ -1,28 +0,0 @@
.TH CM2REM 1 "18 October 1999"
.UC4
.SH NAME
cm2rem.tcl \- Convert Sun's "cm" input file to Remind format
.SH SYNOPSIS
.B cm2rem.tcl < cm_file > remind_file
.SH DESCRIPTION
\fBcm2rem.tcl\fR reads the Sun calendar manager data file and converts
it into a \fBRemind\fR script. Note that \fBcm2rem.tcl\fR can convert
\fIonly\fR version 3 calendar manager files. If you are using version 4
files, there should be a system utility to convert them to version 3 files.
.SH AUTHOR
\fBcm2rem.tcl\fR is supported by Roaring Penguin Software
Inc. (http://www.roaringpenguin.com)
.PP
\fBcm2rem.tcl\fR was written by David F. Skoll <dfs@roaringpenguin.com>.
.SH BUGS
Not all of the Sun calendar manager options are respected. In particular,
nothing is done for e-mail actions. Also, the resulting Remind script
is not editable with \fBTkRemind\fR; you can only edit it with a text
editor.
.PP
\fBcm2rem.tcl\fR requires Tcl/Tk version 8.0 or higher. The
\fBtclsh\fR interpreter must be on your \fBpath\fR.
.SH SEE ALSO
\fBremind(1)\fR, \fBtkremind(1)\fR

View File

@@ -1,5 +1,5 @@
.TH REM 1 "30 August 2007"
.UC4
.TH REM 1 "1 January 2021"
.UC 4
.SH NAME
rem \- Invoke Remind with a default filename
.SH SYNOPSIS
@@ -15,6 +15,6 @@ value of DOTREMINDERS as the filename. Otherwise, \fBremind\fR uses
the filename $HOME/.reminders
.PP
.SH AUTHOR
Remind was written by David F. Skoll <dfs@roaringpenguin.com>
Remind was written by Dianne Skoll <dianne@skoll.ca>
.SH SEE ALSO
\fBremind\fR

View File

@@ -1,13 +1,13 @@
.TH REM2PS 1 "11 April 2005"
.UC4
.TH REM2PS 1 "5 January 2021"
.UC 4
.SH NAME
rem2ps \- draw a PostScript calendar from Remind output
.SH SYNOPSIS
.B rem2ps [\fIoptions\fR]
.SH DESCRIPTION
\fBRem2ps\fR reads the standard input, which should be the results of running
\fBRemind\fR with the \fB\-p\fR option. It emits PostScript code (which
draws a calendar) to the standard output.
\fBRem2ps\fR reads the standard input, which should be the results of
running \fBRemind\fR with the \fB\-p\fR or \fB\-pp\fR option. It
emits PostScript code (which draws a calendar) to the standard output.
.PP
See the section "Rem2PS Input Format" for details about the \fB\-p\fR
data. This may be useful if you wish to create other \fBRemind\fR
@@ -29,6 +29,11 @@ include any document structuring comments in your prologue.
Produce the calendar in landscape mode rather than the default
portrait mode.
.TP
.B \-x
When printing the calendar, place the day numbers in the top-left of each
day's box. If this option is omitted, the day numbers appear in the
top-right.
.TP
\fB\-c\fR[\fIn\fR]
If \fIn\fR is omitted, disables the small calendars for next and previous
months which are normally generated. If \fIn\fR is supplied, it can range
@@ -267,7 +272,7 @@ hold:
.TP
o
The PostScript origin is at the bottom left-hand corner of the page, and
PostScript units of 1/72" are in effect.
PostScript units of 1/72 inch are in effect.
.TP
o
The variables MinX, MinY, MaxX and MaxY define the bounding box within
@@ -313,7 +318,13 @@ Use that file with the \fBRem2ps\fR \fB\-p\fR option to create calendars
with the year and month in large grey letters in the background of the
calendar.
.PP
.SH REM2PS INPUT FORMAT
.SH REM2PS INPUT FORMAT (-P OPTION)
The \fB\-p\fR option is an older, simpler interchange format used by
\fBRemind\fR to communicate with back-ends. New back-ends are
encoraged to support the new \fB\-pp\fR format preferably, though they
are encouraged to support the older \fB\-p\fR format as well if the
older format contains enough information for them to work properly.
.PP
\fBRemind \-p\fR sends the following lines to standard output.
The information is designed to be easily parsed by back-end programs:
.TP
@@ -362,7 +373,10 @@ Other back-ends may understand other specials. A back end should
\fIsilently ignore\fR a reminder with a special it doesn't understand.
.PP
\fItag\fR is whatever tag the user provided with the \fBTAG\fR clause,
or "*" if no tag was provided.
or "*" if no tag was provided. If there is more than one \fBTAG\fR clause,
the tags appear in a comma-separated list. For example, the command
\fBREM TAG foo TAG bar TAG quux\fR would result in \fBfoo,bar,quux\fR
in the \fItag\fR field.
.PP
\fIdur\fR is the \fBDURATION\fR value in minutes, or "*" if no duration
was provided.
@@ -372,6 +386,9 @@ was provided.
.PP
\fIbody\fR is the body of the reminder.
.PP
Future versions of \fBRemind\fR may add additional keys to the JSON
object. Back-ends \fImust\fR ignore keys they don't recognize.
.PP
After a month's worth of reminders have been emitted, \fBRemind\fR
emits the line:
.PP
@@ -390,11 +407,249 @@ the line number and file name of the file containing the reminder. Back-ends
that don't care about this information should ignore lines starting with
"#" (except, of course, for the # rem2ps lines.)
.PP
.SH AUTHOR
Rem2PS is now supported by Roaring Penguin Software
Inc. (http://www.roaringpenguin.com)
.SH REM2PS PARTIAL JSON INPUT FORMAT (-PP OPTION)
\fBRemind \-pp\fR sends the following lines to standard output. They
are designed to be easily parsed, but contain much more information
than the old-style \fBremind -p\fR output. The extra information
contains a representation of the parsed "REM" statement, which could
allow converters to better preserve semantics of a reminder. For
example, this format passes enough information to allow a back-end to
(in many cases) determine a reminder's recurrence rather than just treating
each reminder as a one-off event.
.PP
Rem2PS was written by David F. Skoll <dfs@roaringpenguin.com>.
The lines emitted by \fBremind \-pp\fR are as follows:
.TP
.B # rem2ps2 begin
This line signifies the start of calendar data. Back-ends can search
for it to verify they are being fed correct information. Note the
"2" after "rem2ps", which distinguishes this format from the older \fB\-p\fR
format.
.TP
\fImonth_name year num_days first_day monday_first\fR
Same as the \fB\-p\fR format
.TP
\fIsun mon tue wed thu fri sat\fR
Same as the \fB\-p\fR format
.TP
\fInext_mon next_days\fR
Same as the \fB\-p\fR format
.TP
\fIprev_mon prev_days\fR
Same as the \fB\-p\fR format
.PP
.B CALENDAR ENTRIES
.PP
The remaining data consists of calendar entries expressed as a JSON object
on a single line. Each such line will begin with "{" and will be a well-formed
JSON object. The keys that may be present in the JSON object are as
follows:
.TP
.B date \fIYYYY-MM-DD\fR
The \fbdate\fR key will \fIalways\fR be present; it is the trigger date
of the reminder expressed as a string in the format \fIYYYY-MM-DD\fR
.TP
.B filename \fIf\fR
The filename in which the reminder was found.
.TP
.B lineno \fIn\fR
The line number within the file on which the reminder was found.
.TP
.B nonconst_expr 1
If the reminder contained a non-constant expression that had to be evaluated
to determine the trigger date, this key will be present with the value 1.
If this key is present, then it is unsafe for a back-end to rely on
recurrence semantics or even the semantics of any part of the parsed
reminder, as they may have been computed in a way that cannot be expressed
in JSON.
.TP
.B if_depth \fIn\fR
If the reminder is inside one or more IF or ELSE statements, this key
will be present and the value will be the number of nested IFs from
the top-level to the reminder. Back-ends should be wary of
interpreting recurrence semantics of reminders within an IF or ELSE
block.
.TP
.B passthru \fIspecial\fR
If the reminder was a SPECIAL reminder, the \fBpassthru\fR key will be
present and the value will be the type of SPECIAL (such as SHADE, COLOR,
MOON, etc.)
.TP
.B tags \fIdata\fR
If any TAG clauses are present, the \fBtags\fR key will be present and consist
of a comma-separated list of tags.
.TP
.B time \fIt\fR
If an AT clause was present, this key will contain the time of the AT clause
in minutes after midnight.
.TP
.B tdelta \fIn\fR
If a time delta (+n after an AT clause) was present, this key contains the
delta value in minutes.
.TP
.B trep \fIn\fR
If a time repeat (*n after an AT clause) was present, this key contains the
repeat value in minutes.
.TP
.B eventduration \fIn\fR
If a DURATION clause was present, this key contains the event duration in
minutes.
.TP
.B duration \fIn\fR
If a DURATION clause was present, this key contains today's duration in
minutes. See the \fBremind(1)\fR man page, "MULTI-DAY EVENTS", for a
discussion of duration vs. event duration.
.TP
.B eventstart \fIdt\fR
If an AT clause was present, this key contains the event start time in
the format \fIYYYY-MM-DDTHH:MM\fR.
.TP
.B back \fIn\fR
If the reminder contained a "back" clause (\-n or \-\-n), this key
contains the back value. If the "back" value was \-n, the value will
be positive; if it was \-\-n, the value will be negative.
.TP
.B delta \fIn\fR
If the reminder contained a "delta" clause (\+n or \+\+n), this key
contains the delta value. If the "delta" value was \+n, the value will
be positive; if it was \+\+n, the value will be negative.
.TP
.B rep \fIn\fR
If the reminder contained a "repeat" clause (*n), this key contains
the repeat value.
.TP
.B skip \fItype\fR
If the reminder contained a SKIP, BEFORE or AFTER keyword, then this
key will contain that keyword.
.TP
.B localomit \fIarray\fR
If the reminder contains a local OMIT keyword, this key will be present.
Its value will be an array of English day names that are OMITted.
.TP
.B wd \fIarray\fR
If the reminder contains one or more weekdays, this key will be present.
Its value will be an array of English day names that are present.
.TP
.B d \fIn\fR
If a day-of-month is present in the reminder specification, this key
will be present and its value will be the day number.
.TP
.B m \fIn\fR
If a month is present in the reminder specification, this key
will be present and its value will be the month number.
.TP
.B y \fIn\fR
If a year is present in the reminder specification, this key
will be present and its value will be the year.
.TP
.B until \fIYYYY-MM-DD\fR
If the reminder contains an UNTIL or THROUGH clause, this key
will be present. Its value will be a string of the form YYYY-MM-DD.
.TP
.B once 1
If the reminder contains a ONCE keyword, this key will be present
with a value of 1.
.TP
.B scanfrom \fIYYYY-MM-DD\fR
If the reminder contains a SCANFROM keyword, this key will be present
and its value will be a string of the form YYYY-MM-DD.
.TP
.B from \fIYYYY-MM-DD\fR
If the reminder contains a FROM keyword, this key will be present
and its value will be a string of the form YYYY-MM-DD.
.TP
.B priority \fIn\fR
The priority of the reminder. Always present; if no PRIORITY keyword
is specified, then a reminder has a default priority of 5000.
.TP
.B r \fIn\fR
For a SHADE or COLOR special, the red color component.
.TP
.B g \fIn\fR
For a SHADE or COLOR special, the green color component.
.TP
.B b \fIn\fR
For a SHADE or COLOR special, the blue color component.
.TP
.B body \fIbody\fR
The body of the reminder to issue. Always present.
.TP
.B rawbody \fIraw\fR
The "raw" body of the reminder, before any expression-pasting or
substitution-sequence processing. If the raw body would be the same
as the processed body, then this key is not present.
.PP
After a month's worth of reminders have been emitted, \fBRemind\fR
emits the line:
.PP
\fB# rem2ps2 end
.PP
However, back-ends should keep reading until EOF in case more data for
subsequent months is forthcoming.
.PP
.SH REM2PS PURE JSON INPUT FORMAT (-PPP OPTION)
\fBRemind \-ppp\fR emits \fIpure JSON\fR output. The format is
as follows:
.PP
\fBRemind\fR outputs a JSON array. Each element of the array is a
\fImonth descriptor\fR.
.PP
Each month descriptor is a JSON object with the following elements:
.TP
.B monthname \fIname\fR
The name of the month.
.TP
.B year \fIyyyy\fR
The year.
.TP
.B daysinmonnth \fIn\fR
The number of days in the current month.
.TP
.B firstwkday \fIn\fR
The weekday of the first day of the month (0 = Sunday, 1 = Monday, 6 = Saturday).
.TP
.B mondayfirst \fIn\fR
An indicator of whether or not the calendar week should start with
Sunday (n=0) or Monday (n=1).
.TP
.B daynames \fR[\fIdays\fR]
A seven-element array of day names; each element is a string representing
the names of the days from Sunday through Saturday.
.TP
.B prevmonthname \fIname\fR
The name of the previous month.
.TP
.B daysinprevmonth \fIn\fR
The number of days in the previous month.
.TP
.B prevmonthyear \fIyyyy\fR
The year of the previous month. (The same as \fByear\fR unless the current
month is January.)
.TP
.B nextmonthname \fIname\fR
The name of the following month.
.TP
.B daysinnextmonth \fIn\fR
The number of days in the following month.
.TP
.B nextmonthyear \fIyyyy\fR
The year of the following month. (The same as \fByear\fR unless the
current month is December.)
.TP
.B entries \fR[\fIarray\fR]
The \fBentries\fR key consists of an array of calendar entries; each
entry is a JSON object that has the same format as described in the
\fBCALENDAR ENTRIES\fR section in the \fB\-PP FORMAT\fR section,
\fIwith the following difference\fR: In \fB\-PP\fR mode, if a reminder
has \fB%"\fR markers, only the text between the markers
is included in the \fBbody\fR element. In \fB\-PPP\fR mode, the
entire text \fIincluding\fR the \fB%"\fR markers is included and it's up to
the back-end to extract the portion between the markers if that
is desired.
.SH AUTHOR
Rem2PS was written by Dianne Skoll <dianne@skoll.ca>
.SH BUGS
All \fBRem2ps\fR options are case-sensitive, unlike \fBRemind\fR.
Any time you supply

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
.TH TKREMIND 1 "15 February 1998"
.TH TKREMIND 1 "15 January 2021"
.UC 4
.SH NAME
tkremind \- graphical front-end to Remind calendar program
.SH SYNOPSIS
.B tkremind \fR[\fIoptions\fR] [\fIread_file\fR] [\fIwrite_file\fR]
.B tkremind \fR[\fIoptions\fR] [\fIread_file\fR] [\fIwrite_file\fR] [\fIconfig_file\fR]
.SH DESCRIPTION
\fBTkRemind\fR is a graphical front-end to the \fBRemind\fR program.
It provides a friendly graphical interface which allows you to view
@@ -13,8 +13,10 @@ Although not all of \fBRemind\fR's features are available with \fBTkRemind\fR,
it creates. This allows you to learn \fBRemind\fR's syntax and then add
extra features as you become a more sophisticated \fBRemind\fR programmer.
\fBTkRemind\fR is written in Tcl, and requires version 8.0
(or higher). It also requires a \fBwish\fR binary.
\fBTkRemind\fR is written in Tcl, and requires version 8.5 (or higher)
as well as the tcllib extension. It also requires a \fBwish\fR
binary. If you are using Tcl/Tk 8.5, you may also need either the Img
or the tkpng extension to handle PNG images.
.SH OPTIONS
\fBTkRemind\fR itself has no options. However, it passes certain options
@@ -41,6 +43,9 @@ include the line:
.fi
.PP
\fIConfig_file\fR is the file in which \fBTkRemind\fR stores
its options. If it is omitted, it defaults to \fI$HOME/.tkremindrt\fR.
.SH THE CALENDAR WINDOW
When you start \fBTkRemind\fR, it displays a calendar for the current
month, with today's date highlighted. Reminders are filled into each
@@ -51,11 +56,14 @@ notice that the box appears completely full.
.SH NAVIGATING
To change to the previous or next month, click the \fB<\-\fR
or \fB\->\fR button, respectively. To change back to
the current month, click \fBToday\fR. To go to a specific month,
click \fBGo To Date...\fR. This pops up a dialog box which allows you
to select a month and enter a year. Once you've done this, click
\fBGo\fR to go to the date, or \fBCancel\fR to cancel.
or \fB\->\fR button, respectively. You can also use the left/right arrow
keys or PageUp/PageDown to navigate.
To change back to the current month, click \fBToday\fR or press the
Home key. To go to a specific month, click \fBGo To Date...\fR. This
pops up a dialog box which allows you to select a month and enter a
year. Once you've done this, click \fBGo\fR to go to the date, or
\fBCancel\fR to cancel.
To exit \fBTkRemind\fR, click \fBQuit\fR.
@@ -74,7 +82,7 @@ The next control specifies an expiry date for the reminder. Select
the check button to enable an expiry date, and fill in the values
using pull-down menus.
The third control specifes how much advance notice you want (if any),
The third control specifies how much advance notice you want (if any),
and whether or not weekends and holidays are counted when computing advance
notice.
@@ -104,7 +112,7 @@ edit the reminder, thereby gaining access to advanced features of
\fBRemind\fR's idioms for expressing different types of reminders.
.SH PRINTING
To print the current month's calender, click \fBPrint...\fR on the
To print the current month's calendar, click \fBPrint...\fR on the
main calendar window. This brings up the print dialog. Printing
either produces a PostScript file or sends PostScript to a UNIX command.
@@ -125,10 +133,11 @@ Select the appropriate paper size and orientation. Activate
be the normal case unless you have many reminders in a particular
day. (See the \fBRem2PS\fR documentation.)
Finally, click \fBPrint\fR to print or \fBCancel\fR to cancel.
Note that during printing, \fBRemind\fR is \fInot\fR called with
the \fB-itkremind=1\fR option, because it is operated in normal
PostScript-producing mode.
Finally, click \fBPrint\fR to print or \fBCancel\fR to cancel. Note
that during printing, \fBRemind\fR is called with the
\fB-itkremind=1\fR option and also an additional \fB-itkprint=1\fR
option.
.SH EDITING REMINDERS
@@ -179,7 +188,7 @@ it starts up in a normal window.
.TP
.B Show Today's Reminders on Startup
If this is selected, \fBTkRemind\fR shows a text window containing reminders
which would be issued by "remind -q -a -r" on startup, and when the date
which would be issued by "remind \-q \-a \-r" on startup, and when the date
changes at midnight.
.TP
@@ -210,7 +219,8 @@ background reminder pops up.
.TP
.B Feed popped-up reminder to command's standard input
If selected, feeds the text of the reminder to the command described
above.
above. The text of the reminder is prefixed by "HH:MM ", where HH:MM
is the time of the reminder.
.TP
.B E-mail reminders here if popup not dismissed
@@ -231,6 +241,22 @@ The characters "%d" are replaced with the lined number of the file
containing the reminder, and "%s" are replaced with the file name.
Useful strings might be "emacs +%d %s" or "gvim +%d %s"
.TP
.B Extra Argument for Remind
This specifies any extra arguments that should be passed to Remind
when \BTkRemind\fR invokes \fBremind\fR. Unless you know what
you are doing, leave this blank.
.TP
.B Change entry font...
This button pops up a font selection dialog that lets you change the
font used to draw calendar items in the calendar boxes.
.TP
.B Change heading font...
Similar to Change entry font, but applies to calendar heading
(the month and day names and the day numbers.)
.PP
Once you've configured the options the way you like them,
press \fBApply Options\fR to put them into effect, \fBSave Options\fR
@@ -268,7 +294,7 @@ the body. Furthermore, if you use expression-pasting in the body,
When \fBTkRemind\fR invokes \fBRemind\fR, it supplies the option:
.PP
.nf
-itkremind=1
\-itkremind=1
.fi
.PP
on the command line. So, in your \fBRemind\fR file, you can include:
@@ -289,7 +315,9 @@ file to store additional state. You can certainly mix
if you are aware of the following rules and limitations:
.TP
o
Do not use the \fBTAG\fR keyword in hand-crafted reminders.
\fBTkRemind\fR uses \fBTAG\fRs of the form \fBTKTAG\fR\fInnn\fR
where \fInnn\fR is a number. You should not use such \fBTAG\fRs
in hand-crafted reminders.
.TP
o
Do not edit lines starting with "# TKTAGnnn", "# TKEND", or any
@@ -356,13 +384,9 @@ This line is emitted in response to a \fBSTATUS\fR command. The number
\fIn\fR is the number of reminders in the queue.
.SH AUTHOR
TkRemind is now supported by Roaring Penguin Software
Inc. (http://www.roaringpenguin.com)
.PP
TkRemind was written by David F. Skoll <dfs@roaringpenguin.com>.
TkRemind was written by Dianne Skoll <dianne@skoll.ca>
\fBTkRemind\fR is Copyright 1996-1998 by David F. Skoll, Copyright
1999 by Roaring Penguin Software Inc.
\fBTkRemind\fR is Copyright 1996-2020 by Dianne Skoll.
.SH FILES

29
rem2html/Makefile.in Normal file
View File

@@ -0,0 +1,29 @@
# Set by configure - don't touch.
srcdir=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
mandir=@mandir@
bindir=@bindir@
datadir=@datadir@
datarootdir=@datarootdir@
PERL=@PERL@
PERLMODS_NEEDED=JSON::Any Getopt::Long
all:
true
install:
@if test "$(PERL)" = "" ; then \
echo "Not installing rem2html; Perl is required"; exit 0; fi; \
for m in $(PERLMODS_NEEDED) ; \
do \
perl -M$$m -e 1 > /dev/null 2>&1; \
if test $$? != 0 ; then echo "Not installing rem2html; missing $$m"; exit 0; fi; \
done; \
echo "Installing rem2html in $(DESTDIR)$(bindir)"; \
mkdir -p $(DESTDIR)$(bindir) && sed -e 's|^#!perl|#!$(PERL)|' < rem2html > $(DESTDIR)$(bindir)/rem2html && chmod 755 $(DESTDIR)$(bindir)/rem2html && exit 0; \
exit 1;

12
rem2html/README.rem2html Normal file
View File

@@ -0,0 +1,12 @@
REM2HTML
--------
rem2html is a Perl script that transforms the output of `remind -pp
...' to HTML. Type `perl rem2html --help' for usage information.
rem2html requires the Perl modules `JSON::Any' and `Getopt::Long'. It
will not be installed unless you have those modules as well as Perl
itself.
--
Dianne Skoll

285
www/rem2html → rem2html/rem2html Executable file → Normal file
View File

@@ -1,13 +1,14 @@
#!/usr/bin/perl
#!perl
use strict;
use warnings;
use Getopt::Long;
use JSON::Any;
my %Options;
my $rem2html_version = '2.0';
my $rem2html_version = '2.1';
my($days, $shades, $moons, $classes, $Month, $Year, $Numdays, $Firstwkday, $Mondayfirst, $weeks,
@Daynames, $Nextmon, $Nextlen, $Prevmon, $Prevlen);
@@ -15,15 +16,20 @@ my($days, $shades, $moons, $classes, $Month, $Year, $Numdays, $Firstwkday, $Mond
my $TIDY_PROGNAME = $0;
$TIDY_PROGNAME =~ s|^.*/||;
# rem2html -- convert the output of "remind -p" to HTML
# rem2html -- convert the output of "remind -pp" to HTML
=head1 NAME
rem2html - Convert the output of "remind -p" to HTML
rem2html - Convert the output of "remind -pp" to HTML
=head1 SYNOPSIS
remind -p ... | rem2html [options]
remind -pp ... | rem2html [options]
You can also use the old interchange format as below, but the -pp
version is preferred.
remind -p ... | rem2html [options]
=head1 OPTIONS
@@ -49,13 +55,21 @@ month name a link to I<url>.
=item --imgbase I<url>
When creating URLs for images and the stylesheet, use
I<url> as the base URL.
When creating URLs for the stylesheet or external images, use I<url>
as the base URL.
=item --pngs
Normally, rem2html uses inline "data:" URLs for the moon phase images,
yielding a standalone HTML file. The C<--pngs> option makes it use
external images named firstquarter.png, fullmoon.png, lastquarter.png
and newmoon.png, which are expected to live in C<--imgbase>.
=item --stylesheet I<url.css>
Use I<url.css> as the stylesheet. If this option is used,
I<url.css> is I<not> interpreted relative to B<imgbase>.
I<url.css> is interpreted relative to B<imgbase> I<unless> it start
with a "/".
=item --nostyle
@@ -84,7 +98,7 @@ Insert I<html_text> right before the E<lt>/bodyE<gt> tag.
=head1 AUTHOR
rem2html was written by David F. Skoll with much inspiration from an
rem2html was written by Dianne Skoll with much inspiration from an
earlier version by Don Schwarz.
=cut
@@ -96,9 +110,9 @@ sub usage
$exit_status = 1;
}
print STDERR <<"EOM";
$TIDY_PROGNAME: Produce an HTML calendar from the output of "remind -p"
$TIDY_PROGNAME: Produce an HTML calendar from the output of "remind -pp"
Usage: remind -p ... | rem2html [options]
Usage: remind -pp ... | rem2html [options]
Options:
@@ -109,6 +123,8 @@ Options:
entry a link to <url>
--forwurl url Same as --backurl, but for the next month's small calendar
--imgbase url Base URL of images and default stylesheet file
--pngs Use external .PNG images for moon phases rater than
inline data: URLs
--stylesheet url.css URL of CSS stylesheet. If specified, imgbase is NOT
prepended to url.css
--nostyle Produce basic HTML that does not use a CSS stylesheet
@@ -120,11 +136,31 @@ EOM
exit($exit_status);
}
sub smoosh
{
my ($first, $second) = @_;
return $second unless defined ($first);
return $second if $first eq '';
return $second if ($second =~ m|^/|); # Absolute path given for second
# Squash multiple slashes
$first =~ s|/+|/|g;
# Special case
return "/$second" if ($first eq '/');
# Delete trailing slash
$first =~ s|/$||;
return "$first/$second";
}
sub parse_options
{
local $SIG{__WARN__} = sub { print STDERR "$TIDY_PROGNAME: $_[0]\n"; };
if (!GetOptions(\%Options, "help|h",
"man",
"pngs",
"version",
"stylesheet=s",
"nostyle",
@@ -137,45 +173,40 @@ sub parse_options
"tableonly")) {
usage(1);
}
$Options{'title'} ||= 'HTML Calendar';
$Options{title} ||= 'HTML Calendar';
# Fix up imgbase
my $imgbase = '%IMAGEBASE%';
if ($imgbase ne '%' . 'IMAGEBASE' . '%') {
$Options{'imgbase'} ||= $imgbase;
} else {
$Options{'imgbase'} ||= '';
my $stylesheet = $Options{stylesheet};
if ($stylesheet) {
$Options{stylesheet} = smoosh($Options{imgbase}, $stylesheet);
}
$Options{'imgbase'} =~ s|/+$||;
my $stylesheet = $Options{'imgbase'};
$stylesheet .= '/' if ($stylesheet ne '');
$stylesheet .= 'rem-default.css';
$Options{'stylesheet'} ||= $stylesheet;
}
sub start_output
{
return if ($Options{'tableonly'});
return if ($Options{tableonly});
print("<html>\n<head>\n<title>" . $Options{'title'} . "</title>\n");
if (!$Options{'nostyle'}) {
if ($Options{'stylesheet'}) {
print('<link rel="stylesheet" type="text/css" href="' .
$Options{'stylesheet'} . '">' . "\n");
}
print("<html>\n<head>\n<title>" . $Options{title} . "</title>\n");
if (!$Options{nostyle}) {
if ($Options{stylesheet}) {
print('<link rel="stylesheet" type="text/css" href="' .
$Options{stylesheet} . '">' . "\n");
} else {
print("<style>\n");
print default_stylesheet();
print("</style>\n");
}
}
print("</head>\n<body>\n");
if ($Options{'prologue'}) {
print $Options{'prologue'} . "\n";
if ($Options{prologue}) {
print $Options{prologue} . "\n";
}
}
sub end_output
{
return if ($Options{'tableonly'});
if ($Options{'epilogue'}) {
print $Options{'epilogue'} . "\n";
return if ($Options{tableonly});
if ($Options{epilogue}) {
print $Options{epilogue} . "\n";
}
print("</body>\n</html>\n");
}
@@ -191,7 +222,7 @@ sub parse_input
my $found_data = 0;
while(<STDIN>) {
chomp;
last if /^\# rem2ps begin$/;
last if /^\# rem2ps2? begin$/;
}
my $line;
@@ -221,20 +252,36 @@ sub parse_input
$found_data = 1;
my $class;
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
$class = '';
} else {
$class = ' class="rem-entry"';
}
while(<STDIN>) {
chomp;
last if /^\# rem2ps end$/;
last if /^\# rem2ps2? end$/;
next if /^\#/;
next unless m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/;
my ($y, $m, $d, $special, $tag, $duration, $time, $body) =
($1, $2, $3, $4, $5, $6, $7, $8);
my ($y, $m, $d, $special, $tag, $duration, $time, $body);
if (m/^(\d*).(\d*).(\d*)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*(.*)$/) {
($y, $m, $d, $special, $tag, $duration, $time, $body) =
($1, $2, $3, $4, $5, $6, $7, $8);
} elsif (/\{/) {
my $obj = JSON::Any->jsonToObj($_);
next unless ($obj->{date} =~ /^(\d+)-(\d+)-(\d+)$/);
$y = $1;
$m = $2;
$d = $3;
$special = $obj->{passthru} || '*';
$tag = $obj->{tags} || '*';
$duration = $obj->{duration} || '*';
$time = $obj->{time} || '*';
$body = $obj->{body};
} else {
next;
}
my $d1 = $d;
$d1 =~ s/^0+//;
$special = uc($special);
if ($special eq 'HTML') {
push(@{$days->[$d]}, $body);
} elsif ($special eq 'HTMLCLASS') {
@@ -256,8 +303,11 @@ sub parse_input
if ($body =~ /(\d+)\s+(\d+)\s+(\d+)/) {
$shades->[$d] = sprintf("#%02X%02X%02X",
($1 % 256), ($2 % 256), ($3 % 256));
} elsif ($body =~ /(\d+)/) {
$shades->[$d] = sprintf("#%02X%02X%02X",
($1 % 256), ($1 % 256), ($1 % 256));
}
} elsif ($special eq 'COLOR') {
} elsif ($special eq 'COLOR' || $special eq 'COLOUR') {
if ($body =~ /(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/) {
my($r, $g, $b, $text) = ($1, $2, $3, $4);
my $color = sprintf("style=\"color: #%02X%02X%02X;\"",
@@ -281,7 +331,7 @@ sub small_calendar
}
}
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print "<td width=\"14%\">\n";
print "<table border=\"0\">\n";
print "<caption>";
@@ -296,7 +346,7 @@ sub small_calendar
print "</caption>\n";
my $class;
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print '<tr>';
$class = ' align="right"';
} else {
@@ -318,7 +368,7 @@ sub small_calendar
if ($col == 0) {
print("<tr>\n");
}
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print("<td align=\"right\" width=\"14%\">&nbsp;</td>");
} else {
print("<td class=\"rem-sc-empty-cell\">&nbsp;</td>");
@@ -330,7 +380,7 @@ sub small_calendar
print("<tr>\n");
}
$col++;
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print("<td align=\"right\" width=\"14%\">$day</td>");
} else {
print("<td class=\"rem-sc-cell\">$day</td>");
@@ -342,7 +392,7 @@ sub small_calendar
}
if ($col) {
while ($col < 7) {
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print("<td align=\"right\" width=\"14%\">&nbsp;</td>");
} else {
print("<td class=\"rem-sc-empty-cell\">&nbsp;</td>");
@@ -371,7 +421,7 @@ sub output_calendar
# Start the table
my $class;
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print '<table width="100%" border="1" cellspacing=\"0\"><caption>' .
$Month . ' ' . $Year . '</caption>' . "\n";
print '<tr>';
@@ -395,23 +445,23 @@ sub output_calendar
# Start the calendar rows
my $col = 0;
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print "<tr>\n";
} else {
print "<tr class=\"rem-cal-row\">\n";
}
if ($first_col > 0) {
small_calendar($Prevmon, $Prevlen, $Options{'backurl'},
small_calendar($Prevmon, $Prevlen, $Options{backurl},
($Firstwkday - $Prevlen + 35) % 7);
$col++;
}
if ($last_col == 6 && $first_col > 0) {
small_calendar($Nextmon, $Nextlen, $Options{'forwurl'},
small_calendar($Nextmon, $Nextlen, $Options{forwurl},
($Firstwkday + $Numdays) % 7);
$col++;
}
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
$class = ' width="14%"';
} else {
$class = ' class="rem-empty"';
@@ -428,7 +478,7 @@ sub output_calendar
$col = 0;
print "</tr>\n";
if ($day < $Numdays) {
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print "<tr>\n";
} else {
print "<tr class=\"rem-cal-row\">\n";
@@ -441,13 +491,13 @@ sub output_calendar
while ($col < 7) {
if ($col == 5) {
if ($first_col == 0) {
small_calendar($Prevmon, $Prevlen, $Options{'backurl'},
small_calendar($Prevmon, $Prevlen, $Options{backurl},
($Firstwkday - $Prevlen + 35) % 7);
} else {
print("<td$class>&nbsp;</td>\n");
}
} elsif ($col == 6) {
small_calendar($Nextmon, $Nextlen, $Options{'forwurl'},
small_calendar($Nextmon, $Nextlen, $Options{forwurl},
($Firstwkday + $Numdays) % 7);
} else {
print("<td$class>&nbsp;</td>\n");
@@ -459,17 +509,17 @@ sub output_calendar
# Add a row for small calendars if they were not yet done!
if ($first_col == 0 && $last_col == 6) {
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print "<tr>\n";
} else {
print "<tr class=\"rem-cal-row\">\n";
}
small_calendar($Prevmon, $Prevlen, $Options{'backurl'},
small_calendar($Prevmon, $Prevlen, $Options{backurl},
($Firstwkday - $Prevlen + 35) % 7);
for (my $i=0; $i<5; $i++) {
print("<td$class>&nbsp;</td>\n");
}
small_calendar($Nextmon, $Nextlen, $Options{'forwurl'},
small_calendar($Nextmon, $Nextlen, $Options{forwurl},
($Firstwkday + $Numdays) % 7);
print("</tr>\n");
}
@@ -486,7 +536,7 @@ sub draw_day_cell
$week = ' ' . $weeks->{$day};
}
my $class;
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
$class = $classes->[$day] || '';
} else {
$class = $classes->[$day] || "rem-cell";
@@ -512,33 +562,46 @@ sub draw_day_cell
my $alt;
my $title;
if ($phase == 0) {
$img = 'newmoon.png';
if ($Options{pngs}) {
$img = smoosh($Options{imgbase}, 'newmoon.png');
} else {
$img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAC6SURBVDiNpdNNbsIwFATgL0HKolchHKBX6yFaBOEyoPYUabvOIVKJRaCL2JX5TRNGGvnJ8ozGz89cYoElPvET+BX2yivn/1Bggw5HHMKa1h2qcPZC/JEIhvh+brIZIY6sorhMYo9hh3KGFzzfa84NZNjDt9OG/ZcH1BlaPE1IAG0+URhxzNGESKPFaHJs9Q0Ziww7HnvGeXSrJhis0jiFfjwnj3I0WRv+TKtr4hQl3lDrZ6QN9Wt654hfWfGDmBpUwDkAAAAASUVORK5CYII=';
}
$title = 'New Moon';
$alt = 'new';
} elsif ($phase == 1) {
$img = 'firstquarter.png';
if ($Options{pngs}) {
$img = smoosh($Options{imgbase}, 'firstquarter.png');
} else {
$img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADfSURBVDiNndM9TsNAFATgzy5yjZSAE85JBygETgENUPF3iBCitHAFQkcIhZ/Ryn9gRlrZmp2Z3ef3TBOHOMULPrDBMrhpi/4HI5xjix2+4nmJRbx/Yh7ahvkpRPVV4QDXwT3UQy46zGkAZDgK/iytefvHgCrkJsqZUH6cLnNbABSxd5Jhhf1IbkMXv8Qux7hH1Ic1xvk/jBWy6gavumvtwx7ectwZXkKh7MA95XgObeOtpI2U4zl0kGbpxgiPvwQUcXLrKFchc82f6Ur0PK49azOnmOI4TBu84zm4SV38DeIVYkrYJyNbAAAAAElFTkSuQmCC';
}
$title = 'First Quarter';
$alt = '1st';
} elsif ($phase == 2) {
$img = 'fullmoon.png';
if ($Options{pngs}) {
$img = smoosh($Options{imgbase}, 'fullmoon.png');
} else {
$img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADlSURBVDiNrdNBUsJAEAXQlyw4hq4hwWPqTixET6ELkZ16CcAq7oFLqXExjaYgQVNlV/Viev7/6XT/4TjGuME7PiLXUatb8N8xwB12SFjiIXIZtU/MAntEfgvQE4YtHxhiHpjXQ5H7uLhEcaLLAleBvd0Xx9Ha/BdyU+Q5OBV5OKmj7a4YBWdSyNPe4aKHAHkzqcQZNj3JgnNexqE8heyIAulffuFF3kTfIVbBVeu/xoXGGsn2TLJJ/mqkafNiINszySYZdbS90GHlvcgsWktY4TFy7ecxTdvIzahxHQLbyFXUqkPwF2ASRNYgB/PXAAAAAElFTkSuQmCC';
}
$alt = 'full';
$title = 'Full Moon';
} else {
$img = 'lastquarter.png';
if ($Options{pngs}) {
$img = smoosh($Options{imgbase}, 'lastquarter.png');
} else {
$img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAGQAAABkABchkaRQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADmSURBVDiNndMxTsNAEIXhzy5yCyQ6FAgcE7oQheQWUAAl5BIkREoZrgB0GFNkHBl7bURGsryaee/3jHeXdpxjghU+8InXyI0S+n0MMEeBEi+4jfV3vAvMQtsyL0J0j2GtViaeRRMyj8IlsgY8BSijE2Kur/hy09wHKMJrEolhwtwHKDHOsI4OLnoAXfl1jiNsOkR9keE4P8D4q4scbzg5xIxtjie709f1E7siC+9+Gx/8fxvPKtEsklcJSBdgWhcN8ByFR5z+AWgd5QpyE+OUWOJO+zJNU+Z6jHAdgHe7K73CuD5zFT9nCmRDIssCaAAAAABJRU5ErkJggg==';
}
$alt = 'last';
$title = 'Last Quarter';
}
if ($Options{'imgbase'}) {
$img = $Options{'imgbase'} . '/' . $img;
}
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print("<div style=\"float: left\"><img border=\"0\" width=\"16\" height=\"16\" alt=\"$alt\" title=\"$title\" src=\"$img\">$msg</div>");
} else {
print("<div class=\"rem-moon\"><img width=\"16\" height=\"16\" alt=\"$alt\" title=\"$title\" src=\"$img\">$msg</div>");
}
}
if ($Options{'nostyle'}) {
if ($Options{nostyle}) {
print "<div style=\"float: right\">$day$week</div>\n";
print "<p>&nbsp;</p>\n";
} else {
@@ -561,13 +624,13 @@ sub escape_html
}
parse_options();
if ($Options{'help'}) {
if ($Options{help}) {
usage(0);
exit(0);
} elsif ($Options{'man'}) {
} elsif ($Options{man}) {
system("perldoc $0");
exit(0);
} elsif ($Options{'version'}) {
} elsif ($Options{version}) {
print "rem2html version $rem2html_version.\n";
exit(0);
}
@@ -592,3 +655,81 @@ if ($found_something) {
exit(1);
}
sub default_stylesheet
{
return <<'EOF';
table.rem-cal {
font-family: helvetica, arial, sans-serif;
font-size: 12pt;
}
table.rem-sc-table {
font-family: helvetica, arial, sans-serif;
font-size: 10pt;
width: 95%;
float: left;
}
caption.rem-cal-caption {
font-size: 14pt;
font-weight: bold;
}
th.rem-cal-hdr {
width: 14%;
border-style: solid;
border-width: 1px;
vertical-align: top;
}
td.rem-empty, td.rem-cell, td.rem-small-calendar {
width: 14%;
height: 7em;
border-style: solid;
border-width: 1px;
vertical-align: top;
}
td.rem-today {
width: 14%;
height: 7em;
border-style: solid;
border-width: 2px;
border-color: #EE3333;
vertical-align: top;
}
table.rem-cal {
width: 100%;
border-collapse: collapse;
}
div.rem-daynumber {
float: right;
text-align: right;
vertical-align: top;
font-size: 14pt;
}
p.rem-entry {
clear: both;
}
div.rem-moon {
float: left;
text-align: left;
vertical-align: top;
}
th.rem-sc-hdr {
text-align: right;
}
td.rem-sc-empty-cell, td.rem-sc-cell {
text-align: right;
width: 14%;
}
caption.rem-sc-caption {
font-size: 12pt;
}
EOF
}

View File

@@ -1,4 +1,3 @@
Files in this directory:
tkremind -- Tcl/Tk graphical calendar using Remind as engine
cm2rem.tcl -- Convert Sun's "cm" calendar manager files to Remind.

View File

@@ -1,359 +0,0 @@
#!/bin/sh
# -*-Mode: TCL;-*-
#--------------------------------------------------------------
# cm2rem.tcl
#
# A cheesy Tcl script to convert Sun's "cm" calendar manager
# files (version 3 only) to Remind format.
#
# This file is part of REMIND.
# Copyright (C) 1992-1998 by David F. Skoll
# Copyright (C) 1999-2000 by Roaring Penguin Software Inc.
#
#--------------------------------------------------------------
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
set i 0
foreach month {January February March April May June
July August September October November December} {
incr i
set MonthNum($month) $i
set FullMonth([string range $month 0 2]) $month
}
#***********************************************************************
# %PROCEDURE: convertParens
# %ARGUMENTS:
# line -- a line read from a cm file
# %RETURNS:
# A new line with all ( and ) outside quotes converted to { and }.
# This cheap trick allows us to use Tcl's built-in list manipulation
# functions to munge the line.
#***********************************************************************
proc convertParens { line } {
# Convert all ( and ) to { and } unless they are inside a quoted
# string
set out ""
set len [string length $line]
set inQuotes 0
for {set i 0} {$i < $len} {incr i} {
set char [string range $line $i $i]
if {$char == "\\" && $inQuotes} {
append out $char
incr i
set char [string range $line $i $i]
append out $char
continue
}
if {$char == "(" && !$inQuotes} {
set char \{
}
if {$char == ")" && !$inQuotes} {
set char \}
}
if {$char == "\""} {
set inQuotes [expr !$inQuotes]
}
append out $char
}
return $out
}
#***********************************************************************
# %PROCEDURE: processLine
# %ARGUMENTS:
# line -- a line read from a cm file
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Processes a single line from the file, possibly writing a reminder
# in Remind format to stdout
#***********************************************************************
proc processLine { line } {
global Attributes
global FullMonth
catch {unset Attributes}
# Only convert lines which start with "(add"
if {[string range $line 0 3] != "(add"} {
return
}
set line [convertParens $line]
# Convert it to a list. CAREFUL: Potential security problem if
# $line contains something nasty.
eval set line $line
set Attributes(body) ""
foreach {key val} $line {
switch -exact -- $key {
"add" {
set Attributes(date) $val
}
"what:" {
append Attributes(body) $val
}
"details:" {
append Attributes(body) $val
}
"duration:" {
set Attributes(duration) $val
}
"period:" {
set Attributes(period) $val
}
"ntimes:" {
set Attributes(ntimes) $val
}
"attributes:" {
set Attributes(action) $val
}
}
}
if {[info exists Attributes(action)]} {
# Nuke quotes and commas in action
regsub -all {[,\"]} $Attributes(action) { } Attributes(action)
# Add spaces to pairs
regsub -all \}\{ $Attributes(action) \}\ \{ Attributes(action)
# Add another pair of brackets to make a proper list
set Attributes(action) "{$Attributes(action)}"
# Convert to a real Tcl list
eval set Attributes(action) $Attributes(action)
}
# Split out date into month, day, year, time parts
scan $Attributes(date) "%s%s%s%s%s" wkday month day time year
set time [string range $time 0 4]
set Attributes(wkday) $wkday
set Attributes(month) $FullMonth($month)
set Attributes(day) $day
set Attributes(time) $time
set Attributes(year) $year
# Convert newlines in body to spaces
set body $Attributes(body)
regsub -all "\n" $body " " body
# TODO: Escape BODY to get rid of [] chars.
set Attributes(body) $body
# Convert to Reminder format
convertReminder
}
#***********************************************************************
# %PROCEDURE: convertReminder
# %ARGUMENTS:
# None -- uses global Attributes variable which must be filled in
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Converts a reminder to Remind format.
#***********************************************************************
proc convertReminder {} {
global Attributes
switch -exact $Attributes(period) {
single { convertSingleReminder }
daily { convertDailyReminder }
weekly { convertWeeklyReminder }
monthly { convertMonthlyReminder }
yearly { convertYearlyReminder }
default {
puts "\# Unable to convert reminder with period $Attributes(period)"
puts "\# Body is: $Attributes(body)"
}
}
}
#***********************************************************************
# %PROCEDURE: convertSingleReminder
# %ARGUMENTS:
# None -- uses global Attributes variable which must be filled in
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Converts a reminder with "single" period to Remind format.
#***********************************************************************
proc convertSingleReminder {} {
global Attributes
puts "REM $Attributes(day) $Attributes(month) $Attributes(year) [at][duration]MSG $Attributes(body)"
}
#***********************************************************************
# %PROCEDURE: convertDailyReminder
# %ARGUMENTS:
# None -- uses global Attributes variable which must be filled in
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Converts a reminder with "daily" period to Remind format.
#***********************************************************************
proc convertDailyReminder {} {
global Attributes
set ntimes [expr $Attributes(ntimes) - 1]
if {$ntimes <= 1} {
convertSingleReminder
return
}
set until [getUntilDate $Attributes(day) $Attributes(month) $Attributes(year) $ntimes]
puts "REM $Attributes(day) $Attributes(month) $Attributes(year) *1 [at][duration]UNTIL $until MSG $Attributes(body)"
}
#***********************************************************************
# %PROCEDURE: convertWeeklyReminder
# %ARGUMENTS:
# None -- uses global Attributes variable which must be filled in
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Converts a reminder with "daily" period to Remind format.
#***********************************************************************
proc convertWeeklyReminder {} {
global Attributes
set ntimes [expr $Attributes(ntimes) - 1]
if {$ntimes <= 1} {
convertSingleReminder
return
}
set until [getUntilDate $Attributes(day) $Attributes(month) $Attributes(year) [expr $ntimes * 7]]
puts "REM $Attributes(day) $Attributes(month) $Attributes(year) *7 [at][duration]UNTIL $until MSG $Attributes(body)"
}
#***********************************************************************
# %PROCEDURE: convertMonthlyReminder
# %ARGUMENTS:
# None -- uses global Attributes variable which must be filled in
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Converts a reminder with "monthly" period to Remind format.
#***********************************************************************
proc convertMonthlyReminder {} {
global Attributes
set ntimes [expr $Attributes(ntimes) - 1]
if {$ntimes <= 1} {
convertSingleReminder
return
}
# If repetition > 1000, it's infinite
if {$ntimes > 1000} {
puts "REM $Attributes(day) [at][duration]MSG $Attributes(body)"
return
}
### UNTIL date is fudged!
set until [getUntilDate $Attributes(day) $Attributes(month) $Attributes(year) [expr $ntimes * 30]]
puts "REM $Attributes(day) [at][duration]UNTIL $until MSG $Attributes(body)"
}
#***********************************************************************
# %PROCEDURE: convertYearlyReminder
# %ARGUMENTS:
# None -- uses global Attributes variable which must be filled in
# %RETURNS:
# Nothing
# %DESCRIPTION:
# Converts a reminder with "yearly" period to Remind format.
#***********************************************************************
proc convertYearlyReminder {} {
global Attributes
# No special handling of ntimes et al.
puts "REM $Attributes(day) $Attributes(month) [at][duration]MSG $Attributes(body)"
}
#***********************************************************************
# %PROCEDURE: at
# %ARGUMENTS:
# None -- uses Attributes global variable
# %RETURNS:
# A string providing the correct AT clause for a timed reminder.
#***********************************************************************
proc at {} {
global Attributes
if {![info exists Attributes(time)]} {
return ""
}
if {"$Attributes(time)" == ""} {
return ""
}
return "AT $Attributes(time) "
}
#***********************************************************************
# %PROCEDURE: duration
# %ARGUMENTS:
# None -- uses Attributes global variable
# %RETURNS:
# A string providing the correct DURATION clause for a timed reminder.
#***********************************************************************
proc duration {} {
global Attributes
if {![info exists Attributes(duration)]} {
return ""
}
if {"$Attributes(duration)" == ""} {
return ""
}
set h [expr $Attributes(duration) / 3600]
set remainder [expr $Attributes(duration) - $h*3600]
set m [expr $remainder / 60]
return "DURATION [format "%d:%02d " $h $m]"
}
#***********************************************************************
# %PROCEDURE: getUntilDate
# %ARGUMENTS:
# day, month, year -- a date
# days -- number of days to add to date
# %RETURNS:
# The date which is "days" later than supplied date in a correct UNTIL
# format.
#***********************************************************************
proc getUntilDate { day month year days } {
global RemindPipe
global MonthNum
set date "'$year/$MonthNum($month)/$day'"
puts $RemindPipe "MSG \[trigger($date + $days)\]%"
puts $RemindPipe "flush"
flush $RemindPipe
gets $RemindPipe line
return $line
}
catch {wm withdraw .}
# Start a Remind process to issue reminders
if {[catch {set RemindPipe [open "|remind -" "r+"]} err]} {
puts stderr "Error: Cannot run Remind: $err"
exit 1
}
puts $RemindPipe "banner %"
flush $RemindPipe
# Write some blurb
puts "\# Reminder file converted from \"cm\" data by cm2rem.tcl"
puts ""
while {[gets stdin line] >= 0} {
processLine $line
}
exit 0

File diff suppressed because it is too large Load Diff

View File

@@ -18,11 +18,10 @@ INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
PROGS= remind rem2ps
SCRIPTS= $(srcdir)/../scripts/tkremind $(srcdir)/../scripts/cm2rem.tcl
SCRIPTS= $(srcdir)/../scripts/tkremind
MANS= $(srcdir)/../man/rem2ps.1 $(srcdir)/../man/remind.1 \
$(srcdir)/../man/tkremind.1 $(srcdir)/../man/cm2rem.1 \
$(srcdir)/../man/rem.1
$(srcdir)/../man/tkremind.1 $(srcdir)/../man/rem.1
.SUFFIXES:
.SUFFIXES: .c .o
@@ -38,13 +37,15 @@ REMINDOBJS= $(REMINDSRCS:.c=.o)
all: remind rem2ps
test: remind
sh ../tests/test-rem
@sh ../tests/test-rem
.c.o:
@CC@ -c @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -I. -I$(srcdir) $<
@CC@ -c @CPPFLAGS@ @CFLAGS@ @DEFS@ $(CEXTRA) $(LANGDEF) -I. -I$(srcdir) $<
rem2ps: rem2ps.o dynbuf.o
@CC@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o
$(REMINDOBJS): $(REMINDHDRS)
rem2ps: rem2ps.o dynbuf.o json.o
@CC@ @LDFLAGS@ $(LDEXTRA) -o rem2ps rem2ps.o dynbuf.o json.o -lm
remind: $(REMINDOBJS)
@CC@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
@@ -72,23 +73,21 @@ clobber:
rm -f *.o *~ remind rem2ps test.out core *.bak
depend:
gccmakedep @DEFS@ $(REMINDSRCS) rem2ps.c
gccmakedep @DEFS@ $(REMINDSRCS) rem2ps.c json.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 git.
distro:
ln -s . ../remind-$(VERSION)
(cd ..; git-ls-files -x .gitignore) | sed -e 's/^/remind-$(VERSION)\//' | xargs tar -C .. -cvf remind-$(VERSION).tar
cd .. && git archive --worktree-attributes --format=tar --prefix=remind-$(VERSION)/ HEAD > src/remind-$(VERSION).tar
gzip -f -v -9 remind-$(VERSION).tar
rm -f ../remind-$(VERSION)
gpg --detach-sign -u dianne@skoll.ca remind-$(VERSION).tar.gz
beta-tgz:
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
cd .. && git archive --worktree-attributes --format=tar --prefix=remind-$(VERSION)-BETA-$(BETA)/ HEAD > src/remind-$(VERSION)-BETA-$(BETA).tar
gzip -f -v -9 remind-$(VERSION)-BETA-$(BETA).tar
rm -f ../remind-$(VERSION)-BETA-$(BETA)
gpg --detach-sign -u dianne@skoll.ca remind-$(VERSION)-BETA-$(BETA).tar.gz
#---------------- Stuff after this added by "make depend" -----------------

File diff suppressed because it is too large Load Diff

View File

@@ -10,15 +10,26 @@
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <glob.h> header file */
#undef HAVE_GLOB_H
#undef HAVE_WCTYPE_H
#undef HAVE_LOCALE_H
#undef HAVE_GLOB
#undef HAVE_SETENV
#undef HAVE_UNSETENV
#undef HAVE_MBSTOWCS
#undef HAVE_SETLOCALE
/* The number of bytes in a unsigned int. */
#undef SIZEOF_UNSIGNED_INT

View File

@@ -6,8 +6,7 @@
/* which you can customize. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -37,7 +36,7 @@
/*---------------------------------------------------------------------*/
#define DEFAULT_PAGE {"Letter", 612, 792}
/* #define DEFAULT_PAGE {"A4", 595, 842} */
/*---------------------------------------------------------------------*/
/* DATESEP: The default date separator. Standard usage is '-'; */
/* others may prefer '/'. */
@@ -52,6 +51,13 @@
#define TIMESEP ':'
/* #define TIMESEP '.' */
/*---------------------------------------------------------------------*/
/* DATETIMESEP: The default datetime separator. Default is '@'; */
/* others may prefer 'T'. */
/*---------------------------------------------------------------------*/
#define DATETIMESEP '@'
/* #define DATETIMESEP '/' */
/*---------------------------------------------------------------------*/
/* ISOLATIN1: define it to 1 if you use the */
/* ISO 8859-1 character set instead of ASCII. */
@@ -140,7 +146,7 @@
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
/* any less than 12. */
/*---------------------------------------------------------------------*/
#define VAR_NAME_LEN 16
#define VAR_NAME_LEN 64
/*---------------------------------------------------------------------*/
/* MAX_PRT_LEN: The maximum number of characters to print when */
@@ -178,17 +184,17 @@
/*---------------------------------------------------------------------*/
/* How many attempts to resolve a weird date spec? */
/*---------------------------------------------------------------------*/
#define TRIG_ATTEMPTS 50
#define TRIG_ATTEMPTS 500
/*---------------------------------------------------------------------*/
/* How many global omits of the form YYYY MM DD do we handle? */
/*---------------------------------------------------------------------*/
#define MAX_FULL_OMITS 250
#define MAX_FULL_OMITS 500
/*---------------------------------------------------------------------*/
/* How many global omits of the form MM DD do we handle? */
/*---------------------------------------------------------------------*/
#define MAX_PARTIAL_OMITS 250
#define MAX_PARTIAL_OMITS 366
/*---------------------------------------------------------------------*/
/* A newline - some systems need "\n\r" */
@@ -214,6 +220,9 @@
#define PSBEGIN "# rem2ps begin"
#define PSEND "# rem2ps end"
#define PSBEGIN2 "# rem2ps2 begin"
#define PSEND2 "# rem2ps2 end"
#ifdef BROKEN_PUTC
#define Putc SafePutc
#define PutChar SafePutChar
@@ -221,3 +230,9 @@
#define Putc putc
#define PutChar putchar
#endif
#if defined(HAVE_MBSTOWCS) && defined(HAVE_WCTYPE_H)
#define REM_USE_WCHAR 1
#else
#undef REM_USE_WCHAR
#endif

View File

@@ -6,8 +6,7 @@
/* which you can customize. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -37,7 +36,7 @@
/*---------------------------------------------------------------------*/
#define DEFAULT_PAGE {"Letter", 612, 792}
/* #define DEFAULT_PAGE {"A4", 595, 842} */
/*---------------------------------------------------------------------*/
/* DATESEP: The default date separator. Standard usage is '-'; */
/* others may prefer '/'. */
@@ -52,6 +51,13 @@
#define TIMESEP ':'
/* #define TIMESEP '.' */
/*---------------------------------------------------------------------*/
/* DATETIMESEP: The default datetime separator. Default is '@'; */
/* others may prefer 'T'. */
/*---------------------------------------------------------------------*/
#define DATETIMESEP '@'
/* #define DATETIMESEP '/' */
/*---------------------------------------------------------------------*/
/* ISOLATIN1: define it to 1 if you use the */
/* ISO 8859-1 character set instead of ASCII. */
@@ -140,7 +146,7 @@
/* VAR_NAME_LEN: The maximum length of variable names. Don't make it */
/* any less than 12. */
/*---------------------------------------------------------------------*/
#define VAR_NAME_LEN 16
#define VAR_NAME_LEN 64
/*---------------------------------------------------------------------*/
/* MAX_PRT_LEN: The maximum number of characters to print when */
@@ -178,17 +184,17 @@
/*---------------------------------------------------------------------*/
/* How many attempts to resolve a weird date spec? */
/*---------------------------------------------------------------------*/
#define TRIG_ATTEMPTS 50
#define TRIG_ATTEMPTS 500
/*---------------------------------------------------------------------*/
/* How many global omits of the form YYYY MM DD do we handle? */
/*---------------------------------------------------------------------*/
#define MAX_FULL_OMITS 250
#define MAX_FULL_OMITS 500
/*---------------------------------------------------------------------*/
/* How many global omits of the form MM DD do we handle? */
/*---------------------------------------------------------------------*/
#define MAX_PARTIAL_OMITS 250
#define MAX_PARTIAL_OMITS 366
/*---------------------------------------------------------------------*/
/* A newline - some systems need "\n\r" */
@@ -214,6 +220,9 @@
#define PSBEGIN "# rem2ps begin"
#define PSEND "# rem2ps end"
#define PSBEGIN2 "# rem2ps2 begin"
#define PSEND2 "# rem2ps2 end"
#ifdef BROKEN_PUTC
#define Putc SafePutc
#define PutChar SafePutChar
@@ -221,3 +230,9 @@
#define Putc putc
#define PutChar putchar
#endif
#if defined(HAVE_MBSTOWCS) && defined(HAVE_WCTYPE_H)
#define REM_USE_WCHAR 1
#else
#undef REM_USE_WCHAR
#endif

View File

@@ -7,8 +7,7 @@
/* commands. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -19,22 +18,29 @@
#include <stdlib.h>
#include "types.h"
#include "globals.h"
#include "err.h"
#include "types.h"
#include "protos.h"
#include "expr.h"
/* Define the shell characters not to escape */
static char const DontEscapeMe[] =
"1234567890_-=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@.,";
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);
static int ComputeTrigDuration(TimeTrig *t);
static int
ComputeTrigDuration(TimeTrig *t)
{
if (t->ttime == NO_TIME ||
t->duration == NO_TIME) {
return 0;
}
return (t->ttime + t->duration - 1) / MINUTES_PER_DAY;
}
/***************************************************************/
/* */
@@ -56,29 +62,57 @@ int DoRem(ParsePtr p)
DBufInit(&buf);
/* Parse the trigger date and time */
if ( (r=ParseRem(p, &trig, &tim, 1)) ) return r;
if ( (r=ParseRem(p, &trig, &tim, 1)) ) {
FreeTrig(&trig);
return r;
}
if (trig.typ == NO_TYPE) return E_EOLN;
if (trig.typ == NO_TYPE) {
PurgeEchoLine("%s\n%s\n", "#!P! Cannot parse next line", CurLine);
FreeTrig(&trig);
return E_EOLN;
}
if (trig.typ == SAT_TYPE) {
PurgeEchoLine("%s\n", "#!P: Cannot purge SATISFY-type reminders");
PurgeEchoLine("%s\n", CurLine);
r=DoSatRemind(&trig, &tim, p);
if (r) return r;
if (!LastTrigValid) return OK;
if (r) {
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
r = OK;
}
FreeTrig(&trig);
if (r == E_EXPIRED) return OK;
return r;
}
if (!LastTrigValid) {
FreeTrig(&trig);
return OK;
}
r=ParseToken(p, &buf);
if (r) return r;
if (r) {
FreeTrig(&trig);
return r;
}
FindToken(DBufValue(&buf), &tok);
DBufFree(&buf);
if (tok.type == T_Empty || tok.type == T_Comment) {
DBufFree(&buf);
FreeTrig(&trig);
return OK;
}
if (tok.type != T_RemType || tok.val == SAT_TYPE) {
DBufFree(&buf);
FreeTrig(&trig);
return E_PARSE_ERR;
}
if (tok.val == PASSTHRU_TYPE) {
r=ParseToken(p, &buf);
if (r) return r;
if (r) {
FreeTrig(&trig);
return r;
}
if (!DBufLen(&buf)) {
FreeTrig(&trig);
DBufFree(&buf);
return E_EOLN;
}
@@ -87,13 +121,45 @@ int DoRem(ParsePtr p)
}
trig.typ = tok.val;
jul = LastTriggerDate;
if (!LastTrigValid) return OK;
if (!LastTrigValid || PurgeMode) {
FreeTrig(&trig);
return OK;
}
} else {
/* Calculate the trigger date */
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 1);
if (r) return r;
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
if (r) {
if (PurgeMode) {
PurgeEchoLine("%s: %s\n", "#!P! Problem calculating trigger date", ErrMsg[r]);
PurgeEchoLine("%s\n", CurLine);
}
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
r = OK;
}
FreeTrig(&trig);
return r;
}
}
if (PurgeMode) {
if (trig.expired || jul < JulianToday) {
if (p->expr_happened) {
if (p->nonconst_expr) {
PurgeEchoLine("%s\n", "#!P: Next line may have expired, but contains non-constant expression");
PurgeEchoLine("%s\n", CurLine);
} else {
PurgeEchoLine("%s\n", "#!P: Next line has expired, but contains expression... please verify");
PurgeEchoLine("#!P: Expired: %s\n", CurLine);
}
} else {
PurgeEchoLine("#!P: Expired: %s\n", CurLine);
}
} else {
PurgeEchoLine("%s\n", CurLine);
}
FreeTrig(&trig);
return OK;
}
/* Queue the reminder, if necessary */
if (jul == JulianToday &&
!(!IgnoreOnce &&
@@ -101,17 +167,21 @@ int DoRem(ParsePtr p)
FileAccessDate == JulianToday))
QueueReminder(p, &trig, &tim, trig.sched);
/* If we're in daemon mode, do nothing over here */
if (Daemon) return OK;
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
if ( (r=TriggerReminder(p, &trig, &tim, jul)) )
{
return r;
}
if (Daemon) {
FreeTrig(&trig);
return OK;
}
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
if ( (r=TriggerReminder(p, &trig, &tim, jul)) ) {
FreeTrig(&trig);
return r;
}
}
FreeTrig(&trig);
return OK;
}
}
/***************************************************************/
/* */
@@ -126,7 +196,6 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
register int r;
DynamicBuffer buf;
Token tok;
int y, m, d;
DBufInit(&buf);
@@ -144,11 +213,16 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
trig->once = NO_ONCE;
trig->typ = NO_TYPE;
trig->scanfrom = NO_DATE;
trig->from = NO_DATE;
trig->priority = DefaultPrio;
trig->sched[0] = 0;
trig->warn[0] = 0;
trig->omitfunc[0] = 0;
trig->tag[0] = 0;
trig->duration_days = 0;
trig->eventstart = NO_TIME;
trig->eventduration = NO_TIME;
trig->maybe_uncomputable = 0;
DBufInit(&(trig->tags));
trig->passthru[0] = 0;
tim->ttime = NO_TIME;
tim->delta = NO_DELTA;
@@ -189,6 +263,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
tim->ttime = (tok.val % MINUTES_PER_DAY);
if (save_in_globals) {
LastTriggerTime = tim->ttime;
SaveLastTimeTrig(tim);
}
break;
@@ -204,6 +279,10 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
trig->m = tok.val;
break;
case T_MaybeUncomputable:
trig->maybe_uncomputable = 1;
break;
case T_Skip:
DBufFree(&buf);
if (trig->skip != NO_SKIP) return E_SKIP_ERR;
@@ -220,6 +299,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
DBufFree(&buf);
r=ParseTimeTrig(s, tim, save_in_globals);
if (r) return r;
trig->duration_days = ComputeTrigDuration(tim);
break;
case T_Scanfrom:
@@ -244,6 +324,14 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
}
return OK;
case T_Through:
DBufFree(&buf);
if (trig->rep != NO_REP) return E_REP_TWICE;
trig->rep = 1;
r = ParseUntil(s, trig);
if (r) return r;
break;
case T_Until:
DBufFree(&buf);
r=ParseUntil(s, trig);
@@ -308,6 +396,10 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
r=ParseToken(s, &buf);
if (r) return r;
StrnCpy(trig->omitfunc, DBufValue(&buf), VAR_NAME_LEN);
/* An OMITFUNC counts as a nonconst_expr! */
s->expr_happened = 1;
s->nonconst_expr = 1;
DBufFree(&buf);
break;
@@ -321,7 +413,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
case T_Tag:
r = ParseToken(s, &buf);
if (r) return r;
StrnCpy(trig->tag, DBufValue(&buf), TAG_LEN);
AppendTag(&(trig->tags), DBufValue(&buf));
break;
case T_Duration:
@@ -332,7 +424,18 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals)
switch(tok.type) {
case T_Time:
case T_LongTime:
tim->duration = tok.val;
case T_Year:
case T_Day:
case T_Number:
if (tok.val != 0) {
tim->duration = tok.val;
} else {
tim->duration = NO_TIME;
}
if (save_in_globals) {
SaveLastTimeTrig(tim);
}
trig->duration_days = ComputeTrigDuration(tim);
break;
default:
return E_BAD_TIME;
@@ -382,16 +485,19 @@ static int ParseTimeTrig(ParsePtr s, TimeTrig *tim, int save_in_globals)
switch(tok.type) {
case T_Time:
DBufFree(&buf);
if (tim->ttime != NO_TIME) return E_TIME_TWICE;
tim->ttime = tok.val;
break;
case T_Delta:
DBufFree(&buf);
if (tim->delta != NO_DELTA) return E_DELTA_TWICE;
tim->delta = (tok.val > 0) ? tok.val : -tok.val;
break;
case T_Rep:
DBufFree(&buf);
if (tim->rep != NO_REP) return E_REP_TWICE;
tim->rep = tok.val;
break;
@@ -401,6 +507,7 @@ static int ParseTimeTrig(ParsePtr s, TimeTrig *tim, int save_in_globals)
/* Save trigger time in global variable */
if (save_in_globals) {
LastTriggerTime = tim->ttime;
SaveLastTimeTrig(tim);
}
PushToken(DBufValue(&buf), s);
DBufFree(&buf);
@@ -599,6 +706,30 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
FromJulian(tok.val, &y, &m, &d);
break;
case T_Back:
DBufFree(&buf);
if (type != SCANFROM_TYPE) {
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
return E_INCOMPLETE;
}
if (y != NO_YR) {
Eprint("%s: %s", word, ErrMsg[E_YR_TWICE]);
return E_YR_TWICE;
}
if (m != NO_MON) {
Eprint("%s: %s", word, ErrMsg[E_MON_TWICE]);
return E_MON_TWICE;
}
if (d != NO_DAY) {
Eprint("%s: %s", word, ErrMsg[E_DAY_TWICE]);
return E_DAY_TWICE;
}
if (tok.val < 0) {
tok.val = -tok.val;
}
FromJulian(JulianToday - tok.val, &y, &m, &d);
break;
default:
if (y == NO_YR || m == NO_MON || d == NO_DAY) {
Eprint("%s: %s", word, ErrMsg[E_INCOMPLETE]);
@@ -611,9 +742,12 @@ static int ParseScanFrom(ParsePtr s, Trigger *t, int type)
}
t->scanfrom = Julian(y, m, d);
if (type == FROM_TYPE) {
t->from = t->scanfrom;
if (t->scanfrom < JulianToday) {
t->scanfrom = JulianToday;
}
} else {
t->from = NO_DATE;
}
PushToken(DBufValue(&buf), s);
@@ -639,32 +773,44 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
char const *s;
Value v;
int red = -1, green = -1, blue = -1;
int is_color = 0;
DBufInit(&buf);
DBufInit(&calRow);
DBufInit(&pre_buf);
if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED;
if ((t->typ == PASSTHRU_TYPE && strcmp(t->passthru, "COLOR")) ||
if ((t->typ == PASSTHRU_TYPE && StrCmpi(t->passthru, "COLOR") && StrCmpi(t->passthru, "COLOUR")) ||
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")) {
if (t->typ == PASSTHRU_TYPE && (!StrCmpi(t->passthru, "COLOR") || !StrCmpi(t->passthru, "COLOUR"))) {
/* Strip off three tokens */
r = ParseToken(p, &buf);
DBufPuts(&pre_buf, DBufValue(&buf));
DBufPutc(&pre_buf, ' ');
sscanf(DBufValue(&buf), "%d", &red);
if (!NextMode) {
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, ' ');
sscanf(DBufValue(&buf), "%d", &green);
if (!NextMode) {
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, ' ');
sscanf(DBufValue(&buf), "%d", &blue);
if (!NextMode) {
DBufPuts(&pre_buf, DBufValue(&buf));
DBufPutc(&pre_buf, ' ');
}
DBufFree(&buf);
if (r) return r;
t->typ = MSG_TYPE;
@@ -680,10 +826,10 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
DBufFree(&buf);
}
/* If it's NextMode, process as a CAL-type entry, and issue simple-calendar
format. */
/* If it's NextMode, process as a ADVANCE_MODE-type entry, and issue
simple-calendar format. */
if (NextMode) {
if ( (r=DoSubst(p, &buf, t, tim, jul, CAL_MODE)) ) return r;
if ( (r=DoSubst(p, &buf, t, tim, jul, ADVANCE_MODE)) ) return r;
if (!DBufLen(&buf)) {
DBufFree(&buf);
DBufFree(&pre_buf);
@@ -704,16 +850,12 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
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 (*DBufValue(&(t->tags))) {
DBufPuts(&calRow, DBufValue(&(t->tags)));
DBufPutc(&calRow, ' ');
} else {
DBufPuts(&calRow, "* ");
}
if (tim->duration != NO_TIME) {
sprintf(tmpBuf, "%d ", tim->duration);
} else {
@@ -748,38 +890,76 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
return OK;
}
/* Put the substituted string into the substitution buffer */
if (UserFuncExists("msgprefix") == 1) {
sprintf(PrioExpr, "msgprefix(%d)", t->priority);
s = PrioExpr;
r = EvalExpr(&s, &v);
if (!r) {
if (!DoCoerce(STR_TYPE, &v)) {
if (DBufPuts(&buf, v.v.str) != OK) {
DBufFree(&buf);
DestroyValue(v);
return E_NO_MEM;
}
/* Correct colors */
if (UseVTColors) {
if (red == -1 && green == -1 && blue == -1) {
if (DefaultColorR != -1 && DefaultColorG != -1 && DefaultColorB != -1) {
red = DefaultColorR;
green = DefaultColorG;
blue = DefaultColorB;
}
DestroyValue(v);
}
if (red >= 0 && green >= 0 && blue >= 0) {
is_color = 1;
if (red > 255) red = 255;
if (green > 255) green = 255;
if (blue > 255) blue = 255;
}
}
/* Put the substituted string into the substitution buffer */
/* Don't use msgprefix() on RUN-type reminders */
if (t->typ != RUN_TYPE) {
if (UserFuncExists("msgprefix") == 1) {
sprintf(PrioExpr, "msgprefix(%d)", t->priority);
s = PrioExpr;
r = EvalExpr(&s, &v, NULL);
if (!r) {
if (!DoCoerce(STR_TYPE, &v)) {
if (is_color) {
DBufPuts(&buf, Colorize(red, green, blue));
}
if (DBufPuts(&buf, v.v.str) != OK) {
DBufFree(&buf);
DestroyValue(v);
return E_NO_MEM;
}
}
DestroyValue(v);
}
}
}
if (is_color) {
DBufPuts(&buf, Colorize(red, green, blue));
}
if ( (r=DoSubst(p, &buf, t, tim, jul, NORMAL_MODE)) ) return r;
if (UserFuncExists("msgsuffix") == 1) {
sprintf(PrioExpr, "msgsuffix(%d)", t->priority);
s = PrioExpr;
r = EvalExpr(&s, &v);
if (!r) {
if (!DoCoerce(STR_TYPE, &v)) {
if (DBufPuts(&buf, v.v.str) != OK) {
DBufFree(&buf);
DestroyValue(v);
return E_NO_MEM;
if (t->typ != RUN_TYPE) {
if (UserFuncExists("msgsuffix") == 1) {
sprintf(PrioExpr, "msgsuffix(%d)", t->priority);
s = PrioExpr;
r = EvalExpr(&s, &v, NULL);
if (!r) {
if (!DoCoerce(STR_TYPE, &v)) {
if (is_color) {
DBufPuts(&buf, Colorize(red, green, blue));
}
if (DBufPuts(&buf, v.v.str) != OK) {
DBufFree(&buf);
DestroyValue(v);
return E_NO_MEM;
}
}
DestroyValue(v);
}
DestroyValue(v);
}
}
if (is_color) {
DBufPuts(&buf, Decolorize(red, green, blue));
}
if ((!MsgCommand && t->typ == MSG_TYPE) || t->typ == MSF_TYPE) {
if (DBufPutc(&buf, '\n') != OK) {
DBufFree(&buf);
@@ -814,7 +994,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
break;
case RUN_TYPE:
system(DBufValue(&buf));
System(DBufValue(&buf));
break;
default: /* Unknown/illegal type? */
@@ -849,7 +1029,17 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err)
/* Don't trigger timed reminders if DontIssueAts is true, and if the
reminder is for today */
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0;
if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) {
if (DontIssueAts > 1) {
/* If two or more -a options, then *DO* issue ats that are in the
future */
if (tim->ttime < SystemTime(0) / 60) {
return 0;
}
} else {
return 0;
}
}
/* Don't trigger "old" timed reminders */
/*** REMOVED...
@@ -876,9 +1066,9 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err)
if (t->delta < 0)
jul = jul + t->delta;
else {
r = t->delta;
int iter = 0;
int max = MaxSatIter;
r = t->delta;
if (max < r*2) max = r*2;
while(iter++ < max) {
if (!r || (jul <= JulianToday)) {
@@ -908,37 +1098,79 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err)
/* Do the "satisfying..." remind calculation. */
/* */
/***************************************************************/
int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
int DoSatRemind(Trigger *trig, TimeTrig *tt, ParsePtr p)
{
int iter, jul, r;
int iter, jul, r, start;
Value v;
char const *s;
char const *t;
t = p->pos;
iter = 0;
jul = trig->scanfrom;
start = trig->scanfrom;
while (iter++ < MaxSatIter) {
jul = ComputeTrigger(jul, trig, &r, 1);
jul = ComputeTriggerNoAdjustDuration(start, trig, tt, &r, 1, 0);
if (r) {
if (r == E_CANT_TRIG) return OK; else return r;
}
if (jul != start && trig->duration_days) {
jul = ComputeTriggerNoAdjustDuration(start, trig, tt, &r, 1, trig->duration_days);
if (r) {
if (r == E_CANT_TRIG) return OK; else return r;
}
} else if (jul == start) {
if (tt->ttime != NO_TIME) {
trig->eventstart = MINUTES_PER_DAY * r + tt->ttime;
if (tt->duration != NO_TIME) {
trig->eventduration = tt->duration;
}
}
SaveAllTriggerInfo(trig, tt, jul, tt->ttime, 1);
}
if (jul == -1) {
return OK;
return E_EXPIRED;
}
s = p->pos;
r = EvaluateExpr(p, &v);
t = p->pos;
if (r) return r;
if (v.type != INT_TYPE && v.type != STR_TYPE) return E_BAD_TYPE;
if (v.type == INT_TYPE && v.v.val) return OK;
if (v.type == STR_TYPE && *v.v.str) return OK;
if ((v.type == INT_TYPE && v.v.val) ||
(v.type == STR_TYPE && *v.v.str)) {
AdjustTriggerForDuration(trig->scanfrom, jul, trig, tt, 1);
if (DebugFlag & DB_PRTTRIG) {
int y, m, d;
FromJulian(LastTriggerDate, &y, &m, &d);
fprintf(ErrFp, "%s(%d): Trig(satisfied) = %s, %d %s, %d",
FileName, LineNo,
DayName[LastTriggerDate % 7],
d,
MonthName[m],
y);
if (tt->ttime != NO_TIME) {
fprintf(ErrFp, " AT %02d:%02d",
(tt->ttime / 60),
(tt->ttime % 60));
if (tt->duration != NO_TIME) {
fprintf(ErrFp, " DURATION %02d:%02d",
(tt->duration / 60),
(tt->duration % 60));
}
}
fprintf(ErrFp, "\n");
}
return OK;
}
p->pos = s;
jul++;
if (jul+trig->duration_days < start) {
start++;
} else {
start = jul+trig->duration_days+1;
}
}
p->pos = t;
LastTrigValid = 0;
return OK;
return E_CANT_TRIG;
}
/***************************************************************/
@@ -994,24 +1226,16 @@ int DoMsgCommand(char const *cmd, char const *msg)
DynamicBuffer execBuffer;
DynamicBuffer buf;
char const *s;
DBufInit(&buf);
DBufInit(&execBuffer);
/* Escape shell characters in msg INCLUDING WHITESPACE! */
for (s=msg; *s; s++) {
if (isspace(*s) || !strchr(DontEscapeMe, *s)) {
if (DBufPutc(&buf, '\\') != OK) {
r = E_NO_MEM;
goto finished;
}
}
if (DBufPutc(&buf, *s) != OK) {
r = E_NO_MEM;
goto finished;
}
/* Escape shell characters in msg */
if (ShellEscape(msg, &buf) != OK) {
r = E_NO_MEM;
goto finished;
}
msg = DBufValue(&buf);
/* Do "%s" substitution */
@@ -1032,7 +1256,7 @@ int DoMsgCommand(char const *cmd, char const *msg)
}
r = OK;
system(DBufValue(&execBuffer));
System(DBufValue(&execBuffer));
finished:
DBufFree(&buf);
@@ -1065,7 +1289,7 @@ static int ShouldTriggerBasedOnWarn(Trigger *t, int jul, int *err)
for (i=1; ; i++) {
sprintf(buffer, "%s(%d)", t->warn, i);
s = buffer;
r = EvalExpr(&s, &v);
r = EvalExpr(&s, &v, NULL);
if (r) {
Eprint("%s: `%s': %s", ErrMsg[M_BAD_WARN_FUNC],
t->warn, ErrMsg[r]);

View File

@@ -6,8 +6,7 @@
/* reminders are triggered. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -19,9 +18,9 @@
#include <stdlib.h>
#include "types.h"
#include "globals.h"
#include "err.h"
#include "types.h"
#include "protos.h"
#define UPPER(c) (islower(c) ? toupper(c) : (c))
@@ -62,6 +61,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
char *os;
char s[256];
int origLen = DBufLen(dbuf);
int altmode;
FromJulian(jul, &y, &m, &d);
@@ -141,6 +141,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
continue;
}
altmode = 0;
s[0] = 0;
c = ParseChar(p, &err, 0);
if (err) {
@@ -150,6 +151,17 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
if (!c) {
break;
}
if (c == '*') {
altmode = c;
c = ParseChar(p, &err, 0);
if (err) {
DBufFree(dbuf);
return err;
}
if (!c) {
break;
}
}
done = 0;
if (diff <= 1) {
switch(UPPER(c)) {
@@ -206,8 +218,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_A_OVER
L_A_OVER
#else
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
MonthName[m], y);
if (altmode == '*') {
sprintf(s, "%s, %d %s, %d", DayName[jul%7], d,
MonthName[m], y);
} else {
sprintf(s, "%s %s, %d %s, %d", L_ON, DayName[jul%7], d,
MonthName[m], y);
}
#endif
SHIP_OUT(s);
break;
@@ -225,7 +242,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_C_OVER
L_C_OVER
#else
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
if (altmode == '*') {
sprintf(s, "%s", DayName[jul%7]);
} else {
sprintf(s, "%s %s", L_ON, DayName[jul%7]);
}
#endif
SHIP_OUT(s);
break;
@@ -243,8 +264,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_E_OVER
L_E_OVER
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, d, DateSep,
m+1, DateSep, y);
if (altmode == '*') {
sprintf(s, "%02d%c%02d%c%04d", 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;
@@ -253,7 +279,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_F_OVER
L_F_OVER
#else
sprintf(s, "%s %02d%c%02d%c%04d", L_ON, m+1, DateSep, d, DateSep, y);
if (altmode == '*') {
sprintf(s, "%02d%c%02d%c%04d", 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;
@@ -262,7 +292,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_G_OVER
L_G_OVER
#else
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
if (altmode == '*') {
sprintf(s, "%s, %d %s", DayName[jul%7], d, MonthName[m]);
} else {
sprintf(s, "%s %s, %d %s", L_ON, DayName[jul%7], d, MonthName[m]);
}
#endif
SHIP_OUT(s);
break;
@@ -271,7 +305,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_H_OVER
L_H_OVER
#else
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
if (altmode == '*') {
sprintf(s, "%02d%c%02d", d, DateSep, m+1);
} else {
sprintf(s, "%s %02d%c%02d", L_ON, d, DateSep, m+1);
}
#endif
SHIP_OUT(s);
break;
@@ -280,7 +318,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_I_OVER
L_I_OVER
#else
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
if (altmode == '*') {
sprintf(s, "%02d%c%02d", m+1, DateSep, d);
} else {
sprintf(s, "%s %02d%c%02d", L_ON, m+1, DateSep, d);
}
#endif
SHIP_OUT(s);
break;
@@ -289,8 +331,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_J_OVER
L_J_OVER
#else
sprintf(s, "%s %s, %s %d%s, %d", L_ON, DayName[jul%7],
MonthName[m], d, plu, y);
if (altmode == '*') {
sprintf(s, "%s, %s %d%s, %d", DayName[jul%7],
MonthName[m], d, plu, y);
} else {
sprintf(s, "%s %s, %s %d%s, %d", L_ON, DayName[jul%7],
MonthName[m], d, plu, y);
}
#endif
SHIP_OUT(s);
break;
@@ -299,8 +346,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_K_OVER
L_K_OVER
#else
sprintf(s, "%s %s, %s %d%s", L_ON, DayName[jul%7],
MonthName[m], d, plu);
if (altmode == '*') {
sprintf(s, "%s, %s %d%s", DayName[jul%7],
MonthName[m], d, plu);
} else {
sprintf(s, "%s %s, %s %d%s", L_ON, DayName[jul%7],
MonthName[m], d, plu);
}
#endif
SHIP_OUT(s);
break;
@@ -309,7 +361,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_L_OVER
L_L_OVER
#else
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DateSep, m+1, DateSep, d);
if (altmode == '*') {
sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
} else {
sprintf(s, "%s %04d%c%02d%c%02d", L_ON, y, DateSep, m+1, DateSep, d);
}
#endif
SHIP_OUT(s);
break;
@@ -391,8 +447,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_U_OVER
L_U_OVER
#else
sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], d,
plu, MonthName[m], y);
if (altmode == '*') {
sprintf(s, "%s, %d%s %s, %d", DayName[jul%7], d,
plu, MonthName[m], y);
} else {
sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], d,
plu, MonthName[m], y);
}
#endif
SHIP_OUT(s);
break;
@@ -401,8 +462,13 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_V_OVER
L_V_OVER
#else
sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu,
MonthName[m]);
if (altmode == '*') {
sprintf(s, "%s, %d%s %s", DayName[jul%7], d, plu,
MonthName[m]);
} else {
sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu,
MonthName[m]);
}
#endif
SHIP_OUT(s);
break;
@@ -464,7 +530,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
#ifdef L_2_OVER
L_2_OVER
#else
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TimeSep, min, pm);
if (altmode == '*') {
sprintf(s, "%d%c%02d%s", hh, TimeSep, min, pm);
} else {
sprintf(s, "%s %d%c%02d%s", L_AT, hh, TimeSep, min, pm);
}
#endif
SHIP_OUT(s);
break;
@@ -474,7 +544,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
L_3_OVER
#else
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
if (altmode == '*') {
sprintf(s, "%02d%c%02d", h, TimeSep, min);
} else {
sprintf(s, "%s %02d%c%02d", L_AT, h, TimeSep, min);
}
#endif
SHIP_OUT(s);
break;
@@ -570,10 +644,11 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
break;
case '_':
if (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)
if (PsCal == PSCAL_LEVEL2 || PsCal == PSCAL_LEVEL3 || (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)) {
sprintf(s, "%s", NL);
else
} else {
sprintf(s, " ");
}
SHIP_OUT(s);
break;
@@ -582,16 +657,24 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
break;
case '"':
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
has_quote = 1;
if (PsCal != PSCAL_LEVEL3) {
if (DBufPutc(dbuf, QUOTE_MARKER) != OK) return E_NO_MEM;
has_quote = 1;
} else {
if (DBufPutc(dbuf, '%') != OK) return E_NO_MEM;
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
}
break;
default:
if (DBufPutc(dbuf, c) != OK) return E_NO_MEM;
}
if (isupper(c)) {
os = DBufValue(dbuf) - strlen(s);
*os = UPPER(*os);
os = DBufValue(dbuf);
os += strlen(os) - strlen(s);
if (os >= DBufValue(dbuf)) {
*os = UPPER(*os);
}
}
}

View File

@@ -6,8 +6,7 @@
/* buffers. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -151,7 +150,9 @@ int DBufGets(DynamicBuffer *dbuf, FILE *fp)
we can usually save some unnecessary copying */
*(dbuf->buffer) = 0;
fgets(dbuf->buffer, dbuf->allocatedLen, fp);
if (fgets(dbuf->buffer, dbuf->allocatedLen, fp) == NULL) {
return OK;
}
if (!*(dbuf->buffer)) return OK;
dbuf->len = strlen(dbuf->buffer);
l = dbuf->len - 1;
@@ -163,7 +164,7 @@ int DBufGets(DynamicBuffer *dbuf, FILE *fp)
while(busy) {
*tmp = 0;
fgets(tmp, 256, fp);
if (fgets(tmp, 256, fp) == NULL) return OK;
if (!*tmp) return OK;
l = strlen(tmp) - 1;
if (tmp[l] == '\n') {

View File

@@ -5,8 +5,7 @@
/* Declaration of functions for manipulating dynamic buffers */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -5,8 +5,7 @@
/* Error definitions. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -119,7 +118,8 @@
#define E_CANT_CONVERT_TZ 99
#define E_NO_MATCHING_REMS 100
#define E_STRING_TOO_LONG 101
#define E_TIME_TWICE 102
#define E_DURATION_NO_AT 103
#ifdef MK_GLOBALS
#undef EXTERN
#define EXTERN
@@ -205,7 +205,7 @@ EXTERN char *ErrMsg[]
"Back value specified twice",
"ONCE keyword used twice. (Hah.)",
"Expecting time after AT",
"UNTIL keyword used twice",
"THROUGH/UNTIL keyword used twice",
"Incomplete date specification",
"FROM/SCANFROM keyword used twice",
"Variable",
@@ -234,7 +234,9 @@ EXTERN char *ErrMsg[]
"Bad function in WARN clause",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
}
#endif /* MK_GLOBALS */
;

View File

@@ -5,8 +5,7 @@
/* This file contains routines to parse and evaluate */
/* expressions. */
/* */
/* Copyright 1992-1998 by David F. Skoll */
/* Copyright (C) 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -14,6 +13,7 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
@@ -31,7 +31,6 @@
#define LE 4
#define NE 5
static char CoerceBuf[512];
extern int NumFuncs;
static int Multiply(void), Divide(void), Mod(void), Add(void),
@@ -41,7 +40,7 @@ static int Multiply(void), Divide(void), Mod(void), Add(void),
UnMinus(void), LogNot(void),
Compare(int);
static int MakeValue (char const *s, Value *v, Var *locals);
static int MakeValue (char const *s, Value *v, Var *locals, ParsePtr p);
/* Binary operators - all left-associative */
@@ -132,7 +131,7 @@ static void CleanStack(void)
static char PeekChar(char const **s)
{
char const *t = *s;
while (*t && isspace(*t)) t++;
while (*t && isempty(*t)) t++;
return *t;
}
@@ -150,7 +149,7 @@ static int ParseExprToken(DynamicBuffer *buf, char const **in)
DBufFree(buf);
/* Skip white space */
while (**in && isspace(**in)) (*in)++;
while (**in && isempty(**in)) (*in)++;
if (!**in) return OK;
@@ -283,7 +282,7 @@ static int ParseExprToken(DynamicBuffer *buf, char const **in)
(*in)++;
}
/* Chew up any remaining white space */
while (**in && isspace(**in)) (*in)++;
while (**in && isempty(**in)) (*in)++;
/* Peek ahead - is it '('? Then we have a function call */
if (**in == '(') {
@@ -303,14 +302,14 @@ static int ParseExprToken(DynamicBuffer *buf, char const **in)
/* Put the result into value pointed to by v. */
/* */
/***************************************************************/
int EvalExpr(char const **e, Value *v)
int EvalExpr(char const **e, Value *v, ParsePtr p)
{
int r;
OpStackPtr = 0;
ValStackPtr = 0;
r = Evaluate(e, NULL);
r = Evaluate(e, NULL, p);
/* Put last character parsed back onto input stream */
if (DBufLen(&ExprBuf)) (*e)--;
@@ -326,7 +325,7 @@ int EvalExpr(char const **e, Value *v)
}
/* Evaluate - do the actual work of evaluation. */
int Evaluate(char const **s, Var *locals)
int Evaluate(char const **s, Var *locals, ParsePtr p)
{
int OpBase, ValBase;
int r;
@@ -351,7 +350,7 @@ int Evaluate(char const **s, Var *locals)
if (*DBufValue(&ExprBuf) == '(') { /* Parenthesized expression */
DBufFree(&ExprBuf);
r = Evaluate(s, locals); /* Leaves the last parsed token in ExprBuf */
r = Evaluate(s, locals, p); /* Leaves the last parsed token in ExprBuf */
if (r) return r;
r = OK;
if (*DBufValue(&ExprBuf) != ')') {
@@ -374,9 +373,11 @@ int Evaluate(char const **s, Var *locals)
}
args = 0;
if (PeekChar(s) == ')') { /* Function has no arguments */
if (f) r = CallFunc(f, 0);
else {
r = CallUserFunc(ufname, 0);
if (f) {
if (!f->is_constant && (p != NULL)) p->nonconst_expr = 1;
r = CallFunc(f, 0);
} else {
r = CallUserFunc(ufname, 0, p);
free((char *) ufname);
}
if (r) return r;
@@ -385,7 +386,7 @@ int Evaluate(char const **s, Var *locals)
} else { /* Function has some arguments */
while(1) {
args++;
r = Evaluate(s, locals);
r = Evaluate(s, locals, p);
if (r) {
if (!f) free((char *) ufname);
return r;
@@ -399,9 +400,11 @@ int Evaluate(char const **s, Var *locals)
return E_EXPECT_COMMA;
}
}
if (f) r = CallFunc(f, args);
else {
r = CallUserFunc(ufname, args);
if (f) {
if (!f->is_constant && (p != NULL)) p->nonconst_expr = 1;
r = CallFunc(f, args);
} else {
r = CallUserFunc(ufname, args, p);
free((char *) ufname);
}
DBufFree(&ExprBuf);
@@ -422,7 +425,7 @@ int Evaluate(char const **s, Var *locals)
DBufFree(&ExprBuf);
return E_ILLEGAL_CHAR;
} else { /* Must be a literal value */
r = MakeValue(DBufValue(&ExprBuf), &va, locals);
r = MakeValue(DBufValue(&ExprBuf), &va, locals, p);
DBufFree(&ExprBuf);
if (r) return r;
PushValStack(va);
@@ -486,10 +489,12 @@ int Evaluate(char const **s, Var *locals)
/* a date or the value of a symbol. */
/* */
/***************************************************************/
static int MakeValue(char const *s, Value *v, Var *locals)
static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
{
int len;
int h, m, r;
int ampm = 0;
int prev_val;
if (*s == '\"') { /* It's a literal string "*/
len = strlen(s)-1;
@@ -516,9 +521,15 @@ static int MakeValue(char const *s, Value *v, Var *locals)
return OK;
} else if (isdigit(*s)) { /* It's a number - use len to hold it.*/
len = 0;
prev_val = 0;
while (*s && isdigit(*s)) {
len *= 10;
len += (*s++ - '0');
if (len < prev_val) {
/* We overflowed */
return E_2HIGH;
}
prev_val = len;
}
if (*s == ':' || *s == '.' || *s == TimeSep) { /* Must be a literal time */
s++;
@@ -530,7 +541,27 @@ static int MakeValue(char const *s, Value *v, Var *locals)
m += *s - '0';
s++;
}
/* Check for p[m] or a[m] */
if (*s == 'A' || *s == 'a' || *s == 'P' || *s == 'p') {
ampm = tolower(*s);
s++;
if (*s == 'm' || *s == 'M') {
s++;
}
}
if (*s || h>23 || m>59) return E_BAD_TIME;
if (ampm) {
if (h < 1 || h > 12) return E_BAD_TIME;
if (ampm == 'a') {
if (h == 12) {
h = 0;
}
} else if (ampm == 'p') {
if (h < 12) {
h += 12;
}
}
}
v->type = TIME_TYPE;
v->v.val = h*60 + m;
return OK;
@@ -541,6 +572,7 @@ static int MakeValue(char const *s, Value *v, Var *locals)
v->v.val = len;
return OK;
} else if (*s == '$') { /* A system variable */
if (p) p->nonconst_expr = 1;
if (DebugFlag & DB_PRTEXPR)
fprintf(ErrFp, "%s => ", s);
r = GetSysVar(s+1, v);
@@ -551,10 +583,11 @@ static int MakeValue(char const *s, Value *v, Var *locals)
Putc('\n', ErrFp);
}
return r;
} else /* Must be a symbol */
} else { /* Must be a symbol */
if (DebugFlag & DB_PRTEXPR)
fprintf(ErrFp, "%s => ", s);
r = GetVarValue(s, v, locals);
}
r = GetVarValue(s, v, locals, p);
if (! (DebugFlag & DB_PRTEXPR)) return r;
if (r == OK) {
PrintValue(v, ErrFp);
@@ -573,6 +606,8 @@ int DoCoerce(char type, Value *v)
int h, d, m, y, i, k;
char const *s;
char coerce_buf[128];
/* Do nothing if value is already the right type */
if (type == v->type) return OK;
@@ -600,12 +635,12 @@ int DoCoerce(char type, Value *v)
}
case STR_TYPE:
switch(v->type) {
case INT_TYPE: sprintf(CoerceBuf, "%d", v->v.val); break;
case TIME_TYPE: sprintf(CoerceBuf, "%02d%c%02d", v->v.val / 60,
case INT_TYPE: sprintf(coerce_buf, "%d", v->v.val); break;
case TIME_TYPE: sprintf(coerce_buf, "%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",
sprintf(coerce_buf, "%04d%c%02d%c%02d",
y, DateSep, m+1, DateSep, d);
break;
case DATETIME_TYPE:
@@ -614,13 +649,13 @@ int DoCoerce(char type, Value *v)
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);
sprintf(coerce_buf, "%04d%c%02d%c%02d%c%02d%c%02d",
y, DateSep, m+1, DateSep, d, DateTimeSep, h, TimeSep, i);
break;
default: return E_CANT_COERCE;
}
v->type = STR_TYPE;
v->v.str = StrDup(CoerceBuf);
v->v.str = StrDup(coerce_buf);
if (!v->v.str) {
v->type = ERR_TYPE;
return E_NO_MEM;
@@ -695,26 +730,12 @@ int DoCoerce(char type, Value *v)
return OK;
case STR_TYPE:
h = 0;
m = 0;
s = v->v.str;
if (!isdigit(*s)) return E_CANT_COERCE;
while (isdigit(*s)) {
h *= 10;
h += *s++ - '0';
}
if (*s != ':' && *s != '.' && *s != TimeSep)
return E_CANT_COERCE;
s++;
if (!isdigit(*s)) return E_CANT_COERCE;
while (isdigit(*s)) {
m *= 10;
m += *s++ - '0';
}
if (*s || h>23 || m>59) return E_CANT_COERCE;
if (ParseLiteralTime(&s, &i)) return E_CANT_COERCE;
if (*s) return E_CANT_COERCE;
v->type = TIME_TYPE;
free(v->v.str);
v->v.val = h*60+m;
v->v.val = i;
return OK;
default: return E_CANT_COERCE;
@@ -745,35 +766,49 @@ static int Add(void)
/* If both are ints, just add 'em */
if (v2.type == INT_TYPE && v1.type == INT_TYPE) {
v2.v.val += v1.v.val;
PushValStack(v2);
int old = v1.v.val;
v1.v.val += v2.v.val;
/* Check for overflow */
if (_private_add_overflow(v1.v.val, v2.v.val, old)) {
return E_2HIGH;
}
PushValStack(v1);
return OK;
}
/* If it's a date plus an int, add 'em */
if ((v1.type == DATE_TYPE && v2.type == INT_TYPE) ||
(v1.type == INT_TYPE && v2.type == DATE_TYPE)) {
int old = v1.v.val;
v1.v.val += v2.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
if (v1.v.val < 0) return E_DATE_OVER;
v1.type = DATE_TYPE;
PushValStack(v1);
return OK;
}
/* 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)) {
/* If it's a datetime plus an int or a time, add 'em */
if ((v1.type == DATETIME_TYPE && (v2.type == INT_TYPE || v2.type == TIME_TYPE)) ||
((v1.type == INT_TYPE || v1.type == TIME_TYPE) && v2.type == DATETIME_TYPE)) {
int old = v1.v.val;
v1.v.val += v2.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
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 it's a time plus an int or a time plus a time,
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;
(v1.type == INT_TYPE && v2.type == TIME_TYPE) ||
(v1.type == TIME_TYPE && v2.type == TIME_TYPE)) {
int old = v1.v.val;
v1.v.val += v2.v.val;
if (_private_add_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
v1.v.val = v1.v.val % MINUTES_PER_DAY;
if (v1.v.val < 0) v1.v.val += MINUTES_PER_DAY;
v1.type = TIME_TYPE;
PushValStack(v1);
@@ -793,7 +828,7 @@ static int Add(void)
v3.type = STR_TYPE;
l1 = strlen(v1.v.str);
l2 = strlen(v2.v.str);
if (MaxStringLen && (l1 + l2 > MaxStringLen)) {
if (MaxStringLen && (l1 + l2 > (size_t) MaxStringLen)) {
DestroyValue(v1); DestroyValue(v2);
return E_STRING_TOO_LONG;
}
@@ -803,7 +838,7 @@ static int Add(void)
return E_NO_MEM;
}
strcpy(v3.v.str, v1.v.str);
strcat(v3.v.str, v2.v.str);
strcpy(v3.v.str+l1, v2.v.str);
DestroyValue(v1); DestroyValue(v2);
PushValStack(v3);
return OK;
@@ -833,22 +868,29 @@ static int Subtract(void)
/* If they're both INTs, do subtraction */
if (v1.type == INT_TYPE && v2.type == INT_TYPE) {
int old = v1.v.val;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_2HIGH;
PushValStack(v1);
return OK;
}
/* If it's a date minus an int, do subtraction, checking for underflow */
if (v1.type == DATE_TYPE && v2.type == INT_TYPE) {
int old = v1.v.val;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
if (v1.v.val < 0) return E_DATE_OVER;
PushValStack(v1);
return OK;
}
/* If it's a datetime minus an int, do subtraction, checking for underflow */
if (v1.type == DATETIME_TYPE && v2.type == INT_TYPE) {
/* If it's a datetime minus an int or a time, do subtraction,
* checking for underflow */
if (v1.type == DATETIME_TYPE && (v2.type == INT_TYPE || v2.type == TIME_TYPE)) {
int old = v1.v.val;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
if (v1.v.val < 0) return E_DATE_OVER;
PushValStack(v1);
return OK;
@@ -866,7 +908,9 @@ static int Subtract(void)
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)) {
int old = v1.v.val;
v1.v.val -= v2.v.val;
if (_private_sub_overflow(v1.v.val, v2.v.val, old)) return E_DATE_OVER;
v1.type = INT_TYPE;
PushValStack(v1);
return OK;
@@ -896,7 +940,16 @@ static int Multiply(void)
}
if (v1.type == INT_TYPE && v2.type == INT_TYPE) {
/* Prevent floating-point exception */
if ((v2.v.val == -1 && v1.v.val == INT_MIN) ||
(v1.v.val == -1 && v2.v.val == INT_MIN)) {
return E_2HIGH;
}
int old = v1.v.val;
v1.v.val *= v2.v.val;
if (v2.v.val != 0) {
if (_private_div(v1.v.val, v2.v.val) != old) return E_2HIGH;
}
PushValStack(v1);
return OK;
}
@@ -924,6 +977,10 @@ static int Divide(void)
if (v1.type == INT_TYPE && v2.type == INT_TYPE) {
if (v2.v.val == 0) return E_DIV_ZERO;
/* This is the only way it can overflow */
if (v2.v.val == -1 && v1.v.val == INT_MIN) {
return E_2HIGH;
}
v1.v.val /= v2.v.val;
PushValStack(v1);
return OK;
@@ -1098,7 +1155,9 @@ static int UnMinus(void)
{
Value *v = &ValStack[ValStackPtr-1];
if (v->type != INT_TYPE) return E_BAD_TYPE;
int old = v->v.val;
v->v.val = -v->v.val;
if (_private_unminus_overflow(old, v->v.val)) return E_2HIGH;
return OK;
}
@@ -1187,7 +1246,7 @@ void PrintValue (Value *v, FILE *fp)
}
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,
fprintf(fp, "%04d%c%02d%c%02d%c%02d%c%02d", y, DateSep, m+1, DateSep, d, DateTimeSep,
(v->v.val % MINUTES_PER_DAY) / 60, TimeSep, (v->v.val % MINUTES_PER_DAY) % 60);
}
else fprintf(fp, "ERR");
@@ -1213,6 +1272,48 @@ int CopyValue(Value *dest, const Value *src)
return OK;
}
int ParseLiteralTime(char const **s, int *tim)
{
int h=0;
int m=0;
int ampm=0;
if (!isdigit(**s)) return E_BAD_TIME;
while(isdigit(**s)) {
h *= 10;
h += *(*s)++ - '0';
}
if (**s != ':' && **s != '.' && **s != TimeSep) return E_BAD_TIME;
(*s)++;
if (!isdigit(**s)) return E_BAD_TIME;
while(isdigit(**s)) {
m *= 10;
m += *(*s)++ - '0';
}
/* Check for p[m] or a[m] */
if (**s == 'A' || **s == 'a' || **s == 'P' || **s == 'p') {
ampm = tolower(**s);
(*s)++;
if (**s == 'm' || **s == 'M') {
(*s)++;
}
}
if (h>23 || m>59) return E_BAD_TIME;
if (ampm) {
if (h < 1 || h > 12) return E_BAD_TIME;
if (ampm == 'a') {
if (h == 12) {
h = 0;
}
} else if (ampm == 'p') {
if (h < 12) {
h += 12;
}
}
}
*tim = h * 60 + m;
return OK;
}
/***************************************************************/
/* */
/* ParseLiteralDate */
@@ -1224,10 +1325,9 @@ int CopyValue(Value *dest, const Value *src)
int ParseLiteralDate(char const **s, int *jul, int *tim)
{
int y, m, d;
int hour, min;
int r;
y=0; m=0; d=0;
hour=0; min=0;
*tim = NO_TIME;
if (!isdigit(**s)) return E_BAD_DATE;
@@ -1255,22 +1355,11 @@ int ParseLiteralDate(char const **s, int *jul, int *tim)
*jul = Julian(y, m, d);
/* Do we have a time part as well? */
if (**s == ' ' || **s == '@') {
if (**s == ' ' || **s == '@' || **s == 'T' || **s == 't') {
(*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;
r = ParseLiteralTime(s, tim);
if (r != OK) return r;
}
return OK;
}

View File

@@ -5,8 +5,7 @@
/* Contains a few definitions used by expression evaluator. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -54,3 +53,12 @@ if (ValStackPtr <= 0) \
return E_VA_STK_UNDER; \
else \
(val) = ValStack[--ValStackPtr]
/* These functions are in utils.c and are used to detect overflow
in various arithmetic operators. They have to be in separate
functions with extern linkage to defeat compiler optimizations
that would otherwise break the overflow checks. */
extern int _private_div(int a, int b);
extern int _private_add_overflow(int result, int b, int old);
extern int _private_sub_overflow(int result, int b, int old);
extern int _private_unminus_overflow(int a, int b);

View File

@@ -7,8 +7,7 @@
/* files. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -17,6 +16,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/stat.h>
@@ -40,8 +40,9 @@
#include "err.h"
/* Convenient macro for closing files */
/* Convenient macros for closing files */
#define FCLOSE(fp) (((fp)&&((fp)!=stdin)) ? (fclose(fp),(fp)=NULL) : ((fp)=NULL))
#define PCLOSE(fp) (((fp)&&((fp)!=stdin)) ? (pclose(fp),(fp)=NULL) : ((fp)=NULL))
/* Define the structures needed by the file caching system */
typedef struct cache {
@@ -91,11 +92,37 @@ static FILE *fp;
static IncludeStruct IStack[INCLUDE_NEST];
static int IStackPtr = 0;
static int ReadLineFromFile (void);
static int CacheFile (char const *fname);
static int ReadLineFromFile (int use_pclose);
static int CacheFile (char const *fname, int use_pclose);
static void DestroyCache (CachedFile *cf);
static int CheckSafety (void);
static int PopFile (void);
static int IncludeCmd(char const *);
static void OpenPurgeFile(char const *fname, char const *mode)
{
DynamicBuffer fname_buf;
if (PurgeFP != NULL && PurgeFP != stdout) {
fclose(PurgeFP);
}
PurgeFP = NULL;
/* Do not open a purge file if we're below purge
include depth */
if (IStackPtr-2 >= PurgeIncludeDepth) {
PurgeFP = NULL;
return;
}
DBufInit(&fname_buf);
if (DBufPuts(&fname_buf, fname) != OK) return;
if (DBufPuts(&fname_buf, ".purged") != OK) return;
PurgeFP = fopen(DBufValue(&fname_buf), mode);
if (!PurgeFP) {
fprintf(ErrFp, "Cannot open `%s' for writing: %s\n", DBufValue(&fname_buf), strerror(errno));
}
DBufFree(&fname_buf);
}
static void FreeChainItem(FilenameChain *chain)
{
@@ -141,7 +168,7 @@ int ReadLine(void)
}
/* Not cached. Read from the file. */
return ReadLineFromFile();
return ReadLineFromFile(0);
}
/***************************************************************/
@@ -151,9 +178,11 @@ int ReadLine(void)
/* Read a line from the file pointed to by fp. */
/* */
/***************************************************************/
static int ReadLineFromFile(void)
static int ReadLineFromFile(int use_pclose)
{
int l;
char copy_buffer[4096];
size_t n;
DynamicBuffer buf;
@@ -172,15 +201,37 @@ static int ReadLineFromFile(void)
return E_IO_ERR;
}
if (feof(fp)) {
FCLOSE(fp);
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
if ((DBufLen(&buf) == 0) &&
(DBufLen(&LineBuffer) == 0) && PurgeMode) {
if (PurgeFP != NULL && PurgeFP != stdout) fclose(PurgeFP);
PurgeFP = NULL;
}
}
l = DBufLen(&buf);
if (l && (DBufValue(&buf)[l-1] == '\\')) {
DBufValue(&buf)[l-1] = '\n';
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
DBufFree(&buf);
DBufFree(&LineBuffer);
return E_NO_MEM;
if (PurgeMode) {
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
DBufFree(&buf);
DBufFree(&LineBuffer);
return E_NO_MEM;
}
if (DBufPutc(&LineBuffer, '\n') != OK) {
DBufFree(&buf);
DBufFree(&LineBuffer);
return E_NO_MEM;
}
} else {
DBufValue(&buf)[l-1] = '\n';
if (DBufPuts(&LineBuffer, DBufValue(&buf)) != OK) {
DBufFree(&buf);
DBufFree(&LineBuffer);
return E_NO_MEM;
}
}
continue;
}
@@ -189,8 +240,29 @@ static int ReadLineFromFile(void)
DBufFree(&LineBuffer);
return E_NO_MEM;
}
FreshLine = 1;
DBufFree(&buf);
/* If the line is: __EOF__ treat it as end-of-file */
CurLine = DBufValue(&LineBuffer);
if (!strcmp(CurLine, "__EOF__")) {
if (PurgeMode && PurgeFP) {
PurgeEchoLine("%s\n", "__EOF__");
while ((n = fread(copy_buffer, 1, sizeof(copy_buffer), fp)) != 0) {
fwrite(copy_buffer, 1, n, PurgeFP);
}
if (PurgeFP != stdout) fclose(PurgeFP);
PurgeFP = NULL;
}
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
DBufFree(&LineBuffer);
CurLine = DBufValue(&LineBuffer);
}
FreshLine = 1;
if (DebugFlag & DB_ECHO_LINE) OutputLine(ErrFp);
return OK;
}
@@ -212,8 +284,12 @@ int OpenFile(char const *fname)
CachedFile *h = CachedFiles;
int r;
/* Assume we own the file for now */
RunDisabled &= ~RUN_NOTOWNER;
if (PurgeMode) {
if (PurgeFP != NULL && PurgeFP != stdout) {
fclose(PurgeFP);
}
PurgeFP = NULL;
}
/* If it's in the cache, get it from there. */
@@ -227,7 +303,9 @@ int OpenFile(char const *fname)
LineNo = 0;
if (!h->ownedByMe) {
RunDisabled |= RUN_NOTOWNER;
}
} else {
RunDisabled &= ~RUN_NOTOWNER;
}
if (FileName) return OK; else return E_NO_MEM;
}
h = h->next;
@@ -236,6 +314,10 @@ int OpenFile(char const *fname)
/* If it's a dash, then it's stdin */
if (!strcmp(fname, "-")) {
fp = stdin;
RunDisabled &= ~RUN_NOTOWNER;
if (PurgeMode) {
PurgeFP = stdout;
}
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Reading `-': Reading stdin\n");
}
@@ -244,12 +326,15 @@ int OpenFile(char const *fname)
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Reading `%s': Opening file on disk\n", fname);
}
if (PurgeMode) {
OpenPurgeFile(fname, "w");
}
}
if (!fp || !CheckSafety()) return E_CANT_OPEN;
CLine = NULL;
if (ShouldCache) {
LineNo = 0;
r = CacheFile(fname);
r = CacheFile(fname, 0);
if (r == OK) {
fp = NULL;
CLine = CachedFiles->cache;
@@ -257,8 +342,10 @@ int OpenFile(char const *fname)
if (strcmp(fname, "-")) {
fp = fopen(fname, "r");
if (!fp || !CheckSafety()) return E_CANT_OPEN;
if (PurgeMode) OpenPurgeFile(fname, "w");
} else {
fp = stdin;
if (PurgeMode) PurgeFP = stdout;
}
}
}
@@ -275,7 +362,7 @@ int OpenFile(char const *fname)
/* Returns an indication of success or failure. */
/* */
/***************************************************************/
static int CacheFile(char const *fname)
static int CacheFile(char const *fname, int use_pclose)
{
int r;
CachedFile *cf;
@@ -288,12 +375,24 @@ static int CacheFile(char const *fname)
cl = NULL;
/* Create a file header */
cf = NEW(CachedFile);
if (!cf) {
ShouldCache = 0;
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
return E_NO_MEM;
}
cf->cache = NULL;
if (!cf) { ShouldCache = 0; FCLOSE(fp); return E_NO_MEM; }
cf->filename = StrDup(fname);
if (!cf->filename) {
ShouldCache = 0;
FCLOSE(fp);
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
free(cf);
return E_NO_MEM;
}
@@ -306,16 +405,20 @@ static int CacheFile(char const *fname)
/* Read the file */
while(fp) {
r = ReadLineFromFile();
r = ReadLineFromFile(use_pclose);
if (r) {
DestroyCache(cf);
ShouldCache = 0;
FCLOSE(fp);
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
return r;
}
/* Skip blank chars */
s = DBufValue(&LineBuffer);
while (isspace(*s)) s++;
while (isempty(*s)) s++;
if (*s && *s!=';' && *s!='#') {
/* Add the line to the cache */
if (!cl) {
@@ -324,7 +427,11 @@ static int CacheFile(char const *fname)
DBufFree(&LineBuffer);
DestroyCache(cf);
ShouldCache = 0;
FCLOSE(fp);
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
return E_NO_MEM;
}
cl = cf->cache;
@@ -334,7 +441,11 @@ static int CacheFile(char const *fname)
DBufFree(&LineBuffer);
DestroyCache(cf);
ShouldCache = 0;
FCLOSE(fp);
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
return E_NO_MEM;
}
cl = cl->next;
@@ -346,7 +457,11 @@ static int CacheFile(char const *fname)
if (!cl->text) {
DestroyCache(cf);
ShouldCache = 0;
FCLOSE(fp);
if (use_pclose) {
PCLOSE(fp);
} else {
FCLOSE(fp);
}
return E_NO_MEM;
}
}
@@ -389,9 +504,6 @@ static int PopFile(void)
{
IncludeStruct *i;
/* Assume we own the file for now */
RunDisabled &= ~RUN_NOTOWNER;
if (!Hush && NumIfs) Eprint("%s", ErrMsg[E_MISS_ENDIF]);
if (!IStackPtr) return E_EOF;
i = &IStack[IStackPtr-1];
@@ -418,14 +530,18 @@ static int PopFile(void)
STRSET(FileName, i->filename);
if (!i->ownedByMe) {
RunDisabled |= RUN_NOTOWNER;
} else {
RunDisabled &= ~RUN_NOTOWNER;
}
if (!CLine && (i->offset != -1L)) {
if (!CLine && (i->offset != -1L || !strcmp(i->filename, "-"))) {
/* We must open the file, then seek to specified position */
if (strcmp(i->filename, "-")) {
fp = fopen(i->filename, "r");
if (!fp || !CheckSafety()) return E_CANT_OPEN;
if (PurgeMode) OpenPurgeFile(i->filename, "a");
} else {
fp = stdin;
if (PurgeMode) PurgeFP = stdout;
}
if (fp != stdin)
(void) fseek(fp, i->offset, 0); /* Trust that it works... */
@@ -460,6 +576,64 @@ int DoInclude(ParsePtr p)
return OK;
}
/***************************************************************/
/* */
/* DoIncludeCmd */
/* */
/* The INCLUDECMD command. */
/* */
/***************************************************************/
int DoIncludeCmd(ParsePtr p)
{
DynamicBuffer buf;
int r;
int ch;
char append_buf[2];
int seen_nonspace = 0;
append_buf[1] = 0;
DBufInit(&buf);
while(1) {
ch = ParseChar(p, &r, 0);
if (r) {
DBufFree(&buf);
return r;
}
if (!ch) {
break;
}
if (isspace(ch) && !seen_nonspace) {
continue;
}
seen_nonspace = 1;
/* Convert \n to ' ' to better handle line continuation */
if (ch == '\n') {
ch = ' ';
}
append_buf[0] = (char) ch;
if (DBufPuts(&buf, append_buf) != OK) {
DBufFree(&buf);
return E_NO_MEM;
}
}
if (RunDisabled) {
DBufFree(&buf);
return E_RUN_DISABLED;
}
if ( (r=IncludeCmd(DBufValue(&buf))) ) {
DBufFree(&buf);
return r;
}
DBufFree(&buf);
NumIfs = 0;
IfFlags = 0;
return OK;
}
#ifdef HAVE_GLOB
static int SetupGlobChain(char const *dirname, IncludeStruct *i)
{
@@ -495,6 +669,10 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
/* Check the cache */
while(dc) {
if (!strcmp(dc->dirname, dir)) {
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Found cached directory listing for `%s'\n",
dir);
}
free(dir);
i->chain = dc->chain;
return OK;
@@ -502,6 +680,10 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
dc = dc->next;
}
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Scanning directory `%s' for *.rem files\n", dir);
}
if (ShouldCache) {
dc = malloc(sizeof(DirectoryFilenameChain));
if (dc) {
@@ -512,6 +694,10 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
}
}
if (dc) {
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Caching directory `%s' listing\n", dir);
}
dc->chain = NULL;
dc->next = CachedDirectoryChains;
CachedDirectoryChains = dc;
@@ -568,6 +754,127 @@ static int SetupGlobChain(char const *dirname, IncludeStruct *i)
}
#endif
/***************************************************************/
/* */
/* IncludeCmd */
/* */
/* Process the INCLUDECMD command - actually do the command */
/* inclusion. */
/* */
/***************************************************************/
static int IncludeCmd(char const *cmd)
{
IncludeStruct *i;
DynamicBuffer buf;
FILE *fp2;
int r;
CachedFile *h;
char const *fname;
int old_flag;
FreshLine = 1;
if (IStackPtr+1 >= INCLUDE_NEST) return E_NESTED_INCLUDE;
i = &IStack[IStackPtr];
/* Use "cmd|" as the filename */
DBufInit(&buf);
if (DBufPuts(&buf, cmd) != OK) {
DBufFree(&buf);
return E_NO_MEM;
}
if (DBufPuts(&buf, "|") != OK) {
DBufFree(&buf);
return E_NO_MEM;
}
fname = DBufValue(&buf);
if (FileName) {
i->filename = StrDup(FileName);
if (!i->filename) {
DBufFree(&buf);
return E_NO_MEM;
}
} else {
i->filename = NULL;
}
i->ownedByMe = 1;
i->LineNo = LineNo;
i->NumIfs = NumIfs;
i->IfFlags = IfFlags;
i->CLine = CLine;
i->offset = -1L;
i->chain = NULL;
if (fp) {
i->offset = ftell(fp);
FCLOSE(fp);
}
IStackPtr++;
/* If the file is cached, use it */
h = CachedFiles;
while(h) {
if (!strcmp(fname, h->filename)) {
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Reading command `%s': Found in cache\n", fname);
}
CLine = h->cache;
STRSET(FileName, fname);
DBufFree(&buf);
LineNo = 0;
if (!h->ownedByMe) {
RunDisabled |= RUN_NOTOWNER;
} else {
RunDisabled &= ~RUN_NOTOWNER;
}
if (FileName) return OK; else return E_NO_MEM;
}
h = h->next;
}
if (DebugFlag & DB_TRACE_FILES) {
fprintf(ErrFp, "Executing `%s' for INCLUDECMD and caching as `%s'\n",
cmd, fname);
}
/* Not found in cache */
/* If cmd starts with !, then disable RUN within the cmd output */
if (cmd[0] == '!') {
fp2 = popen(cmd+1, "r");
} else {
fp2 = popen(cmd, "r");
}
if (!fp2) {
DBufFree(&buf);
return E_CANT_OPEN;
}
fp = fp2;
LineNo = 0;
/* Temporarily turn of file tracing */
old_flag = DebugFlag;
DebugFlag &= (~DB_TRACE_FILES);
if (cmd[0] == '!') {
RunDisabled |= RUN_NOTOWNER;
}
r = CacheFile(fname, 1);
DebugFlag = old_flag;
if (r == OK) {
fp = NULL;
CLine = CachedFiles->cache;
LineNo = 0;
STRSET(FileName, fname);
DBufFree(&buf);
return OK;
}
DBufFree(&buf);
/* We failed */
PopFile();
return E_CANT_OPEN;
}
/***************************************************************/
/* */
/* IncludeFile */
@@ -615,9 +922,6 @@ int IncludeFile(char const *fname)
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) {
@@ -735,7 +1039,8 @@ int TopLevel(void)
/* root, we refuse to open files not owned by root. */
/* We also reject world-writable files, no matter */
/* who we're running as. */
/* As a side effect, if we don't own the file, we disable RUN */
/* As a side effect, if we don't own the file, or it's not */
/* owned by a trusted user, we disable RUN */
/***************************************************************/
static int CheckSafety(void)
{
@@ -773,9 +1078,22 @@ static int CheckSafety(void)
return 0;
}
/* If file is not owned by me, disable RUN command */
if (statbuf.st_uid != geteuid()) {
RunDisabled |= RUN_NOTOWNER;
/* If file is not owned by me or a trusted user, disable RUN command */
/* Assume unsafe */
RunDisabled |= RUN_NOTOWNER;
if (statbuf.st_uid == geteuid()) {
/* Owned by me... safe */
RunDisabled &= ~RUN_NOTOWNER;
} else {
int i;
for (i=0; i<NumTrustedUsers; i++) {
if (statbuf.st_uid == TrustedUsers[i]) {
/* Owned by a trusted user... safe */
RunDisabled &= ~RUN_NOTOWNER;
break;
}
}
}
return 1;

View File

@@ -6,8 +6,7 @@
/* expressions. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -54,90 +53,109 @@
#define RetVal (info->retval)
/* Function prototypes */
static int FCurrent (func_info *);
static int FNonomitted (func_info *);
static int FTimepart(func_info *);
static int FDatepart(func_info *);
static int FRealCurrent(func_info *);
static int FAbs (func_info *);
static int FAccess (func_info *);
static int FArgs (func_info *);
static int FAsc (func_info *);
static int FBaseyr (func_info *);
static int FChar (func_info *);
static int FChoose (func_info *);
static int FCoerce (func_info *);
static int FDate (func_info *);
static int FDateTime (func_info *);
static int FDay (func_info *);
static int FDaysinmon (func_info *);
static int FDefined (func_info *);
static int FDosubst (func_info *);
static int FEasterdate (func_info *);
static int FEvalTrig (func_info *);
static int FFiledate (func_info *);
static int FFiledatetime (func_info *);
static int FFiledir (func_info *);
static int FFilename (func_info *);
static int FGetenv (func_info *);
static int FHebdate (func_info *);
static int FHebday (func_info *);
static int FHebmon (func_info *);
static int FHebyear (func_info *);
static int FHour (func_info *);
static int FIif (func_info *);
static int FIndex (func_info *);
static int FIsdst (func_info *);
static int FIsomitted (func_info *);
static int FSlide (func_info *);
static int FLanguage (func_info *);
static int FMax (func_info *);
static int FMin (func_info *);
static int FMinute (func_info *);
static int FMinsfromutc (func_info *);
static int FMoondate (func_info *);
static int FMoondatetime (func_info *);
static int FMoonphase (func_info *);
static int FMoontime (func_info *);
static int FMon (func_info *);
static int FMonnum (func_info *);
static int FOrd (func_info *);
static int FOstype (func_info *);
static int FPlural (func_info *);
static int FSgn (func_info *);
static int FPsmoon (func_info *);
static int FPsshade (func_info *);
static int FShell (func_info *);
static int FStrlen (func_info *);
static int FSubstr (func_info *);
static int FDawn (func_info *);
static int FDusk (func_info *);
static int FSunset (func_info *);
static int FSunrise (func_info *);
static int FTime (func_info *);
static int FTrigdate (func_info *);
static int FTrigdatetime (func_info *);
static int FTrigtime (func_info *);
static int FTrigvalid (func_info *);
static int FTypeof (func_info *);
static int FUpper (func_info *);
static int FValue (func_info *);
static int FVersion (func_info *);
static int FWkday (func_info *);
static int FWkdaynum (func_info *);
static int FYear (func_info *);
static int FIsleap (func_info *);
static int FLower (func_info *);
static int FNow (func_info *);
static int FRealnow (func_info *);
static int FRealtoday (func_info *);
static int FToday (func_info *);
static int FTrigger (func_info *);
static int FTzconvert (func_info *);
static int FWeekno (func_info *);
static int CheckArgs (BuiltinFunc *f, int nargs);
static int CleanUpAfterFunc (func_info *);
static int SunStuff (int rise, double cosz, int jul);
static int FADawn (func_info *);
static int FADusk (func_info *);
static int FAbs (func_info *);
static int FAccess (func_info *);
static int FAmpm (func_info *);
static int FArgs (func_info *);
static int FAsc (func_info *);
static int FBaseyr (func_info *);
static int FChar (func_info *);
static int FChoose (func_info *);
static int FCoerce (func_info *);
static int FCurrent (func_info *);
static int FDate (func_info *);
static int FDateTime (func_info *);
static int FDatepart (func_info *);
static int FDawn (func_info *);
static int FDay (func_info *);
static int FDaysinmon (func_info *);
static int FDefined (func_info *);
static int FDosubst (func_info *);
static int FDusk (func_info *);
static int FEasterdate (func_info *);
static int FEvalTrig (func_info *);
static int FFiledate (func_info *);
static int FFiledatetime (func_info *);
static int FFiledir (func_info *);
static int FFilename (func_info *);
static int FGetenv (func_info *);
static int FHebdate (func_info *);
static int FHebday (func_info *);
static int FHebmon (func_info *);
static int FHebyear (func_info *);
static int FHour (func_info *);
static int FIif (func_info *);
static int FIndex (func_info *);
static int FIsdst (func_info *);
static int FIsleap (func_info *);
static int FIsomitted (func_info *);
static int FLanguage (func_info *);
static int FLower (func_info *);
static int FMax (func_info *);
static int FMin (func_info *);
static int FMinsfromutc (func_info *);
static int FMinute (func_info *);
static int FMon (func_info *);
static int FMonnum (func_info *);
static int FMoondate (func_info *);
static int FMoondatetime (func_info *);
static int FMoonphase (func_info *);
static int FMoontime (func_info *);
static int FNDawn (func_info *);
static int FNDusk (func_info *);
static int FNonomitted (func_info *);
static int FNow (func_info *);
static int FOrd (func_info *);
static int FOstype (func_info *);
static int FPlural (func_info *);
static int FPsmoon (func_info *);
static int FPsshade (func_info *);
static int FRealCurrent (func_info *);
static int FRealnow (func_info *);
static int FRealtoday (func_info *);
static int FSgn (func_info *);
static int FShell (func_info *);
static int FSlide (func_info *);
static int FStrlen (func_info *);
static int FSubstr (func_info *);
static int FSunrise (func_info *);
static int FSunset (func_info *);
static int FTime (func_info *);
static int FTimepart (func_info *);
static int FToday (func_info *);
static int FTrigback (func_info *);
static int FTrigdate (func_info *);
static int FTrigdatetime (func_info *);
static int FTrigdelta (func_info *);
static int FTrigduration (func_info *);
static int FTrigeventduration(func_info *);
static int FTrigeventstart (func_info *);
static int FTrigfrom (func_info *);
static int FTrigger (func_info *);
static int FTrigpriority (func_info *);
static int FTrigrep (func_info *);
static int FTrigscanfrom (func_info *);
static int FTrigtime (func_info *);
static int FTrigtimedelta (func_info *);
static int FTrigtimerep (func_info *);
static int FTriguntil (func_info *);
static int FTrigvalid (func_info *);
static int FTypeof (func_info *);
static int FTzconvert (func_info *);
static int FUpper (func_info *);
static int FValue (func_info *);
static int FVersion (func_info *);
static int FWeekno (func_info *);
static int FWkday (func_info *);
static int FWkdaynum (func_info *);
static int FYear (func_info *);
static int FShellescape (func_info *);
static int CleanUpAfterFunc (func_info *);
static int CheckArgs (BuiltinFunc *f, int nargs);
static int SunStuff (int rise, double cosz, int jul);
/* "Overload" the struct Operator definition */
#define NO_MAX 127
@@ -184,89 +202,107 @@ extern int ValStackPtr;
/* The array holding the built-in functions. */
BuiltinFunc Func[] = {
/* Name minargs maxargs func */
/* Name minargs maxargs is_constant func */
{ "abs", 1, 1, FAbs },
{ "access", 2, 2, FAccess },
{ "args", 1, 1, FArgs },
{ "asc", 1, 1, FAsc },
{ "baseyr", 0, 0, FBaseyr },
{ "char", 1, NO_MAX, FChar },
{ "choose", 2, NO_MAX, FChoose },
{ "coerce", 2, 2, FCoerce },
{ "current", 0, 0, FCurrent },
{ "date", 3, 3, FDate },
{ "datepart", 1, 1, FDatepart },
{ "datetime", 2, 5, FDateTime },
{ "dawn", 0, 1, FDawn},
{ "day", 1, 1, FDay },
{ "daysinmon", 2, 2, FDaysinmon },
{ "defined", 1, 1, FDefined },
{ "dosubst", 1, 3, FDosubst },
{ "dusk", 0, 1, FDusk },
{ "easterdate", 1, 1, FEasterdate },
{ "evaltrig", 1, 2, FEvalTrig },
{ "filedate", 1, 1, FFiledate },
{ "filedatetime", 1, 1, FFiledatetime },
{ "filedir", 0, 0, FFiledir },
{ "filename", 0, 0, FFilename },
{ "getenv", 1, 1, FGetenv },
{ "hebdate", 2, 5, FHebdate },
{ "hebday", 1, 1, FHebday },
{ "hebmon", 1, 1, FHebmon },
{ "hebyear", 1, 1, FHebyear },
{ "hour", 1, 1, FHour },
{ "iif", 1, NO_MAX, FIif },
{ "index", 2, 3, FIndex },
{ "isdst", 0, 2, FIsdst },
{ "isleap", 1, 1, FIsleap },
{ "isomitted", 1, 1, FIsomitted },
{ "language", 0, 0, FLanguage },
{ "lower", 1, 1, FLower },
{ "max", 1, NO_MAX, FMax },
{ "min", 1, NO_MAX, FMin },
{ "minsfromutc", 0, 2, FMinsfromutc },
{ "minute", 1, 1, FMinute },
{ "mon", 1, 1, FMon },
{ "monnum", 1, 1, FMonnum },
{ "moondate", 1, 3, FMoondate },
{ "moondatetime", 1, 3, FMoondatetime },
{ "moonphase", 0, 2, FMoonphase },
{ "moontime", 1, 3, FMoontime },
{ "nonomitted", 2, NO_MAX, FNonomitted },
{ "now", 0, 0, FNow },
{ "ord", 1, 1, FOrd },
{ "ostype", 0, 0, FOstype },
{ "plural", 1, 3, FPlural },
{ "psmoon", 1, 4, FPsmoon},
{ "psshade", 1, 3, FPsshade},
{ "realcurrent", 0, 0, FRealCurrent},
{ "realnow", 0, 0, FRealnow},
{ "realtoday", 0, 0, FRealtoday },
{ "sgn", 1, 1, FSgn },
{ "shell", 1, 2, FShell },
{ "slide", 2, NO_MAX, FSlide },
{ "strlen", 1, 1, FStrlen },
{ "substr", 2, 3, FSubstr },
{ "sunrise", 0, 1, FSunrise},
{ "sunset", 0, 1, FSunset },
{ "time", 2, 2, FTime },
{ "timepart", 1, 1, FTimepart },
{ "today", 0, 0, FToday },
{ "trigdate", 0, 0, FTrigdate },
{ "trigdatetime", 0, 0, FTrigdatetime },
{ "trigger", 1, 3, FTrigger },
{ "trigtime", 0, 0, FTrigtime },
{ "trigvalid", 0, 0, FTrigvalid },
{ "typeof", 1, 1, FTypeof },
{ "tzconvert", 2, 3, FTzconvert },
{ "upper", 1, 1, FUpper },
{ "value", 1, 2, FValue },
{ "version", 0, 0, FVersion },
{ "weekno", 0, 3, FWeekno },
{ "wkday", 1, 1, FWkday },
{ "wkdaynum", 1, 1, FWkdaynum },
{ "year", 1, 1, FYear }
{ "abs", 1, 1, 1, FAbs },
{ "access", 2, 2, 0, FAccess },
{ "adawn", 0, 1, 0, FADawn},
{ "adusk", 0, 1, 0, FADusk},
{ "ampm", 1, 3, 1, FAmpm },
{ "args", 1, 1, 0, FArgs },
{ "asc", 1, 1, 1, FAsc },
{ "baseyr", 0, 0, 1, FBaseyr },
{ "char", 1, NO_MAX, 1, FChar },
{ "choose", 2, NO_MAX, 1, FChoose },
{ "coerce", 2, 2, 1, FCoerce },
{ "current", 0, 0, 0, FCurrent },
{ "date", 3, 3, 1, FDate },
{ "datepart", 1, 1, 1, FDatepart },
{ "datetime", 2, 5, 1, FDateTime },
{ "dawn", 0, 1, 0, FDawn},
{ "day", 1, 1, 1, FDay },
{ "daysinmon", 2, 2, 1, FDaysinmon },
{ "defined", 1, 1, 0, FDefined },
{ "dosubst", 1, 3, 0, FDosubst },
{ "dusk", 0, 1, 0, FDusk },
{ "easterdate", 1, 1, 0, FEasterdate },
{ "evaltrig", 1, 2, 0, FEvalTrig },
{ "filedate", 1, 1, 0, FFiledate },
{ "filedatetime", 1, 1, 0, FFiledatetime },
{ "filedir", 0, 0, 0, FFiledir },
{ "filename", 0, 0, 0, FFilename },
{ "getenv", 1, 1, 0, FGetenv },
{ "hebdate", 2, 5, 0, FHebdate },
{ "hebday", 1, 1, 0, FHebday },
{ "hebmon", 1, 1, 0, FHebmon },
{ "hebyear", 1, 1, 0, FHebyear },
{ "hour", 1, 1, 1, FHour },
{ "iif", 1, NO_MAX, 1, FIif },
{ "index", 2, 3, 1, FIndex },
{ "isdst", 0, 2, 0, FIsdst },
{ "isleap", 1, 1, 1, FIsleap },
{ "isomitted", 1, 1, 0, FIsomitted },
{ "language", 0, 0, 1, FLanguage },
{ "lower", 1, 1, 1, FLower },
{ "max", 1, NO_MAX, 1, FMax },
{ "min", 1, NO_MAX, 1, FMin },
{ "minsfromutc", 0, 2, 0, FMinsfromutc },
{ "minute", 1, 1, 1, FMinute },
{ "mon", 1, 1, 1, FMon },
{ "monnum", 1, 1, 1, FMonnum },
{ "moondate", 1, 3, 0, FMoondate },
{ "moondatetime", 1, 3, 0, FMoondatetime },
{ "moonphase", 0, 2, 0, FMoonphase },
{ "moontime", 1, 3, 0, FMoontime },
{ "ndawn", 0, 1, 0, FNDawn},
{ "ndusk", 0, 1, 0, FNDusk},
{ "nonomitted", 2, NO_MAX, 0, FNonomitted },
{ "now", 0, 0, 0, FNow },
{ "ord", 1, 1, 1, FOrd },
{ "ostype", 0, 0, 1, FOstype },
{ "plural", 1, 3, 1, FPlural },
{ "psmoon", 1, 4, 1, FPsmoon},
{ "psshade", 1, 3, 1, FPsshade},
{ "realcurrent", 0, 0, 0, FRealCurrent},
{ "realnow", 0, 0, 0, FRealnow},
{ "realtoday", 0, 0, 0, FRealtoday },
{ "sgn", 1, 1, 1, FSgn },
{ "shell", 1, 2, 0, FShell },
{ "shellescape", 1, 1, 1, FShellescape },
{ "slide", 2, NO_MAX, 0, FSlide },
{ "strlen", 1, 1, 1, FStrlen },
{ "substr", 2, 3, 1, FSubstr },
{ "sunrise", 0, 1, 0, FSunrise},
{ "sunset", 0, 1, 0, FSunset },
{ "time", 2, 2, 1, FTime },
{ "timepart", 1, 1, 1, FTimepart },
{ "today", 0, 0, 0, FToday },
{ "trigback", 0, 0, 0, FTrigback },
{ "trigdate", 0, 0, 0, FTrigdate },
{ "trigdatetime", 0, 0, 0, FTrigdatetime },
{ "trigdelta", 0, 0, 0, FTrigdelta },
{ "trigduration", 0, 0, 0, FTrigduration },
{ "trigeventduration", 0, 0, 0, FTrigeventduration },
{ "trigeventstart", 0, 0, 0, FTrigeventstart },
{ "trigfrom", 0, 0, 0, FTrigfrom },
{ "trigger", 1, 3, 0, FTrigger },
{ "trigpriority", 0, 0, 0, FTrigpriority },
{ "trigrep", 0, 0, 0, FTrigrep },
{ "trigscanfrom", 0, 0, 0, FTrigscanfrom },
{ "trigtime", 0, 0, 0, FTrigtime },
{ "trigtimedelta",0, 0, 0, FTrigtimedelta },
{ "trigtimerep", 0, 0, 0, FTrigtimerep },
{ "triguntil", 0, 0, 0, FTriguntil },
{ "trigvalid", 0, 0, 0, FTrigvalid },
{ "typeof", 1, 1, 1, FTypeof },
{ "tzconvert", 2, 3, 0, FTzconvert },
{ "upper", 1, 1, 1, FUpper },
{ "value", 1, 2, 0, FValue },
{ "version", 0, 0, 1, FVersion },
{ "weekno", 0, 3, 1, FWeekno },
{ "wkday", 1, 1, 1, FWkday },
{ "wkdaynum", 1, 1, 1, FWkdaynum },
{ "year", 1, 1, 1, FYear }
};
/* Need a variable here - Func[] array not really visible to outside. */
@@ -832,12 +868,14 @@ static int FTime(func_info *info)
/***************************************************************/
static int FAbs(func_info *info)
{
int v;
volatile int v;
ASSERT_TYPE(0, INT_TYPE);
v = ARGV(0);
RetVal.type = INT_TYPE;
RETVAL = (v < 0) ? (-v) : v;
v = RETVAL;
if (v < 0) return E_2HIGH;
return OK;
}
@@ -854,6 +892,76 @@ static int FSgn(func_info *info)
return OK;
}
/***************************************************************/
/* */
/* FAmpm - return a time as a string with "AM" or "PM" suffix */
/* */
/***************************************************************/
static int FAmpm(func_info *info)
{
int h, m;
int yr=0, mo=0, da=0;
char const *am = "AM";
char const *pm = "PM";
char const *ampm = NULL;
char outbuf[128];
if (ARG(0).type != DATETIME_TYPE && ARG(0).type != TIME_TYPE) {
return E_BAD_TYPE;
}
if (HASDATE(ARG(0))) {
FromJulian(DATEPART(ARG(0)), &yr, &mo, &da);
}
if (Nargs >= 2) {
ASSERT_TYPE(1, STR_TYPE);
am = ARGSTR(1);
if (Nargs >= 3) {
ASSERT_TYPE(2, STR_TYPE);
pm = ARGSTR(2);
}
}
h = TIMEPART(ARG(0)) / 60;
m = TIMEPART(ARG(0)) % 60;
if (h <= 11) {
/* AM */
if (h == 0) {
if (ARG(0).type == DATETIME_TYPE) {
snprintf(outbuf, sizeof(outbuf), "%04d%c%02d%c%02d%c12%c%02d", yr, DateSep, mo+1, DateSep, da, DateTimeSep, TimeSep, m);
} else {
snprintf(outbuf, sizeof(outbuf), "12%c%02d", TimeSep, m);
}
} else {
if (ARG(0).type == DATETIME_TYPE) {
snprintf(outbuf, sizeof(outbuf), "%04d%c%02d%c%02d%c%d%c%02d", yr, DateSep, mo+1, DateSep, da, DateTimeSep, h, TimeSep, m);
} else {
snprintf(outbuf, sizeof(outbuf), "%d%c%02d", h, TimeSep, m);
}
}
ampm = am;
} else {
if (h > 12) {
h -= 12;
}
if (ARG(0).type == DATETIME_TYPE) {
snprintf(outbuf, sizeof(outbuf), "%04d%c%02d%c%02d%c%d%c%02d", yr, DateSep, mo+1, DateSep, da, DateTimeSep, h, TimeSep, m);
} else {
snprintf(outbuf, sizeof(outbuf), "%d%c%02d", h, TimeSep, m);
}
ampm = pm;
}
RetVal.type = STR_TYPE;
RetVal.v.str = malloc(strlen(outbuf) + strlen(ampm) + 1);
if (!RetVal.v.str) {
RetVal.type = ERR_TYPE;
return E_NO_MEM;
}
strcpy(RetVal.v.str, outbuf);
strcat(RetVal.v.str, ampm);
return OK;
}
/***************************************************************/
/* */
/* FOrd - returns a string containing ordinal number. */
@@ -966,6 +1074,28 @@ static int FOstype(func_info *info)
return RetStrVal("UNIX", info);
}
/***************************************************************/
/* */
/* FShellescape - escape shell meta-characters */
/* */
/***************************************************************/
static int FShellescape(func_info *info)
{
DynamicBuffer buf;
int r;
ASSERT_TYPE(0, STR_TYPE);
DBufInit (&buf);
if (ShellEscape(ARG(0).v.str, &buf) != OK) {
DBufFree(&buf);
return E_NO_MEM;
}
r = RetStrVal(DBufValue(&buf), info);
DBufFree(&buf);
return r;
}
/***************************************************************/
/* */
/* FUpper - convert string to upper-case */
@@ -1076,7 +1206,7 @@ static int FValue(func_info *info)
ASSERT_TYPE(0, STR_TYPE);
switch(Nargs) {
case 1:
return GetVarValue(ARGSTR(0), &RetVal, NULL);
return GetVarValue(ARGSTR(0), &RetVal, NULL, NULL);
case 2:
v = FindVar(ARGSTR(0), 0);
@@ -1130,6 +1260,120 @@ static int FTrigdate(func_info *info)
return OK;
}
static int FTrigback(func_info *info)
{
RetVal.type = INT_TYPE;
RETVAL = LastTrigger.back;
return OK;
}
static int FTrigdelta(func_info *info)
{
RetVal.type = INT_TYPE;
RETVAL = LastTrigger.delta;
return OK;
}
static int FTrigtimedelta(func_info *info)
{
RetVal.type = INT_TYPE;
RETVAL = LastTimeTrig.delta;
return OK;
}
static int FTrigtimerep(func_info *info)
{
RetVal.type = INT_TYPE;
RETVAL = LastTimeTrig.rep;
return OK;
}
static int FTrigeventduration(func_info *info)
{
if (LastTrigger.eventduration == NO_TIME) {
RetVal.type = INT_TYPE;
RETVAL = -1;
} else {
RetVal.type = TIME_TYPE;
RETVAL = LastTrigger.eventduration;
}
return OK;
}
static int FTrigeventstart(func_info *info)
{
if (LastTrigger.eventstart == NO_TIME) {
RetVal.type = INT_TYPE;
RETVAL = -1;
} else {
RetVal.type = DATETIME_TYPE;
RETVAL = LastTrigger.eventstart;
}
return OK;
}
static int FTrigduration(func_info *info)
{
if (LastTimeTrig.duration == NO_TIME) {
RetVal.type = INT_TYPE;
RETVAL = -1;
} else {
RetVal.type = TIME_TYPE;
RETVAL = LastTimeTrig.duration;
}
return OK;
}
static int FTrigrep(func_info *info)
{
RetVal.type = INT_TYPE;
RETVAL = LastTrigger.rep;
return OK;
}
static int FTrigpriority(func_info *info)
{
RetVal.type = INT_TYPE;
RETVAL = LastTrigger.priority;
return OK;
}
static int FTriguntil(func_info *info)
{
if (LastTrigger.until == NO_UNTIL) {
RetVal.type = INT_TYPE;
RETVAL = -1;
} else {
RetVal.type = DATE_TYPE;
RETVAL = LastTrigger.until;
}
return OK;
}
static int FTrigscanfrom(func_info *info)
{
if (LastTrigger.scanfrom == NO_DATE) {
RetVal.type = INT_TYPE;
RETVAL = -1;
} else {
RetVal.type = DATE_TYPE;
RETVAL = LastTrigger.scanfrom;
}
return OK;
}
static int FTrigfrom(func_info *info)
{
if (LastTrigger.from == NO_DATE) {
RetVal.type = INT_TYPE;
RETVAL = -1;
} else {
RetVal.type = DATE_TYPE;
RETVAL = LastTrigger.from;
}
return OK;
}
static int FTrigvalid(func_info *info)
{
RetVal.type = INT_TYPE;
@@ -1335,10 +1579,11 @@ static int FShell(func_info *info)
/***************************************************************/
static int FIsomitted(func_info *info)
{
int r;
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
RetVal.type = INT_TYPE;
int r = IsOmitted(DATEPART(ARG(0)), 0, NULL, &RETVAL);
r = IsOmitted(DATEPART(ARG(0)), 0, NULL, &RETVAL);
return r;
}
@@ -1790,7 +2035,7 @@ static int FEasterdate(func_info *info)
/* */
/* FIsdst and FMinsfromutc */
/* */
/* Check whether daylight savings time is in effect, and */
/* Check whether daylight saving time is in effect, and */
/* get minutes from UTC. */
/* */
/***************************************************************/
@@ -1853,12 +2098,10 @@ static int FTimeStuff(int wantmins, func_info *info)
static int SunStuff(int rise, double cosz, int jul)
{
int year, mon, day;
int jan0;
int mins, hours;
int dusk_or_dawn;
int year, mon, day;
double M, L, tanA, sinDelta, cosDelta, a, a_hr, cosH, t, H, T;
double M, L, sinDelta, cosDelta, a, a_hr, cosH, t, H, T;
double latitude, longdeg, UT, local;
/* Get offset from UTC */
@@ -1874,60 +2117,49 @@ static int SunStuff(int rise, double cosz, int jul)
+ (double) LongSec / 3600.0;
latitude = DEGRAD * ((double) LatDeg + (double) LatMin / 60.0
+ (double) LatSec / 3600.0);
+ (double) LatSec / 3600.0);
FromJulian(jul, &year, &mon, &day);
jan0 = jul - Julian(year, 0, 1);
dusk_or_dawn = rise;
if (rise > 1)
rise -= 2;
/* Following formula on page B6 exactly... */
t = (double) jan0;
if (rise) t += (6.0 + longdeg/15.0) / 24.0;
else t += (18.0 + longdeg/15.0) / 24.0;
t = (double) jul;
if (rise) {
t += (6.0 + longdeg/15.0) / 24.0;
} else {
t += (18.0 + longdeg/15.0) / 24.0;
}
/* Mean anomaly of sun for 1978 ... how accurate for other years??? */
M = 0.985600 * t - 3.251; /* In degrees */
/* Mean anomaly of sun starting from 1 Jan 1990 */
/* NOTE: This assumes that BASE = 1990!!! */
#if BASE != 1990
#error Sun calculations assume a BASE of 1990!
#endif
t = 0.9856002585 * t;
M = t + 357.828757; /* In degrees */
/* Make sure M is in the range [0, 360) */
M -= (floor(M/360.0) * 360.0);
/* Sun's true longitude */
L = M + 1.916*sin(DEGRAD*M) + 0.02*sin(2*DEGRAD*M) + 282.565;
if (dusk_or_dawn == 2) {/* dusk */
L += 6;
} else if (dusk_or_dawn == 3) {/* dawn */
L -= 14;
}
L = M + 1.916*sin(DEGRAD*M) + 0.02*sin(2*DEGRAD*M) + 283.07080214;
if (L > 360.0) L -= 360.0;
/* Tan of sun's right ascension */
tanA = 0.91746 * tan(DEGRAD*L);
a = RADDEG * atan(tanA);
/* Move a into same quadrant as L */
if (0.0 <= L && L < 90.0) {
if (a < 0.0) a += 180.0;
} else if (90.0 <= L && L < 180.0) {
a += 180.0;
} else if (180.0 <= L && L < 270.0) {
a += 180.0;
} else {
if (a > 0.0) a += 180.0;
a = RADDEG * atan2(0.91746*sin(DEGRAD*L), cos(DEGRAD*L));
if (a<0) {
a += 360.0;
}
/* if (fabs(a - L) > 90.0)
a += 180.0; */
if (a > 360.0)
a -= 360.0;
a_hr = a / 15.0;
/* Sine of sun's declination */
sinDelta = 0.39782 * sin(DEGRAD*L);
cosDelta = sqrt(1 - sinDelta*sinDelta);
/* Cosine of sun's local hour angle */
cosH = (cosz - sinDelta * sin(latitude)) / (cosDelta * cos(latitude));
if (cosH < -1.0) { /* Summer -- permanent daylight */
if (rise) return NO_TIME;
else return -NO_TIME;
@@ -1940,20 +2172,25 @@ static int SunStuff(int rise, double cosz, int jul)
H = RADDEG * acos(cosH);
if (rise) H = 360.0 - H;
T = H / 15.0 + a_hr - 0.065710*t - 6.620;
t -= 360.0*floor(t/360.0);
T = (H-t) / 15.0 + a_hr - 6.726637276;
if (T >= 24.0) T -= 24.0;
else if (T < 0.0) T+= 24.0;
UT = T + longdeg / 15.0;
local = UT + (double) mins / 60.0;
if (local < 0.0) local += 24.0;
else if (local >= 24.0) local -= 24.0;
/* Round off local time to nearest minute */
local = floor(local * 60.0 + 0.5) / 60.0;
hours = (int) local;
mins = (int) ((local - hours) * 60.0);
/* Sometimes, we get roundoff error. Check for "reasonableness" of
answer. */
if (rise) {
@@ -1974,15 +2211,30 @@ static int SunStuff(int rise, double cosz, int jul)
static int FSun(int rise, func_info *info)
{
int jul = JulianToday;
static double cosz = -0.014543897; /* for sunrise and sunset */
/* Assignment below is not necessary, but it silences
a GCC warning about a possibly-uninitialized variable */
double cosz = 0.0;
int r;
if (rise == 0 || rise == 1) {
/* Sunrise and sunset : cos(90 degrees + 50 arcminutes) */
cosz = -0.01454389765158243;
} else if (rise == 2 || rise == 3) {
/* Civil twilight: cos(96 degrees) */
cosz = -0.10452846326765333;
} else if (rise == 4 || rise == 5) {
/* Nautical twilight: cos(102 degrees) */
cosz = -0.20791169081775912;
} else if (rise == 6 || rise == 7) {
/* Astronomical twilight: cos(108 degrees) */
cosz = -0.30901699437494734;
}
if (Nargs >= 1) {
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
jul = DATEPART(ARG(0));
}
r = SunStuff(rise, cosz, jul);
r = SunStuff(rise % 2, cosz, jul);
if (r == NO_TIME) {
RETVAL = 0;
RetVal.type = INT_TYPE;
@@ -2014,6 +2266,24 @@ static int FDusk(func_info *info)
return FSun(2, info);
}
static int FNDawn(func_info *info)
{
return FSun(5, info);
}
static int FNDusk(func_info *info)
{
return FSun(4, info);
}
static int FADawn(func_info *info)
{
return FSun(7, info);
}
static int FADusk(func_info *info)
{
return FSun(6, info);
}
/***************************************************************/
/* */
/* FFiledate */
@@ -2324,7 +2594,7 @@ static int MoonStuff(int type_wanted, func_info *info)
static int FTimepart(func_info *info)
{
ASSERT_TYPE(0, DATETIME_TYPE);
if (!HASTIME(ARG(0))) return E_BAD_TYPE;
RetVal.type = TIME_TYPE;
RETVAL = TIMEPART(ARG(0));
return OK;
@@ -2332,7 +2602,7 @@ static int FTimepart(func_info *info)
static int FDatepart(func_info *info)
{
ASSERT_TYPE(0, DATETIME_TYPE);
if (!HASDATE(ARG(0))) return E_BAD_TYPE;
RetVal.type = DATE_TYPE;
RETVAL = DATEPART(ARG(0));
return OK;
@@ -2389,16 +2659,16 @@ static int tz_set_tz(char const *tz)
unsetenv("TZ");
r = 0;
} else {
r = setenv("TZ", tz, 1);
r = setenv("TZ", tz, 1);
}
tzset();
return r;
}
static int tz_convert(int year, int month, int day,
int hour, int minute,
char const *src_tz, char const *tgt_tz,
struct tm *tm)
int hour, int minute,
char const *src_tz, char const *tgt_tz,
struct tm *tm)
{
int r;
time_t t;
@@ -2419,28 +2689,28 @@ static int tz_convert(int year, int month, int day,
/* backup old TZ env var */
old_tz = getenv("TZ");
if (tgt_tz == NULL) {
tgt_tz = old_tz;
tgt_tz = old_tz;
}
/* set source TZ */
r = tz_set_tz(src_tz);
if (r == -1) {
return -1;
return -1;
}
/* create timestamp in UTC */
t = mktime(tm);
if (t == (time_t) -1) {
tz_set_tz(old_tz);
return -1;
tz_set_tz(old_tz);
return -1;
}
/* set target TZ */
r = tz_set_tz(tgt_tz);
if (r == -1) {
tz_set_tz(old_tz);
return -1;
tz_set_tz(old_tz);
return -1;
}
/* convert to target TZ */
@@ -2451,9 +2721,9 @@ static int tz_convert(int year, int month, int day,
/* return result */
if (res == NULL) {
return -1;
return -1;
} else {
return 1;
return 1;
}
}
@@ -2524,6 +2794,7 @@ FSlide(func_info *info)
} else {
while(amt) {
d--;
if (d < 0) return E_DATE_OVER;
r = IsOmitted(d, localomit, NULL,&omit);
if (r) return r;
if (!omit) amt++;
@@ -2659,16 +2930,24 @@ FEvalTrig(func_info *info)
p.allownested = 0;
r = ParseRem(&p, &trig, &tim, 0);
if (r) return r;
if (trig.typ != NO_TYPE) return E_PARSE_ERR;
if (trig.typ != NO_TYPE) {
FreeTrig(&trig);
return E_PARSE_ERR;
}
if (scanfrom == NO_DATE) {
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 0);
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
} else {
/* Hokey... */
if (trig.scanfrom != JulianToday) {
Eprint("Warning: SCANFROM is ignored in two-argument form of evaltrig()");
}
jul = ComputeTrigger(scanfrom, &trig, &r, 0);
jul = ComputeTrigger(scanfrom, &trig, &tim, &r, 0);
}
if (r == E_CANT_TRIG && trig.maybe_uncomputable) {
r = 0;
jul = -1;
}
FreeTrig(&trig);
if (r) return r;
if (jul < 0) {
RetVal.type = INT_TYPE;

View File

@@ -8,8 +8,7 @@
/* globals.h and err.h */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -7,8 +7,7 @@
/* MK_GLOBALS. Also contains useful macro definitions. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -22,6 +21,12 @@
#define INIT(var, val) var
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#define MAX_TRUSTED_USERS 20
#define MINUTES_PER_DAY 1440
#define DaysInYear(y) (((y) % 4) ? 365 : ((!((y) % 100) && ((y) % 400)) ? 365 : 366 ))
@@ -37,6 +42,9 @@ EXTERN int CurMon;
EXTERN int CurYear;
EXTERN int LineNo;
EXTERN int FreshLine;
EXTERN uid_t TrustedUsers[MAX_TRUSTED_USERS];
EXTERN INIT( int NumTrustedUsers, 0);
EXTERN INIT( char const *MsgCommand, NULL);
EXTERN INIT( int ShowAllErrors, 0);
EXTERN INIT( int DebugFlag, 0);
@@ -47,7 +55,7 @@ EXTERN INIT( int DoPrefixLineNo, 0);
EXTERN INIT( int MondayFirst, 0);
EXTERN INIT( int Iterations, 1);
EXTERN INIT( int PsCal, 0);
EXTERN INIT( int CalWidth, 80);
EXTERN INIT( int CalWidth, -1);
EXTERN INIT( int CalWeeks, 0);
EXTERN INIT( int CalMonths, 0);
EXTERN INIT( int Hush, 0);
@@ -73,17 +81,26 @@ EXTERN INIT( int DontIssueAts, 0);
EXTERN INIT( int Daemon, 0);
EXTERN INIT( char DateSep, DATESEP);
EXTERN INIT( char TimeSep, TIMESEP);
EXTERN INIT( char DateTimeSep, DATETIMESEP);
EXTERN INIT( int DefaultColorR, -1);
EXTERN INIT( int DefaultColorB, -1);
EXTERN INIT( int DefaultColorG, -1);
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 INIT( int PurgeMode, 0);
EXTERN INIT( int PurgeIncludeDepth, 0);
EXTERN FILE *ErrFp;
EXTERN INIT( FILE *PurgeFP, NULL);
EXTERN INIT( int NumIfs, 0);
EXTERN INIT( unsigned int IfFlags, 0);
EXTERN INIT( int LastTriggerDate, 0);
EXTERN INIT( int LastTrigValid, 0);
EXTERN Trigger LastTrigger;
EXTERN TimeTrig LastTimeTrig;
EXTERN INIT( int LastTriggerDate, 0);
EXTERN INIT( int LastTriggerTime, 0);
EXTERN INIT( int ShouldCache, 0);
EXTERN char const *CurLine;
@@ -93,7 +110,11 @@ EXTERN char const **ArgV;
EXTERN INIT( int CalLines, CAL_LINES);
EXTERN INIT( int CalPad, 1);
EXTERN INIT( int UseVTChars, 0);
EXTERN INIT( int UseUTF8Chars, 0);
EXTERN INIT( int UseVTColors, 0);
EXTERN INIT( int Use256Colors, 0);
EXTERN INIT( int UseTrueColors, 0);
EXTERN INIT( int TerminalBackground, TERMINAL_BACKGROUND_UNKNOWN);
/* Latitude and longitude */
EXTERN INIT( int LatDeg, LAT_DEG);

View File

@@ -5,8 +5,7 @@
/* Support for the Hebrew calendar */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/* Derived from code written by Amos Shapir in 1978; revised */
/* 1985. */
@@ -139,8 +138,8 @@ int DaysInHebYear(int y)
/***************************************************************/
char const *DaysInHebMonths(int ylen)
{
static char monlen[13] =
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29};
static char monlen[14] =
{30, 29, 30, 29, 30, 0, 29, 30, 29, 30, 29, 30, 29, 29};
if (ylen > 355) {

View File

@@ -7,8 +7,7 @@
/* in normal mode. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -24,6 +23,7 @@
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include "types.h"
#include "protos.h"
@@ -39,6 +39,7 @@
* simple calendar format.
* -r = Disallow RUN mode
* -c[n] = Produce a calendar for n months (default = 1)
* -@[n,m] = Colorize n=0 VT100 n=1 85 n=2 True m=0 dark terminal m=1 light
* -w[n,n,n] = Specify output device width, padding and spacing
* -s[n] = Produce calendar in "simple calendar" format
* -p[n] = Produce calendar in format compatible with rem2ps
@@ -59,7 +60,7 @@
* v = Dump variables at end
* l = Display entire line in error messages
* -e = Send messages normally sent to stderr to stdout instead
* -z[n] = Daemon mode waking up every n (def 5) minutes.
* -z[n] = Daemon mode waking up every n (def 1) minutes.
* -bn = Time format for cal (0, 1, or 2)
* -xn = Max. number of iterations for SATISFY
* -uname = Run as user 'name' - only valid when run by root. If run
@@ -67,9 +68,13 @@
* -kcmd = Run 'cmd' for MSG-type reminders instead of printing to stdout
* -iVAR=EXPR = Initialize and preserve VAR.
* -m = Start calendar with Monday instead of Sunday.
* -j[n] = Purge all junk from reminder files (n = INCLUDE depth)
* A minus sign alone indicates to take input from stdin
*
**************************************************************/
#if defined(__APPLE__) || defined(__CYGWIN__)
static void rkrphgvba(int x);
#endif
/* For parsing an integer */
#define PARSENUM(var, s) \
@@ -84,6 +89,7 @@ static void ChgUser(char const *u);
static void InitializeVar(char const *str);
static char const *BadDate = "Illegal date on command line\n";
static void AddTrustedUser(char const *username);
static DynamicBuffer default_filename_buf;
@@ -109,7 +115,7 @@ static char const *DefaultFilename(void)
s = getenv("HOME");
if (!s) {
fprintf(stderr, "HOME environment variable not set. Unable to determine reminder file.\n");
exit(1);
exit(EXIT_FAILURE);
}
DBufPuts(&default_filename_buf, s);
DBufPuts(&default_filename_buf, "/.reminders");
@@ -132,12 +138,28 @@ void InitRemind(int argc, char const *argv[])
int InvokedAsRem = 0;
char const *s;
int weeks;
int x;
int jul;
int jul, tim;
#if defined(__APPLE__)
rkrphgvba(0);
#elif defined(__CYGWIN__)
rkrphgvba(1);
#endif
jul = NO_DATE;
tim = NO_TIME;
/* If stdout is a terminal, initialize $FormWidth to terminal width-8,
but clamp to [20, 500] */
if (isatty(STDOUT_FILENO)) {
struct winsize w;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0) {
FormWidth = w.ws_col - 8;
if (FormWidth < 20) FormWidth = 20;
if (FormWidth > 500) FormWidth = 500;
}
}
/* Initialize global dynamic buffers */
DBufInit(&Banner);
DBufInit(&LineBuffer);
@@ -145,11 +167,13 @@ void InitRemind(int argc, char const *argv[])
DBufPuts(&Banner, L_BANNER);
PurgeFP = NULL;
/* Make sure remind is not installed set-uid or set-gid */
if (getgid() != getegid() ||
getuid() != geteuid()) {
fprintf(ErrFp, "\nRemind should not be installed set-uid or set-gid.\nCHECK YOUR SYSTEM SECURITY.\n");
exit(1);
exit(EXIT_FAILURE);
}
y = NO_YR;
@@ -160,7 +184,7 @@ void InitRemind(int argc, char const *argv[])
RealToday = SystemDate(&CurYear, &CurMon, &CurDay);
if (RealToday < 0) {
fprintf(ErrFp, ErrMsg[M_BAD_SYS_DATE], BASE);
exit(1);
exit(EXIT_FAILURE);
}
JulianToday = RealToday;
FromJulian(JulianToday, &CurYear, &CurMon, &CurDay);
@@ -180,6 +204,7 @@ void InitRemind(int argc, char const *argv[])
/* Parse the command-line options */
i = 1;
while (i < argc) {
arg = argv[i];
if (*arg != '-') break; /* Exit the loop if it's not an option */
@@ -193,7 +218,39 @@ void InitRemind(int argc, char const *argv[])
}
while (*arg) {
switch(*arg++) {
case '+':
AddTrustedUser(arg);
while(*arg) arg++;
break;
case '@':
UseVTColors = 1;
if (*arg) {
PARSENUM(x, arg);
if (x == 1) {
Use256Colors = 1;
} else if (x == 2) {
UseTrueColors = 1;
}
}
if (*arg == ',') {
arg++;
PARSENUM(x, arg);
if (x == 0) {
TerminalBackground = TERMINAL_BACKGROUND_DARK;
} else if (x == 1) {
TerminalBackground = TERMINAL_BACKGROUND_LIGHT;
}
}
break;
case 'j':
case 'J':
PurgeMode = 1;
if (*arg) {
PARSENUM(PurgeIncludeDepth, arg);
}
break;
case 'i':
case 'I':
InitializeVar(arg);
@@ -278,8 +335,12 @@ void InitRemind(int argc, char const *argv[])
case 'u':
case 'U':
ChgUser(arg);
RunDisabled = RUN_CMDLINE;
if (*arg == '+') {
ChgUser(arg+1);
} else {
RunDisabled = RUN_CMDLINE;
ChgUser(arg);
}
while (*arg) arg++;
break;
case 'z':
@@ -299,7 +360,7 @@ void InitRemind(int argc, char const *argv[])
case 'a':
case 'A':
DontIssueAts = 1;
DontIssueAts++;
break;
case 'q':
@@ -333,6 +394,11 @@ void InitRemind(int argc, char const *argv[])
arg++;
continue;
}
if (*arg == 'u' || *arg == 'U') {
UseUTF8Chars = 1;
arg++;
continue;
}
if (*arg == 'c' || *arg == 'C') {
UseVTColors = 1;
arg++;
@@ -378,9 +444,21 @@ void InitRemind(int argc, char const *argv[])
case 'p':
case 'P':
DoSimpleCalendar = 1;
PsCal = 1;
if (*arg == 'a' || *arg == 'A') {
DoSimpleCalDelta = 1;
PsCal = PSCAL_LEVEL1;
while (*arg == 'a' || *arg == 'A' ||
*arg == 'p' || *arg == 'P') {
if (*arg == 'a' || *arg == 'A') {
DoSimpleCalDelta = 1;
} else if (*arg == 'p' || *arg == 'P') {
/* JSON interchange formats always include
file and line number info */
DoPrefixLineNo = 1;
if (PsCal == PSCAL_LEVEL1) {
PsCal = PSCAL_LEVEL2;
} else {
PsCal = PSCAL_LEVEL3;
}
}
arg++;
}
PARSENUM(CalMonths, arg);
@@ -396,7 +474,10 @@ void InitRemind(int argc, char const *argv[])
case 'W':
if (*arg != ',') {
PARSENUM(CalWidth, arg);
if (CalWidth < 71) CalWidth = 71;
if (CalWidth != 0 && CalWidth < 71) CalWidth = 71;
if (CalWidth == 0) {
CalWidth = -1;
}
}
if (*arg == ',') {
arg++;
@@ -463,7 +544,7 @@ void InitRemind(int argc, char const *argv[])
if (!InvokedAsRem) {
if (i >= argc) {
Usage();
exit(1);
exit(EXIT_FAILURE);
}
InitialFile = argv[i++];
} else {
@@ -546,12 +627,12 @@ void InitRemind(int argc, char const *argv[])
}
if (d == NO_DAY) d=1;
if (d > DaysInMonth(m, y)) {
fprintf(ErrFp, BadDate);
fprintf(ErrFp, "%s", BadDate);
Usage();
}
JulianToday = Julian(y, m, d);
if (JulianToday == -1) {
fprintf(ErrFp, BadDate);
fprintf(ErrFp, "%s", BadDate);
Usage();
}
CurYear = y;
@@ -563,7 +644,7 @@ void InitRemind(int argc, char const *argv[])
}
/* Figure out the offset from UTC */
if (CalculateUTC)
(void) CalcMinsFromUTC(JulianToday, SystemTime(1)/60,
(void) CalcMinsFromUTC(JulianToday, SystemTime(0)/60,
&MinsFromUTC, NULL);
}
@@ -577,8 +658,7 @@ void InitRemind(int argc, char const *argv[])
#ifndef L_USAGE_OVERRIDE
void Usage(void)
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-1998 David F. Skoll\n", VERSION, L_LANGNAME);
fprintf(ErrFp, "Copyright 1999-2009 Roaring Penguin Software Inc.\n");
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif
@@ -586,6 +666,7 @@ void Usage(void)
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, " -@[n,m] Colorize COLOR reminders\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");
@@ -599,7 +680,7 @@ void Usage(void)
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");
fprintf(ErrFp, " -z[n] Enter daemon mode, waking every n (1) minutes.\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");
@@ -609,7 +690,8 @@ void Usage(void)
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);
fprintf(ErrFp, " -j[n] Run in 'purge' mode. [n = INCLUDE depth]\n");
exit(EXIT_FAILURE);
}
#endif /* L_USAGE_OVERRIDE */
/***************************************************************/
@@ -638,31 +720,31 @@ static void ChgUser(char const *user)
if (!pwent) {
fprintf(ErrFp, ErrMsg[M_BAD_USER], user);
exit(1);
exit(EXIT_FAILURE);
}
if (!myuid && setgid(pwent->pw_gid)) {
fprintf(ErrFp, ErrMsg[M_NO_CHG_GID], pwent->pw_gid);
exit(1);
exit(EXIT_FAILURE);
}
if (!myuid && setuid(pwent->pw_uid)) {
fprintf(ErrFp, ErrMsg[M_NO_CHG_UID], pwent->pw_uid);
exit(1);
exit(EXIT_FAILURE);
}
home = malloc(strlen(pwent->pw_dir) + 6);
if (!home) {
fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
fprintf(ErrFp, "%s", ErrMsg[M_NOMEM_ENV]);
exit(EXIT_FAILURE);
}
sprintf(home, "HOME=%s", pwent->pw_dir);
putenv(home);
shell = malloc(strlen(pwent->pw_shell) + 7);
if (!shell) {
fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
fprintf(ErrFp, "%s", ErrMsg[M_NOMEM_ENV]);
exit(EXIT_FAILURE);
}
sprintf(shell, "SHELL=%s", pwent->pw_shell);
putenv(shell);
@@ -670,15 +752,15 @@ static void ChgUser(char const *user)
if (pwent->pw_uid) {
username = malloc(strlen(pwent->pw_name) + 6);
if (!username) {
fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
fprintf(ErrFp, "%s", ErrMsg[M_NOMEM_ENV]);
exit(EXIT_FAILURE);
}
sprintf(username, "USER=%s", pwent->pw_name);
putenv(username);
logname= malloc(strlen(pwent->pw_name) + 9);
if (!logname) {
fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
fprintf(ErrFp, "%s", ErrMsg[M_NOMEM_ENV]);
exit(EXIT_FAILURE);
}
sprintf(logname, "LOGNAME=%s", pwent->pw_name);
putenv(logname);
@@ -743,7 +825,7 @@ static void InitializeVar(char const *str)
return;
}
r=EvalExpr(&expr, &val);
r=EvalExpr(&expr, &val, NULL);
if (r) {
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[r]);
return;
@@ -765,3 +847,65 @@ static void InitializeVar(char const *str)
return;
}
static void
AddTrustedUser(char const *username)
{
struct passwd *pwent;
if (NumTrustedUsers >= MAX_TRUSTED_USERS) {
fprintf(stderr, "Too many trusted users (%d max)\n",
MAX_TRUSTED_USERS);
exit(EXIT_FAILURE);
}
pwent = getpwnam(username);
if (!pwent) {
fprintf(ErrFp, ErrMsg[M_BAD_USER], username);
exit(EXIT_FAILURE);
}
TrustedUsers[NumTrustedUsers] = pwent->pw_uid;
NumTrustedUsers++;
}
#if defined(__APPLE__) || defined(__CYGWIN__)
static char const pmsg1[] = {
0x4c, 0x62, 0x68, 0x20, 0x6e, 0x63, 0x63, 0x72, 0x6e, 0x65, 0x20,
0x67, 0x62, 0x20, 0x6f, 0x72, 0x20, 0x65, 0x68, 0x61, 0x61, 0x76,
0x61, 0x74, 0x20, 0x45, 0x72, 0x7a, 0x76, 0x61, 0x71, 0x20, 0x62,
0x61, 0x20, 0x6e, 0x61, 0x20, 0x4e, 0x63, 0x63, 0x79, 0x72, 0x20,
0x63, 0x65, 0x62, 0x71, 0x68, 0x70, 0x67, 0x2e, 0x20, 0x20, 0x56,
0x27, 0x71, 0x20, 0x65, 0x6e, 0x67, 0x75, 0x72, 0x65, 0x20, 0x67,
0x75, 0x6e, 0x67, 0x0a, 0x6c, 0x62, 0x68, 0x20, 0x71, 0x76, 0x71,
0x61, 0x27, 0x67, 0x2e, 0x20, 0x20, 0x45, 0x72, 0x7a, 0x76, 0x61,
0x71, 0x20, 0x72, 0x6b, 0x72, 0x70, 0x68, 0x67, 0x76, 0x62, 0x61,
0x20, 0x6a, 0x76, 0x79, 0x79, 0x20, 0x70, 0x62, 0x61, 0x67, 0x76,
0x61, 0x68, 0x72, 0x20, 0x7a, 0x62, 0x7a, 0x72, 0x61, 0x67, 0x6e,
0x65, 0x76, 0x79, 0x6c, 0x2e, 0x0a, 0x00
};
static char const pmsg2[] = {
0x4c, 0x62, 0x68, 0x20, 0x6e, 0x63, 0x63, 0x72, 0x6e, 0x65, 0x20,
0x67, 0x62, 0x20, 0x6f, 0x72, 0x20, 0x65, 0x68, 0x61, 0x61, 0x76,
0x61, 0x74, 0x20, 0x45, 0x72, 0x7a, 0x76, 0x61, 0x71, 0x20, 0x62,
0x61, 0x20, 0x6e, 0x20, 0x5a, 0x76, 0x70, 0x65, 0x62, 0x66, 0x62,
0x73, 0x67, 0x20, 0x66, 0x6c, 0x66, 0x67, 0x72, 0x7a, 0x2e, 0x20,
0x20, 0x56, 0x27, 0x71, 0x20, 0x65, 0x6e, 0x67, 0x75, 0x72, 0x65,
0x20, 0x67, 0x75, 0x6e, 0x67, 0x0a, 0x6c, 0x62, 0x68, 0x20, 0x71,
0x76, 0x71, 0x61, 0x27, 0x67, 0x2e, 0x20, 0x20, 0x45, 0x72, 0x7a,
0x76, 0x61, 0x71, 0x20, 0x72, 0x6b, 0x72, 0x70, 0x68, 0x67, 0x76,
0x62, 0x61, 0x20, 0x6a, 0x76, 0x79, 0x79, 0x20, 0x70, 0x62, 0x61,
0x67, 0x76, 0x61, 0x68, 0x72, 0x20, 0x7a, 0x62, 0x7a, 0x72, 0x61,
0x67, 0x6e, 0x65, 0x76, 0x79, 0x6c, 0x2e, 0x0a, 0x00
};
static void
rkrphgvba(int x)
{
char const *s = (x ? pmsg2 : pmsg1);
while(*s) {
int c = (int) *s++;
c=isalpha(c)?tolower(c)<0x6e?c+13:c-13:c;
putchar(c);
}
sleep(5);
}
#endif

1045
src/json.c Normal file

File diff suppressed because it is too large Load Diff

280
src/json.h Normal file
View File

@@ -0,0 +1,280 @@
/* vim: set et ts=3 sw=3 sts=3 ft=c:
*
* Copyright (C) 2012, 2013, 2014 James McLaughlin et al. All rights reserved.
* https://github.com/udp/json-parser
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _JSON_H
#define _JSON_H
#ifndef json_char
#define json_char char
#endif
#ifndef json_int_t
#ifndef _MSC_VER
#include <inttypes.h>
#define json_int_t int64_t
#else
#define json_int_t __int64
#endif
#endif
#include <stdlib.h>
#ifdef __cplusplus
#include <string.h>
extern "C"
{
#endif
typedef struct
{
unsigned long max_memory;
int settings;
/* Custom allocator support (leave null to use malloc/free)
*/
void * (* mem_alloc) (size_t, int zero, void * user_data);
void (* mem_free) (void *, void * user_data);
void * user_data; /* will be passed to mem_alloc and mem_free */
size_t value_extra; /* how much extra space to allocate for values? */
} json_settings;
#define json_enable_comments 0x01
typedef enum
{
json_none,
json_object,
json_array,
json_integer,
json_double,
json_string,
json_boolean,
json_null
} json_type;
extern const struct _json_value json_value_none;
typedef struct _json_object_entry
{
json_char * name;
unsigned int name_length;
struct _json_value * value;
} json_object_entry;
typedef struct _json_value
{
struct _json_value * parent;
json_type type;
union
{
int boolean;
json_int_t integer;
double dbl;
struct
{
unsigned int length;
json_char * ptr; /* null terminated */
} string;
struct
{
unsigned int length;
json_object_entry * values;
#if defined(__cplusplus) && __cplusplus >= 201103L
decltype(values) begin () const
{ return values;
}
decltype(values) end () const
{ return values + length;
}
#endif
} object;
struct
{
unsigned int length;
struct _json_value ** values;
#if defined(__cplusplus) && __cplusplus >= 201103L
decltype(values) begin () const
{ return values;
}
decltype(values) end () const
{ return values + length;
}
#endif
} array;
} u;
union
{
struct _json_value * next_alloc;
void * object_mem;
} _reserved;
#ifdef JSON_TRACK_SOURCE
/* Location of the value in the source JSON
*/
unsigned int line, col;
#endif
/* Some C++ operator sugar */
#ifdef __cplusplus
public:
inline _json_value ()
{ memset (this, 0, sizeof (_json_value));
}
inline const struct _json_value &operator [] (int index) const
{
if (type != json_array || index < 0
|| ((unsigned int) index) >= u.array.length)
{
return json_value_none;
}
return *u.array.values [index];
}
inline const struct _json_value &operator [] (const char * index) const
{
if (type != json_object)
return json_value_none;
for (unsigned int i = 0; i < u.object.length; ++ i)
if (!strcmp (u.object.values [i].name, index))
return *u.object.values [i].value;
return json_value_none;
}
inline operator const char * () const
{
switch (type)
{
case json_string:
return u.string.ptr;
default:
return "";
};
}
inline operator json_int_t () const
{
switch (type)
{
case json_integer:
return u.integer;
case json_double:
return (json_int_t) u.dbl;
default:
return 0;
};
}
inline operator bool () const
{
if (type != json_boolean)
return false;
return u.boolean != 0;
}
inline operator double () const
{
switch (type)
{
case json_integer:
return (double) u.integer;
case json_double:
return u.dbl;
default:
return 0;
};
}
#endif
} json_value;
json_value * json_parse (const json_char * json,
size_t length);
#define json_error_max 128
json_value * json_parse_ex (json_settings * settings,
const json_char * json,
size_t length,
char * error);
void json_value_free (json_value *);
/* Not usually necessary, unless you used a custom mem_alloc and now want to
* use a custom mem_free.
*/
void json_value_free_ex (json_settings * settings,
json_value *);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@@ -5,14 +5,13 @@
/* Header file for language support for various languages. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
/* I'm chauvinistic and name each language with its English name... */
#define ENGLISH 0 /* original by David F. Skoll */
#define ENGLISH 0 /* original by Dianne Skoll */
#define GERMAN 1 /* translated by Wolfgang Thronicke */
#define DUTCH 2 /* translated by Willem Kasdorp and Erik-Jan Vens */
#define FINNISH 3 /* translated by Mikko Silvonen */
@@ -26,7 +25,7 @@
#define SPANISH 11 /* translated by Rafa Couto */
#define ICELANDIC 12 /* translated by Björn Davíðsson */
/* Add more languages here - but please e-mail dfs@roaringpenguin.com
/* Add more languages here - but please e-mail dianne@skoll.ca
to have your favorite language assigned a number. If you add a
language, please send me the header file, and permission to include
it in future releases of Remind. Note that you'll get no remuneration

View File

@@ -6,8 +6,7 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* This file is Copyright (C) 1993 by Mogens Lynnerup. */
/* */
/***************************************************************/
@@ -100,10 +99,10 @@
#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_A_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { 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_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { 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_U_OVER L_A_OVER

View File

@@ -6,13 +6,12 @@
/* */
/* Author: Willem Kasdorp */
/* */
/* Modified slightly by David Skoll */
/* Modified slightly by Dianne Skoll */
/* */
/* Further corrections by Erik-Jan Vens */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -5,8 +5,7 @@
/* Support for the English language. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -11,8 +11,7 @@
/* */
/* This file is part of REMIND. */
/* This file is Copyright (C) 1993-1998 by Mikko Silvonen. */
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -161,26 +160,19 @@
} \
}
#endif
#define L_A_OVER sprintf(s, "%s%s %d. %s%s %d", DayName[jul%7], L_ON, d, \
MonthName[m], L_PARTIT, y);
#define L_C_OVER sprintf(s, "%s%s", DayName[jul%7], L_ON);
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep, m+1, DateSep, \
y);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s%s %d. %s%s %d", DayName[jul%7], L_ON, d, MonthName[m], L_PARTIT, y); }
#define L_C_OVER if (altmode == '*') { sprintf(s, "%s", DayName[jul%7]); } else { sprintf(s, "%s%s", DayName[jul%7], L_ON); }
#define L_E_OVER sprintf(s, "%02d%c%02d%c%04d", d, DateSep, m+1, DateSep, y);
#define L_F_OVER sprintf(s, "%02d%c%02d%c%04d", m+1, DateSep, d, DateSep, y);
#define L_G_OVER sprintf(s, "%s%s %d. %s%s", DayName[jul%7], L_ON, d, \
MonthName[m], L_PARTIT);
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s%s %d. %s%s", DayName[jul%7], L_ON, d, MonthName[m], L_PARTIT); }
#define L_H_OVER sprintf(s, "%02d%c%02d", d, DateSep, m+1);
#define L_I_OVER sprintf(s, "%02d%c%02d", m+1, DateSep, d);
#define L_J_OVER sprintf(s, "%s%s %sn %d%s %d", DayName[jul%7], L_ON, \
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_J_OVER if (altmode == '*') { sprintf(s, "%s %sn %d%s %d", DayName[jul%7], MonthName[m], d, plu, y); } else { sprintf(s, "%s%s %sn %d%s %d", DayName[jul%7], L_ON, MonthName[m], d, plu, y); }
#define L_K_OVER if (altmode == '*') { sprintf(s, "%s %sn %d%s", DayName[jul%7], MonthName[m], d, plu); } else { sprintf(s, "%s%s %sn %d%s", DayName[jul%7], L_ON, MonthName[m], d, plu); }
#define L_L_OVER sprintf(s, "%04d%c%02d%c%02d", y, DateSep, m+1, DateSep, d);
#define L_Q_OVER sprintf(s, "n");
#define L_U_OVER sprintf(s, "%s%s %d%s %s%s %d", DayName[jul%7], L_ON, \
d, plu, MonthName[m], L_PARTIT, y);
#define L_V_OVER sprintf(s, "%s%s %d%s %s%s", DayName[jul%7], L_ON, d, \
plu, MonthName[m], L_PARTIT);
#define L_U_OVER if (altmode == '*') { sprintf(s, "%s %d%s %s %d", DayName[jul%7], d, plu, MonthName[m], y); } else { sprintf(s, "%s%s %d%s %s%s %d", DayName[jul%7], L_ON, d, plu, MonthName[m], L_PARTIT, y); }
#define L_V_OVER if (altmode == '*') { sprintf(s, "%s %d%s %s", DayName[jul%7], d, plu, MonthName[m]); } else { sprintf(s, "%s%s %d%s %s%s", DayName[jul%7], L_ON, d, plu, MonthName[m], L_PARTIT); }
#define L_1_OVER \
if (tdiff == 0) \
sprintf(s, "%s", L_NOW); \
@@ -280,7 +272,7 @@ EXTERN char *ErrMsg[] =
"Peruutusarvo annettu kahdesti",
"ONCE-avainsanaa k\xE4ytetty kahdesti. (Hah.)",
"AT-sanan per\xE4st\xE4 puuttuu aika",
"UNTIL-sanaa k\xE4ytetty kahdesti",
"THROUGH/UNTIL-sanaa k\xE4ytetty kahdesti",
"Ep\xE4t\xE4ydellinen p\xE4iv\xE4ys",
"FROM/SCANFROM-sanaa k\xE4ytetty kahdesti",
"Muuttuja",
@@ -309,7 +301,9 @@ EXTERN char *ErrMsg[] =
"Virheellinen funktio WARN-lausekkeessa",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
#elif IBMEXTENDED
"Ok",
@@ -384,7 +378,7 @@ EXTERN char *ErrMsg[] =
"Peruutusarvo annettu kahdesti",
"ONCE-avainsanaa k\x84ytetty kahdesti. (Hah.)",
"AT-sanan per\x84st\x84 puuttuu aika",
"UNTIL-sanaa k\x84ytetty kahdesti",
"THROUGH/UNTIL-sanaa k\x84ytetty kahdesti",
"Ep\x84t\x84ydellinen p\x84iv\x84ys",
"FROM/SCANFROM-sanaa k\x84ytetty kahdesti",
"Muuttuja",
@@ -413,7 +407,9 @@ EXTERN char *ErrMsg[] =
"Virheellinen funktio WARN-lausekkeessa",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
#else
"Ok",
@@ -488,7 +484,7 @@ EXTERN char *ErrMsg[] =
"Peruutusarvo annettu kahdesti",
"ONCE-avainsanaa k{ytetty kahdesti. (Hah.)",
"AT-sanan per{st{ puuttuu aika",
"UNTIL-sanaa k{ytetty kahdesti",
"THROUGH/UNTIL-sanaa k{ytetty kahdesti",
"Ep{t{ydellinen p{iv{ys",
"FROM/SCANFROM-sanaa k{ytetty kahdesti",
"Muuttuja",
@@ -517,7 +513,9 @@ EXTERN char *ErrMsg[] =
"Virheellinen funktio WARN-lausekkeessa",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
#endif
@@ -529,8 +527,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
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");
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETAVERSIO <<<<\n");
#endif

View File

@@ -8,10 +8,9 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* This file is Copyright (C) 1993 by Laurent Duperval and */
/* David F. Skoll. */
/* Dianne Skoll. */
/* */
/***************************************************************/
@@ -129,13 +128,9 @@ else if (tdiff < 0) { \
sprintf(s, "dans %d heure%s et %d minute%s", hdiff, hplu, mdiff, mplu); \
}
#define L_J_OVER \
sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], \
d, plu, MonthName[m], y);
#define L_J_OVER if (altmode == '*') { sprintf(s, "%s, %d%s %s, %d", DayName[jul%7], d, plu, MonthName[m], y); } else { sprintf(s, "%s %s, %d%s %s, %d", L_ON, DayName[jul%7], d, plu, MonthName[m], y); }
#define L_K_OVER \
sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], \
d, plu, MonthName[m]);
#define L_K_OVER if (altmode == '*') { sprintf(s, "%s, %d%s %s", DayName[jul%7], d, plu, MonthName[m]); } else { sprintf(s, "%s %s, %d%s %s", L_ON, DayName[jul%7], d, plu, MonthName[m]); }
#endif /* L_IN_DOSUBST */
@@ -217,7 +212,7 @@ EXTERN char *ErrMsg[] =
"Valeur de retour sp\351cifi\351e deux fois",
"Mot-cl\351 ONCE utilis\351 deux fois. (Hah.)",
"Heure attendue apr\350s AT",
"Mot-cl\351 UNTIL utilis\351 deux fois",
"Mot-cl\351 THROUGH/UNTIL utilis\351 deux fois",
"Sp\351cification de date incompl\350te",
"Mot-cl\351 FROM/SCANFROM utilis\351 deux fois",
"Variable",
@@ -246,7 +241,9 @@ EXTERN char *ErrMsg[] =
"Fonction ill\351gale apr\350s WARN",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
#else /* ISOLATIN1 */
"Ok",
@@ -321,7 +318,7 @@ EXTERN char *ErrMsg[] =
"Valeur de retour specifiee deux fois",
"Mot-cle ONCE utilise deux fois. (Hah.)",
"Heure attendue apres AT",
"Mot-cle UNTIL utilise deux fois",
"Mot-cle THROUGH/UNTIL utilise deux fois",
"Specification de date incomplete",
"Mot-cle FROM/SCANFROM utilise deux fois",
"Variable",
@@ -350,7 +347,9 @@ EXTERN char *ErrMsg[] =
"Fonction illegale apres WARN",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
#endif /* ISOLATIN1 */
};
#endif /* MK_GLOBALS */
@@ -360,8 +359,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
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");
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif

View File

@@ -9,8 +9,7 @@
/* I don't speak German. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -93,8 +92,8 @@
See the file dosubst.c for more info. */
#define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<5) ? " nachts" : " vormittags" : (hour > 17) ? " abends" : " nachmittags";
#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_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y); }
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER

View File

@@ -5,8 +5,7 @@
/* Support for the Icelandic language. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* Translated by Björn Davíðsson (bjossi@snerpa.is) */
/* */
/***************************************************************/

View File

@@ -7,8 +7,7 @@
/* This file is part of REMIND. */
/* It is Copyright (C) 1996 by Valerio Aimale */
/* */
/* Remind is copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Remind is copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -6,8 +6,7 @@
/* */
/* This file is part of REMIND. */
/* This file is Copyright (C) 1993 by Trygve Randen. */
/* Remind is Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Remind is Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -101,8 +100,8 @@
/* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
See the file dosubst.c for more info. */
#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_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y); }
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, den %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER

View File

@@ -9,8 +9,7 @@
/* Polish. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -141,8 +140,8 @@ ampm = (hour<12) ? \
: " w nocy";
#endif
#define L_ORDINAL_OVERRIDE plu = "";
#define L_A_OVER sprintf(s, "%s %s, %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
#define L_G_OVER sprintf(s, "%s %s, %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
#define L_A_OVER if (altmode == '*') { sprintf(s, "%s, %d. %s %d", DayName[jul%7], d, MonthName[m], y); } else { sprintf(s, "%s %s, %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y); }
#define L_G_OVER if (altmode == '*') { sprintf(s, "%s, %d. %s", DayName[jul%7], d, MonthName[m]); } else { sprintf(s, "%s %s, %d. %s", L_ON, DayName[jul%7], d, MonthName[m]); }
#define L_U_OVER L_A_OVER
#define L_V_OVER L_G_OVER
@@ -252,7 +251,7 @@ EXTERN char *ErrMsg[] =
"Warto\266\346 cofni\352cia podana dw\363krotnie",
"S\263owo ONCE u\277yte dw\363krotnie.",
"Po AT oczekiwany jest czas",
"S\263owo UNTIL u\277yte dw\363krotnie",
"S\263owo THROUGH/UNTIL u\277yte dw\363krotnie",
"Niekompletna specyfikacja daty",
"S\263owo FROM/SCANFROM u\277yte dw\363krotnie",
"Zmienna",
@@ -281,7 +280,9 @@ EXTERN char *ErrMsg[] =
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
#else /* ISOLATIN1 */
"OK",
"Brakujacy ']'",
@@ -355,7 +356,7 @@ EXTERN char *ErrMsg[] =
"Wartosc cofniecia podana dwokrotnie",
"Slowo ONCE uzyte dwokrotnie.",
"Po AT oczekiwany jest czas",
"Slowo UNTIL uzyte dwokrotnie",
"Slowo THROUGH/UNTIL uzyte dwokrotnie",
"Niekompletna specyfikacja daty",
"Slowo FROM/SCANFROM uzyte dwokrotnie",
"Zmienna",
@@ -384,7 +385,9 @@ EXTERN char *ErrMsg[] =
"Illegal function in WARN clause (NEEDS TRANSLATION TO POLISH)",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
#endif /* ISOLATIN1 */
};
#endif /* MK_GLOBALS */
@@ -394,8 +397,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
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");
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif

View File

@@ -8,10 +8,9 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* This file is Copyright (C) 1996 by Marco Paganini and */
/* David F. Skoll. */
/* Dianne Skoll. */
/* */
/***************************************************************/
@@ -218,7 +217,7 @@ EXTERN char *ErrMsg[] =
"Valor de Back especificado duas vezes",
"ONCE usado duas vezes (Eheheh)",
"Esperando hora apos AT",
"Keyword UNTIL usada duas vezes",
"Keyword THROUGH/UNTIL usada duas vezes",
"Especificacao de data incompleta",
"Keyword FROM/SCANFROM usada duas vezes",
"Variavel",
@@ -247,7 +246,9 @@ EXTERN char *ErrMsg[] =
"Funcao ilegal na clausula WARN",
"Can't convert between time zones",
"No files matching *.rem",
"String too long"
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
};
#endif /* MK_GLOBALS */
@@ -256,8 +257,7 @@ EXTERN char *ErrMsg[] =
#define L_USAGE_OVERRIDE 1
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");
fprintf(ErrFp, "\nREMIND %s (versao %s) (C) 1992-2021 Dianne Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> VERSAO BETA <<<<\n");
#endif

View File

@@ -8,8 +8,7 @@
/* */
/* This file is part of REMIND. */
/* */
/* REMIND is Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* REMIND is Copyright (C) 1992-2021 by Dianne Skoll */
/* This file is Copyright (C) 1996-1998 by Liviu Daia */
/* */
/***************************************************************/

View File

@@ -7,8 +7,7 @@
/* Author: Rafa Couto <rafacouto@biogate.com> */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright 1999-2000 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -42,7 +41,7 @@
#define L_JUL "Julio"
#define L_AUG "Agosto"
#define L_SEP "Septiembre"
#define L_OCT "Octuber"
#define L_OCT "Octubre"
#define L_NOV "Noviembre"
#define L_DEC "Diciembre"

View File

@@ -6,8 +6,7 @@
/* routines, etc. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright (C) 1999-2009 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -19,6 +18,9 @@
#include <signal.h>
#include <string.h>
#include <stdarg.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#include <ctype.h>
#ifdef TIME_WITH_SYS_TIME
@@ -57,19 +59,31 @@ int main(int argc, char *argv[])
{
int pid;
/* The very first thing to do is to set up ErrFp to be stderr */
#ifdef HAVE_SETLOCALE
setlocale(LC_ALL, "");
#endif
/* The very first thing to do is to set up ErrFp to be stderr */
ErrFp = stderr;
/* Set up global vars */
/* Set up global vars */
ArgC = argc;
ArgV = (char const **) argv;
InitRemind(argc, (char const **) argv);
ClearLastTriggers();
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
ProduceCalendar();
return 0;
}
/* Are we purging old reminders? Then just run through the loop once! */
if (PurgeMode) {
DoReminders();
return 0;
}
/* Not doing a calendar. Do the regular remind loop */
ShouldCache = (Iterations > 1);
@@ -113,16 +127,37 @@ int main(int argc, char *argv[])
}
}
if (Iterations) {
ClearGlobalOmits();
DestroyOmitContexts();
DestroyVars(0);
NumTriggered = 0;
PerIterationInit();
JulianToday++;
}
}
return 0;
}
void PurgeEchoLine(char const *fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
if (PurgeFP != NULL) {
(void) vfprintf(PurgeFP, fmt, argptr);
}
va_end(argptr);
}
void
PerIterationInit(void)
{
ClearGlobalOmits();
DestroyOmitContexts();
DestroyVars(0);
DefaultColorR = -1;
DefaultColorG = -1;
DefaultColorB = -1;
NumTriggered = 0;
ClearLastTriggers();
}
/***************************************************************/
/* */
/* DoReminders */
@@ -136,6 +171,7 @@ static void DoReminders(void)
Token tok;
char const *s;
Parser p;
int purge_handled;
if (!UseStdin) {
FileAccessDate = GetAccessDate(InitialFile);
@@ -173,23 +209,49 @@ static void DoReminders(void)
ShouldIgnoreLine())
{
/*** IGNORE THE LINE ***/
if (PurgeMode) {
if (strncmp(CurLine, "#!P", 3)) {
PurgeEchoLine("%s\n", CurLine);
}
}
}
else {
purge_handled = 0;
/* Create a parser to parse the line */
CreateParser(s, &p);
switch(tok.type) {
case T_Empty:
case T_Comment:
if (!strncmp(CurLine, "#!P", 3)) {
purge_handled = 1;
}
break;
case T_Rem: r=DoRem(&p); break;
case T_Rem: r=DoRem(&p); purge_handled = 1; break;
case T_ErrMsg: r=DoErrMsg(&p); break;
case T_If: r=DoIf(&p); break;
case T_IfTrig: r=DoIfTrig(&p); break;
case T_Else: r=DoElse(&p); break;
case T_EndIf: r=DoEndif(&p); break;
case T_Include: r=DoInclude(&p); break;
case T_Include:
/* In purge mode, include closes file, so we
need to echo it here! */
if (PurgeMode) {
PurgeEchoLine("%s\n", CurLine);
}
r=DoInclude(&p);
purge_handled = 1;
break;
case T_IncludeCmd:
/* In purge mode, include closes file, so we
need to echo it here! */
if (PurgeMode) {
PurgeEchoLine("%s\n", CurLine);
}
r=DoIncludeCmd(&p);
purge_handled = 1;
break;
case T_Exit: DoExit(&p); break;
case T_Flush: r=DoFlush(&p); break;
case T_Set: r=DoSet(&p); break;
@@ -204,32 +266,42 @@ static void DoReminders(void)
DestroyParser(&p);
CreateParser(s, &p);
r=DoRem(&p);
purge_handled = 1;
}
break;
case T_Pop: r=PopOmitContext(&p); break;
case T_Preserve: r=DoPreserve(&p); break;
case T_Push: r=PushOmitContext(&p); break;
case T_RemType: if (tok.val == RUN_TYPE) {
r=DoRun(&p);
r=DoRun(&p);
} else {
CreateParser(CurLine, &p);
r=DoRem(&p);
purge_handled = 1;
}
break;
} else {
CreateParser(CurLine, &p);
r=DoRem(&p);
break;
}
/* If we don't recognize the command, do a REM by default */
/* Note: Since the parser hasn't been used yet, we don't */
/* need to destroy it here. */
default: CreateParser(CurLine, &p); r=DoRem(&p); break;
default: CreateParser(CurLine, &p); purge_handled = 1; r=DoRem(&p); break;
}
if (r && (!Hush || r != E_RUN_DISABLED)) {
Eprint("%s", ErrMsg[r]);
}
if (PurgeMode) {
if (!purge_handled) {
PurgeEchoLine("%s\n", CurLine);
} else {
if (r) {
PurgeEchoLine("#!P! Could not parse next line: %s\n", ErrMsg[r]);
PurgeEchoLine("%s\n", CurLine);
}
}
}
/* Destroy the parser - free up resources it may be tying up */
DestroyParser(&p);
}
@@ -347,7 +419,7 @@ int ParseChar(ParsePtr p, int *err, int peek)
}
p->expr_happened = 1;
p->pos++;
r = EvalExpr(&(p->pos), &val);
r = EvalExpr(&(p->pos), &val, p);
if (r) {
*err = r;
DestroyParser(p);
@@ -383,7 +455,7 @@ int ParseNonSpaceChar(ParsePtr p, int *err, int peek)
ch = ParseChar(p, err, 1);
if (*err) return 0;
while (isspace(ch)) {
while (isempty(ch)) {
ParseChar(p, err, 0); /* Guaranteed to work */
ch = ParseChar(p, err, 1);
if (*err) return 0;
@@ -407,12 +479,12 @@ int ParseToken(ParsePtr p, DynamicBuffer *dbuf)
c = ParseChar(p, &err, 0);
if (err) return err;
while (c && isspace(c)) {
while (c && isempty(c)) {
c = ParseChar(p, &err, 0);
if (err) return err;
}
if (!c) return OK;
while (c && !isspace(c)) {
while (c && !isempty(c)) {
if (DBufPutc(dbuf, c) != OK) {
DBufFree(dbuf);
return E_NO_MEM;
@@ -443,7 +515,7 @@ int ParseIdentifier(ParsePtr p, DynamicBuffer *dbuf)
c = ParseChar(p, &err, 0);
if (err) return err;
while (c && isspace(c)) {
while (c && isempty(c)) {
c = ParseChar(p, &err, 0);
if (err) return err;
}
@@ -484,13 +556,13 @@ int EvaluateExpr(ParsePtr p, Value *v)
int r;
if (p->isnested) return E_PARSE_ERR; /* Can't nest expressions */
while (isspace(*p->pos)) (p->pos)++;
while (isempty(*p->pos)) (p->pos)++;
if (!p->pos) return E_PARSE_ERR; /* Missing expression */
if (*p->pos == BEG_OF_EXPR) {
(p->pos)++;
bracketed = 1;
}
r = EvalExpr(&(p->pos), v);
r = EvalExpr(&(p->pos), v, p);
if (r) return r;
if (bracketed) {
if (*p->pos != END_OF_EXPR) return E_MISS_END;
@@ -567,6 +639,7 @@ void CreateParser(char const *s, ParsePtr p)
p->allownested = 1;
p->tokenPushed = NULL;
p->expr_happened = 0;
p->nonconst_expr = 0;
DBufInit(&p->pushedToken);
}
@@ -661,7 +734,7 @@ int DoIf(ParsePtr p)
int r;
unsigned syndrome;
if (NumIfs >= IF_NEST) return E_NESTED_IF;
if ((size_t) NumIfs >= IF_NEST) return E_NESTED_IF;
if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE;
else {
@@ -670,10 +743,15 @@ int DoIf(ParsePtr p)
Eprint("%s", ErrMsg[r]);
} else
if ( (v.type != STR_TYPE && v.v.val) ||
(v.type == STR_TYPE && strcmp(v.v.str, "")) )
(v.type == STR_TYPE && strcmp(v.v.str, "")) ) {
syndrome = IF_TRUE | BEFORE_ELSE;
else
} else {
syndrome = IF_FALSE | BEFORE_ELSE;
if (PurgeMode) {
PurgeEchoLine("%s\n", "#!P: The next IF evaluated false...");
PurgeEchoLine("%s\n", "#!P: REM statements in IF block not checked for purging.");
}
}
}
NumIfs++;
@@ -693,6 +771,8 @@ int DoElse(ParsePtr p)
{
unsigned syndrome;
int was_ignoring = ShouldIgnoreLine();
if (!NumIfs) return E_ELSE_NO_IF;
syndrome = IfFlags >> (2 * NumIfs - 2);
@@ -700,6 +780,10 @@ int DoElse(ParsePtr p)
if ((syndrome & IF_ELSE_MASK) == AFTER_ELSE) return E_ELSE_NO_IF;
IfFlags |= AFTER_ELSE << (2 * NumIfs - 2);
if (PurgeMode && ShouldIgnoreLine() && !was_ignoring) {
PurgeEchoLine("%s\n", "#!P: The previous IF evaluated true.");
PurgeEchoLine("%s\n", "#!P: REM statements in ELSE block not checked for purging");
}
return VerifyEoln(p);
}
@@ -731,19 +815,32 @@ int DoIfTrig(ParsePtr p)
int jul;
if (NumIfs >= IF_NEST) return E_NESTED_IF;
if ((size_t) NumIfs >= IF_NEST) return E_NESTED_IF;
if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE;
else {
if ( (r=ParseRem(p, &trig, &tim, 1)) ) return r;
if (trig.typ != NO_TYPE) return E_PARSE_ERR;
jul = ComputeTrigger(trig.scanfrom, &trig, &r, 1);
if (r) syndrome = IF_TRUE | BEFORE_ELSE;
else {
if (ShouldTriggerReminder(&trig, &tim, jul, &err))
syndrome = IF_TRUE | BEFORE_ELSE;
else
syndrome = IF_FALSE | BEFORE_ELSE;
jul = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 1);
if (r) {
if (r != E_CANT_TRIG || !trig.maybe_uncomputable) {
if (!Hush || r != E_RUN_DISABLED) {
Eprint("%s", ErrMsg[r]);
}
}
syndrome = IF_TRUE | BEFORE_ELSE;
}
else {
if (ShouldTriggerReminder(&trig, &tim, jul, &err)) {
syndrome = IF_TRUE | BEFORE_ELSE;
} else {
syndrome = IF_FALSE | BEFORE_ELSE;
if (PurgeMode) {
PurgeEchoLine("%s\n", "#!P: The next IFTRIG did not trigger.");
PurgeEchoLine("%s\n", "#!P: REM statements in IFTRIG block not checked for purging.");
}
}
}
FreeTrig(&trig);
}
NumIfs++;
IfFlags &= ~(IF_MASK << (2*NumIfs - 2));
@@ -889,7 +986,7 @@ int DoBanner(ParsePtr p)
DBufInit(&buf);
c = ParseChar(p, &err, 0);
if (err) return err;
while (isspace(c)) {
while (isempty(c)) {
c = ParseChar(p, &err, 0);
if (err) return err;
}
@@ -969,6 +1066,8 @@ void DoExit(ParsePtr p)
int r;
Value v;
if (PurgeMode) return;
r = EvaluateExpr(p, &v);
if (r || v.type != INT_TYPE) exit(99);
exit(v.v.val);
@@ -990,6 +1089,8 @@ int DoErrMsg(ParsePtr p)
DynamicBuffer buf;
if (PurgeMode) return OK;
DBufInit(&buf);
t.typ = MSG_TYPE;
tt.ttime = SystemTime(0) / 60;
@@ -997,7 +1098,7 @@ int DoErrMsg(ParsePtr p)
return r;
}
s = DBufValue(&buf);
while (isspace(*s)) s++;
while (isempty(*s)) s++;
fprintf(ErrFp, "%s\n", s);
DBufFree(&buf);
return OK;
@@ -1229,7 +1330,87 @@ void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime)
void SigIntHandler(int d)
{
UNUSED(d);
signal(SIGINT, SigIntHandler);
GotSigInt();
exit(0);
}
void
AppendTag(DynamicBuffer *buf, char const *s)
{
if (*(DBufValue(buf))) {
DBufPutc(buf, ',');
}
DBufPuts(buf, s);
}
void
FreeTrig(Trigger *t)
{
DBufFree(&(t->tags));
}
void
ClearLastTriggers(void)
{
LastTrigger.expired = 0;
LastTrigger.wd = NO_WD;
LastTrigger.d = NO_DAY;
LastTrigger.m = NO_MON;
LastTrigger.y = NO_YR;
LastTrigger.back = NO_BACK;
LastTrigger.delta = NO_DELTA;
LastTrigger.rep = NO_REP;
LastTrigger.localomit = NO_WD;
LastTrigger.skip = NO_SKIP;
LastTrigger.until = NO_UNTIL;
LastTrigger.typ = NO_TYPE;
LastTrigger.once = NO_ONCE;
LastTrigger.scanfrom = NO_DATE;
LastTrigger.from = NO_DATE;
LastTrigger.priority = DefaultPrio;
LastTrigger.sched[0] = 0;
LastTrigger.warn[0] = 0;
LastTrigger.omitfunc[0] = 0;
LastTrigger.passthru[0] = 0;
LastTimeTrig.ttime = NO_TIME;
LastTimeTrig.delta = NO_DELTA;
LastTimeTrig.rep = NO_REP;
LastTimeTrig.duration = NO_TIME;
}
void
SaveAllTriggerInfo(Trigger const *t, TimeTrig const *tt, int trigdate, int trigtime, int valid)
{
SaveLastTrigger(t);
SaveLastTimeTrig(tt);
LastTriggerDate = trigdate;
LastTriggerTime = trigtime;
LastTrigValid = valid;
}
void
SaveLastTrigger(Trigger const *t)
{
memcpy(&LastTrigger, t, sizeof(LastTrigger));
DBufInit(&(LastTrigger.tags));
}
void
SaveLastTimeTrig(TimeTrig const *t)
{
memcpy(&LastTimeTrig, t, sizeof(LastTimeTrig));
}
/* Wrapper to ignore warnings about ignoring return value of system() */
void
System(char const *cmd)
{
int r;
r = system(cmd);
if (r == 0) {
r = 1;
}
}

View File

@@ -141,7 +141,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
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 */
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
#ifndef ASM_MD5

View File

@@ -5,8 +5,7 @@
/* Calculations for figuring out moon phases. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/

View File

@@ -6,8 +6,7 @@
/* the data structures for OMITted dates. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -125,7 +124,7 @@ int PushOmitContext(ParsePtr p)
free(context);
return E_NO_MEM;
}
/* Copy the context over */
for (i=0; i<NumFullOmits; i++)
*(context->fullsave + i) = FullOmitArray[i];
@@ -198,7 +197,7 @@ int IsOmitted(int jul, int localomit, char const *omitfunc, int *omit)
sprintf(expr, "%s('%04d-%02d-%02d')",
omitfunc, y, m+1, d);
s = expr;
r = EvalExpr(&s, &v);
r = EvalExpr(&s, &v, NULL);
if (r) return r;
if (v.type == INT_TYPE && v.v.val != 0) {
*omit = 1;
@@ -272,6 +271,9 @@ static void InsertIntoSortedArray(int *array, int num, int key)
*cur = key;
}
static int DoThroughOmit(ParsePtr p, int y, int m, int d);
static void DumpOmits(void);
/***************************************************************/
/* */
/* DoOmit */
@@ -285,15 +287,25 @@ int DoOmit(ParsePtr p)
Token tok;
int parsing=1;
int syndrome;
int not_first_token = -1;
DynamicBuffer buf;
DBufInit(&buf);
/* Parse the OMIT. We need a month and day; year is optional. */
while(parsing) {
not_first_token++;
if ( (r=ParseToken(p, &buf)) ) return r;
FindToken(DBufValue(&buf), &tok);
switch (tok.type) {
case T_Dumpvars:
if (not_first_token) return E_PARSE_ERR;
DBufFree(&buf);
r = VerifyEoln(p);
if (r != OK) return r;
DumpOmits();
return OK;
case T_Date:
DBufFree(&buf);
if (y != NO_YR) return E_YR_TWICE;
@@ -324,6 +336,11 @@ int DoOmit(ParsePtr p)
DBufFree(&buf);
break;
case T_Through:
DBufFree(&buf);
if (y == NO_YR || m == NO_MON || d == NO_DAY) return E_INCOMPLETE;
return DoThroughOmit(p, y, m, d);
case T_Empty:
case T_Comment:
case T_RemType:
@@ -362,7 +379,124 @@ int DoOmit(ParsePtr p)
NumFullOmits++;
}
}
if (tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
}
static int
DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
{
int yend = NO_YR, mend = NO_MON, dend = NO_DAY, r;
int start, end, tmp;
int parsing = 1;
Token tok;
DynamicBuffer buf;
DBufInit(&buf);
while(parsing) {
if ( (r=ParseToken(p, &buf)) ) return r;
FindToken(DBufValue(&buf), &tok);
switch(tok.type) {
case T_Date:
DBufFree(&buf);
if (yend != NO_YR) return E_YR_TWICE;
if (mend != NO_MON) return E_MON_TWICE;
if (dend != NO_DAY) return E_DAY_TWICE;
FromJulian(tok.val, &yend, &mend, &dend);
break;
case T_Year:
DBufFree(&buf);
if (yend != NO_YR) return E_YR_TWICE;
yend = tok.val;
break;
case T_Month:
DBufFree(&buf);
if (mend != NO_MON) return E_MON_TWICE;
mend = tok.val;
break;
case T_Day:
DBufFree(&buf);
if (dend != NO_DAY) return E_DAY_TWICE;
dend = tok.val;
break;
case T_Empty:
case T_Comment:
case T_RemType:
case T_Priority:
case T_Tag:
case T_Duration:
DBufFree(&buf);
parsing = 0;
break;
default:
Eprint("%s: `%s' (OMIT)", ErrMsg[E_UNKNOWN_TOKEN],
DBufValue(&buf));
DBufFree(&buf);
return E_UNKNOWN_TOKEN;
}
}
if (yend == NO_YR || mend == NO_MON || dend == NO_DAY) return E_INCOMPLETE;
if (dend > DaysInMonth(mend, yend)) return E_BAD_DATE;
if (dstart > DaysInMonth(mstart, ystart)) return E_BAD_DATE;
start = Julian(ystart, mstart, dstart);
end = Julian(yend, mend, dend);
if (end < start) {
Eprint("Warning: Swapping dates on OMIT ... THROUGH ... line");
tmp = start;
start = end;
end = tmp;
}
tmp = end - start + 1;
/* Don't create any OMITs if there would be too many. */
if (NumFullOmits + tmp >= MAX_FULL_OMITS) return E_2MANY_FULL;
for (tmp = start; tmp <= end; tmp++) {
if (!BexistsIntArray(FullOmitArray, NumFullOmits, tmp)) {
InsertIntoSortedArray(FullOmitArray, NumFullOmits, tmp);
NumFullOmits++;
}
}
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
}
void
DumpOmits(void)
{
int i;
int y, m, d;
printf("Global Full OMITs (%d of maximum allowed %d):\n", NumFullOmits, MAX_FULL_OMITS);
if (!NumFullOmits) {
printf("\tNone.\n");
} else {
for (i=0; i<NumFullOmits; i++) {
FromJulian(FullOmitArray[i], &y, &m, &d);
printf("\t%04d%c%02d%c%02d\n",
y, DateSep, m+1, DateSep, d);
}
}
printf("Global Partial OMITs (%d of maximum allowed %d):\n", NumPartialOmits, MAX_PARTIAL_OMITS);
if (!NumPartialOmits) {
printf("\tNone.\n");
} else {
for (i=0; i<NumPartialOmits; i++) {
m = PartialOmitArray[i] >> 5 & 0xf;
d = PartialOmitArray[i] & 0x1f;
printf("\t%02d%c%02d\n", m+1, DateSep, d);
}
}
}

View File

@@ -5,20 +5,25 @@
/* Function Prototypes. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
/* Suppress unused variable warnings */
#define UNUSED(x) (void) x
/* 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) (malloc(sizeof(type)))
/* Characters to ignore */
#define isempty(c) (isspace(c) || ((c) == '\\'))
#include "dynbuf.h"
int CallUserFunc (char const *name, int nargs);
int CallUserFunc (char const *name, int nargs, ParsePtr p);
int DoFset (ParsePtr p);
void ProduceCalendar (void);
char const *SimpleTime (int tim);
@@ -32,13 +37,15 @@ 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 ParseLiteralDate (char const **s, int *jul, int *tim);
int EvalExpr (char const **e, Value *v);
int ParseLiteralTime (char const **s, int *tim);
int EvalExpr (char const **e, Value *v, ParsePtr p);
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 DoIncludeCmd (ParsePtr p);
int IncludeFile (char const *fname);
int GetAccessDate (char const *file);
int SetAccessDate (char const *fname, int jul);
@@ -52,7 +59,7 @@ 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 Evaluate (char const **s, Var *locals, ParsePtr p);
int FnPopValStack (Value *val);
void Eprint (char const *fmt, ...);
void OutputLine (FILE *fp);
@@ -83,7 +90,10 @@ 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);
int ComputeTrigger (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals);
int ComputeTriggerNoAdjustDuration (int today, Trigger *trig, TimeTrig *tim, int *err, int save_in_globals, int duration_days);
int AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int save_in_globals);
int ComputeScanStart(int today, Trigger *trig, TimeTrig *tt);
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);
@@ -92,7 +102,7 @@ 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 GetVarValue (char const *str, Value *val, Var *locals, ParsePtr p);
int DoSet (Parser *p);
int DoUnset (Parser *p);
int DoDump (ParsePtr p);
@@ -100,7 +110,7 @@ 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 DoSatRemind (Trigger *trig, TimeTrig *tt, ParsePtr p);
int DoMsgCommand (char const *cmd, char const *msg);
int ParseNonSpaceChar (ParsePtr p, int *err, int peek);
unsigned int HashVal (char const *str);
@@ -133,4 +143,23 @@ 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 *);
void PurgeEchoLine(char const *fmt, ...);
void FreeTrig(Trigger *t);
void AppendTag(DynamicBuffer *buf, char const *s);
char const *SynthesizeTag(void);
void ClearLastTriggers(void);
void SaveLastTrigger(Trigger const *t);
void SaveLastTimeTrig(TimeTrig const *t);
void SaveAllTriggerInfo(Trigger const *t, TimeTrig const *tt, int trigdate, int trigtime, int valid);
void PerIterationInit(void);
char const *Decolorize(int r, int g, int b);
char const *Colorize(int r, int g, int b);
void PrintJSONString(char const *s);
void PrintJSONKeyPairInt(char const *name, int val);
void PrintJSONKeyPairString(char const *name, char const *val);
void PrintJSONKeyPairDate(char const *name, int jul);
void PrintJSONKeyPairDateTime(char const *name, int dt);
void PrintJSONKeyPairTime(char const *name, int t);
void System(char const *cmd);
int ShellEscape(char const *in, DynamicBuffer *out);

View File

@@ -5,8 +5,7 @@
/* Queue up reminders for subsequent execution. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -28,9 +27,9 @@
#include <stdlib.h>
#include <unistd.h>
#include "types.h"
#include "globals.h"
#include "err.h"
#include "types.h"
#include "protos.h"
#include "expr.h"
@@ -43,7 +42,8 @@ typedef struct queuedrem {
char const *text;
char passthru[PASSTHRU_LEN+1];
char sched[VAR_NAME_LEN+1];
char tag[TAG_LEN+1];
DynamicBuffer tags;
Trigger t;
TimeTrig tt;
} QueuedRem;
@@ -92,13 +92,16 @@ int QueueReminder(ParsePtr p, Trigger *trig,
qelem->typ = trig->typ;
strcpy(qelem->passthru, trig->passthru);
qelem->tt = *tim;
qelem->t = *trig;
DBufInit(&(qelem->t.tags));
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);
DBufInit(&(qelem->tags));
DBufPuts(&(qelem->tags), DBufValue(&(trig->tags)));
if (SynthesizeTags) {
AppendTag(&(qelem->tags), SynthesizeTag());
}
QueueHead = qelem;
return OK;
@@ -151,7 +154,7 @@ void HandleQueuedReminders(void)
/* Initialize the queue - initialize all the entries time of issue */
while (q) {
q->tt.nexttime = (int) (SystemTime(0)/60 - 1);
q->tt.nexttime = (int) (SystemTime(1)/60 - 1);
q->tt.nexttime = CalculateNextTime(q);
q = q->next;
}
@@ -168,25 +171,24 @@ void HandleQueuedReminders(void)
if (Daemon && !q) {
if (Daemon < 0) {
/* Sleep until midnight */
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(1);
} else {
TimeToSleep = 60*Daemon;
}
} else {
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
TimeToSleep = q->tt.nexttime * 60L - SystemTime(1);
}
while (TimeToSleep > 0L) {
SleepTime = TimeToSleep;
if (Daemon > 0 && SleepTime > 60*Daemon) SleepTime = 60*Daemon;
if (Daemon > 0 && SleepTime > (unsigned int) 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;
}
/* Wake up on the next exact minute */
SleepTime = 60 - (SystemTime(1)%60);
}
if (Daemon >= 0) {
@@ -209,12 +211,12 @@ void HandleQueuedReminders(void)
if (Daemon && !q) {
if (Daemon < 0) {
/* Sleep until midnight */
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(0);
TimeToSleep = MINUTES_PER_DAY*60 - SystemTime(1);
} else {
TimeToSleep = 60*Daemon;
}
} else {
TimeToSleep = q->tt.nexttime * 60L - SystemTime(0);
TimeToSleep = q->tt.nexttime * 60L - SystemTime(1);
}
}
@@ -224,7 +226,7 @@ void HandleQueuedReminders(void)
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) ||
if ((SystemTime(1) - (q->tt.nexttime * 60) <= 60) ||
(q->tt.nexttime == q->tt.ttime)) {
/* Trigger the reminder */
CreateParser(q->text, &p);
@@ -234,20 +236,17 @@ void HandleQueuedReminders(void)
if (Daemon < 0) {
printf("NOTE reminder %s",
SimpleTime(q->tt.ttime));
printf("%s", SimpleTime(SystemTime(0)/60));
if (!*q->tag) {
printf("*");
printf("%s", SimpleTime(SystemTime(1)/60));
if (!*DBufValue(&q->tags)) {
printf("*\n");
} else {
printf("%s", q->tag);
printf("%s\n", DBufValue(&(q->tags)));
}
printf("\n");
}
/* Set up global variables so some functions like trigdate()
and trigtime() work correctly */
LastTriggerDate = JulianToday;
LastTriggerTime = q->tt.ttime;
LastTrigValid = 1;
SaveAllTriggerInfo(&(q->t), &(q->tt), JulianToday, q->tt.ttime, 1);
(void) TriggerReminder(&p, &trig, &q->tt, JulianToday);
if (Daemon < 0) {
printf("NOTE endreminder\n");
@@ -411,7 +410,7 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
char exprBuf[VAR_NAME_LEN+32];
sprintf(exprBuf, "%s(%d)", q->sched, q->ntrig);
s = exprBuf;
r = EvalExpr(&s, &v);
r = EvalExpr(&s, &v, NULL);
if (r) {
q->sched[0] = 0;
return NO_TIME;
@@ -420,7 +419,11 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
ThisTime = v.v.val;
} else if (v.type == INT_TYPE) {
if (v.v.val > 0)
ThisTime = q->tt.nexttime + v.v.val;
if (LastTime >= 0) {
ThisTime = LastTime + v.v.val;
} else {
ThisTime = q->tt.nexttime + v.v.val;
}
else
ThisTime = q->tt.ttime + v.v.val;
@@ -431,6 +434,10 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
}
if (ThisTime < 0) ThisTime = 0; /* Can't be less than 00:00 */
if (ThisTime > (MINUTES_PER_DAY-1)) ThisTime = (MINUTES_PER_DAY-1); /* or greater than 11:59 */
if (DebugFlag & DB_PRTEXPR) {
fprintf(ErrFp, "SCHED: Considering %02d%c%02d\n",
ThisTime / 60, TimeSep, ThisTime % 60);
}
if (ThisTime > q->tt.nexttime) return ThisTime;
if (ThisTime <= LastTime) {
q->sched[0] = 0;
@@ -441,6 +448,70 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
}
}
/* Dump the queue in JSON format */
static void
json_queue(QueuedRem const *q)
{
int done = 0;
printf("[");
while(q) {
if (q->tt.nexttime == NO_TIME) {
q = q->next;
continue;
}
if (done) {
printf(",");
}
done = 1;
printf("{");
switch(q->typ) {
case NO_TYPE: PrintJSONKeyPairString("type", "NO_TYPE"); break;
case MSG_TYPE: PrintJSONKeyPairString("type", "MSG_TYPE"); break;
case RUN_TYPE: PrintJSONKeyPairString("type", "RUN_TYPE"); break;
case CAL_TYPE: PrintJSONKeyPairString("type", "CAL_TYPE"); break;
case SAT_TYPE: PrintJSONKeyPairString("type", "SAT_TYPE"); break;
case PS_TYPE: PrintJSONKeyPairString("type", "PS_TYPE"); break;
case PSF_TYPE: PrintJSONKeyPairString("type", "PSF_TYPE"); break;
case MSF_TYPE: PrintJSONKeyPairString("type", "MSF_TYPE"); break;
case PASSTHRU_TYPE: PrintJSONKeyPairString("type", "PASSTHRU_TYPE"); break;
default: PrintJSONKeyPairString("type", "?"); break;
}
PrintJSONKeyPairInt("rundisabled", q->RunDisabled);
PrintJSONKeyPairInt("ntrig", q->ntrig);
PrintJSONKeyPairTime("ttime", q->tt.ttime);
PrintJSONKeyPairTime("nextttime", q->tt.nexttime);
PrintJSONKeyPairInt("delta", q->tt.delta);
if (q->tt.rep != NO_TIME) {
PrintJSONKeyPairInt("rep", q->tt.rep);
}
if (q->tt.duration != NO_TIME) {
PrintJSONKeyPairInt("duration", q->tt.duration);
}
if (q->passthru[0]) {
PrintJSONKeyPairString("passthru", q->passthru);
}
if (q->sched[0]) {
PrintJSONKeyPairString("sched", q->sched);
}
if (DBufLen(&(q->tags))) {
PrintJSONKeyPairString("tags", DBufValue(&(q->tags)));
}
/* Last one is a special case - no trailing comma */
printf("\"");
PrintJSONString("body");
printf("\":\"");
if (q->text) {
PrintJSONString(q->text);
} else {
PrintJSONString("");
}
printf("\"}");
q = q->next;
}
printf("]\n");
}
/***************************************************************/
/* */
/* DaemonWait */
@@ -498,6 +569,38 @@ static void DaemonWait(unsigned int sleeptime)
}
printf("NOTE queued %d\n", nqueued);
fflush(stdout);
} else if (!strcmp(cmdLine, "QUEUE\n")) {
printf("NOTE queue\n");
QueuedRem *q = QueueHead;
while (q) {
if (q->tt.nexttime != NO_TIME) {
switch (q->typ) {
case NO_TYPE: printf("NO_TYPE "); break;
case MSG_TYPE: printf("MSG_TYPE "); break;
case RUN_TYPE: printf("RUN_TYPE "); break;
case CAL_TYPE: printf("CAL_TYPE "); break;
case SAT_TYPE: printf("SAT_TYPE "); break;
case PS_TYPE: printf("PS_TYPE "); break;
case PSF_TYPE: printf("PSF_TYPE "); break;
case MSF_TYPE: printf("MSF_TYPE "); break;
case PASSTHRU_TYPE: printf("PASSTHRU_TYPE "); break;
default: printf("? "); break;
}
printf("RunDisabled=%d ntrig=%d ttime=%02d:%02d nexttime=%02d:%02d delta=%d rep=%d duration=%d ", q->RunDisabled, q->ntrig, q->tt.ttime/60, q->tt.ttime % 60, q->tt.nexttime / 60, q->tt.nexttime % 60, q->tt.delta, (q->tt.rep != NO_TIME ? q->tt.rep : -1), (q->tt.duration != NO_TIME ? q->tt.duration : -1));
printf("%s %s %s\n",
(q->passthru[0] ? q->passthru : "*"),
(q->sched[0] ? q->sched : "*"),
q->text ? q->text : "NULL");
}
q = q->next;
}
printf("NOTE endqueue\n");
fflush(stdout);
} else if (!strcmp(cmdLine, "JSONQUEUE\n")) {
printf("NOTE JSONQUEUE\n");
json_queue(QueueHead);
printf("NOTE ENDJSONQUEUE\n");
fflush(stdout);
} else if (!strcmp(cmdLine, "REREAD\n")) {
printf("NOTE reread\n");
fflush(stdout);

View File

@@ -5,8 +5,7 @@
/* Print a PostScript calendar. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -21,6 +20,7 @@
#include <unistd.h>
#include <stdlib.h>
#include "rem2ps.h"
#include "json.h"
#define NEW(type) (malloc(sizeof(type)))
@@ -28,14 +28,27 @@
#define SPECIAL_POSTSCRIPT 1
#define SPECIAL_PSFILE 2
#define SPECIAL_MOON 3
#define SPECIAL_SHADE 4
#define SPECIAL_COLOR 5
#define SPECIAL_WEEK 6
#define SPECIAL_COLOR 4
#define SPECIAL_WEEK 5
#define SPECIAL_SHADE 6
#define SPECIAL_UNKNOWN 7
/* Array holding how specials sort */
static int SpecialSortOrder[] = {
0, /* NORMAL */
1, /* POSTSCRIPT */
1, /* PSFILE */
2, /* MOON */
0, /* COLOR */
4, /* WEEK */
5 /* SHADE */
};
typedef struct calentry {
struct calentry *next;
int special;
char *entry;
int daynum;
} CalEntry;
typedef struct {
@@ -52,7 +65,7 @@ char const *SmallCalLoc[] = {
"sbt",
};
#define NUMSMALL (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0]))
#define NUMSMALL ((int) (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0])))
char const *SmallLocation;
int SmallCol1, SmallCol2;
@@ -86,6 +99,7 @@ CalEntry *CurEntries = NULL;
CalEntry *PsEntries[32];
PageType *CurPage;
char PortraitMode;
char DaynumRight;
char NoSmallCal;
char UseISO;
@@ -127,6 +141,184 @@ void WriteOneEntry (CalEntry *c);
void GetSmallLocations (void);
char const *EatToken(char const *in, char *out, int maxlen);
static void
put_escaped_string(char const *s)
{
while(*s) {
if (*s == '\\' || *s == '(' || *s == ')') {
PutChar('\\');
}
PutChar(*s);
s++;
}
}
/***************************************************************/
/* */
/* StrCmpi */
/* */
/* Compare strings, case insensitive. */
/* */
/***************************************************************/
int StrCmpi(char const *s1, char const *s2)
{
int r;
while (*s1 && *s2) {
r = toupper(*s1) - toupper(*s2);
if (r) return r;
s1++;
s2++;
}
return toupper(*s1) - toupper(*s2);
}
/***************************************************************/
/* */
/* Parse the new-style JSON intermediate format */
/* */
/***************************************************************/
static CalEntry *
JSONToCalEntry(DynamicBuffer *buf)
{
CalEntry *c;
json_value *val;
val = json_parse(DBufValue(buf), DBufLen(buf));
if (!val) {
fprintf(stderr, "Unable to parse JSON line `%s'\n", DBufValue(buf));
exit(1);
}
if (val->type != json_object) {
fprintf(stderr, "Expecting JSON object; found `%s'\n",
DBufValue(buf));
exit(1);
}
c = NEW(CalEntry);
if (!c) {
fprintf(stderr, "malloc failed - aborting.\n");
exit(1);
}
c->next = NULL;
c->special = SPECIAL_NORMAL;
int got_date = 0, got_body = 0;
size_t i;
for (i=0; i<val->u.object.length; i++) {
char const *nm = val->u.object.values[i].name;
json_value *v = val->u.object.values[i].value;
char const *s;
if (!strcmp(nm, "date")) {
if (v->type == json_string) {
s = v->u.string.ptr;
c->daynum = (s[8] - '0') * 10 + s[9] - '0';
got_date = 1;
}
} else if (!strcmp(nm, "body")) {
if (v->type == json_string) {
s = v->u.string.ptr;
c->entry = malloc(strlen(s)+1);
if (!c->entry) {
fprintf(stderr, "malloc failed - aborting.\n");
exit(1);
}
strcpy(c->entry, s);
got_body = 1;
}
} else if (!strcmp(nm, "passthru")) {
if (v->type == json_string) {
s = v->u.string.ptr;
if (!StrCmpi(s, "PostScript")) {
c->special = SPECIAL_POSTSCRIPT;
} else if (!StrCmpi(s, "SHADE")) {
c->special = SPECIAL_SHADE;
} else if (!StrCmpi(s, "MOON")) {
c->special = SPECIAL_MOON;
} else if (!StrCmpi(s, "WEEK")) {
c->special = SPECIAL_WEEK;
} else if (!StrCmpi(s, "PSFile")) {
c->special = SPECIAL_PSFILE;
} else if (!StrCmpi(s, "COLOUR") ||
!StrCmpi(s, "COLOR")) {
c->special = SPECIAL_COLOR;
} else {
c->special = SPECIAL_UNKNOWN;
}
}
}
}
json_value_free(val);
if (!got_body || !got_date) {
fprintf(stderr, "Could not parse line `%s'\n", DBufValue(buf));
exit(1);
}
return c;
}
/***************************************************************/
/* */
/* Parse the old-style REM2PS intermediate format */
/* */
/***************************************************************/
static CalEntry *
TextToCalEntry(DynamicBuffer *buf)
{
char const *startOfBody;
char passthru[PASSTHRU_LEN+1];
CalEntry *c = NEW(CalEntry);
if (!c) {
fprintf(stderr, "malloc failed - aborting.\n");
exit(1);
}
c->next = NULL;
c->special = SPECIAL_NORMAL;
c->daynum = (DBufValue(buf)[8] - '0') * 10 + DBufValue(buf)[9] - '0';
/* Skip the tag, duration and time */
startOfBody = DBufValue(buf)+10;
/* Eat the passthru */
startOfBody = EatToken(startOfBody, passthru, PASSTHRU_LEN);
/* Eat the tag */
startOfBody = EatToken(startOfBody, NULL, 0);
/* Eat the duration */
startOfBody = EatToken(startOfBody, NULL, 0);
/* Eat the time */
startOfBody = EatToken(startOfBody, NULL, 0);
c->entry = malloc(strlen(startOfBody) + 1);
if (!c->entry) {
fprintf(stderr, "malloc failed - aborting.\n");
exit(1);
}
strcpy(c->entry, startOfBody);
/* Save the type of SPECIAL */
if (!StrCmpi(passthru, "PostScript")) {
c->special = SPECIAL_POSTSCRIPT;
} else if (!StrCmpi(passthru, "SHADE")) {
c->special = SPECIAL_SHADE;
} else if (!StrCmpi(passthru, "MOON")) {
c->special = SPECIAL_MOON;
} else if (!StrCmpi(passthru, "WEEK")) {
c->special = SPECIAL_WEEK;
} else if (!StrCmpi(passthru, "PSFile")) {
c->special = SPECIAL_PSFILE;
} else if (!StrCmpi(passthru, "COLOUR") ||
!StrCmpi(passthru, "COLOR")) {
c->special = SPECIAL_COLOR;
} else if (StrCmpi(passthru, "*")) {
c->special = SPECIAL_UNKNOWN;
}
return c;
}
/***************************************************************/
/* */
/* MAIN PROGRAM */
@@ -144,13 +336,20 @@ int main(int argc, char *argv[])
Usage("Input should not come from a terminal");
}
int first_line = 1;
/* Search for a valid input file */
while (!feof(stdin)) {
DBufGets(&buf, stdin);
if (!strcmp(DBufValue(&buf), PSBEGIN)) {
if (first_line && (!strcmp(DBufValue(&buf), "["))) {
fprintf(stderr, "Rem2PS: It appears that you have invoked Remind with the -ppp option.\n Please use either -p or -pp, but not -ppp.\n");
exit(1);
}
first_line = 0;
if (!strcmp(DBufValue(&buf), PSBEGIN) ||
!strcmp(DBufValue(&buf), PSBEGIN2)) {
if (!validfile) {
if (Verbose) {
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-1998 by David F. Skoll\n\n", VERSION);
fprintf(stderr, "Rem2PS: Version %s Copyright 1992-2021 by Dianne Skoll\n\n", VERSION);
fprintf(stderr, "Generating PostScript calendar\n");
}
}
@@ -181,12 +380,9 @@ void DoPsCal(void)
int days, wkday, prevdays, nextdays;
int sfirst;
int i;
int is_ps;
int firstcol;
char const *startOfBody;
char passthru[PASSTHRU_LEN+1];
DynamicBuffer buf;
CalEntry *c, *d;
CalEntry *c, *d, *p;
/* Read the month and year name, followed by # days in month and 1st day of
month */
@@ -220,6 +416,7 @@ void DoPsCal(void)
printf("%%%%Page: %c%c%c%c%c %d\n", month[0], month[1], month[2],
year[2], year[3], validfile);
printf("%%%%PageBoundingBox: 0 0 %d %d\n", CurPage->xsize, CurPage->ysize);
/* Emit PostScript to do the heading */
if (!PortraitMode) printf("90 rotate 0 XSIZE neg translate\n");
@@ -262,85 +459,67 @@ void DoPsCal(void)
}
DBufGets(&buf, stdin);
if (!strcmp(DBufValue(&buf), PSEND)) {
if (!strcmp(DBufValue(&buf), PSEND) ||
!strcmp(DBufValue(&buf), PSEND2)) {
DBufFree(&buf);
break;
}
/* Ignore lines beginning with '#' */
if (DBufValue(&buf)[0] == '#') {
DBufFree(&buf);
continue;
}
/* Read the day number - a bit of a hack! */
DayNum = (DBufValue(&buf)[8] - '0') * 10 + DBufValue(&buf)[9] - '0';
if (DayNum != CurDay) {
for(; CurDay<DayNum; CurDay++) {
if (DBufValue(&buf)[0] == '{') {
/* Starts with '{', so assume new-style JSON format */
c = JSONToCalEntry(&buf);
} else {
/* Assume it's the old-style rem2ps intermediate format */
c = TextToCalEntry(&buf);
}
/* If it's an unknown special, ignore */
if (c->special == SPECIAL_UNKNOWN) {
DBufFree(&buf);
free(c);
c = NULL;
continue;
}
if (c->daynum != CurDay) {
for(; CurDay<c->daynum; CurDay++) {
WriteCalEntry();
WkDayNum = (WkDayNum + 1) % 7;
}
}
/* Add the text */
c = NEW(CalEntry);
if (!c) {
fprintf(stderr, "malloc failed - aborting.\n");
exit(1);
}
c->next = NULL;
c->special = SPECIAL_NORMAL;
/* Skip the tag, duration and time */
startOfBody = DBufValue(&buf)+10;
/* Eat the passthru */
startOfBody = EatToken(startOfBody, passthru, PASSTHRU_LEN);
/* Eat the tag */
startOfBody = EatToken(startOfBody, NULL, 0);
/* Eat the duration */
startOfBody = EatToken(startOfBody, NULL, 0);
/* Eat the time */
startOfBody = EatToken(startOfBody, NULL, 0);
is_ps = 0;
if (!strcmp(passthru, "PostScript") ||
!strcmp(passthru, "PSFile") ||
!strcmp(passthru, "MOON") ||
!strcmp(passthru, "WEEK") ||
!strcmp(passthru, "SHADE")) {
is_ps = 1;
}
c->entry = malloc(strlen(startOfBody) + 1);
if (!c->entry) {
fprintf(stderr, "malloc failed - aborting.\n");
exit(1);
}
strcpy(c->entry, startOfBody);
if (is_ps) {
/* Save the type of SPECIAL */
if (!strcmp(passthru, "PostScript")) {
c->special = SPECIAL_POSTSCRIPT;
} else if (!strcmp(passthru, "SHADE")) {
c->special = SPECIAL_SHADE;
} else if (!strcmp(passthru, "MOON")) {
c->special = SPECIAL_MOON;
} else if (!strcmp(passthru, "WEEK")) {
c->special = SPECIAL_WEEK;
if (c->special == SPECIAL_POSTSCRIPT ||
c->special == SPECIAL_SHADE ||
c->special == SPECIAL_MOON ||
c->special == SPECIAL_WEEK ||
c->special == SPECIAL_PSFILE) {
if (!PsEntries[c->daynum]) {
PsEntries[c->daynum] = c;
} else {
c->special = SPECIAL_PSFILE;
d = PsEntries[c->daynum];
p = NULL;
/* Slot it into the right place */
while (d->next && (SpecialSortOrder[c->special] <= SpecialSortOrder[d->special])) {
p = d;
d = d->next;
}
if (SpecialSortOrder[c->special] <= SpecialSortOrder[d->special]) {
c->next = d->next;
d->next = c;
} else {
if (p) {
p->next = c;
} else {
PsEntries[c->daynum] = c;
}
c->next = d;
}
}
if (!PsEntries[DayNum]) {
PsEntries[DayNum] = c;
} else {
d = PsEntries[DayNum];
while(d->next) d = d->next;
d->next = c;
}
} else if (!strcmp(passthru, "*") ||
!strcmp(passthru, "COLOR")) {
} else {
/* Put on linked list */
if (!CurEntries) {
CurEntries = c;
@@ -349,9 +528,6 @@ void DoPsCal(void)
while(d->next) d = d->next;
d->next = c;
}
if (!strcmp(passthru, "COLOR")) {
c->special = SPECIAL_COLOR;
}
}
}
for(; CurDay<=days; CurDay++) {
@@ -424,6 +600,12 @@ void WriteProlog(void)
printf("%%%%Pages: (atend)\n");
printf("%%%%Orientation: %s\n", PortraitMode ? "Portrait" : "Landscape");
printf("%%%%EndComments\n");
if (PortraitMode) {
printf("<< /PageSize [%d %d] >> setpagedevice\n", x, y);
} else {
/* They were swapped up above, so swap them back or we'll get rotated output */
printf("<< /PageSize [%d %d] >> setpagedevice\n", y, x);
}
for (i=0; PSProlog1[i]; i++) puts(PSProlog1[i]);
if (!MondayFirst)
@@ -516,7 +698,7 @@ void WriteCalEntry(void)
printf("]\n");
/* Print the day number */
printf("(%d)\n", CurDay);
printf("(%d) %d\n", CurDay, (int) DaynumRight);
/* Do it! */
printf("DoCalBox\n");
@@ -642,7 +824,8 @@ void Init(int argc, char *argv[])
char const *s;
char const *t;
int i=1;
int j;
size_t j;
int k;
int offset;
PortraitMode = 1;
@@ -655,6 +838,7 @@ void Init(int argc, char *argv[])
FillPage = 0;
MondayFirst = 0;
SmallLocation = "bt";
DaynumRight = 1;
for(j=0; j<32; j++) PsEntries[i] = NULL;
@@ -744,7 +928,7 @@ void Init(int argc, char *argv[])
case 'o':
if (i == argc) Usage("Offset must be supplied");
offset = atoi(argv[i++]);
if (offset < 36) offset = 36;
if (offset < 0) offset = 0;
if (!*s) Usage("Offset must specify l, r, t or b");
while(*s) {
switch(*s++) {
@@ -771,13 +955,14 @@ void Init(int argc, char *argv[])
case 'i': UseISO = 1; break;
case 'c': j=(*s);
if (!j) {
case 'x': DaynumRight = 0; break;
case 'c': k=(*s);
if (!k) {
SmallLocation = SmallCalLoc[0];
} else {
j -= '0';
if (j>=0 && j<NUMSMALL) {
SmallLocation = SmallCalLoc[j];
k -= '0';
if (k>=0 && k<NUMSMALL) {
SmallLocation = SmallCalLoc[k];
} else {
SmallLocation = SmallCalLoc[0];
}
@@ -815,6 +1000,7 @@ void Usage(char const *s)
fprintf(stderr, "-b size Set border size for calendar entries\n");
fprintf(stderr, "-t size Set line thickness\n");
fprintf(stderr, "-e Make calendar fill entire page\n");
fprintf(stderr, "-x Put day numbers on left instead of right\n");
fprintf(stderr, "-o[lrtb] marg Specify left, right, top and bottom margins\n");
exit(1);
}
@@ -890,10 +1076,10 @@ int DoQueuedPs(void)
FILE *fp;
int fnoff;
char buffer[512];
char const *size, *extra;
char fbuffer[512];
char const *size, *fsize, *extra;
char const *s;
int num, r, g, b, phase, fontsize, moonsize;
unsigned char c;
if (!MondayFirst) begin = CurDay - WkDayNum;
else begin = CurDay - (WkDayNum ? WkDayNum-1 : 6);
@@ -965,19 +1151,28 @@ int DoQueuedPs(void)
while(*s && isspace(*s)) {
s++;
}
while(*s) {
if (*s == '\\' || *s == '(' || *s == ')') {
PutChar('\\');
}
PutChar(*s);
s++;
}
put_escaped_string(s);
printf(") show grestore\n");
break;
case SPECIAL_MOON: /* Moon phase */
num = sscanf(e->entry+fnoff, "%d %d %d", &phase, &moonsize,
&fontsize);
/* See if we have extra stuff */
extra = e->entry+fnoff;
/* Skip phase */
while(*extra && !isspace(*extra)) extra++;
while(*extra && isspace(*extra)) extra++;
/* Skip moon size */
while(*extra && !isspace(*extra)) extra++;
while(*extra && isspace(*extra)) extra++;
/* Skip font size */
while(*extra && !isspace(*extra)) extra++;
while(*extra && isspace(*extra)) extra++;
if (num == 1) {
moonsize = -1;
fontsize = -1;
@@ -999,7 +1194,27 @@ int DoQueuedPs(void)
size = buffer;
}
printf("gsave 0 setgray newpath Border %s add BoxHeight Border sub %s sub\n", size, size);
/* Store the starting X coordinate in "moonstartx" */
if (DaynumRight) {
printf("Border %s add /moonstartx exch def", size);
} else {
printf("xincr Border sub %s sub ", size);
if (*extra) {
if (fontsize < 0) {
fsize = "EntrySize";
} else {
sprintf(fbuffer, "%d", fontsize);
fsize = fbuffer;
}
printf("/EntryFont findfont %s scalefont setfont (",
fsize);
put_escaped_string(extra);
printf(") stringwidth pop sub Border sub ");
}
printf("/moonstartx exch def\n");
}
printf(" gsave 0 setgray newpath ");
printf("moonstartx BoxHeight Border sub %s sub\n", size);
printf(" %s 0 360 arc closepath\n", size);
switch(phase) {
case 0:
@@ -1010,49 +1225,28 @@ int DoQueuedPs(void)
break;
case 1:
printf("stroke\n");
printf("newpath Border %s add BoxHeight Border sub %s sub\n",
size, size);
printf("stroke\nnewpath ");
printf("moonstartx BoxHeight Border sub %s sub\n", size);
printf("%s 90 270 arc closepath fill\n", size);
break;
default:
printf("stroke\n");
printf("newpath Border %s add BoxHeight Border sub %s sub\n",
size, size);
printf("stroke\nnewpath ");
printf("moonstartx BoxHeight Border sub %s sub\n", size);
printf("%s 270 90 arc closepath fill\n", size);
break;
}
/* See if we have extra stuff */
extra = e->entry+fnoff;
/* Skip phase */
while(*extra && !isspace(*extra)) extra++;
while(*extra && isspace(*extra)) extra++;
/* Skip moon size */
while(*extra && !isspace(*extra)) extra++;
while(*extra && isspace(*extra)) extra++;
/* Skip font size */
while(*extra && !isspace(*extra)) extra++;
while(*extra && isspace(*extra)) extra++;
/* Anything left? */
if (*extra) {
printf("Border %s add %s add Border add BoxHeight border sub %s sub %s sub moveto\n", size, size, size, size);
printf("moonstartx %s add Border add BoxHeight border sub %s sub %s sub moveto\n", size, size, size);
if (fontsize < 0) {
size = "EntrySize";
fsize = "EntrySize";
} else {
sprintf(buffer, "%d", fontsize);
size = buffer;
sprintf(fbuffer, "%d", fontsize);
fsize = fbuffer;
}
printf("/EntryFont findfont %s scalefont setfont (",
size);
while(*extra) {
c = (unsigned char) *extra++;
if (c == '\\' || c == '(' || c == ')') PutChar('\\');
PutChar(c);
}
fsize);
put_escaped_string(extra);
printf(") show\n");
}

View File

@@ -5,16 +5,15 @@
/* Define the PostScript prologue */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
char *PSProlog1[] =
{
"% This file was produced by Remind and Rem2PS, written by",
"% David F. Skoll.",
"% Remind and Rem2PS are Copyright 1992-1997 David F. Skoll.",
"% Dianne Skoll.",
"% Remind and Rem2PS are Copyright 1992-2021 Dianne Skoll.",
"/ISOLatin1Encoding where { pop save true }{ false } ifelse",
" /ISOLatin1Encoding [ StandardEncoding 0 45 getinterval aload pop /minus",
" StandardEncoding 46 98 getinterval aload pop /dotlessi /grave /acute",
@@ -197,9 +196,10 @@ char *PSProlog2[] =
"% Variables for calendar boxes:",
"% ytop - current top position",
"% ymin - minimum y reached for current row",
"% border ytop xleft width textarray daynum DoCalBox ybot",
"% border ytop xleft width textarray daynum onright DoCalBox ybot",
"% Do the entries for one calendar box. Returns lowest Y-coordinate reached",
"/DoCalBox {",
" /onright exch def",
" /daynum exch def",
" /textarr exch def",
" /wid exch def",
@@ -208,8 +208,10 @@ char *PSProlog2[] =
" /border exch def",
"% Do the day number",
" /DayFont findfont DaySize scalefont setfont",
" xl wid add border sub daynum stringwidth pop sub",
" yt border sub DaySize sub moveto daynum show",
" onright 1 eq",
" {xl wid add border sub daynum stringwidth pop sub yt border sub DaySize sub moveto daynum show}",
" {xl border add yt border sub DaySize sub moveto daynum show}",
" ifelse",
"% Do the text entries. Precharge the stack with current y pos.",
" /ycur yt border sub DaySize sub DaySize sub 2 add def",
" /EntryFont findfont EntrySize scalefont setfont",

View File

@@ -5,8 +5,7 @@
/* Routines for sorting reminders by trigger date */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -151,7 +150,7 @@ void IssueSortedReminders(void)
break;
case RUN_TYPE:
system(cur->text);
System(cur->text);
break;
}
@@ -181,7 +180,7 @@ static void IssueSortBanner(int jul)
FromJulian(jul, &y, &m, &d);
sprintf(BanExpr, "sortbanner('%04d/%02d/%02d')", y, m+1, d);
y = EvalExpr(&s, &v);
y = EvalExpr(&s, &v, NULL);
if (y) return;
if (DoCoerce(STR_TYPE, &v)) return;
DBufInit(&buf);

11
src/test-all-languages.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# Make sure Remind compiles with all supported languages; show
# tstlang.rem output for each language.
ALL=`grep ^#define lang.h | grep -v '#define LANG' | awk '{print $2}'`
for i in $ALL ; do
make clean all LANGDEF=-DLANG=$i || exit 1
./remind -q -r ../tests/tstlang.rem
done
exit 0

View File

@@ -6,8 +6,7 @@
/* classifying the tokens parsed. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -63,11 +62,13 @@ Token TokArray[] = {
{ "if", 2, T_If, 0 },
{ "iftrig", 6, T_IfTrig, 0 },
{ "include", 3, T_Include, 0 },
{ "includecmd", 10, T_IncludeCmd, 0 },
{ "january", 3, T_Month, 0 },
{ "july", 3, T_Month, 6 },
{ "june", 3, T_Month, 5 },
{ "march", 3, T_Month, 2 },
{ "may", 3, T_Month, 4 },
{ "maybe-uncomputable", 5, T_MaybeUncomputable, 0},
{ "monday", 3, T_WkDay, 0 },
{ "msf", 3, T_RemType, MSF_TYPE },
{ "msg", 3, T_RemType, MSG_TYPE },
@@ -94,6 +95,7 @@ Token TokArray[] = {
{ "special", 7, T_RemType, PASSTHRU_TYPE },
{ "sunday", 3, T_WkDay, 6 },
{ "tag", 3, T_Tag, 0 },
{ "through", 7, T_Through, 0 },
{ "thursday", 3, T_WkDay, 3 },
{ "tuesday", 3, T_WkDay, 1 },
{ "unset", 5, T_UnSet, 0 },
@@ -146,9 +148,9 @@ char const *FindInitialToken(Token *tok, char const *s)
tok->type = T_Illegal;
while (isspace(*s)) s++;
while (isempty(*s)) s++;
while (*s && !isspace(*s)) {
while (*s && !isempty(*s)) {
if (DBufPutc(&buf, *s++) != OK) return s;
}
@@ -171,6 +173,10 @@ void FindToken(char const *s, Token *tok)
int top, bot, mid, r, max;
int l;
#if LANG != ENGLISH
size_t i;
#endif
tok->type = T_Illegal;
if (! *s) {
tok->type = T_Empty;
@@ -228,11 +234,11 @@ void FindToken(char const *s, Token *tok)
/* If language is other than English, search the DayNames[] and MonthNames[]
array. */
#if LANG != ENGLISH
for (r=0; r<(sizeof(NonEnglishToks) / sizeof(Token)); r++) {
if (l >= NonEnglishToks[r].MinLen &&
!TokStrCmp(&NonEnglishToks[r], s)) {
tok->type = NonEnglishToks[r].type;
tok->val = NonEnglishToks[r].val;
for (i=0; i<(sizeof(NonEnglishToks) / sizeof(Token)); i++) {
if (l >= NonEnglishToks[i].MinLen &&
!TokStrCmp(&NonEnglishToks[i], s)) {
tok->type = NonEnglishToks[i].type;
tok->val = NonEnglishToks[i].val;
return;
}
}
@@ -257,6 +263,7 @@ void FindNumericToken(char const *s, Token *t)
{
int mult = 1, hour, min;
char const *s_orig = s;
int ampm = 0;
t->type = T_Illegal;
t->val = 0;
@@ -284,10 +291,6 @@ void FindNumericToken(char const *s, Token *t)
like Jan 6, 1998 */
if (*s == ',') {
s++;
/* Special hack - convert years between 90 and
99 to 1990 and 1999 */
if (t->val >= 90 && t->val <= 99) t->val += 1900;
/* Classify the number we've got */
if (t->val >= BASE && t->val <= BASE+YR_RANGE) t->type = T_Year;
else if (t->val >= 1 && t->val <= 31) t->type = T_Day;
@@ -299,7 +302,29 @@ void FindNumericToken(char const *s, Token *t)
s++;
hour = t->val;
PARSENUM(min, s);
if (*s || min > 59) return; /* Illegal time */
if (min > 59) return; /* Illegal time */
/* Check for p[m] or a[m] */
if (*s == 'A' || *s == 'a' || *s == 'P' || *s == 'p') {
ampm = tolower(*s);
s++;
if (*s == 'm' || *s == 'M') {
s++;
}
}
if (*s) return; /* Illegal time */
if (ampm) {
if (hour < 1 || hour > 12) return;
if (ampm == 'a') {
if (hour == 12) {
hour = 0;
}
} else if (ampm == 'p') {
if (hour < 12) {
hour += 12;
}
}
}
t->val = hour*60 + min; /* Convert to minutes past midnight */
if (hour <= 23) {
t->type = T_Time;
@@ -359,7 +384,7 @@ static int TokStrCmp(Token const *t, char const *s)
register int r;
char const *tk = t->name;
while(*tk && *s && !(*s == ',' && *(s+1) == 0)) {
r = *tk - tolower(*s);
r = tolower(*tk) - tolower(*s);
tk++;
s++;
if (r) return r;
@@ -367,5 +392,5 @@ static int TokStrCmp(Token const *t, char const *s)
/* Ignore trailing commas on s */
if (!*s || (*s == ',' && !*(s+1))) return 0;
return (*tk - *s);
return (tolower(*tk) - tolower(*s));
}

View File

@@ -5,8 +5,7 @@
/* Routines for figuring out the trigger date of a reminder */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -25,6 +24,8 @@
#define GOT_YR 4
#define GOT_WD 8
#define ADVANCE_TO_WD(x, wd) while (! ((wd) & (1 << ((x)%7)))) (x)++
static int JYear(int jul);
static int JMonth(int jul);
static int NextSimpleTrig(int startdate, Trigger *trig, int *err);
@@ -59,9 +60,10 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
if (trig->wd != NO_WD) typ |= GOT_WD;
switch(typ) {
case 0:
return startdate;
case GOT_WD:
if (trig->wd != NO_WD)
while(! (trig->wd & (1 << (startdate%7)))) startdate++;
ADVANCE_TO_WD(startdate, trig->wd);
return startdate;
case GOT_DAY:
@@ -84,12 +86,12 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
else return -1;
case GOT_DAY+GOT_MON:
if (m > trig->m || (m == trig->m && d > trig->d)) y++;
if (trig->d > MonthDays[trig->m]) {
*err = E_BAD_DATE;
return -1;
}
if (m > trig->m || (m == trig->m && d > trig->d)) y++;
/* Take care of Feb. 29 */
while (trig->d > DaysInMonth(trig->m, y)) y++;
return Julian(y, trig->m, trig->d);
@@ -122,19 +124,19 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
if (y > trig->y) return -1;
if (y < trig->y) j = Julian(trig->y, 0, 1);
else j = startdate;
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (JYear(j) > trig->y) return -1;
return j;
case GOT_MON+GOT_WD:
if (m == trig->m) {
j = startdate;
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (JMonth(j) == trig->m) return j;
}
if (m >= trig->m) j = Julian(y+1, trig->m, 1);
else j = Julian(y, trig->m, 1);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
return j; /* Guaranteed to be within the month */
case GOT_DAY+GOT_WD:
@@ -145,7 +147,7 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
/* If there are fewer days in previous month, no match */
if (trig->d <= DaysInMonth(m2, y2)) {
j = Julian(y2, m2, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (j >= startdate) return j;
}
@@ -154,7 +156,7 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
/* Try this month */
if (trig->d <= DaysInMonth(m, y)) {
j = Julian(y, m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (j >= startdate) return j;
}
@@ -163,18 +165,18 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
if (m2 > 11) { m2 = 0; y++; }
while (trig->d > DaysInMonth(m2, y)) m2++;
j = Julian(y, m2, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
return j;
case GOT_WD+GOT_YR+GOT_DAY:
if (y > trig->y+1 || (y > trig->y && m>0)) return -1;
if (y > trig->y) {
j = Julian(trig->y, 11, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (j >= startdate) return j;
} else if (y < trig->y) {
j = Julian(trig->y, 0, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
return j;
} else {
/* Try last month */
@@ -182,14 +184,16 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
m2 = m-1;
while (trig->d > DaysInMonth(m2, trig->y)) m2--;
j = Julian(trig->y, m2, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (JYear(j) > trig->y) return -1;
if (j >= startdate) return j;
}
}
/* Try this month */
if (trig->d <= DaysInMonth(m, trig->y)) {
j = Julian(trig->y, m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (JYear(j) > trig->y) return -1;
if (j >= startdate) return j;
}
@@ -198,7 +202,8 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
m++;
while (trig->d > DaysInMonth(m, trig->d)) m++;
j = Julian(trig->y, m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (JYear(j) > trig->y) return -1;
return j;
case GOT_DAY+GOT_MON+GOT_WD:
@@ -216,31 +221,32 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
/* Try last year */
j = Julian(y, trig->m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (j >= startdate) return j;
/* Try this year */
y++;
while (trig->d > DaysInMonth(trig->m, y)) y++;
j = Julian(y, trig->m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
if (j >= startdate) return j;
/* Must be next year */
y++;
while (trig->d > DaysInMonth(trig->m, y)) y++;
j = Julian(y, trig->m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
return j;
case GOT_WD+GOT_MON+GOT_YR:
if (y > trig->y || (y == trig->y && m > trig->m)) return -1;
if (trig->y > y || (trig->y == y && trig->m > m)) {
j = Julian(trig->y, trig->m, 1);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
return j;
} else {
j = startdate;
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
FromJulian(j, &y2, &m2, &d2);
if (m2 == trig->m) return j; else return -1;
}
@@ -251,7 +257,7 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
return -1;
}
j = Julian(trig->y, trig->m, trig->d);
while(! (trig->wd & (1 << (j%7)))) j++;
ADVANCE_TO_WD(j, trig->wd);
return j;
default:
@@ -301,7 +307,10 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
/* First: Have we passed the UNTIL date? */
if (trig->until != NO_UNTIL &&
trig->until < start) return -1; /* expired */
trig->until < start) {
trig->expired = 1;
return -1; /* expired */
}
/* Next: If it's an "AFTER"-type skip, back up
until we're at the start of a block of holidays */
@@ -406,6 +415,57 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
return simple;
}
int
AdjustTriggerForDuration(int today, int r, Trigger *trig, TimeTrig *tim, int save_in_globals)
{
int y, m, d;
/* If we have an AT, save the original event start */
if (tim->ttime != NO_TIME) {
trig->eventstart = MINUTES_PER_DAY * r + tim->ttime;
if (tim->duration != NO_TIME) {
trig->eventduration = tim->duration;
}
}
/* Now potentially adjust */
if (r < today && r + trig->duration_days >= today) {
/* Adjust duration down */
tim->duration -= (today - r) * MINUTES_PER_DAY;
tim->duration += tim->ttime;
/* Start at midnight */
tim->ttime = 0;
/* Change trigger date to today */
r = today;
if (DebugFlag & DB_PRTTRIG) {
FromJulian(r, &y, &m, &d);
fprintf(ErrFp, "%s(%d): Trig(adj) = %s, %d %s, %d",
FileName, LineNo,
DayName[r % 7],
d,
MonthName[m],
y);
if (tim->ttime != NO_TIME) {
fprintf(ErrFp, " AT %02d:%02d",
(tim->ttime / 60),
(tim->ttime % 60));
if (tim->duration != NO_TIME) {
fprintf(ErrFp, " DURATION %02d:%02d",
(tim->duration / 60),
(tim->duration % 60));
}
}
fprintf(ErrFp, "\n");
}
}
if (save_in_globals) {
SaveAllTriggerInfo(trig, tim, r, tim->ttime, 1);
}
return r;
}
/***************************************************************/
/* */
/* ComputeTrigger */
@@ -414,25 +474,77 @@ static int GetNextTriggerDate(Trigger *trig, int start, int *err, int *nextstart
/* today's date. */
/* */
/***************************************************************/
int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
int ComputeTrigger(int today, Trigger *trig, TimeTrig *tim,
int *err, int save_in_globals)
{
int r = ComputeTriggerNoAdjustDuration(today, trig, tim, err, save_in_globals, 0);
if (*err != OK) {
return r;
}
if (r == today) {
if (tim->ttime != NO_TIME) {
trig->eventstart = MINUTES_PER_DAY * r + tim->ttime;
if (tim->duration != NO_TIME) {
trig->eventduration = tim->duration;
}
}
if (save_in_globals) {
SaveAllTriggerInfo(trig, tim, r, tim->ttime, 1);
}
return r;
}
if (trig->duration_days) {
r = ComputeTriggerNoAdjustDuration(today, trig, tim, err, save_in_globals, trig->duration_days);
if (*err != OK) {
return r;
}
}
r = AdjustTriggerForDuration(today, r, trig, tim, save_in_globals);
return r;
}
/***************************************************************/
/* */
/* ComputeTriggerNoAdjustDuration */
/* */
/* Compute a trigger, but do NOT adjust the time trigger */
/* duration. */
/* */
/***************************************************************/
int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim,
int *err, int save_in_globals, int duration_days)
{
int nattempts = 0,
start = today,
start = today - duration_days,
nextstart = 0,
y, m, d, omit,
result;
if (save_in_globals) LastTrigValid = 0;
trig->expired = 0;
if (save_in_globals) {
LastTrigValid = 0;
}
/* Assume everything works */
/* Assume everything works */
*err = OK;
/* But check for obvious problems... */
/* But check for obvious problems... */
if (trig->localomit == 1 + 2 + 4 + 8 + 16 + 32 + 64) {
*err = E_2MANY_LOCALOMIT;
return -1;
}
if (start < 0) {
*err = E_DATE_OVER;
return -1;
}
if (tim->duration != NO_TIME && tim->ttime == NO_TIME) {
*err = E_DURATION_NO_AT;
return -1;
}
if (trig->rep != NO_REP &&
(trig->d == NO_DAY ||
trig->m == NO_MON ||
@@ -443,12 +555,18 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
}
/* Save the trigger */
if (save_in_globals) {
SaveLastTrigger(trig);
}
while (nattempts++ < TRIG_ATTEMPTS) {
result = GetNextTriggerDate(trig, start, err, &nextstart);
/* If there's an error, die immediately */
if (*err) return -1;
if (result == -1) {
trig->expired = 1;
if (DebugFlag & DB_PRTTRIG) {
fprintf(ErrFp, "%s(%d): %s\n",
FileName, LineNo, ErrMsg[E_EXPIRED]);
@@ -463,7 +581,9 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
} else {
omit = 0;
}
if (result >= today &&
/** FIXME: Fix bad interaction with SATISFY... need to rethink!!! */
if (result+duration_days >= today &&
(trig->skip != SKIP_SKIP || !omit)) {
if (save_in_globals) {
LastTriggerDate = result; /* Save in global var */
@@ -471,12 +591,23 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
}
if (DebugFlag & DB_PRTTRIG) {
FromJulian(result, &y, &m, &d);
fprintf(ErrFp, "%s(%d): Trig = %s, %d %s, %d\n",
fprintf(ErrFp, "%s(%d): Trig = %s, %d %s, %d",
FileName, LineNo,
DayName[result % 7],
d,
MonthName[m],
y);
if (tim->ttime != NO_TIME) {
fprintf(ErrFp, " AT %02d:%02d",
(tim->ttime / 60),
(tim->ttime % 60));
if (tim->duration != NO_TIME) {
fprintf(ErrFp, " DURATION %02d:%02d",
(tim->duration / 60),
(tim->duration % 60));
}
}
fprintf(ErrFp, "\n");
}
return result;
}
@@ -485,6 +616,7 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
if (trig->back == NO_BACK &&
trig->skip == NO_SKIP &&
trig->rep == NO_REP) {
trig->expired = 1;
if (DebugFlag & DB_PRTTRIG) {
fprintf(ErrFp, "%s(%d): %s\n",
FileName, LineNo, ErrMsg[E_EXPIRED]);
@@ -513,6 +645,7 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
LastTrigValid = 1;
}
}
trig->expired = 1;
if (DebugFlag & DB_PRTTRIG) {
fprintf(ErrFp, "%s(%d): %s\n",
FileName, LineNo, ErrMsg[E_EXPIRED]);
@@ -527,3 +660,41 @@ int ComputeTrigger(int today, Trigger *trig, int *err, int save_in_globals)
*err = E_CANT_TRIG;
return -1;
}
/***************************************************************/
/* */
/* ComputeScanStart */
/* */
/* Figure out where to start scan from by examining SCANFROM */
/* and DURATION */
/* */
/***************************************************************/
int
ComputeScanStart(int today, Trigger *trig, TimeTrig *tt)
{
int minutes, days;
/* If we don't have a time/duration, just use scanfrom */
if (tt->ttime == NO_TIME ||
tt->duration == NO_TIME) {
if (trig->scanfrom == NO_DATE) {
return today;
}
return trig->scanfrom;
}
/* Calculate time-based SCANFROM */
minutes = tt->ttime + tt->duration - 1;
/* Figure out how many days to scan backwards from */
days = minutes / MINUTES_PER_DAY;
if (trig->scanfrom != NO_DATE) {
if (trig->scanfrom <= today - days) {
return trig->scanfrom;
} else {
return today - days;
}
}
return today - days;
}

View File

@@ -5,8 +5,7 @@
/* Type definitions all dumped here. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -41,6 +40,7 @@ typedef struct {
char const *name;
char minargs;
char maxargs;
char is_constant;
int (*func)(func_info *);
} BuiltinFunc;
@@ -54,6 +54,7 @@ typedef struct var {
/* A trigger */
typedef struct {
int expired;
int wd;
int d;
int m;
@@ -67,11 +68,16 @@ typedef struct {
int typ;
int once;
int scanfrom;
int from;
int priority;
int duration_days; /* Duration converted to days to search */
int eventstart; /* Original event start (datetime) */
int eventduration; /* Original event duration (minutes) */
int maybe_uncomputable; /* Suppress "can't compute trigger" warnings */
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];
DynamicBuffer tags;
char passthru[PASSTHRU_LEN+1];
} Trigger;
@@ -86,15 +92,16 @@ typedef struct {
/* The parse pointer */
typedef struct {
char isnested; /* Is it a nested expression? */
char allownested;
DynamicBuffer pushedToken; /* Pushed-back token */
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 const *tokenPushed; /* NULL if no pushed-back token */
char expr_happened; /* Did we encounter an [expression] ? */
unsigned char isnested; /* Is it a nested expression? */
unsigned char allownested;
unsigned char expr_happened; /* Did we encounter an [expression] ? */
unsigned char nonconst_expr; /* Did we encounter a non-constant [expression] ? */
} Parser;
typedef Parser *ParsePtr; /* Pointer to parser structure */
@@ -143,7 +150,7 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
enum TokTypes
{ T_Illegal,
/* Commands first */
T_Rem, T_Push, T_Pop, T_Preserve, T_Include, T_If, T_Else, T_EndIf,
T_Rem, T_Push, T_Pop, T_Preserve, T_Include, T_IncludeCmd, T_If, T_Else, T_EndIf,
T_IfTrig, T_ErrMsg,
T_Set, T_UnSet, T_Fset, T_Omit, T_Banner, T_Exit,
T_WkDay,
@@ -164,7 +171,9 @@ enum TokTypes
T_Tag,
T_Duration,
T_LongTime,
T_OmitFunc
T_OmitFunc,
T_Through,
T_MaybeUncomputable
};
/* The structure of a token */
@@ -209,3 +218,18 @@ typedef struct {
/* Flags for FROM / SCANFROM */
#define SCANFROM_TYPE 0
#define FROM_TYPE 1
/* PS Calendar levels */
/* Original interchange format */
#define PSCAL_LEVEL1 1
/* Line-by-line JSON */
#define PSCAL_LEVEL2 2
/* Pure JSON */
#define PSCAL_LEVEL3 3
#define TERMINAL_BACKGROUND_UNKNOWN 0
#define TERMINAL_BACKGROUND_DARK 1
#define TERMINAL_BACKGROUND_LIGHT 2

View File

@@ -6,8 +6,7 @@
/* functions. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -65,6 +64,7 @@ int DoFset(ParsePtr p)
int c;
UserFunc *func;
Var *v;
int orig_namelen;
DynamicBuffer buf;
DBufInit(&buf);
@@ -75,6 +75,7 @@ int DoFset(ParsePtr p)
DBufFree(&buf);
return E_BAD_ID;
}
orig_namelen = buf.len;
/* Should be followed by '(' */
c = ParseNonSpaceChar(p, &r, 0);
@@ -95,9 +96,8 @@ int DoFset(ParsePtr p)
StrnCpy(func->name, DBufValue(&buf), VAR_NAME_LEN);
DBufFree(&buf);
if (!Hush) {
if (FindFunc(DBufValue(&buf), Func, NumFuncs)) {
Eprint("%s: `%s'", ErrMsg[E_REDEF_FUNC],
DBufValue(&buf));
if (FindFunc(func->name, Func, NumFuncs)) {
Eprint("%s: `%s'", ErrMsg[E_REDEF_FUNC], func->name);
}
}
func->locals = NULL;
@@ -119,6 +119,7 @@ int DoFset(ParsePtr p)
if ( (r=ParseIdentifier(p, &buf)) ) return r;
if (*DBufValue(&buf) == '$') {
DBufFree(&buf);
DestroyUserFunc(func);
return E_BAD_ID;
}
v = NEW(Var);
@@ -165,6 +166,10 @@ int DoFset(ParsePtr p)
/* Add the function definition */
FSet(func);
if (orig_namelen > VAR_NAME_LEN) {
Eprint("Warning: Function name `%s...' truncated to `%s'",
func->name, func->name);
}
return OK;
}
@@ -243,7 +248,7 @@ static void FSet(UserFunc *f)
/* Call a user-defined function. */
/* */
/***************************************************************/
int CallUserFunc(char const *name, int nargs)
int CallUserFunc(char const *name, int nargs, ParsePtr p)
{
UserFunc *f;
int h = HashVal(name) % FUNC_HASH_SIZE;
@@ -274,7 +279,7 @@ int CallUserFunc(char const *name, int nargs)
}
return E_RECURSIVE;
}
/* Check number of args */
if (nargs != f->nargs) {
if (DebugFlag &DB_PRTEXPR) {
@@ -299,9 +304,9 @@ int CallUserFunc(char const *name, int nargs)
s = f->text;
/* Skip the opening bracket, if there's one */
while (isspace(*s)) s++;
while (isempty(*s)) s++;
if (*s == BEG_OF_EXPR) s++;
h = Evaluate(&s, f->locals);
h = Evaluate(&s, f->locals, p);
f->IsActive = 0;
DestroyLocalVals(f);
if (DebugFlag &DB_PRTEXPR) {

View File

@@ -5,12 +5,15 @@
/* Useful utility functions. */
/* */
/* 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) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
static char const DontEscapeMe[] =
"1234567890_-=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@.,/";
#include "config.h"
#include "err.h"
#include <string.h>
#include <stdio.h>
@@ -124,3 +127,38 @@ int DateOK(int y, int m, int d)
d > DaysInMonth(m, y) ) return 0;
else return 1;
}
/* Functions designed to defeat gcc optimizer */
int _private_div(int a, int b) { return a/b; }
int _private_add_overflow(int result, int b, int old)
{
if (b > 0 && result < old) return 1;
if (b < 0 && result > old) return 1;
return 0;
}
int _private_sub_overflow(int result, int b, int old)
{
if (b < 0 && result < old) return 1;
if (b > 0 && result > old) return 1;
return 0;
}
int _private_unminus_overflow(int a, int b)
{
if (a > 0 && b > 0) return 1;
if (a < 0 && b < 0) return 1;
return 0;
}
int
ShellEscape(char const *in, DynamicBuffer *out)
{
while(*in) {
if (!strchr(DontEscapeMe, *in)) {
if (DBufPutc(out, '\\') != OK) return E_NO_MEM;
}
if (DBufPutc(out, *in++) != OK) return E_NO_MEM;
}
return OK;
}

314
src/var.c
View File

@@ -6,8 +6,7 @@
/* user- and system-defined variables. */
/* */
/* This file is part of REMIND. */
/* Copyright (C) 1992-1998 by David F. Skoll */
/* Copyright (C) 1999-2007 by Roaring Penguin Software Inc. */
/* Copyright (C) 1992-2021 by Dianne Skoll */
/* */
/***************************************************************/
@@ -18,6 +17,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <limits.h>
#include "types.h"
#include "expr.h"
#include "globals.h"
@@ -32,10 +32,185 @@
#define VALUE ErrMsg[E_VAL]
#define UNDEF ErrMsg[E_UNDEF]
static int IntMin = INT_MIN;
static int IntMax = INT_MAX;
static Var *VHashTbl[VAR_HASH_SIZE];
typedef int (*SysVarFunc)(int, Value *);
static int trig_date_func(int do_set, Value *val)
{
UNUSED(do_set);
val->type = DATE_TYPE;
if (!LastTrigValid) {
val->v.val = 0;
} else {
val->v.val = LastTriggerDate;
}
return OK;
}
static int trig_day_func(int do_set, Value *val)
{
int y, m, d;
UNUSED(do_set);
val->type = INT_TYPE;
if (!LastTrigValid) {
val->v.val = -1;
return OK;
}
FromJulian(LastTriggerDate, &y, &m, &d);
val->v.val = d;
return OK;
}
static int trig_mon_func(int do_set, Value *val)
{
int y, m, d;
UNUSED(do_set);
val->type = INT_TYPE;
if (!LastTrigValid) {
val->v.val = -1;
return OK;
}
FromJulian(LastTriggerDate, &y, &m, &d);
val->v.val = m+1;
return OK;
}
static int trig_year_func(int do_set, Value *val)
{
int y, m, d;
UNUSED(do_set);
val->type = INT_TYPE;
if (!LastTrigValid) {
val->v.val = -1;
return OK;
}
FromJulian(LastTriggerDate, &y, &m, &d);
val->v.val = y;
return OK;
}
static int trig_wday_func(int do_set, Value *val)
{
val->type = INT_TYPE;
UNUSED(do_set);
if (!LastTrigValid) {
val->v.val = -1;
return OK;
}
val->v.val = (LastTriggerDate + 1) % 7;
return OK;
}
static int today_date_func(int do_set, Value *val)
{
UNUSED(do_set);
val->type = DATE_TYPE;
val->v.val = JulianToday;
return OK;
}
static int today_day_func(int do_set, Value *val)
{
int y, m, d;
UNUSED(do_set);
val->type = INT_TYPE;
FromJulian(JulianToday, &y, &m, &d);
val->v.val = d;
return OK;
}
static int today_mon_func(int do_set, Value *val)
{
int y, m, d;
UNUSED(do_set);
val->type = INT_TYPE;
FromJulian(JulianToday, &y, &m, &d);
val->v.val = m+1;
return OK;
}
static int today_year_func(int do_set, Value *val)
{
int y, m, d;
UNUSED(do_set);
val->type = INT_TYPE;
FromJulian(JulianToday, &y, &m, &d);
val->v.val = y;
return OK;
}
static int today_wday_func(int do_set, Value *val)
{
UNUSED(do_set);
val->type = INT_TYPE;
val->v.val = (JulianToday + 1) % 7;
return OK;
}
static int datetime_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] = DateTimeSep;
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, "T") &&
strcmp(val->v.str, "@")) {
return E_BAD_TYPE;
}
DateTimeSep = val->v.str[0];
return OK;
}
static int default_color_func(int do_set, Value *val)
{
int col_r, col_g, col_b;
if (!do_set) {
/* 12 = strlen("255 255 255\0") */
val->v.str = malloc(12);
if (!val->v.str) return E_NO_MEM;
snprintf(val->v.str, 12, "%d %d %d",
DefaultColorR,
DefaultColorG,
DefaultColorB
);
val->type = STR_TYPE;
return OK;
}
if (val->type != STR_TYPE) return E_BAD_TYPE;
if (sscanf(val->v.str, "%d %d %d", &col_r, &col_g, &col_b) != 3) {
return E_BAD_TYPE;
}
/* They either all have to be -1, or all between 0 and 255 */
if (col_r == -1 && col_g == -1 && col_b == -1) {
DefaultColorR = -1;
DefaultColorG = -1;
DefaultColorB = -1;
return OK;
}
if (col_r < 0) return E_2LOW;
if (col_r > 255) return E_2HIGH;
if (col_g < 0) return E_2LOW;
if (col_g > 255) return E_2HIGH;
if (col_b < 0) return E_2LOW;
if (col_b > 255) return E_2HIGH;
DefaultColorR = col_r;
DefaultColorG = col_g;
DefaultColorB = col_b;
return OK;
}
static int date_sep_func(int do_set, Value *val)
{
if (!do_set) {
@@ -186,7 +361,7 @@ int SetVar(char const *str, Value *val)
/* Get a copy of the value of the variable. */
/* */
/***************************************************************/
int GetVarValue(char const *str, Value *val, Var *locals)
int GetVarValue(char const *str, Value *val, Var *locals, ParsePtr p)
{
Var *v;
@@ -198,6 +373,8 @@ int GetVarValue(char const *str, Value *val, Var *locals)
v = v->next;
}
/* Global variable... mark expression as non-constant */
if (p) p->nonconst_expr = 1;
v=FindVar(str, 0);
if (!v) {
@@ -236,6 +413,10 @@ int DoSet (Parser *p)
if (*DBufValue(&buf) == '$') r = SetSysVar(DBufValue(&buf)+1, &v);
else r = SetVar(DBufValue(&buf), &v);
if (buf.len > VAR_NAME_LEN) {
Eprint("Warning: Variable name `%.*s...' truncated to `%.*s'",
VAR_NAME_LEN, DBufValue(&buf), VAR_NAME_LEN, DBufValue(&buf));
}
DBufFree(&buf);
return r;
}
@@ -286,6 +467,8 @@ int DoDump(ParsePtr p)
Var *v;
DynamicBuffer buf;
if (PurgeMode) return OK;
DBufInit(&buf);
r = ParseToken(p, &buf);
if (r) return r;
@@ -296,17 +479,17 @@ int DoDump(ParsePtr p)
DumpVarTable();
return OK;
}
fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, VARIABLE, VALUE);
fprintf(ErrFp, "%s %s\n\n", VARIABLE, VALUE);
while(1) {
if (*DBufValue(&buf) == '$') {
DumpSysVarByName(DBufValue(&buf)+1);
} else {
v = FindVar(DBufValue(&buf), 0);
DBufValue(&buf)[VAR_NAME_LEN] = 0;
if (!v) fprintf(ErrFp, "%*s %s\n", VAR_NAME_LEN,
if (!v) fprintf(ErrFp, "%s %s\n",
DBufValue(&buf), UNDEF);
else {
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, v->name);
fprintf(ErrFp, "%s ", v->name);
PrintValue(&(v->v), ErrFp);
fprintf(ErrFp, "\n");
}
@@ -334,12 +517,12 @@ void DumpVarTable(void)
register Var *v;
register int i;
fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, VARIABLE, VALUE);
fprintf(ErrFp, "%s %s\n\n", VARIABLE, VALUE);
for (i=0; i<VAR_HASH_SIZE; i++) {
v = VHashTbl[i];
while(v) {
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, v->name);
fprintf(ErrFp, "%s ", v->name);
PrintValue(&(v->v), ErrFp);
fprintf(ErrFp, "\n");
v = v->next;
@@ -462,47 +645,61 @@ typedef struct {
/* 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 },
{ "EndSent", 1, STR_TYPE, &EndSent, 0, 0 },
{ "EndSentIg", 1, STR_TYPE, &EndSentIg, 0, 0 },
{ "FirstIndent", 1, INT_TYPE, &FirstIndent, 0, 132 },
{ "FoldYear", 1, INT_TYPE, &FoldYear, 0, 1 },
{ "FormWidth", 1, INT_TYPE, &FormWidth, 20, 132 },
{ "HushMode", 0, INT_TYPE, &Hush, 0, 0 },
{ "IgnoreOnce", 0, INT_TYPE, &IgnoreOnce, 0, 0 },
{ "InfDelta", 0, INT_TYPE, &InfiniteDelta, 0, 0 },
{ "LatDeg", 1, INT_TYPE, &LatDeg, -90, 90 },
{ "LatMin", 1, INT_TYPE, &LatMin, -59, 59 },
{ "LatSec", 1, INT_TYPE, &LatSec, -59, 59 },
{ "Location", 1, STR_TYPE, &Location, 0, 0 },
{ "LongDeg", 1, INT_TYPE, &LongDeg, -180, 180 },
{ "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 },
{ "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},
{ "TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0 },
{ "UntimedFirst", 0, INT_TYPE, &UntimedBeforeTimed, 0, 0 }
/* 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 },
{"DateTimeSep", 1, SPECIAL_TYPE, datetime_sep_func, 0, 0 },
{"DefaultColor", 1, SPECIAL_TYPE, default_color_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 },
{"EndSent", 1, STR_TYPE, &EndSent, 0, 0 },
{"EndSentIg", 1, STR_TYPE, &EndSentIg, 0, 0 },
{"FirstIndent", 1, INT_TYPE, &FirstIndent, 0, 132 },
{"FoldYear", 1, INT_TYPE, &FoldYear, 0, 1 },
{"FormWidth", 1, INT_TYPE, &FormWidth, 20, 500 },
{"HushMode", 0, INT_TYPE, &Hush, 0, 0 },
{"IgnoreOnce", 0, INT_TYPE, &IgnoreOnce, 0, 0 },
{"InfDelta", 0, INT_TYPE, &InfiniteDelta, 0, 0 },
{"IntMax", 0, INT_TYPE, &IntMax, 0, 0 },
{"IntMin", 0, INT_TYPE, &IntMin, 0, 0 },
{"LatDeg", 1, INT_TYPE, &LatDeg, -90, 90 },
{"LatMin", 1, INT_TYPE, &LatMin, -59, 59 },
{"LatSec", 1, INT_TYPE, &LatSec, -59, 59 },
{"Location", 1, STR_TYPE, &Location, 0, 0 },
{"LongDeg", 1, INT_TYPE, &LongDeg, -180, 180 },
{"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, -780, 780 },
{"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 },
{"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 },
{"T", 0, SPECIAL_TYPE, trig_date_func, 0, 0 },
{"Td", 0, SPECIAL_TYPE, trig_day_func, 0, 0 },
{"TimeSep", 1, SPECIAL_TYPE, time_sep_func, 0, 0 },
{"Tm", 0, SPECIAL_TYPE, trig_mon_func, 0, 0 },
{"Tw", 0, SPECIAL_TYPE, trig_wday_func, 0, 0 },
{"Ty", 0, SPECIAL_TYPE, trig_year_func, 0, 0 },
{"U", 0, SPECIAL_TYPE, today_date_func, 0, 0 },
{"Ud", 0, SPECIAL_TYPE, today_day_func, 0, 0 },
{"Um", 0, SPECIAL_TYPE, today_mon_func, 0, 0 },
{"UntimedFirst", 0, INT_TYPE, &UntimedBeforeTimed, 0, 0 },
{"Uw", 0, SPECIAL_TYPE, today_wday_func, 0, 0 },
{"Uy", 0, SPECIAL_TYPE, today_year_func, 0, 0 }
};
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
@@ -611,7 +808,7 @@ static SysVar *FindSysVar(char const *name)
/***************************************************************/
void DumpSysVarByName(char const *name)
{
int i;
size_t i;
SysVar *v;
if (!name || !*name) {
@@ -639,16 +836,19 @@ static void DumpSysVar(char const *name, const SysVar *v)
if (!v && !name) return; /* Shouldn't happen... */
buffer[0]='$'; buffer[1] = 0;
if (name && strlen(name) > VAR_NAME_LEN) {
fprintf(ErrFp, "$%s: Name too long\n", name);
return;
}
if (name) strcat(buffer, name); else strcat(buffer, v->name);
fprintf(ErrFp, "%*s ", VAR_NAME_LEN+1, buffer);
fprintf(ErrFp, "%16s ", buffer);
if (v) {
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);
}
PrintValue(&val, ErrFp);
Putc('\n', ErrFp);
DestroyValue(val);
} else if (v->type == STR_TYPE) {
char const *s = *((char **)v->value);
@@ -665,6 +865,12 @@ static void DumpSysVar(char const *name, const SysVar *v)
Putc('"', ErrFp);
if (*s) fprintf(ErrFp, "...");
Putc('\n', ErrFp);
} else if (v->type == DATE_TYPE) {
Value val;
val.type = DATE_TYPE;
val.v.val = * (int *) v->value;
PrintValue(&val, ErrFp);
Putc('\n', ErrFp);
} else {
if (!v->modifiable) fprintf(ErrFp, "%d\n", *((int *)v->value));
else {

View File

@@ -7,11 +7,11 @@ 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
REM 28 SPECIAL COLOUR 129 0 0 Bright Red
REM 28 SPECIAL COLOUR 0 129 0 Bright Green
REM 28 SPECIAL COLOUR 0 0 129 Bright Blue
REM 28 SPECIAL COLOUR 0 129 129 Bright Cyan
REM 28 SPECIAL COLOUR 129 0 129 Bright Magenta
REM 28 SPECIAL COLOUR 129 129 0 Bright Yellow
REM 28 SPECIAL COLOUR 129 129 129 Bright White

1
tests/file.ps Normal file
View File

@@ -0,0 +1 @@
(Second-Bit-Of-PS)

1
tests/file2.ps Normal file
View File

@@ -0,0 +1 @@
(Fourth-Bit-Of-PS)

7
tests/purge_dir/f1.rem Normal file
View File

@@ -0,0 +1,7 @@
# This is f1.rem
INCLUDE [filedir()]/f2.rem
INCLUDE [filedir()]/f2.rem
REM 1 Oct 1991 MSG old1.
REM Monday UNTIL 1 Oct 1991 MSG old2.

6
tests/purge_dir/f2.rem Normal file
View File

@@ -0,0 +1,6 @@
# This is f2.rem
REM 3 feb 2012 MSG new
REM 3 1998 MSG old
INCLUDE [filedir()]/f3.rem

92
tests/purge_dir/f3.rem Normal file
View File

@@ -0,0 +1,92 @@
# This is f3.rem
REM Mon MSG repeat
REM Mon SATISFY [1] MSG repeat
IF 0
REM 1991 MSG wookie
ENDIF
IF 1
REM 1991 MSG wookie
ENDIF
IFTRIG 1991
REM MSG wookie
ENDIF
# More complex conditional statements
IF 1
IF 0
REM 1991 MSG wookie
ELSE
REM 1991 MSG wookie
ENDIF
ELSE
IF 1
REM 1991 MSG wookie
ELSE
REM 1991 MSG wookie
ENDIF
ENDIF
REM [1990+1] MSG old-with-constant-expression
REM [1990+1] \
MSG Continued line-old-with-constant-expression
REM 1990 \
MSG expired-continued-line
set y 1990
REM [y+1] MSG old-with-nonconstant-expression
# A comment that should be preserved
#!P A comment that should be nuked because it \
starts with #!P
REM [y+1] \
MSG Continued-line-old-with-nonconstant-expression
OMIT 25 Dec MSG woaaahh!
OMIT 24 Dec
OMIT 1 Jan 1992 MSG woaaahah... expired
OMIT 2 Jan 1992
# Complicated expressions
SET a 3
FSET const(x) x+3
FSET nonconst(x) x+a
REM [const(5)] Jan 1992 MSG expired... should be commented out
REM [const(a)] Jan 1992 MSG nonconstant expression
REM [nonconst(5)] Jan 1992 MSG nonconstant expression
REM [value("a")] Jan 1992 MSG nonconstant expression
IF 0
# A comment in a false IF block
#!P This should be nuked
ENDIF
# Busted line
REM [0/0] Jan 1992 MSG ouch
ERRMSG blorky
FLUSH
SET a 1
FSET a(x) x*x
UNSET a
CLEAR-OMIT-CONTEXT
PUSH-OMIT-CONTEXT
POP-OMIT-CONTEXT
BANNER wow
DEBUG +x
DEBUG -x
DUMP $
EXIT 0
PRESERVE i

32
tests/shade.rem Normal file
View File

@@ -0,0 +1,32 @@
set $MinsFromUTC -240
set $CalcUTC 0
set $Location "Ottawa"
set $LongDeg 75
set $LongMin 39
set $LongSec 0
set $LatDeg 45
set $LatMin 24
set $LatSec 0
IF $PSCAL
[trigger(moondate(0))] SPECIAL MOON 0 -1 -1 [moontime(0)]
[trigger(moondate(1))] SPECIAL MOON 1 -1 -1 [moontime(1)]
[trigger(moondate(2))] SPECIAL MOON 2 -1 -1 [moontime(2)]
[trigger(moondate(3))] SPECIAL MOON 3 -1 -1 [moontime(3)]
ENDIF
REM 4 PS (First-Bit-Of-PS)
REM 4 PSFILE file.ps
REM 4 PS (Third-Bit-Of-PS)
REM 4 PSFILE file2.ps
REM Mon SPECIAL SHADE 255 255 255
REM Tue SPECIAL SHADE 255 255 204
REM Wed SPECIAL SHADE 255 204 255
REM Thu SPECIAL SHADE 204 255 255
REM Fri SPECIAL SHADE 255 204 204
REM Sat SPECIAL SHADE 204 255 204
REM Sun SPECIAL SHADE 204 204 255
# This should be ignored by rem2ps
REM SPECIAL HTML <b>FOO</b>

13
tests/sun.rem Normal file
View File

@@ -0,0 +1,13 @@
SET $LatDeg 45
SET $LatMin 24
SET $LatSec 0
SET $LongDeg 75
SET $LongMin 39
SET $LongSec 0
SET $MinsFromUTC -300
SET $CalcUTC 0
MSG Dawn: [dawn()]
MSG Sunrise: [sunrise()]
MSG Sunset: [sunset()]
MSG Dusk: [dusk()]

View File

@@ -0,0 +1,27 @@
# This file is designed for testing how back-ends
# handle SPECIALs, including SPECIALS they don't understand
# If you're writing a back-end, test it by feeding it the output
# of: remind -pp test-for-backends.rem
# Color and shade
REM 1 SPECIAL COLOR 128 0 0 Red
REM 2 SPECIAL COLOUR 0 128 0 British Green
REM 3 SPECIAL SHADE 192 192 255
# Moon
REM [moondate(0)] SPECIAL MOON 0 -1 -1 [moontime(0)]
REM [moondate(1)] SPECIAL MOON 1 -1 -1 [moontime(1)]
REM [moondate(2)] SPECIAL MOON 2 -1 -1 [moontime(2)]
REM [moondate(3)] SPECIAL MOON 3 -1 -1 [moontime(3)]
# Week
REM Monday SPECIAL WEEK (W[weekno()])
# PostScript
REM Wed PS Border Border 2 div moveto /Helvetica-Oblique findfont 6 scalefont setfont (oof!) show
# A SPECIAL that should be ignored
REM 15 SPECIAL RANDOM-STUFF ignore me and be happy
# A normal reminder
REM 16 MSG A normal reminder

View File

@@ -7,14 +7,22 @@
# in the build directory.
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 David F. Skoll
# Copyright (C) 1999-2000 Roaring Penguin Software Inc.
# Copyright (C) 1992-2021 Dianne Skoll
# ---------------------------------------------------------------------------
DIR=`dirname $0`
cd $DIR
if test $? != 0 ; then
echo ""
echo "Unable to cd $DIR" >&2
echo ""
exit 1
fi
if test `id -u` = 0 ; then
echo ""
echo "*** Please do not run the test suite as root; it will fail."
echo ""
exit 1
fi
@@ -22,28 +30,28 @@ chmod 000 include_dir/04cantread.rem
TEST_GETENV="foo bar baz" ; export TEST_GETENV
echo "Test 1" > ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -e -dxte ../tests/test.rem 16 feb 1991 >> ../tests/test.out
../src/remind -e -dxte ../tests/test.rem 16 feb 1991 >> ../tests/test.out 2>&1
echo "" >> ../tests/test.out
echo "Test 2" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -l ../tests/test2.rem 1 aug 2007 >> ../tests/test.out
../src/remind -p -l ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
echo "" >> ../tests/test.out
echo "Test 3" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -s ../tests/test2.rem 1 aug 2007 >> ../tests/test.out
../src/remind -s ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
echo "" >> ../tests/test.out
echo "Test 4" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -sa ../tests/test2.rem 1 aug 2007 >> ../tests/test.out
../src/remind -sa ../tests/test2.rem 1 aug 2007 >> ../tests/test.out 2>&1
echo "Test 5" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -l -b0 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
../src/remind -p -l -b0 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
echo "Test 6" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -l -b1 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
../src/remind -p -l -b1 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
echo "Test 7" >> ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -p -l -b2 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out
../src/remind -p -l -b2 ../tests/test3.rem 1 aug 2007 >> ../tests/test.out 2>&1
echo "Test 8" >> ../tests/test.out
echo "" >> ../tests/test.out
@@ -57,18 +65,266 @@ echo "" >> ../tests/test.out
chmod 644 include_dir/04cantread.rem
# Feb 29 bug
echo "Feb 29 Bug Test" >> ../tests/test.out
echo 'REM Sun 29 Feb MSG [$T]' | ../src/remind -dt - 1 feb 2021 >> ../tests/test.out 2>&1
# Day Weekday Year out-of-year bug
echo "Mon 31 Dec Bug Test" >> ../tests/test.out
echo 'REM Mon 31 2021 MSG [$T]' | ../src/remind -dt - 31 dec 2021 >> ../tests/test.out 2>&1
echo "Color Test" >> ../tests/test.out
../src/remind -ccl ../tests/colors.rem 1 aug 2007 >> ../tests/test.out
../src/remind -ccl ../tests/colors.rem 1 aug 2007 >> ../tests/test.out 2>&1
echo "MON WKDAY DAY across year test" >> ../tests/test.out
echo 'REM Mon 29 Dec MSG x' | ../src/remind -dt - 1 Jan 2000 >> ../tests/test.out 2>&1
echo "Sort Test" >> ../tests/test.out
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -gaaa - 1 Jan 2000 >> ../tests/test.out 2>&1
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -gaaad - 1 Jan 2000 >> ../tests/test.out 2>&1
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -q -gaaa - 1 Jan 2000 >> ../tests/test.out 2>&1
(echo "REM AT 12:00 MSG Untimed"; echo "REM MSG Timed") | ../src/remind -q -gaaad - 1 Jan 2000 >> ../tests/test.out 2>&1
echo "Purge Test" >> ../tests/test.out
../src/remind -j999 ../tests/purge_dir/f1.rem 3 Feb 2012 >> ../tests/test.out 2>&1
echo "F1" >> ../tests/test.out
cat ../tests/purge_dir/f1.rem.purged >> ../tests/test.out
echo "F2" >> ../tests/test.out
cat ../tests/purge_dir/f2.rem.purged >> ../tests/test.out
echo "F3" >> ../tests/test.out
cat ../tests/purge_dir/f3.rem.purged >> ../tests/test.out
rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1
../src/remind ../tests/runtest.rem >> ../tests/test.out 2>&1
../src/remind -p ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
../src/remind -pp ../tests/shade.rem 1 August 2009 | ../src/rem2ps -e -l -c3 >> ../tests/test.out 2>&1
# The sun tests can fail due to math roundoff error changing the times
# by a minute...
# ../src/remind -p12 ../tests/sun.rem 1 Jan 2011 >> ../tests/test.out 2>&1
# Test -a vs -aa
../src/remind -q -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up
REM 1 Jan 2012 AT 9:00 MSG 9am: Should not show up
REM 1 Jan 2012 AT 10:00 MSG 10am: Should not show up
MSG [$DontTrigAts]
EOF
../src/remind -q -a -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up
REM 1 Jan 2012 AT 9:00 MSG 9am: Should show up
REM 1 Jan 2012 AT 10:00 MSG 10am: Should show up
MSG [$DontTrigAts]
EOF
# An OMITFUNC should indicate nonconst_expr
../src/remind -pp - 1 jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM Mon OMITFUNC foo MSG bar
EOF
# Test default color
../src/remind -ppp - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1
REM 2 MSG Normal
SET $DefaultColor "255 0 0"
REM 3 MSG Red
SET $DefaultColor "-1 -1 -1"
REM 4 MSG Normal
# Should give an error
SET $DefaultColor "256 0 0"
EOF
# Test -@ option
../src/remind -w,0,0 -@0 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@0
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@0,0 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@0,0
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@0,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@0,1
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@1
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@1,0 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@1,0
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@1,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@1,1
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@2 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@2
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@2,0 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@2,0
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
../src/remind -w,0,0 -@2,1 -c - 1 Jan 2020 <<'EOF' >> ../tests/test.out 2>&1
rem 1 SPECIAL COLOR 0 0 0 BLACK
rem 2 SPECIAL COLOR 0 0 65 BLUE
rem 3 SPECIAL COLOR 0 65 0 GREEN
rem 4 SPECIAL COLOR 0 65 65 CYAN
rem 5 msg -@2,1
rem 15 SPECIAL COLOR 65 0 0 RED
rem 16 SPECIAL COLOR 65 0 65 MAGENTA
rem 17 SPECIAL COLOR 65 65 0 YELLOW
rem 18 SPECIAL COLOR 65 65 65 WHITE
rem 8 SPECIAL COLOR 0 0 0 BLACK
rem 9 SPECIAL COLOR 0 0 200 BRIGHT BLUE
rem 10 SPECIAL COLOR 0 200 0 BRIGHT GREEN
rem 11 SPECIAL COLOR 0 200 200 BRIGHT CYAN
rem 22 SPECIAL COLOR 200 0 0 BRIGHT RED
rem 23 SPECIAL COLOR 200 0 200 BRIGHT MAGENTA
rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW
rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE
EOF
# If we're already in a utf-8 locale, do
# nothing; otherwise, set LC_ALL
OK=0
if echo $LC_ALL | grep -i utf-8 > /dev/null 2>&1 ; then
OK=1
fi
if test -z "$LC_ALL" ; then
if echo $LANG | grep -i utf-8 > /dev/null 2>&1 ; then
export LC_ALL="$LANG"
OK=1
fi
fi
if test "$OK" = 0 ; then
export LC_ALL=en_US.utf-8
fi
../src/remind -w128 -c ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out
cmp -s ../tests/test.out ../tests/test.cmp
if [ "$?" = "0" ]; then
echo "Remind: Acceptance test PASSED"

File diff suppressed because it is too large Load Diff

View File

@@ -5,13 +5,50 @@
#
# ./test-rem # From WITHIN Remind source directory!
# Should issue a warning
fset year(x) 1
# Don't evaluate SATISFY expressions if reminder has expired
REM Wed UNTIL 15 Feb 1991 SATISFY [trigdate() > '1990-01-01'] MSG wookie
# bad AT
REM AT 0:00 0:01 0:02 MSG foo
# Includecmd
INCLUDECMD echo REM 16 Feb 1991 MSG Blork
INCLUDECMD echo REM 18 Feb 1991 MSG Blork
# Includecmd with continuation line
INCLUDECMD echo REM 18 Feb 1991 MSG This line is \
continued so there
# This should work
INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo MSG Yippee
# This should fail
INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo INCLUDECMD echo MSG Yippee
REM MSG Today is [hebday(today())] [hebmon(today())] [hebyear(today())]
fset _h(x, y) trigger(hebdate(x,y))
# Test case from Remind mailing list
set mltest "a b"
INCLUDECMD printf 'REM %s\n' [mltest]
# Disabling RUN in an !includecmd
INCLUDECMD !echo MSG foo
INCLUDECMD !echo MSG foo
INCLUDECMD !echo INCLUDECMD echo MSG foo
INCLUDECMD !echo INCLUDECMD echo MSG foo
INCLUDECMD !echo MSG foo
INCLUDECMD !echo MSG foo
# INCLUDECMD with RUN disabled
RUN OFF
INCLUDECMD echo MSG foo
RUN ON
INCLUDECMD echo MSG foo
[_h(1, "Tishrey")] MSG Rosh Hashana 1
[_h(2, "Tishrey")] MSG Rosh Hashana 2
[_h(3, "Tishrey")] MSG Tzom Gedalia
@@ -45,6 +82,9 @@ fset _i(x,y,z,a) trigger(hebdate(x,y,z,a))
[_i(29, "Adar A", today(), 5755)] MSG Leap
[_i(29, "Adar A", today(), 5756)] MSG Illegal
# This causes a parse error on version 03.01.01
REM 1990-01-01 SATISFY 1
# Test each possible case of the basic reminders.
REM MSG Every Day
@@ -163,6 +203,10 @@ REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
OMIT [trigger(trigdate())]
REM Fri after MSG 16 Feb 1991
CLEAR-OMIT-CONTEXT
REM Fri SCANFROM -7 SATISFY 1
OMIT [trigger(trigdate())]
REM Fri after MSG 16 Feb 1991
CLEAR-OMIT-CONTEXT
# Test omitfunc
fset _ofunc(x) (day(x) < 7 || day(x) % 2)
@@ -267,7 +311,29 @@ set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5')
msg [a075]%
set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5')
msg [a076]%
set a077 dosubst("%y %z", '1992/5/5')
set a074 dosubst("%*a %*b %*c %*d %*e %*f %*g %*h", '1992/5/5')
msg [a074]%
set a075 dosubst("%*i %*j %*k %*l %*m %*n %*o %*p", '1992/5/5')
msg [a075]%
set a076 dosubst("%*q %*r %*s %*t %*u %*v %*w %*x", '1992/5/5')
msg [a076]%
set a077 dosubst("%*y %*z", '1992/5/5')
msg [a077]%
set a074 dosubst("%A %B %C %D %E %F %G %H", '1992/5/5')
msg [a074]%
set a075 dosubst("%I %J %K %L %M %N %O %P", '1992/5/5')
msg [a075]%
set a076 dosubst("%Q %R %S %T %U %V %W %X", '1992/5/5')
msg [a076]%
set a077 dosubst("%Y %Z", '1992/5/5')
msg [a077]%
set a074 dosubst("%*A %*B %*C %*D %*E %*F %*G %*H", '1992/5/5')
msg [a074]%
set a075 dosubst("%*I %*J %*K %*L %*M %*N %*O %*P", '1992/5/5')
msg [a075]%
set a076 dosubst("%*Q %*R %*S %*T %*U %*V %*W %*X", '1992/5/5')
msg [a076]%
set a077 dosubst("%*Y %*Z", '1992/5/5')
msg [a077]%
set a078 easterdate(today())
set a079 easterdate(1992)
@@ -278,4 +344,258 @@ set a082 slide('1991-03-01', 7, "Sat", "Sun")
set a083 slide('1991-04-01', -7, "Sat")
set a084 nonomitted('1991-03-01', '1991-03-13', "Sat", "Sun")
set a085 nonomitted('1991-03-24', '1991-04-01', "Sat")
REM 2010-09-03 +3 -4 UNTIL 2012-01-01 PRIORITY 7 *14 MSG foo
set a086 trigback()
set a087 trigdelta()
set a088 trigrep()
set a089 triguntil()
set a090 trigscanfrom()
set a091 trigfrom()
set a092 trigpriority()
set a093 trigtimedelta()
set a094 trigtimerep()
set a095 trigduration()
REM Mon Wed FROM 2010-09-03 ++3 --4 MSG foo
set a096 trigback()
set a097 trigdelta()
set a098 trigrep()
set a099 triguntil()
set a100 trigscanfrom()
set a101 trigfrom()
set a102 trigpriority()
set a103 trigtimedelta()
set a104 trigtimerep()
set a105 trigduration()
REM 2010-09-03 +3 -4 UNTIL 2012-01-01 PRIORITY 7 *14 AT 14:41 +15 *2 DURATION 213 MSG foo
set a106 trigback()
set a107 trigdelta()
set a108 trigrep()
set a109 triguntil()
set a110 trigscanfrom()
set a111 trigfrom()
set a112 trigpriority()
set a113 trigtimedelta()
set a114 trigtimerep()
set a115 trigduration()
REM Mon Wed FROM 2010-09-03 ++3 --4 AT 14:44 MSG foo
set a116 trigback()
set a117 trigdelta()
set a118 trigrep()
set a119 triguntil()
set a120 trigscanfrom()
set a121 trigfrom()
set a122 trigpriority()
set a123 trigtimedelta()
set a124 trigtimerep()
set a125 trigduration()
# Test adding TIME+TIME and DATETIME+TIME
set a126 11:00 + 3:00
set a127 23:00 + 5:30
set a128 '2018-02-03@10:00' + 6:45
set a129 23:30 + '2019-02-02@16:44'
# Multi-day reminder
REM 13 AT 16:00 DURATION 72:00 MSG 72-hour event
set a130 trigdate()
set a131 trigtime()
set a132 trigdatetime()
set a133 trigduration()
set a134 trigeventstart()
set a135 trigeventduration()
# These will issue errors
REM Mon OMIT Mon SKIP MSG Never ever ever...
REM Mon SATISFY [wkdaynum($T) == 3] MSG Nope nope...
# These will just silently not trigger
REM MAYBE-UNCOMPUTABLE Mon OMIT Mon SKIP MSG Never ever ever...
REM MAYBE-UNCOMPUTABLE Mon SATISFY [wkdaynum($T) == 3] MSG Nope nope...
dump
dump $aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
OMIT 2010-09-03 THROUGH 2010-09-15
OMIT December 25 MSG X
# Next should give a parse error
OMIT 26 Dec 2010 THROUGH 27 Dec 2010 MSG This is not legal
OMIT DUMP
# Regression test for bugfix in Hebrew calendar Adar jahrzeit
[_i(14, "Adar", today(), 5761)] MSG Purim
# Regression test for bug found by Larry Hynes
REM SATISFY [day(trigdate()-25) == 14] MSG Foo
# Check combo of SATISFY and long-duration events
REM 14 SATISFY [$Tw == 4] MSG Thursday, the 14th
REM 14 AT 16:00 DURATION 8:00 SATISFY [$Tw == 4] MSG Thursday, the 14th
REM 14 AT 16:00 DURATION 8:01 SATISFY [$Tw == 4] MSG Thursday, the 14th
REM 14 AT 16:00 DURATION 32:00 SATISFY [$Tw == 4] MSG Thursday, the 14th
REM 14 AT 16:00 DURATION 32:01 SATISFY [$Tw == 4] MSG Thursday, the 14th
REM 14 AT 16:00 DURATION 40:00 SATISFY [$Tw == 4] MSG Thursday, the 14th
# This is now an error
REM DURATION 15:00 MSG Should fail... need AT if you have DURATION.
# Parsing of AM/PM times
REM AT 0:00am MSG foo 0a
REM AT 1:00AM MSG foo 1a
REM AT 2:00am MSG foo 2a
REM AT 3:00AM MSG foo 3a
REM AT 4:00am MSG foo 4a
REM AT 5:00AM MSG foo 5a
REM AT 6:00am MSG foo 6a
REM AT 7:00AM MSG foo 7a
REM AT 8:00am MSG foo 8a
REM AT 9:00AM MSG foo 9a
REM AT 10:00am MSG foo 10a
REM AT 11:00AM MSG foo 11a
REM AT 12:00am MSG foo 12a
REM AT 13:00AM MSG foo 13a
REM AT 0:00pm MSG foo 0p
REM AT 1:00PM MSG foo 1p
REM AT 2:00pm MSG foo 2p
REM AT 3:00PM MSG foo 3p
REM AT 4:00pm MSG foo 4p
REM AT 5:00PM MSG foo 5p
REM AT 6:00pm MSG foo 6p
REM AT 7:00PM MSG foo 7p
REM AT 8:00pm MSG foo 8p
REM AT 9:00PM MSG foo 9p
REM AT 10:00pm MSG foo 10p
REM AT 11:00PM MSG foo 11p
REM AT 12:00pm MSG foo 12p
REM AT 13:00PM MSG foo 13p
DEBUG +x
SET x 0:00am + 0
SET x 1:00AM + 0
SET x 2:00am + 0
SET x 3:00AM + 0
SET x 4:00am + 0
SET x 5:00AM + 0
SET x 6:00am + 0
SET x 7:00AM + 0
SET x 8:00am + 0
SET x 9:00AM + 0
SET x 10:00am + 0
SET x 11:00AM + 0
SET x 12:00am + 0
SET x 13:00AM + 0
SET x 0:00pm + 0
SET x 1:00PM + 0
SET x 2:00pm + 0
SET x 3:00PM + 0
SET x 4:00pm + 0
SET x 5:00PM + 0
SET x 6:00pm + 0
SET x 7:00PM + 0
SET x 8:00pm + 0
SET x 9:00PM + 0
SET x 10:00pm + 0
SET x 11:00PM + 0
SET x 12:00pm + 0
SET x 13:00PM + 0
SET x '2015-02-03@0:00am' + 0
SET x '2015-02-03@1:00AM' + 0
SET x '2015-02-03@2:00am' + 0
SET x '2015-02-03@3:00AM' + 0
SET x '2015-02-03@4:00am' + 0
SET x '2015-02-03@5:00AM' + 0
SET x '2015-02-03@6:00am' + 0
SET x '2015-02-03@7:00AM' + 0
SET x '2015-02-03@8:00am' + 0
SET x '2015-02-03@9:00AM' + 0
SET x '2015-02-03@10:00am' + 0
SET x '2015-02-03@11:00AM' + 0
SET x '2015-02-03@12:00am' + 0
SET x '2015-02-03@13:00AM' + 0
SET x '2015-02-03@0:00pm' + 0
SET x '2015-02-03@1:00PM' + 0
SET x '2015-02-03@2:00pm' + 0
SET x '2015-02-03@3:00PM' + 0
SET x '2015-02-03@4:00pm' + 0
SET x '2015-02-03@5:00PM' + 0
SET x '2015-02-03@6:00pm' + 0
SET x '2015-02-03@7:00PM' + 0
SET x '2015-02-03@8:00pm' + 0
SET x '2015-02-03@9:00PM' + 0
SET x '2015-02-03@10:00pm' + 0
SET x '2015-02-03@11:00PM' + 0
SET x '2015-02-03@12:00pm' + 0
SET x '2015-02-03@13:00PM' + 0
# Test the ampm function
set x ampm(0:12) + ""
set x ampm(1:12) + ""
set x ampm(2:12) + ""
set x ampm(3:12) + ""
set x ampm(4:12) + ""
set x ampm(5:12) + ""
set x ampm(6:12) + ""
set x ampm(7:12) + ""
set x ampm(8:12) + ""
set x ampm(9:12) + ""
set x ampm(10:12) + ""
set x ampm(11:12) + ""
set x ampm(12:12) + ""
set x ampm(13:12) + ""
set x ampm(14:12) + ""
set x ampm(15:12) + ""
set x ampm(16:12) + ""
set x ampm(17:12) + ""
set x ampm(18:12) + ""
set x ampm(19:12) + ""
set x ampm(20:12) + ""
set x ampm(21:12) + ""
set x ampm(22:12) + ""
set x ampm(23:12) + ""
# Coerce with am/pm
set x coerce("TIME", "12:45am")
set x coerce("TIME", "12:45")
set x coerce("TIME", "1:45pm")
set x coerce("DATETIME", "2020-05-05@12:45am")
set x coerce("DATETIME", "2020-05-05@12:45")
set x coerce("DATETIME", "2020-05-05@1:45pm")
# Overflow - these tests only work on machines with 32-bit
# twos-complement signed integers. You may get test failures on
# machines with different architectures.
set a $IntMin - 1
set a $IntMin - $IntMax
set a $IntMax - $IntMin
set a $IntMax - (-1)
set a $IntMax + 1
set a $IntMax + $IntMax
set a $IntMin + (-1)
set a $IntMin + $IntMin
set a $IntMax * 2
set a $IntMax * $IntMax
set a $IntMax * $IntMin
set a $IntMin * 2
set a $IntMin * $IntMin
set a $IntMin * $IntMax
set a $IntMin / (-1)
set a $IntMin * (-1)
set a (-1) * $IntMin
set a abs($IntMin)
# Shellescape
set a shellescape(" !\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~")
msg [a]
# Don't want Remind to queue reminders
EXIT
__EOF__
REM This line should not even be seen
And you can put whatever you like here.
[+f=asdfasdasde3ir0a]

View File

@@ -11,8 +11,7 @@
# Use the output to verify your translations.
#
# This file is part of REMIND.
# Copyright (C) 1992-1997 David F. Skoll
# Copyright (C) 1999-2000 Roaring Penguin Software Inc.
# Copyright (C) 1992-2018 Dianne Skoll
#
# ---------------------------------------------------------------------------
@@ -30,7 +29,7 @@ if !$RunOff || !$DontQueue || $DontTrigAts
endif
# Set up a few useful definitions
fset show(x) "%%" + x + " yields: " + char(34) + "%" + x + char(34) + "%"
fset show(x) "%%" + x + " yields: " + char(34) + "%" + x + char(34) + "% and %%*" + x + " yields: " + char(34) + "%*" + x + char(34) + "%"
set a trigger(today()+2) + " ++2"
set l language()
set tt now()+134

4
tests/utf-8.rem Normal file
View File

@@ -0,0 +1,4 @@
MSG ру́сский ру́сский ру́сский ру́сский ру́сский ру́сский ру́сский ру́сский
MSG עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית עִבְרִית
Wed MSG With tabs and spaces

View File

@@ -1,6 +1,6 @@
#!/bin/sh
echo "Unconfiguring Remind..."
echo rm -f config.cache config.log config.status src/Makefile src/config.h src/version.h
rm -f config.cache config.log config.status src/Makefile src/config.h src/version.h
echo rm -f config.cache config.log config.status src/Makefile src/config.h src/version.h www/Makefile rem2html/Makefile
rm -f config.cache config.log config.status src/Makefile src/config.h src/version.h www/Makefile rem2html/Makefile
exit 0

View File

@@ -1,11 +1,10 @@
# Makefile.in for installing WWW server calendar scripts
# This file is part of REMIND.
# Copyright (C) 1992-1997 by David F. Skoll
# Copyright (C) 1999-2007 by Roaring Penguin Software Inc.
# Copyright (C) 1992-2018 by Dianne Skoll
# The complete path to where the scripts actually live, as seen by
# the UNIX operating system.
SCRIPTDIR = /var/www/cgi-bin
SCRIPTDIR = /usr/lib/cgi-bin
# Where the scripts live as seen by the web browser.
CGIDIR = /cgi-bin
@@ -18,7 +17,7 @@ HTMLDIR = /var/www/remind
# Where you stick images and CSS files, as seen by UNIX
IMAGEDIR = /var/www/remind/resources
# Where images are, as seen by web browers
# Where images and CSS fiels are, as seen by web browers
IMAGEBASE = /remind/resources
# Set by configure - don't touch.
@@ -33,7 +32,7 @@ datarootdir=@datarootdir@
# Where do Remind and Rem2PS executables live?
REMIND = $(bindir)/remind
REM2PS = $(bindir)/rem2ps
REM2HTML = $(bindir)/rem2html
# If your Web server requires CGI programs to have a .cgi suffix, use
# the next line. Otherwise, comment it out
CGISUFFIX=.cgi
@@ -47,14 +46,8 @@ SEDSCRIPT = -e 's@%CGIDIR%@$(CGIDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%IMAGEBASE%@$(IMAGEBASE)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' \
-e 's@%REM2HTML%@$(REM2HTML)@g' \
-e 's@cal_dispatch@cal_dispatch$(CGISUFFIX)@g' \
-e 's@rem2html@rem2html$(CGISUFFIX)@g'
SEDSCRIPT2 = -e 's@%CGIDIR%@$(CGIDIR)@g' \
-e 's@%SCRIPTDIR%@$(SCRIPTDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%IMAGEBASE%@$(IMAGEBASE)@g' \
-e 's@%REM2PS%@$(REM2PS)@g'
all:
@echo "Edit the Makefile; then type 'make install' to install"
@@ -70,29 +63,24 @@ install:
sed $(SEDSCRIPT) < moon.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/moon.rem
sed $(SEDSCRIPT) < sunrise.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunrise.rem
sed $(SEDSCRIPT) < sunset.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/sunset.rem
cp blank.rem $(DESTDIR)$(SCRIPTDIR)/blank.rem
sed $(SEDSCRIPT) < calendar.html-DIST > $(DESTDIR)$(HTMLDIR)/calendar.html
sed $(SEDSCRIPT) < hebhtml > $(DESTDIR)$(SCRIPTDIR)/hebhtml
sed $(SEDSCRIPT2) < rem2html > $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
chmod 644 $(DESTDIR)$(SCRIPTDIR)/sunrise.rem
chmod 644 $(DESTDIR)$(SCRIPTDIR)/moon.rem
chmod 644 $(DESTDIR)$(SCRIPTDIR)/hebdate.rem
chmod 644 $(DESTDIR)$(SCRIPTDIR)/sunset.rem
chmod 644 $(DESTDIR)$(SCRIPTDIR)/blank.rem
chmod 644 $(DESTDIR)$(HTMLDIR)/calendar.html
chmod 755 $(DESTDIR)$(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
chmod 755 $(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
chmod 755 $(DESTDIR)$(SCRIPTDIR)/calps $(DESTDIR)$(SCRIPTDIR)/hebdate \
$(DESTDIR)$(SCRIPTDIR)/hebps $(DESTDIR)$(SCRIPTDIR)/moon \
$(DESTDIR)$(SCRIPTDIR)/sunrise $(DESTDIR)$(SCRIPTDIR)/sunset \
$(DESTDIR)$(SCRIPTDIR)/hebhtml \
$(DESTDIR)$(SCRIPTDIR)/rem2html$(CGISUFFIX)
-mkdir -p $(DESTDIR)$(IMAGEDIR)
cp firstquarter.png fullmoon.png lastquarter.png newmoon.png rem-default.css $(DESTDIR)$(IMAGEDIR)
chmod 644 $(DESTDIR)$(IMAGEDIR)/firstquarter.png \
$(DESTDIR)$(IMAGEDIR)/fullmoon.png \
$(DESTDIR)$(IMAGEDIR)/lastquarter.png \
$(DESTDIR)$(IMAGEDIR)/newmoon.png \
$(DESTDIR)$(IMAGEDIR)/rem-default.css
cp rem-default.css *.png $(DESTDIR)$(IMAGEDIR)
chmod 644 $(DESTDIR)$(IMAGEDIR)/rem-default.css $(DESTDIR)$(IMAGEDIR)/*.png

View File

@@ -9,7 +9,7 @@ only tested it with Linux running NCSA's httpd and Apache's httpd, but
it should work on any UNIX web server.
To install it, you need the Remind package, available via ftp from
ftp://ftp.doe.carleton.ca/pub/remind-3.0. You should install Remind,
https://dianne.skoll.ca/projects/remind/ You should install Remind,
setting the lattitude, longitude, location and time zone as appropriate
for your machine.
@@ -19,9 +19,7 @@ server:
1) Edit the Makefile in this directory. See the comments in the Makefile
for details.
2) Edit the first line of "rem2html" to reflect the location of
Perl on your system. (Oh yeah, you need Perl for the
HTML Hebrew calendar...)
2) Make sure "rem2html" is installed.
3) Type "make install"
@@ -38,12 +36,8 @@ where "what" is one of:
hebps -- get a PostScript calendar with Jewish holidays.
hebhtml -- get an HTML version of the above (requires Perl.)
(Visit http://www.doe.carleton.ca/~dfs/ for previews.)
All of these links will be set up in a sample HTML document
called "calendar.html" and installed in the HTMLDIR you specified
in the Makefile.
4) Enjoy!

View File

@@ -1,13 +0,0 @@
REM2HTML
--------
Rem2HTML is a Perl script that transforms the output of `remind -p
...' to HTML. Type `perl rem2html --help' for usage information.
Typical usage: remind -p ~/.reminders | rem2html > file.html
You may have to edit the "#!/usr/bin/perl" line to reflect the
location of your Perl interpreter.
--
David F. Skoll

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