diff --git a/man/remind.1 b/man/remind.1 index 14c8bf51..48800ccc 100644 --- a/man/remind.1 +++ b/man/remind.1 @@ -149,10 +149,16 @@ The \fB\-h\fR option ("hush...") suppresses certain warning and information messages. In particular, if no reminders are triggered, this mode produces no output. .TP -\fB\-a\fR -The \fB\-a\fR option causes \fBRemind\fR not to immediately trigger timed -reminders that would also be queued. It also causes \fBRemind\fR not to -place timed reminders in a calendar. +.B \-a +The \fB\-a\fR option causes \fBRemind\fR not to immediately +trigger timed reminders that would also be queued. It also causes +\fBRemind\fR not to place timed reminders in a calendar. If you +supply two or more \fB\-a\fR options, then \fBRemind\fR \fIwill\fR +trigger timed reminders that are in the future, but will not trigger +timed reminders whose time has passed. (Regardless of how many +\fB\-a\fR options you supply, \fBRemind\fR will not include timed +reminders in the calendar if at least one \fB\-a\fR option is used.) + .TP \fB\-q\fR The \fB\-q\fR option causes \fBRemind\fR not to queue timed reminders @@ -1869,7 +1875,7 @@ If non-zero, then the \fB\-c\fR option was supplied on the command line. .B $Daemon (read-only) If the daemon mode \fB\-z\fR was invoked, contains the number of minutes between wakeups. If not running in daemon mode, contains -0. For the MS-DOS version, always contains 0. +0. .TP .B $DateSep This variable can be set only to "/" or "-". It holds the character @@ -1885,15 +1891,13 @@ from 0 to 9999. .TP .B $DontFork (read-only) If non-zero, then the \fB\-c\fR option was supplied on the command line. -For the MS-DOS version, always contains 1. .TP .B $DontTrigAts (read-only) -If non-zero, then the \fB\-a\fR option was supplied on the command line. -For the MS-DOS version, always contains 0. +The number of times that the \fB\-a\fR option was supplied on the +command line. .TP .B $DontQueue (read-only) If non-zero, then the \fB\-q\fR option was supplied on the command line. -For the MS-DOS version, always contains 1. .TP .B $EndSent (STRING type) Contains a list of characters that end a sentence. The \fBMSF\fR @@ -1996,7 +2000,7 @@ If non-zero, then the \fB\-n\fR option was supplied on the command line. .TP .B $NumQueued (read-only) Contains the number of reminders queued so far for background -timed triggering. For MS-DOS, always returns 0. +timed triggering. .TP .B $NumTrig (read-only) Contains the number of reminders triggered for the current date. One diff --git a/src/dorem.c b/src/dorem.c index b4791319..28ec6f11 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -924,7 +924,17 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err) /* Don't trigger timed reminders if DontIssueAts is true, and if the reminder is for today */ - if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) return 0; + if (jul == JulianToday && DontIssueAts && tim->ttime != NO_TIME) { + if (DontIssueAts > 1) { + /* If two or more -a options, then *DO* issue ats that are in the + future */ + if (tim->ttime < SystemTime(0) / 60) { + return 0; + } + } else { + return 0; + } + } /* Don't trigger "old" timed reminders */ /*** REMOVED... diff --git a/src/init.c b/src/init.c index 3b2cbb61..74d2d3c6 100644 --- a/src/init.c +++ b/src/init.c @@ -317,7 +317,7 @@ void InitRemind(int argc, char const *argv[]) case 'a': case 'A': - DontIssueAts = 1; + DontIssueAts++; break; case 'q': diff --git a/tests/test-rem b/tests/test-rem index 9f047c93..08b88ce4 100644 --- a/tests/test-rem +++ b/tests/test-rem @@ -83,6 +83,22 @@ rm -f ../tests/purge_dir/*.rem.purged >> ../tests/test.out 2>&1 ../src/remind -p12 ../tests/sun.rem 1 Jan 2011 >> ../tests/test.out 2>&1 +# Test -a vs -aa +../src/remind -q -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1 +REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up +REM 1 Jan 2012 AT 9:00 MSG 9am: Should not show up +REM 1 Jan 2012 AT 10:00 MSG 10am: Should not show up +MSG [$DontTrigAts] +EOF + +../src/remind -q -a -a - 1 Jan 2012 9:00 <<'EOF' >> ../tests/test.out 2>&1 +REM 1 Jan 2012 AT 8:00 MSG 8am: Should not show up +REM 1 Jan 2012 AT 9:00 MSG 9am: Should show up +REM 1 Jan 2012 AT 10:00 MSG 10am: Should show up +MSG [$DontTrigAts] +EOF + + cmp -s ../tests/test.out ../tests/test.cmp if [ "$?" = "0" ]; then echo "Remind: Acceptance test PASSED" diff --git a/tests/test.cmp b/tests/test.cmp index f3341924..d290cf9d 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -5013,3 +5013,15 @@ January 31 2011/12/31 * * * * Sunset: 16:30 2011/12/31 * * * * Dusk: 17:05 # rem2ps end +Reminders for Sunday, 1st January, 2012: + +1 + +Reminders for Sunday, 1st January, 2012: + +9am: Should show up + +10am: Should show up + +2 +