🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #25542

Re: LightSpeed C 2.15 putchar???

#25542
From: Clive Steward
Date: Tue, 23 Feb 1988 00:58
34 lines
1977 bytes
Subject: Lightspeed fputc problem -- easy answer, hope fix in 3.0
Newsgroups: comp.sys.mac
References: <6802@drutx.ATT.COM>

Well, I should have tried this one before posting.

I wasn't accurate as to the real problem, and neither was Dave Platt
coherent!dplatt, who sent unix-gruish mail on the subject.  More on
that at the end.

The real difficulty, doped out in the library sources, is that the LSC
library function Init_stdio () doesn't always get called automatically,
as it's supposed to.

For now (we can hope it'll be fixed in 3.0), it's sufficient to call
Init_stdio () once yourself right at the beginning of your main ()
program.  It will self-protect against being re-called later.

The actual problem is that any variant which ends up internally calling 
fputc (), as putchar () does, will fail unless it's after something like 
printf (), which happens to actually force the initialization.

The apparent problem is that the initial data for the _file[] array's stdout
(_file[1]) is apparently now not correct.  I don't have the source for the
current (2.15) libraries, so can't see it there (in stddata_file.c), but 
did print out actual contents by copying the FILE structs into dummys 
before calling any print/put code.  On stdin, the InUse bit is properly set;
on stdout, it's not, though the other relevant info I checked seemed ok.

Then when fputc checks for InUse as a file-active flag, it fails
there, returning -1 (EOF) as it should.  And thus never calls putch (), 
which would have done the Init_stdio () and fixed this.

Please copy, Rich Siegal/ LightSpeed people.
Technical Details
Message-ID: <6813@drutx.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!mordor!sri-spam!rutgers!mtune!mtgzz!drutx!clive
References: <6802@drutx.ATT.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!mordor!sri-spam!rutgers!mtune!mtgzz!drutx!clive
From: clive@drutx.ATT.COM (Clive Steward)
Newsgroups: comp.sys.mac
Subject: Re: LightSpeed C 2.15 putchar???
Message-ID: <6813@drutx.ATT.COM>
Date: 23 Feb 88 00:58:18 GMT
References: <6802@drutx.ATT.COM>
Organization: resident visitor
Lines: 33