summaryrefslogtreecommitdiff
path: root/time/ical/patches/patch-ad
blob: c1a29f4d673c89756ed4792bbf56ecaf02ca5c25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
$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)
 {