1
by brian
clean slate |
1 |
/* Copyright (C) 2002 MySQL AB
|
2 |
|
|
3 |
This library is free software; you can redistribute it and/or
|
|
4 |
modify it under the terms of the GNU Library General Public
|
|
5 |
License as published by the Free Software Foundation; version 2
|
|
6 |
of the License.
|
|
7 |
|
|
8 |
This library is distributed in the hope that it will be useful,
|
|
9 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11 |
Library General Public License for more details.
|
|
12 |
|
|
13 |
You should have received a copy of the GNU Library General Public
|
|
14 |
License along with this library; if not, write to the Free
|
|
15 |
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
|
16 |
MA 02111-1307, USA */
|
|
17 |
||
18 |
/* File : strxmov.c
|
|
19 |
Author : Richard A. O'Keefe.
|
|
20 |
Updated: 25 may 1984
|
|
21 |
Defines: strxmov()
|
|
22 |
||
236.1.27
by Monty Taylor
Some cleanups/decoupling in mystring. |
23 |
strxmov(dst, src1, ..., srcn, (char *))
|
1
by brian
clean slate |
24 |
moves the concatenation of src1,...,srcn to dst, terminates it
|
25 |
with a NUL character, and returns a pointer to the terminating NUL.
|
|
26 |
It is just like strmov except that it concatenates multiple sources.
|
|
27 |
Beware: the last argument should be the null character pointer.
|
|
236.1.27
by Monty Taylor
Some cleanups/decoupling in mystring. |
28 |
Take VERY great care not to omit it!
|
1
by brian
clean slate |
29 |
*/
|
30 |
||
31 |
#include "m_string.h" |
|
32 |
#include <stdarg.h> |
|
33 |
||
34 |
char *strxmov(char *dst,const char *src, ...) |
|
35 |
{
|
|
36 |
va_list pvar; |
|
37 |
||
38 |
va_start(pvar,src); |
|
236.1.27
by Monty Taylor
Some cleanups/decoupling in mystring. |
39 |
while (src != (char *)0) { |
1
by brian
clean slate |
40 |
while ((*dst++ = *src++)) ; |
41 |
dst--; |
|
42 |
src = va_arg(pvar, char *); |
|
43 |
}
|
|
44 |
va_end(pvar); |
|
45 |
*dst = 0; /* there might have been no sources! */ |
|
46 |
return dst; |
|
47 |
}
|