/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * %sccs.include.redist.c% */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)strncat.c 8.1 (Berkeley) 06/04/93"; #endif /* LIBC_SCCS and not lint */ #include #include /* * Concatenate src on the end of dst. At most strlen(dst)+n+1 bytes * are written at dst (at most n+1 bytes being appended). Return dst. */ char * strncat(dst, src, n) char *dst; const char *src; register size_t n; { if (n != 0) { register char *d = dst; register const char *s = src; while (*d != 0) d++; do { if ((*d = *s++) == 0) break; d++; } while (--n != 0); *d = 0; } return (dst); }