summaryrefslogtreecommitdiff
path: root/net/netatalk-asun/patches/patch-aj
blob: 2ae3aa4cb2ff01c1379c4f1e196232840bddefc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$NetBSD: patch-aj,v 1.2 2000/07/31 18:33:49 abs Exp $

--- etc/papd/printcap.c.orig	Fri May 30 01:27:35 1997
+++ etc/papd/printcap.c	Mon Jul 31 18:55:05 2000
@@ -158,6 +158,7 @@
 	register int i = 0, cnt = 0;
 	char ibuf[BUFSIZ];
 	int tf;
+	int skip;
 
 	hopcount = 0;
 	tbuf = bp;
@@ -176,7 +177,7 @@
 			cp2 = getenv("TERM");
 			if (cp2==(char *) 0 || strcmp(name,cp2)==0) {
 				strcpy(bp,cp);
-				return(tnchktc());
+				return(tnchktc(cap));
 			} else {
 				tf = open(cap, 0);
 			}
@@ -190,6 +191,7 @@
 #endif
 	if (tf < 0)
 		return (-1);
+	skip = 0;
 	for (;;) {
 		cp = bp;
 		for (;;) {
@@ -203,12 +205,20 @@
 			}
 			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;
@@ -222,7 +232,7 @@
 		 */
 		if (tnamatch(name)) {
 			close(tf);
-			return(tnchktc());
+			return(tnchktc(cap));
 		}
 	}
 }