version 1.2.2.1, 2011/02/10 19:34:53
|
version 1.2.2.2, 2011/02/10 19:45:07
|
Line 358 end:
|
Line 358 end:
|
/* |
/* |
* ioVarAst() Function for evaluate string like asterisk variable "{text[:[-]#[:#]]}" |
* ioVarAst() Function for evaluate string like asterisk variable "{text[:[-]#[:#]]}" |
* @csString = Input string |
* @csString = Input string |
* @strLen = String length |
|
* return: NULL error, !=NULL Allocated new string evaluated from input string, must be free() |
* return: NULL error, !=NULL Allocated new string evaluated from input string, must be free() |
*/ |
*/ |
char * |
char * |
ioVarAst(const char *csString, int strLen) | ioVarAst(const char *csString) |
{ |
{ |
char *ext, *str, *out = NULL; |
char *ext, *str, *out = NULL; |
int e[2] = { 0 }; |
int e[2] = { 0 }; |
|
|
if (!csString || !strLen) | if (!csString) |
return NULL; |
return NULL; |
|
|
if (!strchr(csString, '{') || !strrchr(csString, '}')) | if (!strchr(csString, '{') || !strrchr(csString, '}')) { |
| memset(io_Error, 0, STRSIZ); |
| snprintf(io_Error, STRSIZ, "Error:: Invalid input string format ... " |
| "must be like {text[:[-]#[:#]]}"); |
| io_Errno = EINVAL; |
return NULL; |
return NULL; |
else { | } else { |
str = strdup(strchr(csString, '{') + 1); |
str = strdup(strchr(csString, '{') + 1); |
*strrchr(str, '}') = 0; |
*strrchr(str, '}') = 0; |
} |
} |