-/*********************************************************************
- *
- * Function : enlist
- *
- * Description : Append a string into a specified string list.
- *
- * Parameters :
- * 1 : h = pointer to list 'dummy' header
- * 2 : s = string to add to the list
- *
- * Returns : N/A
- *
- *********************************************************************/
-void enlist(struct list *h, const char *s)
-{
- struct list *n = (struct list *)malloc(sizeof(*n));
- struct list *l;
-
- if (n)
- {
- n->str = strdup(s);
- n->next = NULL;
-
- if ((l = h->last))
- {
- l->next = n;
- }
- else
- {
- h->next = n;
- }
-
- h->last = n;
- }
-
-}
-
-
-/*********************************************************************
- *
- * Function : destroy_list
- *
- * Description : Destroy a string list (opposite of enlist)
- *
- * Parameters :
- * 1 : h = pointer to list 'dummy' header
- *
- * Returns : N/A
- *
- *********************************************************************/
-void destroy_list(struct list *h)
-{
- struct list *p, *n;
-
- for (p = h->next; p ; p = n)
- {
- n = p->next;
- freez(p->str);
- freez(p);
- }
-
- memset(h, '\0', sizeof(*h));
-
-}
-
-
-/*********************************************************************
- *
- * Function : list_to_text
- *
- * Description : "Flaten" a string list into 1 long \r\n delimited string.
- *
- * Parameters :
- * 1 : h = pointer to list 'dummy' header
- *
- * Returns : NULL on malloc error, else new long string.
- *
- *********************************************************************/
-static char *list_to_text(struct list *h)
-{
- struct list *p;
- char *ret = NULL;
- char *s;
- int size;
-
- size = 0;
-
- for (p = h->next; p ; p = p->next)
- {
- if (p->str)
- {
- size += strlen(p->str) + 2;
- }
- }
-
- if ((ret = (char *)malloc(size + 1)) == NULL)
- {
- return(NULL);
- }
-
- ret[size] = '\0';
-
- s = ret;
-
- for (p = h->next; p ; p = p->next)
- {
- if (p->str)
- {
- strcpy(s, p->str);
- s += strlen(s);
- *s++ = '\r'; *s++ = '\n';
- }
- }
-
- return(ret);
-
-}
-
-