--- rpl/src/transliteration.c 2014/04/25 07:37:35 1.75 +++ rpl/src/transliteration.c 2019/02/03 14:41:31 1.98 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.18 - Copyright (C) 1989-2014 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.31 + Copyright (C) 1989-2019 Dr. BERTRAND Joël This file is part of RPL/2. @@ -291,7 +291,6 @@ localisation_courante(struct_processus * verrouillage_threads_concurrents(s_etat_processus); pid = fork(); - deverrouillage_threads_concurrents(s_etat_processus); if (pid < 0) { @@ -419,6 +418,8 @@ localisation_courante(struct_processus * } else { + deverrouillage_threads_concurrents(s_etat_processus); + if (close(pipes_entree[0]) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; @@ -464,23 +465,27 @@ localisation_courante(struct_processus * return; } - if (waitpid(pid, &status, 0) == -1) + while(waitpid(pid, &status, 0) == -1) { -# ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) -# else - while(sem_wait((*s_etat_processus).semaphore_fork) != 0) -# endif + if (errno != EINTR) { - if (errno != EINTR) +# ifndef SEMAPHORES_NOMMES + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) +# else + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) +# endif { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; + if (errno != EINTR) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } } - } - (*s_etat_processus).erreur_systeme = d_es_processus; - return; + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } } # ifndef SEMAPHORES_NOMMES @@ -690,7 +695,7 @@ transliterated_fprintf(struct_processus unsigned long i; # endif - if (valsprintf(&tampon, format, arguments) < 0) + if (valsprintf(s_etat_processus, &tampon, format, arguments) < 0) { va_end(arguments); @@ -789,6 +794,22 @@ transliterated_fprintf(struct_processus int +std_fprintf(file *flux, const char *format, ...) +{ + int ios; + + va_list arguments; + + va_start(arguments, format); + ios = vfprintf(flux, format, arguments); + va_end(arguments); + + // Pas de parenthèses pour ne pas appeler la macro. + return ios; +} + + +int tex_fprintf(struct_processus *s_etat_processus, file *flux, const char *format, ...) { @@ -801,7 +822,7 @@ tex_fprintf(struct_processus *s_etat_pro va_start(arguments, format); - if (valsprintf(&tampon, format, arguments) < 0) + if (valsprintf(s_etat_processus, &tampon, format, arguments) < 0) { va_end(arguments); @@ -844,14 +865,35 @@ tex_fprintf(struct_processus *s_etat_pro #undef readline unsigned char * -readline_wrapper(unsigned char *invite) +readline_wrapper(struct_processus *s_etat_processus, unsigned char *invite) { - unsigned char *chaine; + unsigned char *rpl_chaine; + unsigned char *sys_chaine; + + association_etat_processus_readline(s_etat_processus); + sys_chaine = readline(invite); - chaine = readline(invite); +# ifdef OS2 printf("\r"); +# endif + + if (sys_chaine == NULL) + { + return(NULL); + } + + if ((rpl_chaine = rpl_malloc(s_etat_processus, (strlen(sys_chaine) + 1) * + sizeof(unsigned char *))) == NULL) + { + sys_free(sys_chaine); + (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; + return(NULL); + } + + strcpy(rpl_chaine, sys_chaine); + sys_free(sys_chaine); - return(chaine); + return(rpl_chaine); }