Chameleon

Chameleon Svn Source Tree

Root/tags/2.1/i386/klibc/strlcpy.c

Source at commit 2151 created 11 years 5 months ago.
By meklort, Add graphics enabler code for HD4000. Select configuration bassed on video ram configured. Remove erroneous Intel from beginning of model names.
1/*
2 * strlcpy.c
3 */
4
5#include <string.h>
6#include <klibc/compiler.h>
7
8size_t strlcpy(char *dst, const char *src, size_t size)
9{
10size_t bytes = 0;
11char *q = dst;
12const char *p = src;
13char ch;
14
15while ((ch = *p++)) {
16if (bytes + 1 < size)
17*q++ = ch;
18
19bytes++;
20}
21
22/* If size == 0 there is no space for a final null... */
23if (size)
24*q = '\0';
25
26return bytes;
27}
28

Archive Download this file

Revision: 2151