1995-02-07 23:34:18 +01:00
|
|
|
#include "libiberty.h"
|
|
|
|
#include "gprof.h"
|
|
|
|
#include "search_list.h"
|
|
|
|
|
|
|
|
|
|
|
|
void
|
1995-02-08 03:35:44 +01:00
|
|
|
DEFUN (search_list_append, (list, paths),
|
|
|
|
Search_List * list AND const char *paths)
|
1995-02-07 23:34:18 +01:00
|
|
|
{
|
1995-02-08 03:35:44 +01:00
|
|
|
Search_List_Elem *new_el;
|
|
|
|
const char *beg, *colon;
|
|
|
|
int len;
|
1995-02-07 23:34:18 +01:00
|
|
|
|
1995-02-08 03:35:44 +01:00
|
|
|
colon = paths - 1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
beg = colon + 1;
|
|
|
|
colon = strchr (beg, ':');
|
|
|
|
if (colon)
|
|
|
|
{
|
|
|
|
len = colon - beg;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
len = strlen (beg);
|
1995-03-14 03:58:16 +01:00
|
|
|
}
|
1995-02-08 03:35:44 +01:00
|
|
|
new_el = (Search_List_Elem *) xmalloc (sizeof (*new_el) + len);
|
|
|
|
memcpy (new_el->path, beg, len);
|
|
|
|
new_el->path[len] = '\0';
|
1995-02-07 23:34:18 +01:00
|
|
|
|
1995-02-08 03:35:44 +01: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;
|
1995-03-14 03:58:16 +01:00
|
|
|
}
|
1995-02-08 03:35:44 +01:00
|
|
|
list->tail = new_el;
|
|
|
|
}
|
|
|
|
while (colon);
|
1995-03-14 03:58:16 +01:00
|
|
|
}
|