version 1.78, 2015/01/05 15:32:25
|
version 1.105, 2022/09/07 13:40:42
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.20 |
RPL/2 (R) version 4.1.34 |
Copyright (C) 1989-2015 Dr. BERTRAND Joël |
Copyright (C) 1989-2021 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 131 reencodage(struct_processus *s_etat_proc
|
Line 131 reencodage(struct_processus *s_etat_proc
|
longueur_sortie = d_LONGUEUR; |
longueur_sortie = d_LONGUEUR; |
pointeur = buffer_sortie; |
pointeur = buffer_sortie; |
|
|
if ((ios = iconv(transcodage, (char **) &buffer_entree, |
if ((ios = iconv(transcodage, |
|
# if defined(Linux) |
|
(char **) |
|
# elif defined(NetBSD) |
|
(const char **) |
|
# else |
|
(char **) |
|
# endif |
|
&buffer_entree, |
&longueur_entree, (char **) &pointeur, &longueur_sortie)) |
&longueur_entree, (char **) &pointeur, &longueur_sortie)) |
== (size_t) -1) |
== (size_t) -1) |
{ |
{ |
Line 291 localisation_courante(struct_processus *
|
Line 299 localisation_courante(struct_processus *
|
|
|
verrouillage_threads_concurrents(s_etat_processus); |
verrouillage_threads_concurrents(s_etat_processus); |
pid = fork(); |
pid = fork(); |
deverrouillage_threads_concurrents(s_etat_processus); |
|
|
|
if (pid < 0) |
if (pid < 0) |
{ |
{ |
Line 419 localisation_courante(struct_processus *
|
Line 426 localisation_courante(struct_processus *
|
} |
} |
else |
else |
{ |
{ |
|
deverrouillage_threads_concurrents(s_etat_processus); |
|
|
if (close(pipes_entree[0]) != 0) |
if (close(pipes_entree[0]) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 464 localisation_courante(struct_processus *
|
Line 473 localisation_courante(struct_processus *
|
return; |
return; |
} |
} |
|
|
if (waitpid(pid, &status, 0) == -1) |
while(waitpid(pid, &status, 0) == -1) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
if (errno != EINTR) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
{ |
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; |
if (errno != EINTR) |
return; |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
} |
} |
} |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
|
} |
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
Line 690 transliterated_fprintf(struct_processus
|
Line 703 transliterated_fprintf(struct_processus
|
unsigned long i; |
unsigned long i; |
# endif |
# endif |
|
|
if (valsprintf(&tampon, format, arguments) < 0) |
if (valsprintf(s_etat_processus, &tampon, format, arguments) < 0) |
{ |
{ |
va_end(arguments); |
va_end(arguments); |
|
|
Line 789 transliterated_fprintf(struct_processus
|
Line 802 transliterated_fprintf(struct_processus
|
|
|
|
|
int |
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, |
tex_fprintf(struct_processus *s_etat_processus, |
file *flux, const char *format, ...) |
file *flux, const char *format, ...) |
{ |
{ |
Line 801 tex_fprintf(struct_processus *s_etat_pro
|
Line 830 tex_fprintf(struct_processus *s_etat_pro
|
|
|
va_start(arguments, format); |
va_start(arguments, format); |
|
|
if (valsprintf(&tampon, format, arguments) < 0) |
if (valsprintf(s_etat_processus, &tampon, format, arguments) < 0) |
{ |
{ |
va_end(arguments); |
va_end(arguments); |
|
|
Line 844 tex_fprintf(struct_processus *s_etat_pro
|
Line 873 tex_fprintf(struct_processus *s_etat_pro
|
#undef readline |
#undef readline |
|
|
unsigned char * |
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"); |
printf("\r"); |
|
# endif |
|
|
|
if (sys_chaine == NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
if ((rpl_chaine = malloc((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); |
} |
} |
|
|
|
|