Compare commits

..

54 Commits

Author SHA1 Message Date
Dianne Skoll
b86245c4c6 Fix wording. 2024-03-25 10:24:39 -04:00
Dianne Skoll
499fcfad41 Fix typo 2024-03-25 10:24:20 -04:00
Dianne Skoll
bddbbf061b Update changelog. 2024-03-25 10:21:05 -04:00
Dianne Skoll
05136f4cf0 Add a basic CSS file for the demo WWW stuff. 2024-03-25 10:12:46 -04:00
Dianne Skoll
e62e3d5d03 More multitrig examples. 2024-03-24 11:05:15 -04:00
Dianne Skoll
595fdaa4a4 Increment version to 04.03.04. 2024-03-24 10:54:44 -04:00
Dianne Skoll
133febc2c1 Document that you can't have an AT clause in a multitrig trigger. 2024-03-24 10:50:21 -04:00
Dianne Skoll
f8c6d7ff6c Document multitrig. 2024-03-24 10:46:53 -04:00
Dianne Skoll
db3341db91 Fix bug in code that stripes the Queue... output grey and white. 2024-03-23 10:57:56 -04:00
Dianne Skoll
8cbcd3ec01 Show Hebrew dates on PDF version of Jewish holiday calendar. 2024-03-22 17:38:30 -04:00
Dianne Skoll
4c6512e9b6 Update the HTML remind demo. 2024-03-22 17:26:23 -04:00
Dianne Skoll
4769789a8f More common HTML path. 2024-03-22 17:14:13 -04:00
Dianne Skoll
b4a8cb085c Add "blank PDF calendar" to www choices. 2024-03-22 17:13:21 -04:00
Dianne Skoll
4f816d52fd Another test for multitrig / scanfrom interaction. 2024-03-22 12:40:50 -04:00
Dianne Skoll
94b3a0248d Add tests for multitrig 2024-03-22 12:39:58 -04:00
Dianne Skoll
5fbf1d82e4 Remove duplicated line. 2024-03-22 11:23:04 -04:00
Dianne Skoll
55eb3ebe95 Add multitrig built-in function which is how trig() should originally have been done. 2024-03-22 11:21:26 -04:00
Dianne Skoll
2afa3c5558 Raise windows after errors so they remain visible. 2024-03-21 16:08:18 -04:00
Dianne Skoll
30d9a42db2 Remove debugging statement. 2024-03-21 12:39:48 -04:00
Dianne Skoll
74d357b84d Use placeholders that are less likely to be used as filenames. :) 2024-03-21 12:22:43 -04:00
Dianne Skoll
09c98a93ec Fix month navigation. 2024-03-21 12:19:39 -04:00
Dianne Skoll
ed89ab7c04 Remove unnecessary code and variable. 2024-03-21 12:13:32 -04:00
Dianne Skoll
27c74be02b Don't need to monitor reminder file for changes; reap zombies. 2024-03-21 12:11:39 -04:00
Dianne Skoll
8f22ab39dc Apply POSIX-escaping to filenames. 2024-03-21 11:46:29 -04:00
Dianne Skoll
795c53f4ce Format queue items better; make them clickable to open an editor. 2024-03-21 11:02:07 -04:00
Dianne Skoll
3fd18a9cc0 Document clickable errors. 2024-03-21 10:45:32 -04:00
Dianne Skoll
a5afb4a87e In the "show errors" text box, fire up the editor when you click on an error if we can figure out the filename and line number. 2024-03-20 20:53:19 -04:00
Dianne Skoll
379fc4542d Make errors stand out more obviously. 2024-03-20 20:33:46 -04:00
Dianne Skoll
538ef6c8ce Check for both $CalMode and $PsCal 2024-03-20 16:32:02 -04:00
Dianne Skoll
95c7e8856c Add standard "moonphases.rem" file with moon phases. 2024-03-20 16:28:50 -04:00
Dianne Skoll
95523c8f10 Convert cosd() function into a macro. 2024-03-19 16:26:07 -04:00
Dianne Skoll
97b53d5e40 Fix typo 2024-03-18 11:18:46 -04:00
Dianne Skoll
fb688850b1 Update release notes. 2024-03-18 11:11:16 -04:00
Dianne Skoll
5b1bad2650 Document DEL server command and qid value. 2024-03-16 15:50:58 -04:00
Dianne Skoll
e5ff132c5e Remove all traces of tk_dialog 2024-03-16 15:45:29 -04:00
Dianne Skoll
a0830ad23c Bump version to 04.03.03 2024-03-16 15:27:34 -04:00
Dianne Skoll
9290f53466 Fix typo 2024-03-16 15:24:11 -04:00
Dianne Skoll
e5711032bd Keep reading inotify events until 0.2 seconds elapses between successive events. 2024-03-16 15:22:48 -04:00
Dianne Skoll
08e3c1d5a2 Use tk_messageBox instead of tk_dialog. 2024-03-16 15:22:36 -04:00
Dianne Skoll
29c579a301 Refactor some code. 2024-03-16 14:01:21 -04:00
Dianne Skoll
61f55bceee Fix "Delete this reminder completely" functionality. 2024-03-16 13:56:28 -04:00
Dianne Skoll
6586fae3eb Fix logic bug that would sometimes fail to send a queue update message to controlling process. 2024-03-16 13:36:24 -04:00
Dianne Skoll
d5a86f3e4f Actually de-queue and free reminders that expire out of the queue. 2024-03-16 13:29:59 -04:00
Dianne Skoll
96551ccaa4 Make TkRemind use the "DEL qid" facility to ignore reminders. Fix potential use of freed memory in queue.c 2024-03-16 13:25:47 -04:00
Dianne Skoll
c83ee86d10 Implement DEL command to removed a queued reminder from the queue in -zj mode. 2024-03-16 12:54:30 -04:00
Dianne Skoll
c913306cbd Add "qid" member to JSONQUEUE. 2024-03-16 11:17:28 -04:00
Dianne Skoll
03d385df97 Add a test for the "-ds" debugging flag. 2024-03-13 12:17:49 -04:00
Dianne Skoll
61fcc1b275 Add "s" debugging flag to see expression-parsing stack high-water marks.
Reduce default value stack size from 1000 to 100.
2024-03-13 12:06:55 -04:00
Dianne Skoll
26977a4ac0 Fix a bunch of cppcheck complaints and also update the cppcheck Makefile target. 2024-03-11 12:10:03 -04:00
Dianne Skoll
28acd05215 Better icon. 2024-03-08 14:28:19 -05:00
Dianne Skoll
be4eed8b20 Update TkRemind logo to include a white outline. 2024-03-07 15:36:31 -05:00
Dianne Skoll
cdb0850373 Add a comment to the troff source so it doesn't confuse Emacs syntax highlighting. 2024-03-03 14:55:40 -05:00
Dianne Skoll
0d55e04284 Make a local OMIT that doesn't specify a weekday name into a syntax error. 2024-03-03 14:51:53 -05:00
Dianne Skoll
f4cce54b70 Warn if a local OMIT doesn't actually omit any weekdays. 2024-03-03 11:00:35 -05:00
48 changed files with 860 additions and 329 deletions

View File

@@ -53,7 +53,7 @@ proc SetConfigDefaults {} {
# Pops up an error dialog; then calls exit.
#***********************************************************************
proc Bail { msg } {
tk_dialog .err "Remind Configuration Error" $msg error 0 "Bummer"
tk_messageBox -message "Remind Build Error" -detail $msg -icon error -type ok
exit 1
}

2
configure vendored
View File

@@ -4225,7 +4225,7 @@ then :
fi
VERSION=04.03.02
VERSION=04.03.04

View File

@@ -88,7 +88,7 @@ if test "$?" != 0 ; then
fi
AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups inotify_init1)
VERSION=04.03.02
VERSION=04.03.04
AC_SUBST(VERSION)
AC_SUBST(PERL)
AC_SUBST(PERLARTIFACTS)

View File

@@ -95,7 +95,7 @@ Norman Walsh.
#!/usr/local/bin/wish
wm withdraw .
after 15000 { destroy . ; exit }
tk_dialog .d { Message } $argv warning 0 { OK }
tk_messageBox -message Message -detail $argv -icon info -type ok
destroy .
exit
-------------- Cut Here ---------- Cut Here ---------- Cut Here -------------

View File

@@ -1,5 +1,63 @@
CHANGES TO REMIND
* VERSION 4.3 Patch 4 - 2024-03-25
* NEW FEATURE: remind: Add the new "multitrig" function, which is how "trig"
should have worked in the first place. See man page for details.
* IMPROVEMENT: tkremind: Make errors in your reminders file stand out more
prominently.
* IMPROVEMENT: tkremind: If you click on an error in the "Errors..." popup,
tkremind will open a text editor on the offending file and line.
* IMPROVEMENT: tkremind: Format the "Queue..." output better and make queue
items clickable; clicking on a queue item opens a text editor on the
corresponding file and line.
* IMPROVEMENT: Add a standard [$SysInclude]/moonphases.rem file to display
moon phases on your calendar.
* IMPROVEMENT: Clean up the demo code in www/ and add PDF output.
* BUG FIX: tkremind: Correctly handle filenames containing spaces and other
characters that tend to confuse the shell.
* BUG FIX: tkremind: Raise dialog boxes after errors so that they
remain visible.
* CLEANUP: tkremind: Remove some dead code.
* VERSION 4.3 Patch 3 - 2024-03-18
* IMPROVEMENT: tkremind: Update icon to include a white border so it shows
up better on dark backgrounds.
* IMPROVEMENT: C code: Fix a number of cppcheck static-analysis warnings.
* IMPROVEMENT: remind: Update the "-zj" protocol to include a queue-id for
each queued reminder and add the DEL client command to delete a specific
item from the queue. Used by tkremind to implement "don't remind me about
this again today."
* MINOR NEW FEATURE: Add a "-ds" debugging flag to print out expression-parsing
stack high-water marks on exit. This esoteric feature is of no use to
anyone but the Remind author.
* IMPROVEMENT: tkremind: Stop using the deprecated tk_dialog command in favor
of the newer tk_messageBox command.
* IMPROVEMENT: remind: In server mode, try to minimize redraws by
consuming inotify events until at least 0.2s elapses without an
event appearing.
* BUG FIX: tkremind: The "Don't remind me about this again today" feature
was unreliable and only worked for reminders created with TkRemind itself.
It has been made more reliable and works with any reminder.
* BUG FIX: remind: Make it a syntax error if a local OMIT in a REM statement
is not followed by at least one weekday name.
* VERSION 4.3 Patch 2 - 2024-03-01
- BUG FIX: remind: Fix a logic error when implementing the RUN command in

14
include/moonphases.rem Normal file
View File

@@ -0,0 +1,14 @@
# Moon phases
# SPDX-License-Identifier: GPL-2.0-only
IF $CalMode || $PsCal
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)]
ELSE
REM NOQUEUE [moondatetime(0)] MSG New Moon (%2)
REM NOQUEUE [moondatetime(1)] MSG First Quarter (%2)
REM NOQUEUE [moondatetime(2)] MSG Full Moon (%2)
REM NOQUEUE [moondatetime(3)] MSG Last Quarter (%2)
ENDIF

View File

@@ -66,7 +66,7 @@ causes \fBRemind\fR to display reminders on the calendar on the
day they actually occur \fIas well as\fR on any preceding days
specified by the reminder's \fIdelta\fR. This \fIalso\fR causes
\fBRemind\fR to include text outside %"...%" sequences that would
otherwise be removed (though the actual %" markers themselves are removed.)
otherwise be removed (though the actual %" markers themselves are removed.) \"" Add comment to avoid Emacs highlighting problems
.TP
.B 'l'
causes \fBRemind\fR to use VT100 line-drawing characters to draw
@@ -300,6 +300,11 @@ Echo lines when displaying error messages
.TP
.B f
Trace the reading of reminder files
.TP
.B s
Upon exit, print the high-water mark of the operator and value stacks
used for expression-parsing. This is unlikely to be useful unless
you're intimately familiar with Remind's source code.
.RE
.TP
\fB\-g\fR[\fBa|d\fR[\fBa|d\fR[\fBa|d\fR[\fBa|d\fR]]]]
@@ -3350,6 +3355,62 @@ which default to \fBtoday()\fR and midnight, respectively. The returned
value is an integer from 0 to 359, representing the phase of the moon
in degrees. 0 is a new moon, 180 is a full moon, 90 is first-quarter, etc.
.TP
.B multitrig(s_trig1 [,s_trig2, [... s_trigN]])
\fBmultitrig\fR evaluates each string as a trigger, similar to \fBevaltrig\fR,
and returns the \fIearliest\fR trigger date that is on or after \fBtoday()\fR.
\fBmultitrig\fR is similar to \fBtrig\fR but has the following difference:
.RS
.PP
\fBtrig\fR returns the \fIfirst\fR trigger date that would have triggered today,
whereas \fBmultitrig\fR returns the \fIearliest\fR trigger date later than
today, regardless of whether it would have triggered today.
.PP
If no trigger can be computed that is later than \fBtoday()\fR, then
\fBmultitrig\fR returns 1990-01-01.
.PP
Consider the following examples, assuming that today is Sunday, 24 March 2024:
.PP
.nf
# Returns 1990-01-01 because neither would trigger today
SET a trig("Mon", "Wed")
# Returns 2024-03-25 because it's the earlier trigger date
SET a multitrig("Mon", "Wed")
# Returns 2024-03-27 because it's the first that would trigger today
SET a trig("Wed +3", "Mon +3")
# Returns 2024-03-25 because it's the earlier trigger date
SET a multitrig("Wed +3", "Mon +3")
# Returns 1990-01-01 because all triggers have expired
SET a multitrig("2000", "2022", "1998", "2023")
.fi
.PP
In general, \fBmultitrig\fR works better with the Remind algorithm than
\fBtrig\fR and should be used most of the time. As an example, this
reminder is issued at the end of each quarter:
.PP
.nf
REM [multitrig("Mar 31", "Jun 30", "Sep 30", "Dec 31")] +7 MSG \\
%"End of [ord($Tm/3)] quarter%" is %b.
.fi
.PP
If you want the last working day of each quarter, you could use:
.PP
.nf
PUSH-OMIT-CONTEXT
OMIT Sat Sun
REM [multitrig("Mar ~1", "Jun ~1", "Sep ~1", "Dec ~1")] +7 MSG \\
%"Last working day of [ord($Tm/3)] quarter%" is %b.
POP-OMIT-CONTEXT
.fi
.PP
Note that unlike \fBevaltrig\fR, \fBmultitrig\fR always returns a \fBDATE\fR
and never a \fBDATETIME\fR. Including an \fBAT\fR clause in a trigger
supplied to \fBmultitrig\fR will result in an error.
.RE
.TP
.B ndawn([dq_date])
Returns the time of "nautical dawn" on the specified \fIdate\fR. If
\fIdate\fR is omitted, defaults to \fBtoday()\fR. If a \fIdatetime\fR object
@@ -5363,7 +5424,7 @@ as:
.PP
You can define your own substitution sequences in addition to the built-in
ones as follows: If you define a function named \fBsubst_\fIname\fB(alt, date, time)\fR, then the sequence \fB%{name}\fR calls the function with \fBalt\fR
set to 0 and \fBdate\fR and \fRtime\fR to the trigger date and time,
set to 0 and \fBdate\fR and \fBtime\fR to the trigger date and time,
respectively. The \fB%{name}\fR sequence is replaced with whatever the
function returns. The sequence \fB%*{name}\fR is similar, but calls
the function with \fBalt\fR set to 1.

View File

@@ -184,7 +184,9 @@ on the reminder.
If there are any errors in your reminder file, the "Queue..." button
changes to "Errors...". Click on "Errors..." to see the Remind error
output. Click "OK" to close the error window; this makes the button
in the main TkRemind window to revert to "Queue..."
in the main TkRemind window to revert to "Queue..." You can click on
any error message to open an editor on the file and line number that
caused the error.
.SH BACKGROUND REMINDERS
@@ -403,6 +405,10 @@ like this:
The value of the \fBqueue\fR key is an array of JSON objects, each
representing a queued reminder.
.TP
DEL \fIqid\fR
Delete the reminder with queue-id \fIqid\fR from the queue.
.TP
REREAD
Re-read the reminder file. Returns the following status line:
@@ -419,15 +425,19 @@ Additional status lines written are as follows:
.TP
.nf
{"response":"reminder","ttime":tt,"now":now,"tags":tags,"body":body}
{"response":"reminder","ttime":tt,"now":now,"tags":tags,"qid":qid,"body":body}
.fi
In this line, \fItt\fR is the trigger time of the reminder (expressed
as a string), \fInow\fR is the current time, \fItags\fR (if present)
is the tag or tags associated with the reminder, and \fIbody\fR is
the body of the reminder. This response causes \fBTkRemind\fR to
pop up a reminder notification.
is the tag or tags associated with the reminder, and \fIbody\fR is the
body of the reminder. This response causes \fBTkRemind\fR to pop up a
reminder notification. \fIqid\fR is a unique identifier for this
reminder. You may delete it from the queue by sending a \fBDEL\fR
\fIqid\fR command to the server. Note that \fIqid\fRs are not stable
across re-reads; if \fBRemind\fR restarts itself to re-read the reminder
file, then the \fIqid\fR values are likely to change, and any reminder
deleted with a \fBDEL\fR \fIqid\fR command is likely to be re-queued.
.TP
.nf

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -29,69 +29,92 @@ set Hostname [exec hostname]
# Our icon photo
catch {
image create photo rpicon -data {
iVBORw0KGgoAAAANSUhEUgAAAEAAAABbCAYAAADDeIOGAAAACXBIWXMAAAu6AAALugFBTNueAAAA
GXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAADANJREFUeJzdnGtsFNcVx38Xr19r
4/BawjPGjcGY2MY8Q+1g05iXKwoihvAQoCJEQoiU0CofWgmpUhIJNVKpSGnUSGmKLEEihcZFQeBW
gRJeKQkQisFAsWDxGsdAawjgGGF7Tz/MrrvGuzN3ZmchzV8aeT17zj3n/u+5d87cxyoR4fsMpVQx
MBkYC+QDQ4DBQDtQ7XmEviUESqnBwAKgFHgaGAP0iRC5AWwDtojI1e8FAUqp4cBzwExgBpAVRexb
4E/AJhG52n1XRP4vL2Ag8DOgFmgDJMYVBPYCT0ct51FXJEbl+gLpMb77IbAZuGpS6fBVD6wys6W+
C4OgUiodeBGYC4zHaN1OoAU4CxzGaOVFwHR69ulo+Bb4HfCmiNw1lfwOtPY84AzWral7HQfKtO0/
4sqvA+66VPFO4PeA15YPj7Dyz4VC1Y3KtwIvOvLjEVW+CPi3TuUyMzOtZC4DJY59eQSVTwL26VR+
48aNcu/ePXn++edjyVwAiuPy5xEQ8Gvdlr97966IiLz99tvRZPzA2Hj9sXqcuAql1CLgVR3Ze/fu
ce7cOUSE/fv39/oaeFVEzsft1ENs+TwggI3BbcSIEVJcXBztu39iEFkBpGra7xtN9qEkQqFE568Y
SYzbuAU0YHQJP0aGeBODKICRQAHQCPxCHqzwQ2r93+BeomM3NzgC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hyo1WpEREQgIiICkZGRiIiIQFRUFKKiohAbG4vo6GiYTCYkJiYiKSkJQUHDPhCxBkBA
XlkR+oRGGoB/BLAEgAmDClN3dzeuXLkCh8OBjo4OdHZ2orOzc8Q9fz5CQ0Oh1+sxfvx4GAwGhIaG
Ijg4GImJiTAaRV/vGYDnwkMHgHsA6uExfd0E8J/yq+odUr8hkgTPm9nZAGbC84amAZ6vNI+D8LYa
8HTjAQBueMatG57bnF3wrOX34DnVqYOngjXwfAPULx1fKv4X5zAnLNolSeQAAAAASUVORK5CYII=}
wm iconphoto . -default rpicon
}
proc die_with_error { msg } {
tk_messageBox -message "Fatal Error" -detail $msg -icon error -type ok
exit 1
}
proc show_error { msg } {
tk_messageBox -message "Error" -detail $msg -icon error -type ok
}
proc missing_tcllib { pkg } {
catch { puts stderr "Could not find the '$pkg' package -- you must install tcllib.\nPlease see http://tcllib.sourceforge.net/" }
tk_dialog .err "Error: tcllib not installed" "Could not find the '$pkg' package -- you must install tcllib. Please see http://tcllib.sourceforge.net/" error 0 OK
tk_messageBox -message "Error: tcllib not installed" -detail "Could not find the '$pkg' package -- you must install tcllib. Please see http://tcllib.sourceforge.net/" -icon error -type ok
exit 1
}
if {[catch {package require mime}]} {
@@ -106,7 +129,7 @@ if {[catch {package require json}]} {
}
if {$tcl_platform(platform) == "windows"} {
tk_dialog .error Error "Please do not port Remind to Windows" error 0 OK
tk_messageBox -message "Please do not port Remind to Windows" -icon error -type ok
exit 1
}
@@ -301,14 +324,14 @@ set Option(PrintFormat) ps
set WarningHeaders [list "# Lines starting with REM TAG TKTAGnnn ... were created by tkremind" "# Do not edit them by hand or results may be unpredictable."]
# Highest tag seen so far. Array of tags is stored in ReminderTags()
# Highest tag seen so far.
set HighestTagSoFar 0
# Check Remind version
set ver [GetRemindVersion]
if {"$ver" < "04.03.00"} {
tk_dialog .error Error "This version of TkRemind requires Remind version 04.03.00 or newer; you have version $ver" error 0 OK
if {"$ver" < "04.03.03"} {
tk_messageBox -message "This version of TkRemind requires Remind version 04.03.03 or newer; you have version $ver" -icon error -type ok
exit 1
}
@@ -338,6 +361,21 @@ proc is_warning_header { line } {
return 0
}
proc extract_tag { regex tag } {
if {[regexp $regex $tag extracted]} {
return $extracted
}
return "*"
}
proc extract_tktag { tag } {
extract_tag {TKTAG[0-9]+} $tag
}
proc extract_syntag { tag } {
extract_tag {__syn__[0-9a-f]+} $tag
}
#***********************************************************************
# %PROCEDURE: Initialize
# %ARGUMENTS:
@@ -350,7 +388,7 @@ proc is_warning_header { line } {
#***********************************************************************
proc Initialize {} {
global DayNames argc argv CommandLine ReminderFile AppendFile Remind PSCmd
global MondayFirst TwentyFourHourMode ReminderFileModTime
global MondayFirst TwentyFourHourMode
global TodayDay TodayMonth TodayYear
global Option ConfigFile
@@ -362,8 +400,8 @@ proc Initialize {} {
set TodayYear [clock format $now -format %Y]
set TodayDay [string trim [clock format $now -format %e]]
set CommandLine "|$Remind -itkremind=1 -pp -y -l EXTRA"
set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp -l EXTRA"
set CommandLine "$Remind -itkremind=1 -pp -y -l @EXTRA@"
set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp -l @EXTRA@"
set i 0
while {$i < $argc} {
if {[regexp -- {-[bgxim].*} [lindex $argv $i]]} {
@@ -404,8 +442,8 @@ proc Initialize {} {
# Check system sanity
if {! [file readable $ReminderFile]} {
set ans [tk_dialog .error "TkRemind: Warning" "Can't read reminder file `$ReminderFile'" warning 0 "Create it and continue" "Exit"]
if {$ans != 0} {
set ans [tk_messageBox -message "Can't read reminder file `$ReminderFile'. Create it and continue?" -type yesno -icon question]
if {$ans != "yes"} {
exit 1
}
catch {
@@ -416,7 +454,7 @@ proc Initialize {} {
}
}
if {! [file readable $ReminderFile]} {
tk_dialog .error "TkRemind: Error" "Could not create reminder file `$ReminderFile'" error 0 "Exit"
die_with_error "Could not create reminder file `$ReminderFile'"
exit 1
}
@@ -426,58 +464,21 @@ proc Initialize {} {
write_warning_headers $out
puts $out ""
close $out}]} {
tk_dialog .error "Created File" "Created blank file `$AppendFile'" info 0 "OK"
tk_messageBox -message "Created File" -detail "Created blank file `$AppendFile'" -icon info -type ok
}
}
if {! [file writable $AppendFile]} {
tk_dialog .error Error "Can't write reminder file `$AppendFile'" error 0 Ok
die_with_error "Can't write reminder file `$AppendFile'"
exit 1
}
append CommandLine " $ReminderFile"
append PSCmd " $ReminderFile"
append CommandLine " "
append CommandLine [posix_escape $ReminderFile]
append PSCmd " "
append PSCmd [posix_escape $ReminderFile]
# Get modification time of ReminderFile
set ReminderFileModTime -1
catch {
set ReminderFileModTime [file mtime $ReminderFile]
}
MonitorReminderFile
# puts "CommandLine: $CommandLine"
}
#---------------------------------------------------------------------------
# MonitorReminderFile
# If Reminder File modtime changes, restart daemon
#---------------------------------------------------------------------------
proc MonitorReminderFile {} {
global ReminderFileModTime ReminderFile
if {$ReminderFileModTime < 0} {
# Could not stat file
return
}
set mtime -1
catch {
set mtime [file mtime $ReminderFile]
}
if {$mtime < 0} {
# Doh!
return
}
# Run ourselves again
after 60000 MonitorReminderFile
# Redraw calendar and restart daemon if needed
if {$ReminderFileModTime < $mtime} {
set ReminderFileModTime $mtime
ScheduleUpdateForChanges
}
set CommandLine "|/bin/sh -c \"$CommandLine @MONTH@ @YEAR@\""
}
#***********************************************************************
@@ -982,7 +983,7 @@ proc WriteOptionsToFile {} {
global Option OptDescr
set problem [catch {set f [open "$ConfigFile.tmp" "w"]} err]
if {$problem} {
tk_dialog .error Error "Can't write $ConfigFile.tmp: $err" 0 OK
show_error "Can't write $ConfigFile.tmp: $err"
return
}
@@ -1081,8 +1082,11 @@ proc FillCalWindow {} {
set_button_to_queue
set month [lindex $MonthNames $CurMonth]
set cmd [regsub EXTRA $CommandLine $Option(ExtraRemindArgs)]
set file [open "$cmd $month $CurYear" r]
set cmd [regsub @EXTRA@ $CommandLine $Option(ExtraRemindArgs)]
set cmd [regsub @MONTH@ $cmd $month]
set cmd [regsub @YEAR@ $cmd $CurYear]
set file [open $cmd r]
# Look for # rem2ps2 begin line
while { [gets $file line] >= 0 } {
if { [string compare "$line" "# rem2ps2 begin"] == 0 } { break }
@@ -1396,29 +1400,30 @@ proc DoPrint {} {
WriteOptionsToFile
if {$Option(PrintDest) == "file"} {
if {$fname == ""} {
tk_dialog .error Error "No filename specified" error 0 Ok
show_error "No filename specified"
return
}
if {[file isdirectory $fname]} {
tk_dialog .error Error "$fname is a directory" error 0 Ok
show_error "$fname is a directory"
return
}
if {[file readable $fname]} {
set ans [tk_dialog .error Overwrite? "Overwrite $fname?" question 0 No Yes]
if {$ans == 0} {
set ans [tk_messageBox -message "Overwrite?" -detail "Overwrite $fname?" -icon question -type yesno]
if {$ans == no} {
return
}
}
set fname [posix_escape $fname]
set fname "> $fname"
} else {
set fname "| $cmd"
}
if {$HaveRem2PDF && $Option(PrintFormat) == "pdf"} {
set p [regsub EXTRA $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set p [regsub @EXTRA@ $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF"
} else {
set p [regsub EXTRA $PSCmd $Option(ExtraRemindArgs)]
set p [regsub @EXTRA@ $PSCmd $Option(ExtraRemindArgs)]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PS"
set Option(PrintFormat) ps
}
@@ -1487,7 +1492,7 @@ proc DoPrint {} {
append cmd " $fname"
Status "Printing..."
if {[catch {eval "exec $cmd"} err]} {
if {[catch {exec /bin/sh "-c" $cmd} err]} {
set RemindErrors [unique_lines $err]
set_button_to_errors
}
@@ -1506,6 +1511,7 @@ proc PrintFileBrowse {} {
.p.filename icursor end
.p.filename xview end
}
raise .p
}
#---------------------------------------------------------------------------
@@ -1557,11 +1563,13 @@ proc DoGoto {} {
global CurYear CurMonth MonthNames
set year [.g.y.e get]
if { ! [regexp {^[0-9]+$} $year] } {
tk_dialog .error Error {Illegal year specified (1990-5990)} error 0 Ok
show_error {Illegal year specified (1990-5990)}
raise .g
return
}
if { $year < 1990 || $year > 5990 } {
tk_dialog .error Error {Illegal year specified (1990-5990)} error 0 Ok
show_error {Illegal year specified (1990-5990)}
raise .g
return
}
set month [lsearch -exact $MonthNames [.g.mon cget -text]]
@@ -1581,7 +1589,8 @@ proc Quit {} {
StopBackgroundRemindDaemon
exit 0
}
if { [tk_dialog .question "Confirm..." {Really quit?} question 0 No Yes] } {
set ans [tk_messageBox -message "Really quit?" -icon question -type yesno]
if { $ans == "yes" } {
destroy .
StopBackgroundRemindDaemon
exit 0
@@ -2018,7 +2027,7 @@ proc CreateYearMenu {w {every 1}} {
# firstDay -- first weekday in month (0-6)
#---------------------------------------------------------------------------
proc ModifyDay {d firstDay} {
global ModifyDialogResult AppendFile HighestTagSoFar ReminderTags
global ModifyDialogResult AppendFile HighestTagSoFar
catch {destroy .mod}
toplevel .mod
CreateModifyDialog .mod $d $firstDay "Cancel" "Add to reminder file" "Preview reminder"
@@ -2039,7 +2048,8 @@ proc ModifyDay {d firstDay} {
}
set problem [catch {set rem [CreateReminder .mod]} err]
if {$problem} {
tk_dialog .error Error "$err" error 0 Ok
show_error $err
raise .mod
} else {
if {$ModifyDialogResult == 3} {
set rem [EditReminder $rem Cancel "Add reminder"]
@@ -2053,7 +2063,6 @@ proc ModifyDay {d firstDay} {
Status "Writing reminder..."
set f [open $AppendFile a]
incr HighestTagSoFar
set ReminderTags($HighestTagSoFar) 1
WriteReminder $f TKTAG$HighestTagSoFar $rem $opts
close $f
@@ -2066,7 +2075,6 @@ proc ModifyDay {d firstDay} {
#---------------------------------------------------------------------------
# CenterWindow -- center a window on the screen or over a parent.
# Stolen from tk_dialog code
# Arguments:
# w -- window to center
# parent -- window over which to center. Defaults to screen if not supplied.
@@ -2581,8 +2589,9 @@ proc BrowseForFileRead {w {dir ""}} {
if {$dir == ""} {
set dir [$w.cwd cget -text]
}
if {[catch "cd $dir" err]} {
tk_dialog .error Error "$err" error 0 Ok
if {[catch {cd $dir} err]} {
show_error "$err"
raise $w
return
}
$w.cwd configure -text [pwd]
@@ -2625,13 +2634,14 @@ proc BrowseForFileRead {w {dir ""}} {
#---------------------------------------------------------------------------
proc StartBackgroundRemindDaemon {} {
global Remind DaemonFile ReminderFile Option TwentyFourHourMode
set fname [posix_escape $ReminderFile]
if {$TwentyFourHourMode} {
set problem [catch { set DaemonFile [open "|$Remind -b1 -zj -itkremind=1 $Option(ExtraRemindArgs) $ReminderFile" "r+"] } err]
set problem [catch { set DaemonFile [open "|/bin/sh -c \"$Remind -b1 -zj -y -itkremind=1 $Option(ExtraRemindArgs) $fname\"" "r+"] } err]
} else {
set problem [catch { set DaemonFile [open "|$Remind -zj -itkremind=1 $Option(ExtraRemindArgs) $ReminderFile" "r+"] } err]
set problem [catch { set DaemonFile [open "|/bin/sh -c \"$Remind -zj -y -itkremind=1 $Option(ExtraRemindArgs) $fname\"" "r+"] } err]
}
if {$problem} {
tk_dialog .error Error "Can't start Remind daemon in background: $err" error 0 OK
show_error "Can't start Remind daemon in background: $err"
} else {
fileevent $DaemonFile readable "DaemonReadable $DaemonFile"
puts $DaemonFile "STATUS"
@@ -2667,13 +2677,7 @@ proc StopBackgroundRemindDaemon {} {
# Restarts the background Remind daemon
#---------------------------------------------------------------------------
proc RestartBackgroundRemindDaemon {} {
global DaemonFile ReminderFile ReminderFileModTime
# Don't let the background handler trigger another reread
catch {
set mtime [file mtime $ReminderFile]
set ReminderFileModTime $mtime
}
global DaemonFile ReminderFile
catch {
puts $DaemonFile "REREAD"
@@ -2715,11 +2719,30 @@ proc ShowQueue { queue } {
if { $did > 0 } {
$w.t insert end "\n"
}
foreach r $q {
set fntag ""
catch {
set fname [dict get $q filename]
set lineno [dict get $q lineno]
set fntag [string cat "FILE_" $lineno "_" $fname]
}
if { "$fntag" != "" } {
$w.t tag bind $fntag <Enter> [list $w.t tag configure $fntag -underline 1]
$w.t tag bind $fntag <Leave> [list $w.t tag configure $fntag -underline 0]
$w.t tag bind $fntag <ButtonPress-1> [list FireEditor $w.t $fntag]
$w.t tag bind $fntag <ButtonPress-3> [list FireEditor $w.t $fntag]
}
foreach key [list time nexttime body] {
set r [dict get $q $key]
if { $toggle != 0 } {
$w.t insert end "$r " grey
$w.t insert end "$key=$r" [list grey $fntag]
if {"$key" != "body"} {
$w.t insert end "; " [list grey $fntag]
}
} else {
$w.t insert end "$r "
$w.t insert end "$key=$r" [list $fntag]
if {"$key" != "body"} {
$w.t insert end "; " [list $fntag]
}
}
}
$w.t insert end "\n"
@@ -2728,6 +2751,8 @@ proc ShowQueue { queue } {
}
if { $did == 0 } {
$w.t insert end "(Queue is empty)\n"
} else {
$w.t insert end "\n\nClick on a queue item to open an editor on the corresponding REM command.\n"
}
$w.t configure -state disabled
}
@@ -2764,7 +2789,7 @@ proc DaemonReadable { file } {
if {[catch {set obj [::json::json2dict $line]}]} {
return;
}
if (![dict exists $obj response]) {
if {![dict exists $obj response]} {
return;
}
set response [dict get $obj response]
@@ -2785,7 +2810,11 @@ proc DaemonReadable { file } {
set tag [dict get $obj tags]
}
set body [dict get $obj body]
IssueBackgroundReminder $body $time $now $tag
set qid "*"
if {[dict exists $obj qid]} {
set qid [dict get $obj qid]
}
IssueBackgroundReminder $body $time $now $tag $qid
}
"queue" {
set queue [dict get $obj queue]
@@ -2793,7 +2822,7 @@ proc DaemonReadable { file } {
}
"newdate" {
# Date has rolled over -- clear "ignore" list
catch { unset Ignore}
catch { unset Ignore }
Initialize
FillCalWindow
ShowTodaysReminders
@@ -2821,13 +2850,14 @@ proc DaemonReadable { file } {
# time -- time of reminder
# now -- current time according to Remind daemon
# tag -- tag for reminder, or "*" if no tag
# qid -- Queue-ID for reminder, or "*" if no qid
# Returns:
# nothing
# Description:
# Reads a background reminder from daemon and pops up window.
#---------------------------------------------------------------------------
proc IssueBackgroundReminder { body time now tag } {
global BgCounter Option Ignore
proc IssueBackgroundReminder { body time now tag qid } {
global BgCounter Option Ignore DaemonFile
if {$Option(Deiconify)} {
wm deiconify .
}
@@ -2837,9 +2867,16 @@ proc IssueBackgroundReminder { body time now tag } {
return
}
# Do nothing if user told us to ignore this reminder
if {[info exists Ignore($tag)]} {
return
# If we're ignoring it because of tag, ignore and delete
set syntag [extract_syntag $tag]
if {$syntag != "*"} {
if {[info exists Ignore($syntag)]} {
if {$qid != "*"} {
puts $DaemonFile "DEL $qid"
flush $DaemonFile
}
return
}
}
incr BgCounter
@@ -2852,20 +2889,26 @@ proc IssueBackgroundReminder { body time now tag } {
frame $w.b
# Automatically shut down window after a minute if option says so
set after_token [after 60000 [list ClosePopup $w "" $Option(MailAddr) $Option(AutoClose) "" $tag $body $time]]
set after_token [after 60000 [list ClosePopup $w "" $Option(MailAddr) $Option(AutoClose) "" $tag $body $time $qid]]
wm protocol $w WM_DELETE_WINDOW [list ClosePopup $w $after_token "" 1 "" $tag $body $time]
button $w.ok -text "OK" -command [list ClosePopup $w $after_token "" 1 "" $tag $body $time]
if {$tag != "*"} {
button $w.nomore -text "Don't remind me again today" -command [list ClosePopup $w $after_token "" 1 "ignore" $tag $body $time]
button $w.kill -text "Delete this reminder completely" -command [list ClosePopup $w $after_token "" 1 "kill" $tag $body $time]
wm protocol $w WM_DELETE_WINDOW [list ClosePopup $w $after_token "" 1 "" $tag $body $time $qid]
button $w.ok -text "OK" -command [list ClosePopup $w $after_token "" 1 "" $tag $body $time $qid]
set tktag [extract_tktag $tag]
if {$tktag != "*"} {
button $w.kill -text "Delete this reminder completely" -command [list ClosePopup $w $after_token "" 1 "kill" $tag $body $time $qid]
}
if {$qid != "*"} {
button $w.nomore -text "Don't remind me again today" -command [list ClosePopup $w $after_token "" 1 "ignore" $tag $body $time $qid]
}
pack $w.l -side top
pack $w.msg -side top -expand 1 -fill both
pack $w.b -side top
pack $w.ok -in $w.b -side left
if {$tag != "*"} {
pack $w.nomore $w.kill -in $w.b -side left
if {$qid != "*"} {
pack $w.nomore -in $w.b -side left
}
if {$tktag != "*"} {
pack $w.kill -in $w.b -side left
}
CenterWindow $w .
@@ -2959,7 +3002,7 @@ proc main {} {
# the tag array. Also adjusts HighestTagSoFar
#***********************************************************************
proc ScanForTags { fname } {
global HighestTagSoFar ReminderTags
global HighestTagSoFar
if {[catch { set f [open $fname "r"]}]} {
return
}
@@ -2970,7 +3013,6 @@ proc ScanForTags { fname } {
if {$tagno > $HighestTagSoFar} {
set HighestTagSoFar $tagno
}
set ReminderTags($tagno) 1
}
}
}
@@ -3286,6 +3328,12 @@ proc ReadTaggedOptions { tag date } {
}
return $ans
}
# Make a string safe for passing to shell.
proc posix_escape { str } {
return [string cat "'" [string map [list {'} {'\''}] $str] "'"]
}
proc FireEditor { w {fntag ""}} {
global Option
global EditorPid
@@ -3301,7 +3349,7 @@ proc FireEditor { w {fntag ""}} {
return
}
set editor $Option(Editor)
regsub -all "%s" $editor $file editor
regsub -all "%s" $editor [posix_escape $file] editor
regsub -all "%d" $editor $line editor
# Don't fire up a second editor if first is running
@@ -3457,7 +3505,7 @@ proc EditTaggedReminder { w } {
}
set problem [catch {set rem [CreateReminder .mod]} err]
if {$problem} {
tk_dialog .error Error "$err" error 0 Ok
show_error "$err"
continue
}
if {$ModifyDialogResult == 4} {
@@ -3477,7 +3525,7 @@ proc EditTaggedReminder { w } {
}
} err]
if {$problem} {
tk_dialog .error Error "Error: $err" error 0 Ok
show_error $err
return 1
}
@@ -3540,7 +3588,7 @@ proc UniqueFileName { stem } {
#***********************************************************************
proc DeleteTaggedReminder { tag } {
global AppendFile
global HighestTagSoFar
global HighestTagSoFar Ignore
set tmpfile [UniqueFileName $AppendFile]
set out [open $tmpfile "w"]
@@ -3549,12 +3597,14 @@ proc DeleteTaggedReminder { tag } {
set found 0
set tagno 0
set tktag [extract_tktag $tag]
set syntag [extract_syntag $tag]
set h 0
while {[gets $in line] >= 0} {
if {[is_warning_header $line]} {
continue
}
if {[string match "REM TAG $tag *" $line]} {
if {[string match "REM TAG $tktag *" $line]} {
set found 1
continue
}
@@ -3569,13 +3619,12 @@ proc DeleteTaggedReminder { tag } {
continue
}
# Renumber tags
if {[regexp {^REM TAG TKTAG([0-9]+) (.*)$} $line all oldtag rest]} {
incr tagno
puts $out "REM TAG TKTAG$tagno $rest"
} else {
puts $out $line
}
if {[regexp {^REM TAG TKTAG([0-9]+)} $line all tagno]} {
if {$tagno > $h} {
set h $tagno
}
}
puts $out $line
}
if {! $found } {
@@ -3585,9 +3634,13 @@ proc DeleteTaggedReminder { tag } {
error "Did not find reminder with tag $tag"
}
set HighestTagSoFar $tagno
if {$syntag != "*"} {
catch { unset Ignore($syntag) }
}
close $in
close $out
set HighestTagSoFar $h
file rename -force -- $tmpfile $AppendFile
}
@@ -3846,6 +3899,10 @@ proc CreateMoonWindows {} {
#***********************************************************************
proc DisplayTimeContinuously {} {
DisplayTime
# Reap any zombies
eval { exec true }
set secs [clock format [clock seconds] -format "%S"]
# Doh -- don't interpret as an octal number if leading zero
scan $secs "%d" decSecs
@@ -3920,8 +3977,8 @@ proc ShowTodaysReminders {} {
# Prompts for confirmation; then deletes reminder
#***********************************************************************
proc InteractiveDeleteReminder { tag } {
set ans [tk_dialog .error "Really Delete" "Really delete reminder?" warning 0 No Yes]
if {$ans == 1} {
set ans [tk_messageBox -message "Really Delete" -detail "Really delete reminder?" -icon question -type yesno]
if {$ans == yes} {
DeleteTaggedReminder $tag
ScheduleUpdateForChanges
}
@@ -3943,8 +4000,8 @@ proc SendMail { recipient subject body } {
}
}
proc ClosePopup { w after_token mail_addr close_win ignore_or_kill tag reminder rem_time } {
global Ignore
proc ClosePopup { w after_token mail_addr close_win ignore_or_kill tag reminder rem_time qid } {
global DaemonFile Ignore
if {"$after_token" != ""} {
catch { after cancel $after_token }
}
@@ -3957,10 +4014,20 @@ proc ClosePopup { w after_token mail_addr close_win ignore_or_kill tag reminder
SendMail $mail_addr "Reminder for $rem_time" "Hello,\n\nThe following reminder is scheduled for $rem_time:\n\n$reminder\nRegards,\n\nTkRemind\n"
}
if {"$ignore_or_kill" == "ignore"} {
set Ignore($tag) 1
if {$qid != "*"} {
set syntag [extract_syntag $tag]
if {$syntag != "*"} {
set Ignore($syntag) 1
}
puts $DaemonFile "DEL $qid"
flush $DaemonFile
}
}
if {"$ignore_or_kill" == "kill"} {
InteractiveDeleteReminder $tag
set tktag [extract_tktag $tag]
if {$tktag != "*"} {
InteractiveDeleteReminder $tag
}
}
}
@@ -4210,12 +4277,13 @@ proc update_color_buttons { w } {
}
proc set_button_to_queue {} {
global Option
balloon_set_help .b.queue "See the queue of pending reminders (debugging purposes only)"
.b.queue configure -text {Queue...} -command {DoQueue}
.b.queue configure -text {Queue...} -command {DoQueue} -foreground $Option(LabelColor) -background $Option(WinBackground)
}
proc set_button_to_errors {} {
balloon_set_help .b.queue "See the list of errors from the most recent operation"
.b.queue configure -text {Errors...} -command {ShowErrors}
.b.queue configure -text {Errors...} -command {ShowErrors} -bg #FF5555 -fg black
}
proc ShowErrors {} {
@@ -4233,7 +4301,25 @@ proc ShowErrors {} {
grid columnconfigure $w 1 -weight 0
grid rowconfigure $w 0 -weight 1
grid rowconfigure $w 1 -weight 0
$w.t insert end $RemindErrors
set l [split $RemindErrors "\n"]
set i 0
foreach line $l {
if {[regexp {^(.*)\(([0-9]+)\)} $line dummy fname lineno]} {
incr i
set fntag [string cat "FILE_" $lineno "_" $fname]
$w.t insert end $line [list ERR "ERR$i" $fntag]
$w.t tag bind "ERR$i" <ButtonPress-1> [list FireEditor $w.t $fntag]
$w.t tag bind "ERR$i" <ButtonPress-3> [list FireEditor $w.t $fntag]
$w.t tag bind "ERR$i" <Enter> "$w.t tag configure ERR$i -underline 1"
$w.t tag bind "ERR$i" <Leave> "$w.t tag configure ERR$i -underline 0"
} else {
$w.t insert end $line
}
$w.t insert end "\n"
}
if {$i > 0} {
$w.t insert end "\nIf an error message is underlined when you hover over it, click button-1 to edit the offending file at the line number of the error.\n"
}
$w.t configure -state disabled
CenterWindow $w .
}

View File

@@ -80,9 +80,6 @@ install-stripped: install
clean:
rm -f *.o *~ core *.bak $(PROGS)
cppcheck:
cppcheck --force --enable=all --suppress=variableScope --suppress=ConfigurationNotChecked *.c
clobber:
rm -f *.o *~ remind rem2ps test.out core *.bak
@@ -92,6 +89,9 @@ depend:
# The next targets are not very useful to you. I use them to build
# distributions, etc.
cppcheck:
cppcheck -j`nproc` --force --enable=all --suppress=ConfigurationNotChecked --suppress=unmatchedSuppression --suppress=variableScope --inline-suppr .
# Build a tar file based on all files checked into git.
distro:
cd .. && git archive --worktree-attributes --format=tar --prefix=remind-$(VERSION)/ HEAD > src/remind-$(VERSION).tar

View File

@@ -1041,7 +1041,7 @@ static void DoCalendarOneMonth(void)
printf("\"entries\":[\n");
}
}
while (WriteCalendarRow()) continue;
while (WriteCalendarRow()) /* continue */;
if (PsCal == PSCAL_LEVEL1) {
printf("%s\n", PSEND);

View File

@@ -117,7 +117,7 @@
/*---------------------------------------------------------------------*/
/* VAL_STACK_SIZE: The size of the operand stack for expr. parsing */
/*---------------------------------------------------------------------*/
#define VAL_STACK_SIZE 1000
#define VAL_STACK_SIZE 100
/*---------------------------------------------------------------------*/
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */

View File

@@ -117,7 +117,7 @@
/*---------------------------------------------------------------------*/
/* VAL_STACK_SIZE: The size of the operand stack for expr. parsing */
/*---------------------------------------------------------------------*/
#define VAL_STACK_SIZE 1000
#define VAL_STACK_SIZE 100
/*---------------------------------------------------------------------*/
/* INCLUDE_NEST: How many nested INCLUDES do we handle? */

View File

@@ -679,6 +679,9 @@ static int ParseLocalOmit(ParsePtr s, Trigger *t)
break;
default:
if (t->localomit == NO_WD) {
return E_EXPECTING_WEEKDAY;
}
PushToken(DBufValue(&buf), s);
DBufFree(&buf);
return OK;

View File

@@ -50,7 +50,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
int err, done;
int c;
int d, m, y;
int tim = tt->ttime;
int tim = NO_TIME;
int h, min, hh, ch, cmin, chh;
int i;
char const *pm, *cpm;
@@ -72,6 +72,9 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int dse,
FromDSE(dse, &y, &m, &d);
if (tt) {
tim = tt->ttime;
}
if (tim == NO_TIME) tim = curtime;
tdiff = tim - curtime;
adiff = ABS(tdiff);

View File

@@ -121,6 +121,8 @@
#define E_STRING_TOO_LONG 101
#define E_TIME_TWICE 102
#define E_DURATION_NO_AT 103
#define E_EXPECTING_WEEKDAY 104
#ifdef MK_GLOBALS
#undef EXTERN
#define EXTERN
@@ -241,7 +243,8 @@ EXTERN char *ErrMsg[]
"No files matching *.rem",
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
"Cannot specify DURATION without specifying AT",
"Expecting weekday name"
}
#endif /* MK_GLOBALS */
;

View File

@@ -87,10 +87,11 @@ extern BuiltinFunc Func[];
static Operator OpStack[OP_STACK_SIZE];
static int OpStackPtr = 0;
static int OpStackHiWater = 0;
/* ValStack can't be static - needed by funcs.c */
Value ValStack[VAL_STACK_SIZE];
int ValStackPtr = 0;
Value ValStack[VAL_STACK_SIZE];
int ValStackPtr = 0;
int ValStackHiWater = 0;
/***************************************************************/
/* */
@@ -1485,3 +1486,11 @@ int FnPopValStack(Value *val)
return OK;
}
}
void DebugExitFunc(void)
{
if (DebugFlag & DB_EXPR_STACKS) {
fprintf(stderr, "Operator stack high water: %d\n", OpStackHiWater);
fprintf(stderr, " Value stack high water: %d\n", ValStackHiWater);
}
}

View File

@@ -33,10 +33,8 @@
for speed. BEWARE: These macros invoke return if an error happens ! */
#define PushOpStack(op) \
if (OpStackPtr >= OP_STACK_SIZE) \
return E_OP_STK_OVER; \
else \
OpStack[OpStackPtr++] = (op)
do { if (OpStackPtr >= OP_STACK_SIZE) return E_OP_STK_OVER; \
else { OpStack[OpStackPtr++] = (op); if (OpStackPtr > OpStackHiWater) OpStackHiWater = OpStackPtr; } } while(0)
#define PopOpStack(op) \
if (OpStackPtr <= 0) \
@@ -45,10 +43,13 @@ else \
(op) = OpStack[--OpStackPtr]
#define PushValStack(val) \
if (ValStackPtr >= VAL_STACK_SIZE) \
return E_VA_STK_OVER; \
else \
ValStack[ValStackPtr++] = (val)
do { if (ValStackPtr >= VAL_STACK_SIZE) { \
DestroyValue(val); \
return E_VA_STK_OVER; \
} else { \
ValStack[ValStackPtr++] = (val); \
if (ValStackPtr > ValStackHiWater) ValStackHiWater = ValStackPtr; \
} } while (0);
#define PopValStack(val) \
if (ValStackPtr <= 0) \

View File

@@ -42,8 +42,8 @@
/* 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 FCLOSE(fp) ((((fp)!=stdin)) ? (fclose(fp),(fp)=NULL) : ((fp)=NULL))
#define PCLOSE(fp) ((((fp)!=stdin)) ? (pclose(fp),(fp)=NULL) : ((fp)=NULL))
/* Define the structures needed by the file caching system */
typedef struct cache {

View File

@@ -10,7 +10,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* */
/***************************************************************/
#include "version.h"
#include "config.h"
@@ -66,8 +65,6 @@ static int FAbs (func_info *);
static int FAccess (func_info *);
static int FAmpm (func_info *);
static int FAnsicolor (func_info *);
static int FTrig (func_info *);
static int FIsAny (func_info *);
static int FArgs (func_info *);
static int FAsc (func_info *);
static int FBaseyr (func_info *);
@@ -101,6 +98,7 @@ static int FHtmlEscape (func_info *);
static int FHtmlStriptags (func_info *);
static int FIif (func_info *);
static int FIndex (func_info *);
static int FIsAny (func_info *);
static int FIsdst (func_info *);
static int FIsleap (func_info *);
static int FIsomitted (func_info *);
@@ -117,6 +115,7 @@ static int FMoondate (func_info *);
static int FMoondatetime (func_info *);
static int FMoonphase (func_info *);
static int FMoontime (func_info *);
static int FMultiTrig (func_info *);
static int FNDawn (func_info *);
static int FNDusk (func_info *);
static int FNonomitted (func_info *);
@@ -134,6 +133,7 @@ static int FRealtoday (func_info *);
static int FRows (func_info *);
static int FSgn (func_info *);
static int FShell (func_info *);
static int FShellescape (func_info *);
static int FSlide (func_info *);
static int FSoleq (func_info *);
static int FStdout (func_info *);
@@ -156,9 +156,9 @@ static int FTrigeventstart (func_info *);
static int FTrigfrom (func_info *);
static int FTrigger (func_info *);
static int FTrigpriority (func_info *);
static int FTrigtags (func_info *);
static int FTrigrep (func_info *);
static int FTrigscanfrom (func_info *);
static int FTrigtags (func_info *);
static int FTrigtime (func_info *);
static int FTrigtimedelta (func_info *);
static int FTrigtimerep (func_info *);
@@ -166,15 +166,14 @@ 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 FUTCToLocal (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);
@@ -195,6 +194,7 @@ static int CacheHebYear, CacheHebMon, CacheHebDay;
/* We need access to the value stack */
extern Value ValStack[];
extern int ValStackPtr;
extern int ValStackHiWater;
/* Macro for accessing arguments from the value stack - args are numbered
from 0 to (Nargs - 1) */
@@ -284,6 +284,7 @@ BuiltinFunc Func[] = {
{ "moondatetime", 1, 3, 0, FMoondatetime },
{ "moonphase", 0, 2, 0, FMoonphase },
{ "moontime", 1, 3, 0, FMoontime },
{ "multitrig", 1, NO_MAX, 0, FMultiTrig },
{ "ndawn", 0, 1, 0, FNDawn},
{ "ndusk", 0, 1, 0, FNDusk},
{ "nonomitted", 2, NO_MAX, 0, FNonomitted },
@@ -3520,6 +3521,57 @@ FEvalTrig(func_info *info)
return OK;
}
static int
FMultiTrig(func_info *info)
{
Parser p;
Trigger trig;
TimeTrig tim;
int dse;
int r;
int i;
int earliest = -1;
RetVal.type = DATE_TYPE;
RETVAL = 0;
for (i=0; i<Nargs; i++) {
ASSERT_TYPE(i, STR_TYPE);
}
for (i=0; i<Nargs; i++) {
CreateParser(ARGSTR(i), &p);
p.allownested = 0;
r = ParseRem(&p, &trig, &tim, 0);
if (r) {
DestroyParser(&p);
return r;
}
if (trig.typ != NO_TYPE) {
DestroyParser(&p);
FreeTrig(&trig);
return E_PARSE_ERR;
}
if (tim.ttime != NO_TIME) {
Eprint("Cannot use AT clause in multitrig() function");
return E_PARSE_ERR;
}
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
DestroyParser(&p);
if (r != E_CANT_TRIG) {
if (dse < earliest || earliest < 0) {
earliest = dse;
}
}
FreeTrig(&trig);
}
if (earliest >= 0) {
RETVAL = earliest;
}
return OK;
}
static int LastTrig = 0;
static int
FTrig(func_info *info)
@@ -3557,20 +3609,18 @@ FTrig(func_info *info)
return E_PARSE_ERR;
}
dse = ComputeTrigger(trig.scanfrom, &trig, &tim, &r, 0);
DestroyParser(&p);
if (r == E_CANT_TRIG) {
DestroyParser(&p);
FreeTrig(&trig);
continue;
}
if (ShouldTriggerReminder(&trig, &tim, dse, &r)) {
LastTrig = dse;
RETVAL = dse;
DestroyParser(&p);
FreeTrig(&trig);
return OK;
}
DestroyParser(&p);
FreeTrig(&trig);
}
return OK;
@@ -3683,11 +3733,8 @@ mean_december_solstice(double y)
}
/* Cosine of an angle specified in degrees */
static double
cosd(double degrees)
{
return cos((degrees / 180.0) * 3.14159265358979);
}
#define PI_BY_180 0.01745329251994329576923690768
#define cosd(theta) cos( (theta) * PI_BY_180)
/* Astronomical Algorithms by Meeus, p. 179
These weird periodic components refine the mean solstice/equinox dates

View File

@@ -39,7 +39,7 @@ EXTERN FILE *ErrFp;
#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
#define DestroyValue(x) (void) (((x).type == STR_TYPE && (x).v.str) ? (free((x).v.str),(x).v.str = NULL,(x).type = ERR_TYPE) : 0)
#define DestroyValue(x) do { if ((x).type == STR_TYPE && (x).v.str) { free((x).v.str); (x).v.str = NULL; } (x).type = ERR_TYPE; } while (0)
EXTERN int DSEToday;
EXTERN int RealToday;

View File

@@ -78,6 +78,7 @@ static void ProcessLongOption(char const *arg);
* t = Display trigger dates
* v = Dump variables at end
* l = Display entire line in error messages
* s = Display expression-parsing stack usage before exit
* -e = Send messages normally sent to stderr to stdout instead
* -z[n] = Daemon mode waking up every n (def 1) minutes.
* -bn = Time format for cal (0, 1, or 2)
@@ -604,6 +605,7 @@ void InitRemind(int argc, char const *argv[])
case 'D':
while (*arg) {
switch(*arg++) {
case 's': case 'S': DebugFlag |= DB_EXPR_STACKS; break;
case 'e': case 'E': DebugFlag |= DB_ECHO_LINE; break;
case 'x': case 'X': DebugFlag |= DB_PRTEXPR; break;
case 't': case 'T': DebugFlag |= DB_PRTTRIG; break;
@@ -1004,7 +1006,7 @@ guess_terminal_background(int *r, int *g, int *b)
{
int ttyfd;
struct pollfd p;
int rr, gg, bb;
unsigned int rr, gg, bb;
char buf[128];
int n;
@@ -1070,9 +1072,9 @@ guess_terminal_background(int *r, int *g, int *b)
/* Couldn't scan color codes */
return;
}
*r = (rr >> 8) & 255;
*g = (gg >> 8) & 255;
*b = (bb >> 8) & 255;
*r = (int) ((rr >> 8) & 255);
*g = (int) ((gg >> 8) & 255);
*b = (int) ((bb >> 8) & 255);
}
static struct termios orig_termios;

View File

@@ -245,7 +245,8 @@ EXTERN char *ErrMsg[] =
"No files matching *.rem",
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
"Cannot specify DURATION without specifying AT".
"Odotettu viikonpäivän nimi"
};
#endif /* MK_GLOBALS */

View File

@@ -219,7 +219,8 @@ EXTERN char *ErrMsg[] =
"No files matching *.rem",
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
"Cannot specify DURATION without specifying AT",
"Nom du jour de la semaine attendu",
};
#endif /* MK_GLOBALS */

View File

@@ -235,7 +235,8 @@ EXTERN char *ErrMsg[] =
"No files matching *.rem",
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
"Cannot specify DURATION without specifying AT",
"Oczekiwana nazwa dnia tygodnia"
};
#endif /* MK_GLOBALS */

View File

@@ -244,7 +244,8 @@ EXTERN char *ErrMsg[] =
"No files matching *.rem",
"String too long",
"Time specified twice",
"Cannot specify DURATION without specifying AT"
"Cannot specify DURATION without specifying AT",
"Esperando nome do dia da semana",
};
#endif /* MK_GLOBALS */

View File

@@ -76,6 +76,8 @@ int main(int argc, char *argv[])
DBufInit(&(LastTrigger.tags));
ClearLastTriggers();
atexit(DebugExitFunc);
if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) {
ProduceCalendar();
return 0;
@@ -590,8 +592,8 @@ int EvaluateExpr(ParsePtr p, Value *v)
int r;
if (p->isnested) return E_PARSE_ERR; /* Can't nest expressions */
while (isempty(*p->pos)) (p->pos)++;
if (!p->pos) return E_PARSE_ERR; /* Missing expression */
while (isempty(*p->pos)) (p->pos)++;
if (*p->pos == BEG_OF_EXPR) {
(p->pos)++;
bracketed = 1;
@@ -1016,6 +1018,12 @@ int DoDebug(ParsePtr p)
else DebugFlag &= ~DB_ECHO_LINE;
break;
case 's':
case 'S':
if (val) DebugFlag |= DB_EXPR_STACKS;
else DebugFlag &= ~DB_EXPR_STACKS;
break;
case 'x':
case 'X':
if (val) DebugFlag |= DB_PRTEXPR;
@@ -1690,9 +1698,7 @@ System(char const *cmd, int is_queued)
}
} else {
/* In the parent */
while (waitpid(kid, &status, 0) != kid) {
continue;
}
while (waitpid(kid, &status, 0) != kid) /* continue */ ;
return;
}
}

View File

@@ -22,7 +22,7 @@
#include "err.h"
#include "expr.h"
static int BexistsIntArray (int array[], int num, int key);
static int BexistsIntArray (int const array[], int num, int key);
static void InsertIntoSortedArray (int *array, int num, int key);
/* Arrays for the global omits */
@@ -251,7 +251,7 @@ int IsOmitted(int dse, int localomit, char const *omitfunc, int *omit)
/* element is found, 0 otherwise. */
/* */
/***************************************************************/
static int BexistsIntArray(int array[], int num, int key)
static int BexistsIntArray(int const array[], int num, int key)
{
int top=num-1, bot=0, mid;

View File

@@ -108,7 +108,7 @@ char *StrDup (char const *s);
int StrCmpi (char const *s1, char const *s2);
Var *FindVar (char const *str, int create);
int DeleteVar (char const *str);
int SetVar (char const *str, Value *val);
int SetVar (char const *str, Value const *val);
int GetVarValue (char const *str, Value *val, Var *locals, ParsePtr p);
int DoSet (Parser *p);
int DoUnset (Parser *p);
@@ -174,6 +174,8 @@ int AddGlobalOmit(int dse);
void set_lat_and_long_from_components(void);
void set_components_from_lat_and_long(void);
void DebugExitFunc(void);
int GetTerminalBackground(void);
char const *get_day_name(int wkday);

View File

@@ -153,6 +153,34 @@ static char const *QueueFilename(char const *fname)
return elem->fname;
}
static void del_reminder(QueuedRem *qid)
{
QueuedRem *q = QueueHead;
QueuedRem *next;
if (!q) {
return;
}
if (q == qid) {
QueueHead = q->next;
if (q->text) free((void *) q->text);
free(q);
return;
}
while(q->next) {
next = q->next;
if (q->next == qid) {
q->next = q->next->next;
if (next->text) free((void *) next->text);
free(next);
return;
}
q = q->next;
}
}
static void del_reminder_ul(unsigned long qid) {
del_reminder((QueuedRem *) qid);
}
/***************************************************************/
/* */
@@ -277,6 +305,7 @@ void HandleQueuedReminders(void)
struct timeval tv;
struct timeval sleep_tv;
struct sigaction sa;
char qid[64];
/* Turn off sorting -- otherwise, TriggerReminder has no effect! */
SortByDate = 0;
@@ -370,6 +399,8 @@ void HandleQueuedReminders(void)
sleep_tv.tv_usec = 0;
}
DaemonWait(&sleep_tv);
/* A DEL command might have deleted our queued reminder! */
q = FindNextReminder();
} else {
sleep(SleepTime);
}
@@ -417,6 +448,8 @@ void HandleQueuedReminders(void)
if (IsServerMode() && q->typ != RUN_TYPE) {
if (DaemonJSON) {
printf("{\"response\":\"reminder\",");
snprintf(qid, sizeof(qid), "%lx", (unsigned long) q);
PrintJSONKeyPairString("qid", qid);
PrintJSONKeyPairString("ttime", SimpleTimeNoSpace(q->tt.ttime));
PrintJSONKeyPairString("now", SimpleTimeNoSpace(MinutesPastMidnight(1)));
PrintJSONKeyPairString("tags", DBufValue(&q->t.tags));
@@ -461,7 +494,6 @@ void HandleQueuedReminders(void)
/* Calculate the next trigger time */
q->tt.nexttime = CalculateNextTime(q);
/* If it's dequeued, update num_queued */
if (q->tt.nexttime != NO_TIME) {
/* If trigger time is way in the past because computer has been
suspended or hibernated, remove from queue */
@@ -471,9 +503,13 @@ void HandleQueuedReminders(void)
}
}
/* If we have dequeued a reminder, update controlling process */
if (q->tt.nexttime == NO_TIME && IsServerMode()) {
print_num_queued();
/* If queued reminder has expired, actually remove it from queue
and update status */
if (q->tt.nexttime == NO_TIME) {
del_reminder(q);
if (IsServerMode()) {
print_num_queued();
}
}
}
exit(EXIT_SUCCESS);
@@ -676,6 +712,7 @@ json_queue(QueuedRem const *q)
printf("{\"response\":\"queue\",\"queue\":");
}
printf("[");
char idbuf[64];
while(q) {
if (q->tt.nexttime == NO_TIME) {
q = q->next;
@@ -688,6 +725,8 @@ json_queue(QueuedRem const *q)
printf("{");
WriteJSONTrigger(&(q->t), 1, DSEToday);
WriteJSONTimeTrigger(&(q->tt));
snprintf(idbuf, sizeof(idbuf), "%lx", (unsigned long) q);
PrintJSONKeyPairString("qid", idbuf);
PrintJSONKeyPairInt("rundisabled", q->RunDisabled);
PrintJSONKeyPairInt("ntrig", q->ntrig);
PrintJSONKeyPairString("filename", q->fname);
@@ -849,6 +888,13 @@ static void DaemonWait(struct timeval *sleep_tv)
}
fflush(stdout);
reread();
} else if (!strncmp(cmdLine, "DEL ", 4)) {
unsigned long qid;
if (sscanf(cmdLine, "DEL %lx", &qid) == 1) {
del_reminder_ul(qid);
}
print_num_queued();
fflush(stdout);
} else {
if (DaemonJSON) {
size_t l = strlen(cmdLine);
@@ -884,18 +930,27 @@ static void consume_inotify_events(int fd)
int n;
struct timespec sleeptime;
/* HACK: sleep for 0.2 seconds to let multiple events queue up so we
only do a single reread */
sleeptime.tv_sec = 0;
sleeptime.tv_nsec = 200000000;
nanosleep(&sleeptime, NULL);
int slept = 0;
/* Consume all the inotify events */
while(1) {
n = read(fd, buf, sizeof(buf));
if (n > 0) {
/* Something new since we slept */
slept = 0;
}
if (n < 0) {
if (errno == EINTR) continue;
return;
if (slept) {
/* Nothing new since we slept */
return;
}
slept = 1;
/* HACK: sleep for 0.2 seconds to let multiple events queue up so we
only do a single reread */
sleeptime.tv_sec = 0;
sleeptime.tv_nsec = 200000000;
nanosleep(&sleeptime, NULL);
}
}
}

View File

@@ -244,6 +244,7 @@ static int NextSimpleTrig(int startdate, Trigger *trig, int *err)
case GOT_WD+GOT_MON+GOT_YR:
if (y > trig->y || (y == trig->y && m > trig->m)) return -1;
/* cppcheck-suppress knownConditionTrueFalse */
if (trig->y > y || (trig->y == y && trig->m > m)) {
j = DSE(trig->y, trig->m, 1);
ADVANCE_TO_WD(j, trig->wd);

View File

@@ -150,6 +150,7 @@ typedef Parser *ParsePtr; /* Pointer to parser structure */
#define DB_DUMP_VARS 8
#define DB_ECHO_LINE 16
#define DB_TRACE_FILES 32
#define DB_EXPR_STACKS 64
/* Enumeration of the tokens */
enum TokTypes

View File

@@ -480,7 +480,7 @@ int DeleteVar(char const *str)
/* Set the indicate variable to the specified value. */
/* */
/***************************************************************/
int SetVar(char const *str, Value *val)
int SetVar(char const *str, Value const *val)
{
Var *v = FindVar(str, 1);

View File

@@ -65,6 +65,8 @@ echo "Test 1" > ../tests/test.out
echo "" >> ../tests/test.out
../src/remind -e -dxte ../tests/test.rem 16 feb 1991 12:13 >> ../tests/test.out 2>&1
echo "" >> ../tests/test.out
echo 'set a 1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+2*3))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))' | ../src/remind -ds - 16 feb 1991 12:13 >> ../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 2>&1
@@ -452,8 +454,8 @@ rm -rf include_dir/ww
# Test queueing. Because eventstart depends on the actual system
# date, we have to convert it to some constant (in this case,
# VOLATILE) so that tests are not dependent on the system date.
echo JSONQUEUE | ../src/remind -z0 ../tests/queue1.rem 2>&1 | sed -e 's/"eventstart":"................"/"eventstart":"VOLATILE"/g' >> ../tests/test.out 2>&1
echo QUEUE | ../src/remind -zj ../tests/queue1.rem 2>&1 | sed -e 's/"eventstart":"................"/"eventstart":"VOLATILE"/g' >> ../tests/test.out 2>&1
echo JSONQUEUE | ../src/remind -z0 ../tests/queue1.rem 2>&1 | sed -e 's/"eventstart":"................"/"eventstart":"VOLATILE"/g' | sed -e 's/"qid":"[0-9a-f]*",//g' >> ../tests/test.out 2>&1
echo QUEUE | ../src/remind -zj ../tests/queue1.rem 2>&1 | sed -e 's/"eventstart":"................"/"eventstart":"VOLATILE"/g' | sed -e 's/"qid":"[0-9a-f]*",//g' >> ../tests/test.out 2>&1
# Test for leap year bug that was fixed
../src/remind -dte - 28 Feb 2024 <<'EOF' >> ../tests/test.out 2>&1

File diff suppressed because one or more lines are too long

View File

@@ -784,6 +784,15 @@ ENDIF
REM [trig("Mon", "Tue", "Wed", "Sat")] MSG foo
REM [trig("Mon", "Tue", "Wed")] MSG bar
# Multitrig
REM [multitrig("10", "17")] MSG multitrig-1
REM [multitrig("Feb 15", "Mar 20")] MSG multitrig-2
REM [multitrig("Oct 7 1992", "1991")] MSG multitrig-3
REM [multitrig("16 Feb AFTER OMIT Sat Sun", "29 March")] MSG multitrig-4
REM [multitrig("2", "3", "5", "7")] MSG multitrig-5
REM [multitrig("15 SCANFROM -7", "14 SCANFROM -7")] MSG multitrig-6
REM [multitrig("15 SCANFROM -7", "14 SCANFROM -7")] SCANFROM -7 MSG multitrig-7
# The new syntactic sugar
REM First Monday January MSG x
REM Second Tuesday in April MSG x
@@ -910,6 +919,12 @@ set a 7 * "Cabbage! "
# Should result in errors
set pqxya 1+2)
# Should result in an error
REM Tue OMIT 2024-01-01 MSG Wookie
# No error
REM Tue OMIT Wed 2024-01-01 MSG Blort
# Don't want Remind to queue reminders
EXIT

View File

@@ -12,10 +12,10 @@ CGIDIR = /cgi-bin
# The complete path to the directory containing the HTML file "calendar.html".
# This is a sample file containing links to all the scripts. This path
# should be the path as seen by the UNIX operating system
HTMLDIR = /var/www/remind
HTMLDIR = /var/www/html/remind
# Where you stick images and CSS files, as seen by UNIX
IMAGEDIR = /var/www/remind/resources
IMAGEDIR = /var/www/html/remind/resources
# Where images and CSS files are, as seen by web browsers
IMAGEBASE = /remind/resources
@@ -32,6 +32,7 @@ datarootdir=@datarootdir@
# Where do Remind and Rem2PS executables live?
REMIND = $(bindir)/remind
REM2PS = $(bindir)/rem2ps
REM2PDF = $(bindir)/rem2pdf
REM2HTML = $(bindir)/rem2html
# If your Web server requires CGI programs to have a .cgi suffix, use
# the next line. Otherwise, comment it out
@@ -46,6 +47,7 @@ SEDSCRIPT = -e 's@%CGIDIR%@$(CGIDIR)@g' \
-e 's@%REMIND%@$(REMIND)@g' \
-e 's@%IMAGEBASE%@$(IMAGEBASE)@g' \
-e 's@%REM2PS%@$(REM2PS)@g' \
-e 's@%REM2PDF%@$(REM2PDF)@g' \
-e 's@%REM2HTML%@$(REM2HTML)@g' \
-e 's@cal_dispatch@cal_dispatch$(CGISUFFIX)@g' \
@@ -57,7 +59,8 @@ all:
install:
-mkdir -p $(DESTDIR)$(SCRIPTDIR)
-mkdir -p $(DESTDIR)$(HTMLDIR)
cp calps hebdate hebps hebhtml moon sunrise sunset $(DESTDIR)$(SCRIPTDIR)
cp calps calpdf hebps hebpdf hebhtml moon sunrise sunset $(DESTDIR)$(SCRIPTDIR)
sed $(SEDSCRIPT) < hebdate > $(DESTDIR)$(SCRIPTDIR)/hebdate
sed $(SEDSCRIPT) < cal_dispatch-DIST > $(DESTDIR)$(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
sed $(SEDSCRIPT) < hebdate.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/hebdate.rem
sed $(SEDSCRIPT) < moon.rem-DIST > $(DESTDIR)$(SCRIPTDIR)/moon.rem
@@ -73,14 +76,14 @@ install:
chmod 644 $(DESTDIR)$(SCRIPTDIR)/blank.rem
chmod 644 $(DESTDIR)$(HTMLDIR)/calendar.html
chmod 755 $(DESTDIR)$(SCRIPTDIR)/cal_dispatch$(CGISUFFIX)
chmod 755 $(DESTDIR)$(SCRIPTDIR)/calps $(DESTDIR)$(SCRIPTDIR)/hebdate \
$(DESTDIR)$(SCRIPTDIR)/hebps $(DESTDIR)$(SCRIPTDIR)/moon \
chmod 755 $(DESTDIR)$(SCRIPTDIR)/calpdf $(DESTDIR)$(SCRIPTDIR)/calps $(DESTDIR)$(SCRIPTDIR)/hebdate \
$(DESTDIR)$(SCRIPTDIR)/hebps $(DESTDIR)$(SCRIPTDIR)/hebpdf $(DESTDIR)$(SCRIPTDIR)/moon \
$(DESTDIR)$(SCRIPTDIR)/sunrise $(DESTDIR)$(SCRIPTDIR)/sunset \
$(DESTDIR)$(SCRIPTDIR)/hebhtml \
-mkdir -p $(DESTDIR)$(IMAGEDIR)
cp rem-default.css *.png $(DESTDIR)$(IMAGEDIR)
chmod 644 $(DESTDIR)$(IMAGEDIR)/rem-default.css $(DESTDIR)$(IMAGEDIR)/*.png
cp calendar.css rem-default.css *.png $(DESTDIR)$(IMAGEDIR)
chmod 644 $(DESTDIR)$(IMAGEDIR)/calendar.css $(DESTDIR)$(IMAGEDIR)/rem-default.css $(DESTDIR)$(IMAGEDIR)/*.png

View File

@@ -28,6 +28,10 @@ export REMIND
REM2PS=%REM2PS%
export REM2PS
# Set REM2PDF to the full pathname of the rem2pdf executable
REM2PDF=%REM2PDF%
export REM2PDF
#########################
#
# Don't change anything after this.
@@ -56,6 +60,10 @@ case "$1" in
exec $DIR/calps
;;
calpdf)
exec $DIR/calpdf
;;
moon)
exec $DIR/moon
;;
@@ -64,6 +72,10 @@ case "$1" in
exec $DIR/hebps
;;
hebpdf)
exec $DIR/hebpdf
;;
hebhtml)
if [ "$2" = "" -o "$3" = "" ] ; then
exec $DIR/hebhtml

41
www/calendar.css Normal file
View File

@@ -0,0 +1,41 @@
html, body {
padding: 0px;
margin-left: 10px;
margin-right: 10px;
font-family: "Open Sans", Arial, sans-serif
background: #FFFFFF;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 5px;
margin-bottom: 5px;
padding-top: 0px;
padding-bottom: 0px;
font-family: inherit;
font-weight: 600;
}
h1, .h1 {
font-size: 1.75rem; }
h2, .h2 {
font-size: 1.5rem; }
h3, .h3 {
font-size: 1.25rem; }
a {
text-decoration: none;
color: #1a0dab;
}
a:visited {
text-decoration: none;
color: #1a0dab;
}
a:hover {
text-decoration: none;
color: #ff0000;
}

View File

@@ -1,7 +1,8 @@
<HTML>
<!-- Sample HTML file with links to the calendar stuff -->
<HEAD>
<TITLE>Remind Calendar Server</TITLE>
<TITLE>Remind Calendar Server</TITLE>
<LINK rel="stylesheet" href="%IMAGEBASE%/calendar.css">
</HEAD>
<BODY>
@@ -15,10 +16,14 @@ Sunset Information</a><P>
Moon Phase Information</a><P>
<a HREF="%CGIDIR%/cal_dispatch?calps">
Blank PostScript Calendar</a> (Approximately 20kB)<P>
<a HREF="%CGIDIR%/cal_dispatch?calpdf">
Blank PDF Calendar</a> (Approximately 15kB)<P>
<a HREF="%CGIDIR%/cal_dispatch?hebdate">
Today's Hebrew Date</a><P>
<a HREF="%CGIDIR%/cal_dispatch?hebps">
PostScript Calendar with Jewish Holidays</a> (Approximately 35 kB)<P>
<a HREF="%CGIDIR%/cal_dispatch?hebpdf">
PDF Calendar with Jewish Holidays</a> (Approximately 20 kB)<P>
<a HREF="%CGIDIR%/cal_dispatch?hebhtml">
HTML Calendar with Jewish Holidays</a>
<HR>

11
www/calpdf Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# PostScript calendar shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-2018 by Dianne Skoll
echo "Content-type: application/pdf"
echo
$REMIND -p $DIR/blank.rem | $REM2PDF -e -c3 -l
exit 0

View File

@@ -11,6 +11,7 @@ cat <<EOM
<HTML>
<HEAD>
<TITLE>Hebrew date</TITLE>
<LINK rel="stylesheet" href="%IMAGEBASE%/calendar.css">
</HEAD>
<BODY>

View File

@@ -165,13 +165,15 @@ ENDIF
IF !$PSCAL
REM 20 ++40 msg Also available: <a HREF="%CGIDIR%/cal_dispatch?hebps">a PostScript calendar</a> (about 35KB) for %m %y, complete with Hebrew dates, Jewish holidays, and moon phases for [$Location].
REM 20 ++40 msg And: <a HREF="%CGIDIR%/cal_dispatch?hebhtml">an HTML version</a> of the above.
REM 20 ++40 msg And: <a HREF="%CGIDIR%/cal_dispatch?hebpdf">a PDF version</a> of the above.
ELSE
[trigger(moondate(0))] SPECIAL MOON 0
[trigger(moondate(1))] SPECIAL MOON 1
[trigger(moondate(2))] SPECIAL MOON 2
[trigger(moondate(3))] SPECIAL MOON 3
REM PS Border Border moveto /DayFont findfont 10 scalefont setfont ([hebday(today())] [hebmon(today())]) show
REM SPECIAL HTML <P>[hebday(today())] [hebmon(today())]</P>
REM [moondate(0)] SPECIAL MOON 0
REM [moondate(1)] SPECIAL MOON 1
REM [moondate(2)] SPECIAL MOON 2
REM [moondate(3)] SPECIAL MOON 3
REM PS Border Border moveto /DayFont findfont 10 scalefont setfont ([hebday($U)] [hebmon($U)]) show
REM SPECIAL HTML <P>[hebday($U)] [hebmon($U)]</P>
REM SPECIAL PANGO @4,-1 <span size="6400"><i>[hebday($U)] [hebmon($U)]</i></span>
ENDIF

17
www/hebpdf Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
# Hebrew PostScript calendar shell script
#
# This file is part of REMIND.
# Copyright (C) 1992-2018 by Dianne Skoll
# Figure out the month: If day <= 20, use this month; otherwise, use
# next month.
echo "Content-type: application/pdf"
echo ""
$REMIND - <<EOR
BANNER %
REM 20 ++40 RUN $REMIND -iHTML=0 -p $DIR/hebdate.rem %m %y | $REM2PDF -e -c3 -l
EOR
exit 0

View File

@@ -9,6 +9,7 @@ banner %
MSG <HEAD>%
MSG <TITLE>Moon over [$Location]</TITLE>%
MSG <LINK rel="stylesheet" href="%IMAGEBASE%/calendar.css">%
MSG </HEAD>%
MSG <BODY>

View File

@@ -8,6 +8,7 @@ set now now()
banner %
MSG <HEAD>%
MSG <TITLE>Sunrise in [$Location]</TITLE>%
MSG <LINK rel="stylesheet" href="%IMAGEBASE%/calendar.css">%
MSG </HEAD>%
MSG <BODY>

View File

@@ -10,6 +10,7 @@ banner %
MSG <HEAD>%
MSG <TITLE>Sunset in [$Location]</TITLE>%
MSG <LINK rel="stylesheet" href="%IMAGEBASE%/calendar.css">%
MSG </HEAD>%
MSG <BODY>