Skip to content
This repository has been archived by the owner on Jan 11, 2020. It is now read-only.

Commit

Permalink
Implemented the <string.h> strncat() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
gluk256 committed Nov 23, 2014
1 parent 744d115 commit 3d9e99d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/string/strncat.c
Expand Up @@ -8,13 +8,22 @@

/**
* @date 2014-11-23
* @author Arto Bendiken
* @author Vlad Gluhovsky
* @see http://libc11.org/string/strncat.html
*/
char*
strncat(char* restrict s1,
const char* restrict s2,
size_t n) {

size_t i = 0, j = 0;
while (s1[i++])
;

while (j < n && s2[j])
s1[i++] = s2[j++];

s1[i] = 0;

return (void)s1, (void)s2, (void)n, NULL; // TODO
return s1;
}

0 comments on commit 3d9e99d

Please sign in to comment.