- inserted command echo into exe manager
This commit is contained in:
37
exebuf.c
37
exebuf.c
@ -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){
|
||||
/*
|
||||
|
Reference in New Issue
Block a user