summaryrefslogtreecommitdiffstats
path: root/bin/sh/nodes.c.pat
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/nodes.c.pat')
-rw-r--r--bin/sh/nodes.c.pat140
1 files changed, 65 insertions, 75 deletions
diff --git a/bin/sh/nodes.c.pat b/bin/sh/nodes.c.pat
index e0602ed..739616d 100644
--- a/bin/sh/nodes.c.pat
+++ b/bin/sh/nodes.c.pat
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nodes.c.pat 8.1 (Berkeley) 5/31/93
- * $Id$
+ * @(#)nodes.c.pat 8.2 (Berkeley) 5/4/95
+ * $Id: nodes.c.pat,v 1.2 1994/09/24 02:58:02 davidg Exp $
*/
+#include <stdlib.h>
/*
* Routine for dealing with parsed shell commands.
*/
@@ -48,31 +49,19 @@
#include "mystring.h"
-int funcblocksize; /* size of structures in function */
-int funcstringsize; /* size of strings in node */
-#ifdef __STDC__
+int funcblocksize; /* size of structures in function */
+int funcstringsize; /* size of strings in node */
pointer funcblock; /* block to allocate function from */
-#else
-char *funcblock; /* block to allocate function from */
-#endif
-char *funcstring; /* block to allocate strings from */
+char *funcstring; /* block to allocate strings from */
%SIZES
-#ifdef __STDC__
-STATIC void calcsize(union node *);
-STATIC void sizenodelist(struct nodelist *);
-STATIC union node *copynode(union node *);
-STATIC struct nodelist *copynodelist(struct nodelist *);
-STATIC char *nodesavestr(char *);
-#else
-STATIC void calcsize();
-STATIC void sizenodelist();
-STATIC union node *copynode();
-STATIC struct nodelist *copynodelist();
-STATIC char *nodesavestr();
-#endif
+STATIC void calcsize __P((union node *));
+STATIC void sizenodelist __P((struct nodelist *));
+STATIC union node *copynode __P((union node *));
+STATIC struct nodelist *copynodelist __P((struct nodelist *));
+STATIC char *nodesavestr __P((char *));
@@ -82,85 +71,86 @@ STATIC char *nodesavestr();
union node *
copyfunc(n)
- union node *n;
- {
- if (n == NULL)
- return NULL;
- funcblocksize = 0;
- funcstringsize = 0;
- calcsize(n);
- funcblock = ckmalloc(funcblocksize + funcstringsize);
- funcstring = funcblock + funcblocksize;
- return copynode(n);
+ union node *n;
+{
+ if (n == NULL)
+ return NULL;
+ funcblocksize = 0;
+ funcstringsize = 0;
+ calcsize(n);
+ funcblock = ckmalloc(funcblocksize + funcstringsize);
+ funcstring = funcblock + funcblocksize;
+ return copynode(n);
}
STATIC void
calcsize(n)
- union node *n;
- {
- %CALCSIZE
+ union node *n;
+{
+ %CALCSIZE
}
STATIC void
sizenodelist(lp)
- struct nodelist *lp;
- {
- while (lp) {
- funcblocksize += ALIGN(sizeof (struct nodelist));
- calcsize(lp->n);
- lp = lp->next;
- }
+ struct nodelist *lp;
+{
+ while (lp) {
+ funcblocksize += ALIGN(sizeof(struct nodelist));
+ calcsize(lp->n);
+ lp = lp->next;
+ }
}
STATIC union node *
copynode(n)
- union node *n;
- {
- union node *new;
+ union node *n;
+{
+ union node *new;
- %COPY
- return new;
+ %COPY
+ return new;
}
STATIC struct nodelist *
copynodelist(lp)
- struct nodelist *lp;
- {
- struct nodelist *start;
- struct nodelist **lpp;
-
- lpp = &start;
- while (lp) {
- *lpp = funcblock;
- funcblock += ALIGN(sizeof (struct nodelist));
- (*lpp)->n = copynode(lp->n);
- lp = lp->next;
- lpp = &(*lpp)->next;
- }
- *lpp = NULL;
- return start;
+ struct nodelist *lp;
+{
+ struct nodelist *start;
+ struct nodelist **lpp;
+
+ lpp = &start;
+ while (lp) {
+ *lpp = funcblock;
+ funcblock += ALIGN(sizeof(struct nodelist));
+ (*lpp)->n = copynode(lp->n);
+ lp = lp->next;
+ lpp = &(*lpp)->next;
+ }
+ *lpp = NULL;
+ return start;
}
STATIC char *
nodesavestr(s)
- char *s;
- {
- register char *p = s;
- register char *q = funcstring;
- char *rtn = funcstring;
-
- while (*q++ = *p++);
- funcstring = q;
- return rtn;
+ char *s;
+{
+ register char *p = s;
+ register char *q = funcstring;
+ char *rtn = funcstring;
+
+ while ((*q++ = *p++) != '\0')
+ continue;
+ funcstring = q;
+ return rtn;
}
@@ -171,8 +161,8 @@ nodesavestr(s)
void
freefunc(n)
- union node *n;
- {
- if (n)
- ckfree(n);
+ union node *n;
+{
+ if (n)
+ ckfree(n);
}
OpenPOWER on IntegriCloud