🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs
Article #516

Bug in putc

#516
From: Steve Harris
Date: Wed, 26 Mar 1986 23:57
13 lines
1199 bytes
There is a bug in the putc macro, in stdio.h.
Putc returns an int which contains the char you have just "put".
However, (at least on both a Pixel and a Sun), the result is sign extended;
if the 8th bit of the char is set, the return value from putc does not equal
the character you put!  To fix, replace the putc macro with the following:

#define putc(x,p) ((int) ((--(p)->_cnt>=0? ((unsigned char)(*(p)->_ptr++=(x))):(unsigned char)_flsbuf((x),p))))
-- 

Steve Harris            |  {allegra|ihnp4|cbosgd|ima|genrad|amd|harvard}\
xePIX, Inc.             |               !wjh12!pixel!pixdoc!vsh
51 Lake Street          |
Nashua, NH  03060       |  +1 603 881 8791
Technical Details
Message-ID: <41@pixdoc.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!wjh12!pixel!pixdoc!vsh

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site pixdoc.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!wjh12!pixel!pixdoc!vsh
From: vsh@pixdoc.UUCP (Steve Harris)
Newsgroups: net.bugs
Subject: Bug in putc
Message-ID: <41@pixdoc.UUCP>
Date: Wed, 26-Mar-86 18:57:13 EST
Article-I.D.: pixdoc.41
Posted: Wed Mar 26 18:57:13 1986
Date-Received: Sat, 29-Mar-86 01:16:08 EST
Organization: Pixel Systems, Woburn, MA
Lines: 13