[klibc] Question about islower() in ctype.h (ANSI compat headers
test)
Martin Schlemmer
azarah at nosferatu.za.org
Mon Mar 7 13:31:13 PST 2005
Hi,
So far with the latest changes the projects I am trying to port works
fine, except for a mismatch on what is considered the ansi behaviour of
islower() in ctype.h:
-----
i = 220
islower (i) = 0, ISLOWER (i) = 0
toupper (i) = 220, TOUPPER (i) = 220
i = 221
islower (i) = 0, ISLOWER (i) = 0
toupper (i) = 221, TOUPPER (i) = 221
i = 222
islower (i) = 0, ISLOWER (i) = 0
toupper (i) = 222, TOUPPER (i) = 222
i = 223
islower (i) = 2, ISLOWER (i) = 0
toupper (i) = 223, TOUPPER (i) = 223
No Match!
nosferatu 1.0.0.rc6.klibc4 # cat foo.c
/* confdefs.h. */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define HAVE_DIRENT_H 1
/* end confdefs.h. */
#include <ctype.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') || ('j' <= (c) && (c) <= 'r') || ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
int i;
for (i = 0; i < 256; i++) {
printf("i = %i\n", i);
printf("islower (i) = %i, ISLOWER (i) = %i\n", islower (i), ISLOWER (i));
printf("toupper (i) = %i, TOUPPER (i) = %i\n", toupper (i), TOUPPER (i));
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i)) {
printf("No Match!\n");
exit(2);
}
}
exit (0);
}
nosferatu 1.0.0.rc6.klibc4 #
-----
Above is some output, and the test program (without the printf's) they
use. I have looked at ctype.h, and admitting that I have not really
tried to figure out the voodoo being used, want to know if cases like
this is seen as issues that should be fixed ... I understand that this
being a minimal library, size might be a factor in not making everything
100% ansi/whatever compliant ...
Thanks,
--
Martin Schlemmer
--
---------------------[ Ciphire Signature ]----------------------
From: azarah at nosferatu.za.org signed email body (1537 characters)
Date: on 07 March 2005 at 21:28:14 UTC
To: klibc at zytor.com
----------------------------------------------------------------
: Ciphire has secured this email against identity theft.
: Free download at www.ciphire.com. The garbled lines
: below are the sender's verifiable digital signature.
----------------------------------------------------------------
00fAAAAAEAAABuxyxCAQYAACcCAAIAAgACACAjYe/qeWoHRrdDE3mOifT0WPgp92
kbkclxgX1lQsV9VwEAJOQiG+Djg3e7Ai63e8AMF0Hl/gle8q4Ud88Lecx5fcVdfO
34ORi44kniJJSNDrTkjsUywGVN/QzXC0bqYwyV/Q==
------------------[ End Ciphire Signed Message ]----------------
More information about the klibc
mailing list