1 /* @(#)strcatl.c	1.13 06/09/13 Copyright 1985, 1989, 1995-2003 J. Schilling */
2 /*
3  *	list version of strcat()
4  *
5  *	concatenates all past first parameter until a NULL pointer is reached
6  *
7  *	WARNING: a NULL constant is not a NULL pointer, so a caller must
8  *		cast a NULL constant to a pointer: (char *)NULL
9  *
10  *	returns pointer past last character (to '\0' byte)
11  *
12  *	Copyright (c) 1985, 1989, 1995-2003 J. Schilling
13  */
14 /*
15  * The contents of this file are subject to the terms of the
16  * Common Development and Distribution License, Version 1.0 only
17  * (the "License").  You may not use this file except in compliance
18  * with the License.
19  *
20  * See the file CDDL.Schily.txt in this distribution for details.
21  * A copy of the CDDL is also available via the Internet at
22  * http://www.opensource.org/licenses/cddl1.txt
23  *
24  * When distributing Covered Code, include this CDDL HEADER in each
25  * file and include the License file CDDL.Schily.txt from this distribution.
26  */
27 
28 #include <schily/mconfig.h>
29 #include <schily/varargs.h>
30 #include <schily/standard.h>
31 #include <schily/schily.h>
32 
33 /* VARARGS3 */
34 #ifdef	PROTOTYPES
35 EXPORT char *
strcatl(char * to,...)36 strcatl(char *to, ...)
37 #else
38 EXPORT char *
39 strcatl(to, va_alist)
40 	char *to;
41 	va_dcl
42 #endif
43 {
44 		va_list	args;
45 	register char	*p;
46 	register char	*tor = to;
47 
48 #ifdef	PROTOTYPES
49 	va_start(args, to);
50 #else
51 	va_start(args);
52 #endif
53 	while ((p = va_arg(args, char *)) != NULL) {
54 		while ((*tor = *p++) != '\0') {
55 			tor++;
56 		}
57 	}
58 	*tor = '\0';
59 	va_end(args);
60 	return (tor);
61 }
62