| @@ -683,20 +683,20 @@ void pr_encours(void) | |||||
| void * fct_com(void * p) | void * fct_com(void * p) | ||||
| { | { | ||||
| int REQ=1; | int REQ=1; | ||||
| char *cmd = NULL, *fauth, com[100]; | |||||
| char *cmd = NULL, *fauth, pr[30], com[200]; | |||||
| int n2; | int n2; | ||||
| pid_t pid; | pid_t pid; | ||||
| fauth = (char*)p; | fauth = (char*)p; | ||||
| pid = getpid(); | pid = getpid(); | ||||
| read_history(FHISTO); | read_history(FHISTO); | ||||
| if (REPR) comsh("reset",0); | |||||
| while (REQ) { | while (REQ) { | ||||
| if (kill(pid,SIGUSR1) < 0) { /* verif processus acquisition */ | if (kill(pid,SIGUSR1) < 0) { /* verif processus acquisition */ | ||||
| ENDT=1; | ENDT=1; | ||||
| write(p1[1],"\n",1); | write(p1[1],"\n",1); | ||||
| } | } | ||||
| free(cmd); | free(cmd); | ||||
| cmd = readline("O-> "); | |||||
| sprintf(pr,"\e[01;34m%s-> \e[00m",NPROG); | |||||
| cmd = readline(pr); | |||||
| if ((n2 = strlen(cmd)) > 0) { | if ((n2 = strlen(cmd)) > 0) { | ||||
| write(p1[1],"\n",1); | write(p1[1],"\n",1); | ||||
| add_history(cmd); | add_history(cmd); | ||||
| @@ -887,6 +887,8 @@ pid_t pid; | |||||
| } | } | ||||
| WH=write_history(FHISTO); | WH=write_history(FHISTO); | ||||
| free(cmd); | free(cmd); | ||||
| sprintf(com,"rm -f .Trav%d",pid); | |||||
| comsh(com,0); | |||||
| /* fin dialogue */ | /* fin dialogue */ | ||||
| pthread_exit(NULL); | pthread_exit(NULL); | ||||
| } | } | ||||
| @@ -1169,15 +1171,18 @@ int Inter=0, i, ie, np=0, opt; | |||||
| close(p1[1]); | close(p1[1]); | ||||
| closelog(); | closelog(); | ||||
| if (ENDT) { /* relance auto */ | if (ENDT) { /* relance auto */ | ||||
| comsh("reset",0); | |||||
| if (T1) printf("Relance auto %s dans %d sec. ...\n",strPID, DELAYR); | if (T1) printf("Relance auto %s dans %d sec. ...\n",strPID, DELAYR); | ||||
| sleep(DELAYR); /* attend N s */ | sleep(DELAYR); /* attend N s */ | ||||
| NP = (char**)malloc((sizeof(Pars))*(N+3)); | NP = (char**)malloc((sizeof(Pars))*(N+3)); | ||||
| for (i=0;i<N;i++) NP[i] = P[i]; | |||||
| NP[i++]=strR; | |||||
| NP[i++]=strPID; | |||||
| ie=0; | |||||
| for (i=0;i<N;i++) { NP[i] = P[i]; if (strcmp(P[i],strR) == 0) ie=1; } | |||||
| if (ie == 0) { | |||||
| NP[i++]=strR; | |||||
| NP[i++]=strPID; | |||||
| } | |||||
| NP[i]=NULL; | NP[i]=NULL; | ||||
| if (WH) write_history(FHISTO); | if (WH) write_history(FHISTO); | ||||
| comsh("reset",0); | |||||
| execv(P[0],NP); | execv(P[0],NP); | ||||
| perror("execv"); | perror("execv"); | ||||
| } | } | ||||