- introduced "stopexe run"

- fixed "task ps" to show names containing ':' correctly
This commit is contained in:
zolliker
2013-05-24 05:44:52 +00:00
parent f6a2b259ea
commit 8096212c52
3 changed files with 14 additions and 10 deletions

View File

@ -501,7 +501,10 @@ int StopExe(pExeList self, char *name)
self->iRun = 0;
return 1;
}
if (strcasecmp(name, "run") == 0) {
TaskSignalGroup(self->pTask, SICSINT, &interrupt, self->runID);
return 1;
}
TaskSignalGroup(self->pTask, SICSINT, &interrupt, self->waitID);
return 1;

6
task.c
View File

@ -508,15 +508,15 @@ char *TaskDescription(pTaskHead it)
}
memset(result,0,length*sizeof(char));
strcpy(result,it->name);
strcat(result,":");
strcat(result,"|");
length = strlen(result);
tm = localtime((const time_t *)&it->start_time);
strftime(result+length,100,"%F-%k-%m-%S",tm);
length = strlen(result);
snprintf(result+length,120-20,":%ld", it->lID);
snprintf(result+length,120-20,"|%ld", it->lID);
length = strlen(result);
snprintf(result+length,120-40,":%ld", it->groupID);
snprintf(result+length,120-40,"|%.0ld ", it->groupID);
return result;

View File

@ -20,7 +20,7 @@ static int ListCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
pHdb par[], int nPar)
{
pDynString result = NULL;
char buffer[256], *pDes, *pPtr, name[80], time[80],id[80];
char buffer[256], *pDes, *pPtr, name[80], time[80], id[80], gid[80];
pTaskHead it = NULL;
result = CreateDynString(128,128);
@ -35,11 +35,12 @@ static int ListCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
for(it = TaskIteratorStart(pServ->pTasker); it != NULL; it = TaskIteratorNext(it)){
pDes = TaskDescription(it);
if(pDes != NULL){
pPtr = stptok(pDes,name,sizeof(name),":");
pPtr = stptok(pPtr,time,sizeof(name),":");
pPtr = stptok(pPtr,id,sizeof(name),":");
snprintf(buffer,sizeof(buffer),"%20s %20s %12s",
name,time,id);
pPtr = stptok(pDes,name,sizeof(name),"|");
pPtr = stptok(pPtr,time,sizeof(time),"|");
pPtr = stptok(pPtr,id,sizeof(id),"|");
pPtr = stptok(pPtr,gid,sizeof(gid),"|");
snprintf(buffer,sizeof(buffer),"%20s %20s %12s %10s",
name,time,id,gid);
DynStringConcat(result,buffer);
DynStringConcatChar(result,'\n');
free(pDes);