diff options
author | Damien Miller <djm@mindrot.org> | 2001-04-14 00:22:33 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2001-04-14 00:22:33 +1000 |
commit | 6e77a538ca63f2ecbab74656839e77084a2db425 (patch) | |
tree | 03dd15234a4ccc802fba338e7b1e54e3a9e71b94 /openbsd-compat/strlcat.c | |
parent | 92d4a020011565d766153cbf85210157c33c541c (diff) |
- Sync with OpenBSD glob.c, strlcat.c and vis.c changes
Diffstat (limited to 'openbsd-compat/strlcat.c')
-rw-r--r-- | openbsd-compat/strlcat.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/openbsd-compat/strlcat.c b/openbsd-compat/strlcat.c index 10ad9e71a..7631d9694 100644 --- a/openbsd-compat/strlcat.c +++ b/openbsd-compat/strlcat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ | 1 | /* $OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -31,7 +31,7 @@ | |||
31 | #ifndef HAVE_STRLCAT | 31 | #ifndef HAVE_STRLCAT |
32 | 32 | ||
33 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) |
34 | static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; | 34 | static char *rcsid = "$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $"; |
35 | #endif /* LIBC_SCCS and not lint */ | 35 | #endif /* LIBC_SCCS and not lint */ |
36 | 36 | ||
37 | #include <sys/types.h> | 37 | #include <sys/types.h> |
@@ -40,8 +40,9 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp | |||
40 | /* | 40 | /* |
41 | * Appends src to string dst of size siz (unlike strncat, siz is the | 41 | * Appends src to string dst of size siz (unlike strncat, siz is the |
42 | * full size of dst, not space left). At most siz-1 characters | 42 | * full size of dst, not space left). At most siz-1 characters |
43 | * will be copied. Always NUL terminates (unless siz == 0). | 43 | * will be copied. Always NUL terminates (unless siz <= strlen(dst)). |
44 | * Returns strlen(src); if retval >= siz, truncation occurred. | 44 | * Returns strlen(initial dst) + strlen(src); if retval >= siz, |
45 | * truncation occurred. | ||
45 | */ | 46 | */ |
46 | size_t strlcat(dst, src, siz) | 47 | size_t strlcat(dst, src, siz) |
47 | char *dst; | 48 | char *dst; |
@@ -54,7 +55,7 @@ size_t strlcat(dst, src, siz) | |||
54 | size_t dlen; | 55 | size_t dlen; |
55 | 56 | ||
56 | /* Find the end of dst and adjust bytes left but don't go past end */ | 57 | /* Find the end of dst and adjust bytes left but don't go past end */ |
57 | while (*d != '\0' && n-- != 0) | 58 | while (n-- != 0 && *d != '\0') |
58 | d++; | 59 | d++; |
59 | dlen = d - dst; | 60 | dlen = d - dst; |
60 | n = siz - dlen; | 61 | n = siz - dlen; |