- use Tcl library for splitting and merging argument lists
This commit is contained in:
20
SCinter.c
20
SCinter.c
@ -293,7 +293,6 @@ int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
|
||||
commandContext comCon;
|
||||
Statistics *old;
|
||||
|
||||
|
||||
assert(self);
|
||||
assert(pCon);
|
||||
|
||||
@ -312,9 +311,12 @@ int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
|
||||
}
|
||||
|
||||
/* convert to argc, argv */
|
||||
argc = 0;
|
||||
argv = NULL;
|
||||
Text2Arg(pText, &argc, &argv);
|
||||
/* use Tcl_SplitList instead of Text2Arg, is needed for complicated Tcl syntax. M.Z. 8.2011 */
|
||||
iRet = Tcl_SplitList(self->pTcl, pText, &argc, (const char ***)&argv);
|
||||
if (iRet != TCL_OK) {
|
||||
SCWrite(pCon, "ERROR: illegal tcl syntax", eError);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* the first one must be the target object. If not given an empty
|
||||
command string was given which will be silently ignored */
|
||||
@ -364,15 +366,7 @@ int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
|
||||
|
||||
|
||||
deleteArgv:
|
||||
if (argv) {
|
||||
/* delete argv */
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (argv[i] != NULL) {
|
||||
free(argv[i]);
|
||||
}
|
||||
}
|
||||
free(argv);
|
||||
}
|
||||
Tcl_Free((char *)argv);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user