Go to the source code of this file.
|
char * | TokenValue (char *tokenlist, const char *target) |
|
◆ TokenValue()
char* TokenValue |
( |
char * |
tokenlist, |
|
|
const char * |
target |
|
) |
| |
Definition at line 41 of file ToolkitOptions.cpp.
48 char *tokenlistcopy = NULL;
51 if(tokenlist==NULL)
_error_(
"tokenlist not set (may be a mex?)");
52 tokenlistcopy= xNew<char>(strlen(tokenlist)+1);
53 sprintf(tokenlistcopy,
"%s",tokenlist);
56 token=strtok(tokenlistcopy,
" ");
57 while(token != NULL) {
60 if (strncmp(token,
"-",1)==0){
61 if (strcmp(token+1,target)==0){
63 token = strtok(NULL,
" ");
65 if (strncmp(token,
"-",1)==0){
67 value= xNew<char>(strlen(
"")+1);
68 sprintf(value,
"%s",
"");
73 value= xNew<char>(strlen(token)+1);
74 sprintf(value,
"%s",token);
79 token = strtok(NULL,
" ");
80 if (strncmp(token,
"-",1)==0){
89 else _error_(
"token list should start with an option, not a value");
92 token = strtok(NULL,
" ");
96 xDelete<char>(tokenlistcopy);