Commit 2637bbcc authored by oharboe's avatar oharboe
Browse files

handle end of line comments to improve compatibility with event scripts

git-svn-id: svn://svn.berlios.de/openocd/trunk@860 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent be00c7d0
......@@ -71,19 +71,24 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
c = interp->cmdPrivData;
LOG_DEBUG("script_command - %s", c->name);
nwords = argc;
words = malloc(sizeof(char *) * nwords);
for (i = 0; i < nwords; i++)
words = malloc(sizeof(char *) * argc);
for (i = 0; i < argc; i++)
{
int len;
words[i] = strdup(Jim_GetString(argv[i], &len));
char *w=Jim_GetString(argv[i], &len);
if (*w=='#')
{
/* hit an end of line comment */
break;
}
words[i] = strdup(w);
if (words[i] == NULL)
{
return JIM_ERR;
}
LOG_DEBUG("script_command - %s, argv[%u]=%s", c->name, i, words[i]);
}
nwords = i;
/* grab the command context from the associated data */
context = Jim_GetAssocData(interp, "context");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment