diff --git a/src/calendar.c b/src/calendar.c index 0cc5c058..f8563c26 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -1830,6 +1830,10 @@ static int DoCalRem(ParsePtr p, int col) DBufFree(&buf); } trig.typ = tok.val; + + /* Convert some SPECIALs back to plain types */ + FixSpecialType(&trig); + if (trig.typ == MSG_TYPE || trig.typ == CAL_TYPE || trig.typ == MSF_TYPE) { diff --git a/src/dorem.c b/src/dorem.c index 8d23c9d3..0cbbf044 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -123,8 +123,12 @@ int DoRem(ParsePtr p) } StrnCpy(trig.passthru, DBufValue(&buf), PASSTHRU_LEN); DBufFree(&buf); - } - trig.typ = tok.val; + } + trig.typ = tok.val; + + /* Convert some SPECIALs back to plain types */ + FixSpecialType(&trig); + dse = LastTriggerDate; if (!LastTrigValid || PurgeMode) { FreeTrig(&trig); @@ -370,6 +374,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim, int save_in_globals) } StrnCpy(trig->passthru, DBufValue(&buf), PASSTHRU_LEN); } + FixSpecialType(trig); parsing = 0; break; @@ -1466,3 +1471,25 @@ static int ShouldTriggerBasedOnWarn(Trigger *t, int dse, int *err) } } } + +void FixSpecialType(Trigger *t) +{ + if (t->typ != PASSTHRU_TYPE) { + return; + } + + /* Convert SPECIAL MSG / MSF / RUN / CAL to just plain MSG / MSF / etc */ + if (!StrCmpi(t->passthru, "MSG")) { + t->typ = MSG_TYPE; + } else if (!StrCmpi(t->passthru, "MSF")) { + t->typ = MSF_TYPE; + } else if (!StrCmpi(t->passthru, "RUN")) { + t->typ = RUN_TYPE; + } else if (!StrCmpi(t->passthru, "CAL")) { + t->typ = CAL_TYPE; + } else if (!StrCmpi(t->passthru, "PS")) { + t->typ = PS_TYPE; + } else if (!StrCmpi(t->passthru, "PSFILE")) { + t->typ = PSF_TYPE; + } +} diff --git a/src/protos.h b/src/protos.h index a265cea2..ce3b697d 100644 --- a/src/protos.h +++ b/src/protos.h @@ -177,6 +177,7 @@ int push_call(char const *filename, char const *func, int lineno); void clear_callstack(void); int print_callstack(FILE *fp); void pop_call(void); +void FixSpecialType(Trigger *trig); #ifdef REM_USE_WCHAR #define _XOPEN_SOURCE 600 #include