regapi: strsep is missing on Solaris
François Gouget
fgouget at codeweavers.com
Tue Nov 6 14:56:04 CST 2001
Changelog:
François Gouget <fgouget at codeweavers.com>
* programs/regapi/regapi.c
strsep is not implemented on Solaris.
Replace it with our own portable implementation
--
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: programs/regapi/regapi.c
===================================================================
RCS file: /home/wine/wine/programs/regapi/regapi.c,v
retrieving revision 1.15
diff -u -r1.15 regapi.c
--- programs/regapi/regapi.c 2001/11/06 17:53:09 1.15
+++ programs/regapi/regapi.c 2001/11/06 19:22:59
@@ -318,6 +318,32 @@
}
/******************************************************************************
+ * This is a replacement for strsep which is not portable (missing on Solaris).
+ */
+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;
+}
+
+/******************************************************************************
* Returns an allocated buffer with a cleaned copy (removed the surrounding
* dbl quotes) of the passed value.
*/
@@ -616,7 +642,7 @@
for (counter=0; counter<SET_VALUE_MAX_ARGS; counter++)
argv[counter]=NULL;
- while( (token = strsep(&cmdline, setValueDelim[argCounter])) != NULL )
+ while( (token = getToken(&cmdline, setValueDelim[argCounter])) != NULL )
{
argv[argCounter++] = getArg(token);
@@ -673,7 +699,7 @@
for (counter=0; counter<QUERY_VALUE_MAX_ARGS; counter++)
argv[counter]=NULL;
- while( (token = strsep(&cmdline, queryValueDelim[argCounter])) != NULL )
+ while( (token = getToken(&cmdline, queryValueDelim[argCounter])) != NULL )
{
argv[argCounter++] = getArg(token);
@@ -997,7 +1023,7 @@
/*
* get the command, should be the first arg (modify cmdLine)
*/
- token = strsep(&cmdline, " ");
+ token = getToken(&cmdline, " ");
if (token != NULL)
{
cmdIndex = getCommand(token);
More information about the wine-patches
mailing list