Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/modules/klibc/strncpy.c

Source at commit 1308 created 12 years 8 months ago.
By meklort, Add a few placeholders for file io
1/*
2 * strncpy.c
3 */
4
5#include <string.h>
6
7char *strncpy(char *dst, const char *src, size_t n)
8{
9char *q = dst;
10const char *p = src;
11char ch;
12
13while (n) {
14n--;
15*q++ = ch = *p++;
16if (!ch)
17break;
18}
19
20/* The specs say strncpy() fills the entire buffer with NUL. Sigh. */
21memset(q, 0, n);
22
23return dst;
24}
25

Archive Download this file

Revision: 1308