MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
strxmov.c
1 /* Copyright (c) 2000-2002, 2006 MySQL AB
2  Use is subject to license terms.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; version 2
7  of the License.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public
15  License along with this library; if not, write to the Free
16  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
17  MA 02110-1301, USA */
18 
19 /* File : strxmov.c
20  Author : Richard A. O'Keefe.
21  Updated: 25 may 1984
22  Defines: strxmov()
23 
24  strxmov(dst, src1, ..., srcn, NullS)
25  moves the concatenation of src1,...,srcn to dst, terminates it
26  with a NUL character, and returns a pointer to the terminating NUL.
27  It is just like strmov except that it concatenates multiple sources.
28  Beware: the last argument should be the null character pointer.
29  Take VERY great care not to omit it! Also be careful to use NullS
30  and NOT to use 0, as on some machines 0 is not the same size as a
31  character pointer, or not the same bit pattern as NullS.
32 */
33 
34 #include <my_global.h>
35 #include "m_string.h"
36 #include <stdarg.h>
37 
38 char *strxmov(char *dst,const char *src, ...)
39 {
40  va_list pvar;
41 
42  va_start(pvar,src);
43  while (src != NullS) {
44  while ((*dst++ = *src++)) ;
45  dst--;
46  src = va_arg(pvar, char *);
47  }
48  va_end(pvar);
49  *dst = 0; /* there might have been no sources! */
50  return dst;
51 }