🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #930

Re: NOFILES bug in System V.3

#930
From: Guy Harris
Date: Wed, 23 Nov 1988 21:44
18 lines
1395 bytes
>Sscanf() apparently dummies up a FILE struct and then calls
>_doscan() to do the real work.  It uses the string being scanned as the
>"buffer" in the FILE struct and sets to file descriptor to 20.

This is true.  Some means of indicating that the FILE struct in question
refers to a string, rather than a file, is necessary; you have just
discovered why the method used by System V Releases 2 and 3 (and perhaps
earlier releases) is wrong.  The one used by 4BSD (and perhaps by V7 or
32V) is better; it uses the _IOSTRG flag to indicate that the FILE
struct refers to a string.

An even better one would permit you to create standard I/O streams that
can refer to arbitrary objects, with "put buffer" and "get buffer"
operations; this would 1) permit you to use more than "sprintf" and
"sscanf" on strings, and 2) might permit you to do things like support
string objects that grow dynamically as needed, as well as fixed-length
strings.  I think Chris Torek has done such a version of standard I/O,
which may appear in a future BSD release.
Technical Details
Message-ID: <501@auspex.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!auspex!guy
References: <11616@cup.portal.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!auspex!guy
From: guy@auspex.UUCP (Guy Harris)
Newsgroups: comp.bugs.sys5
Subject: Re: NOFILES bug in System V.3
Message-ID: <501@auspex.UUCP>
Date: 23 Nov 88 21:44:24 GMT
References: <11616@cup.portal.com>
Reply-To: guy@auspex.UUCP (Guy Harris)
Organization: Auspex Systems, Santa Clara
Lines: 18