diff options
Diffstat (limited to 'main/glib/strncpy.c')
-rw-r--r-- | main/glib/strncpy.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/main/glib/strncpy.c b/main/glib/strncpy.c index 740ac0d..3eabc1a 100644 --- a/main/glib/strncpy.c +++ b/main/glib/strncpy.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. @@ -44,20 +44,21 @@ __FBSDID("$FreeBSD$"); * Return dst. */ char * -strncpy(char * __restrict dst, const char * __restrict src, size_t n) +strncpy(char *__restrict dst, const char *__restrict src, size_t n) { - if (n != 0) { - char *d = dst; - const char *s = src; + if(n != 0) { + char *d = dst; + const char *s = src; - do { - if ((*d++ = *s++) == '\0') { - /* NUL pad the remaining n-1 bytes */ - while (--n != 0) - *d++ = '\0'; - break; - } - } while (--n != 0); - } - return (dst); + do { + if((*d++ = *s++) == '\0') { + /* NUL pad the remaining n-1 bytes */ + while(--n != 0) { + *d++ = '\0'; + } + break; + } + } while(--n != 0); + } + return (dst); } |