blob: 331e8dc7bce77340bc7d6b5456b16607f31c66ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include <string.h> // for strncpy, size_t
char *strncpy(char *restrict s1, const char *restrict s2, size_t n)
{
char *d = s1;
while (n-- && *s2)
*d++ = *s2++;
while (n--)
*d++ = '\0';
return s1;
}
|