mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-30 21:07:07 +02:00
Fix more bugs in -sa mode.
This commit is contained in:
+3
-3
@@ -11,7 +11,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.18 2007-07-12 03:09:44 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: calendar.c,v 1.19 2007-07-12 03:14:36 dfs Exp $";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -694,10 +694,10 @@ static int DoCalRem(ParsePtr p, int col)
|
||||
}
|
||||
oldLen = DBufLen(&obuf);
|
||||
|
||||
/* In -sa mode, run in NORMAL mode if we're triggering
|
||||
/* In -sa mode, run in ADVANCE mode if we're triggering
|
||||
* before the actual date */
|
||||
if (jul != JulianToday) {
|
||||
r = DoSubst(p, &obuf, &trig, &tim, jul, NORMAL_MODE);
|
||||
r = DoSubst(p, &obuf, &trig, &tim, jul, ADVANCE_MODE);
|
||||
} else {
|
||||
r = DoSubst(p, &obuf, &trig, &tim, jul, CAL_MODE);
|
||||
}
|
||||
|
||||
+7
-5
@@ -12,7 +12,7 @@
|
||||
/***************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
static char const RCSID[] = "$Id: dosubst.c,v 1.12 2007-07-01 20:12:15 dfs Exp $";
|
||||
static char const RCSID[] = "$Id: dosubst.c,v 1.13 2007-07-12 03:14:36 dfs Exp $";
|
||||
|
||||
#define L_IN_DOSUBST
|
||||
#include <stdio.h>
|
||||
@@ -44,6 +44,7 @@ static char TOMORROW[] = L_TOMORROW;
|
||||
/* Process the % escapes in the reminder. If */
|
||||
/* mode==NORMAL_MODE, ignore the %" sequence. If */
|
||||
/* mode==CAL_MODE, process the %" sequence. */
|
||||
/* If mode==ADVANCE_MODE, ignore %" but don't add newline */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode)
|
||||
@@ -131,7 +132,8 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
}
|
||||
if (c == '\n') continue;
|
||||
if (!c) {
|
||||
if (mode != CAL_MODE && t->typ != RUN_TYPE && !MsgCommand) {
|
||||
if (mode != CAL_MODE && mode != ADVANCE_MODE &&
|
||||
t->typ != RUN_TYPE && !MsgCommand) {
|
||||
if (DBufPutc(dbuf, '\n') != OK) return E_NO_MEM;
|
||||
}
|
||||
break;
|
||||
@@ -569,7 +571,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
break;
|
||||
|
||||
case '_':
|
||||
if (mode != CAL_MODE && !MsgCommand)
|
||||
if (mode != CAL_MODE && mode != ADVANCE_MODE && !MsgCommand)
|
||||
sprintf(s, "%s", NL);
|
||||
else
|
||||
sprintf(s, " ");
|
||||
@@ -602,7 +604,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
/* If there are NO quotes, then: If CAL_MODE && RUN_TYPE, we don't want the
|
||||
reminder in the calendar. Zero the output buffer and quit. */
|
||||
if (!has_quote) {
|
||||
if (mode == CAL_MODE && t->typ == RUN_TYPE) {
|
||||
if ((mode == ADVANCE_MODE || mode == CAL_MODE) && t->typ == RUN_TYPE) {
|
||||
*DBufValue(dbuf) = 0;
|
||||
dbuf->len = 0;
|
||||
}
|
||||
@@ -614,7 +616,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
|
||||
ss = DBufValue(dbuf) + origLen;
|
||||
os = ss;
|
||||
if (mode == NORMAL_MODE) {
|
||||
if (mode == NORMAL_MODE || mode == ADVANCE_MODE) {
|
||||
while (*ss) {
|
||||
if (*ss != QUOTE_MARKER) *os++ = *ss;
|
||||
ss++;
|
||||
|
||||
+5
-3
@@ -10,7 +10,7 @@
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
/* $Id: types.h,v 1.7 2005-11-20 01:26:59 dfs Exp $ */
|
||||
/* $Id: types.h,v 1.8 2007-07-12 03:14:36 dfs Exp $ */
|
||||
|
||||
#include <limits.h>
|
||||
#include "dynbuf.h"
|
||||
@@ -169,8 +169,10 @@ typedef struct {
|
||||
#define IF_ELSE_MASK 2
|
||||
|
||||
/* Flags for the DoSubst function */
|
||||
#define NORMAL_MODE 0
|
||||
#define CAL_MODE 1
|
||||
#define NORMAL_MODE 0
|
||||
#define CAL_MODE 1
|
||||
#define ADVANCE_MODE 2
|
||||
|
||||
#define QUOTE_MARKER 1 /* Unlikely character to appear in reminder */
|
||||
|
||||
/* Flags for disabling run */
|
||||
|
||||
Reference in New Issue
Block a user