summaryrefslogtreecommitdiff
path: root/list.c
diff options
context:
space:
mode:
authortim <tim>1997-05-14 15:30:41 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:00 +0100
commit53cf1b1c1c3f0c2b5067afccc2976b99a574a089 (patch)
treea31f167c3779362e29ab377d662052b6257253a8 /list.c
parentb87bfedf65c289bf0ee5338c9e10492b70b1e8e0 (diff)
Initial revision
Diffstat (limited to 'list.c')
-rw-r--r--list.c57
1 files changed, 0 insertions, 57 deletions
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;
-}