diff --git a/src/err.h b/src/err.h index aeb05c83..fdbcd947 100644 --- a/src/err.h +++ b/src/err.h @@ -119,6 +119,7 @@ #define E_NO_MATCHING_REMS 100 #define E_STRING_TOO_LONG 101 #define E_TIME_TWICE 102 +#define E_DURATION_NO_AT 103 #ifdef MK_GLOBALS #undef EXTERN #define EXTERN @@ -234,7 +235,8 @@ EXTERN char *ErrMsg[] "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" } #endif /* MK_GLOBALS */ ; diff --git a/src/langs/finnish.h b/src/langs/finnish.h index 5b0fbe75..4da6b8f2 100644 --- a/src/langs/finnish.h +++ b/src/langs/finnish.h @@ -302,7 +302,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" #elif IBMEXTENDED "Ok", @@ -407,7 +408,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" #else "Ok", @@ -512,7 +514,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" #endif diff --git a/src/langs/french.h b/src/langs/french.h index 2a68b371..b93d424b 100644 --- a/src/langs/french.h +++ b/src/langs/french.h @@ -242,7 +242,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" #else /* ISOLATIN1 */ "Ok", @@ -347,7 +348,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" #endif /* ISOLATIN1 */ }; #endif /* MK_GLOBALS */ diff --git a/src/langs/polish.h b/src/langs/polish.h index 5b8bd995..dbe173c6 100644 --- a/src/langs/polish.h +++ b/src/langs/polish.h @@ -281,7 +281,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" #else /* ISOLATIN1 */ "OK", "Brakujacy ']'", @@ -385,7 +386,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" #endif /* ISOLATIN1 */ }; #endif /* MK_GLOBALS */ diff --git a/src/langs/portbr.h b/src/langs/portbr.h index 40d31454..ca7e905c 100644 --- a/src/langs/portbr.h +++ b/src/langs/portbr.h @@ -247,7 +247,8 @@ EXTERN char *ErrMsg[] = "Can't convert between time zones", "No files matching *.rem", "String too long", - "Time specified twice" + "Time specified twice", + "Cannot specify DURATION without specifying AT" }; #endif /* MK_GLOBALS */ diff --git a/src/trigger.c b/src/trigger.c index eec5d03a..63a7346d 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -513,6 +513,11 @@ int ComputeTriggerNoAdjustDuration(int today, Trigger *trig, TimeTrig *tim, return -1; } + if (tim->duration != NO_TIME && tim->ttime == NO_TIME) { + *err = E_DURATION_NO_AT; + return -1; + } + if (trig->rep != NO_REP && (trig->d == NO_DAY || trig->m == NO_MON || diff --git a/tests/test.cmp b/tests/test.cmp index e2a94526..3ff310a3 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -1379,6 +1379,9 @@ $Tw => 4 Thursday, the 14th +# This is now an error +REM DURATION 15:00 MSG Should fail... need AT if you have DURATION. +../tests/test.rem(396): Cannot specify DURATION without specifying AT diff --git a/tests/test.rem b/tests/test.rem index 5393fca8..44c9dcfb 100644 --- a/tests/test.rem +++ b/tests/test.rem @@ -392,6 +392,8 @@ REM 14 AT 16:00 DURATION 8:00 SATISFY [$Tw == 4] MSG Thursday, the 14th REM 14 AT 16:00 DURATION 32:00 SATISFY [$Tw == 4] MSG Thursday, the 14th REM 14 AT 16:00 DURATION 40:00 SATISFY [$Tw == 4] MSG Thursday, the 14th +# This is now an error +REM DURATION 15:00 MSG Should fail... need AT if you have DURATION. __EOF__ REM This line should not even be seen