Remove RCS keywords, since they no longer work after git migration.
[mmh] / sbr / concat.c
1
2 /*
3  * concat.c -- concatenate a variable number (minimum of 1)
4  *             of strings in managed memory
5  *
6  * This code is Copyright (c) 2002, by the authors of nmh.  See the
7  * COPYRIGHT file in the root directory of the nmh distribution for
8  * complete copyright information.
9  */
10
11 #include <h/mh.h>
12 #include <h/utils.h>
13
14
15 char *
16 concat (char *s1, ...)
17 {
18     char *cp, *dp, *sp;
19     size_t len;
20     va_list list;
21
22     len = strlen (s1) + 1;
23     va_start(list, s1); 
24     while ((cp = va_arg(list, char *)))
25         len += strlen (cp);
26     va_end(list);
27
28     dp = sp = mh_xmalloc(len);
29
30     sp = copy(s1, sp);
31
32     va_start(list, s1); 
33     while ((cp = va_arg (list, char *)))
34         sp = copy(cp, sp);
35     va_end(list);
36
37     return dp;
38 }