- strcat(items, " ");
- start = items;
- initial_len = strlen(items);
- for (i=0; i<initial_len; ++i) {
- if (items[i]=='(') ++nest;
- if (items[i]=='[') ++nest;
- if (items[i]=='<') ++nest;
- if (items[i]=='{') ++nest;
- if (items[i]==')') --nest;
- if (items[i]==']') --nest;
- if (items[i]=='>') --nest;
- if (items[i]=='}') --nest;
-
- if (nest <= 0) if (items[i]==' ') {
- items[i] = 0;
- argv[num_items++] = start;
- start = &items[i+1];
+ nArgs = StrLength(Cmd->CmdBuf) / 10 + 10;
+ nArgs = CmdAdjust(Cmd, nArgs, 0);
+ initial_len = StrLength(Cmd->CmdBuf);
+ Cmd->num_parms = 0;
+ Cmd->Params[Cmd->num_parms].Key = pch = ChrPtr(Cmd->CmdBuf);
+ end = Cmd->Params[Cmd->num_parms].Key + StrLength(Cmd->CmdBuf);
+
+ while (pch < end)
+ {
+ if ((*pch=='(') ||
+ (*pch=='[') ||
+ (*pch=='<') ||
+ (*pch=='{'))
+ ++nest;
+
+ else if ((*pch==')') ||
+ (*pch==']') ||
+ (*pch=='>') ||
+ (*pch=='}'))
+ --nest;
+
+ if ((nest <= 0) && (*pch==' ')) {
+ StrBufPeek(Cmd->CmdBuf, pch, 0, '\0');
+ Cmd->Params[Cmd->num_parms].len =
+ pch - Cmd->Params[Cmd->num_parms].Key;
+
+ if (Cmd->num_parms + 1 >= Cmd->avail_parms) {
+ nArgs = CmdAdjust(Cmd, nArgs * 2, 1);
+ }
+ Cmd->num_parms++;
+ Cmd->Params[Cmd->num_parms].Key = ++pch;