81ef29ab40
OS X patch program.
99 lines
1.9 KiB
Text
99 lines
1.9 KiB
Text
$NetBSD: patch-ak,v 1.6 2006/01/17 21:23:01 kristerw 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 @@
|
|
-#endif lint
|
|
+#endif /* lint */
|
|
@@ -7,4 +7,5 @@
|
|
|
|
#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);
|
|
}
|