From 53cf1b1c1c3f0c2b5067afccc2976b99a574a089 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 14 May 1997 15:30:41 +0000 Subject: Initial revision --- list.c | 57 --------------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 list.c (limited to 'list.c') diff --git a/list.c b/list.c deleted file mode 100644 index fba6f6a..0000000 --- a/list.c +++ /dev/null @@ -1,57 +0,0 @@ -/* list.c: routines for manipulating the List type */ - -#include "rc.h" - -/* - These list routines assign meta values of null to the resulting lists; - it is impossible to glob with the value of a variable unless this value - is rescanned with eval---therefore it is safe to throw away the meta-ness - of the list. -*/ - -/* free a list from malloc space */ - -extern void listfree(List *p) { - while (p != NULL) { - List *n = p->n; - efree(p->w); - efree(p); - p = n; - } -} - -/* Copy list into malloc space (for storing a variable) */ - -extern List *listcpy(List *s, void *(*alloc)(size_t)) { - List *top, *r; - for (top = r = NULL; s != NULL; s = s->n) { - if (top == NULL) - r = top = (*alloc)(sizeof (List)); - else - r = r->n = (*alloc)(sizeof (List)); - r->w = (*alloc)(strlen(s->w) + 1); - strcpy(r->w, s->w); - r->m = NULL; - } - if (r != NULL) - r->n = NULL; - return top; -} - -/* Length of list */ - -extern size_t listlen(List *s) { - size_t size; - for (size = 0; s != NULL; s = s->n) - size += strlen(s->w) + 1; - return size; -} - -/* Number of elements in list */ - -extern int listnel(List *s) { - int nel; - for (nel = 0; s != NULL; s = s->n) - nel++; - return nel; -} -- cgit v1.2.3