From b6ad67891ce4fc3d55bb6937ea5c0f125f2219b2 Mon Sep 17 00:00:00 2001 From: dfs Date: Sun, 16 Oct 2005 14:48:02 +0000 Subject: [PATCH] Implement Paul Pelzl's patch for combining -n with -s/-p --- src/custom.h | 2 +- src/dorem.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++----- src/main.c | 4 ++-- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/src/custom.h b/src/custom.h index 6a0f2411..1d536c57 100644 --- a/src/custom.h +++ b/src/custom.h @@ -11,7 +11,7 @@ /* */ /***************************************************************/ -/* $Id: custom.h,v 1.33 2005-09-30 03:29:32 dfs Exp $ */ +/* $Id: custom.h,v 1.34 2005-10-16 14:48:02 dfs Exp $ */ /*---------------------------------------------------------------------*/ /* LAT_DEG, LAT_MIN and LAT_SEC: Latitude of your location */ diff --git a/src/dorem.c b/src/dorem.c index 7b643d31..a539a28c 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -13,7 +13,7 @@ /***************************************************************/ #include "config.h" -static char const RCSID[] = "$Id: dorem.c,v 1.12 2005-09-30 03:29:32 dfs Exp $"; +static char const RCSID[] = "$Id: dorem.c,v 1.13 2005-10-16 14:48:02 dfs Exp $"; #include #include @@ -532,11 +532,13 @@ static int ParseScanFrom(ParsePtr s, Trigger *t) { int r, y, m, d; char PrioExpr[25]; - DynamicBuffer buf; + char tmpBuf[64]; + DynamicBuffer buf, calRow; char *s; Value v; DBufInit(&buf); + DBufInit(&calRow); if (t->typ == RUN_TYPE && RunDisabled) return E_RUN_DISABLED; if (t->typ == PASSTHRU_TYPE || t->typ == CAL_TYPE || @@ -563,10 +565,54 @@ static int ParseScanFrom(ParsePtr s, Trigger *t) return OK; } FromJulian(jul, &y, &m, &d); - printf("%04d%c%02d%c%02d %s%s\n", y, DATESEP, m+1, DATESEP, d, - SimpleTime(tim->ttime), - DBufValue(&buf)); + sprintf(tmpBuf, "%04d%c%02d%c%02d ", y, DATESEP, m+1, DATESEP, d); + if (DBufPuts(&calRow, tmpBuf) != OK) { + DBufFree(&calRow); + return E_NO_MEM; + } + /* If DoSimpleCalendar==1, output *all* simple calendar fields */ + if (DoSimpleCalendar) { + /* ignore passthru field when in NextMode */ + if (DBufPuts(&calRow, "* ") != OK) { + DBufFree(&calRow); + return E_NO_MEM; + } + if (t->tag[0]) { + sprintf(tmpBuf, "%s ", t->tag); + } else { + sprintf(tmpBuf, "* "); + } + if (DBufPuts(&calRow, tmpBuf) != OK) { + DBufFree(&calRow); + return E_NO_MEM; + } + if (tim->duration != NO_TIME) { + sprintf(tmpBuf, "%d ", tim->duration); + } else { + sprintf(tmpBuf, "* "); + } + if (DBufPuts(&calRow, tmpBuf) != OK) { + DBufFree(&calRow); + return E_NO_MEM; + } + if (tim->ttime != NO_TIME) { + sprintf(tmpBuf, "%d ", tim->ttime); + } else { + sprintf(tmpBuf, "* "); + } + if (DBufPuts(&calRow, tmpBuf) != OK) { + DBufFree(&calRow); + return E_NO_MEM; + } + } + if (DBufPuts(&calRow, SimpleTime(tim->ttime)) != OK) { + DBufFree(&calRow); + return E_NO_MEM; + } + + printf("%s%s\n", DBufValue(&calRow), DBufValue(&buf)); DBufFree(&buf); + DBufFree(&calRow); return OK; } diff --git a/src/main.c b/src/main.c index 22f2f855..77fb9825 100644 --- a/src/main.c +++ b/src/main.c @@ -12,7 +12,7 @@ /***************************************************************/ #include "config.h" -static char const RCSID[] = "$Id: main.c,v 1.13 2005-09-30 03:29:32 dfs Exp $"; +static char const RCSID[] = "$Id: main.c,v 1.14 2005-10-16 14:48:02 dfs Exp $"; #include #include @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) ArgV = argv; InitRemind(argc, argv); - if(DoCalendar || DoSimpleCalendar) { + if (DoCalendar || (DoSimpleCalendar && (!NextMode || PsCal))) { ProduceCalendar(); return 0; }