wm: teppich

ref: 8fe978f00633ce7bdf4c0413e72b5a78ddca7bec
dir: /libc/strncpy.c/

View raw version
#include <u.h>

char*
strncpy(char *dst, const char *src, size_t num)
{
	char *dst_p;

	dst_p = dst;
	while(*src != '\0' && num > 0)
	{
		*dst++ = *src++;
		num--;
	}
	if(*src != '\0')
		*dst = '\0';

	return (dst_p);
}