Date: Mon, 16 Oct 1995 23:16:52 +1000 From: Bruce Evans <bde@zeta.org.au> To: ache@astral.msk.su, bde@zeta.org.au, j@uriah.heep.sax.de Cc: hackers@freefall.freebsd.org, kaleb@x.org Subject: Re: A couple problems in FreeBSD 2.1.0-950922-SNAP Message-ID: <199510161316.XAA28075@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>>programs in /bin and /sbin - grep shows "ctype.h" in only 25 out of 80 >>programs in /usr/src/[s]bin. >It isn't accurate results. Many libc functions calls ctype >indirecly, i.e. strtol, atoi, etc. You additionly need >to grep ctype through libc and then grep function you got >through bin/sbin. I suspect that 100% of programs use ctype >for accurate results. strtoul etc. assume the C locale, not to mention the ASCII collating sequence for alpha characters. From strtoul.c: register unsigned char c; ... if (!isascii(c)) break; if (isdigit(c)) c -= '0'; else if (isalpha(c)) c -= isupper(c) ? 'A' - 10 : 'a' - 10; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ else break; if (c >= base) break; The man page says that the base must be <= 36, but this isn't checked for. The above would be less incorrect if it checked for c in the range [a-z] or [A-Z]. Then it would only be assuming an ASCII collating sequence and not the C locale. >>[bloat] >3) I don't see proper way to avoid it for statically compiled >pgms, so I don't understand what we can discuss here. Yes >it isn't very good. Alternatives? Perhaps something can be done using linker tricks. We need: if (ctype is really used (strtoul etc. don't count :-)) link to current _startup_setlocale else link to dummy _startup_setlocale Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510161316.XAA28075>