1995-02-07 22:34:18 +00:00
|
|
|
#include "libiberty.h"
|
|
|
|
#include "gprof.h"
|
|
|
|
#include "search_list.h"
|
|
|
|
|
|
|
|
|
|
|
|
void
|
1995-02-08 02:35:44 +00:00
|
|
|
DEFUN (search_list_append, (list, paths),
|
|
|
|
Search_List * list AND const char *paths)
|
1995-02-07 22:34:18 +00:00
|
|
|
{
|
1995-02-08 02:35:44 +00:00
|
|
|
Search_List_Elem *new_el;
|
|
|
|
const char *beg, *colon;
|
|
|
|
int len;
|
1995-02-07 22:34:18 +00:00
|
|
|
|
1995-02-08 02:35:44 +00:00
|
|
|
colon = paths - 1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
beg = colon + 1;
|
|
|
|
colon = strchr (beg, ':');
|
|
|
|
if (colon)
|
|
|
|
{
|
|
|
|
len = colon - beg;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
len = strlen (beg);
|
|
|
|
} /* if */
|
|
|
|
new_el = (Search_List_Elem *) xmalloc (sizeof (*new_el) + len);
|
|
|
|
memcpy (new_el->path, beg, len);
|
|
|
|
new_el->path[len] = '\0';
|
1995-02-07 22:34:18 +00:00
|
|
|
|
1995-02-08 02:35:44 +00:00
|
|
|
/* append new path at end of list: */
|
|
|
|
new_el->next = 0;
|
|
|
|
if (list->tail)
|
|
|
|
{
|
|
|
|
list->tail->next = new_el;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
list->head = new_el;
|
|
|
|
} /* if */
|
|
|
|
list->tail = new_el;
|
|
|
|
}
|
|
|
|
while (colon);
|
|
|
|
} /* search_list_append */
|
1995-02-07 22:34:18 +00:00
|
|
|
|
1995-02-08 02:35:44 +00:00
|
|
|
/*** end of search_list.c ***/
|