diff options
Diffstat (limited to 'src/string/strcat.c')
-rw-r--r-- | src/string/strcat.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/string/strcat.c b/src/string/strcat.c index 9526cd59..75364ad3 100644 --- a/src/string/strcat.c +++ b/src/string/strcat.c @@ -1,9 +1,10 @@ #include <string.h> -#include "nonstd/assert.h" +#include "../_assert.h" /** concatenate strings **/ char * strcat(char * restrict s1, const char * restrict s2) { + size_t i = 0; ASSERT_NONNULL(s1); ASSERT_NONNULL(s2); ASSERT_NOOVERLAP(s1, s2, strlen(s1) + strlen(s2)); @@ -11,7 +12,11 @@ char * strcat(char * restrict s1, const char * restrict s2) /* RETURN_ALWAYS(ARGUMENT(s1)); */ - return strncat(s1, s2, strlen(s2)); + while (s1[i] != '\0') { + i++; + } + + return strcpy(s1 + i, s2); } /*** |