Licensing Information
Open Source Used In Cisco DSP IP Cameras 417
/* Return 0 if the entry is not present. */
if (l == NULL)
{
/* For compatibility with programs like 'less' that want to
put data in the termcap buffer themselves as a fallback. */
if (buffer)
{
term_entry = buffer;
}
return(0);
}
/* Adjust lines and columns. */
adjust_lines_cols(&l);
/* Free old buffer if possible. */
if (is_malloced && term_entry) free(term_entry);
/* Do we already have a buffer? */
if (sp) {
maxlen = tgetent_bufsize - 1;
is_malloced = 0;
} else {
/* Count how many bytes we need. */
count = strlen(s) + 1;
for(i = l; i; i = i->next)
count += strlen(i->cap) + 1;
count++;
/* Malloc this amount. */
sp = xmalloc(count);
maxlen = count + 32; /* Just a lot. */
is_malloced = 1;
}
/* Save buffer into static variable (yuk!) */
term_entry = sp;
/* First copy the description to the buffer. */
count = 0;
for(bp = s; *bp; bp++) {
*sp++ = *bp;
count++;
}
*sp++ = ':';
count++;
/* And now the capabilities. */