Licensing Information
Open Source Used In Cisco DSP IP Cameras 412
/* Add capability to the list. */
i = (struct tc_ent *)xmalloc(sizeof(struct tc_ent) + strlen(bp));
if (i == NULL) break;
shrinkcap(i->cap, bp);
i->next = NULL;
if (list == NULL)
list = i;
else
last->next = i;
}
/* Done. */
*listp = list;
return(tc_next);
}
/* Add OR change a capability (hardcoded for li# and co#) */
static void add_list(struct tc_ent **list, char *cap)
{
struct tc_ent *prev, *new, *l;
/* Walk through the list. */
prev = NULL;
for(l = *list; l; l = l->next) {
if (strncmp(l->cap, cap, 3) == 0) {
/* Found: modify in-place. */
new = xmalloc(sizeof(struct tc_ent) + strlen(cap));
strcpy(new->cap, cap);
new->next = l->next;
if (prev)
prev->next = new;
else
*list = new;
free(l);
l = new;
break;
}
prev = l;
}
if (l != NULL) return;
/* Not found, add to the end of the list. */
new = xmalloc(sizeof(struct tc_ent) + strlen(cap));
strcpy(new->cap, cap);
new->next = NULL;
if (prev)
prev->next = new;