1 /* strl(cat|cpy) implementation for systems that do not have it in libc */
2 /* strl.c - strlcpy/strlcat implementation
3 * Time-stamp: <2004-03-14 njk>
4 * (C) 2003-2004 Nicholas J. Kain <njk@aerifal.cx>
10 unsigned int strlcpy (char *dest
, const char *src
, unsigned int size
)
12 register unsigned int i
;
14 for (i
=0; size
> 0 && src
[i
] != '\0'; ++i
, size
--)
24 unsigned int strlcat (char *dest
, const char *src
, unsigned int size
)
27 register unsigned int i
, j
;
29 for(i
=0; size
> 0 && dest
[i
] != '\0'; size
--, i
++);
30 for(j
=0; size
> 0 && src
[j
] != '\0'; size
--, i
++, j
++)
36 register char *d
= dest
;
37 register const char *s
= src
;
39 for (; size
> 0 && *d
!= '\0'; size
--, d
++);
40 for (; size
> 0 && *s
!= '\0'; size
--, d
++, s
++)
44 return (d
- dest
) + (s
- src
);