This repository has been archived on 2023-08-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

23 lines
253 B
C

/*
* 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;
}