diff options
Diffstat (limited to 'Cryptlib/SysCall')
| -rw-r--r-- | Cryptlib/SysCall/BaseStrings.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Cryptlib/SysCall/BaseStrings.c b/Cryptlib/SysCall/BaseStrings.c index 990037d1..2267d862 100644 --- a/Cryptlib/SysCall/BaseStrings.c +++ b/Cryptlib/SysCall/BaseStrings.c @@ -93,3 +93,33 @@ AsciiStrDecimalToUintn(const char *String) return Result; } + +int +strcmp (const char *str1, const char *str2) +{ + return strcmpa((CHAR8 *)str1,(CHAR8 *)str2); +} + +inline static char +toupper (char c) +{ + return ((c >= 'a' && c <= 'z') ? c - ('a' - 'A') : c); +} + +/* Based on AsciiStriCmp() in edk2 MdePkg/Library/BaseLib/String.c */ +int +strcasecmp (const char *str1, const char *str2) +{ + char c1, c2; + + c1 = toupper (*str1); + c2 = toupper (*str2); + while ((*str1 != '\0') && (c1 == c2)) { + str1++; + str2++; + c1 = toupper (*str1); + c2 = toupper (*str2); + } + + return c1 - c2; +} |
