version 1.2, 2019/07/18 10:50:24 |
version 1.3, 2019/07/19 16:00:08 |
|
|
char excbuf[BUFSIZE], argbuf[BUFSIZE], *contbuf, tmpbuf[BUFSIZE]; |
char excbuf[BUFSIZE], argbuf[BUFSIZE], *contbuf, tmpbuf[BUFSIZE]; |
char *cmdp, *argp, *fendp, *endp, *p, *t, *s = " "; |
char *cmdp, *argp, *fendp, *endp, *p, *t, *s = " "; |
int singlecmd = 0, spc, numparams, numspc; |
int singlecmd = 0, spc, numparams, numspc; |
int inlist, foundlst = 0, last, sizof; |
int inlist, foundlst = 0, eolst, rpar, sizof, fin; |
|
|
contbuf = NULL; |
contbuf = NULL; |
endp = strrchr(funstr, ')'); |
endp = strrchr(funstr, ')'); |
|
|
return (dobeep_msg("strlcpy error")); |
return (dobeep_msg("strlcpy error")); |
argp = argbuf; |
argp = argbuf; |
numspc = spc = 1; /* initially fake a space so we find first argument */ |
numspc = spc = 1; /* initially fake a space so we find first argument */ |
inlist = last = 0; |
inlist = eolst = fin = rpar = 0; |
|
|
for (p = argp; *p != '\0'; p++) { |
for (p = argp; fin == 0; p++) { |
#ifdef MGLOG |
#ifdef MGLOG |
mglog_execbuf("", excbuf, argbuf, argp, last, inlist, cmdp, |
mglog_execbuf("", excbuf, argbuf, argp, eolst, inlist, cmdp, |
p, contbuf); |
p, contbuf); |
#endif |
#endif |
if (foundlst) { |
if (foundlst) { |
foundlst = 0; |
foundlst = 0; |
p--; /* otherwise 1st arg is missed from list. */ |
p--; /* otherwise 1st arg is missed from list. */ |
} |
} |
if (*p == ' ' || *p == '\t' || *p == ')') { |
if (*p == ')') { |
|
rpar = 1; |
|
*p = '\0'; |
|
} |
|
if (*p == ' ' || *p == '\t' || *p == '\0') { |
if (spc == 1) |
if (spc == 1) |
continue; |
continue; |
if (spc == 0 && (numspc % numparams == 0)) { |
if (spc == 0 && (numspc % numparams == 0)) { |
if (*p == ')') |
if (*p == '\0') |
last = 1; |
eolst = 1; |
else |
else |
last = 0; |
eolst = 0; |
*p = '\0'; /* terminate arg string */ |
*p = '\0'; /* terminate arg string */ |
endp = p + 1; |
endp = p + 1; |
excbuf[0] = '\0'; |
excbuf[0] = '\0'; |
|
|
excline(excbuf); |
excline(excbuf); |
#ifdef MGLOG |
#ifdef MGLOG |
mglog_execbuf(" ", excbuf, argbuf, argp, |
mglog_execbuf(" ", excbuf, argbuf, argp, |
last, inlist, cmdp, p, contbuf); |
eolst, inlist, cmdp, p, contbuf); |
#endif |
#endif |
*p = ' '; /* so 'for' loop can continue */ |
*p = ' '; /* so 'for' loop can continue */ |
if (last) { |
if (eolst) { |
if (contbuf != NULL) { |
if (contbuf != NULL) { |
(void)strlcpy(argbuf, contbuf, |
(void)strlcpy(argbuf, contbuf, |
sizeof(argbuf)); |
sizeof(argbuf)); |
|
|
p = argp = argbuf; |
p = argp = argbuf; |
foundlst = 1; |
foundlst = 1; |
inlist = 0; |
inlist = 0; |
|
if (rpar) |
|
fin = 1; |
continue; |
continue; |
} |
} |
spc = 1; |
spc = 1; |
inlist = 0; |
inlist = 0; |
} |
} |
|
if (eolst && rpar) |
|
fin = 1; |
} |
} |
numspc++; |
numspc++; |
spc = 1; |
spc = 1; |
|
|
{ |
{ |
struct varentry *vt, *v1 = NULL; |
struct varentry *vt, *v1 = NULL; |
const char e[1] = "e", t[1] = "t"; |
const char e[1] = "e", t[1] = "t"; |
char *p, *vnamep, *vendp = NULL, *valp; |
char *p, *vnamep, *vendp = NULL, *valp, *o; |
int spc; |
int spc; |
|
|
|
|
|
|
return(dobeep_msg("strndup error")); |
return(dobeep_msg("strndup error")); |
v1->count = 0; |
v1->count = 0; |
vendp = NULL; |
vendp = NULL; |
|
|
/* initially fake a space so we find first value */ |
/* initially fake a space so we find first value */ |
spc = 1; |
spc = 1; |
/* now loop through values in list value string while counting them */ |
/* now loop through values in list value string while counting them */ |
|
|
vendp = p; |
vendp = p; |
spc = 1; |
spc = 1; |
} else if (*p == ')') { |
} else if (*p == ')') { |
vendp = ++p; /* currently need ')' */ |
o = p - 1; |
|
if (*o != ' ' && *o != '\t') |
|
vendp = p; |
break; |
break; |
} else { |
} else { |
if (spc == 1) |
if (spc == 1) |