When you supply the date on the command-line, permit leaving out the year, which defaults to this year in that case.

This commit is contained in:
Dianne Skoll
2026-04-02 14:48:18 -04:00
parent dcf55e0fba
commit 1f960039a1
2 changed files with 9 additions and 10 deletions

View File

@@ -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. Allows you to define a function on the command line.
.PP .PP
If you supply a \fIdate\fR on the command line, it must consist of 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 \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 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. 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 .PP
If you do supply a \fIdate\fR on the command line, then \fBRemind\fR 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." uses it, rather than the actual system date, as its notion of "today."

View File

@@ -806,16 +806,13 @@ void InitRemind(int argc, char const *argv[])
if (dse != NO_DATE) { if (dse != NO_DATE) {
FromDSE(dse, &y, &m, &d); 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 || d != NO_DAY) {
if (m == NO_MON || y == NO_YR) { if (y == NO_YR) {
if (rep == NO_REP) Usage(); y = CurYear;
else if (m != NO_MON || y != NO_YR) Usage(); }
else { if (m == NO_MON) {
m = CurMon; Usage();
y = CurYear;
if (d == NO_DAY) d = CurDay;
}
} }
if (d == NO_DAY) d=1; if (d == NO_DAY) d=1;
if (d > DaysInMonth(m, y)) { if (d > DaysInMonth(m, y)) {