diff options
Diffstat (limited to 'com32/lib/strncpy.c')
-rw-r--r-- | com32/lib/strncpy.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/com32/lib/strncpy.c b/com32/lib/strncpy.c new file mode 100644 index 00000000..a8fe45fc --- /dev/null +++ b/com32/lib/strncpy.c @@ -0,0 +1,22 @@ +/* + * strncpy.c + * + * strncpy() + */ + +#include <string.h> + +char *strncpy(char *dst, const char *src, size_t n) +{ + char *q = dst; + const char *p = src; + char ch; + + while ( n-- ) { + *q++ = ch = *p++; + if ( !ch ) + break; + } + + return dst; +} |