/*
- * $Id: printcap.c,v 1.5 2001-07-31 19:50:14 srittau Exp $
+ * $Id: printcap.c,v 1.5.2.1 2002-02-07 23:59:33 srittau Exp $
*
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
register int i = 0, cnt = 0;
char ibuf[BUFSIZ];
int tf;
+ int skip;
hopcount = 0;
tbuf = bp;
cp2 = getenv("TERM");
if (cp2==(char *) 0 || strcmp(name,cp2)==0) {
strcpy(bp,cp);
- return(tnchktc());
+ return(tnchktc(cap));
} else {
tf = open(cap, 0);
}
}
if (tf==0)
tf = open(cap, 0);
-#else
+#else /* V6 */
tf = open(cap, 0);
-#endif
+#endif /* V6 */
if (tf < 0)
return (-1);
for (;;) {
cp = bp;
+ skip = 0;
for (;;) {
if (i == cnt) {
cnt = read(tf, ibuf, BUFSIZ);
}
c = ibuf[i++];
if (c == '\n') {
- if (cp > bp && cp[-1] == '\\'){
+ if (!skip && cp > bp && cp[-1] == '\\') {
cp--;
continue;
}
- break;
+ skip = 0;
+ if (cp == bp)
+ continue;
+ else
+ break;
}
+ if (c == '#' && cp == bp)
+ skip++;
+ if (skip)
+ continue;
if (cp >= bp+BUFSIZ) {
write(2,"Termcap entry too long\n", 23);
break;