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