mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Document OMITFUNC and fix huge bug. :-)
This commit is contained in:
42
man/remind.1
42
man/remind.1
@@ -337,6 +337,7 @@ Its syntax is:
|
||||
[\fBPRIORITY\fR \fIprio\fR]
|
||||
[\fBSKIP\fR | \fBBEFORE\fR | \fBAFTER\fR]
|
||||
[\fBOMIT\fR \fIomit_list\fR]
|
||||
[\fBOMITFUNC\fR \fIomit_function\fR]
|
||||
[\fBAT\fR \fItime\fR [\fItdelta\fR] [\fItrepeat\fR]]
|
||||
[\fBSCHED\fR \fIsched_function\fR]
|
||||
[\fBWARN\fR \fIwarn_function\fR]
|
||||
@@ -794,6 +795,37 @@ also. See "The OMIT command" for more details.)
|
||||
By comparison, if we had used "\-\-1", the reminder would be triggered on
|
||||
the last day of the month, regardless of the \fBOMIT\fR.
|
||||
.PP
|
||||
.B COMPUTED LOCAL OMITS
|
||||
.PP
|
||||
The \fBOMITFUNC\fR phrase of the \fBREM\fR command allows you to supply
|
||||
a function that determines whether or not a date is omitted. The function
|
||||
is passed a single parameter of type \fBDATE\fR, and must return 1 if the
|
||||
date is considered "omitted" and 0 otherwise. Here's an example:
|
||||
.PP
|
||||
.nf
|
||||
FSET _third(x) (day(x) % 3)
|
||||
REM OMIT Sat Sun OMITFUNC _third AFTER MSG Working day divisible by 3
|
||||
.fi
|
||||
.PP
|
||||
In the example above, the reminder is triggered every Monday to Friday whose
|
||||
day-of-month number is divisible by three. Here's how it works:
|
||||
.TP
|
||||
.B o
|
||||
The \fBOMIT Sat Sun\fR portion causes weekends to be considered "omitted"
|
||||
.TP
|
||||
.B o
|
||||
The \fBOMITFUNC _third\fR portion causes all days for which \fB_third(x)\fR
|
||||
returns non-zero to be considered "omitted". This causes all days whose
|
||||
day-of-month number is \fInot\fR a multiple of three to be omitted.
|
||||
.TP
|
||||
.B o
|
||||
The \fBAFTER\fR keyword causes the reminder to be moved after a block of
|
||||
omitted days.
|
||||
.PP
|
||||
The combination of omitted days and AFTER keyword causes the reminder to
|
||||
be issued on all days whose day-of-month number is divisible by three,
|
||||
but not on Saturday or Sunday.
|
||||
.PP
|
||||
.B TIMED REMINDERS
|
||||
.PP
|
||||
Timed reminders are those that have an \fBAT\fR keyword followed
|
||||
@@ -1226,11 +1258,11 @@ equivalent:
|
||||
.PP
|
||||
.B THE BEFORE, AFTER AND SKIP KEYWORDS
|
||||
.PP
|
||||
Normally, days that are omitted, whether by a global \fBOMIT\fR command
|
||||
or the local \fBOMIT\fR keyword in a \fBREM\fR statement, only affect the
|
||||
counting of the \-\fIback\fR or the +\fIdelta\fR. For example, suppose
|
||||
you have a meeting every Wednesday. Suppose, too, that you have indicated
|
||||
11 Nov as a holiday:
|
||||
Normally, days that are omitted, whether by a global \fBOMIT\fR
|
||||
command or the local \fBOMIT\fR or \fBOMITFUNC\fR keywords in a
|
||||
\fBREM\fR statement, only affect the counting of the \-\fIback\fR or
|
||||
the +\fIdelta\fR. For example, suppose you have a meeting every
|
||||
Wednesday. Suppose, too, that you have indicated 11 Nov as a holiday:
|
||||
.PP
|
||||
.nf
|
||||
OMIT 11 Nov +4 MSG Remembrance Day
|
||||
|
||||
@@ -203,7 +203,7 @@ int IsOmitted(int jul, int localomit, char const *omitfunc)
|
||||
int r;
|
||||
Value v;
|
||||
sprintf(expr, "%s('%04d-%02d-%02d')",
|
||||
omitfunc, y, m, d);
|
||||
omitfunc, y, m+1, d);
|
||||
s = expr;
|
||||
r = EvalExpr(&s, &v);
|
||||
if (!r) {
|
||||
|
||||
180
tests/test.cmp
180
tests/test.cmp
@@ -492,167 +492,167 @@ CLEAR-OMIT-CONTEXT
|
||||
# Test omitfunc
|
||||
fset _ofunc(x) (day(x) < 7 || day(x) % 2)
|
||||
REM 1 March OMITFUNC _ofunc AFTER MSG OmitFunc Test
|
||||
Entering UserFN _ofunc(1991-01-15)
|
||||
x => 1991-01-15
|
||||
day(1991-01-15) => 15
|
||||
Entering UserFN _ofunc(1991-02-15)
|
||||
x => 1991-02-15
|
||||
day(1991-02-15) => 15
|
||||
15 < 7 => 0
|
||||
x => 1991-01-15
|
||||
day(1991-01-15) => 15
|
||||
x => 1991-02-15
|
||||
day(1991-02-15) => 15
|
||||
15 % 2 => 1
|
||||
0 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-01-14)
|
||||
x => 1991-01-14
|
||||
day(1991-01-14) => 14
|
||||
Entering UserFN _ofunc(1991-02-14)
|
||||
x => 1991-02-14
|
||||
day(1991-02-14) => 14
|
||||
14 < 7 => 0
|
||||
x => 1991-01-14
|
||||
day(1991-01-14) => 14
|
||||
x => 1991-02-14
|
||||
day(1991-02-14) => 14
|
||||
14 % 2 => 0
|
||||
0 || 0 => 0
|
||||
Leaving UserFN _ofunc() => 0
|
||||
Entering UserFN _ofunc(1991-02-01)
|
||||
x => 1991-02-01
|
||||
day(1991-02-01) => 1
|
||||
Entering UserFN _ofunc(1991-03-01)
|
||||
x => 1991-03-01
|
||||
day(1991-03-01) => 1
|
||||
1 < 7 => 1
|
||||
x => 1991-02-01
|
||||
day(1991-02-01) => 1
|
||||
x => 1991-03-01
|
||||
day(1991-03-01) => 1
|
||||
1 % 2 => 1
|
||||
1 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-02)
|
||||
x => 1991-02-02
|
||||
day(1991-02-02) => 2
|
||||
Entering UserFN _ofunc(1991-03-02)
|
||||
x => 1991-03-02
|
||||
day(1991-03-02) => 2
|
||||
2 < 7 => 1
|
||||
x => 1991-02-02
|
||||
day(1991-02-02) => 2
|
||||
x => 1991-03-02
|
||||
day(1991-03-02) => 2
|
||||
2 % 2 => 0
|
||||
1 || 0 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-03)
|
||||
x => 1991-02-03
|
||||
day(1991-02-03) => 3
|
||||
Entering UserFN _ofunc(1991-03-03)
|
||||
x => 1991-03-03
|
||||
day(1991-03-03) => 3
|
||||
3 < 7 => 1
|
||||
x => 1991-02-03
|
||||
day(1991-02-03) => 3
|
||||
x => 1991-03-03
|
||||
day(1991-03-03) => 3
|
||||
3 % 2 => 1
|
||||
1 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-04)
|
||||
x => 1991-02-04
|
||||
day(1991-02-04) => 4
|
||||
Entering UserFN _ofunc(1991-03-04)
|
||||
x => 1991-03-04
|
||||
day(1991-03-04) => 4
|
||||
4 < 7 => 1
|
||||
x => 1991-02-04
|
||||
day(1991-02-04) => 4
|
||||
x => 1991-03-04
|
||||
day(1991-03-04) => 4
|
||||
4 % 2 => 0
|
||||
1 || 0 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-05)
|
||||
x => 1991-02-05
|
||||
day(1991-02-05) => 5
|
||||
Entering UserFN _ofunc(1991-03-05)
|
||||
x => 1991-03-05
|
||||
day(1991-03-05) => 5
|
||||
5 < 7 => 1
|
||||
x => 1991-02-05
|
||||
day(1991-02-05) => 5
|
||||
x => 1991-03-05
|
||||
day(1991-03-05) => 5
|
||||
5 % 2 => 1
|
||||
1 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-06)
|
||||
x => 1991-02-06
|
||||
day(1991-02-06) => 6
|
||||
Entering UserFN _ofunc(1991-03-06)
|
||||
x => 1991-03-06
|
||||
day(1991-03-06) => 6
|
||||
6 < 7 => 1
|
||||
x => 1991-02-06
|
||||
day(1991-02-06) => 6
|
||||
x => 1991-03-06
|
||||
day(1991-03-06) => 6
|
||||
6 % 2 => 0
|
||||
1 || 0 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-07)
|
||||
x => 1991-02-07
|
||||
day(1991-02-07) => 7
|
||||
Entering UserFN _ofunc(1991-03-07)
|
||||
x => 1991-03-07
|
||||
day(1991-03-07) => 7
|
||||
7 < 7 => 0
|
||||
x => 1991-02-07
|
||||
day(1991-02-07) => 7
|
||||
x => 1991-03-07
|
||||
day(1991-03-07) => 7
|
||||
7 % 2 => 1
|
||||
0 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-08)
|
||||
x => 1991-02-08
|
||||
day(1991-02-08) => 8
|
||||
Entering UserFN _ofunc(1991-03-08)
|
||||
x => 1991-03-08
|
||||
day(1991-03-08) => 8
|
||||
8 < 7 => 0
|
||||
x => 1991-02-08
|
||||
day(1991-02-08) => 8
|
||||
x => 1991-03-08
|
||||
day(1991-03-08) => 8
|
||||
8 % 2 => 0
|
||||
0 || 0 => 0
|
||||
Leaving UserFN _ofunc() => 0
|
||||
../tests/test.rem(169): Trig = Friday, 8 March, 1991
|
||||
REM 8 March OMITFUNC _ofunc -1 MSG OmitFunc Test 2
|
||||
Entering UserFN _ofunc(1991-02-07)
|
||||
x => 1991-02-07
|
||||
day(1991-02-07) => 7
|
||||
Entering UserFN _ofunc(1991-03-07)
|
||||
x => 1991-03-07
|
||||
day(1991-03-07) => 7
|
||||
7 < 7 => 0
|
||||
x => 1991-02-07
|
||||
day(1991-02-07) => 7
|
||||
x => 1991-03-07
|
||||
day(1991-03-07) => 7
|
||||
7 % 2 => 1
|
||||
0 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-06)
|
||||
x => 1991-02-06
|
||||
day(1991-02-06) => 6
|
||||
Entering UserFN _ofunc(1991-03-06)
|
||||
x => 1991-03-06
|
||||
day(1991-03-06) => 6
|
||||
6 < 7 => 1
|
||||
x => 1991-02-06
|
||||
day(1991-02-06) => 6
|
||||
x => 1991-03-06
|
||||
day(1991-03-06) => 6
|
||||
6 % 2 => 0
|
||||
1 || 0 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-05)
|
||||
x => 1991-02-05
|
||||
day(1991-02-05) => 5
|
||||
Entering UserFN _ofunc(1991-03-05)
|
||||
x => 1991-03-05
|
||||
day(1991-03-05) => 5
|
||||
5 < 7 => 1
|
||||
x => 1991-02-05
|
||||
day(1991-02-05) => 5
|
||||
x => 1991-03-05
|
||||
day(1991-03-05) => 5
|
||||
5 % 2 => 1
|
||||
1 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-04)
|
||||
x => 1991-02-04
|
||||
day(1991-02-04) => 4
|
||||
Entering UserFN _ofunc(1991-03-04)
|
||||
x => 1991-03-04
|
||||
day(1991-03-04) => 4
|
||||
4 < 7 => 1
|
||||
x => 1991-02-04
|
||||
day(1991-02-04) => 4
|
||||
x => 1991-03-04
|
||||
day(1991-03-04) => 4
|
||||
4 % 2 => 0
|
||||
1 || 0 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-03)
|
||||
x => 1991-02-03
|
||||
day(1991-02-03) => 3
|
||||
Entering UserFN _ofunc(1991-03-03)
|
||||
x => 1991-03-03
|
||||
day(1991-03-03) => 3
|
||||
3 < 7 => 1
|
||||
x => 1991-02-03
|
||||
day(1991-02-03) => 3
|
||||
x => 1991-03-03
|
||||
day(1991-03-03) => 3
|
||||
3 % 2 => 1
|
||||
1 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-02)
|
||||
x => 1991-02-02
|
||||
day(1991-02-02) => 2
|
||||
Entering UserFN _ofunc(1991-03-02)
|
||||
x => 1991-03-02
|
||||
day(1991-03-02) => 2
|
||||
2 < 7 => 1
|
||||
x => 1991-02-02
|
||||
day(1991-02-02) => 2
|
||||
x => 1991-03-02
|
||||
day(1991-03-02) => 2
|
||||
2 % 2 => 0
|
||||
1 || 0 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-02-01)
|
||||
x => 1991-02-01
|
||||
day(1991-02-01) => 1
|
||||
Entering UserFN _ofunc(1991-03-01)
|
||||
x => 1991-03-01
|
||||
day(1991-03-01) => 1
|
||||
1 < 7 => 1
|
||||
x => 1991-02-01
|
||||
day(1991-02-01) => 1
|
||||
x => 1991-03-01
|
||||
day(1991-03-01) => 1
|
||||
1 % 2 => 1
|
||||
1 || 1 => 1
|
||||
Leaving UserFN _ofunc() => 1
|
||||
Entering UserFN _ofunc(1991-01-28)
|
||||
x => 1991-01-28
|
||||
day(1991-01-28) => 28
|
||||
Entering UserFN _ofunc(1991-02-28)
|
||||
x => 1991-02-28
|
||||
day(1991-02-28) => 28
|
||||
28 < 7 => 0
|
||||
x => 1991-01-28
|
||||
day(1991-01-28) => 28
|
||||
x => 1991-02-28
|
||||
day(1991-02-28) => 28
|
||||
28 % 2 => 0
|
||||
0 || 0 => 0
|
||||
Leaving UserFN _ofunc() => 0
|
||||
|
||||
Reference in New Issue
Block a user