- inserted command echo into exe manager

This commit is contained in:
zolliker
2005-03-30 14:27:44 +00:00
parent 6b745e8254
commit 3327c8d8bf
6 changed files with 55 additions and 13 deletions

View File

@ -147,11 +147,17 @@ static pDynString findBlockEnd(pExeBuf self){
}
/*---------------------------------------------------------------------*/
int exeBufProcess(pExeBuf self, SicsInterp *pSics,
SConnection *pCon, pICallBack pCall){
SConnection *pCon, pICallBack pCall, int echo){
pDynString command = NULL;
Tcl_Interp *pTcl = NULL;
int status;
static int weWantLogging = 1;
char *cmd;
char cmdName[128];
char *ende;
int l;
assert(self);
assert(pSics);
@ -162,9 +168,34 @@ int exeBufProcess(pExeBuf self, SicsInterp *pSics,
InvokeCallBack(pCall,BATCHSTART,self->name);
if (echo) {
SCsetMacro(pCon,0);
}
while((command = findBlockEnd(self)) != NULL){
InvokeCallBack(pCall,BATCHAREA,NULL);
status = Tcl_Eval(pTcl,GetCharArray(command));
cmd = GetCharArray(command);
if (echo) {
/* find first word */
while (*cmd == ' ') {
cmd++;
}
ende = cmd;
while (*ende > ' ') {
ende++;
}
l = ende - cmd;
if (l < sizeof cmdName) {
strncpy(cmdName, cmd, l);
cmdName[l] = '\0';
if (FindCommand(pSics, cmdName) != NULL) {
/* print only SICS commands */
SCPrintf(pCon, eValue, "%s:%d>> %s",self->name,self->lineno,cmd);
}
}
}
status = Tcl_Eval(pTcl,cmd);
if(status != TCL_OK){
if(pCon->sicsError == 0){
/*