Compare commits

..

4 Commits

Author SHA1 Message Date
Dianne Skoll
845c41c867 Use $U instead of today() 2026-04-16 15:22:56 -04:00
Dianne Skoll
bf83ce6c98 Make calendar a bit more export-to-ics-friendly. 2026-04-16 15:18:31 -04:00
Dianne Skoll
861d268448 Allow SATISFY on command-line. 2026-04-03 15:52:58 -04:00
Dianne Skoll
02cf32c739 Permit use of "@ trigger" to specify now. 2026-04-03 10:57:31 -04:00
17 changed files with 120 additions and 32 deletions

View File

@@ -105,22 +105,22 @@ IF !Reform
ENDIF
IF IncludeOmer || IncludeOmerCal
SET ostart HEBDATE(16, "Nisan", TODAY()-50)
IF ostart <= TODAY() && (TODAY() - ostart < 49)
SET odays TODAY()-ostart+1
SET ostart HEBDATE(16, "Nisan", $U-50)
IF ostart <= $U && ($U - ostart < 49)
SET odays $U-ostart+1
IF IncludeOmer
IF odays < 7
REM MSG %"%"Today is the [ORD(odays)] day of the Omer.
REM [$U] MSG %"%"Today is the [ORD(odays)] day of the Omer.
ELSE
IF !(odays % 7)
REM MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays / 7] [PLURAL(odays/7, "week")] of the Omer.
REM [$U] MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays / 7] [PLURAL(odays/7, "week")] of the Omer.
ELSE
REM MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays/7] [PLURAL(odays/7, "week")] and [odays%7] [PLURAL(odays%7, "day")] of the Omer.
REM [$U] MSG %"%"Today is the [ORD(odays)] day of the Omer, being [odays/7] [PLURAL(odays/7, "week")] and [odays%7] [PLURAL(odays%7, "day")] of the Omer.
ENDIF
ENDIF
ENDIF
IF IncludeOmerCal
REM CAL [ORD(odays)] of Omer
REM [$U] CAL [ORD(odays)] of Omer
ENDIF
ENDIF
ENDIF

View File

@@ -33,7 +33,7 @@ TRANSLATE "are" "són"
TRANSLATE "were" "eren"
TRANSLATE "done" "completada"
FSET - subst_bx(a,d,t) iif(d==today()+2, "demà passat", d >= today(), "d'aquí " + (d-today()) + " dies", "fa " + (today()-d) + " dies")
FSET - subst_bx(a,d,t) iif(d==$U+2, "demà passat", d >= $U, "d'aquí " + (d-$U) + " dies", "fa " + ($U-d) + " dies")
# 1 d'abril vs 1 de maig.
FSET - subst_sx(a,d,t) iif(isany(substr(mon(d), 1, 1), "a", "o") , "d'", "de")

View File

@@ -58,12 +58,12 @@ FSET - subst_ampm(h) iif(h<5, " om natten", h < 12, " om formiddagen", h < 18, "
FSET - subst_ordinal(d) "."
FSET - ordx(n) n + "."
FSET - subst_p(alt, d, t) iif(d==today()+1, "", "e")
FSET - subst_p(alt, d, t) iif(d==$U+1, "", "e")
FSET - zeropad(s, len) pad(s, "0", len)
FSET - subst_a_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d) + " " + year(d)
FSET - subst_ax(alt, d, t) iif(alt, subst_a_alt(d), $On + " " + subst_a_alt(d))
FSET - subst_bx(a, d, t) iif(d >= today(), "om " + (d-today()) + " dage", "for " + (today()-d) + " dage siden")
FSET - subst_bx(a, d, t) iif(d >= $U, "om " + (d-$U) + " dage", "for " + ($U-d) + " dage siden")
FSET - subst_ex(alt, d, t) "den " + zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(year(d), 4)
FSET - subst_fx(alt, d, t) "den " + zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2) + $DateSep + zeropad(year(d), 4)

View File

@@ -61,14 +61,14 @@ FSET - ordx(n) n + "."
FSET - subst_a_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d) + " " + year(d)
FSET - subst_ax(alt, d, t) iif(alt, subst_a_alt(d), $On + " " + subst_a_alt(d))
FSET - subst_bx(a, d, t) iif(d >= today(), "in " + (d-today()) + " Tagen", "vor " + (today()-d) + " Tagen")
FSET - subst_bx(a, d, t) iif(d >= $U, "in " + (d-$U) + " Tagen", "vor " + ($U-d) + " Tagen")
FSET - subst_g_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d)
FSET - subst_gx(alt, d, t) iif(alt, subst_g_alt(d), $On + " " + subst_g_alt(d))
FSET - subst_ux(alt, d, t) subst_ax(alt, d, t)
FSET - subst_vx(alt, d, t) subst_gx(alt, d, t)
FSET - subst_p(alt, d, t) iif(d == today()+1, "", "en")
FSET - subst_p(alt, d, t) iif(d == $U+1, "", "en")
# Localization of various astronomical events

View File

@@ -52,4 +52,4 @@ SET $And "y"
SET $Hplu "s"
SET $Mplu "s"
FSET - subst_bx(a, d, t) iif(d >= today(), "dentro de " + (d-today()) + " días", "hace " + (today()-d) + " dias")
FSET - subst_bx(a, d, t) iif(d >= $U, "dentro de " + (d-$U) + " días", "hace " + ($U-d) + " dias")

View File

@@ -62,7 +62,7 @@ FSET - ordx(d) d + subst_ordinal(d)
FSET - subst_a_alt(d, o, p) wkday(d) + o + " " + day(d) + ". " + mon(d) + p + " " + year(d)
FSET - subst_ax(a, d, t) iif(a, subst_a_alt(d, "", ""), subst_a_alt(d, $On, "ta"))
FSET - subst_bx(a, d, t) iif(d >= today(), (d-today()) + " päivän kuluttua", (today()-d) + " päivää sitten")
FSET - subst_bx(a, d, t) iif(d >= $U, (d-$U) + " päivän kuluttua", ($U-d) + " päivää sitten")
FSET - subst_cx(a, d, t) iif(a, wkday(d), wkday(d) + $On)
FSET - subst_ex(a, d, t) zeropad(day(d), 2) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(year(d), 4)
@@ -81,7 +81,7 @@ FSET - subst_k_alt(d, o) wkday(d) + o + " " + mon(d) + "n " + day(d) + subst_ord
FSET - subst_kx(a, d, t) iif(a, subst_k_alt(d, ""), subst_k_alt(d, $On))
FSET - subst_lx(a, d, t) zeropad(year(d), 4) + $DateSep + zeropad(monnum(d), 2) + $DateSep + zeropad(day(d), 2)
FSET - subst_p(a, d, t) iif(d==today()+1, "", "ä")
FSET - subst_p(a, d, t) iif(d==$U+1, "", "ä")
FSET - subst_qx(a, d, t) "n"
FSET - subst_u_alt(d, o, p) wkday(d) + o + " " + day(d) + subst_ordinal(day(d)) + " " + mon(d) + p + " " + year(d)

View File

@@ -63,7 +63,7 @@ FSET - subst_1(alt, date, time) iif(time == now(), "maintenant", \
time > now(), "dans " + subst_tdiff((time-now())/60, (time-now())%60), \
"il y a " + subst_tdiff ((now()-time)/60, (now()-time)%60))
FSET - subst_bx(alt, date, time) iif(date >= today(), "dans " + (date-today()) + " jours", "il y a " + (today()-date) + " jours")
FSET - subst_bx(alt, date, time) iif(date >= $U, "dans " + (date-$U) + " jours", "il y a " + ($U-date) + " jours")
FSET - subst_j_alt(date) wkday(date) + ", " + day(date) + subst_ordinal(day(date)) + " " + mon(date) + ", " + year(date)
FSET - subst_jx(alt, date, time) iif(alt, subst_j_alt(date), $On + " " + subst_j_alt(date))

View File

@@ -54,7 +54,7 @@ SET $And "και"
SET $Hplu ""
SET $Mplu ""
FSET - subst_bx(a, d, t) iif(d >= today(), "σε " + (d - today()) + " ημέρες", "πριν από " + (today()-d) + " ημέρες")
FSET - subst_bx(a, d, t) iif(d >= $U, "σε " + (d - $U) + " ημέρες", "πριν από " + ($U-d) + " ημέρες")
FSET - subst_ordinal(d) "."
FSET - ordx(d) d + "."
FSET - subst_a_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d) + " " + year(d)

View File

@@ -54,5 +54,5 @@ SET $And "og"
SET $Hplu "ir"
SET $Mplu "r"
FSET - subst_bx(a, d, t) iif(d >= today(), "eftir " + (d - today()) + " daga", "fyrir " + (today()-d) + " dögum")
FSET - subst_p(a, d, t) iif(d == today()+1, "", "a")
FSET - subst_bx(a, d, t) iif(d >= $U, "eftir " + (d - $U) + " daga", "fyrir " + ($U-d) + " dögum")
FSET - subst_p(a, d, t) iif(d == $U+1, "", "a")

View File

@@ -53,9 +53,9 @@ SET $And "e"
SET $Hplu "a"
SET $Mplu "i"
FSET - subst_bx(a, d, t) iif(d >= today(), "fra " + (d-today()) + " giorni", (today()-d) + " giorni fa")
FSET - subst_p(a, d, t) iif(d==today()+1, "o", "i")
FSET - subst_q(a, d, t) iif(d==today()+1, "a", "e")
FSET - subst_bx(a, d, t) iif(d >= $U, "fra " + (d-$U) + " giorni", ($U-d) + " giorni fa")
FSET - subst_p(a, d, t) iif(d==$U+1, "o", "i")
FSET - subst_q(a, d, t) iif(d==$U+1, "a", "e")
FSET - subst_ax(a, d, t) wkday(d) + ", " + day(d) + " " + mon(d) + " " + year(d)
FSET - subst_jx(a, d, t) subst_ax(a, d, t)

View File

@@ -59,7 +59,7 @@ FSET - subst_1b(hdiff, mdiff) iif(hdiff==0, subst_minutes(mdiff), mdiff==0, subs
FSET - subst_minutes(m) iif(m==1, "1 minuut", m + " minuten")
FSET - subst_hours(h) iif(h==1, "1 uur", h + " uren")
FSET - subst_bx(a, d, t) iif (d == today()+2, "overmorgen", d+2 == today(), "eergisteren", d >= today(), "over " + (d-today()) + " dagen", (today()-d) + " dagen geleden")
FSET - subst_bx(a, d, t) iif (d == $U+2, "overmorgen", d+2 == $U, "eergisteren", d >= $U, "over " + (d-$U) + " dagen", ($U-d) + " dagen geleden")
FSET - subst_s(a, d, t) iif(day(d) == 1 || day(d) == 8, "e", day(d) < 20, "de", "te")

View File

@@ -53,7 +53,7 @@ SET $And "og"
SET $Hplu "r"
SET $Mplu "er"
FSET - subst_bx(a, d, t) iif(d >= today(), "om " + (d-today()) + " dager", "for " + (today()-d) + " dager siden")
FSET - subst_bx(a, d, t) iif(d >= $U, "om " + (d-$U) + " dager", "for " + ($U-d) + " dager siden")
FSET - subst_ordinal(d) "."
FSET - ordx(n) n + "."
@@ -63,4 +63,4 @@ FSET - subst_gx(a, d, t) iif(a, subst_g_alt(d), $On + " " + subst_g_alt(d))
FSET - subst_g_alt(d) wkday(d) + ", den " + day(d) + ". " + mon(d)
FSET - subst_ux(a, d, t) subst_ax(a, d, t)
FSET - subst_vx(a, d, t) subst_gx(a, d, t)
FSET - subst_p(a, d, t) iif(d==today()+1, "", "er")
FSET - subst_p(a, d, t) iif(d==$U+1, "", "er")

View File

@@ -58,7 +58,7 @@ FSET - subst_ordinal(d) ""
FSET - subst_a_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d) + " " + year(d)
FSET - subst_ax(a, d, t) iif(a, subst_a_alt(d), $On + " " + subst_a_alt(d))
FSET - subst_bx(a, d, t) iif(d >= today(), "za " + (d-today()) + " dni", (today()-d) + " dni temu")
FSET - subst_bx(a, d, t) iif(d >= $U, "za " + (d-$U) + " dni", ($U-d) + " dni temu")
FSET - subst_g_alt(d) wkday(d) + ", " + day(d) + ". " + mon(d)
FSET - subst_gx(a, d, t) iif(a, subst_g_alt(d), $On + " " + subst_g_alt(d))
FSET - subst_ux(a, d, t) subst_ax(a, d, t)

View File

@@ -58,7 +58,7 @@ FSET - subst_ordinal(d) ""
FSET - subst_on_wd(d) iif(wkdaynum(d) == 1 || wkdaynum(d) == 2, "no", "na")
FSET - subst_a_alt(d) wkday(d) + ", " + day(d) + " de " + mon(d) + " de " + year(d)
FSET - subst_bx(a, d, t) iif(d >= today(), "em " + (d-today()) + " dias", "há " + (today()-d) + " dias")
FSET - subst_bx(a, d, t) iif(d >= $U, "em " + (d-$U) + " dias", "há " + ($U-d) + " dias")
FSET - subst_c_alt(d) wkday(d)
FSET - subst_g_alt(d) wkday(d) + ", " + day(d) + " " + mon(d)
FSET - subst_ax(a, d, t) iif(a, subst_a_alt(d), subst_on_wd(d) + " " + subst_a_alt(d))

View File

@@ -53,7 +53,7 @@ SET $Mplu "e"
SET $Hplu "e"
SET $And "şi"
FSET - subst_bx(a, d, t) iif(d >= today(), "peste " + (d-today()) + " zile", "acume " + (today()-d) + " zile")
FSET - subst_bx(a, d, t) iif(d >= $U, "peste " + (d-$U) + " zile", "acume " + ($U-d) + " zile")
FSET - subst_ampm(h) iif(h<4, " noaptea", h<12, " dimineaţa", h<18, " după-amiaza", " seara")
FSET - subst_ordinal(d) ""
@@ -65,7 +65,7 @@ FSET - subst_jx(a, d, t) wkday(d) + ", " + mon(d) + " " + day(d) + ", " + year(d
FSET - subst_kx(a, d, t) wkday(d) + ", " + mon(d) + " " + day(d)
FSET - subst_ux(a, d, t) subst_ax(a, d, t)
FSET - subst_vx(a, d, t) subst_gx(a, d, t)
FSET - subst_p(a, d, t) iif(d==today()+1, "", "le")
FSET - subst_p(a, d, t) iif(d==$U+1, "", "le")
FSET - subst_1(a, d, t) iif(t==now(), $Now, t<now(), subst_1helper(now()-t, "acum "), subst_1helper(t-now(), "peste "))
FSET - subst_1helper(diff, when) when + iif(diff%60==0, subst_1h(diff/60), diff/60==0, subst_1m(diff%60), subst_1h(diff/60) + " " + $And + " " + subst_1m(diff%60))

View File

@@ -4727,6 +4727,7 @@ FEvalTrig(func_info *info)
return r;
}
if (trig.tz != NULL && tim.ttime == NO_TIME) {
DestroyParser(&p);
FreeTrig(&trig);
return E_TZ_NO_AT;
}
@@ -4753,7 +4754,10 @@ FEvalTrig(func_info *info)
dse = -1;
}
DestroyParser(&p);
if (r) return r;
if (r) {
FreeTrig(&trig);
return r;
}
if (dse < 0) {
RetVal.type = INT_TYPE;
RETVAL = dse;

View File

@@ -54,6 +54,8 @@ static int tty_init(int fd);
static void tty_raw(int fd);
static void tty_reset(int fd);
static int GetInitDateFromTrigger(char const *s, int *y, int *m, int *d, int *systime);
static void ProcessLongOption(char const *arg);
/***************************************************************
*
@@ -183,6 +185,7 @@ void InitRemind(int argc, char const *argv[])
int x;
int dse;
int ttyfd;
int r;
/* Make sure remind is not installed set-uid or set-gid */
if (getgid() != getegid() ||
@@ -740,10 +743,28 @@ void InitRemind(int argc, char const *argv[])
if (i < argc) {
while (i < argc) {
arg = argv[i++];
/* If it begins with '@' then it's a trigger spec */
if (*arg == '@') {
if (m != NO_MON || d != NO_DAY || y != NO_YR || dse != NO_DATE) {
Usage();
}
r = GetInitDateFromTrigger(arg+1, &y, &m, &d, &SysTime);
if (r == OK) {
if (SysTime != -1) {
DontQueue = 1;
Daemon = 0;
LocalSysTime = SysTime;
}
} else {
fprintf(stderr, "Could not evaluate command-line trigger: %s\n", GetErr(r));
Usage();
}
continue;
}
FindToken(arg, &tok);
switch (tok.type) {
case T_Time:
if (SysTime != -1L) Usage();
if (SysTime != -1) Usage();
else {
SysTime = (long) tok.val * 60L;
LocalSysTime = SysTime;
@@ -753,7 +774,7 @@ void InitRemind(int argc, char const *argv[])
break;
case T_DateTime:
if (SysTime != -1L) Usage();
if (SysTime != -1) Usage();
if (m != NO_MON || d != NO_DAY || y != NO_YR || dse != NO_DATE) Usage();
SysTime = (tok.val % MINUTES_PER_DAY) * 60;
LocalSysTime = SysTime;
@@ -1398,3 +1419,66 @@ GetTerminalBackground(void)
}
return TerminalBackground;
}
static int
GetInitDateFromTrigger(char const *s, int *y, int *m, int *d, int *systime)
{
Parser p;
Trigger trig;
TimeTrig tim;
int dse;
int r;
CreateParser(s, &p);
r = ParseRem(&p, &trig, &tim);
if (r) {
DestroyParser(&p);
return r;
}
if (trig.tz != NULL && tim.ttime == NO_TIME) {
DestroyParser(&p);
FreeTrig(&trig);
return E_TZ_NO_AT;
}
if (trig.typ == SAT_TYPE) {
EnterTimezone(trig.tz);
r=DoSatRemind(&trig, &tim, &p);
ExitTimezone(trig.tz);
if (r) {
DestroyParser(&p);
FreeTrig(&trig);
return r;
}
dse = LastTriggerDate;
} else if (trig.typ == NO_TYPE) {
EnterTimezone(trig.tz);
dse = ComputeTrigger(get_scanfrom(&trig), &trig, &tim, &r, 0);
ExitTimezone(trig.tz);
} else {
DestroyParser(&p);
FreeTrig(&trig);
return E_PARSE_ERR;
}
DestroyParser(&p);
if (r) {
FreeTrig(&trig);
return r;
}
if (dse < 0) {
FreeTrig(&trig);
return E_CANT_TRIG;
}
if (dse >= 0) {
if (tim.ttime != NO_TIME) {
if (*systime != -1) {
Usage();
}
dse=AdjustTriggerForTimeZone(&trig, dse, &tim, 1);
*systime = tim.ttime * 60;
}
FromDSE(dse, y, m, d);
}
FreeTrig(&trig);
return OK;
}