~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to strings/strxnmov.c

  • Committer: Monty Taylor
  • Date: 2008-07-05 11:20:18 UTC
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: monty@inaugust.com-20080705112018-fr12kkmgphtu7m29
Changes so that removal of duplicate curr_dir from my_sys.h work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    Updated: 2 June 1984
21
21
    Defines: strxnmov()
22
22
 
23
 
    strxnmov(dst, len, src1, ..., srcn, NULL)
 
23
    strxnmov(dst, len, src1, ..., srcn, NullS)
24
24
    moves the first len characters of the concatenation of src1,...,srcn
25
25
    to dst and add a closing NUL character.
26
 
    It is just like my_stpncpy except that it concatenates multiple sources.
 
26
    It is just like strnmov except that it concatenates multiple sources.
27
27
    Beware: the last argument should be the null character pointer.
28
 
    Take VERY great care not to omit it!  Also be careful to use NULL
 
28
    Take VERY great care not to omit it!  Also be careful to use NullS
29
29
    and NOT to use 0, as on some machines 0 is not the same size as a
30
 
    character pointer, or not the same bit pattern as NULL.
 
30
    character pointer, or not the same bit pattern as NullS.
31
31
 
32
32
    NOTE
33
 
      strxnmov is like my_stpncpy in that it moves up to len
 
33
      strxnmov is like strnmov in that it moves up to len
34
34
      characters; dst will be padded on the right with one '\0' character.
35
35
      if total-string-length >= length then dst[length] will be set to \0
36
36
*/
37
37
 
 
38
#include <my_global.h>
38
39
#include "m_string.h"
39
40
#include <stdarg.h>
40
41
 
44
45
  char *end_of_dst=dst+len;
45
46
 
46
47
  va_start(pvar,src);
47
 
  while (src != (char *)0)
 
48
  while (src != NullS)
48
49
  {
49
50
    do
50
51
    {