[unixODBC-dev] strxmov routine?

lsunley at mb.sympatico.ca lsunley at mb.sympatico.ca
Thu Aug 19 03:14:47 BST 2004


Thanks...


Lorne

In <41241880.9090902 at mysql.com>, on 08/18/04 
   at 08:03 PM, Peter Harvey <peterh at mysql.com> said:

>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
>>variable.
>>
>>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??
>>
>>Thanks
>>
>>Lorne
>>
>>  
>>
>Lorne,

>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;

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

>Keep in mind there are platform specific considerations.



-- 
-----------------------------------------------------------
lsunley at mb.sympatico.ca
-----------------------------------------------------------




More information about the unixODBC-dev mailing list