summaryrefslogtreecommitdiff
path: root/mail/ja-mh/patches/patch-ag
blob: 8bacbe3b01dd5714bb7351214323ce968151035e (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
$NetBSD: patch-ag,v 1.4 2010/09/27 12:01:49 taca Exp $

* Add DragonFly support.

--- sbr/m_getfld.c.orig	2001-06-13 14:21:02.000000000 +0000
+++ sbr/m_getfld.c
@@ -186,6 +186,9 @@ static int  (*eom_action) () = NULL;
 #define	_cnt	_r		/* Retch */
 #define	_filbuf	__srget		/* Puke */
 #endif
+#ifdef __DragonFly__)
+#define	_filbuf	__srget		/* Puke */
+#endif
 
 /*  */
 
@@ -302,6 +305,9 @@ register FILE	*iob;
 		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;
@@ -332,6 +338,9 @@ register FILE	*iob;
 		} else {
 #ifdef _STDIO_USES_IOSTREAM
 		    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;
@@ -377,6 +386,8 @@ register FILE	*iob;
 #ifdef _STDIO_USES_IOSTREAM
 		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;
 #endif
@@ -390,6 +401,10 @@ register FILE	*iob;
 			j = ep - (unsigned char *) iob->_IO_read_ptr;
 			(void) bcopy( iob->_IO_read_ptr, cp, j);
 			iob->_IO_read_ptr = ep;
+#elif defined(__DragonFly__)
+			j = ep - (unsigned char *) ((struct __FILE_public *)iob)->_p;
+			(void) bcopy( ((struct __FILE_public *)iob)->_p, cp, j);
+			((struct __FILE_public *)iob)->_p = ep; ((struct __FILE_public *)iob)->_r -= j;
 #else
 			j = ep - (unsigned char *) iob->_ptr;
 			(void) bcopy( iob->_ptr, cp, j);
@@ -407,6 +422,9 @@ register FILE	*iob;
 #ifdef _STDIO_USES_IOSTREAM
 		c += bp - (unsigned char *) iob->_IO_read_ptr;
 		(void) bcopy( iob->_IO_read_ptr, cp, c);
+#elif defined(__DragonFly__)
+		c += bp - (unsigned char *) ((struct __FILE_public *)iob)->_p;
+		(void) bcopy( ((struct __FILE_public *)iob)->_p, cp, c);
 #else
 		c += bp - (unsigned char *) iob->_ptr;
 		(void) bcopy( iob->_ptr, cp, c);
@@ -416,6 +434,8 @@ register FILE	*iob;
 		    /* the dest buffer is full */
 #ifdef _STDIO_USES_IOSTREAM
 		    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;
 #endif
@@ -434,6 +454,8 @@ register FILE	*iob;
 		iob->_IO_read_ptr = iob->_IO_read_end;
 		c = __underflow((struct _IO_FILE *) iob);
 		iob->_IO_read_ptr++;   /* NOT automatic! */
+#elif defined(__DragonFly__)
+		*cp++ = j = *(((struct __FILE_public *)iob)->_p + c);
 #else
 		*cp++ = j = *(iob->_ptr + c);
 #ifdef FILBUF_ADJ
@@ -467,6 +489,8 @@ register FILE	*iob;
 		    if (c != EOF)
 #ifdef _STDIO_USES_IOSTREAM
 			--iob->_IO_read_ptr;
+#elif defined(__DragonFly__)
+			--((struct __FILE_public *)iob)->_p, ++((struct __FILE_public *)iob)->_r;
 #else
 			--iob->_ptr, ++iob->_cnt;
 #endif
@@ -488,6 +512,8 @@ register FILE	*iob;
 #ifdef _STDIO_USES_IOSTREAM
 	    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;
 #endif
@@ -549,6 +575,9 @@ register FILE	*iob;
 	    (void) bcopy( bp, buf, c );
 #ifdef _STDIO_USES_IOSTREAM
 	    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;