Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!sun!gorodish!guy From: guy@gorodish.UUCP Newsgroups: comp.sources.bugs Subject: Re: Problems with 'mush' on Pyramid Message-ID: <29215@sun.uucp> Date: Sun, 27-Sep-87 02:25:51 EDT Article-I.D.: sun.29215 Posted: Sun Sep 27 02:25:51 1987 Date-Received: Sun, 27-Sep-87 22:15:57 EDT References: <1002@pyrltd.UUCP> Sender: news@sun.uucp Lines: 41 > There are problems trying to use the recently posted 'mush' on a Pyramid > (or anything that doesn't handle varags like a VAX). Such as a Sun-4. > * if available. msgbuf is the buffer used to print into if necessary. > * If you're running SUN3.2 or higher, the typecast (unsigned char *)msgbuf > * (where indicated) otherwise, msgbuf is not typecast at all. > * Also note same casting in wprint(). ... > #ifdef VPRINTF > if (fmt) > vsprintf(msgbuf, fmt, &args); /* NULL in fmt reprints last msg */ > #else VPRINTF > foo._cnt = BUFSIZ; > foo._base = foo._ptr = msgbuf; /* may have to be cast(unsigned char *) */ > foo._flag = _IOWRT+_IOSTRG; > if (fmt) { /* passing NULL (not "") reprints last message */ > va_start(args); > (void) _doprnt(fmt, args, &foo); > va_end(args); > *foo._ptr = '\0'; /* plant terminating null character */ > } > #endif VPIRNTF 1) On Suns running 3.2 or later, you actually don't *need* the cast - it just keeps the compiler from issuing a warning. The same warning will be issued on other systems, such as most S5R2 or later systems, where the buffer is an array of "unsigned char". However, the vanilla S5R[2,3] standard I/O doesn't have _IOSTRG, so this code won't work there. Then again, 2) On Suns running 3.2 or later, or machines with the S5R2 or later standard I/O, none of this is relevant anyway - they have "vprintf", "vfprintf", and "vsprintf". Just define VPRINTF when compiling for those systems. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com