*BSD News Article 5487


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!goanna!minyos.xx.rmit.oz.au!rcskb
From: rcskb@minyos.xx.rmit.oz.au (Kendall Bennett)
Newsgroups: comp.unix.bsd
Subject: 386BSD's non-standard C library
Message-ID: <1992Sep24.031603.21009@minyos.xx.rmit.oz.au>
Date: 24 Sep 92 08:16:03 GMT
Organization: RMIT Computer Centre, Melbourne Australia.
Lines: 40

Hmph. I assumed that the standard C library for 386BSD (the one that
comes with 0.1 bindist/srcdist) would be standard, so my ANSI C
conforming programs would work no problems. Well, it seems that the
library is far from standard and is taking a number of shortcuts.

The first program I tried porting to 386BSD was my simple text translation
program. This was originially written under MS-DOS, but I have ported
it to a number of UNIX platforms (SGI Irix 4.0.5, Encore Multimax and
others) without a hitch. The first problem I encounted was the
'tolower' function. According to the man page (which conforms to ANSI
specs :-), tolower will return the lowercase equivalent of a letter
if it is uppercase, and return the same letter if not. However the
implementation for tolower in <ctype.h> is simply the macro:

	#define tolower(c)	((c) - 'A' + 'a')	

which definately does _not_ do what the man pages say, and is specific
to the ASCII character set. The ANSI spec also says that I can undefine
any of these macros and the actual function version will be used
in it's place - this feature is totally non-existant in <ctype.h>

I fixed the above problem, but the program core dumps with a bus error,
so I have no idea what is going on (and I hate using dbx :-( ).

What can be done about this? There are a number of solutions. The
standard library for 386BSD can be fixed so that it is ANSI conforming
(which I have been thinkg of doing anyway), or the GNU standard C library
can be used in it's place (a bit bulky with #defines' etc, but fully
POSIX and ANSI). What do other people use? Do many people use the
GNU c library on their systems or do most people stick with the BSD
library?

+------------------------------------------+-------------------------------+
| Kendall Bennett,                         | Internet:                     |
| Advanced Computer Graphics Centre,       | kjb@godzilla.cgl.citri.edu.au |
| Royal Melbourne Institute of Technology, | rcskb@minyos.xx.rmit.oz.au    |
| Victoria, AUSTRALIA.                     |                               | 
+------------------------------------------+-------------------------------+
| CoSysop (Bossman), PC Connection Australia:               +61 3 688 0909 |
+--------------------------------------------------------------------------+