1#include <string.h>23#undef strncpy45char *6strncpy(char *restrict s1, const char *restrict s2, size_t n)7{8 char *ret = s1;910 for (; n > 0 && *s2; --n)11 *s1++ = *s2++;1213 while (n-- > 0)14 *s1++ = '\0';1516 return ret;17}
A fork of https://git.simple-cc.org/scc/ for Qute
git clone https://git.8pit.net/scc.git
1#include <string.h>23#undef strncpy45char *6strncpy(char *restrict s1, const char *restrict s2, size_t n)7{8 char *ret = s1;910 for (; n > 0 && *s2; --n)11 *s1++ = *s2++;1213 while (n-- > 0)14 *s1++ = '\0';1516 return ret;17}