12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include <sys/types.h>
- #if defined(__GLIBC__) || defined(_WIN32)
- #include <string.h>
- #include <cutils/memory.h>
- size_t
- strlcpy(char *dst, const char *src, size_t siz)
- {
- char *d = dst;
- const char *s = src;
- size_t n = siz;
-
- if (n != 0) {
- while (--n != 0) {
- if ((*d++ = *s++) == '\0')
- break;
- }
- }
-
- if (n == 0) {
- if (siz != 0)
- *d = '\0';
- while (*s++)
- ;
- }
- return(s - src - 1);
- }
- #endif
|