mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 14:28:40 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
861d268448 | ||
|
|
02cf32c739 | ||
|
|
1f960039a1 | ||
|
|
dcf55e0fba | ||
|
|
aa8f5a9731 |
40
april-fools-announcements/2026-april-fool-announcement.txt
Normal file
40
april-fools-announcements/2026-april-fool-announcement.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
Hi, all,
|
||||
|
||||
As you know, Remind has been around for a long time---over 36 years.
|
||||
It's written in C, and I think it's high time to rewrite it in a
|
||||
memory-safe language. After all, one CVE in 36 years is simply
|
||||
unacceptable.
|
||||
|
||||
I was looking at writing it in Rust, but decided that Rust isn't quite
|
||||
mature enough yet. So I decided to do it in FORTAN-77. I chose
|
||||
FORTRAN-77 over the more obvious choice of COBOL because I studied
|
||||
engineering and not business.
|
||||
|
||||
The rewrite will have the following implications:
|
||||
|
||||
o Remind will henceforth be known as REMIND.
|
||||
|
||||
o Sadly, I have to drop UTF-8 support. Your choices are ASCII or
|
||||
EBCDIC.
|
||||
|
||||
o All statements must begin in column 7. That means you might need to
|
||||
edit your existing scripts to add 6 spaces at the beginning of the
|
||||
line.
|
||||
|
||||
o Variables whose names begin with "I" through "N" can only hold INTs.
|
||||
|
||||
o I will be setting up a store on my web site to sell punched cards.
|
||||
(Yes; those will be needed to run REMIND.)
|
||||
|
||||
Now, I confess I haven't programmed in FORTRAN-77 in several decades,
|
||||
so I plan on using AI to assist me. After all, it has been trained on
|
||||
the mountains of open-source FORTRAN-77 code on the Internet.
|
||||
|
||||
I anticipate the rewrite will take about 9 years. You can use this
|
||||
reminder to alert yourself to when it's ready:
|
||||
|
||||
REM 1 APRIL 2035 MSG REMIND IN FORTRAN-77 READY. STOP.
|
||||
|
||||
Regards,
|
||||
|
||||
Dianne.
|
||||
@@ -515,10 +515,12 @@ In other words, \fB\-i\fIvar\fR is exactly the same as \fB\-i\fIvar\fR\fB=\fR0.
|
||||
Allows you to define a function on the command line.
|
||||
.PP
|
||||
If you supply a \fIdate\fR on the command line, it must consist of
|
||||
\fIday month year\fR, where \fIday\fR is the day of the month,
|
||||
[\fIday\fR] \fImonth\fR [\fIyear\fR], where \fIday\fR is the day of the month,
|
||||
\fImonth\fR is at least the first three letters of the English name
|
||||
of the month, and \fIyear\fR is a year (all 4 digits) from 1990 to
|
||||
about 2075. You can leave out the \fIday\fR, which then defaults to 1.
|
||||
If you leave out the year, then it defaults to the current year. You
|
||||
cannot leave out the \fImonth\fR.
|
||||
.PP
|
||||
If you do supply a \fIdate\fR on the command line, then \fBRemind\fR
|
||||
uses it, rather than the actual system date, as its notion of "today."
|
||||
|
||||
@@ -80,6 +80,8 @@ install: all
|
||||
$(INSTALL_DATA) $$man $(DESTDIR)$(mandir)/man1 || exit 1; \
|
||||
done
|
||||
-mkdir -p $(DESTDIR)$(datarootdir)/remind || true
|
||||
# Avoid problems with symlinks under holidays/
|
||||
-rm -rf $(DESTDIR)$(datarootdir)/remind/holidays > /dev/null 2>&1 || true
|
||||
cp -R ../include/* $(DESTDIR)$(datarootdir)/remind
|
||||
chmod -R a+rX $(DESTDIR)$(datarootdir)/remind
|
||||
-mkdir -p $(DESTDIR)$(prefix)/share/pixmaps
|
||||
|
||||
@@ -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;
|
||||
|
||||
103
src/init.c
103
src/init.c
@@ -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;
|
||||
@@ -806,16 +827,13 @@ void InitRemind(int argc, char const *argv[])
|
||||
if (dse != NO_DATE) {
|
||||
FromDSE(dse, &y, &m, &d);
|
||||
}
|
||||
/* Must supply date in the form: day, mon, yr OR mon, yr */
|
||||
/* Must supply date in the form: day, mon, yr OR mon, yr */
|
||||
if (m != NO_MON || y != NO_YR || d != NO_DAY) {
|
||||
if (m == NO_MON || y == NO_YR) {
|
||||
if (rep == NO_REP) Usage();
|
||||
else if (m != NO_MON || y != NO_YR) Usage();
|
||||
else {
|
||||
m = CurMon;
|
||||
y = CurYear;
|
||||
if (d == NO_DAY) d = CurDay;
|
||||
}
|
||||
if (y == NO_YR) {
|
||||
y = CurYear;
|
||||
}
|
||||
if (m == NO_MON) {
|
||||
Usage();
|
||||
}
|
||||
if (d == NO_DAY) d=1;
|
||||
if (d > DaysInMonth(m, y)) {
|
||||
@@ -1401,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user