[unixODBC-dev] strxmov routine?

Peter Harvey peterh at mysql.com
Thu Aug 19 04:03:28 BST 2004

lsunley at mb.sympatico.ca wrote:

>While I was porting the MySQL driver I ran into a routine called "strxmov"
>It appears to do a multiple concatenation of strings into a destination
>example ..
>    strxmov(connection,
>            "DSN=",lpsetupdlg->aAttr[KEY_DSN].szAttr,
>            ";SERVER=",lpsetupdlg->aAttr[KEY_SERVER].szAttr,
>            ";DB=",lpsetupdlg->aAttr[KEY_DB].szAttr,
>            ";USER=",lpsetupdlg->aAttr[KEY_USER].szAttr,
>            ";PASSWORD=",lpsetupdlg->aAttr[KEY_PASSWORD].szAttr,
>            ";PORT=",lpsetupdlg->aAttr[KEY_PORT].szAttr,";",NullS);
>I do not appear to have this routine in the os/2 GCC port anywhere.
>Does anyone have some source code or a macro that will implement this??

It is part of the mysql client code. For example; 
mysql-4.0/strings/strxmov.c. The source is open - and short so here is 
what I found;

#include <my_global.h>
#include "m_string.h"
#include <stdarg.h>

char *strxmov(char *dst,const char *src, ...)
  va_list pvar;

  while (src != NullS) {
    while ((*dst++ = *src++)) ;
    src = va_arg(pvar, char *);
  *dst = 0;                     /* there might have been no sources! */
  return dst;

Keep in mind there are platform specific considerations.

Peter Harvey, Software Developer
MySQL AB, www.mysql.com
Office: +1 619 251-6923

Are you MySQL certified?  www.mysql.com/certification

More information about the unixODBC-dev mailing list