Diff for /rpl/src/transliteration.c between versions 1.14 and 1.20

version 1.14, 2010/08/06 15:26:51 version 1.20, 2010/08/26 19:07:42
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.0.18    RPL/2 (R) version 4.0.19
   Copyright (C) 1989-2010 Dr. BERTRAND Joël    Copyright (C) 1989-2010 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
Line 158  reencodage(struct_processus *s_etat_proc Line 158  reencodage(struct_processus *s_etat_proc
 ================================================================================  ================================================================================
   Entrées :    Entrées :
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
   Sorties :  
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
     iorties :
   Effets de bord : néant    Effets de bord : néant
 ================================================================================  ================================================================================
 */  */
Line 461  localisation_courante(struct_processus * Line 461  localisation_courante(struct_processus *
             return;              return;
         }          }
   
           tampon[0] = d_code_fin_chaine;
   
 #       ifndef SEMAPHORES_NOMMES  #       ifndef SEMAPHORES_NOMMES
         if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)          if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
 #       else  #       else
Line 545  localisation_courante(struct_processus * Line 547  localisation_courante(struct_processus *
             return;              return;
         }          }
   
         (*s_etat_processus).localisation = tampon;          if (strlen(tampon) > 0)
           {
               (*s_etat_processus).localisation = tampon;
           }
           else
           {
               free(tampon);
   
               if (((*s_etat_processus).localisation = malloc((strlen(d_locale)
                       + 1) * sizeof(unsigned char))) == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_processus;
                   return;
               }
   
               strcpy((*s_etat_processus).localisation, d_locale);
           }
   
         if (sigaction(SIGINT, &action_passee, NULL) != 0)          if (sigaction(SIGINT, &action_passee, NULL) != 0)
         {          {
Line 580  localisation_courante(struct_processus * Line 598  localisation_courante(struct_processus *
         {          {
             // Le processus fils renvoie une erreur.              // Le processus fils renvoie une erreur.
   
 #           ifndef SEMAPHORES_NOMMES              free(tampon);
             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  
 #           else              if (((*s_etat_processus).localisation = malloc((strlen(d_locale)
             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)                      + 1) * sizeof(unsigned char))) == NULL)
 #           endif  
             {              {
                 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_execution = d_ex_erreur_processus;              strcpy((*s_etat_processus).localisation, d_locale);
             return;  
         }          }
   
 #       ifndef SEMAPHORES_NOMMES  #       ifndef SEMAPHORES_NOMMES
Line 634  transliterated_fprintf(struct_processus Line 647  transliterated_fprintf(struct_processus
   
     va_start(arguments, format);      va_start(arguments, format);
   
   #   ifdef OS2
       unsigned char       *ptr_e;;
       unsigned char       *ptr_l;;
       unsigned char       *tampon3;
   
       unsigned long       i;
   #   endif
   
     if (valsprintf(&tampon, format, arguments) < 0)      if (valsprintf(&tampon, format, arguments) < 0)
     {      {
         va_end(arguments);          va_end(arguments);
Line 664  transliterated_fprintf(struct_processus Line 685  transliterated_fprintf(struct_processus
         tampon2 = tampon;          tampon2 = tampon;
     }      }
   
   #   ifdef OS2
       i = 0;
       ptr_l = tampon2;
   
       while((*ptr_l) != d_code_fin_chaine)
       {
           if ((*ptr_l) == '\n')
           {
               i++;
           }
   
           ptr_l++;
       }
   
       if ((tampon3 = malloc((strlen(tampon2) + i + 1) * sizeof(unsigned char)))
               == NULL)
       {
           (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
           return(NULL);
       }
   
       ptr_e = tampon3;
       ptr_l = tampon2;
   
       while((*ptr_l) != d_code_fin_chaine)
       {
           (*ptr_e) = (*ptr_l);
   
           if ((*ptr_l) == '\n')
           {
               (*(++ptr_e)) = '\r';
               ptr_e++;
               ptr_l++;
           }
           else
           {
               ptr_e++;
               ptr_l++;
           }
       }
   
       (*ptr_e) = d_code_fin_chaine;
   
       free(tampon2);
       tampon2 = tampon3;
   #   endif
   
 #   ifdef SunOS  #   ifdef SunOS
     while((ios = fprintf(flux, "%s", tampon2)) < 0)      while((ios = fprintf(flux, "%s", tampon2)) < 0)
     {      {
Line 735  tex_fprintf(struct_processus *s_etat_pro Line 803  tex_fprintf(struct_processus *s_etat_pro
     return(ios);      return(ios);
 }  }
   
   
   unsigned char *
   readline_wrapper(unsigned char *invite)
   {
       unsigned char       *chaine;
       unsigned char       *i;
   
       chaine = readline(invite);
       printf("\r");
   
       return(chaine);
   }
   
   
 #define fprintf NULL  #define fprintf NULL
 #define printf NULL  #define printf NULL
   

Removed from v.1.14  
changed lines
  Added in v.1.20


CVSweb interface <joel.bertrand@systella.fr>