Skip to content

Commit

Permalink
- strtok_r not available in MinGW, added an implementation for it.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18653 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Jan 16, 2014
1 parent ea4422a commit e4d809e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -2570,6 +2570,38 @@ char* SystemImpl__ctime(double time)
return GC_strdup(ctime_r(&t,buf));
}

#if defined(__MINGW32__)
/*
* strtok_r implementation
*/
char *omc_strtok_r(char *str, const char *delim, char **saveptr)
{
char *token;
if (!str && !(str = *saveptr))
{
return NULL;
}
str += strspn(str, delim);
if (!*str) {
*saveptr = NULL;
return NULL;
}
token = str++;
str += strcspn(str, delim);
if (*str) {
*str = 0;
*saveptr = str+1;
} else {
*saveptr = NULL;
}

return token;
}

#define strtok_r omc_strtok_r

#endif /* defined(__MINGW32__) */

#ifdef __cplusplus
}
#endif

0 comments on commit e4d809e

Please sign in to comment.