summaryrefslogtreecommitdiff
path: root/mail/nmh/patches/patch-af
blob: 83066c84505f0abcf4ed036db9e2915708a8dac1 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
$NetBSD: patch-af,v 1.1 2006/03/02 21:28:23 joerg Exp $

--- sbr/m_getfld.c.orig	2006-03-02 20:29:22.000000000 +0000
+++ sbr/m_getfld.c
@@ -261,6 +261,9 @@ m_getfld (int state, unsigned char *name
 		bp = sp = (unsigned char *) iob->_IO_read_ptr - 1;
 		j = (cnt = ((long) iob->_IO_read_end -
 			(long) iob->_IO_read_ptr)  + 1) < i ? cnt : i;
+#elif defined(__DragonFly__)
+		bp = sp = (unsigned char *) ((struct __FILE_public *)iob)->_p - 1;
+		j = (cnt = ((struct __FILE_public *)iob)->_r+1) < i ? cnt : i;
 #else
 		bp = sp = (unsigned char *) iob->_ptr - 1;
 		j = (cnt = iob->_cnt+1) < i ? cnt : i;
@@ -273,6 +276,8 @@ m_getfld (int state, unsigned char *name
 #ifdef LINUX_STDIO
 		    iob->_IO_read_ptr = iob->_IO_read_end;
 		    if (__underflow(iob) == EOF) {
+#elif defined(__DragonFly__)
+		    if (__srget(iob) == EOF) {
 #else
 		    if (_filbuf(iob) == EOF) {
 #endif
@@ -286,6 +291,9 @@ m_getfld (int state, unsigned char *name
 		} else {
 #ifdef LINUX_STDIO
 		    iob->_IO_read_ptr = bp + 1;
+#elif defined(__DragonFly__)
+		    ((struct __FILE_public *)iob)->_p = bp + 1;
+		    ((struct __FILE_public *)iob)->_r = cnt - 1;
 #else
 		    iob->_ptr = bp + 1;
 		    iob->_cnt = cnt - 1;
@@ -330,6 +338,9 @@ m_getfld (int state, unsigned char *name
 #ifdef LINUX_STDIO
 		cnt = (long) iob->_IO_read_end - (long) iob->_IO_read_ptr;
 		bp = (unsigned char *) --iob->_IO_read_ptr;
+#elif defined(__DragonFly__)
+		cnt = ((struct __FILE_public *)iob)->_r++;
+		bp = (unsigned char *) --((struct __FILE_public *)iob)->_p;
 #else
 		cnt = iob->_cnt++;
 		bp = (unsigned char *) --iob->_ptr;
@@ -344,6 +355,11 @@ m_getfld (int state, unsigned char *name
 			j = ep - (unsigned char *) iob->_IO_read_ptr;
 			memcpy (cp, iob->_IO_read_ptr, j);
 			iob->_IO_read_ptr = ep;
+#elif defined(__DragonFly__)
+			j = ep - (unsigned char *) ((struct __FILE_public *)iob)->_p;
+			memcpy (cp, ((struct __FILE_public *)iob)->_p, j);
+			((struct __FILE_public *)iob)->_p = ep;
+			((struct __FILE_public *)iob)->_r -= j;
 #else
 			j = ep - (unsigned char *) iob->_ptr;
 			memcpy (cp, iob->_ptr, j);
@@ -363,6 +379,9 @@ m_getfld (int state, unsigned char *name
 #ifdef LINUX_STDIO
 		c += bp - (unsigned char *) iob->_IO_read_ptr;
 		memcpy( cp, iob->_IO_read_ptr, c);
+#elif defined(__DragonFly__)
+		c += bp - (unsigned char *) ((struct __FILE_public *)iob)->_p;
+		memcpy( cp, ((struct __FILE_public *)iob)->_p, c);
 #else
 		c += bp - (unsigned char *) iob->_ptr;
 		memcpy( cp, iob->_ptr, c);
@@ -373,6 +392,9 @@ m_getfld (int state, unsigned char *name
 		    /* the dest buffer is full */
 #ifdef LINUX_STDIO
 		    iob->_IO_read_ptr += c;
+#elif defined(__DragonFly__)
+		    ((struct __FILE_public *)iob)->_r -= c;
+		    ((struct __FILE_public *)iob)->_p += c;
 #else
 		    iob->_cnt -= c;
 		    iob->_ptr += c;
@@ -392,6 +414,9 @@ m_getfld (int state, unsigned char *name
 		iob->_IO_read_ptr = iob->_IO_read_end;
 		c = __underflow(iob);
 		iob->_IO_read_ptr++;    /* NOT automatic! */
+#elif defined(__DragonFly__)
+		*cp++ =j = *(((struct __FILE_public *)iob)->_p + c);
+		c = __srget(iob);
 #else
 		*cp++ = j = *(iob->_ptr + c);
 		c = _filbuf(iob);
@@ -401,6 +426,9 @@ m_getfld (int state, unsigned char *name
 		    if (c != EOF) {
 #ifdef LINUX_STDIO
 			--iob->_IO_read_ptr;
+#elif defined(__DragonFly__)
+			--((struct __FILE_public *)iob)->_p;
+			++((struct __FILE_public *)iob)->_r;
 #else
 			--iob->_ptr;
 			++iob->_cnt;
@@ -424,6 +452,9 @@ m_getfld (int state, unsigned char *name
 #ifdef LINUX_STDIO
 	    bp = (unsigned char *) --iob->_IO_read_ptr;
 	    cnt = (long) iob->_IO_read_end - (long) iob->_IO_read_ptr;
+#elif defined(__DragonFly__)
+	    bp = (unsigned char *) --((struct __FILE_public *)iob)->_p;
+	    cnt = ++((struct __FILE_public *)iob)->_r;
 #else
 	    bp = (unsigned char *) --iob->_ptr;
 	    cnt = ++iob->_cnt;
@@ -486,6 +517,9 @@ m_getfld (int state, unsigned char *name
 	    memcpy( buf, bp, c );
 #ifdef LINUX_STDIO
 	    iob->_IO_read_ptr += c;
+#elif defined(__DragonFly__)
+	    ((struct __FILE_public *)iob)->_r -= c;
+	    ((struct __FILE_public *)iob)->_p += c;
 #else
 	    iob->_cnt -= c;
 	    iob->_ptr += c;