strlcat.c (27667f58213568a5a115df753353e4cc4b455cf7) | strlcat.c (4a8dea8cf97aab33f4e6a11afcc64dd9562f3bfd) |
---|---|
1/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ 2 3/*- 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 30 unchanged lines hidden (view full) --- 39/* 40 * Appends src to string dst of size siz (unlike strncat, siz is the 41 * full size of dst, not space left). At most siz-1 characters 42 * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 43 * Returns strlen(src) + MIN(siz, strlen(initial dst)). 44 * If retval >= siz, truncation occurred. 45 */ 46size_t | 1/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ 2 3/*- 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 30 unchanged lines hidden (view full) --- 39/* 40 * Appends src to string dst of size siz (unlike strncat, siz is the 41 * full size of dst, not space left). At most siz-1 characters 42 * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 43 * Returns strlen(src) + MIN(siz, strlen(initial dst)). 44 * If retval >= siz, truncation occurred. 45 */ 46size_t |
47strlcat(dst, src, siz) 48 char *dst; 49 const char *src; 50 size_t siz; | 47strlcat(char *dst, const char *src, size_t siz) |
51{ 52 char *d = dst; 53 const char *s = src; 54 size_t n = siz; 55 size_t dlen; 56 57 /* Find the end of dst and adjust bytes left but don't go past end */ 58 while (n-- != 0 && *d != '\0') --- 17 unchanged lines hidden --- | 48{ 49 char *d = dst; 50 const char *s = src; 51 size_t n = siz; 52 size_t dlen; 53 54 /* Find the end of dst and adjust bytes left but don't go past end */ 55 while (n-- != 0 && *d != '\0') --- 17 unchanged lines hidden --- |