Adding upstream version 3.35.
[syslinux-debian/hramrach.git] / com32 / lib / strlcpy.c
blobba4272b79ba5e1862fc1f09c4c703a2b6fb1c085
1 /*
2 * strlcpy.c
3 */
5 #include <string.h>
6 #include <klibc/compiler.h>
8 size_t strlcpy(char *dst, const char *src, size_t size)
10 size_t bytes = 0;
11 char *q = dst;
12 const char *p = src;
13 char ch;
15 while ( (ch = *p++) ) {
16 if ( bytes < size )
17 *q++ = ch;
19 bytes++;
22 *q = '\0';
23 return bytes;