diff options
author | dfr <dfr@FreeBSD.org> | 1999-09-11 17:54:37 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1999-09-11 17:54:37 +0000 |
commit | d9e5c7d5f23454b95b14ed828e79fcae8c570f38 (patch) | |
tree | fef71eb0365ba0b028ea2ec081d29d7ea1ffdbb1 | |
parent | a229a63526767d194764b7401510c12dfc658bd7 (diff) | |
download | FreeBSD-src-d9e5c7d5f23454b95b14ed828e79fcae8c570f38.zip FreeBSD-src-d9e5c7d5f23454b95b14ed828e79fcae8c570f38.tar.gz |
Change toupper/tolower so that they don't give a bogus answer if the
argument is already upper/lower.
-rw-r--r-- | lib/libstand/stand.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h index 80e667e..78832e7 100644 --- a/lib/libstand/stand.h +++ b/lib/libstand/stand.h @@ -167,8 +167,16 @@ extern struct open_file files[]; #define isxdigit(c) (isdigit(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) #define isascii(c) ((c) >= 0 || (c <= 0x7f)) #define isalpha(c) (isupper(c) || (islower(c))) -#define toupper(c) ((c) - 'a' + 'A') -#define tolower(c) ((c) - 'A' + 'a') + +static __inline int toupper(int c) +{ + return islower(c) ? c - 'a' + 'A' : c; +} + +static __inline int tolower(int c) +{ + return isupper(c) ? c - 'A' + 'a' : c; +} /* sbrk emulation */ extern void setheap(void *base, void *top); |