Przeglądaj źródła

Version 1.01

master
Patrick Foubet 6 miesięcy temu
rodzic
commit
6e3000fc4b
1 zmienionych plików z 12 dodań i 7 usunięć
  1. +12
    -7
      octave.c

+ 12
- 7
octave.c Wyświetl plik

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


Ładowanie…
Anuluj
Zapisz