/* list.c: routines for manipulating the List type */
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
/* free a list from malloc space */
extern void listfree(List
*p
) {
/* Copy list into malloc space (for storing a variable) */
extern List
*listcpy(List
*s
, void *(*alloc
)(size_t)) {
for (top
= r
= NULL
; s
!= NULL
; s
= s
->n
) {
r
= top
= (*alloc
)(sizeof (List
));
r
= r
->n
= (*alloc
)(sizeof (List
));
r
->w
= (*alloc
)(strlen(s
->w
) + 1);
extern size_t listlen(List
*s
) {
for (size
= 0; s
!= NULL
; s
= s
->n
)
size
+= strlen(s
->w
) + 1;
/* Number of elements in list */
extern int listnel(List
*s
) {
for (nel
= 0; s
!= NULL
; s
= s
->n
)