pkgsrc/time/ical/patches/patch-ad

105 lines
3.3 KiB
Text

$NetBSD: patch-ad,v 1.1 2001/10/15 17:09:44 tron Exp $
--- item_tcl.C.orig Thu Aug 1 21:25:10 1996
+++ item_tcl.C Mon Oct 15 19:07:06 2001
@@ -14,6 +14,9 @@
#include "item_tcl.h"
#include "dispatch.h"
+static char One[2] = "1";
+static char Zero[2] = "0";
+
/*
* Item* -> Item_Tcl* map.
*/
@@ -232,14 +235,14 @@
Item_Tcl* item = (Item_Tcl*) c;
if ((strcmp(argv[0], "note") == 0) && (item->value()->AsNotice() != 0)) {
- TCL_Return(tcl, "1");
+ TCL_Return(tcl, One);
}
if ((strcmp(argv[0], "appt") == 0) && (item->value()->AsAppointment()!=0)){
- TCL_Return(tcl, "1");
+ TCL_Return(tcl, One);
}
- TCL_Return(tcl, "0");
+ TCL_Return(tcl, Zero);
}
static int item_delete(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
@@ -329,7 +332,7 @@
static int item_owned(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
Item_Tcl* item = (Item_Tcl*) c;
- TCL_Return(tcl, (item->value()->IsMine() ? "1" : "0"));
+ TCL_Return(tcl, (item->value()->IsMine() ? One : Zero));
}
static int item_own(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
@@ -360,7 +363,7 @@
Item_Tcl* item = (Item_Tcl*) c;
if (argc == 0) {
- TCL_Return(tcl, (char*)(item->value()->IsTodo() ? "1" : "0"));
+ TCL_Return(tcl, (char*)(item->value()->IsTodo() ? One : Zero));
}
int todo;
@@ -376,7 +379,7 @@
static int item_is_done(ClientData c, Tcl_Interp* tcl,int argc,char* argv[]) {
Item_Tcl* item = (Item_Tcl*) c;
- TCL_Return(tcl, (char*)(item->value()->IsDone() ? "1" : "0"));
+ TCL_Return(tcl, (char*)(item->value()->IsDone() ? One : Zero));
}
static int item_done(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
@@ -492,12 +495,12 @@
static int item_empty(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
Item_Tcl* item = (Item_Tcl*) c;
- TCL_Return(tcl, (item->value()->empty()?"1":"0"));
+ TCL_Return(tcl, (item->value()->empty()?One:Zero));
}
static int item_repeat(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
Item_Tcl* item = (Item_Tcl*) c;
- TCL_Return(tcl,(item->value()->repeats()?"1":"0"));
+ TCL_Return(tcl,(item->value()->repeats()?One:Zero));
}
static int item_first(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
@@ -576,7 +579,7 @@
TCL_Error(tcl, "invalid date");
}
Date date(dateDays);
- TCL_Return(tcl, (item->value()->contains(date)?"1":"0"));
+ TCL_Return(tcl, (item->value()->contains(date)?One:Zero));
}
static int item_next(ClientData c, Tcl_Interp* tcl, int argc, char* argv[]) {
@@ -609,10 +612,10 @@
sprintf(buffer, "%d", f.EpochDays());
if (Tcl_SetVar(tcl, argv[1], buffer, 0) == NULL)
TCL_Error(tcl, "could not set range finish variable");
- TCL_Return(tcl, "1");
+ TCL_Return(tcl, One);
}
else {
- TCL_Return(tcl, "0");
+ TCL_Return(tcl, Zero);
}
}
@@ -719,7 +722,7 @@
// effects Parses "n", "anchor" and "interval" from the command
// arguments. Returns TCL_OK iff successful. If "anchor"
// and "interval" are not specified in the command arguments,
-// then "anchor" is set to today and "interval" is set to "1".
+// then "anchor" is set to today and "interval" is set to One.
static int parse_month_args(Tcl_Interp* tcl, int argc, char* argv[],
int& n, Date& anchor, int& interval)
{