- Introducted Arg2Tcl as a replacement for some calls to Arg2Text

- Fixed a memory leak
This commit is contained in:
zolliker
2006-04-11 07:26:55 +00:00
parent e25fb68080
commit da3dfd9d76
11 changed files with 184 additions and 92 deletions

View File

@@ -135,7 +135,7 @@ int TclIntAction(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]){
pTclInt self = NULL;
char pBuffer[1024];
char *cmd;
self = (pTclInt)pData;
assert(self);
@@ -159,11 +159,14 @@ int TclIntAction(SConnection *pCon, SicsInterp *pSics, void *pData,
SCSendOK(pCon);
return 1;
} else if(strcmp(argv[1],"backup") == 0){
Arg2Text(argc-2, &argv[2],pBuffer,1023);
if(self->fd != NULL){
fprintf(self->fd,"%s\n",pBuffer);
cmd = Arg2Tcl(argc-2, &argv[2],pBuffer,1023);
if (cmd) {
if(self->fd != NULL){
fprintf(self->fd,"%s\n",pBuffer);
}
if (cmd != pBuffer) free(cmd);
SCSendOK(pCon);
}
SCSendOK(pCon);
return 1;
} else {
sprintf(pBuffer,"ERROR: keyword %s to %s not recognized",