10l: comparison of char* ptrs with string literals
[mplayer.git] / osdep / strlcpy.c
blob887461abbcb28c8b78325c5bbb7bfa9d7a490e67
1 /* strlcpy implementation for systems that do not have it in libc
2 * Time-stamp: <2004-03-14 njk>
3 * (C) 2003-2004 Nicholas J. Kain <njk@aerifal.cx>
4 */
6 #include "config.h"
8 unsigned int strlcpy (char *dest, const char *src, unsigned int size)
10 register unsigned int i = 0;
12 if (size > 0) {
13 size--;
14 for (i=0; size > 0 && src[i] != '\0'; ++i, size--)
15 dest[i] = src[i];
17 dest[i] = '\0';
19 while (src[i++]);
21 return i;