diff options
author | H. Peter Anvin <hpa@zytor.com> | 2002-04-30 20:59:21 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2002-04-30 20:59:21 +0000 |
commit | af535c16cf3f9f628384ec834e3aa325709cb37b (patch) | |
tree | c582b65fc34ae4e66aa559ebe901c76aefa05bd5 /nasmlib.c | |
parent | 41bf8002b2fa402bd344a290fcc9f65de328859c (diff) | |
download | nasm-af535c16cf3f9f628384ec834e3aa325709cb37b.tar.gz nasm-af535c16cf3f9f628384ec834e3aa325709cb37b.tar.bz2 nasm-af535c16cf3f9f628384ec834e3aa325709cb37b.zip |
NASM 0.98.03
Diffstat (limited to 'nasmlib.c')
-rw-r--r-- | nasmlib.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -125,29 +125,33 @@ char *nasm_strndup (char *s, size_t len) return p; } +#if !defined(stricmp) && !defined(strcasecmp) int nasm_stricmp (const char *s1, const char *s2) { - while (*s1 && toupper(*s1) == toupper(*s2)) + while (*s1 && tolower(*s1) == tolower(*s2)) s1++, s2++; if (!*s1 && !*s2) return 0; - else if (toupper(*s1) < toupper(*s2)) + else if (tolower(*s1) < tolower(*s2)) return -1; else return 1; } +#endif +#if !defined(strnicmp) && !defined(strncasecmp) int nasm_strnicmp (const char *s1, const char *s2, int n) { - while (n > 0 && *s1 && toupper(*s1) == toupper(*s2)) + while (n > 0 && *s1 && tolower(*s1) == tolower(*s2)) s1++, s2++, n--; if ((!*s1 && !*s2) || n==0) return 0; - else if (toupper(*s1) < toupper(*s2)) + else if (tolower(*s1) < tolower(*s2)) return -1; else return 1; } +#endif #define lib_isnumchar(c) ( isalnum(c) || (c) == '$') #define numvalue(c) ((c)>='a' ? (c)-'a'+10 : (c)>='A' ? (c)-'A'+10 : (c)-'0') |