mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 14:28:40 +02:00
Compare commits
15 Commits
04.02.09-B
...
04.02.09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7356138872 | ||
|
|
616966f5df | ||
|
|
a59e277c21 | ||
|
|
740ae2c3e9 | ||
|
|
25b7a40f2b | ||
|
|
2beaab1a2f | ||
|
|
60793d53c6 | ||
|
|
4f869c8c81 | ||
|
|
8955180a35 | ||
|
|
a30cbf5797 | ||
|
|
b2bd6109dc | ||
|
|
9455ec48d7 | ||
|
|
f751f5defa | ||
|
|
994edbebbe | ||
|
|
70959b791c |
@@ -1,6 +1,6 @@
|
||||
CHANGES TO REMIND
|
||||
|
||||
* VERSION 4.2 Patch 9 - 2024-??-??
|
||||
* VERSION 4.2 Patch 9 - 2024-02-04
|
||||
|
||||
- CHANGE: remind: Do not attempt to guess terminal background color on
|
||||
startup. Only obtain it as needed. This can prevent mojibake from
|
||||
@@ -16,7 +16,12 @@ CHANGES TO REMIND
|
||||
being exceeded, include the actual limit in the error message. Clarify
|
||||
the man page regarding limits on the number of OMITs.
|
||||
|
||||
- DOCUMENTATION: Add "Astronomical Algorithms" my Jean Meeus to bibliography.
|
||||
- MINOR NEW FEATURE: remind: The expression STRING * INT or INT * STRING
|
||||
is now accepted and yields a string that is INT concatenations of the
|
||||
origina STRING. In this case, INT must be non-negative and the total
|
||||
string length can't exceed $MaxStringLen.
|
||||
|
||||
- DOCUMENTATION: Add "Astronomical Algorithms" by Jean Meeus to bibliography.
|
||||
|
||||
- DOCUMENTATION FIX: Update address of the Free Software Foundation in the
|
||||
license file.
|
||||
|
||||
@@ -231,10 +231,10 @@ calendar entries. This border is normally blank space.
|
||||
.TP
|
||||
BoxWidth and BoxHeight
|
||||
The width and height of the calendar box, from center-to-center of the
|
||||
black gridlines.
|
||||
black grid lines.
|
||||
.TP
|
||||
InBoxHeight
|
||||
The height from the center of the bottom black gridline to the top
|
||||
The height from the center of the bottom black grid line to the top
|
||||
of the regular calendar entry area. The space from here to the top
|
||||
of the box is used only to draw the day number.
|
||||
.TP
|
||||
@@ -324,7 +324,7 @@ For an example, create a file called "myprolog" whose contents are:
|
||||
.fi
|
||||
.PP
|
||||
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
|
||||
with the year and month in large gray letters in the background of the
|
||||
calendar.
|
||||
.PP
|
||||
.SH REM2PS INPUT FORMAT (-P OPTION)
|
||||
|
||||
@@ -1138,7 +1138,7 @@ reminder is queued for later activation. When \fBRemind\fR has
|
||||
finished processing the reminder file, it puts itself in the
|
||||
background, and activates timed reminders when the system time reached
|
||||
the specified time. Note that if you use the \fBNOQUEUE\fR modifier
|
||||
in the \fBREM\fR command, then this queueing and background activation
|
||||
in the \fBREM\fR command, then this queuing and background activation
|
||||
is \fInot\fR performed. \fBNOQUEUE\fR is useful if you want a time
|
||||
to be associated with a reminder (eg, in the calendar) but are not
|
||||
interested in a popup reminder happening at the specified time.
|
||||
@@ -2169,7 +2169,10 @@ Unary minus. Can be applied to an \fBINT\fR. Returns the negative
|
||||
of the operand.
|
||||
.TP
|
||||
.B *
|
||||
Multiplication. Returns the product of two \fBINT\fRs.
|
||||
Multiplication. Returns the product of two \fBINT\fRs. Alternatively, if
|
||||
one argument is a \fBSTRING\fR and the other an \fBINT\fR, returns a
|
||||
\fBSTRING\fR consisting of the INT number of repeats of the original STRING.
|
||||
In this case, the INT argument cannot be negative.
|
||||
.TP
|
||||
.B /
|
||||
Integer division. Returns the quotient of two \fBINT\fRs, discarding the
|
||||
@@ -2595,7 +2598,9 @@ The maximum number of iterations for the \fBSATISFY\fR clause
|
||||
A limit on the longest string that \fBRemind\fR will allow you
|
||||
to create. The default is 65535. If you set \fB$MaxStringLen\fR to 0
|
||||
or to -1, then \fBremind\fR will allow you to create arbitrarily-long
|
||||
strings, at least until it runs out of memory.
|
||||
strings, at least until it runs out of memory. We do not recommend
|
||||
setting \fB$MaxStringLen\fR to 0 or -1 because it is very easy to write
|
||||
code that DOSes \fBRemind\fR in that case.
|
||||
.TP
|
||||
.B $MinsFromUTC
|
||||
The number of minutes between Universal Time Coordinated and local time. If
|
||||
@@ -3659,7 +3664,7 @@ not supplied, then it defaults to \fBtoday()\fR.
|
||||
.PP
|
||||
The return value of \fBsoleq()\fR is a \fBDATETIME\fR object specifying
|
||||
the date and time of the solstice or equinox in the local time zone. It
|
||||
should be accurate to within 3 minues or so in the worst case.
|
||||
should be accurate to within 3 minutes or so in the worst case.
|
||||
.PP
|
||||
See the included file \fB$SysInclude/seasons.rem\fR for examples of how
|
||||
to use \fBsoleq()\fR.
|
||||
@@ -5556,13 +5561,13 @@ the anniversary of a death is. The following rules are used:
|
||||
o
|
||||
If the death occurred on 30 Heshvan, and Heshvan in the year after the
|
||||
death is \fIchaser\fR, then the jahrzeit is observed on 29 Heshvan in years
|
||||
when Heshvan is \fIchaser\fR. Otherwise, the yahrzeit is observed on 1
|
||||
when Heshvan is \fIchaser\fR. Otherwise, the jahrzeit is observed on 1
|
||||
Kislev when Heshvan is \fIchaser\fR.
|
||||
.TP
|
||||
o
|
||||
If the death occurred on 30 Kislev, and Kislev in the year after the
|
||||
death is \fIchaser\fR, then the jahrzeit is observed on 29 Kislev in years
|
||||
when Kislev is \fIchaser\fR. Otherwise, the yahrzeit is observed on 1
|
||||
when Kislev is \fIchaser\fR. Otherwise, the jahrzeit is observed on 1
|
||||
Tevet when Kislev is \fIchaser\fR.
|
||||
.TP
|
||||
o
|
||||
|
||||
@@ -192,7 +192,7 @@ If you create "timed" reminders, \fBTkRemind\fR will queue them in
|
||||
the background and pop up boxes as they are triggered. Additionally,
|
||||
if you created the reminder using \fBTkRemind\fR, you will be given the
|
||||
option of "turning off" the reminder for the rest of the day.
|
||||
\fBTkRemind\fR achieves queueing of background reminders by running
|
||||
\fBTkRemind\fR achieves queuing of background reminders by running
|
||||
\fBRemind\fR in \fIserver mode\fR, described later.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
@@ -2213,10 +2213,10 @@ static void WriteSimpleEntryProtocol1(CalEntry *e)
|
||||
|
||||
void WriteJSONTimeTrigger(TimeTrig const *tt)
|
||||
{
|
||||
PrintJSONKeyPairTime("ttime", tt->ttime);
|
||||
PrintJSONKeyPairTime("nextttime", tt->nexttime);
|
||||
PrintJSONKeyPairInt("delta", tt->delta);
|
||||
PrintJSONKeyPairInt("rep", tt->rep);
|
||||
PrintJSONKeyPairTime("time", tt->ttime);
|
||||
PrintJSONKeyPairTime("nexttime", tt->nexttime);
|
||||
PrintJSONKeyPairInt("tdelta", tt->delta);
|
||||
PrintJSONKeyPairInt("trep", tt->rep);
|
||||
if (tt->duration != NO_TIME) {
|
||||
PrintJSONKeyPairInt("duration", tt->duration);
|
||||
}
|
||||
|
||||
58
src/expr.c
58
src/expr.c
@@ -944,7 +944,8 @@ static int Subtract(void)
|
||||
/***************************************************************/
|
||||
static int Multiply(void)
|
||||
{
|
||||
Value v1, v2;
|
||||
Value v1, v2, v3;
|
||||
char *ptr;
|
||||
int r;
|
||||
|
||||
PopValStack(v2);
|
||||
@@ -964,6 +965,61 @@ static int Multiply(void)
|
||||
PushValStack(v1);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* String times int means repeat the string that many times */
|
||||
if ((v1.type == INT_TYPE && v2.type == STR_TYPE) ||
|
||||
(v1.type == STR_TYPE && v2.type == INT_TYPE)) {
|
||||
int rep = (v1.type == INT_TYPE ? v1.v.val : v2.v.val);
|
||||
char const *str = (v1.type == INT_TYPE ? v2.v.str : v1.v.str);
|
||||
int l;
|
||||
|
||||
/* Can't multiply by a negative number */
|
||||
if (rep < 0) {
|
||||
return E_2LOW;
|
||||
}
|
||||
if (rep == 0 || !str || !*str) {
|
||||
/* Empty string */
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
v3.type = STR_TYPE;
|
||||
v3.v.str = malloc(1);
|
||||
if (!v3.v.str) {
|
||||
return E_NO_MEM;
|
||||
}
|
||||
*v3.v.str = 0;
|
||||
PushValStack(v3);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Create the new value */
|
||||
l = (int) strlen(str);
|
||||
if (l * rep < 0) {
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_STRING_TOO_LONG;
|
||||
}
|
||||
if ((unsigned long) l * (unsigned long) rep >= (unsigned long) INT_MAX) {
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_STRING_TOO_LONG;
|
||||
}
|
||||
if (MaxStringLen > 0 && ((unsigned long) l * (unsigned long) rep) > (unsigned long)MaxStringLen) {
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_STRING_TOO_LONG;
|
||||
}
|
||||
v3.type = STR_TYPE;
|
||||
v3.v.str = malloc(l * rep + 1);
|
||||
if (!v3.v.str) {
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
*v3.v.str = 0;
|
||||
ptr = v3.v.str;
|
||||
for (int i=0; i<rep; i++) {
|
||||
strcat(ptr, str);
|
||||
ptr += l;
|
||||
}
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
PushValStack(v3);
|
||||
return OK;
|
||||
}
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_BAD_TYPE;
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ static double phase(double pdate,
|
||||
Day = pdate - epoch; /* Date within epoch */
|
||||
N = fixangle((360 / 365.2422) * Day); /* Mean anomaly of the Sun */
|
||||
M = fixangle(N + elonge - elongp); /* Convert from perigee
|
||||
co-ordinates to epoch 1980.0 */
|
||||
coordinates to epoch 1980.0 */
|
||||
Ec = kepler(M, eccent); /* Solve equation of Kepler */
|
||||
Ec = sqrt((1 + eccent) / (1 - eccent)) * tan(Ec / 2);
|
||||
Ec = 2 * todeg(atan(Ec)); /* 1 anomaly */
|
||||
|
||||
@@ -50,6 +50,7 @@ typedef struct queuedrem {
|
||||
int ntrig;
|
||||
char const *text;
|
||||
char const *fname;
|
||||
int lineno;
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
char sched[VAR_NAME_LEN+1];
|
||||
Trigger t;
|
||||
@@ -151,6 +152,7 @@ int QueueReminder(ParsePtr p, Trigger *trig,
|
||||
return E_NO_MEM;
|
||||
}
|
||||
|
||||
qelem->lineno = LineNo;
|
||||
NumQueued++;
|
||||
qelem->typ = trig->typ;
|
||||
strcpy(qelem->passthru, trig->passthru);
|
||||
@@ -619,6 +621,7 @@ json_queue(QueuedRem const *q)
|
||||
PrintJSONKeyPairInt("rundisabled", q->RunDisabled);
|
||||
PrintJSONKeyPairInt("ntrig", q->ntrig);
|
||||
PrintJSONKeyPairString("filename", q->fname);
|
||||
PrintJSONKeyPairInt("lineno", q->lineno);
|
||||
switch(q->typ) {
|
||||
case NO_TYPE: PrintJSONKeyPairString("type", "NO_TYPE"); break;
|
||||
case MSG_TYPE: PrintJSONKeyPairString("type", "MSG_TYPE"); break;
|
||||
|
||||
@@ -4828,19 +4828,53 @@ set a htmlstriptags("<img src=\"foo\">")
|
||||
htmlstriptags("<img src=\"foo\">") => ""
|
||||
|
||||
# $ParseUntriggered
|
||||
REM 2 Jan 1990 MSG ["bad_expr" * 2]
|
||||
REM 2 Jan 1990 MSG ["bad_expr" / 2]
|
||||
../tests/test.rem(885): Expired
|
||||
"bad_expr" * 2 => Type mismatch
|
||||
../tests/test.rem(885): `*': Type mismatch
|
||||
"bad_expr" / 2 => Type mismatch
|
||||
../tests/test.rem(885): `/': Type mismatch
|
||||
SET $ParseUntriggered 0
|
||||
REM 2 Jan 1990 MSG ["bad_expr" * 2]
|
||||
REM 2 Jan 1990 MSG ["bad_expr" / 2]
|
||||
../tests/test.rem(887): Expired
|
||||
SET $ParseUntriggered 1
|
||||
|
||||
# String multiplication
|
||||
|
||||
set a "low" * (-1)
|
||||
- 1 => -1
|
||||
"low" * -1 => Number too low
|
||||
../tests/test.rem(892): `*': Number too low
|
||||
set a (-1) * "low"
|
||||
- 1 => -1
|
||||
-1 * "low" => Number too low
|
||||
../tests/test.rem(893): `*': Number too low
|
||||
|
||||
set a "zero" * 0
|
||||
"zero" * 0 => ""
|
||||
set a 0 * "zero"
|
||||
0 * "zero" => ""
|
||||
|
||||
set a "" * 10000000
|
||||
"" * 10000000 => ""
|
||||
set a 10000000 * ""
|
||||
10000000 * "" => ""
|
||||
|
||||
# Too long for default limits
|
||||
set a "wookie" * 1000000
|
||||
"wookie" * 1000000 => String too long
|
||||
../tests/test.rem(902): `*': String too long
|
||||
set a 1000000 * "wookie"
|
||||
1000000 * "wookie" => String too long
|
||||
../tests/test.rem(903): `*': String too long
|
||||
|
||||
set a "Cabbage! " * 7
|
||||
"Cabbage! " * 7 => "Cabbage! Cabbage! Cabbage! Cabbage! Cabb"...
|
||||
set a 7 * "Cabbage! "
|
||||
7 * "Cabbage! " => "Cabbage! Cabbage! Cabbage! Cabbage! Cabb"...
|
||||
|
||||
# Should result in errors
|
||||
set pqxya 1+2)
|
||||
1 + 2 => 3
|
||||
../tests/test.rem(891): Expecting end-of-line
|
||||
../tests/test.rem(909): Expecting end-of-line
|
||||
|
||||
# Don't want Remind to queue reminders
|
||||
EXIT
|
||||
@@ -11707,5 +11741,5 @@ SECURITY: Won't read world-writable file or directory!
|
||||
Error reading include_dir/ww: No files matching *.rem
|
||||
04.02.09
|
||||
NOTE JSONQUEUE
|
||||
[{"priority":2,"eventstart":"VOLATILE","ttime":"23:59","nextttime":"23:59","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue2.rem","type":"MSG_TYPE","body":"XXXX"},{"priority":999,"eventstart":"VOLATILE","ttime":"23:58","nextttime":"23:58","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","type":"MSG_TYPE","body":"quux"},{"priority":42,"eventstart":"VOLATILE","ttime":"23:57","nextttime":"23:57","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","type":"MSG_TYPE","body":"bar"},{"priority":5000,"eventstart":"VOLATILE","ttime":"23:56","nextttime":"23:56","delta":0,"rep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","type":"MSG_TYPE","body":"foo"}]
|
||||
[{"priority":2,"eventstart":"VOLATILE","time":"23:59","nexttime":"23:59","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue2.rem","lineno":1,"type":"MSG_TYPE","body":"XXXX"},{"priority":999,"eventstart":"VOLATILE","time":"23:58","nexttime":"23:58","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","lineno":5,"type":"MSG_TYPE","body":"quux"},{"priority":42,"eventstart":"VOLATILE","time":"23:57","nexttime":"23:57","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","lineno":4,"type":"MSG_TYPE","body":"bar"},{"priority":5000,"eventstart":"VOLATILE","time":"23:56","nexttime":"23:56","tdelta":0,"trep":0,"rundisabled":0,"ntrig":1,"filename":"../tests/queue1.rem","lineno":3,"type":"MSG_TYPE","body":"foo"}]
|
||||
NOTE ENDJSONQUEUE
|
||||
|
||||
@@ -882,11 +882,29 @@ set a htmlstriptags("this is > whut <b>foo</b>")
|
||||
set a htmlstriptags("<img src=\"foo\">")
|
||||
|
||||
# $ParseUntriggered
|
||||
REM 2 Jan 1990 MSG ["bad_expr" * 2]
|
||||
REM 2 Jan 1990 MSG ["bad_expr" / 2]
|
||||
SET $ParseUntriggered 0
|
||||
REM 2 Jan 1990 MSG ["bad_expr" * 2]
|
||||
REM 2 Jan 1990 MSG ["bad_expr" / 2]
|
||||
SET $ParseUntriggered 1
|
||||
|
||||
# String multiplication
|
||||
|
||||
set a "low" * (-1)
|
||||
set a (-1) * "low"
|
||||
|
||||
set a "zero" * 0
|
||||
set a 0 * "zero"
|
||||
|
||||
set a "" * 10000000
|
||||
set a 10000000 * ""
|
||||
|
||||
# Too long for default limits
|
||||
set a "wookie" * 1000000
|
||||
set a 1000000 * "wookie"
|
||||
|
||||
set a "Cabbage! " * 7
|
||||
set a 7 * "Cabbage! "
|
||||
|
||||
# Should result in errors
|
||||
set pqxya 1+2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user