moving upper case names to lower case -- Followups to comp.unix.questions
Guy Harris
guy at auspex.auspex.com
Fri Aug 25 04:18:39 AEST 1989
>>I should point out there is a risk in using tolower like this. Some
>>machines define tolower as ((c)-'A'+'a') (like some sun systems).
> ^^^
>The Gould UTX systems also do this ------------------
>Ie: tolower() does exactly what TurboC calls _tolower() -- it _assumes_ its
>arg is an upper case letter...
"tolower()" was changed from a macro that doesn't check whether its
argument is upper-case to a function that checks whether its argument is
upper-case somewhere around System III or System V. Systems still using
the older AT&T version of "tolower()" - which pretty much means
BSD-flavored systems - still have a "tolower()" that's an "unsafe"
macro.
Most such systems have both BSD and System V environments; in the latter
environment, "tolower()" is a safe function and "_tolower()" is the
unsafe macro. One exception is BSD itself; it has no System V
environment of that sort. However, ANSI C specifies that "tolower()"
must be a safe function, which means BSD will probably change at some
point (4.4BSD?), and if the other systems continue to offer BSD
environments, they will possibly pick up that change (although the
adoption of standards such as ANSI C and POSIX will, with any luck,
reduce the number of differences between those environments
substantially and reduce the need for multiple environments of that
sort).
>As an answer to the original question (converting files to lowercase),
>a simple csh script will do:
As long as you have a C shell on your system, which not all people do;
it's generally better to do things with Bourne shell scripts, as opposed
to C shell or Korn shell scripts, for that reason.
More information about the Comp.unix.questions
mailing list