mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Change trigdate, trigtime, trigdatetime to return 0 if trigger was not
valid.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: dorem.c,v 1.14 2005-11-20 01:26:59 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: dorem.c,v 1.15 2007-06-29 01:52:36 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
@@ -151,6 +151,7 @@ int ParseRem(ParsePtr s, Trigger *trig, TimeTrig *tim)
|
||||
tim->delta = NO_DELTA;
|
||||
tim->rep = NO_REP;
|
||||
tim->duration = NO_TIME;
|
||||
LastTriggerTime = NO_TIME;
|
||||
|
||||
while(1) {
|
||||
/* Read space-delimited string */
|
||||
|
||||
32
src/funcs.c
32
src/funcs.c
@@ -12,7 +12,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: funcs.c,v 1.13 2007-06-29 01:17:39 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: funcs.c,v 1.14 2007-06-29 01:52:36 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -1084,8 +1084,13 @@ static int FDefined(void)
|
||||
/***************************************************************/
|
||||
static int FTrigdate(void)
|
||||
{
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = LastTriggerDate;
|
||||
if (LastTrigValid) {
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = LastTriggerDate;
|
||||
} else {
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1098,15 +1103,28 @@ static int FTrigvalid(void)
|
||||
|
||||
static int FTrigtime(void)
|
||||
{
|
||||
RetVal.type = TIME_TYPE;
|
||||
RetVal.v.val = LastTriggerTime;
|
||||
if (LastTriggerTime != NO_TIME) {
|
||||
RetVal.type = TIME_TYPE;
|
||||
RetVal.v.val = LastTriggerTime;
|
||||
} else {
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int FTrigdatetime(void)
|
||||
{
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
RetVal.v.val = LastTriggerDate * MINUTES_PER_DAY + LastTriggerTime;
|
||||
if (!LastTrigValid) {
|
||||
RetVal.type = INT_TYPE;
|
||||
RetVal.v.val = 0;
|
||||
} else if (LastTriggerTime != NO_TIME) {
|
||||
RetVal.type = DATETIME_TYPE;
|
||||
RetVal.v.val = LastTriggerDate * MINUTES_PER_DAY + LastTriggerTime;
|
||||
} else {
|
||||
RetVal.type = DATE_TYPE;
|
||||
RetVal.v.val = LastTriggerDate;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: trigger.c,v 1.6 2005-09-30 03:29:32 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: trigger.c,v 1.7 2007-06-29 01:52:36 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -357,6 +357,7 @@ int ComputeTrigger(int today, Trigger *trig, int *err)
|
||||
result;
|
||||
|
||||
LastTrigValid = 0;
|
||||
|
||||
/* Assume everything works */
|
||||
*err = OK;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user