X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fscansbr.c;h=04dc21528d1af0aa77b8f104023f984cf46545e8;hb=5dd6771b28c257af405d7248639ed0e3bcdce38b;hp=1b6a0ed9ec9ffdfe34929eb4bb09216c3bb2abc8;hpb=13f84dd50ca5754391dbd3296a5c7425f9363600;p=mmh diff --git a/uip/scansbr.c b/uip/scansbr.c index 1b6a0ed..04dc215 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -2,8 +2,6 @@ /* * scansbr.c -- routines to help scan along... * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -68,6 +66,11 @@ char *scanl = 0; /* text of most recent scanline */ int sc_width (void); /* from termsbr.c */ static int mh_fputs(char *, FILE *); +#ifdef MULTIBYTE_SUPPORT +#define SCAN_CHARWIDTH MB_CUR_MAX +#else +#define SCAN_CHARWIDTH 1 +#endif int scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, @@ -76,11 +79,11 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, int i, compnum, encrypted, state; unsigned char *cp, *tmpbuf; char **nxtbuf; - char *saved_c_text; + char *saved_c_text = NULL; struct comp *cptr; struct comp **savecomp; - char *scnmsg; - FILE *scnout; + char *scnmsg = NULL; + FILE *scnout = NULL; char name[NAMESZ]; static int rlwidth, slwidth; @@ -98,7 +101,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, width = MAXSCANL; } dat[3] = slwidth = width; - scanl = (char *) mh_xmalloc((size_t) MB_CUR_MAX * (slwidth + 2) ); + scanl = (char *) mh_xmalloc((size_t) SCAN_CHARWIDTH * (slwidth + 2) ); if (outnum) umask(~m_gmprot()); @@ -251,6 +254,8 @@ body:; while (state == BODY) { #ifdef LINUX_STDIO if (scnout->_IO_write_ptr == scnout->_IO_write_end) { +#elif defined(__DragonFly__) + if (((struct __FILE_public *)scnout)->_w <= 0) { #else if (scnout->_cnt <= 0) { #endif @@ -261,6 +266,10 @@ body:; state = m_getfld(state, name, scnout->_IO_write_ptr, (long)scnout->_IO_write_ptr-(long)scnout->_IO_write_end , inb); scnout->_IO_write_ptr += msg_count; +#elif defined(__DragonFly__) + state = m_getfld( state, name, ((struct __FILE_public *)scnout)->_p, -(((struct __FILE_public *)scnout)->_w), inb ); + ((struct __FILE_public *)scnout)->_w -= msg_count; + ((struct __FILE_public *)scnout)->_p += msg_count; #else state = m_getfld( state, name, scnout->_ptr, -(scnout->_cnt), inb ); scnout->_cnt -= msg_count;