[net.micro.cpm] standardizing BDS C

bill@sigma.UUCP (William Swan) (10/08/86)

References:


[]
Has anybody "standardized" BDS C?


I have been working (playing) with a BDS C compiler lately, and have 
been subjected to a number of annoyances related to its non-standard
I/O routines which carry standard names, such as fopen().

A few years back somebody wrote a set of routines, sfopen() et al, 
that work like the "real" thing. I expanded and incorporated those into
"my" libraries, but there is still the problem of finding and changing
names in p/d programs to be compiled with BDS C.

I would like to reorganize the standard libraries so that the "new"
standard functions would work just like the "real" thing. A quick
survey shows the following routines (there may be others) to be
(possibly) nonstandard in some potentially critical way:

	puts()	getline()?
	open()	creat()	read()	write()	seek()?	tell()?
	fopen()	fgets()?

If anybody has done this before (or knows of it being done), I would
appreciate sources, pointers, or hints.

---
Bill Swan	{decvax,allegra,ihnp4}!uw-beaver!tikal!sigma!bill

mdapoz@watrose.UUCP (Mark Dapoz) (10/09/86)

In article <882@sigma.UUCP> bill@sigma.UUCP (William Swan) writes:

>Has anybody "standardized" BDS C?

From what I hear, there should be a new version of BDS C comming out that
is supposed to be "more K&R compatible".  That could mean anything from
fixing the I/O routines to adding auto initialization.  One thing that
it is supposed to have is a float data type (about time!!).  You might
want to check with the author to see what he really is doing for the next
release before you take on any really big projects for overhauling the
existing BDS C.

	-Mark Dapoz
	mdapoz@watrose.UUCP

stu@jpusa1.UUCP (Stu Heiss) (10/09/86)

Summary:

Expires:


In article <882@sigma.UUCP> bill@sigma.UUCP (William Swan) writes:
-Has anybody "standardized" BDS C?
-I would like to reorganize the standard libraries so that the "new"
-standard functions would work just like the "real" thing. A quick
-survey shows the following routines (there may be others) to be
-(possibly) nonstandard in some potentially critical way:
-	puts()	getline()?
-	open()	creat()	read()	write()	seek()?	tell()?
-	fopen()	fgets()?
-If anybody has done this before (or knows of it being done), I would
-appreciate sources, pointers, or hints.

I came up with a quick and dirty solution for the buffered i/o stuff via
defines and a small library.  It went something like this.  stdio.h for
bdsc is basically bdscio.h with some defines that map fopen to ufopen,
fclose to ufclose and so-on.  The library file (I called it unixio.c)
has the ufopen which uses malloc to get a buffer and bdsc's fopen to do
the actual open after parsing the mode field.  ufclose frees the buffer
and calls fclose.  The higher level calls are easily handled this way
but read/write/seek/tell will need a complete rewrite.  Seek and tell
really can't be done without longs anyway.  As long as your code sticks
to buffered i/o, this works fine and is easy to implement.  While you're
at it, put the whole malloc library in unixio and save yourself further
headaches.  The code in k&r will do.
-- 
Stu Heiss {ihnp4!jpusa1!stu}