MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
strxnmov.c
1
/* Copyright (c) 2000-2002, 2005-2007 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 : strxnmov.c
20
Author : Richard A. O'Keefe.
21
Updated: 2 June 1984
22
Defines: strxnmov()
23
24
strxnmov(dst, len, src1, ..., srcn, NullS)
25
moves the first len characters of the concatenation of src1,...,srcn
26
to dst and add a closing NUL character.
27
It is just like strnmov 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
NOTE
34
strxnmov is like strnmov in that it moves up to len
35
characters; dst will be padded on the right with one '\0' character.
36
if total-string-length >= length then dst[length] will be set to \0
37
*/
38
39
#include <my_global.h>
40
#include "m_string.h"
41
#include <stdarg.h>
42
43
char
*strxnmov(
char
*dst,
size_t
len,
const
char
*src, ...)
44
{
45
va_list pvar;
46
char
*end_of_dst=dst+len;
47
48
va_start(pvar,src);
49
while
(src != NullS)
50
{
51
do
52
{
53
if
(dst == end_of_dst)
54
goto
end;
55
}
56
while
((*dst++ = *src++));
57
dst--;
58
src = va_arg(pvar,
char
*);
59
}
60
end:
61
*dst=0;
62
va_end(pvar);
63
return
dst;
64
}
strings
strxnmov.c
Generated on Sat Nov 9 2013 01:28:54 for MySQL 5.6.14 Source Code Document by
1.8.1.2