+++ /dev/null
-/** @file\r
- Comparison Functions for <string.h>.\r
-\r
- Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-#include <Uefi.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-\r
-#include <LibConfig.h>\r
-\r
-#include <ctype.h>\r
-#include <string.h>\r
-\r
-/** The memcmp function compares the first n characters of the object pointed\r
- to by s1 to the first n characters of the object pointed to by s2.\r
-\r
- @return The memcmp function returns an integer greater than, equal to, or\r
- less than zero, accordingly as the object pointed to by s1 is\r
- greater than, equal to, or less than the object pointed to by s2.\r
-**/\r
-int memcmp(const void *s1, const void *s2, size_t n)\r
-{\r
- return (int)CompareMem( s1, s2, n);\r
-}\r
-\r
-/** The strcmp function compares the string pointed to by s1 to the string\r
- pointed to by s2.\r
-\r
- @return The strcmp function returns an integer greater than, equal to, or\r
- less than zero, accordingly as the string pointed to by s1 is\r
- greater than, equal to, or less than the string pointed to by s2.\r
-**/\r
-int strcmp(const char *s1, const char *s2)\r
-{\r
- return (int)AsciiStrCmp( s1, s2);\r
-}\r
-\r
-/** The strcoll function compares the string pointed to by s1 to the string\r
- pointed to by s2, both interpreted as appropriate to the LC_COLLATE\r
- category of the current locale.\r
-\r
- @return The strcoll function returns an integer greater than, equal to,\r
- or less than zero, accordingly as the string pointed to by s1 is\r
- greater than, equal to, or less than the string pointed to by s2\r
- when both are interpreted as appropriate to the current locale.\r
-**/\r
-int strcoll(const char *s1, const char *s2)\r
-{\r
- /* LC_COLLATE is unimplemented, hence always "C" */\r
- return (strcmp(s1, s2));\r
-}\r
-\r
-/** The strncmp function compares not more than n characters (characters that\r
- follow a null character are not compared) from the array pointed to by s1\r
- to the array pointed to by s2.\r
-\r
- @return The strncmp function returns an integer greater than, equal to,\r
- or less than zero, accordingly as the possibly null-terminated\r
- array pointed to by s1 is greater than, equal to, or less than\r
- the possibly null-terminated array pointed to by s2.\r
-**/\r
-int strncmp(const char *s1, const char *s2, size_t n)\r
-{\r
- return (int)AsciiStrnCmp( s1, s2, n);\r
-}\r
-\r
-/** The strxfrm function transforms the string pointed to by Src and places the\r
- resulting string into the array pointed to by Dest. The transformation is\r
- such that if the strcmp function is applied to two transformed strings, it\r
- returns a value greater than, equal to, or less than zero, corresponding to\r
- the result of the strcoll function applied to the same two original\r
- strings. No more than Len characters are placed into the resulting array\r
- pointed to by Dest, including the terminating null character. If Len is zero,\r
- Dest is permitted to be a null pointer. If copying takes place between\r
- objects that overlap, the behavior is undefined.\r
-\r
- @return The strxfrm function returns the length of the transformed string\r
- (not including the terminating null character). If the value\r
- returned is Len or more, the contents of the array pointed to by Dest\r
- are indeterminate.\r
-**/\r
-size_t strxfrm(char * __restrict Dest, const char * __restrict Src, size_t Len)\r
-{\r
- size_t srclen, copysize;\r
-\r
- /*\r
- * Since locales are unimplemented, this is just a copy.\r
- */\r
- srclen = strlen(Src);\r
- if (Len != 0) {\r
- copysize = srclen < Len ? srclen : Len - 1;\r
- (void)memcpy(Dest, Src, copysize);\r
- Dest[copysize] = 0;\r
- }\r
- return (srclen);\r
-}\r
-\r
-/** Case agnostic string comparison for NetBSD compatibility. **/\r
-int\r
-strcasecmp(const char *s1, const char *s2)\r
-{\r
- return (int)AsciiStriCmp( s1, s2);\r
-}\r