summaryrefslogtreecommitdiff
path: root/nasmlib.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-04-30 20:59:21 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-04-30 20:59:21 +0000
commitaf535c16cf3f9f628384ec834e3aa325709cb37b (patch)
treec582b65fc34ae4e66aa559ebe901c76aefa05bd5 /nasmlib.c
parent41bf8002b2fa402bd344a290fcc9f65de328859c (diff)
downloadnasm-af535c16cf3f9f628384ec834e3aa325709cb37b.tar.gz
nasm-af535c16cf3f9f628384ec834e3aa325709cb37b.tar.bz2
nasm-af535c16cf3f9f628384ec834e3aa325709cb37b.zip
NASM 0.98.03
Diffstat (limited to 'nasmlib.c')
-rw-r--r--nasmlib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/nasmlib.c b/nasmlib.c
index 86ed6c4..64f2b7f 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -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')