queries on internals...

Francois Gouget fgouget at free.fr
Tue Nov 6 12:52:38 CST 2001


On Tue, 6 Nov 2001, Roger Fujii wrote:
[...]
> 2) regapi uses strsep, which solaris doesn't have.  Is its 
> usage in wine compatible with strtok, or should I cut/paste
> strsep into library/ports.c?

   I believe regapi is not compatible with strtok: if you have
   "Name"=
   then regapi expects to get two tokens '"name"' and '', but strtok
only returns one. I was also wondering how to best fix that. Since it is
a Winelib application and not a part of Wine I don't know if
implementing strsep in library/port.c is the best solution: shouldn't we
be able to compile regapi on Windows? In addition to that Wine itself
does not use strsep. I would like Alexandre's opinion on that :-)

   So the other solution is to reimplement strsep in regapi itself and I
have a patch for that. Just in case, here is a carefully tested strsep
reimplementation:

static char* getToken(char** str, const char* delims)
{
    char* token;

    if (*str==NULL) {
        /* No more tokens */
        return NULL;
    }

    token=*str;
    while (**str!='\0') {
        if (strchr(delims,**str)!=NULL) {
            **str='\0';
            (*str)++;
            return token;
        }
        (*str)++;
    }
    /* There is no other token */
    *str=NULL;
    return token;
}


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
      Any sufficiently advanced bug is indistinguishable from a feature.
                            -- from some indian guy





More information about the wine-devel mailing list