Licensing Information

Open Source Used In Cisco DSP IP Cameras 416
printf("Using file %s\n", tc_file);
#endif
/* Now read the termcap file. */
if ((fp = fopen(tc_file, "r")) == NULL) return(NULL);
while(term) {
if (++loop > 16) {
write(2, "tgetent: loop detected, check your termcap\n", 43);
break;
}
#if DEBUG
printf("LOOKUP: term %s\n", term);
#endif
sp = get_one_entry(fp, term);
if (sp == NULL) break;
term = build_list(&l, sp);
if (first)
desc = sp;
else
free(sp);
first = 0;
}
fclose(fp);
/* Done. */
*tcp = l;
#if DEBUG
printf(">> tc_read done, desc = %s\n", desc);
#endif
return(desc ? desc : "");
}
/* The tgetent function. */
int tgetent(void *buffer, const char *term)
{
char *s;
struct tc_ent *l, *i, *next;
char *bp, *sp = (char *)buffer;
int len, count, maxlen;
/* Find the termcap entry. */
s = tc_read(&l, (char *)term);
/* Return -1 if we can't open the termcap file. */
if (s == NULL) return(-1);