search for: f28992ab

Displaying 1 result from an estimated 1 matches for "f28992ab".

Did you mean: 868992ab
2020 Mar 28
0
[klibc:update-dash] Implement stpcpy() and stpncpy()
...9 @@ +/* + * stpcpy.c + */ + +#include <string.h> + +char *stpcpy(char *dst, const char *src) +{ + char ch; + + for (;;) { + *dst = ch = *src++; + if (!ch) + break; + dst++; + } + + return dst; +} diff --git a/usr/klibc/stpncpy.c b/usr/klibc/stpncpy.c new file mode 100644 index 00000000..f28992ab --- /dev/null +++ b/usr/klibc/stpncpy.c @@ -0,0 +1,23 @@ +/* + * stpncpy.c + */ + +#include <string.h> + +char *stpncpy(char *dst, const char *src, size_t n) +{ + char *end; + char ch; + + while (n) { + ch = *src++; + if (!ch) + break; + n--; + *dst++ = ch; + } + + end = dst; + memset(d...