$NetBSD: patch-ag,v 1.3 2006/04/11 15:08:38 joerg Exp $ --- 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;