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
|
$NetBSD: patch-ak,v 1.5 2006/01/03 18:16:10 joerg Exp $
--- fep_set.c.orig 1991-05-29 01:31:24.000000000 -0400
+++ fep_set.c 2005-12-10 16:59:27.000000000 -0500
@@ -6,6 +6,7 @@
-#endif lint
+#endif /* lint */
#include <stdio.h>
+#include <stdlib.h>
#include "fep_defs.h"
#include "fep_glob.h"
@@ -67,10 +68,10 @@
#ifdef HASH
#define HASHNUM 10
VAR *var_htab[HASHNUM];
-#else HASH
+#else /* HASH */
VAR var_top = {"top", "top", (char *)0, (VAR *)0};
VAR *var_list = &var_top;
-#endif HASH
+#endif /* HASH */
/*
* Functions
@@ -251,12 +252,12 @@
for (; vp != (VAR *)0; vp = vp->v_next)
printf ("%-16s %s\n", vp->v_name, vp->v_value);
}
-#else HASH
+#else /* HASH */
register VAR *vp;
for (vp = var_list->v_next; vp; vp = vp->v_next)
printf ("%-16s %s\n", vp->v_name, vp->v_value);
-#endif HASH
+#endif /* HASH */
}
#ifdef HASH
@@ -273,7 +274,7 @@
return (sum % HASHNUM);
}
-#endif HASH
+#endif /* HASH */
/*
* Get pointer to VAR.
@@ -288,7 +289,7 @@
{
#ifdef HASH
register i = getindex (name);
-#endif HASH
+#endif /* HASH */
VAR *vp, *last = (VAR *)0;
#ifdef HASH
@@ -296,7 +297,7 @@
if (strcmp (name, vp->v_value) == 0)
return (vp);
}
-#else HASH
+#else /* HASH */
for (vp = var_list->v_next, last = var_list; vp; last = vp, vp = vp->v_next) {
int r;
@@ -309,14 +310,14 @@
else if (r < 0)
break;
}
-#endif HASH
+#endif /* HASH */
if (alloc == 0)
return (0);
- vp = (VAR *) calloc (sizeof (VAR), 1);
- vp->v_value = (char *)0;
- vp->v_next = (VAR *) 0;
+ vp = calloc (sizeof (VAR), 1);
+ vp->v_value = NULL;
+ vp->v_next = NULL;
vp->v_name = allocAndCopyThere (name);
#ifdef HASH
@@ -327,9 +328,9 @@
else {
var_htab[i] = vp;
}
-#else HASH
+#else /* HASH */
vp->v_next = last->v_next;
last->v_next = vp;
-#endif HASH
+#endif /* HASH */
return (vp);
}
|