diff options
author | Francois Perrad <francois.perrad@gadz.org> | 2016-03-25 07:57:19 +0100 |
---|---|---|
committer | Francois Perrad <francois.perrad@gadz.org> | 2016-11-15 14:56:25 +0100 |
commit | 37a66fa5b64ba36285abd346fc8706e6bef4be31 (patch) | |
tree | 88d91d61225562f929bbd9fcb554013387546cb1 | |
parent | 81a024049151e5d62805a4517bf6b357cfaa9e0a (diff) |
upgrade strlcat
in order to remove K&R code
-rw-r--r-- | compat.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -114,8 +114,8 @@ size_t strlcpy(char *dst, const char *src, size_t size) { #endif /* HAVE_STRLCPY */ #ifndef HAVE_STRLCAT -/* taken from openbsd-compat for OpenSSH 3.6.1p1 */ -/* "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $" +/* taken from openbsd-compat for OpenSSH 7.2p2 */ +/* "$OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $" * * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters @@ -123,15 +123,12 @@ size_t strlcpy(char *dst, const char *src, size_t size) { * Returns strlen(src) + MIN(siz, strlen(initial dst)). * If retval >= siz, truncation occurred. */ - size_t -strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; +size_t +strlcat(char *dst, const char *src, size_t siz) { - register char *d = dst; - register const char *s = src; - register size_t n = siz; + char *d = dst; + const char *s = src; + size_t n = siz; size_t dlen; /* Find the end of dst and adjust bytes left but don't go past end */ |