Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!caip!clyde!cuae2!ihnp4!gargoyle!jpusa1!stu From: stu@jpusa1.UUCP (Stu Heiss) Newsgroups: net.micro.cpm Subject: standardizing BDS C (sort of) Message-ID: <117@jpusa1.UUCP> Date: Thu, 9-Oct-86 11:35:32 EDT Article-I.D.: jpusa1.117 Posted: Thu Oct 9 11:35:32 1986 Date-Received: Fri, 10-Oct-86 05:49:47 EDT References: <882@sigma.UUCP> Reply-To: stu@jpusa1.UUCP (Stu Heiss) Followup-To: net.micro.cpm Organization: JPUSA - Chicago, IL Lines: 26 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}