+++ /dev/null
-/** @file\r
- Miscellaneous 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 <sys/EfiCdefs.h>\r
-\r
-#include <Uefi.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/PrintLib.h>\r
-\r
-#include <LibConfig.h>\r
-\r
-#include <errno.h>\r
-#include <limits.h>\r
-#include <string.h>\r
-\r
-extern char *sys_errlist[];\r
-\r
-#if !((defined(MDE_CPU_ARM) || defined(MDE_CPU_AARCH64)) && defined(__GNUC__))\r
-/** The memset function copies the value of c (converted to an unsigned char)\r
- into each of the first n characters of the object pointed to by s.\r
-\r
- @return The memset function returns the value of s.\r
-**/\r
-void *\r
-memset(void *s, int c, size_t n)\r
-{\r
- return SetMem( s, (UINTN)n, (UINT8)c);\r
-}\r
-#endif\r
-\r
-int\r
-strerror_r(int errnum, char *buf, size_t buflen)\r
-{\r
- const char *estring;\r
- INTN i;\r
- int retval = 0;\r
-\r
- if( (errnum < 0) || (errnum >= EMAXERRORVAL)) {\r
- (void) AsciiSPrint( buf, ASCII_STRING_MAX, "Unknown Error: %d.", errnum);\r
- retval = EINVAL;\r
- }\r
- else {\r
- estring = sys_errlist[errnum];\r
- for( i = buflen; i > 0; --i) {\r
- if( (*buf++ = *estring++) == '\0') {\r
- break;\r
- }\r
- }\r
- if(i == 0) {\r
- retval = ERANGE;\r
- }\r
- }\r
- return retval;\r
-}\r
-\r
-/** The strerror function maps the number in errnum to a message string.\r
- Typically, the values for errnum come from errno, but strerror shall map\r
- any value of type int to a message.\r
-\r
- The implementation shall behave as if no library function calls the\r
- strerror function.\r
-\r
- @return The strerror function returns a pointer to the string, the\r
- contents of which are locale specific. The array pointed to\r
- shall not be modified by the program, but may be overwritten by\r
- a subsequent call to the strerror function.\r
-**/\r
-char *\r
-strerror(int errnum)\r
-{\r
- static char errorbuf[ASCII_STRING_MAX];\r
- int status;\r
-\r
- status = strerror_r(errnum, errorbuf, sizeof(errorbuf));\r
- if(status != 0) {\r
- errno = status;\r
- }\r
- return errorbuf;\r
-}\r
-\r
-/** The strlen function computes the length of the string pointed to by s.\r
-\r
- @return The strlen function returns the number of characters that\r
- precede the terminating null character.\r
-**/\r
-size_t\r
-strlen(const char *s)\r
-{\r
- return (size_t)AsciiStrLen( s);\r
-}\r