diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/string/stricmp.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/crt32/string/stricmp.c')
-rw-r--r-- | private/crt32/string/stricmp.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/private/crt32/string/stricmp.c b/private/crt32/string/stricmp.c new file mode 100644 index 000000000..8565e25e3 --- /dev/null +++ b/private/crt32/string/stricmp.c @@ -0,0 +1,80 @@ +/*** +*stricmp.c - contains case-insensitive string comp routine _stricmp/_strcmpi +* +* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved. +* +*Purpose: +* contains _stricmp(), also known as _strcmpi() +* +*Revision History: +* 05-31-89 JCR C version created. +* 02-27-90 GJF Fixed calling type, #include <cruntime.h>, fixed +* copyright. +* 07-25-90 SBM Added #include <ctype.h> +* 10-02-90 GJF New-style function declarator. +* 01-18-91 GJF ANSI naming. +* 10-11-91 GJF Bug fix! Comparison of final bytes must use unsigned +* chars. +* 11-08-91 GJF Fixed compiler warning. +* 09-27-93 CFW Avoid cast bug. +* 06-28-94 SRW Rewrite to use same ANSI specific tolower logic as x86 +* assembler version is i386\stricmp.asm +* +*******************************************************************************/ + +#include <cruntime.h> +#include <string.h> +#include <ctype.h> + +/*** +*int _stricmp(dst, src), _strcmpi(dst, src) - compare strings, ignore case +* +*Purpose: +* _stricmp/_strcmpi perform a case-insensitive string comparision. +* For differences, upper case letters are mapped to lower case. +* Thus, "abc_" < "ABCD" since "_" < "d". +* +*Entry: +* char *dst, *src - strings to compare +* +*Return: +* <0 if dst < src +* 0 if dst = src +* >0 if dst > src +* +*Exceptions: +* +*******************************************************************************/ + +int _CALLTYPE1 _stricmp ( + const char * dst, + const char * src + ) +{ + return( _strcmpi(dst,src) ); +} + + +int _CALLTYPE1 _strcmpi(const char * dst, const char * src) +{ + unsigned char f,l; + + do { + f = *dst++; + l = *src++; + if (f != l) { + if (f>='A' && f<='Z') { + f = f - 'A' + 'a'; + } + if (l>='A' && l<='Z') { + l = l - 'A' + 'a'; + } + if (f!=l) { + return f-l; + } + } + } + while (f); + + return(0); +} |