+++ /dev/null
-/** @file\r
- Concatenation 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
-\r
-#include <LibConfig.h>\r
-\r
-#include <string.h>\r
-\r
-/** The strcat function appends a copy of the string pointed to by s2\r
- (including the terminating null character) to the end of the string pointed\r
- to by s1. The initial character of s2 overwrites the null character at the\r
- end of s1. If copying takes place between objects that overlap, the\r
- behavior is undefined.\r
-\r
- @return The strcat function returns the value of s1.\r
-**/\r
-char *\r
-strcat(char * __restrict s1, const char * __restrict s2)\r
-{\r
- return AsciiStrCat( s1, s2);\r
-}\r
-\r
-/** The strncat function appends not more than n characters (a null character\r
- and characters that follow it are not appended) from the array pointed to\r
- by s2 to the end of the string pointed to by s1. The initial character of\r
- s2 overwrites the null character at the end of s1. A terminating null\r
- character is always appended to the result. If copying takes place\r
- between objects that overlap, the behavior is undefined.\r
-\r
- @return The strncat function returns the value of s1.\r
-**/\r
-char *\r
-strncat(char * __restrict s1, const char * __restrict s2, size_t n)\r
-{\r
- return AsciiStrnCat( s1, s2, n);\r
-}\r
-\r
-/** The strncatX function appends not more than n characters (a null character\r
- and characters that follow it are not appended) from the array pointed to\r
- by s2 to the end of the string pointed to by s1. The initial character of\r
- s2 overwrites the null character at the end of s1. The result is always\r
- terminated with a null character. If copying takes place between objects\r
- that overlap, the behavior is undefined.\r
-\r
- strncatX exists because normal strncat does not indicate if the operation\r
- was terminated because of exhausting n or reaching the end of s2.\r
-\r
- @return The strncatX function returns 0 if the operation was terminated\r
- because it reached the end of s1. Otherwise, a non-zero value is\r
- returned indicating how many characters remain in s1.\r
-**/\r
-int\r
-strncatX(char * __restrict s1, const char * __restrict s2, size_t n)\r
-{\r
- int NumLeft;\r
-\r
- // Find s1's terminating NUL\r
- for( ; n != 0; --n) {\r
- if( *s1++ == '\0') break;\r
- }\r
-\r
- // Now copy *s2 into s1, overwriting s1's terminating NUL\r
- for( --s1; n != 0; --n) {\r
- if((*s1++ = *s2++) == '\0') break;\r
- }\r
- NumLeft = (int)n;\r
-\r
- // Guarantee that s1 is NUL terminated.\r
- *--s1 = '\0';\r
-\r
- return NumLeft; // Zero if we ran out of buffer ( strlen(s1) < strlen(s2) )\r
-}\r