File:  [local] / rpl / src / rpl.c
Revision 1.127: download - view: text, annotated - select for diffs - revision graph
Mon Dec 17 21:22:44 2012 UTC (11 years, 4 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Série de patches pour les variables partagées. Les patches ne provoquent pas
de segfault, mais n'ont pas encore été testés sur des variables partagées.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.1.11
    4:   Copyright (C) 1989-2012 Dr. BERTRAND Joël
    5: 
    6:   This file is part of RPL/2.
    7: 
    8:   RPL/2 is free software; you can redistribute it and/or modify it
    9:   under the terms of the CeCILL V2 License as published by the french
   10:   CEA, CNRS and INRIA.
   11:  
   12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
   13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
   15:   for more details.
   16:  
   17:   You should have received a copy of the CeCILL License
   18:   along with RPL/2. If not, write to info@cecill.info.
   19: ================================================================================
   20: */
   21: 
   22: 
   23: #define  MAIN_RPL
   24: #include "rpl-conv.h"
   25: 
   26: 
   27: /*
   28: ================================================================================
   29:   Programme principal
   30: ================================================================================
   31: */
   32: 
   33: int
   34: rplinit(int argc, char *argv[], char *envp[],
   35:         unsigned char ***resultats, char *rpl_home)
   36: {
   37: #   include                             "copyright-conv.h"
   38: #   include                             "licence-conv.h"
   39: 
   40:     char                                **arg_exec;
   41: 
   42: #   ifdef HAVE_STACK_OVERFLOW_RECOVERY
   43:     char                                pile_signaux[SIGSTKSZ];
   44: #   endif
   45: 
   46: #   define RPL_PATH_MAX                 1024
   47:     char                                repertoire_initial[RPL_PATH_MAX];
   48: 
   49:     file                                *f_source;
   50: 
   51:     int                                 erreur_historique;
   52:     int                                 option_P;
   53: 
   54:     logical1                            core;
   55:     logical1                            debug;
   56:     logical1                            erreur_fichier;
   57:     logical1                            existence;
   58:     logical1                            mode_interactif;
   59:     logical1                            option_a;
   60:     logical1                            option_A;
   61:     logical1                            option_c;
   62:     logical1                            option_d;
   63:     logical1                            option_D;
   64:     logical1                            option_h;
   65:     logical1                            option_i;
   66:     logical1                            option_l;
   67:     logical1                            option_n;
   68:     logical1                            option_p;
   69:     logical1                            option_s;
   70:     logical1                            option_S;
   71:     logical1                            option_t;
   72:     logical1                            option_v;
   73:     logical1                            ouverture;
   74: 
   75:     pthread_mutexattr_t                 attributs_mutex;
   76: 
   77:     ssize_t                             longueur_ecriture;
   78: 
   79:     struct_objet                        *s_objet;
   80: 
   81:     struct_processus                    *s_etat_processus;
   82: 
   83:     struct_liste_variables_partagees    *l_element_partage_courant;
   84:     struct_liste_variables_partagees    *l_element_partage_suivant;
   85: 
   86:     struct_liste_variables_statiques    *l_element_statique_courant;
   87:     struct_liste_variables_statiques    *l_element_statique_suivant;
   88: 
   89:     struct_arbre_variables_partagees    *s_arbre_variables_partagees;
   90:     struct_liste_variables_partagees    *l_liste_variables_partagees;
   91: 
   92:     struct sigaction                    action;
   93:     struct sigaction                    registre;
   94: 
   95:     struct timespec                     attente;
   96: 
   97:     unsigned char                       *arguments;
   98:     unsigned char                       drapeau_encart;
   99:     unsigned char                       *type_debug;
  100:     unsigned char                       *home;
  101:     unsigned char                       *langue;
  102:     unsigned char                       *message;
  103:     unsigned char                       *nom_fichier_temporaire;
  104:     unsigned char                       option;
  105:     unsigned char                       presence_definition;
  106:     unsigned char                       *ptr;
  107:     unsigned char                       *tampon;
  108: 
  109:     unsigned long                       i;
  110:     unsigned long                       unite_fichier;
  111: 
  112:     void                                *l_element_courant;
  113:     void                                *l_element_suivant;
  114: 
  115:     volatile int                        erreur;
  116:     volatile unsigned char              traitement_fichier_temporaire;
  117: 
  118:     errno = 0;
  119:     s_queue_signaux = NULL;
  120:     routine_recursive = 0;
  121:     pid_processus_pere = getpid();
  122: 
  123: #   ifdef DEBUG_MEMOIRE
  124:     debug_memoire_initialisation();
  125: #   endif
  126: 
  127:     setvbuf(stdout, NULL, _IOLBF, 0);
  128:     setvbuf(stderr, NULL, _IOLBF, 0);
  129: 
  130: #   ifndef SEMAPHORES_NOMMES
  131:     sem_init(&semaphore_gestionnaires_signaux, 0, 0);
  132: #   else
  133:     semaphore_gestionnaires_signaux = sem_init2(0, getpid(), SEM_SIGNAUX);
  134:     
  135:     if (semaphore_gestionnaires_signaux == SEM_FAILED)
  136:     {
  137:         erreur = d_es_allocation_memoire;
  138: 
  139:         if ((langue = getenv("LANG")) != NULL)
  140:         {
  141:             if (strncmp(langue, "fr", 2) == 0)
  142:             {
  143:                 uprintf("+++Système : Mémoire insuffisante\n");
  144:             }
  145:             else
  146:             {
  147:                 uprintf("+++System : Not enough memory\n");
  148:             }
  149:         }
  150:         else
  151:         {
  152:             uprintf("+++System : Not enough memory\n");
  153:         }
  154: 
  155:         return(EXIT_FAILURE);
  156:     }
  157: #   endif
  158: 
  159:     if ((s_etat_processus = malloc(sizeof(struct_processus))) == NULL)
  160:     {
  161: #       ifndef SEMAPHORES_NOMMES
  162:         sem_post(&semaphore_gestionnaires_signaux);
  163:         sem_destroy(&semaphore_gestionnaires_signaux);
  164: #       else
  165:         sem_post(semaphore_gestionnaires_signaux);
  166:         sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
  167: #       endif
  168: 
  169:         erreur = d_es_allocation_memoire;
  170: 
  171:         if ((langue = getenv("LANG")) != NULL)
  172:         {
  173:             if (strncmp(langue, "fr", 2) == 0)
  174:             {
  175:                 uprintf("+++Système : Mémoire insuffisante\n");
  176:             }
  177:             else
  178:             {
  179:                 uprintf("+++System : Not enough memory\n");
  180:             }
  181:         }
  182:         else
  183:         {
  184:             uprintf("+++System : Not enough memory\n");
  185:         }
  186: 
  187:         return(EXIT_FAILURE);
  188:     }
  189: 
  190:     if ((langue = getenv("LANG")) != NULL)
  191:     {
  192:         (*s_etat_processus).langue = (strncmp(langue, "fr", 2) == 0)
  193:                 ? 'F' : 'E';
  194:     }
  195:     else
  196:     {
  197:         (*s_etat_processus).langue = 'E';
  198:     }
  199: 
  200:     if (getcwd(repertoire_initial, RPL_PATH_MAX) == NULL)
  201:     {
  202: #       ifndef SEMAPHORES_NOMMES
  203:         sem_post(&semaphore_gestionnaires_signaux);
  204:         sem_destroy(&semaphore_gestionnaires_signaux);
  205: #       else
  206:         sem_post(semaphore_gestionnaires_signaux);
  207:         sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
  208: #       endif
  209: 
  210:         if ((*s_etat_processus).langue == 'F')
  211:         {
  212:             uprintf("+++Système : Mémoire insuffisante\n");
  213:         }
  214:         else
  215:         {
  216:             uprintf("+++System : Not enough memory\n");
  217:         }
  218: 
  219:         return(EXIT_FAILURE);
  220:     }
  221: 
  222:     if ((arg_exec = malloc((argc + 1) * sizeof(char *))) == NULL)
  223:     {
  224: #       ifndef SEMAPHORES_NOMMES
  225:         sem_post(&semaphore_gestionnaires_signaux);
  226:         sem_destroy(&semaphore_gestionnaires_signaux);
  227: #       else
  228:         sem_post(semaphore_gestionnaires_signaux);
  229:         sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
  230: #       endif
  231: 
  232:         if ((*s_etat_processus).langue == 'F')
  233:         {
  234:             uprintf("+++Système : Mémoire insuffisante\n");
  235:         }
  236:         else
  237:         {
  238:             uprintf("+++System : Not enough memory\n");
  239:         }
  240: 
  241:         return(EXIT_FAILURE);
  242:     }
  243: 
  244:     for(i = 0; i < (unsigned long) argc; i++)
  245:     {
  246:         arg_exec[i] = argv[i];
  247:     }
  248: 
  249:     argv[argc] = NULL;
  250: 
  251:     initialisation_contexte_cas(s_etat_processus);
  252: 
  253:     (*s_etat_processus).exception = d_ep;
  254:     (*s_etat_processus).erreur_systeme = d_es;
  255:     (*s_etat_processus).erreur_execution = d_ex;
  256: 
  257:     (*s_etat_processus).requete_redemarrage = d_faux;
  258:     (*s_etat_processus).rpl_home = rpl_home;
  259: 
  260:     pthread_mutexattr_init(&attributs_mutex);
  261:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
  262:     pthread_mutex_init(&((*s_etat_processus).mutex), &attributs_mutex);
  263:     pthread_mutexattr_destroy(&attributs_mutex);
  264: 
  265:     pthread_mutexattr_init(&attributs_mutex);
  266:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
  267:     pthread_mutex_init(&((*s_etat_processus).mutex_allocation),
  268:             &attributs_mutex);
  269:     pthread_mutexattr_destroy(&attributs_mutex);
  270: 
  271:     pthread_mutexattr_init(&attributs_mutex);
  272:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE);
  273:     pthread_mutex_init(&mutex_sections_critiques, &attributs_mutex);
  274:     pthread_mutexattr_destroy(&attributs_mutex);
  275: 
  276: #   ifndef SEMAPHORES_NOMMES
  277:         sem_init(&((*s_etat_processus).semaphore_fork), 0, 0);
  278: #   else
  279:         if (((*s_etat_processus).semaphore_fork = sem_init3(0, getpid(),
  280:                 pthread_self(), SEM_FORK)) == SEM_FAILED)
  281:         {
  282: #           ifndef SEMAPHORES_NOMMES
  283:                 sem_post(&semaphore_gestionnaires_signaux);
  284:                 sem_destroy(&semaphore_gestionnaires_signaux);
  285: #           else
  286:                 sem_post(semaphore_gestionnaires_signaux);
  287:                 sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  288:                         SEM_SIGNAUX);
  289: #           endif
  290: 
  291:             liberation(contexte_cas(s_etat_processus);
  292: 
  293:             if ((*s_etat_processus).langue == 'F')
  294:             {
  295:                 uprintf("+++Système : Mémoire insuffisante\n");
  296:             }
  297:             else
  298:             {
  299:                 uprintf("+++System : Not enough memory\n");
  300:             }
  301: 
  302:             return(EXIT_FAILURE);
  303:         }
  304: #   endif
  305: 
  306:     pthread_mutexattr_init(&attributs_mutex);
  307:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
  308:     pthread_mutex_init(&((*s_etat_processus).protection_liste_mutexes),
  309:             &attributs_mutex);
  310:     pthread_mutexattr_destroy(&attributs_mutex);
  311: 
  312:     (*s_etat_processus).chemin_fichiers_temporaires =
  313:             recherche_chemin_fichiers_temporaires(s_etat_processus);
  314: 
  315:     insertion_thread(s_etat_processus, d_vrai);
  316:     creation_queue_signaux(s_etat_processus);
  317: 
  318:     if ((*s_etat_processus).erreur_systeme != d_es)
  319:     {
  320: #       ifndef SEMAPHORES_NOMMES
  321:             sem_post(&((*s_etat_processus).semaphore_fork));
  322:             sem_post(&semaphore_gestionnaires_signaux);
  323:             sem_destroy(&semaphore_gestionnaires_signaux);
  324:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  325: #       else
  326:             sem_post((*s_etat_processus).semaphore_fork);
  327:             sem_post(semaphore_gestionnaires_signaux);
  328:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  329:                     SEM_SIGNAUX);
  330:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  331:                     pthread_self(), SEM_FORK);
  332: #       endif
  333: 
  334:         liberation_contexte_cas(s_etat_processus);
  335: 
  336:         if ((*s_etat_processus).langue == 'F')
  337:         {
  338:             uprintf("+++Système : Mémoire insuffisante\n");
  339:         }
  340:         else
  341:         {
  342:             uprintf("+++System : Not enough memory\n");
  343:         }
  344: 
  345:         return(EXIT_FAILURE);
  346:     }
  347: 
  348:     if (d_forced_locale == 0)
  349:     {
  350:         localisation_courante(s_etat_processus);
  351:     }
  352:     else
  353:     {
  354: #       ifndef SEMAPHORES_NOMMES
  355:             sem_post(&((*s_etat_processus).semaphore_fork));
  356:             sem_post(&semaphore_gestionnaires_signaux);
  357:             sem_destroy(&semaphore_gestionnaires_signaux);
  358:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  359: #       else
  360:             sem_post((*s_etat_processus).semaphore_fork);
  361:             sem_post(semaphore_gestionnaires_signaux);
  362:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  363:                     SEM_SIGNAUX);
  364:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  365:                     pthread_self(), SEM_FORK);
  366: #       endif
  367: 
  368:         liberation_contexte_cas(s_etat_processus);
  369:         liberation_queue_signaux(s_etat_processus);
  370: 
  371:         if (((*s_etat_processus).localisation = malloc((strlen(d_locale)
  372:                 + 1) * sizeof(unsigned char))) == NULL)
  373:         {
  374:             if ((*s_etat_processus).langue == 'F')
  375:             {
  376:                 uprintf("+++Système : Mémoire insuffisante\n");
  377:             }
  378:             else
  379:             {
  380:                 uprintf("+++System : Not enough memory\n");
  381:             }
  382: 
  383:             return(EXIT_FAILURE);
  384:         }
  385: 
  386:         strcpy((*s_etat_processus).localisation, d_locale);
  387:     }
  388: 
  389:     (*s_etat_processus).erreur_systeme = d_es;
  390: 
  391:     if ((*s_etat_processus).localisation == NULL)
  392:     {
  393:         if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + 1) *
  394:                 sizeof(unsigned char))) == NULL)
  395:         {
  396: #           ifndef SEMAPHORES_NOMMES
  397:                 sem_post(&((*s_etat_processus).semaphore_fork));
  398:                 sem_post(&semaphore_gestionnaires_signaux);
  399:                 sem_destroy(&semaphore_gestionnaires_signaux);
  400:                 sem_destroy(&((*s_etat_processus).semaphore_fork));
  401: #           else
  402:                 sem_post((*s_etat_processus).semaphore_fork);
  403:                 sem_post(semaphore_gestionnaires_signaux);
  404:                 sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  405:                         SEM_SIGNAUX);
  406:                 sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  407:                         pthread_self(), SEM_FORK);
  408: #           endif
  409: 
  410:             liberation_contexte_cas(s_etat_processus);
  411:             liberation_queue_signaux(s_etat_processus);
  412: 
  413:             if ((*s_etat_processus).langue == 'F')
  414:             {
  415:                 uprintf("+++Système : Mémoire insuffisante\n");
  416:             }
  417:             else
  418:             {
  419:                 uprintf("+++System : Not enough memory\n");
  420:             }
  421: 
  422:             return(EXIT_FAILURE);
  423:         }
  424: 
  425:         strcpy((*s_etat_processus).localisation, d_locale);
  426:     }
  427: 
  428:     printf("+++RPL/2 (R) version %s (%s)\n", d_version_rpl,
  429:             ((*s_etat_processus).langue == 'F') ? d_date_rpl : d_date_en_rpl);
  430: 
  431:     if ((*s_etat_processus).langue == 'F')
  432:     {
  433:         printf("+++Copyright (C) 1989 à 2011, 2012 BERTRAND Joël\n");
  434:     }
  435:     else
  436:     {
  437:         printf("+++Copyright (C) 1989 to 2011, 2012 BERTRAND Joel\n");
  438:     }
  439: 
  440:     if (getenv("HOME") != NULL)
  441:     {
  442:         home = getenv("HOME");
  443:     }
  444:     else if ((getenv("USER") != NULL) && (getpwnam(getenv("USER")) != NULL))
  445:     {
  446:         home = getpwnam(getenv("USER"))->pw_dir;
  447:     }
  448:     else if ((getenv("LOGNAME") != NULL) && (getpwnam(getenv("LOGNAME"))
  449:             != NULL))
  450:     {
  451:         home = getpwnam(getenv("LOGNAME"))->pw_dir;
  452:     }
  453:     else if ((getuid() != ((uid_t) -1)) && (getpwuid(getuid()) != NULL))
  454:     {
  455:         home = getpwuid(getuid())->pw_dir;
  456:     }
  457:     else
  458:     {
  459:         home = "";
  460:     }
  461: 
  462: #   ifdef HAVE_STACK_OVERFLOW_RECOVERY
  463:         if (stackoverflow_install_handler(interruption_depassement_pile,
  464:                 pile_signaux, sizeof(pile_signaux)) != 0)
  465:         {
  466: #           ifndef SEMAPHORES_NOMMES
  467:                 sem_post(&((*s_etat_processus).semaphore_fork));
  468:                 sem_post(&semaphore_gestionnaires_signaux);
  469:                 sem_destroy(&semaphore_gestionnaires_signaux);
  470:                 sem_destroy(&((*s_etat_processus).semaphore_fork));
  471: #           else
  472:                 sem_post((*s_etat_processus).semaphore_fork);
  473:                 sem_post(semaphore_gestionnaires_signaux);
  474:                 sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  475:                         SEM_SIGNAUX);
  476:                 sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  477:                         pthread_self(), SEM_FORK);
  478: #           endif
  479: 
  480:             liberation_contexte_cas(s_etat_processus);
  481:             liberation_queue_signaux(s_etat_processus);
  482: 
  483:             erreur = d_es_signal;
  484: 
  485:             if ((*s_etat_processus).langue == 'F')
  486:             {
  487:                 printf("+++Système : Initialisation de la pile alternative "
  488:                         "impossible\n");
  489:             }
  490:             else
  491:             {
  492:                 printf("+++System : Initialization of alternate "
  493:                         "stack failed\n");
  494:             }
  495: 
  496:             return(EXIT_FAILURE);
  497:         }
  498: #   else
  499:         if ((*s_etat_processus).langue == 'F')
  500:         {
  501:             printf("+++Attention : Le système ne supporte pas de pile "
  502:                     "alternative\n");
  503:         }
  504:         else
  505:         {
  506:             printf("+++Warning : Operating system does not support alternate "
  507:                     "stack\n");
  508:         }
  509: #   endif
  510: 
  511:     if (lancement_thread_signaux(s_etat_processus) != d_absence_erreur)
  512:     {
  513: #       ifndef SEMAPHORES_NOMMES
  514:             sem_post(&((*s_etat_processus).semaphore_fork));
  515:             sem_post(&semaphore_gestionnaires_signaux);
  516:             sem_destroy(&semaphore_gestionnaires_signaux);
  517:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  518: #       else
  519:             sem_post((*s_etat_processus).semaphore_fork);
  520:             sem_post(semaphore_gestionnaires_signaux);
  521:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  522:                     SEM_SIGNAUX);
  523:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  524:                     pthread_self(), SEM_FORK);
  525: #       endif
  526: 
  527:         liberation_contexte_cas(s_etat_processus);
  528:         liberation_queue_signaux(s_etat_processus);
  529: 
  530: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  531:             stackoverflow_deinstall_handler();
  532: #       endif
  533: 
  534:         erreur = d_es_signal;
  535: 
  536:         if ((*s_etat_processus).langue == 'F')
  537:         {
  538:             printf("+++Système : Initialisation des signaux POSIX "
  539:                     "impossible\n");
  540:         }
  541:         else
  542:         {
  543:             printf("+++System : Initialization of POSIX signals failed\n");
  544:         }
  545: 
  546:         return(EXIT_FAILURE);
  547:     }
  548: 
  549:     action.sa_handler = interruption1;
  550:     action.sa_flags = 0;
  551: 
  552:     if (sigaction(SIGINT, &action, NULL) != 0)
  553:     {
  554: #       ifndef SEMAPHORES_NOMMES
  555:             sem_post(&((*s_etat_processus).semaphore_fork));
  556:             sem_post(&semaphore_gestionnaires_signaux);
  557:             sem_destroy(&semaphore_gestionnaires_signaux);
  558:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  559: #       else
  560:             sem_post((*s_etat_processus).semaphore_fork);
  561:             sem_post(semaphore_gestionnaires_signaux);
  562:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  563:                     SEM_SIGNAUX);
  564:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  565:                     pthread_self(), SEM_FORK);
  566: #       endif
  567: 
  568:         liberation_contexte_cas(s_etat_processus);
  569:         liberation_queue_signaux(s_etat_processus);
  570: 
  571: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  572:             stackoverflow_deinstall_handler();
  573: #       endif
  574: 
  575:         erreur = d_es_signal;
  576: 
  577:         if ((*s_etat_processus).langue == 'F')
  578:         {
  579:             printf("+++Système : Initialisation des signaux POSIX "
  580:                     "impossible\n");
  581:         }
  582:         else
  583:         {
  584:             printf("+++System : Initialization of POSIX signals failed\n");
  585:         }
  586: 
  587:         return(EXIT_FAILURE);
  588:     }
  589: 
  590:     signal_test = SIGTEST;
  591:     kill(getpid(), SIGINT);
  592: 
  593:     attente.tv_sec = 0;
  594:     attente.tv_nsec = 1000000;
  595: 
  596:     for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
  597:     {
  598:         nanosleep(&attente, NULL);
  599:     }
  600: 
  601:     if (signal_test != SIGINT)
  602:     {
  603: #       ifndef SEMAPHORES_NOMMES
  604:             sem_post(&((*s_etat_processus).semaphore_fork));
  605:             sem_post(&semaphore_gestionnaires_signaux);
  606:             sem_destroy(&semaphore_gestionnaires_signaux);
  607:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  608: #       else
  609:             sem_post((*s_etat_processus).semaphore_fork);
  610:             sem_post(semaphore_gestionnaires_signaux);
  611:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  612:                     SEM_SIGNAUX);
  613:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  614:                     pthread_self(), SEM_FORK);
  615: #       endif
  616: 
  617:         liberation_contexte_cas(s_etat_processus);
  618:         liberation_queue_signaux(s_etat_processus);
  619: 
  620: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  621:             stackoverflow_deinstall_handler();
  622: #       endif
  623: 
  624:         erreur = d_es_signal;
  625: 
  626:         if ((*s_etat_processus).langue == 'F')
  627:         {
  628:             printf("+++Système : Initialisation des signaux POSIX "
  629:                     "impossible\n");
  630:         }
  631:         else
  632:         {
  633:             printf("+++System : Initialization of POSIX signals failed\n");
  634:         }
  635: 
  636:         return(EXIT_FAILURE);
  637:     }
  638: 
  639:     if (sigaction(SIGTERM, &action, NULL) != 0)
  640:     {
  641: #       ifndef SEMAPHORES_NOMMES
  642:             sem_post(&((*s_etat_processus).semaphore_fork));
  643:             sem_post(&semaphore_gestionnaires_signaux);
  644:             sem_destroy(&semaphore_gestionnaires_signaux);
  645:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  646: #       else
  647:             sem_post((*s_etat_processus).semaphore_fork);
  648:             sem_post(semaphore_gestionnaires_signaux);
  649:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  650:                     SEM_SIGNAUX);
  651:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  652:                     pthread_self(), SEM_FORK);
  653: #       endif
  654: 
  655:         liberation_contexte_cas(s_etat_processus);
  656:         liberation_queue_signaux(s_etat_processus);
  657: 
  658: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  659:             stackoverflow_deinstall_handler();
  660: #       endif
  661: 
  662:         erreur = d_es_signal;
  663: 
  664:         if ((*s_etat_processus).langue == 'F')
  665:         {
  666:             printf("+++Système : Initialisation des signaux POSIX "
  667:                     "impossible\n");
  668:         }
  669:         else
  670:         {
  671:             printf("+++System : Initialization of POSIX signals failed\n");
  672:         }
  673: 
  674:         return(EXIT_FAILURE);
  675:     }
  676: 
  677:     signal_test = SIGTEST;
  678:     kill(getpid(), SIGTERM);
  679: 
  680:     attente.tv_sec = 0;
  681:     attente.tv_nsec = 1000000;
  682: 
  683:     for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
  684:     {
  685:         nanosleep(&attente, NULL);
  686:     }
  687: 
  688:     if (signal_test != SIGTERM)
  689:     {
  690: #       ifndef SEMAPHORES_NOMMES
  691:             sem_post(&((*s_etat_processus).semaphore_fork));
  692:             sem_post(&semaphore_gestionnaires_signaux);
  693:             sem_destroy(&semaphore_gestionnaires_signaux);
  694:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  695: #       else
  696:             sem_post((*s_etat_processus).semaphore_fork);
  697:             sem_post(semaphore_gestionnaires_signaux);
  698:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  699:                     SEM_SIGNAUX);
  700:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  701:                     pthread_self(), SEM_FORK);
  702: #       endif
  703: 
  704:         liberation_contexte_cas(s_etat_processus);
  705:         liberation_queue_signaux(s_etat_processus);
  706: 
  707: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  708:             stackoverflow_deinstall_handler();
  709: #       endif
  710: 
  711:         erreur = d_es_signal;
  712: 
  713:         if ((*s_etat_processus).langue == 'F')
  714:         {
  715:             printf("+++Système : Initialisation des signaux POSIX "
  716:                     "impossible\n");
  717:         }
  718:         else
  719:         {
  720:             printf("+++System : Initialization of POSIX signals failed\n");
  721:         }
  722: 
  723:         return(EXIT_FAILURE);
  724:     }
  725: 
  726:     if (sigaction(SIGALRM, &action, NULL) != 0)
  727:     {
  728: #       ifndef SEMAPHORES_NOMMES
  729:             sem_post(&((*s_etat_processus).semaphore_fork));
  730:             sem_post(&semaphore_gestionnaires_signaux);
  731:             sem_destroy(&semaphore_gestionnaires_signaux);
  732:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  733: #       else
  734:             sem_post((*s_etat_processus).semaphore_fork);
  735:             sem_post(semaphore_gestionnaires_signaux);
  736:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  737:                     SEM_SIGNAUX);
  738:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  739:                     pthread_self(), SEM_FORK);
  740: #       endif
  741: 
  742:         liberation_contexte_cas(s_etat_processus);
  743:         liberation_queue_signaux(s_etat_processus);
  744: 
  745: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  746:             stackoverflow_deinstall_handler();
  747: #       endif
  748: 
  749:         erreur = d_es_signal;
  750: 
  751:         if ((*s_etat_processus).langue == 'F')
  752:         {
  753:             printf("+++Système : Initialisation des signaux POSIX "
  754:                     "impossible\n");
  755:         }
  756:         else
  757:         {
  758:             printf("+++System : Initialization of POSIX signals failed\n");
  759:         }
  760: 
  761:         return(EXIT_FAILURE);
  762:     }
  763: 
  764:     signal_test = SIGTEST;
  765:     kill(getpid(), SIGALRM);
  766: 
  767:     attente.tv_sec = 0;
  768:     attente.tv_nsec = 1000000;
  769: 
  770:     for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
  771:     {
  772:         nanosleep(&attente, NULL);
  773:     }
  774: 
  775:     if (signal_test != SIGALRM)
  776:     {
  777: #       ifndef SEMAPHORES_NOMMES
  778:             sem_post(&((*s_etat_processus).semaphore_fork));
  779:             sem_post(&semaphore_gestionnaires_signaux);
  780:             sem_destroy(&semaphore_gestionnaires_signaux);
  781:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  782: #       else
  783:             sem_post((*s_etat_processus).semaphore_fork);
  784:             sem_post(semaphore_gestionnaires_signaux);
  785:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  786:                     SEM_SIGNAUX);
  787:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  788:                     pthread_self(), SEM_FORK);
  789: #       endif
  790: 
  791:         liberation_contexte_cas(s_etat_processus);
  792:         liberation_queue_signaux(s_etat_processus);
  793: 
  794: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  795:             stackoverflow_deinstall_handler();
  796: #       endif
  797: 
  798:         erreur = d_es_signal;
  799: 
  800:         if ((*s_etat_processus).langue == 'F')
  801:         {
  802:             printf("+++Système : Initialisation des signaux POSIX "
  803:                     "impossible\n");
  804:         }
  805:         else
  806:         {
  807:             printf("+++System : Initialization of POSIX signals failed\n");
  808:         }
  809: 
  810:         return(EXIT_FAILURE);
  811:     }
  812: 
  813:     action.sa_handler = interruption2;
  814:     action.sa_flags = 0;
  815: 
  816:     if (sigaction(SIGTSTP, &action, NULL) != 0)
  817:     {
  818: #       ifndef SEMAPHORES_NOMMES
  819:             sem_post(&((*s_etat_processus).semaphore_fork));
  820:             sem_post(&semaphore_gestionnaires_signaux);
  821:             sem_destroy(&semaphore_gestionnaires_signaux);
  822:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  823: #       else
  824:             sem_post((*s_etat_processus).semaphore_fork);
  825:             sem_post(semaphore_gestionnaires_signaux);
  826:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  827:                     SEM_SIGNAUX);
  828:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  829:                     pthread_self(), SEM_FORK);
  830: #       endif
  831: 
  832:         liberation_contexte_cas(s_etat_processus);
  833:         liberation_queue_signaux(s_etat_processus);
  834: 
  835: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  836:             stackoverflow_deinstall_handler();
  837: #       endif
  838: 
  839:         if ((*s_etat_processus).langue == 'F')
  840:         {
  841:             printf("+++Système : Initialisation des signaux POSIX "
  842:                     "impossible\n");
  843:         }
  844:         else
  845:         {
  846:             printf("+++System : Initialization of POSIX signals failed\n");
  847:         }
  848: 
  849:         return(EXIT_FAILURE);
  850:     }
  851: 
  852:     signal_test = SIGTEST;
  853:     kill(getpid(), SIGTSTP);
  854: 
  855:     attente.tv_sec = 0;
  856:     attente.tv_nsec = 1000000;
  857: 
  858:     for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
  859:     {
  860:         nanosleep(&attente, NULL);
  861:     }
  862: 
  863:     if (signal_test != SIGTSTP)
  864:     {
  865: #       ifndef SEMAPHORES_NOMMES
  866:             sem_post(&((*s_etat_processus).semaphore_fork));
  867:             sem_post(&semaphore_gestionnaires_signaux);
  868:             sem_destroy(&semaphore_gestionnaires_signaux);
  869:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  870: #       else
  871:             sem_post((*s_etat_processus).semaphore_fork);
  872:             sem_post(semaphore_gestionnaires_signaux);
  873:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  874:                     SEM_SIGNAUX);
  875:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  876:                     pthread_self(), SEM_FORK);
  877: #       endif
  878: 
  879:         liberation_contexte_cas(s_etat_processus);
  880:         liberation_queue_signaux(s_etat_processus);
  881: 
  882: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  883:             stackoverflow_deinstall_handler();
  884: #       endif
  885: 
  886:         erreur = d_es_signal;
  887: 
  888:         if ((*s_etat_processus).langue == 'F')
  889:         {
  890:             printf("+++Système : Initialisation des signaux POSIX "
  891:                     "impossible\n");
  892:         }
  893:         else
  894:         {
  895:             printf("+++System : Initialization of POSIX signals failed\n");
  896:         }
  897: 
  898:         return(EXIT_FAILURE);
  899:     }
  900: 
  901:     action.sa_handler = interruption5;
  902:     action.sa_flags = 0;
  903: 
  904:     if (sigaction(SIGPIPE, &action, NULL) != 0)
  905:     {
  906: #       ifndef SEMAPHORES_NOMMES
  907:             sem_post(&((*s_etat_processus).semaphore_fork));
  908:             sem_post(&semaphore_gestionnaires_signaux);
  909:             sem_destroy(&semaphore_gestionnaires_signaux);
  910:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  911: #       else
  912:             sem_post((*s_etat_processus).semaphore_fork);
  913:             sem_post(semaphore_gestionnaires_signaux);
  914:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  915:                     SEM_SIGNAUX);
  916:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  917:                     pthread_self(), SEM_FORK);
  918: #       endif
  919: 
  920:         liberation_contexte_cas(s_etat_processus);
  921:         liberation_queue_signaux(s_etat_processus);
  922: 
  923: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  924:             stackoverflow_deinstall_handler();
  925: #       endif
  926: 
  927:         erreur = d_es_signal;
  928: 
  929:         if ((*s_etat_processus).langue == 'F')
  930:         {
  931:             printf("+++Système : Initialisation des signaux POSIX "
  932:                     "impossible\n");
  933:         }
  934:         else
  935:         {
  936:             printf("+++System : Initialization of POSIX signals failed\n");
  937:         }
  938: 
  939:         return(EXIT_FAILURE);
  940:     }
  941: 
  942:     signal_test = SIGTEST;
  943:     kill(getpid(), SIGPIPE);
  944: 
  945:     attente.tv_sec = 0;
  946:     attente.tv_nsec = 1000000;
  947: 
  948:     for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
  949:     {
  950:         nanosleep(&attente, NULL);
  951:     }
  952: 
  953:     if (signal_test != SIGPIPE)
  954:     {
  955: #       ifndef SEMAPHORES_NOMMES
  956:             sem_post(&((*s_etat_processus).semaphore_fork));
  957:             sem_post(&semaphore_gestionnaires_signaux);
  958:             sem_destroy(&semaphore_gestionnaires_signaux);
  959:             sem_destroy(&((*s_etat_processus).semaphore_fork));
  960: #       else
  961:             sem_post((*s_etat_processus).semaphore_fork);
  962:             sem_post(semaphore_gestionnaires_signaux);
  963:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
  964:                     SEM_SIGNAUX);
  965:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
  966:                     pthread_self(), SEM_FORK);
  967: #       endif
  968: 
  969:         liberation_contexte_cas(s_etat_processus);
  970:         liberation_queue_signaux(s_etat_processus);
  971: 
  972: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
  973:             stackoverflow_deinstall_handler();
  974: #       endif
  975: 
  976:         erreur = d_es_signal;
  977: 
  978:         if ((*s_etat_processus).langue == 'F')
  979:         {
  980:             printf("+++Système : Initialisation des signaux POSIX "
  981:                     "impossible\n");
  982:         }
  983:         else
  984:         {
  985:             printf("+++System : Initialization of POSIX signals failed\n");
  986:         }
  987: 
  988:         return(EXIT_FAILURE);
  989:     }
  990: 
  991:     action.sa_handler = interruption1;
  992:     action.sa_flags = 0;
  993: 
  994:     if (sigaction(SIGUSR1, &action, NULL) != 0)
  995:     {
  996: #       ifndef SEMAPHORES_NOMMES
  997:             sem_post(&((*s_etat_processus).semaphore_fork));
  998:             sem_post(&semaphore_gestionnaires_signaux);
  999:             sem_destroy(&semaphore_gestionnaires_signaux);
 1000:             sem_destroy(&((*s_etat_processus).semaphore_fork));
 1001: #       else
 1002:             sem_post((*s_etat_processus).semaphore_fork);
 1003:             sem_post(semaphore_gestionnaires_signaux);
 1004:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
 1005:                     SEM_SIGNAUX);
 1006:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
 1007:                     pthread_self(), SEM_FORK);
 1008: #       endif
 1009: 
 1010:         liberation_contexte_cas(s_etat_processus);
 1011:         liberation_queue_signaux(s_etat_processus);
 1012: 
 1013: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1014:             stackoverflow_deinstall_handler();
 1015: #       endif
 1016: 
 1017:         erreur = d_es_signal;
 1018: 
 1019:         if ((*s_etat_processus).langue == 'F')
 1020:         {
 1021:             printf("+++Système : Initialisation des signaux POSIX "
 1022:                     "impossible\n");
 1023:         }
 1024:         else
 1025:         {
 1026:             printf("+++System : Initialization of POSIX signals failed\n");
 1027:         }
 1028: 
 1029:         return(EXIT_FAILURE);
 1030:     }
 1031: 
 1032:     signal_test = SIGTEST;
 1033:     kill(getpid(), SIGUSR1);
 1034: 
 1035:     attente.tv_sec = 0;
 1036:     attente.tv_nsec = 1000000;
 1037: 
 1038:     for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
 1039:     {
 1040:         nanosleep(&attente, NULL);
 1041:     }
 1042: 
 1043:     if (signal_test != SIGUSR1)
 1044:     {
 1045: #       ifndef SEMAPHORES_NOMMES
 1046:             sem_post(&((*s_etat_processus).semaphore_fork));
 1047:             sem_post(&semaphore_gestionnaires_signaux);
 1048:             sem_destroy(&semaphore_gestionnaires_signaux);
 1049:             sem_destroy(&((*s_etat_processus).semaphore_fork));
 1050: #       else
 1051:             sem_post((*s_etat_processus).semaphore_fork);
 1052:             sem_post(semaphore_gestionnaires_signaux);
 1053:             sem_destroy2(semaphore_gestionnaires_signaux, getpid(),
 1054:                     SEM_SIGNAUX);
 1055:             sem_destroy3((*s_etat_processus).semphore_fork, getpid(),
 1056:                     pthread_self(), SEM_FORK);
 1057: #       endif
 1058: 
 1059:         liberation_contexte_cas(s_etat_processus);
 1060:         liberation_queue_signaux(s_etat_processus);
 1061: 
 1062: #       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1063:             stackoverflow_deinstall_handler();
 1064: #       endif
 1065: 
 1066:         erreur = d_es_signal;
 1067: 
 1068:         if ((*s_etat_processus).langue == 'F')
 1069:         {
 1070:             printf("+++Système : Initialisation des signaux POSIX "
 1071:                     "impossible\n");
 1072:         }
 1073:         else
 1074:         {
 1075:             printf("+++System : Initialization of POSIX signals failed\n");
 1076:         }
 1077: 
 1078:         return(EXIT_FAILURE);
 1079:     }
 1080: 
 1081:     signal_test = SIGTEST + 1;
 1082: 
 1083:     erreur = d_absence_erreur;
 1084:     core = d_faux;
 1085:     mode_interactif = d_faux;
 1086:     (*s_etat_processus).nom_fichier_source = NULL;
 1087:     (*s_etat_processus).definitions_chainees = NULL;
 1088:     (*s_etat_processus).type_debug = 0;
 1089:     traitement_fichier_temporaire = 'N';
 1090:     option = ' ';
 1091:     drapeau_encart = 'Y';
 1092:     debug = d_faux;
 1093:     arguments = NULL;
 1094: 
 1095:     (*s_etat_processus).s_fichiers = NULL;
 1096:     (*s_etat_processus).s_sockets = NULL;
 1097:     (*s_etat_processus).s_connecteurs_sql = NULL;
 1098: 
 1099:     setlogmask(LOG_MASK(LOG_NOTICE));
 1100:     openlog(argv[0], LOG_ODELAY | LOG_PID, LOG_USER);
 1101: 
 1102:     if (argc == 1)
 1103:     {
 1104:         erreur = d_erreur;
 1105:         informations(s_etat_processus);
 1106:     }
 1107:     else
 1108:     {
 1109:         presence_definition = 'N';
 1110:         (*s_etat_processus).debug = d_faux;
 1111:         (*s_etat_processus).lancement_interactif = d_faux;
 1112: 
 1113:         option_a = d_faux;
 1114:         option_A = d_faux;
 1115:         option_c = d_faux;
 1116:         option_d = d_faux;
 1117:         option_D = d_faux;
 1118:         option_h = d_faux;
 1119:         option_i = d_faux;
 1120:         option_l = d_faux;
 1121:         option_n = d_faux;
 1122:         option_p = d_faux;
 1123:         option_P = 0;
 1124:         option_s = d_faux;
 1125:         option_S = d_faux;
 1126:         option_t = d_faux;
 1127:         option_v = d_faux;
 1128: 
 1129:         // Lorsque le programme est appelé depuis un shebang, argv[0] contient
 1130:         // le chemin du programme et argv[1] tous les arguments.
 1131:         // argv[2] contient quant à lui le nom du script RPL/2.
 1132:         //
 1133:         // Exemple :
 1134:         // argv[0] : /usr/local/bin/rpl
 1135:         // argv[1] : -csdp -t 800
 1136:         // argv[2] : ./on_exit.rpl
 1137: 
 1138:         while((--argc) > 0)
 1139:         {
 1140:             if ((*(++argv))[0] == '-')
 1141:             {
 1142:                 while((option = *(++argv[0])) != '\0')
 1143:                 {
 1144:                     switch(option)
 1145:                     {
 1146:                         case 'a' :
 1147:                         {
 1148:                             if (option_a == d_vrai)
 1149:                             {
 1150: #                               ifndef SEMAPHORES_NOMMES
 1151:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1152:                                 sem_post(&semaphore_gestionnaires_signaux);
 1153:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1154:                                 sem_destroy(&((*s_etat_processus)
 1155:                                         .semaphore_fork));
 1156: #                               else
 1157:                                 sem_post((*s_etat_processus).semaphore_fork);
 1158:                                 sem_post(semaphore_gestionnaires_signaux);
 1159:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1160:                                         getpid(), SEM_SIGNAUX);
 1161:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1162:                                         getpid(), pthread_self(), SEM_FORK);
 1163: #                               endif
 1164: 
 1165:                                 liberation_contexte_cas(s_etat_processus);
 1166:                                 liberation_queue_signaux(s_etat_processus);
 1167: 
 1168: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1169:                                 stackoverflow_deinstall_handler();
 1170: #                               endif
 1171: 
 1172:                                 if ((*s_etat_processus).langue == 'F')
 1173:                                 {
 1174:                                     printf("+++Erreur : option -a présente "
 1175:                                             "plus d'une fois\n");
 1176:                                 }
 1177:                                 else
 1178:                                 {
 1179:                                     printf("+++Error : more than one -a "
 1180:                                             "on command line");
 1181:                                 }
 1182: 
 1183:                                 return(EXIT_FAILURE);
 1184:                             }
 1185: 
 1186:                             option_a = d_vrai;
 1187:                             break;
 1188:                         }
 1189: 
 1190:                         case 'A' :
 1191:                         {
 1192:                             if (option_A == d_vrai)
 1193:                             {
 1194: #                               ifndef SEMAPHORES_NOMMES
 1195:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1196:                                 sem_post(&semaphore_gestionnaires_signaux);
 1197:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1198:                                 sem_destroy(&((*s_etat_processus)
 1199:                                         .semaphore_fork));
 1200: #                               else
 1201:                                 sem_post((*s_etat_processus).semaphore_fork);
 1202:                                 sem_post(semaphore_gestionnaires_signaux);
 1203:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1204:                                         getpid(), SEM_SIGNAUX);
 1205:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1206:                                         getpid(), pthread_self(), SEM_FORK);
 1207: #                               endif
 1208: 
 1209:                                 liberation_contexte_cas(s_etat_processus);
 1210:                                 liberation_queue_signaux(s_etat_processus);
 1211: 
 1212: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1213:                                 stackoverflow_deinstall_handler();
 1214: #                               endif
 1215: 
 1216:                                 if ((*s_etat_processus).langue == 'F')
 1217:                                 {
 1218:                                     printf("+++Erreur : option -A présente "
 1219:                                             "plus d'une fois\n");
 1220:                                 }
 1221:                                 else
 1222:                                 {
 1223:                                     printf("+++Error : more than one -A "
 1224:                                             "on command line");
 1225:                                 }
 1226: 
 1227:                                 return(EXIT_FAILURE);
 1228:                             }
 1229: 
 1230:                             option_A = d_vrai;
 1231: 
 1232:                             while(*(++argv[0]) == ' ');
 1233:                             argv[0]--;
 1234: 
 1235:                             if ((*(++argv[0])) != '\0')
 1236:                             {
 1237:                                 if ((arguments = malloc((strlen(argv[0]) + 7) *
 1238:                                         sizeof(unsigned char))) == NULL)
 1239:                                 {
 1240: #                                   ifndef SEMAPHORES_NOMMES
 1241:                                     sem_post(&((*s_etat_processus)
 1242:                                             .semaphore_fork));
 1243:                                     sem_post(&semaphore_gestionnaires_signaux);
 1244:                                     sem_destroy(
 1245:                                             &semaphore_gestionnaires_signaux);
 1246:                                     sem_destroy(&((*s_etat_processus)
 1247:                                             .semaphore_fork));
 1248: #                                   else
 1249:                                     sem_post((*s_etat_processus)
 1250:                                             .semaphore_fork);
 1251:                                     sem_post(semaphore_gestionnaires_signaux);
 1252:                                     sem_destroy2(
 1253:                                             semaphore_gestionnaires_signaux,
 1254:                                             getpid(), SEM_SIGNAUX);
 1255:                                     sem_destroy3((*s_etat_processus)
 1256:                                             .semphore_fork, getpid(),
 1257:                                             pthread_self(), SEM_FORK);
 1258: #                                   endif
 1259: 
 1260:                                     liberation_contexte_cas(s_etat_processus);
 1261:                                     liberation_queue_signaux(s_etat_processus);
 1262: 
 1263: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1264:                                     stackoverflow_deinstall_handler();
 1265: #                                   endif
 1266: 
 1267:                                     if ((*s_etat_processus).langue == 'F')
 1268:                                     {
 1269:                                         printf("+++Système : Mémoire "
 1270:                                                 "insuffisante\n");
 1271:                                     }
 1272:                                     else
 1273:                                     {
 1274:                                         printf("+++System : Not enough "
 1275:                                                 "memory\n");
 1276:                                     }
 1277: 
 1278:                                     return(EXIT_FAILURE);
 1279:                                 }
 1280: 
 1281:                                 ptr = arguments;
 1282:                                 (*ptr) = d_code_fin_chaine;
 1283:                                 strcat(ptr, "<< ");
 1284:                                 ptr += 3;
 1285: 
 1286:                                 while(*(argv[0]) != '\0')
 1287:                                 {
 1288:                                     *(ptr++) = *(argv[0]++);
 1289:                                 }
 1290: 
 1291:                                 (*ptr) = '\0';
 1292: 
 1293:                                 strcat(arguments, " >>");
 1294:                                 argv[0]--;
 1295:                             }
 1296:                             else if ((--argc) > 0)
 1297:                             {
 1298:                                 argv++;
 1299: 
 1300:                                 if ((arguments = malloc((strlen(argv[0]) + 7) *
 1301:                                         sizeof(unsigned char))) == NULL)
 1302:                                 {
 1303: #                                   ifndef SEMAPHORES_NOMMES
 1304:                                     sem_post(&((*s_etat_processus)
 1305:                                             .semaphore_fork));
 1306:                                     sem_post(&semaphore_gestionnaires_signaux);
 1307:                                     sem_destroy(
 1308:                                             &semaphore_gestionnaires_signaux);
 1309:                                     sem_destroy(&((*s_etat_processus)
 1310:                                             .semaphore_fork));
 1311: #                                   else
 1312:                                     sem_post((*s_etat_processus)
 1313:                                             .semaphore_fork);
 1314:                                     sem_post(semaphore_gestionnaires_signaux);
 1315:                                     sem_destroy2(
 1316:                                             semaphore_gestionnaires_signaux,
 1317:                                             getpid(), SEM_SIGNAUX);
 1318:                                     sem_destroy3((*s_etat_processus)
 1319:                                             .semphore_fork, getpid(),
 1320:                                             pthread_self(), SEM_FORK);
 1321: #                                   endif
 1322: 
 1323:                                     liberation_contexte_cas(s_etat_processus);
 1324:                                     liberation_queue_signaux(s_etat_processus);
 1325: 
 1326: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1327:                                     stackoverflow_deinstall_handler();
 1328: #                                   endif
 1329: 
 1330:                                     if ((*s_etat_processus).langue == 'F')
 1331:                                     {
 1332:                                         printf("+++Système : Mémoire "
 1333:                                                 "insuffisante\n");
 1334:                                     }
 1335:                                     else
 1336:                                     {
 1337:                                         printf("+++System : Not enough "
 1338:                                                 "memory\n");
 1339:                                     }
 1340: 
 1341:                                     return(EXIT_FAILURE);
 1342:                                 }
 1343: 
 1344:                                 ptr = arguments;
 1345:                                 (*ptr) = d_code_fin_chaine;
 1346:                                 strcat(ptr, "<< ");
 1347:                                 ptr += 3;
 1348: 
 1349:                                 while(*(argv[0]) != '\0')
 1350:                                 {
 1351:                                     *(ptr++) = *(argv[0]++);
 1352:                                 }
 1353: 
 1354:                                 (*ptr) = '\0';
 1355: 
 1356:                                 strcat(arguments, " >>");
 1357:                                 argv[0]--;
 1358:                             }
 1359:                             else
 1360:                             {
 1361: #                               ifndef SEMAPHORES_NOMMES
 1362:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1363:                                 sem_post(&semaphore_gestionnaires_signaux);
 1364:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1365:                                 sem_destroy(&((*s_etat_processus)
 1366:                                         .semaphore_fork));
 1367: #                               else
 1368:                                 sem_post((*s_etat_processus).semaphore_fork);
 1369:                                 sem_post(semaphore_gestionnaires_signaux);
 1370:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1371:                                         getpid(), SEM_SIGNAUX);
 1372:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1373:                                         getpid(), pthread_self(), SEM_FORK);
 1374: #                               endif
 1375: 
 1376:                                 liberation_contexte_cas(s_etat_processus);
 1377:                                 liberation_queue_signaux(s_etat_processus);
 1378: 
 1379: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1380:                                 stackoverflow_deinstall_handler();
 1381: #                               endif
 1382: 
 1383:                                 if ((*s_etat_processus).langue == 'F')
 1384:                                 {
 1385:                                     printf("+++Erreur : Aucune donnée "
 1386:                                             "spécifié après l'option -A\n");
 1387:                                 }
 1388:                                 else
 1389:                                 {
 1390:                                     printf("+++Error : Data required after "
 1391:                                             "-A option\n");
 1392:                                 }
 1393: 
 1394:                                 return(EXIT_FAILURE);
 1395:                             }
 1396: 
 1397:                             break;
 1398:                         }
 1399: 
 1400:                         case 'c' :
 1401:                         {
 1402:                             if (option_c == d_vrai)
 1403:                             {
 1404: #                               ifndef SEMAPHORES_NOMMES
 1405:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1406:                                 sem_post(&semaphore_gestionnaires_signaux);
 1407:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1408:                                 sem_destroy(&((*s_etat_processus)
 1409:                                         .semaphore_fork));
 1410: #                               else
 1411:                                 sem_post((*s_etat_processus).semaphore_fork);
 1412:                                 sem_post(semaphore_gestionnaires_signaux);
 1413:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1414:                                         getpid(), SEM_SIGNAUX);
 1415:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1416:                                         getpid(), pthread_self(), SEM_FORK);
 1417: #                               endif
 1418: 
 1419:                                 liberation_contexte_cas(s_etat_processus);
 1420:                                 liberation_queue_signaux(s_etat_processus);
 1421: 
 1422: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1423:                                 stackoverflow_deinstall_handler();
 1424: #                               endif
 1425: 
 1426:                                 if ((*s_etat_processus).langue == 'F')
 1427:                                 {
 1428:                                     printf("+++Erreur : option -c présente "
 1429:                                             "plus d'une fois\n");
 1430:                                 }
 1431:                                 else
 1432:                                 {
 1433:                                     printf("+++Error : more than one -c "
 1434:                                             "on command line");
 1435:                                 }
 1436: 
 1437:                                 return(EXIT_FAILURE);
 1438:                             }
 1439: 
 1440:                             option_c = d_vrai;
 1441:                             core = d_vrai;
 1442:                             break;
 1443:                         }
 1444: 
 1445:                         case 'd' :
 1446:                         {
 1447:                             if (option_d == d_vrai)
 1448:                             {
 1449: #                               ifndef SEMAPHORES_NOMMES
 1450:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1451:                                 sem_post(&semaphore_gestionnaires_signaux);
 1452:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1453:                                 sem_destroy(&((*s_etat_processus)
 1454:                                         .semaphore_fork));
 1455: #                               else
 1456:                                 sem_post((*s_etat_processus).semaphore_fork);
 1457:                                 sem_post(semaphore_gestionnaires_signaux);
 1458:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1459:                                         getpid(), SEM_SIGNAUX);
 1460:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1461:                                         getpid(), pthread_self(), SEM_FORK);
 1462: #                               endif
 1463: 
 1464:                                 liberation_contexte_cas(s_etat_processus);
 1465:                                 liberation_queue_signaux(s_etat_processus);
 1466: 
 1467: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1468:                                 stackoverflow_deinstall_handler();
 1469: #                               endif
 1470: 
 1471:                                 if ((*s_etat_processus).langue == 'F')
 1472:                                 {
 1473:                                     printf("+++Erreur : option -d présente "
 1474:                                             "plus d'une fois\n");
 1475:                                 }
 1476:                                 else
 1477:                                 {
 1478:                                     printf("+++Error : more than one -d "
 1479:                                             "on command line");
 1480:                                 }
 1481: 
 1482:                                 return(EXIT_FAILURE);
 1483:                             }
 1484: 
 1485:                             option_d = d_vrai;
 1486:                             debug = d_vrai;
 1487:                             break;
 1488:                         }
 1489: 
 1490:                         case 'D' :
 1491:                         {
 1492:                             if (option_D == d_vrai)
 1493:                             {
 1494: #                               ifndef SEMAPHORES_NOMMES
 1495:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1496:                                 sem_post(&semaphore_gestionnaires_signaux);
 1497:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1498:                                 sem_destroy(&((*s_etat_processus)
 1499:                                         .semaphore_fork));
 1500: #                               else
 1501:                                 sem_post((*s_etat_processus).semaphore_fork);
 1502:                                 sem_post(semaphore_gestionnaires_signaux);
 1503:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1504:                                         getpid(), SEM_SIGNAUX);
 1505:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1506:                                         getpid(), pthread_self(), SEM_FORK);
 1507: #                               endif
 1508: 
 1509:                                 liberation_contexte_cas(s_etat_processus);
 1510:                                 liberation_queue_signaux(s_etat_processus);
 1511: 
 1512: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1513:                                 stackoverflow_deinstall_handler();
 1514: #                               endif
 1515: 
 1516:                                 if ((*s_etat_processus).langue == 'F')
 1517:                                 {
 1518:                                     printf("+++Erreur : option -D présente "
 1519:                                             "plus d'une fois\n");
 1520:                                 }
 1521:                                 else
 1522:                                 {
 1523:                                     printf("+++Error : more than one -D "
 1524:                                             "on command line");
 1525:                                 }
 1526: 
 1527:                                 return(EXIT_FAILURE);
 1528:                             }
 1529: 
 1530:                             option_D = d_vrai;
 1531:                             break;
 1532:                         }
 1533: 
 1534:                         case 'h' :
 1535:                         {
 1536:                             if (option_h == d_vrai)
 1537:                             {
 1538: #                               ifndef SEMAPHORES_NOMMES
 1539:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1540:                                 sem_post(&semaphore_gestionnaires_signaux);
 1541:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1542:                                 sem_destroy(&((*s_etat_processus)
 1543:                                         .semaphore_fork));
 1544: #                               else
 1545:                                 sem_post((*s_etat_processus).semaphore_fork);
 1546:                                 sem_post(semaphore_gestionnaires_signaux);
 1547:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1548:                                         getpid(), SEM_SIGNAUX);
 1549:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1550:                                         getpid(), pthread_self(), SEM_FORK);
 1551: #                               endif
 1552: 
 1553:                                 liberation_contexte_cas(s_etat_processus);
 1554:                                 liberation_queue_signaux(s_etat_processus);
 1555: 
 1556: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1557:                                 stackoverflow_deinstall_handler();
 1558: #                               endif
 1559: 
 1560:                                 if ((*s_etat_processus).langue == 'F')
 1561:                                 {
 1562:                                     printf("+++Erreur : option -h présente "
 1563:                                             "plus d'une fois\n");
 1564:                                 }
 1565:                                 else
 1566:                                 {
 1567:                                     printf("+++Error : more than one -h "
 1568:                                             "on command line");
 1569:                                 }
 1570: 
 1571:                                 return(EXIT_FAILURE);
 1572:                             }
 1573: 
 1574:                             option_h = d_vrai;
 1575:                             informations(s_etat_processus);
 1576:                             break;
 1577:                         }
 1578: 
 1579:                         case 'i' :
 1580:                         {
 1581:                             if (option_i == d_vrai) 
 1582:                             {
 1583: #                               ifndef SEMAPHORES_NOMMES
 1584:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1585:                                 sem_post(&semaphore_gestionnaires_signaux);
 1586:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1587:                                 sem_destroy(&((*s_etat_processus)
 1588:                                         .semaphore_fork));
 1589: #                               else
 1590:                                 sem_post((*s_etat_processus).semaphore_fork);
 1591:                                 sem_post(semaphore_gestionnaires_signaux);
 1592:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1593:                                         getpid(), SEM_SIGNAUX);
 1594:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1595:                                         getpid(), pthread_self(), SEM_FORK);
 1596: #                               endif
 1597: 
 1598:                                 liberation_contexte_cas(s_etat_processus);
 1599:                                 liberation_queue_signaux(s_etat_processus);
 1600: 
 1601: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1602:                                 stackoverflow_deinstall_handler();
 1603: #                               endif
 1604: 
 1605:                                 if ((*s_etat_processus).langue == 'F')
 1606:                                 {
 1607:                                     printf("+++Erreur : option -i présente "
 1608:                                             "plus d'une fois\n");
 1609:                                 }
 1610:                                 else
 1611:                                 {
 1612:                                     printf("+++Error : more than one -i "
 1613:                                             "on command line");
 1614:                                 }
 1615: 
 1616:                                 return(EXIT_FAILURE);
 1617:                             }
 1618:                             else if (option_S == d_vrai)
 1619:                             {
 1620: #                               ifndef SEMAPHORES_NOMMES
 1621:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1622:                                 sem_post(&semaphore_gestionnaires_signaux);
 1623:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1624:                                 sem_destroy(&((*s_etat_processus)
 1625:                                         .semaphore_fork));
 1626: #                               else
 1627:                                 sem_post((*s_etat_processus).semaphore_fork);
 1628:                                 sem_post(semaphore_gestionnaires_signaux);
 1629:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1630:                                         getpid(), SEM_SIGNAUX);
 1631:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1632:                                         getpid(), pthread_self(), SEM_FORK);
 1633: #                               endif
 1634: 
 1635:                                 liberation_contexte_cas(s_etat_processus);
 1636:                                 liberation_queue_signaux(s_etat_processus);
 1637: 
 1638: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1639:                                 stackoverflow_deinstall_handler();
 1640: #                               endif
 1641: 
 1642:                                 if ((*s_etat_processus).langue == 'F')
 1643:                                 {
 1644:                                     printf("+++Erreur : options -i et -S "
 1645:                                             "incompatibles\n");
 1646:                                 }
 1647:                                 else
 1648:                                 {
 1649:                                     printf("+++Error : incompatible options -i "
 1650:                                             "and -S\n");
 1651:                                 }
 1652: 
 1653:                                 return(EXIT_FAILURE);
 1654:                             }
 1655:                             else if (option_p == d_vrai)
 1656:                             {
 1657: #                               ifndef SEMAPHORES_NOMMES
 1658:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1659:                                 sem_post(&semaphore_gestionnaires_signaux);
 1660:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1661:                                 sem_destroy(&((*s_etat_processus)
 1662:                                         .semaphore_fork));
 1663: #                               else
 1664:                                 sem_post((*s_etat_processus).semaphore_fork);
 1665:                                 sem_post(semaphore_gestionnaires_signaux);
 1666:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1667:                                         getpid(), SEM_SIGNAUX);
 1668:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1669:                                         getpid(), pthread_self(), SEM_FORK);
 1670: #                               endif
 1671: 
 1672:                                 liberation_contexte_cas(s_etat_processus);
 1673:                                 liberation_queue_signaux(s_etat_processus);
 1674: 
 1675: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1676:                                 stackoverflow_deinstall_handler();
 1677: #                               endif
 1678: 
 1679:                                 if ((*s_etat_processus).langue == 'F')
 1680:                                 {
 1681:                                     printf("+++Erreur : options -i et -p "
 1682:                                             "incompatibles\n");
 1683:                                 }
 1684:                                 else
 1685:                                 {
 1686:                                     printf("+++Error : incompatible options -i "
 1687:                                             "and -p\n");
 1688:                                 }
 1689: 
 1690:                                 return(EXIT_FAILURE);
 1691:                             }
 1692: 
 1693:                             option_i = d_vrai;
 1694:                             mode_interactif = d_vrai;
 1695:                             presence_definition = 'O';
 1696:                             break;
 1697:                         }
 1698: 
 1699:                         case 'l' :
 1700:                         {
 1701:                             if (option_l == d_vrai)
 1702:                             {
 1703: #                               ifndef SEMAPHORES_NOMMES
 1704:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1705:                                 sem_post(&semaphore_gestionnaires_signaux);
 1706:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1707:                                 sem_destroy(&((*s_etat_processus)
 1708:                                         .semaphore_fork));
 1709: #                               else
 1710:                                 sem_post((*s_etat_processus).semaphore_fork);
 1711:                                 sem_post(semaphore_gestionnaires_signaux);
 1712:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1713:                                         getpid(), SEM_SIGNAUX);
 1714:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1715:                                         getpid(), pthread_self(), SEM_FORK);
 1716: #                               endif
 1717: 
 1718:                                 liberation_contexte_cas(s_etat_processus);
 1719:                                 liberation_queue_signaux(s_etat_processus);
 1720: 
 1721: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1722:                                 stackoverflow_deinstall_handler();
 1723: #                               endif
 1724: 
 1725:                                 if ((*s_etat_processus).langue == 'F')
 1726:                                 {
 1727:                                     printf("+++Erreur : option -l présente "
 1728:                                             "plus d'une fois\n");
 1729:                                 }
 1730:                                 else
 1731:                                 {
 1732:                                     printf("+++Error : more than one -l "
 1733:                                             "on command line");
 1734:                                 }
 1735: 
 1736:                                 return(EXIT_FAILURE);
 1737:                             }
 1738: 
 1739:                             option_l = d_vrai;
 1740: 
 1741:                             if ((*s_etat_processus).langue == 'F')
 1742:                             {
 1743:                                 printf("%s\n\n", CeCILL_fr);
 1744:                             }
 1745:                             else
 1746:                             {
 1747:                                 printf("%s\n\n", CeCILL_en);
 1748:                             }
 1749: 
 1750:                             break;
 1751:                         }
 1752: 
 1753:                         case 'n' :
 1754:                         {
 1755:                             if (option_n == d_vrai)
 1756:                             {
 1757: #                               ifndef SEMAPHORES_NOMMES
 1758:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1759:                                 sem_post(&semaphore_gestionnaires_signaux);
 1760:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1761:                                 sem_destroy(&((*s_etat_processus)
 1762:                                         .semaphore_fork));
 1763: #                               else
 1764:                                 sem_post((*s_etat_processus).semaphore_fork);
 1765:                                 sem_post(semaphore_gestionnaires_signaux);
 1766:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1767:                                         getpid(), SEM_SIGNAUX);
 1768:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1769:                                         getpid(), pthread_self(), SEM_FORK);
 1770: #                               endif
 1771: 
 1772:                                 liberation_contexte_cas(s_etat_processus);
 1773:                                 liberation_queue_signaux(s_etat_processus);
 1774: 
 1775: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1776:                                 stackoverflow_deinstall_handler();
 1777: #                               endif
 1778: 
 1779:                                 if ((*s_etat_processus).langue == 'F')
 1780:                                 {
 1781:                                     printf("+++Erreur : option -n présente "
 1782:                                             "plus d'une fois\n");
 1783:                                 }
 1784:                                 else
 1785:                                 {
 1786:                                     printf("+++Error : more than one -n "
 1787:                                             "on command line");
 1788:                                 }
 1789: 
 1790:                                 return(EXIT_FAILURE);
 1791:                             }
 1792: 
 1793:                             option_n = d_vrai;
 1794: 
 1795:                             break;
 1796:                         }
 1797: 
 1798:                         case 'p' :
 1799:                         {
 1800:                             if (option_p == d_vrai)
 1801:                             {
 1802: #                               ifndef SEMAPHORES_NOMMES
 1803:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1804:                                 sem_post(&semaphore_gestionnaires_signaux);
 1805:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1806:                                 sem_destroy(&((*s_etat_processus)
 1807:                                         .semaphore_fork));
 1808: #                               else
 1809:                                 sem_post((*s_etat_processus).semaphore_fork);
 1810:                                 sem_post(semaphore_gestionnaires_signaux);
 1811:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1812:                                         getpid(), SEM_SIGNAUX);
 1813:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1814:                                         getpid(), pthread_self(), SEM_FORK);
 1815: #                               endif
 1816: 
 1817:                                 liberation_contexte_cas(s_etat_processus);
 1818:                                 liberation_queue_signaux(s_etat_processus);
 1819: 
 1820: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1821:                                 stackoverflow_deinstall_handler();
 1822: #                               endif
 1823: 
 1824:                                 if ((*s_etat_processus).langue == 'F')
 1825:                                 {
 1826:                                     printf("+++Erreur : option -p présente "
 1827:                                             "plus d'une fois\n");
 1828:                                 }
 1829:                                 else
 1830:                                 {
 1831:                                     printf("+++Error : more than one -p "
 1832:                                             "on command line");
 1833:                                 }
 1834: 
 1835:                                 return(EXIT_FAILURE);
 1836:                             }
 1837:                             else if (option_i == d_vrai)
 1838:                             {
 1839: #                               ifndef SEMAPHORES_NOMMES
 1840:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1841:                                 sem_post(&semaphore_gestionnaires_signaux);
 1842:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1843:                                 sem_destroy(&((*s_etat_processus)
 1844:                                         .semaphore_fork));
 1845: #                               else
 1846:                                 sem_post((*s_etat_processus).semaphore_fork);
 1847:                                 sem_post(semaphore_gestionnaires_signaux);
 1848:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1849:                                         getpid(), SEM_SIGNAUX);
 1850:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1851:                                         getpid(), pthread_self(), SEM_FORK);
 1852: #                               endif
 1853: 
 1854:                                 liberation_contexte_cas(s_etat_processus);
 1855:                                 liberation_queue_signaux(s_etat_processus);
 1856: 
 1857: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1858:                                 stackoverflow_deinstall_handler();
 1859: #                               endif
 1860: 
 1861:                                 if ((*s_etat_processus).langue == 'F')
 1862:                                 {
 1863:                                     printf("+++Erreur : options -i et -p "
 1864:                                             "incompatibles\n");
 1865:                                 }
 1866:                                 else
 1867:                                 {
 1868:                                     printf("+++Error : incompatible options -i "
 1869:                                             "and -p\n");
 1870:                                 }
 1871: 
 1872:                                 return(EXIT_FAILURE);
 1873:                             }
 1874: 
 1875:                             option_p = d_vrai;
 1876: 
 1877:                             break;
 1878:                         }
 1879: 
 1880:                         case 'P' :
 1881:                         {
 1882:                             if (option_P > 2)
 1883:                             {
 1884: #                               ifndef SEMAPHORES_NOMMES
 1885:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1886:                                 sem_post(&semaphore_gestionnaires_signaux);
 1887:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1888:                                 sem_destroy(&((*s_etat_processus)
 1889:                                         .semaphore_fork));
 1890: #                               else
 1891:                                 sem_post((*s_etat_processus).semaphore_fork);
 1892:                                 sem_post(semaphore_gestionnaires_signaux);
 1893:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1894:                                         getpid(), SEM_SIGNAUX);
 1895:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1896:                                         getpid(), pthread_self(), SEM_FORK);
 1897: #                               endif
 1898: 
 1899:                                 liberation_contexte_cas(s_etat_processus);
 1900:                                 liberation_queue_signaux(s_etat_processus);
 1901: 
 1902: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1903:                                 stackoverflow_deinstall_handler();
 1904: #                               endif
 1905: 
 1906:                                 if ((*s_etat_processus).langue == 'F')
 1907:                                 {
 1908:                                     printf("+++Erreur : option -P présente "
 1909:                                             "plus de deux fois\n");
 1910:                                 }
 1911:                                 else
 1912:                                 {
 1913:                                     printf("+++Error : more than two -P "
 1914:                                             "on command line");
 1915:                                 }
 1916: 
 1917:                                 return(EXIT_FAILURE);
 1918:                             }
 1919: 
 1920:                             option_P++;
 1921: 
 1922:                             break;
 1923:                         }
 1924: 
 1925:                         case 's' :
 1926:                         {
 1927:                             if (option_s == d_vrai)
 1928:                             {
 1929: #                               ifndef SEMAPHORES_NOMMES
 1930:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1931:                                 sem_post(&semaphore_gestionnaires_signaux);
 1932:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1933:                                 sem_destroy(&((*s_etat_processus)
 1934:                                         .semaphore_fork));
 1935: #                               else
 1936:                                 sem_post((*s_etat_processus).semaphore_fork);
 1937:                                 sem_post(semaphore_gestionnaires_signaux);
 1938:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1939:                                         getpid(), SEM_SIGNAUX);
 1940:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1941:                                         getpid(), pthread_self(), SEM_FORK);
 1942: #                               endif
 1943: 
 1944:                                 liberation_contexte_cas(s_etat_processus);
 1945:                                 liberation_queue_signaux(s_etat_processus);
 1946: 
 1947: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1948:                                 stackoverflow_deinstall_handler();
 1949: #                               endif
 1950: 
 1951:                                 if ((*s_etat_processus).langue == 'F')
 1952:                                 {
 1953:                                     printf("+++Erreur : option -s présente "
 1954:                                             "plus d'une fois\n");
 1955:                                 }
 1956:                                 else
 1957:                                 {
 1958:                                     printf("+++Error : more than one -s "
 1959:                                             "on command line");
 1960:                                 }
 1961: 
 1962:                                 return(EXIT_FAILURE);
 1963:                             }
 1964: 
 1965:                             option_s = d_vrai;
 1966:                             drapeau_encart = 'N';
 1967:                             break;
 1968:                         }
 1969: 
 1970:                         case 'S' :
 1971:                         {
 1972:                             if (option_S == d_vrai)
 1973:                             {
 1974: #                               ifndef SEMAPHORES_NOMMES
 1975:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 1976:                                 sem_post(&semaphore_gestionnaires_signaux);
 1977:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 1978:                                 sem_destroy(&((*s_etat_processus)
 1979:                                         .semaphore_fork));
 1980: #                               else
 1981:                                 sem_post((*s_etat_processus).semaphore_fork);
 1982:                                 sem_post(semaphore_gestionnaires_signaux);
 1983:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 1984:                                         getpid(), SEM_SIGNAUX);
 1985:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 1986:                                         getpid(), pthread_self(), SEM_FORK);
 1987: #                               endif
 1988: 
 1989:                                 liberation_contexte_cas(s_etat_processus);
 1990:                                 liberation_queue_signaux(s_etat_processus);
 1991: 
 1992: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 1993:                                 stackoverflow_deinstall_handler();
 1994: #                               endif
 1995: 
 1996:                                 if ((*s_etat_processus).langue == 'F')
 1997:                                 {
 1998:                                     printf("+++Erreur : option -S présente "
 1999:                                             "plus d'une fois\n");
 2000:                                 }
 2001:                                 else
 2002:                                 {
 2003:                                     printf("+++Error : more than one -S "
 2004:                                             "on command line");
 2005:                                 }
 2006: 
 2007:                                 return(EXIT_FAILURE);
 2008:                             }
 2009:                             else if (option_i == d_vrai)
 2010:                             {
 2011: #                               ifndef SEMAPHORES_NOMMES
 2012:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 2013:                                 sem_post(&semaphore_gestionnaires_signaux);
 2014:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 2015:                                 sem_destroy(&((*s_etat_processus)
 2016:                                         .semaphore_fork));
 2017: #                               else
 2018:                                 sem_post((*s_etat_processus).semaphore_fork);
 2019:                                 sem_post(semaphore_gestionnaires_signaux);
 2020:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 2021:                                         getpid(), SEM_SIGNAUX);
 2022:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 2023:                                         getpid(), pthread_self(), SEM_FORK);
 2024: #                               endif
 2025: 
 2026:                                 liberation_contexte_cas(s_etat_processus);
 2027:                                 liberation_queue_signaux(s_etat_processus);
 2028: 
 2029: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2030:                                 stackoverflow_deinstall_handler();
 2031: #                               endif
 2032: 
 2033:                                 if ((*s_etat_processus).langue == 'F')
 2034:                                 {
 2035:                                     printf("+++Erreur : options -i et -S "
 2036:                                             "incompatibles\n");
 2037:                                 }
 2038:                                 else
 2039:                                 {
 2040:                                     printf("+++Error : incompatible options -S "
 2041:                                             "and -i\n");
 2042:                                 }
 2043: 
 2044:                                 return(EXIT_FAILURE);
 2045:                             }
 2046: 
 2047:                             option_S = d_vrai;
 2048: 
 2049:                             while(*(++argv[0]) == ' ');
 2050:                             argv[0]--;
 2051: 
 2052:                             if ((*(++argv[0])) != '\0')
 2053:                             {
 2054:                                 if (((*s_etat_processus).definitions_chainees =
 2055:                                         malloc((strlen(argv[0]) + 1) *
 2056:                                         sizeof(unsigned char))) == NULL)
 2057:                                 {
 2058: #                                   ifndef SEMAPHORES_NOMMES
 2059:                                     sem_post(&((*s_etat_processus)
 2060:                                             .semaphore_fork));
 2061:                                     sem_post(&semaphore_gestionnaires_signaux);
 2062:                                     sem_destroy(
 2063:                                             &semaphore_gestionnaires_signaux);
 2064:                                     sem_destroy(&((*s_etat_processus)
 2065:                                             .semaphore_fork));
 2066: #                                   else
 2067:                                     sem_post((*s_etat_processus)
 2068:                                             .semaphore_fork);
 2069:                                     sem_post(semaphore_gestionnaires_signaux);
 2070:                                     sem_destroy2(
 2071:                                             semaphore_gestionnaires_signaux,
 2072:                                             getpid(), SEM_SIGNAUX);
 2073:                                     sem_destroy3((*s_etat_processus)
 2074:                                             .semphore_fork, getpid(),
 2075:                                             pthread_self(), SEM_FORK);
 2076: #                                   endif
 2077: 
 2078:                                     liberation_contexte_cas(s_etat_processus);
 2079:                                     liberation_queue_signaux(s_etat_processus);
 2080: 
 2081: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2082:                                     stackoverflow_deinstall_handler();
 2083: #                                   endif
 2084: 
 2085:                                     if ((*s_etat_processus).langue == 'F')
 2086:                                     {
 2087:                                         printf("+++Système : Mémoire "
 2088:                                                 "insuffisante\n");
 2089:                                     }
 2090:                                     else
 2091:                                     {
 2092:                                         printf("+++System : Not enough "
 2093:                                                 "memory\n");
 2094:                                     }
 2095: 
 2096:                                     return(EXIT_FAILURE);
 2097:                                 }
 2098: 
 2099:                                 ptr = (*s_etat_processus).definitions_chainees;
 2100: 
 2101:                                 while(*(argv[0]) != '\0')
 2102:                                 {
 2103:                                     *(ptr++) = *(argv[0]++);
 2104:                                 }
 2105: 
 2106:                                 (*ptr) = '\0';
 2107: 
 2108:                                 argv[0]--;
 2109:                                 presence_definition = 'O';
 2110:                             }
 2111:                             else if ((--argc) > 0)
 2112:                             {
 2113:                                 argv++;
 2114: 
 2115:                                 if (((*s_etat_processus).definitions_chainees =
 2116:                                         malloc((strlen(argv[0]) + 1) *
 2117:                                         sizeof(unsigned char))) == NULL)
 2118:                                 {
 2119: #                                   ifndef SEMAPHORES_NOMMES
 2120:                                     sem_post(&((*s_etat_processus)
 2121:                                             .semaphore_fork));
 2122:                                     sem_post(&semaphore_gestionnaires_signaux);
 2123:                                     sem_destroy(
 2124:                                             &semaphore_gestionnaires_signaux);
 2125:                                     sem_destroy(&((*s_etat_processus)
 2126:                                             .semaphore_fork));
 2127: #                                   else
 2128:                                     sem_post((*s_etat_processus)
 2129:                                             .semaphore_fork);
 2130:                                     sem_post(semaphore_gestionnaires_signaux);
 2131:                                     sem_destroy2(
 2132:                                             semaphore_gestionnaires_signaux,
 2133:                                             getpid(), SEM_SIGNAUX);
 2134:                                     sem_destroy3((*s_etat_processus)
 2135:                                             .semphore_fork, getpid(),
 2136:                                             pthread_self(), SEM_FORK);
 2137: #                                   endif
 2138: 
 2139:                                     liberation_contexte_cas(s_etat_processus);
 2140:                                     liberation_queue_signaux(s_etat_processus);
 2141: 
 2142: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2143:                                     stackoverflow_deinstall_handler();
 2144: #                                   endif
 2145: 
 2146:                                     if ((*s_etat_processus).langue == 'F')
 2147:                                     {
 2148:                                         printf("+++Système : Mémoire "
 2149:                                                 "insuffisante\n");
 2150:                                     }
 2151:                                     else
 2152:                                     {
 2153:                                         printf("+++System : Not enough "
 2154:                                                 "memory\n");
 2155:                                     }
 2156: 
 2157:                                     return(EXIT_FAILURE);
 2158:                                 }
 2159: 
 2160:                                 ptr = (*s_etat_processus).definitions_chainees;
 2161: 
 2162:                                 while(*(argv[0]) != '\0')
 2163:                                 {
 2164:                                     *(ptr++) = *(argv[0]++);
 2165:                                 }
 2166: 
 2167:                                 (*ptr) = '\0';
 2168: 
 2169:                                 argv[0]--;
 2170:                                 presence_definition = 'O';
 2171:                             }
 2172:                             else
 2173:                             {
 2174: #                               ifndef SEMAPHORES_NOMMES
 2175:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 2176:                                 sem_post(&semaphore_gestionnaires_signaux);
 2177:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 2178:                                 sem_destroy(&((*s_etat_processus)
 2179:                                         .semaphore_fork));
 2180: #                               else
 2181:                                 sem_post((*s_etat_processus).semaphore_fork);
 2182:                                 sem_post(semaphore_gestionnaires_signaux);
 2183:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 2184:                                         getpid(), SEM_SIGNAUX);
 2185:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 2186:                                         getpid(), pthread_self(), SEM_FORK);
 2187: #                               endif
 2188: 
 2189:                                 liberation_contexte_cas(s_etat_processus);
 2190:                                 liberation_queue_signaux(s_etat_processus);
 2191: 
 2192: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2193:                                 stackoverflow_deinstall_handler();
 2194: #                               endif
 2195: 
 2196:                                 if ((*s_etat_processus).langue == 'F')
 2197:                                 {
 2198:                                     printf("+++Erreur : Aucun script "
 2199:                                             "spécifié après l'option -S\n");
 2200:                                 }
 2201:                                 else
 2202:                                 {
 2203:                                     printf("+++Error : Script required after "
 2204:                                             "-S option\n");
 2205:                                 }
 2206: 
 2207:                                 return(EXIT_FAILURE);
 2208:                             }
 2209: 
 2210:                             if (((*s_etat_processus).definitions_chainees =
 2211:                                     compactage((*s_etat_processus)
 2212:                                     .definitions_chainees)) == NULL)
 2213:                             {
 2214: #                               ifndef SEMAPHORES_NOMMES
 2215:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 2216:                                 sem_post(&semaphore_gestionnaires_signaux);
 2217:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 2218:                                 sem_destroy(&((*s_etat_processus)
 2219:                                         .semaphore_fork));
 2220: #                               else
 2221:                                 sem_post((*s_etat_processus).semaphore_fork);
 2222:                                 sem_post(semaphore_gestionnaires_signaux);
 2223:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 2224:                                         getpid(), SEM_SIGNAUX);
 2225:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 2226:                                         getpid(), pthread_self(), SEM_FORK);
 2227: #                               endif
 2228: 
 2229:                                 liberation_contexte_cas(s_etat_processus);
 2230:                                 liberation_queue_signaux(s_etat_processus);
 2231: 
 2232: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2233:                                 stackoverflow_deinstall_handler();
 2234: #                               endif
 2235: 
 2236:                                 if ((*s_etat_processus).langue == 'F')
 2237:                                 {
 2238:                                     printf("+++Système : Mémoire "
 2239:                                             "insuffisante\n");
 2240:                                 }
 2241:                                 else
 2242:                                 {
 2243:                                     printf("+++System : Not enough "
 2244:                                             "memory\n");
 2245:                                 }
 2246: 
 2247:                                 return(EXIT_FAILURE);
 2248:                             }
 2249: 
 2250:                             (*s_etat_processus).longueur_definitions_chainees =
 2251:                                     strlen((*s_etat_processus)
 2252:                                     .definitions_chainees);
 2253: 
 2254:                             break;
 2255:                         }
 2256: 
 2257:                         case 't' :
 2258:                         {
 2259:                             if (option_t == d_vrai)
 2260:                             {
 2261: #                               ifndef SEMAPHORES_NOMMES
 2262:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 2263:                                 sem_post(&semaphore_gestionnaires_signaux);
 2264:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 2265:                                 sem_destroy(&((*s_etat_processus)
 2266:                                         .semaphore_fork));
 2267: #                               else
 2268:                                 sem_post((*s_etat_processus).semaphore_fork);
 2269:                                 sem_post(semaphore_gestionnaires_signaux);
 2270:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 2271:                                         getpid(), SEM_SIGNAUX);
 2272:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 2273:                                         getpid(), pthread_self(), SEM_FORK);
 2274: #                               endif
 2275: 
 2276:                                 liberation_contexte_cas(s_etat_processus);
 2277:                                 liberation_queue_signaux(s_etat_processus);
 2278: 
 2279: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2280:                                 stackoverflow_deinstall_handler();
 2281: #                               endif
 2282: 
 2283:                                 if ((*s_etat_processus).langue == 'F')
 2284:                                 {
 2285:                                     printf("+++Erreur : option -t présente "
 2286:                                             "plus d'une fois\n");
 2287:                                 }
 2288:                                 else
 2289:                                 {
 2290:                                     printf("+++Error : more than one -t "
 2291:                                             "on command line");
 2292:                                 }
 2293: 
 2294:                                 return(EXIT_FAILURE);
 2295:                             }
 2296: 
 2297:                             option_t = d_vrai;
 2298:                             (*s_etat_processus).debug = d_vrai;
 2299: 
 2300:                             while(*(++argv[0]) == ' ');
 2301:                             argv[0]--;
 2302: 
 2303:                             if ((*(++argv[0])) != '\0')
 2304:                             {
 2305:                                 if ((type_debug = malloc((strlen(argv[0]) + 1) *
 2306:                                         sizeof(unsigned char))) == NULL)
 2307:                                 {
 2308: #                                   ifndef SEMAPHORES_NOMMES
 2309:                                     sem_post(&((*s_etat_processus)
 2310:                                             .semaphore_fork));
 2311:                                     sem_post(&semaphore_gestionnaires_signaux);
 2312:                                     sem_destroy(
 2313:                                             &semaphore_gestionnaires_signaux);
 2314:                                     sem_destroy(&((*s_etat_processus)
 2315:                                             .semaphore_fork));
 2316: #                                   else
 2317:                                     sem_post((*s_etat_processus)
 2318:                                             .semaphore_fork);
 2319:                                     sem_post(semaphore_gestionnaires_signaux);
 2320:                                     sem_destroy2(
 2321:                                             semaphore_gestionnaires_signaux,
 2322:                                             getpid(), SEM_SIGNAUX);
 2323:                                     sem_destroy3((*s_etat_processus)
 2324:                                             .semphore_fork, getpid(),
 2325:                                             pthread_self(), SEM_FORK);
 2326: #                                   endif
 2327: 
 2328:                                     liberation_contexte_cas(s_etat_processus);
 2329:                                     liberation_queue_signaux(s_etat_processus);
 2330: 
 2331: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2332:                                     stackoverflow_deinstall_handler();
 2333: #                                   endif
 2334: 
 2335:                                     if ((*s_etat_processus).langue == 'F')
 2336:                                     {
 2337:                                         printf("+++Système : Mémoire "
 2338:                                                 "insuffisante\n");
 2339:                                     }
 2340:                                     else
 2341:                                     {
 2342:                                         printf("+++System : Not enough "
 2343:                                                 "memory\n");
 2344:                                     }
 2345: 
 2346:                                     return(EXIT_FAILURE);
 2347:                                 }
 2348: 
 2349:                                 ptr = type_debug;
 2350: 
 2351:                                 while((*(argv[0]) != '\0') &&
 2352:                                         (*(argv[0]) != ' '))
 2353:                                 {
 2354:                                     *(ptr++) = *(argv[0]++);
 2355:                                 }
 2356: 
 2357:                                 (*ptr) = '\0';
 2358: 
 2359:                                 argv[0]--;
 2360:                             }
 2361:                             else if ((--argc) > 0)
 2362:                             {
 2363:                                 argv++;
 2364: 
 2365:                                 if ((type_debug =
 2366:                                         malloc((strlen(argv[0]) + 1) *
 2367:                                         sizeof(unsigned char))) == NULL)
 2368:                                 {
 2369: #                                   ifndef SEMAPHORES_NOMMES
 2370:                                     sem_post(&((*s_etat_processus)
 2371:                                             .semaphore_fork));
 2372:                                     sem_post(&semaphore_gestionnaires_signaux);
 2373:                                     sem_destroy(
 2374:                                             &semaphore_gestionnaires_signaux);
 2375:                                     sem_destroy(&((*s_etat_processus)
 2376:                                             .semaphore_fork));
 2377: #                                   else
 2378:                                     sem_post((*s_etat_processus)
 2379:                                             .semaphore_fork);
 2380:                                     sem_post(semaphore_gestionnaires_signaux);
 2381:                                     sem_destroy2(
 2382:                                             semaphore_gestionnaires_signaux,
 2383:                                             getpid(), SEM_SIGNAUX);
 2384:                                     sem_destroy3((*s_etat_processus)
 2385:                                             .semphore_fork, getpid(),
 2386:                                             pthread_self(), SEM_FORK);
 2387: #                                   endif
 2388: 
 2389:                                     liberation_contexte_cas(s_etat_processus);
 2390:                                     liberation_queue_signaux(s_etat_processus);
 2391: 
 2392: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2393:                                     stackoverflow_deinstall_handler();
 2394: #                                   endif
 2395: 
 2396:                                     if ((*s_etat_processus).langue == 'F')
 2397:                                     {
 2398:                                         printf("+++Système : Mémoire "
 2399:                                                 "insuffisante\n");
 2400:                                     }
 2401:                                     else
 2402:                                     {
 2403:                                         printf("+++System : Not enough "
 2404:                                                 "memory\n");
 2405:                                     }
 2406: 
 2407:                                     return(EXIT_FAILURE);
 2408:                                 }
 2409: 
 2410:                                 ptr = type_debug;
 2411: 
 2412:                                 while(*(argv[0]) != '\0')
 2413:                                 {
 2414:                                     *(ptr++) = *(argv[0]++);
 2415:                                 }
 2416: 
 2417:                                 (*ptr) = '\0';
 2418: 
 2419:                                 argv[0]--;
 2420:                             }
 2421:                             else
 2422:                             {
 2423: #                               ifndef SEMAPHORES_NOMMES
 2424:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 2425:                                 sem_post(&semaphore_gestionnaires_signaux);
 2426:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 2427:                                 sem_destroy(&((*s_etat_processus)
 2428:                                         .semaphore_fork));
 2429: #                               else
 2430:                                 sem_post((*s_etat_processus).semaphore_fork);
 2431:                                 sem_post(semaphore_gestionnaires_signaux);
 2432:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 2433:                                         getpid(), SEM_SIGNAUX);
 2434:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 2435:                                         getpid(), pthread_self(), SEM_FORK);
 2436: #                               endif
 2437: 
 2438:                                 liberation_contexte_cas(s_etat_processus);
 2439:                                 liberation_queue_signaux(s_etat_processus);
 2440: 
 2441: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2442:                                 stackoverflow_deinstall_handler();
 2443: #                               endif
 2444: 
 2445:                                 if ((*s_etat_processus).langue == 'F')
 2446:                                 {
 2447:                                     printf("+++Erreur : Aucun niveau "
 2448:                                             "de débogage spécifié après "
 2449:                                             "l'option -t\n");
 2450:                                 }
 2451:                                 else
 2452:                                 {
 2453:                                     printf("+++Error : Debug level not "
 2454:                                             "specified after -t option\n");
 2455:                                 }
 2456: 
 2457:                                 return(EXIT_FAILURE);
 2458:                             }
 2459: 
 2460:                             ptr = type_debug;
 2461: 
 2462:                             while(*ptr != '\0')
 2463:                             {
 2464:                                 switch(*ptr)
 2465:                                 {
 2466:                                     case '0':
 2467:                                     case '1':
 2468:                                     case '2':
 2469:                                     case '3':
 2470:                                     case '4':
 2471:                                     case '5':
 2472:                                     case '6':
 2473:                                     case '7':
 2474:                                     case '8':
 2475:                                     case '9':
 2476:                                     case 'A':
 2477:                                     case 'B':
 2478:                                     case 'C':
 2479:                                     case 'D':
 2480:                                     case 'E':
 2481:                                     case 'F':
 2482:                                     {
 2483:                                         break;
 2484:                                     }
 2485: 
 2486:                                     default:
 2487:                                     {
 2488: #                                       ifndef SEMAPHORES_NOMMES
 2489:                                         sem_post(&((*s_etat_processus)
 2490:                                                 .semaphore_fork));
 2491:                                         sem_post(
 2492:                                                 &semaphore_gestionnaires_signaux
 2493:                                                 );
 2494:                                         sem_destroy(
 2495:                                                 &semaphore_gestionnaires_signaux
 2496:                                                 );
 2497:                                         sem_destroy(&((*s_etat_processus)
 2498:                                                 .semaphore_fork));
 2499: #                                       else
 2500:                                         sem_post((*s_etat_processus)
 2501:                                                 .semaphore_fork);
 2502:                                         sem_post(
 2503:                                                 semaphore_gestionnaires_signaux
 2504:                                                 );
 2505:                                         sem_destroy2(
 2506:                                                 semaphore_gestionnaires_signaux,
 2507:                                                 getpid(), SEM_SIGNAUX);
 2508:                                         sem_destroy3((*s_etat_processus)
 2509:                                                 .semphore_fork, getpid(),
 2510:                                                 pthread_self(), SEM_FORK);
 2511: #                                       endif
 2512: 
 2513:                                         liberation_contexte_cas(
 2514:                                                 s_etat_processus);
 2515:                                         liberation_queue_signaux(
 2516:                                                 s_etat_processus);
 2517: 
 2518: #                                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2519:                                         stackoverflow_deinstall_handler();
 2520: #                                       endif
 2521: 
 2522:                                         if ((*s_etat_processus).langue == 'F')
 2523:                                         {
 2524:                                             printf("+++Erreur : Niveau "
 2525:                                                     "de débogage non "
 2526:                                                     "hexadécimal\n");
 2527:                                         }
 2528:                                         else
 2529:                                         {
 2530:                                             printf("+++Error : Debug level must"
 2531:                                                     " be hexadecimal "
 2532:                                                     "integer\n");
 2533:                                         }
 2534: 
 2535:                                         return(EXIT_FAILURE);
 2536:                                     }
 2537:                                 }
 2538: 
 2539:                                 ptr++;
 2540:                             }
 2541: 
 2542:                             if (sscanf(type_debug, "%llX",
 2543:                                     &((*s_etat_processus).type_debug)) != 1)
 2544:                             {
 2545: #                               ifndef SEMAPHORES_NOMMES
 2546:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 2547:                                 sem_post(&semaphore_gestionnaires_signaux);
 2548:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 2549:                                 sem_destroy(&((*s_etat_processus)
 2550:                                         .semaphore_fork));
 2551: #                               else
 2552:                                 sem_post((*s_etat_processus).semaphore_fork);
 2553:                                 sem_post(semaphore_gestionnaires_signaux);
 2554:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 2555:                                         getpid(), SEM_SIGNAUX);
 2556:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 2557:                                         getpid(), pthread_self(), SEM_FORK);
 2558: #                               endif
 2559: 
 2560:                                 liberation_contexte_cas(s_etat_processus);
 2561:                                 liberation_queue_signaux(s_etat_processus);
 2562: 
 2563: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2564:                                 stackoverflow_deinstall_handler();
 2565: #                               endif
 2566: 
 2567:                                 if ((*s_etat_processus).langue == 'F')
 2568:                                 {
 2569:                                     printf("+++Erreur : Niveau "
 2570:                                             "de débogage non entier\n");
 2571:                                 }
 2572:                                 else
 2573:                                 {
 2574:                                     printf("+++Error : Debug level must"
 2575:                                             " be integer\n");
 2576:                                 }
 2577: 
 2578:                                 return(EXIT_FAILURE);
 2579:                             }
 2580: 
 2581:                             free(type_debug);
 2582:                             break;
 2583:                         }
 2584: 
 2585:                         case 'v' :
 2586:                         {
 2587:                             if (option_v == d_vrai)
 2588:                             {
 2589: #                               ifndef SEMAPHORES_NOMMES
 2590:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 2591:                                 sem_post(&semaphore_gestionnaires_signaux);
 2592:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 2593:                                 sem_destroy(&((*s_etat_processus)
 2594:                                         .semaphore_fork));
 2595: #                               else
 2596:                                 sem_post((*s_etat_processus).semaphore_fork);
 2597:                                 sem_post(semaphore_gestionnaires_signaux);
 2598:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 2599:                                         getpid(), SEM_SIGNAUX);
 2600:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 2601:                                         getpid(), pthread_self(), SEM_FORK);
 2602: #                               endif
 2603: 
 2604:                                 liberation_contexte_cas(s_etat_processus);
 2605:                                 liberation_queue_signaux(s_etat_processus);
 2606: 
 2607: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2608:                                 stackoverflow_deinstall_handler();
 2609: #                               endif
 2610: 
 2611:                                 if ((*s_etat_processus).langue == 'F')
 2612:                                 {
 2613:                                     printf("+++Erreur : option -v présente "
 2614:                                             "plus d'une fois\n");
 2615:                                 }
 2616:                                 else
 2617:                                 {
 2618:                                     printf("+++Error : more than one -v "
 2619:                                             "on command line");
 2620:                                 }
 2621: 
 2622:                                 return(EXIT_FAILURE);
 2623:                             }
 2624: 
 2625:                             option_v = d_vrai;
 2626:                             printf("\n");
 2627: 
 2628:                             if ((*s_etat_processus).langue == 'F')
 2629:                             {
 2630:                                 printf("  Reverse Polish Lisp/2 version %s "
 2631:                                         "pour systèmes "
 2632:                                         "POSIX\n", d_version_rpl);
 2633:                                 printf("      Langage procédural de très haut "
 2634:                                         "niveau, semi-compilé, "
 2635:                                         "extensible,\n");
 2636:                                 printf("      destiné principalement aux "
 2637:                                         "calculs scientifiques et "
 2638:                                         "symboliques\n");
 2639:                                 printf("%s\n", copyright);
 2640:                             }
 2641:                             else
 2642:                             {
 2643:                                 printf("  Reverse Polish Lisp/2 version %s "
 2644:                                         "for POSIX operating systems\n",
 2645:                                         d_version_rpl);
 2646:                                 printf("      Half-compiled, high-level "
 2647:                                         "procedural language,\n");
 2648:                                 printf("      mainly aiming at scientific "
 2649:                                         "calculations\n");
 2650:                                 printf("%s\n", copyright_anglais);
 2651:                             }
 2652: 
 2653:                             printf("\n");
 2654:                             break;
 2655:                         }
 2656: 
 2657:                         case '-':
 2658:                         case ' ':
 2659:                         {
 2660:                             break;
 2661:                         }
 2662: 
 2663:                         default :
 2664:                         {
 2665:                             if ((*s_etat_processus).langue == 'F')
 2666:                             {
 2667:                                 printf("+++Information : Option -%c inconnue\n",
 2668:                                         option);
 2669:                             }
 2670:                             else
 2671:                             {
 2672:                                 printf("+++Warning : -%c option unknown\n",
 2673:                                         option);
 2674:                             }
 2675: 
 2676:                             informations(s_etat_processus);
 2677:                             break;
 2678:                         }
 2679:                     }
 2680:                 }
 2681:             }
 2682:             else
 2683:             {
 2684:                 if (presence_definition == 'O')
 2685:                 {
 2686:                     argc = 0;
 2687: 
 2688:                     if ((*s_etat_processus).langue == 'F')
 2689:                     {
 2690:                         printf("+++Erreur : Plusieurs définitions\n");
 2691:                     }
 2692:                     else
 2693:                     {
 2694:                         printf("+++Error : More than one definition\n");
 2695:                     }
 2696: 
 2697:                     erreur = d_erreur;
 2698:                 }
 2699:                 else
 2700:                 {
 2701:                     (*s_etat_processus).nom_fichier_source = argv[0];
 2702:                     presence_definition = 'O';
 2703:                 }
 2704:             }
 2705:         }
 2706: 
 2707:         /*
 2708:          * Dans le cas où le programme est appelé avec l'option -d,
 2709:          * on ne récupère par les signaux de violation d'accès. On
 2710:          * tente simplement la récupération des dépassements de pile.
 2711:          */
 2712: 
 2713:         if (debug == d_faux)
 2714:         {
 2715: #   ifdef HAVE_SIGSEGV_RECOVERY
 2716:             if (sigsegv_install_handler(interruption_violation_access) != 0)
 2717:             {
 2718: #               ifndef SEMAPHORES_NOMMES
 2719:                     sem_post(&((*s_etat_processus).semaphore_fork));
 2720:                     sem_post(&semaphore_gestionnaires_signaux);
 2721:                     sem_destroy(&semaphore_gestionnaires_signaux);
 2722:                     sem_destroy(&((*s_etat_processus)
 2723:                             .semaphore_fork));
 2724: #               else
 2725:                     sem_post((*s_etat_processus).semaphore_fork);
 2726:                     sem_post(semaphore_gestionnaires_signaux);
 2727:                     sem_destroy2(semaphore_gestionnaires_signaux,
 2728:                             getpid(), SEM_SIGNAUX);
 2729:                     sem_destroy3((*s_etat_processus).semphore_fork,
 2730:                             getpid(), pthread_self(), SEM_FORK);
 2731: #               endif
 2732: 
 2733:                 liberation_contexte_cas(s_etat_processus);
 2734:                 liberation_queue_signaux(s_etat_processus);
 2735: 
 2736: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2737:                     stackoverflow_deinstall_handler();
 2738: #               endif
 2739: 
 2740:                 erreur = d_es_signal;
 2741: 
 2742:                 if ((*s_etat_processus).langue == 'F')
 2743:                 {
 2744:                     printf("+++Système : Initialisation de la pile alternative "
 2745:                             "impossible\n");
 2746:                 }
 2747:                 else
 2748:                 {
 2749:                     printf("+++System : Initialization of alternate "
 2750:                             "stack failed\n");
 2751:                 }
 2752: 
 2753:                 return(EXIT_FAILURE);
 2754:             }
 2755: #   else
 2756:             action.sa_handler = interruption3;
 2757:             action.sa_flags = 0;
 2758: 
 2759:             if (sigaction(SIGSEGV, &action, NULL) != 0)
 2760:             {
 2761: #               ifndef SEMAPHORES_NOMMES
 2762:                     sem_post(&((*s_etat_processus).semaphore_fork));
 2763:                     sem_post(&semaphore_gestionnaires_signaux);
 2764:                     sem_destroy(&semaphore_gestionnaires_signaux);
 2765:                     sem_destroy(&((*s_etat_processus)
 2766:                             .semaphore_fork));
 2767: #               else
 2768:                     sem_post((*s_etat_processus).semaphore_fork);
 2769:                     sem_post(semaphore_gestionnaires_signaux);
 2770:                     sem_destroy2(semaphore_gestionnaires_signaux,
 2771:                             getpid(), SEM_SIGNAUX);
 2772:                     sem_destroy3((*s_etat_processus).semphore_fork,
 2773:                             getpid(), pthread_self(), SEM_FORK);
 2774: #               endif
 2775: 
 2776:                 liberation_contexte_cas(s_etat_processus);
 2777:                 liberation_queue_signaux(s_etat_processus);
 2778: 
 2779: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2780:                     stackoverflow_deinstall_handler();
 2781: #               endif
 2782: 
 2783:                 if ((*s_etat_processus).langue == 'F')
 2784:                 {
 2785:                     printf("+++Système : Initialisation des signaux POSIX "
 2786:                             "impossible\n");
 2787:                 }
 2788:                 else
 2789:                 {
 2790:                     printf("+++System : Initialization of POSIX signals "
 2791:                             "failed\n");
 2792:                 }
 2793: 
 2794:                 return(EXIT_FAILURE);
 2795:             }
 2796: 
 2797:             signal_test = SIGTEST;
 2798:             kill(getpid(), SIGSEGV);
 2799: 
 2800:             attente.tv_sec = 0;
 2801:             attente.tv_nsec = 1000000;
 2802: 
 2803:             for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
 2804:             {
 2805:                 nanosleep(&attente, NULL);
 2806:             }
 2807: 
 2808:             if (signal_test != SIGSEGV)
 2809:             {
 2810: #               ifndef SEMAPHORES_NOMMES
 2811:                     sem_post(&((*s_etat_processus).semaphore_fork));
 2812:                     sem_post(&semaphore_gestionnaires_signaux);
 2813:                     sem_destroy(&semaphore_gestionnaires_signaux);
 2814:                     sem_destroy(&((*s_etat_processus)
 2815:                             .semaphore_fork));
 2816: #               else
 2817:                     sem_post((*s_etat_processus).semaphore_fork);
 2818:                     sem_post(semaphore_gestionnaires_signaux);
 2819:                     sem_destroy2(semaphore_gestionnaires_signaux,
 2820:                             getpid(), SEM_SIGNAUX);
 2821:                     sem_destroy3((*s_etat_processus).semphore_fork,
 2822:                             getpid(), pthread_self(), SEM_FORK);
 2823: #               endif
 2824: 
 2825:                 liberation_contexte_cas(s_etat_processus);
 2826:                 liberation_queue_signaux(s_etat_processus);
 2827: 
 2828: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2829:                     stackoverflow_deinstall_handler();
 2830: #               endif
 2831: 
 2832:                 erreur = d_es_signal;
 2833: 
 2834:                 if ((*s_etat_processus).langue == 'F')
 2835:                 {
 2836:                     printf("+++Système : Initialisation des signaux POSIX "
 2837:                             "impossible\n");
 2838:                 }
 2839:                 else
 2840:                 {
 2841:                     printf("+++System : Initialization of POSIX signals "
 2842:                             "failed\n");
 2843:                 }
 2844: 
 2845:                 return(EXIT_FAILURE);
 2846:             }
 2847: #   endif
 2848: 
 2849:             action.sa_handler = interruption3;
 2850:             action.sa_flags = 0;
 2851: 
 2852:             if (sigaction(SIGBUS, &action, NULL) != 0)
 2853:             {
 2854: #               ifndef SEMAPHORES_NOMMES
 2855:                     sem_post(&((*s_etat_processus).semaphore_fork));
 2856:                     sem_post(&semaphore_gestionnaires_signaux);
 2857:                     sem_destroy(&semaphore_gestionnaires_signaux);
 2858:                     sem_destroy(&((*s_etat_processus)
 2859:                             .semaphore_fork));
 2860: #               else
 2861:                     sem_post((*s_etat_processus).semaphore_fork);
 2862:                     sem_post(semaphore_gestionnaires_signaux);
 2863:                     sem_destroy2(semaphore_gestionnaires_signaux,
 2864:                             getpid(), SEM_SIGNAUX);
 2865:                     sem_destroy3((*s_etat_processus).semphore_fork,
 2866:                             getpid(), pthread_self(), SEM_FORK);
 2867: #               endif
 2868: 
 2869:                 liberation_contexte_cas(s_etat_processus);
 2870:                 liberation_queue_signaux(s_etat_processus);
 2871: 
 2872: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2873:                     stackoverflow_deinstall_handler();
 2874: #               endif
 2875: 
 2876: #               ifdef HAVE_SIGSEGV_RECOVERY
 2877:                     if (debug == d_faux)
 2878:                     {
 2879:                         sigsegv_deinstall_handler();
 2880:                     }
 2881: #               endif
 2882: 
 2883:                 if ((*s_etat_processus).langue == 'F')
 2884:                 {
 2885:                     printf("+++Système : Initialisation des signaux POSIX "
 2886:                             "impossible\n");
 2887:                 }
 2888:                 else
 2889:                 {
 2890:                     printf("+++System : Initialization of POSIX signals "
 2891:                             "failed\n");
 2892:                 }
 2893: 
 2894:                 return(EXIT_FAILURE);
 2895:             }
 2896: 
 2897:             signal_test = SIGTEST;
 2898:             kill(getpid(), SIGBUS);
 2899: 
 2900:             attente.tv_sec = 0;
 2901:             attente.tv_nsec = 1000000;
 2902: 
 2903:             for(i = 0; (i < 1000) && (signal_test == SIGTEST); i++)
 2904:             {
 2905:                 nanosleep(&attente, NULL);
 2906:             }
 2907: 
 2908:             if (signal_test != SIGBUS)
 2909:             {
 2910: #               ifndef SEMAPHORES_NOMMES
 2911:                     sem_post(&((*s_etat_processus).semaphore_fork));
 2912:                     sem_post(&semaphore_gestionnaires_signaux);
 2913:                     sem_destroy(&semaphore_gestionnaires_signaux);
 2914:                     sem_destroy(&((*s_etat_processus)
 2915:                             .semaphore_fork));
 2916: #               else
 2917:                     sem_post((*s_etat_processus).semaphore_fork);
 2918:                     sem_post(semaphore_gestionnaires_signaux);
 2919:                     sem_destroy2(semaphore_gestionnaires_signaux,
 2920:                             getpid(), SEM_SIGNAUX);
 2921:                     sem_destroy3((*s_etat_processus).semphore_fork,
 2922:                             getpid(), pthread_self(), SEM_FORK);
 2923: #               endif
 2924: 
 2925:                 liberation_contexte_cas(s_etat_processus);
 2926:                 liberation_queue_signaux(s_etat_processus);
 2927: 
 2928: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2929:                     stackoverflow_deinstall_handler();
 2930: #               endif
 2931: 
 2932: #               ifdef HAVE_SIGSEGV_RECOVERY
 2933:                     if (debug == d_faux)
 2934:                     {
 2935:                         sigsegv_deinstall_handler();
 2936:                     }
 2937: #               endif
 2938: 
 2939:                 erreur = d_es_signal;
 2940: 
 2941:                 if ((*s_etat_processus).langue == 'F')
 2942:                 {
 2943:                     printf("+++Système : Initialisation des signaux POSIX "
 2944:                             "impossible\n");
 2945:                 }
 2946:                 else
 2947:                 {
 2948:                     printf("+++System : Initialization of POSIX signals "
 2949:                             "failed\n");
 2950:                 }
 2951: 
 2952:                 return(EXIT_FAILURE);
 2953:             }
 2954: 
 2955:         }
 2956: 
 2957:         if (option_n == d_vrai)
 2958:         {
 2959:             action.sa_handler = interruption4;
 2960:             action.sa_flags = 0;
 2961: 
 2962:             if (sigaction(SIGHUP, &action, NULL) != 0)
 2963:             {
 2964: #               ifndef SEMAPHORES_NOMMES
 2965:                     sem_post(&((*s_etat_processus).semaphore_fork));
 2966:                     sem_post(&semaphore_gestionnaires_signaux);
 2967:                     sem_destroy(&semaphore_gestionnaires_signaux);
 2968:                     sem_destroy(&((*s_etat_processus)
 2969:                             .semaphore_fork));
 2970: #               else
 2971:                     sem_post((*s_etat_processus).semaphore_fork);
 2972:                     sem_post(semaphore_gestionnaires_signaux);
 2973:                     sem_destroy2(semaphore_gestionnaires_signaux,
 2974:                             getpid(), SEM_SIGNAUX);
 2975:                     sem_destroy3((*s_etat_processus).semphore_fork,
 2976:                             getpid(), pthread_self(), SEM_FORK);
 2977: #               endif
 2978: 
 2979:                 liberation_contexte_cas(s_etat_processus);
 2980:                 liberation_queue_signaux(s_etat_processus);
 2981: 
 2982: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 2983:                     stackoverflow_deinstall_handler();
 2984: #               endif
 2985: 
 2986: #               ifdef HAVE_SIGSEGV_RECOVERY
 2987:                     if (debug == d_faux)
 2988:                     {
 2989:                         sigsegv_deinstall_handler();
 2990:                     }
 2991: #               endif
 2992: 
 2993:                 if ((*s_etat_processus).langue == 'F')
 2994:                 {
 2995:                     printf("+++Système : Initialisation des signaux POSIX "
 2996:                             "impossible\n");
 2997:                 }
 2998:                 else
 2999:                 {
 3000:                     printf("+++System : Initialization of POSIX signals "
 3001:                             "failed\n");
 3002:                 }
 3003: 
 3004:                 return(EXIT_FAILURE);
 3005:             }
 3006:         }
 3007: 
 3008:         if (mode_interactif == d_vrai)
 3009:         {
 3010:             printf("\n");
 3011: 
 3012:             if ((*s_etat_processus).langue == 'F')
 3013:             {
 3014:                 printf("+++Ce logiciel est un logiciel libre"
 3015:                         " sans aucune garantie de "
 3016:                         "fonctionnement.\n");
 3017:                 printf("+++Pour plus de détails, utilisez la "
 3018:                         "commande 'warranty'.\n");
 3019:             }
 3020:             else
 3021:             {
 3022:                 printf("+++This is a free software with "
 3023:                         "absolutely no warranty.\n");
 3024:                 printf("+++For details, type 'warranty'.\n");
 3025:             }
 3026: 
 3027:             printf("\n");
 3028: 
 3029:             traitement_fichier_temporaire = 'Y';
 3030: 
 3031:             if ((nom_fichier_temporaire =
 3032:                     creation_nom_fichier(s_etat_processus, (*s_etat_processus)
 3033:                     .chemin_fichiers_temporaires)) == NULL)
 3034:             {
 3035: #               ifndef SEMAPHORES_NOMMES
 3036:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3037:                     sem_post(&semaphore_gestionnaires_signaux);
 3038:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3039:                     sem_destroy(&((*s_etat_processus)
 3040:                             .semaphore_fork));
 3041: #               else
 3042:                     sem_post((*s_etat_processus).semaphore_fork);
 3043:                     sem_post(semaphore_gestionnaires_signaux);
 3044:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3045:                             getpid(), SEM_SIGNAUX);
 3046:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3047:                             getpid(), pthread_self(), SEM_FORK);
 3048: #               endif
 3049: 
 3050:                 liberation_contexte_cas(s_etat_processus);
 3051:                 liberation_queue_signaux(s_etat_processus);
 3052: 
 3053: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3054:                     stackoverflow_deinstall_handler();
 3055: #               endif
 3056: 
 3057: #               ifdef HAVE_SIGSEGV_RECOVERY
 3058:                     if (debug == d_faux)
 3059:                     {
 3060:                         sigsegv_deinstall_handler();
 3061:                     }
 3062: #               endif
 3063: 
 3064:                 if ((*s_etat_processus).langue == 'F')
 3065:                 {
 3066:                     printf("+++Système : Fichier indisponible\n");
 3067:                 }
 3068:                 else
 3069:                 {
 3070:                     printf("+++System : File unavailable\n");
 3071:                 }
 3072: 
 3073:                 return(EXIT_FAILURE);
 3074:             }
 3075: 
 3076:             if ((f_source = fopen(nom_fichier_temporaire, "w"))
 3077:                     == NULL)
 3078:             {
 3079: #               ifndef SEMAPHORES_NOMMES
 3080:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3081:                     sem_post(&semaphore_gestionnaires_signaux);
 3082:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3083:                     sem_destroy(&((*s_etat_processus)
 3084:                             .semaphore_fork));
 3085: #               else
 3086:                     sem_post((*s_etat_processus).semaphore_fork);
 3087:                     sem_post(semaphore_gestionnaires_signaux);
 3088:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3089:                             getpid(), SEM_SIGNAUX);
 3090:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3091:                             getpid(), pthread_self(), SEM_FORK);
 3092: #               endif
 3093: 
 3094:                 liberation_contexte_cas(s_etat_processus);
 3095:                 liberation_queue_signaux(s_etat_processus);
 3096: 
 3097: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3098:                     stackoverflow_deinstall_handler();
 3099: #               endif
 3100: 
 3101: #               ifdef HAVE_SIGSEGV_RECOVERY
 3102:                     if (debug == d_faux)
 3103:                     {
 3104:                         sigsegv_deinstall_handler();
 3105:                     }
 3106: #               endif
 3107: 
 3108:                 if ((*s_etat_processus).langue == 'F')
 3109:                 {
 3110:                     printf("+++Système : Fichier introuvable\n");
 3111:                 }
 3112:                 else
 3113:                 {
 3114:                     printf("+++System : File not found\n");
 3115:                 }
 3116: 
 3117:                 return(EXIT_FAILURE);
 3118:             }
 3119: 
 3120:             if (fprintf(f_source, "MODE_INTERACTIF\n") < 0)
 3121:             {
 3122: #               ifndef SEMAPHORES_NOMMES
 3123:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3124:                     sem_post(&semaphore_gestionnaires_signaux);
 3125:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3126:                     sem_destroy(&((*s_etat_processus)
 3127:                             .semaphore_fork));
 3128: #               else
 3129:                     sem_post((*s_etat_processus).semaphore_fork);
 3130:                     sem_post(semaphore_gestionnaires_signaux);
 3131:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3132:                             getpid(), SEM_SIGNAUX);
 3133:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3134:                             getpid(), pthread_self(), SEM_FORK);
 3135: #               endif
 3136: 
 3137:                 liberation_contexte_cas(s_etat_processus);
 3138:                 liberation_queue_signaux(s_etat_processus);
 3139: 
 3140: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3141:                     stackoverflow_deinstall_handler();
 3142: #               endif
 3143: 
 3144: #               ifdef HAVE_SIGSEGV_RECOVERY
 3145:                     if (debug == d_faux)
 3146:                     {
 3147:                         sigsegv_deinstall_handler();
 3148:                     }
 3149: #               endif
 3150: 
 3151:                 if ((*s_etat_processus).langue == 'F')
 3152:                 {
 3153:                     printf("+++Système : Erreur d'écriture dans un fichier\n");
 3154:                 }
 3155:                 else
 3156:                 {
 3157:                     printf("+++System : Cannot write in file\n");
 3158:                 }
 3159: 
 3160:                 return(EXIT_FAILURE);
 3161:             }
 3162: 
 3163:             if (fprintf(f_source,
 3164:                     "<< DO HALT UNTIL FALSE END >>\n") < 0)
 3165:             {
 3166: #               ifndef SEMAPHORES_NOMMES
 3167:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3168:                     sem_post(&semaphore_gestionnaires_signaux);
 3169:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3170:                     sem_destroy(&((*s_etat_processus)
 3171:                             .semaphore_fork));
 3172: #               else
 3173:                     sem_post((*s_etat_processus).semaphore_fork);
 3174:                     sem_post(semaphore_gestionnaires_signaux);
 3175:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3176:                             getpid(), SEM_SIGNAUX);
 3177:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3178:                             getpid(), pthread_self(), SEM_FORK);
 3179: #               endif
 3180: 
 3181:                 liberation_contexte_cas(s_etat_processus);
 3182:                 liberation_queue_signaux(s_etat_processus);
 3183: 
 3184: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3185:                     stackoverflow_deinstall_handler();
 3186: #               endif
 3187: 
 3188: #               ifdef HAVE_SIGSEGV_RECOVERY
 3189:                     if (debug == d_faux)
 3190:                     {
 3191:                         sigsegv_deinstall_handler();
 3192:                     }
 3193: #               endif
 3194: 
 3195:                 if ((*s_etat_processus).langue == 'F')
 3196:                 {
 3197:                     printf("+++Système : Erreur d'écriture dans un fichier\n");
 3198:                 }
 3199:                 else
 3200:                 {
 3201:                     printf("+++System : Cannot write in file\n");
 3202:                 }
 3203: 
 3204:                 return(EXIT_FAILURE);
 3205:             }
 3206: 
 3207:             if (fclose(f_source) != 0)
 3208:             {
 3209: #               ifndef SEMAPHORES_NOMMES
 3210:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3211:                     sem_post(&semaphore_gestionnaires_signaux);
 3212:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3213:                     sem_destroy(&((*s_etat_processus)
 3214:                             .semaphore_fork));
 3215: #               else
 3216:                     sem_post((*s_etat_processus).semaphore_fork);
 3217:                     sem_post(semaphore_gestionnaires_signaux);
 3218:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3219:                             getpid(), SEM_SIGNAUX);
 3220:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3221:                             getpid(), pthread_self(), SEM_FORK);
 3222: #               endif
 3223: 
 3224:                 liberation_contexte_cas(s_etat_processus);
 3225:                 liberation_queue_signaux(s_etat_processus);
 3226: 
 3227: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3228:                     stackoverflow_deinstall_handler();
 3229: #               endif
 3230: 
 3231: #               ifdef HAVE_SIGSEGV_RECOVERY
 3232:                     if (debug == d_faux)
 3233:                     {
 3234:                         sigsegv_deinstall_handler();
 3235:                     }
 3236: #               endif
 3237: 
 3238:                 if ((*s_etat_processus).langue == 'F')
 3239:                 {
 3240:                     printf("+++Système : Fichier indisponible\n");
 3241:                 }
 3242:                 else
 3243:                 {
 3244:                     printf("+++System : File unavailable\n");
 3245:                 }
 3246: 
 3247:                 return(EXIT_FAILURE);
 3248:             }
 3249: 
 3250:             (*s_etat_processus).lancement_interactif = d_vrai;
 3251:             (*s_etat_processus).nom_fichier_source =
 3252:                     nom_fichier_temporaire;
 3253: 
 3254:             presence_definition = 'O';
 3255:         }
 3256:         else
 3257:         {
 3258:             nom_fichier_temporaire = NULL;
 3259:         }
 3260: 
 3261:         if ((*s_etat_processus).nom_fichier_source == NULL)
 3262:         {
 3263:             erreur_fichier = d_erreur;
 3264:         }
 3265:         else
 3266:         {
 3267:             erreur_fichier = caracteristiques_fichier(s_etat_processus,
 3268:                     (*s_etat_processus).nom_fichier_source,
 3269:                     &existence, &ouverture, &unite_fichier);
 3270:         }
 3271: 
 3272:         if (((existence == d_faux) || (erreur_fichier != d_absence_erreur)) &&
 3273:                 (option_S == d_faux))
 3274:         {
 3275: #           ifndef SEMAPHORES_NOMMES
 3276:                 sem_post(&((*s_etat_processus).semaphore_fork));
 3277:                 sem_post(&semaphore_gestionnaires_signaux);
 3278:                 sem_destroy(&semaphore_gestionnaires_signaux);
 3279:                 sem_destroy(&((*s_etat_processus).semaphore_fork));
 3280: #           else
 3281:                 sem_post((*s_etat_processus).semaphore_fork);
 3282:                 sem_post(semaphore_gestionnaires_signaux);
 3283:                 sem_destroy2(semaphore_gestionnaires_signaux,
 3284:                         getpid(), SEM_SIGNAUX);
 3285:                 sem_destroy3((*s_etat_processus).semphore_fork,
 3286:                         getpid(), pthread_self(), SEM_FORK);
 3287: #           endif
 3288: 
 3289:             liberation_contexte_cas(s_etat_processus);
 3290:             liberation_queue_signaux(s_etat_processus);
 3291: 
 3292: #           ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3293:                 stackoverflow_deinstall_handler();
 3294: #           endif
 3295: 
 3296: #           ifdef HAVE_SIGSEGV_RECOVERY
 3297:                 if (debug == d_faux)
 3298:                 {
 3299:                     sigsegv_deinstall_handler();
 3300:                 }
 3301: #           endif
 3302: 
 3303:             if (presence_definition == 'O')
 3304:             {
 3305:                 if ((*s_etat_processus).langue == 'F')
 3306:                 {
 3307:                     printf("+++Erreur : Fichier %s inexistant\n",
 3308:                             (*s_etat_processus).nom_fichier_source);
 3309:                 }
 3310:                 else
 3311:                 {
 3312:                     printf("+++Error : File %s not found\n",
 3313:                             (*s_etat_processus).nom_fichier_source);
 3314:                 }
 3315: 
 3316:                 erreur = d_erreur;
 3317:             }
 3318:             else
 3319:             {
 3320:                 if ((*s_etat_processus).langue == 'F')
 3321:                 {
 3322:                     printf("+++Erreur : Absence de définition à exécuter\n");
 3323:                 }
 3324:                 else
 3325:                 {
 3326:                     printf("+++Error : Any executable definition\n");
 3327:                 }
 3328:             }
 3329: 
 3330:             return(EXIT_FAILURE);
 3331:         }
 3332: 
 3333:         if ((*s_etat_processus).chemin_fichiers_temporaires == NULL)
 3334:         {
 3335: #           ifndef SEMAPHORES_NOMMES
 3336:                 sem_post(&((*s_etat_processus).semaphore_fork));
 3337:                 sem_post(&semaphore_gestionnaires_signaux);
 3338:                 sem_destroy(&semaphore_gestionnaires_signaux);
 3339:                 sem_destroy(&((*s_etat_processus).semaphore_fork));
 3340: #           else
 3341:                 sem_post((*s_etat_processus).semaphore_fork);
 3342:                 sem_post(semaphore_gestionnaires_signaux);
 3343:                 sem_destroy2(semaphore_gestionnaires_signaux,
 3344:                         getpid(), SEM_SIGNAUX);
 3345:                 sem_destroy3((*s_etat_processus).semphore_fork,
 3346:                         getpid(), pthread_self(), SEM_FORK);
 3347: #           endif
 3348: 
 3349:             liberation_contexte_cas(s_etat_processus);
 3350:             liberation_queue_signaux(s_etat_processus);
 3351: 
 3352: #           ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3353:                 stackoverflow_deinstall_handler();
 3354: #           endif
 3355: 
 3356: #           ifdef HAVE_SIGSEGV_RECOVERY
 3357:                 if (debug == d_faux)
 3358:                 {
 3359:                     sigsegv_deinstall_handler();
 3360:                 }
 3361: #           endif
 3362: 
 3363:             if ((*s_etat_processus).langue == 'F')
 3364:             {
 3365:                 printf("+++Système : Chemin des fichiers temporaires nul\n");
 3366:             }
 3367:             else
 3368:             {
 3369:                 printf("+++System : Null temporary files path\n");
 3370:             }
 3371: 
 3372:             return(EXIT_FAILURE);
 3373:         }
 3374: 
 3375:         if ((*s_etat_processus).debug == d_vrai)
 3376:         {
 3377:             if ((*s_etat_processus).langue == 'F')
 3378:             {
 3379:                 printf("[%d] Chemin des fichiers temporaires %s\n\n",
 3380:                         (int) getpid(),
 3381:                         (*s_etat_processus).chemin_fichiers_temporaires);
 3382:             }
 3383:             else
 3384:             {
 3385:                 printf("[%d] Temporary files path %s\n\n",
 3386:                         (int) getpid(),
 3387:                         (*s_etat_processus).chemin_fichiers_temporaires);
 3388:             }
 3389:         }
 3390: 
 3391:         if ((erreur == d_absence_erreur) && (presence_definition == 'O'))
 3392:         {
 3393:             (*s_etat_processus).profilage = (option_P != 0) ? d_vrai : d_faux;
 3394:             (*s_etat_processus).niveau_profilage = option_P;
 3395:             (*s_etat_processus).pile_profilage = NULL;
 3396:             (*s_etat_processus).pile_profilage_fonctions = NULL;
 3397:             gettimeofday(&((*s_etat_processus).horodatage_profilage), NULL);
 3398: 
 3399:             (*s_etat_processus).liste_mutexes = NULL;
 3400:             (*s_etat_processus).sections_critiques = 0;
 3401: 
 3402:             (*s_etat_processus).test_instruction = 'N';
 3403:             (*s_etat_processus).nombre_arguments = 0;
 3404:             (*s_etat_processus).affichage_arguments = 'N';
 3405:             (*s_etat_processus).autorisation_conversion_chaine = 'Y';
 3406:             (*s_etat_processus).autorisation_evaluation_nom = 'Y';
 3407: 
 3408:             if (mode_interactif == d_vrai)
 3409:             {
 3410:                 (*s_etat_processus).autorisation_nom_implicite = 'Y';
 3411:             }
 3412:             else
 3413:             {
 3414:                 (*s_etat_processus).autorisation_nom_implicite = 'N';
 3415:             }
 3416: 
 3417:             (*s_etat_processus).autorisation_empilement_programme = 'N';
 3418:             (*s_etat_processus).requete_arret = 'N';
 3419:             (*s_etat_processus).evaluation_forcee = 'N';
 3420:             (*s_etat_processus).recherche_type = 'N';
 3421: 
 3422:             (*s_etat_processus).constante_symbolique = 'N';
 3423:             (*s_etat_processus).traitement_symbolique = 'N';
 3424: 
 3425:             (*s_etat_processus).expression_courante = NULL;
 3426:             (*s_etat_processus).objet_courant = NULL;
 3427:             (*s_etat_processus).evaluation_expression_compilee = 'N';
 3428: 
 3429:             (*s_etat_processus).l_base_pile = NULL;
 3430:             (*s_etat_processus).l_base_pile_last = NULL;
 3431: 
 3432:             (*s_etat_processus).s_arbre_variables = NULL;
 3433:             (*s_etat_processus).l_liste_variables_par_niveau = NULL;
 3434:             (*s_etat_processus).l_liste_variables_statiques = NULL;
 3435:             (*s_etat_processus).gel_liste_variables = d_faux;
 3436:             s_arbre_variables_partagees = NULL;
 3437:             l_liste_variables_partagees = NULL;
 3438:             (*s_etat_processus).s_arbre_variables_partagees =
 3439:                     &s_arbre_variables_partagees;
 3440:             (*s_etat_processus).l_liste_variables_partagees =
 3441:                     &l_liste_variables_partagees;
 3442:             (*s_etat_processus).pointeur_variable_courante = NULL;
 3443:             (*s_etat_processus).pointeur_variable_statique_courante = NULL;
 3444:             (*s_etat_processus).pointeur_variable_partagee_courante = NULL;
 3445:             (*s_etat_processus).niveau_courant = 0;
 3446:             (*s_etat_processus).niveau_initial = 0;
 3447:             (*s_etat_processus).creation_variables_statiques = d_faux;
 3448:             (*s_etat_processus).creation_variables_partagees = d_faux;
 3449: 
 3450:             (*s_etat_processus).s_bibliotheques = NULL;
 3451:             (*s_etat_processus).s_instructions_externes = NULL;
 3452:             (*s_etat_processus).nombre_instructions_externes = 0;
 3453: 
 3454:             (*s_etat_processus).systeme_axes = 0;
 3455: 
 3456:             (*s_etat_processus).x_min = -10.;
 3457:             (*s_etat_processus).x_max = 10.;
 3458:             (*s_etat_processus).y_min = -10.;
 3459:             (*s_etat_processus).y_max = 10.;
 3460:             (*s_etat_processus).z_min = -10.;
 3461:             (*s_etat_processus).z_max = 10.;
 3462: 
 3463:             (*s_etat_processus).x2_min = -10.;
 3464:             (*s_etat_processus).x2_max = 10.;
 3465:             (*s_etat_processus).y2_min = -10.;
 3466:             (*s_etat_processus).y2_max = 10.;
 3467:             (*s_etat_processus).z2_min = -10.;
 3468:             (*s_etat_processus).z2_max = 10.;
 3469: 
 3470:             (*s_etat_processus).resolution = .01;
 3471: 
 3472:             (*s_etat_processus).souris_active = d_faux;
 3473: 
 3474:             (*s_etat_processus).echelle_automatique_x = d_faux;
 3475:             (*s_etat_processus).echelle_automatique_y = d_faux;
 3476:             (*s_etat_processus).echelle_automatique_z = d_faux;
 3477: 
 3478:             (*s_etat_processus).echelle_automatique_x2 = d_faux;
 3479:             (*s_etat_processus).echelle_automatique_y2 = d_faux;
 3480:             (*s_etat_processus).echelle_automatique_z2 = d_faux;
 3481: 
 3482:             (*s_etat_processus).echelle_log_x = d_faux;
 3483:             (*s_etat_processus).echelle_log_y = d_faux;
 3484:             (*s_etat_processus).echelle_log_z = d_faux;
 3485: 
 3486:             (*s_etat_processus).echelle_log_x2 = d_faux;
 3487:             (*s_etat_processus).echelle_log_y2 = d_faux;
 3488:             (*s_etat_processus).echelle_log_z2 = d_faux;
 3489: 
 3490:             (*s_etat_processus).point_de_vue_theta = 4 * atan((real8) 1) / 6;
 3491:             (*s_etat_processus).point_de_vue_phi = 4 * atan((real8) 1) / 3;
 3492:             (*s_etat_processus).echelle_3D = 1;
 3493: 
 3494:             strcpy((*s_etat_processus).type_trace_eq, "FONCTION");
 3495:             strcpy((*s_etat_processus).type_trace_sigma, "POINTS");
 3496:             (*s_etat_processus).fichiers_graphiques = NULL;
 3497:             (*s_etat_processus).nom_fichier_impression = NULL;
 3498:             strcpy((*s_etat_processus).format_papier, "a4paper");
 3499:             (*s_etat_processus).entree_standard = NULL;
 3500:             (*s_etat_processus).s_marques = NULL;
 3501:             (*s_etat_processus).requete_nouveau_plan = d_vrai;
 3502:             (*s_etat_processus).mise_a_jour_trace_requise = d_faux;
 3503: 
 3504:             (*s_etat_processus).l_base_pile = NULL;
 3505:             (*s_etat_processus).hauteur_pile_operationnelle = 0;
 3506:             (*s_etat_processus).l_base_pile_contextes = NULL;
 3507:             (*s_etat_processus).l_base_pile_taille_contextes = NULL;
 3508: 
 3509:             (*s_etat_processus).position_courante = 0;
 3510: 
 3511:             (*s_etat_processus).l_base_pile_systeme = NULL;
 3512:             (*s_etat_processus).hauteur_pile_systeme = 0;
 3513: 
 3514:             (*s_etat_processus).l_base_pile_processus = NULL;
 3515:             (*s_etat_processus).presence_pipes = d_faux;
 3516:             (*s_etat_processus).pipe_donnees = 0;
 3517:             (*s_etat_processus).pipe_acquittement = 0;
 3518:             (*s_etat_processus).pipe_injections = 0;
 3519:             (*s_etat_processus).pipe_nombre_injections = 0;
 3520:             (*s_etat_processus).nombre_objets_injectes = 0;
 3521:             (*s_etat_processus).nombre_objets_envoyes_non_lus = 0;
 3522:             (*s_etat_processus).pourcentage_maximal_cpu = 100;
 3523:             (*s_etat_processus).temps_maximal_cpu = 0;
 3524:             (*s_etat_processus).thread_fusible = 0;
 3525:             (*s_etat_processus).presence_fusible = d_faux;
 3526: 
 3527:             (*s_etat_processus).niveau_recursivite = 0;
 3528:             (*s_etat_processus).generateur_aleatoire = NULL;
 3529:             (*s_etat_processus).type_generateur_aleatoire = NULL;
 3530: 
 3531:             (*s_etat_processus).colonne_statistique_1 = 1; 
 3532:             (*s_etat_processus).colonne_statistique_2 = 2; 
 3533: 
 3534:             (*s_etat_processus).debug_programme = d_faux;
 3535:             (*s_etat_processus).execution_pas_suivant = d_faux;
 3536:             (*s_etat_processus).traitement_instruction_halt = d_faux;
 3537: 
 3538:             (*s_etat_processus).derniere_exception = d_ep;
 3539:             (*s_etat_processus).derniere_erreur_systeme = d_es;
 3540:             (*s_etat_processus).derniere_erreur_execution = d_ex;
 3541:             (*s_etat_processus).derniere_erreur_evaluation = d_ex;
 3542:             (*s_etat_processus).derniere_erreur_fonction_externe = 0;
 3543: 
 3544:             (*s_etat_processus).erreur_processus_fils = d_faux;
 3545:             (*s_etat_processus).erreur_systeme_processus_fils = d_es;
 3546:             (*s_etat_processus).erreur_execution_processus_fils = d_ex;
 3547:             (*s_etat_processus).pid_erreur_processus_fils = 0;
 3548:             (*s_etat_processus).exception_processus_fils = d_ep;
 3549:             (*s_etat_processus).core = core;
 3550:             (*s_etat_processus).invalidation_message_erreur = d_faux;
 3551:             (*s_etat_processus).s_objet_errone = NULL;
 3552:             (*s_etat_processus).s_objet_erreur = NULL;
 3553: 
 3554:             (*s_etat_processus).retour_routine_evaluation = 'N';
 3555: 
 3556:             (*s_etat_processus).traitement_interruption = 'N';
 3557:             (*s_etat_processus).traitement_interruptible = 'Y';
 3558:             (*s_etat_processus).nombre_interruptions_en_queue = 0;
 3559:             (*s_etat_processus).nombre_interruptions_non_affectees = 0;
 3560: 
 3561:             for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 3562:             {
 3563:                 (*s_etat_processus).masque_interruptions[i] = 'N';
 3564:                 (*s_etat_processus).queue_interruptions[i] = 0;
 3565:                 (*s_etat_processus).corps_interruptions[i] = NULL;
 3566:                 (*s_etat_processus).pile_origine_interruptions[i] = NULL;
 3567:             }
 3568: 
 3569:             (*s_etat_processus).at_exit = NULL;
 3570:             (*s_etat_processus).at_poke = NULL;
 3571:             (*s_etat_processus).traitement_at_poke = 'N';
 3572: 
 3573:             (*s_etat_processus).pointeurs_caracteres = NULL;
 3574:             (*s_etat_processus).arbre_instructions = NULL;
 3575: 
 3576:             (*s_etat_processus).tid_processus_pere = pthread_self();
 3577:             (*s_etat_processus).tid = pthread_self();
 3578:             (*s_etat_processus).pid_processus_pere = getpid();
 3579:             (*s_etat_processus).processus_detache = d_vrai;
 3580:             (*s_etat_processus).var_volatile_processus_pere = -1;
 3581:             (*s_etat_processus).var_volatile_processus_racine = -1;
 3582:             (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
 3583:             (*s_etat_processus).var_volatile_alarme = 0;
 3584:             (*s_etat_processus).var_volatile_requete_arret = 0;
 3585:             (*s_etat_processus).var_volatile_requete_arret2 = 0;
 3586:             (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
 3587:             (*s_etat_processus).var_volatile_traitement_sigint = 0;
 3588:             (*s_etat_processus).var_volatile_recursivite = 0;
 3589:             (*s_etat_processus).var_volatile_exception_gsl = 0;
 3590:             (*s_etat_processus).arret_depuis_abort = 0;
 3591:             (*s_etat_processus).pointeur_signal_lecture = 0;
 3592:             (*s_etat_processus).pointeur_signal_ecriture = 0;
 3593: 
 3594:             initialisation_allocateur(s_etat_processus);
 3595:             initialisation_drapeaux(s_etat_processus);
 3596:             initialisation_variables(s_etat_processus);
 3597:             initialisation_instructions(s_etat_processus);
 3598: 
 3599:             if ((*s_etat_processus).erreur_systeme != d_es)
 3600:             {
 3601: #               ifndef SEMAPHORES_NOMMES
 3602:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3603:                     sem_post(&semaphore_gestionnaires_signaux);
 3604:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3605:                     sem_destroy(&((*s_etat_processus).semaphore_fork));
 3606: #               else
 3607:                     sem_post((*s_etat_processus).semaphore_fork);
 3608:                     sem_post(semaphore_gestionnaires_signaux);
 3609:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3610:                             getpid(), SEM_SIGNAUX);
 3611:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3612:                             getpid(), pthread_self(), SEM_FORK);
 3613: #               endif
 3614: 
 3615:                 liberation_contexte_cas(s_etat_processus);
 3616:                 liberation_queue_signaux(s_etat_processus);
 3617: 
 3618: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3619:                     stackoverflow_deinstall_handler();
 3620: #               endif
 3621: 
 3622: #               ifdef HAVE_SIGSEGV_RECOVERY
 3623:                     if (debug == d_faux)
 3624:                     {
 3625:                         sigsegv_deinstall_handler();
 3626:                     }
 3627: #               endif
 3628: 
 3629:                 if ((*s_etat_processus).langue == 'F')
 3630:                 {
 3631:                     printf("+++Système : Mémoire insuffisante\n");
 3632:                 }
 3633:                 else
 3634:                 {
 3635:                     printf("+++System : Not enough memory\n");
 3636:                 }
 3637: 
 3638:                 return(EXIT_FAILURE);
 3639:             }
 3640: 
 3641:             if (((*s_etat_processus).instruction_derniere_erreur =
 3642:                     malloc(sizeof(unsigned char))) == NULL)
 3643:             {
 3644: #               ifndef SEMAPHORES_NOMMES
 3645:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3646:                     sem_post(&semaphore_gestionnaires_signaux);
 3647:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3648:                     sem_destroy(&((*s_etat_processus).semaphore_fork));
 3649: #               else
 3650:                     sem_post((*s_etat_processus).semaphore_fork);
 3651:                     sem_post(semaphore_gestionnaires_signaux);
 3652:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3653:                             getpid(), SEM_SIGNAUX);
 3654:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3655:                             getpid(), pthread_self(), SEM_FORK);
 3656: #               endif
 3657: 
 3658:                 liberation_contexte_cas(s_etat_processus);
 3659:                 liberation_queue_signaux(s_etat_processus);
 3660: 
 3661: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3662:                     stackoverflow_deinstall_handler();
 3663: #               endif
 3664: 
 3665: #               ifdef HAVE_SIGSEGV_RECOVERY
 3666:                     if (debug == d_faux)
 3667:                     {
 3668:                         sigsegv_deinstall_handler();
 3669:                     }
 3670: #               endif
 3671: 
 3672:                 erreur = d_es_allocation_memoire;
 3673: 
 3674:                 if ((*s_etat_processus).langue == 'F')
 3675:                 {
 3676:                     printf("+++Système : Mémoire insuffisante\n");
 3677:                 }
 3678:                 else
 3679:                 {
 3680:                     printf("+++System : Not enough memory\n");
 3681:                 }
 3682: 
 3683:                 return(EXIT_FAILURE);
 3684:             }
 3685: 
 3686:             strcpy((*s_etat_processus).instruction_derniere_erreur, "");
 3687:             (*s_etat_processus).niveau_derniere_erreur = 0;
 3688: 
 3689:             if (traitement_fichier_temporaire == 'Y')
 3690:             {
 3691:                 (*s_etat_processus).mode_interactif = 'Y';
 3692:             }
 3693:             else
 3694:             {
 3695:                 (*s_etat_processus).mode_interactif = 'N';
 3696:             }
 3697: 
 3698:             if (((*s_etat_processus).instruction_courante = (unsigned char *)
 3699:                     malloc(sizeof(unsigned char))) == NULL)
 3700:             {
 3701: #               ifndef SEMAPHORES_NOMMES
 3702:                     sem_post(&((*s_etat_processus).semaphore_fork));
 3703:                     sem_post(&semaphore_gestionnaires_signaux);
 3704:                     sem_destroy(&semaphore_gestionnaires_signaux);
 3705:                     sem_destroy(&((*s_etat_processus).semaphore_fork));
 3706: #               else
 3707:                     sem_post((*s_etat_processus).semaphore_fork);
 3708:                     sem_post(semaphore_gestionnaires_signaux);
 3709:                     sem_destroy2(semaphore_gestionnaires_signaux,
 3710:                             getpid(), SEM_SIGNAUX);
 3711:                     sem_destroy3((*s_etat_processus).semphore_fork,
 3712:                             getpid(), pthread_self(), SEM_FORK);
 3713: #               endif
 3714: 
 3715:                 liberation_contexte_cas(s_etat_processus);
 3716:                 liberation_queue_signaux(s_etat_processus);
 3717: 
 3718: #               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3719:                     stackoverflow_deinstall_handler();
 3720: #               endif
 3721: 
 3722: #               ifdef HAVE_SIGSEGV_RECOVERY
 3723:                     if (debug == d_faux)
 3724:                     {
 3725:                         sigsegv_deinstall_handler();
 3726:                     }
 3727: #               endif
 3728: 
 3729:                 erreur = d_es_allocation_memoire;
 3730: 
 3731:                 if ((*s_etat_processus).langue == 'F')
 3732:                 {
 3733:                     printf("+++Système : Mémoire insuffisante\n");
 3734:                 }
 3735:                 else
 3736:                 {
 3737:                     printf("+++System : Not enough memory\n");
 3738:                 }
 3739: 
 3740:                 return(EXIT_FAILURE);
 3741:             }
 3742: 
 3743:             (*s_etat_processus).instruction_courante[0] = d_code_fin_chaine;
 3744: 
 3745:             empilement_pile_systeme(s_etat_processus);
 3746: 
 3747:             free((*s_etat_processus).instruction_courante);
 3748: 
 3749:             if ((*s_etat_processus).erreur_systeme != d_es)
 3750:             {
 3751:                 erreur = d_es_allocation_memoire;
 3752:             }
 3753:             else
 3754:             {
 3755:                 (*((*s_etat_processus).l_base_pile_systeme))
 3756:                         .retour_definition = 'Y';
 3757: 
 3758:                 (*s_etat_processus).indep = allocation(s_etat_processus, NON);
 3759:                 (*s_etat_processus).depend = allocation(s_etat_processus, NON);
 3760:                 (*s_etat_processus).parametres_courbes_de_niveau =
 3761:                         allocation(s_etat_processus, NON);
 3762: 
 3763:                 if (((*s_etat_processus).indep != NULL) &&
 3764:                         ((*s_etat_processus).depend != NULL) &&
 3765:                         ((*s_etat_processus).parametres_courbes_de_niveau
 3766:                         != NULL))
 3767:                 {
 3768:                     (*((*s_etat_processus).indep)).type = NOM;
 3769:                     (*((*s_etat_processus).depend)).type = NOM;
 3770:                     (*((*s_etat_processus).
 3771:                             parametres_courbes_de_niveau)).type = LST;
 3772: 
 3773:                     initialisation_objet((*s_etat_processus).indep);
 3774:                     initialisation_objet((*s_etat_processus).depend);
 3775:                     initialisation_objet((*s_etat_processus)
 3776:                             .parametres_courbes_de_niveau);
 3777: 
 3778:                     (*((*s_etat_processus).indep)).objet = (struct_nom *)
 3779:                             malloc(sizeof(struct_nom));
 3780:                     (*((*s_etat_processus).depend)).objet = (struct_nom *)
 3781:                             malloc(sizeof(struct_nom));
 3782:                     (*((*s_etat_processus).parametres_courbes_de_niveau))
 3783:                             .objet = (struct_liste_chainee *)
 3784:                             malloc(sizeof(struct_liste_chainee));
 3785: 
 3786:                     if (((*((*s_etat_processus).depend)).objet == NULL) ||
 3787:                             ((*((*s_etat_processus).depend)).objet == NULL) ||
 3788:                             ((*((*s_etat_processus).
 3789:                             parametres_courbes_de_niveau)).objet == NULL))
 3790:                     {
 3791: #                       ifndef SEMAPHORES_NOMMES
 3792:                             sem_post(&((*s_etat_processus).semaphore_fork));
 3793:                             sem_post(&semaphore_gestionnaires_signaux);
 3794:                             sem_destroy(&semaphore_gestionnaires_signaux);
 3795:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 3796: #                       else
 3797:                             sem_post((*s_etat_processus).semaphore_fork);
 3798:                             sem_post(semaphore_gestionnaires_signaux);
 3799:                             sem_destroy2(semaphore_gestionnaires_signaux,
 3800:                                     getpid(), SEM_SIGNAUX);
 3801:                             sem_destroy3((*s_etat_processus).semphore_fork,
 3802:                                     getpid(), pthread_self(), SEM_FORK);
 3803: #                       endif
 3804: 
 3805:                         liberation_contexte_cas(s_etat_processus);
 3806:                         liberation_queue_signaux(s_etat_processus);
 3807: 
 3808: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3809:                             stackoverflow_deinstall_handler();
 3810: #                       endif
 3811: 
 3812: #                       ifdef HAVE_SIGSEGV_RECOVERY
 3813:                             if (debug == d_faux)
 3814:                             {
 3815:                                 sigsegv_deinstall_handler();
 3816:                             }
 3817: #                       endif
 3818: 
 3819:                         erreur = d_es_allocation_memoire;
 3820:                         
 3821:                         if ((*s_etat_processus).langue == 'F')
 3822:                         {
 3823:                             printf("+++Système : Mémoire insuffisante\n");
 3824:                         }
 3825:                         else
 3826:                         {
 3827:                             printf("+++System : Not enough memory\n");
 3828:                         }
 3829: 
 3830:                         return(EXIT_FAILURE);
 3831:                     }
 3832: 
 3833:                     (*((struct_nom *) (*((*s_etat_processus).indep)).objet))
 3834:                             .nom = malloc(2 * sizeof(unsigned char));
 3835:                     (*((struct_nom *) (*((*s_etat_processus).depend)).objet))
 3836:                             .nom = malloc(2 * sizeof(unsigned char));
 3837: 
 3838:                     if (((*((struct_nom *) (*((*s_etat_processus).indep))
 3839:                             .objet)).nom == NULL) || ((*((struct_nom *)
 3840:                             (*((*s_etat_processus).depend)).objet)).nom ==
 3841:                             NULL))
 3842:                     {
 3843: #                       ifndef SEMAPHORES_NOMMES
 3844:                             sem_post(&((*s_etat_processus).semaphore_fork));
 3845:                             sem_post(&semaphore_gestionnaires_signaux);
 3846:                             sem_destroy(&semaphore_gestionnaires_signaux);
 3847:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 3848: #                       else
 3849:                             sem_post((*s_etat_processus).semaphore_fork);
 3850:                             sem_post(semaphore_gestionnaires_signaux);
 3851:                             sem_destroy2(semaphore_gestionnaires_signaux,
 3852:                                     getpid(), SEM_SIGNAUX);
 3853:                             sem_destroy3((*s_etat_processus).semphore_fork,
 3854:                                     getpid(), pthread_self(), SEM_FORK);
 3855: #                       endif
 3856: 
 3857:                         liberation_contexte_cas(s_etat_processus);
 3858:                         liberation_queue_signaux(s_etat_processus);
 3859: 
 3860: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3861:                             stackoverflow_deinstall_handler();
 3862: #                       endif
 3863: 
 3864: #                       ifdef HAVE_SIGSEGV_RECOVERY
 3865:                             if (debug == d_faux)
 3866:                             {
 3867:                                 sigsegv_deinstall_handler();
 3868:                             }
 3869: #                       endif
 3870: 
 3871:                         erreur = d_es_allocation_memoire;
 3872: 
 3873:                         if ((*s_etat_processus).langue == 'F')
 3874:                         {
 3875:                             printf("+++Système : Mémoire insuffisante\n");
 3876:                         }
 3877:                         else
 3878:                         {
 3879:                             printf("+++System : Not enough memory\n");
 3880:                         }
 3881: 
 3882:                         return(EXIT_FAILURE);
 3883:                     }
 3884: 
 3885:                     strcpy((*((struct_nom *) (*((*s_etat_processus).indep))
 3886:                             .objet)).nom, "X");
 3887:                     strcpy((*((struct_nom *) (*((*s_etat_processus).depend))
 3888:                             .objet)).nom, "Y");
 3889: 
 3890:                     (*((struct_nom *) (*((*s_etat_processus).indep))
 3891:                             .objet)).symbole = d_vrai;
 3892:                     (*((struct_nom *) (*((*s_etat_processus).depend))
 3893:                             .objet)).symbole = d_vrai;
 3894: 
 3895:                     (*((struct_liste_chainee *) (*((*s_etat_processus)
 3896:                             .parametres_courbes_de_niveau)).objet)).suivant
 3897:                             = NULL;
 3898: 
 3899:                     (*((struct_liste_chainee *) (*((*s_etat_processus)
 3900:                             .parametres_courbes_de_niveau)).objet)).donnee
 3901:                             = malloc(sizeof(struct_objet));
 3902: 
 3903:                     (*s_etat_processus).legende =
 3904:                             malloc(sizeof(unsigned char));
 3905:                     (*s_etat_processus).label_x =
 3906:                             malloc(sizeof(unsigned char));
 3907:                     (*s_etat_processus).label_y =
 3908:                             malloc(sizeof(unsigned char));
 3909:                     (*s_etat_processus).label_z =
 3910:                             malloc(sizeof(unsigned char));
 3911:                     (*s_etat_processus).titre =
 3912:                             malloc(sizeof(unsigned char));
 3913: 
 3914:                     if (((*s_etat_processus).label_x == NULL) ||
 3915:                             ((*s_etat_processus).label_y == NULL) ||
 3916:                             ((*s_etat_processus).label_z == NULL) ||
 3917:                             ((*s_etat_processus).titre == NULL) ||
 3918:                             ((*s_etat_processus).legende == NULL) ||
 3919:                             ((*((struct_liste_chainee *) (*((*s_etat_processus)
 3920:                             .parametres_courbes_de_niveau)).objet)).donnee
 3921:                             == NULL))
 3922:                     {
 3923: #                       ifndef SEMAPHORES_NOMMES
 3924:                             sem_post(&((*s_etat_processus).semaphore_fork));
 3925:                             sem_post(&semaphore_gestionnaires_signaux);
 3926:                             sem_destroy(&semaphore_gestionnaires_signaux);
 3927:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 3928: #                       else
 3929:                             sem_post((*s_etat_processus).semaphore_fork);
 3930:                             sem_post(semaphore_gestionnaires_signaux);
 3931:                             sem_destroy2(semaphore_gestionnaires_signaux,
 3932:                                     getpid(), SEM_SIGNAUX);
 3933:                             sem_destroy3((*s_etat_processus).semphore_fork,
 3934:                                     getpid(), pthread_self(), SEM_FORK);
 3935: #                       endif
 3936: 
 3937:                         liberation_contexte_cas(s_etat_processus);
 3938:                         liberation_queue_signaux(s_etat_processus);
 3939: 
 3940: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3941:                             stackoverflow_deinstall_handler();
 3942: #                       endif
 3943: 
 3944: #                       ifdef HAVE_SIGSEGV_RECOVERY
 3945:                             if (debug == d_faux)
 3946:                             {
 3947:                                 sigsegv_deinstall_handler();
 3948:                             }
 3949: #                       endif
 3950: 
 3951:                         erreur = d_es_allocation_memoire;
 3952: 
 3953:                         if ((*s_etat_processus).langue == 'F')
 3954:                         {
 3955:                             printf("+++Système : Mémoire insuffisante\n");
 3956:                         }
 3957:                         else
 3958:                         {
 3959:                             printf("+++System : Not enough memory\n");
 3960:                         }
 3961: 
 3962:                         return(EXIT_FAILURE);
 3963:                     }
 3964: 
 3965:                     (*(*((struct_liste_chainee *) (*((*s_etat_processus)
 3966:                             .parametres_courbes_de_niveau)).objet)).donnee)
 3967:                             .type = CHN;
 3968: 
 3969:                     initialisation_objet((*((struct_liste_chainee *)
 3970:                             (*((*s_etat_processus)
 3971:                             .parametres_courbes_de_niveau))
 3972:                             .objet)).donnee);
 3973: 
 3974:                     if (((*(*((struct_liste_chainee *) (*((*s_etat_processus)
 3975:                             .parametres_courbes_de_niveau)).objet)).donnee)
 3976:                             .objet = malloc(10 * sizeof(unsigned char)))
 3977:                             == NULL)
 3978:                     {
 3979: #                       ifndef SEMAPHORES_NOMMES
 3980:                             sem_post(&((*s_etat_processus).semaphore_fork));
 3981:                             sem_post(&semaphore_gestionnaires_signaux);
 3982:                             sem_destroy(&semaphore_gestionnaires_signaux);
 3983:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 3984: #                       else
 3985:                             sem_post((*s_etat_processus).semaphore_fork);
 3986:                             sem_post(semaphore_gestionnaires_signaux);
 3987:                             sem_destroy2(semaphore_gestionnaires_signaux,
 3988:                                     getpid(), SEM_SIGNAUX);
 3989:                             sem_destroy3((*s_etat_processus).semphore_fork,
 3990:                                     getpid(), pthread_self(), SEM_FORK);
 3991: #                       endif
 3992: 
 3993:                         liberation_contexte_cas(s_etat_processus);
 3994:                         liberation_queue_signaux(s_etat_processus);
 3995: 
 3996: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3997:                             stackoverflow_deinstall_handler();
 3998: #                       endif
 3999: 
 4000: #                       ifdef HAVE_SIGSEGV_RECOVERY
 4001:                             if (debug == d_faux)
 4002:                             {
 4003:                                 sigsegv_deinstall_handler();
 4004:                             }
 4005: #                       endif
 4006: 
 4007:                         erreur = d_es_allocation_memoire;
 4008: 
 4009:                         if ((*s_etat_processus).langue == 'F')
 4010:                         {
 4011:                             printf("+++Système : Mémoire insuffisante\n");
 4012:                         }
 4013:                         else
 4014:                         {
 4015:                             printf("+++System : Not enough memory\n");
 4016:                         }
 4017: 
 4018:                         return(EXIT_FAILURE);
 4019:                     }
 4020: 
 4021:                     strcpy((unsigned char *) (*(*((struct_liste_chainee *)
 4022:                             (*((*s_etat_processus)
 4023:                             .parametres_courbes_de_niveau))
 4024:                             .objet)).donnee).objet, "AUTOMATIC");
 4025: 
 4026:                     (*s_etat_processus).label_x[0] = d_code_fin_chaine;
 4027:                     (*s_etat_processus).label_y[0] = d_code_fin_chaine;
 4028:                     (*s_etat_processus).label_z[0] = d_code_fin_chaine;
 4029:                     (*s_etat_processus).titre[0] = d_code_fin_chaine;
 4030:                     (*s_etat_processus).legende[0] = d_code_fin_chaine;
 4031: 
 4032:                     (*s_etat_processus).nom_fichier_gnuplot = NULL;
 4033:                     (*s_etat_processus).type_fichier_gnuplot = NULL;
 4034: 
 4035:                     (*s_etat_processus).x_tics = 0;
 4036:                     (*s_etat_processus).y_tics = 0;
 4037:                     (*s_etat_processus).z_tics = 0;
 4038: 
 4039:                     (*s_etat_processus).x_lines = d_vrai;
 4040:                     (*s_etat_processus).y_lines = d_vrai;
 4041:                     (*s_etat_processus).z_lines = d_vrai;
 4042: 
 4043:                     (*s_etat_processus).mx_tics = -1;
 4044:                     (*s_etat_processus).my_tics = -1;
 4045:                     (*s_etat_processus).mz_tics = -1;
 4046: 
 4047:                     (*s_etat_processus).mx_lines = d_faux;
 4048:                     (*s_etat_processus).my_lines = d_faux;
 4049:                     (*s_etat_processus).mz_lines = d_faux;
 4050: 
 4051:                     (*s_etat_processus).x2_tics = -1;
 4052:                     (*s_etat_processus).y2_tics = -1;
 4053:                     (*s_etat_processus).z2_tics = -1;
 4054: 
 4055:                     (*s_etat_processus).x2_lines = d_faux;
 4056:                     (*s_etat_processus).y2_lines = d_faux;
 4057:                     (*s_etat_processus).z2_lines = d_faux;
 4058: 
 4059:                     (*s_etat_processus).mx2_tics = -1;
 4060:                     (*s_etat_processus).my2_tics = -1;
 4061:                     (*s_etat_processus).mz2_tics = -1;
 4062: 
 4063:                     (*s_etat_processus).mx2_lines = d_faux;
 4064:                     (*s_etat_processus).my2_lines = d_faux;
 4065:                     (*s_etat_processus).mz2_lines = d_faux;
 4066: 
 4067:                     (*s_etat_processus).mode_evaluation_expression = 'N';
 4068:                     (*s_etat_processus).mode_execution_programme = 'Y';
 4069: 
 4070:                     if ((*s_etat_processus).definitions_chainees == NULL)
 4071:                     {
 4072:                         if ((erreur = chainage(s_etat_processus)) !=
 4073:                                 d_absence_erreur)
 4074:                         {
 4075: #                           ifndef SEMAPHORES_NOMMES
 4076:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 4077:                                 sem_post(&semaphore_gestionnaires_signaux);
 4078:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 4079:                                 sem_destroy(&((*s_etat_processus)
 4080:                                         .semaphore_fork));
 4081: #                           else
 4082:                                 sem_post((*s_etat_processus).semaphore_fork);
 4083:                                 sem_post(semaphore_gestionnaires_signaux);
 4084:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 4085:                                         getpid(), SEM_SIGNAUX);
 4086:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 4087:                                         getpid(), pthread_self(), SEM_FORK);
 4088: #                           endif
 4089: 
 4090:                             liberation_contexte_cas(s_etat_processus);
 4091:                             liberation_queue_signaux(s_etat_processus);
 4092: 
 4093: #                           ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4094:                                 stackoverflow_deinstall_handler();
 4095: #                           endif
 4096: 
 4097: #                           ifdef HAVE_SIGSEGV_RECOVERY
 4098:                                 if (debug == d_faux)
 4099:                                 {
 4100:                                     sigsegv_deinstall_handler();
 4101:                                 }
 4102: #                           endif
 4103: 
 4104:                             if ((*s_etat_processus).langue == 'F')
 4105:                             {
 4106:                                 printf("+++Fatal :"
 4107:                                         " Chaînage des définitions"
 4108:                                         " impossible\n");
 4109:                             }
 4110:                             else
 4111:                             {
 4112:                                 printf("+++Fatal : Error in "
 4113:                                         "compilation\n");
 4114:                             }
 4115: 
 4116:                             if (traitement_fichier_temporaire == 'Y')
 4117:                             {
 4118:                                 if (destruction_fichier(
 4119:                                         nom_fichier_temporaire)
 4120:                                         == d_erreur)
 4121:                                 {
 4122:                                     return(EXIT_FAILURE);
 4123:                                 }
 4124: 
 4125:                                 free(nom_fichier_temporaire);
 4126:                             }
 4127: 
 4128:                             return(EXIT_FAILURE);
 4129:                         }
 4130:                     }
 4131: 
 4132:                     if ((erreur = compilation(s_etat_processus)) !=
 4133:                             d_absence_erreur)
 4134:                     {
 4135: #                       ifndef SEMAPHORES_NOMMES
 4136:                             sem_post(&((*s_etat_processus).semaphore_fork));
 4137:                             sem_post(&semaphore_gestionnaires_signaux);
 4138:                             sem_destroy(&semaphore_gestionnaires_signaux);
 4139:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 4140: #                       else
 4141:                             sem_post((*s_etat_processus).semaphore_fork);
 4142:                             sem_post(semaphore_gestionnaires_signaux);
 4143:                             sem_destroy2(semaphore_gestionnaires_signaux,
 4144:                                     getpid(), SEM_SIGNAUX);
 4145:                             sem_destroy3((*s_etat_processus).semphore_fork,
 4146:                                     getpid(), pthread_self(), SEM_FORK);
 4147: #                       endif
 4148: 
 4149:                         liberation_contexte_cas(s_etat_processus);
 4150:                         liberation_queue_signaux(s_etat_processus);
 4151: 
 4152: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4153:                             stackoverflow_deinstall_handler();
 4154: #                       endif
 4155: 
 4156: #                       ifdef HAVE_SIGSEGV_RECOVERY
 4157:                             if (debug == d_faux)
 4158:                             {
 4159:                                 sigsegv_deinstall_handler();
 4160:                             }
 4161: #                       endif
 4162: 
 4163:                         if (traitement_fichier_temporaire == 'Y')
 4164:                         {
 4165:                             if (destruction_fichier(nom_fichier_temporaire)
 4166:                                     == d_erreur)
 4167:                             {
 4168:                                 return(EXIT_FAILURE);
 4169:                             }
 4170: 
 4171:                             free(nom_fichier_temporaire);
 4172:                         }
 4173: 
 4174:                         printf("%s [%d]\n", message =
 4175:                                 messages(s_etat_processus), (int) getpid());
 4176:                         free(message);
 4177: 
 4178:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 4179:                         {
 4180:                             printf("%s", ds_beep);
 4181:                         }
 4182: 
 4183:                         if ((*s_etat_processus).core == d_vrai)
 4184:                         {
 4185:                             printf("\n");
 4186:                             
 4187:                             if ((*s_etat_processus).langue == 'F')
 4188:                             {
 4189:                                 printf("+++Information : Génération du fichier "
 4190:                                         "rpl-core [%d]\n", (int) getpid());
 4191:                             }
 4192:                             else
 4193:                             {
 4194:                                 printf("+++Information : Writing rpl-core "
 4195:                                         "file [%d]\n", (int) getpid());
 4196:                             }
 4197: 
 4198:                             rplcore(s_etat_processus);
 4199: 
 4200:                             if ((*s_etat_processus).langue == 'F')
 4201:                             {
 4202:                                 printf("+++Information : Processus tracé "
 4203:                                         "[%d]\n", (int) getpid());
 4204:                             }
 4205:                             else
 4206:                             {
 4207:                                 printf("+++Information : Done [%d]\n",
 4208:                                         (int) getpid());
 4209:                             }
 4210: 
 4211:                             printf("\n");
 4212:                         }
 4213: 
 4214:                         return(EXIT_FAILURE);
 4215:                     }
 4216: 
 4217:                     (*s_etat_processus).position_courante = 0;
 4218:                     (*s_etat_processus).traitement_cycle_exit = 'N';
 4219: 
 4220:                     if ((*s_etat_processus).s_arbre_variables == NULL)
 4221:                     {
 4222: #                       ifndef SEMAPHORES_NOMMES
 4223:                             sem_post(&((*s_etat_processus).semaphore_fork));
 4224:                             sem_post(&semaphore_gestionnaires_signaux);
 4225:                             sem_destroy(&semaphore_gestionnaires_signaux);
 4226:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 4227: #                       else
 4228:                             sem_post((*s_etat_processus).semaphore_fork);
 4229:                             sem_post(semaphore_gestionnaires_signaux);
 4230:                             sem_destroy2(semaphore_gestionnaires_signaux,
 4231:                                     getpid(), SEM_SIGNAUX);
 4232:                             sem_destroy3((*s_etat_processus).semphore_fork,
 4233:                                     getpid(), pthread_self(), SEM_FORK);
 4234: #                       endif
 4235: 
 4236:                         liberation_contexte_cas(s_etat_processus);
 4237:                         liberation_queue_signaux(s_etat_processus);
 4238: 
 4239: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4240:                             stackoverflow_deinstall_handler();
 4241: #                       endif
 4242: 
 4243: #                       ifdef HAVE_SIGSEGV_RECOVERY
 4244:                             if (debug == d_faux)
 4245:                             {
 4246:                                 sigsegv_deinstall_handler();
 4247:                             }
 4248: #                       endif
 4249: 
 4250:                         if ((*s_etat_processus).langue == 'F')
 4251:                         {
 4252:                             printf("+++Fatal : Aucun point d'entrée\n");
 4253:                         }
 4254:                         else
 4255:                         {
 4256:                             printf("+++Fatal : Any entry point\n");
 4257:                         }
 4258: 
 4259:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 4260:                         {
 4261:                             printf("%s", ds_beep);
 4262:                         }
 4263: 
 4264:                         return(EXIT_FAILURE);
 4265:                     }
 4266: 
 4267:                     if (recherche_instruction_suivante(s_etat_processus)
 4268:                             == d_erreur)
 4269:                     {
 4270: #                       ifndef SEMAPHORES_NOMMES
 4271:                             sem_post(&((*s_etat_processus).semaphore_fork));
 4272:                             sem_post(&semaphore_gestionnaires_signaux);
 4273:                             sem_destroy(&semaphore_gestionnaires_signaux);
 4274:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 4275: #                       else
 4276:                             sem_post((*s_etat_processus).semaphore_fork);
 4277:                             sem_post(semaphore_gestionnaires_signaux);
 4278:                             sem_destroy2(semaphore_gestionnaires_signaux,
 4279:                                     getpid(), SEM_SIGNAUX);
 4280:                             sem_destroy3((*s_etat_processus).semphore_fork,
 4281:                                     getpid(), pthread_self(), SEM_FORK);
 4282: #                       endif
 4283: 
 4284:                         liberation_contexte_cas(s_etat_processus);
 4285:                         liberation_queue_signaux(s_etat_processus);
 4286: 
 4287: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4288:                             stackoverflow_deinstall_handler();
 4289: #                       endif
 4290: 
 4291: #                       ifdef HAVE_SIGSEGV_RECOVERY
 4292:                             if (debug == d_faux)
 4293:                             {
 4294:                                 sigsegv_deinstall_handler();
 4295:                             }
 4296: #                       endif
 4297: 
 4298:                         if ((*s_etat_processus).langue == 'F')
 4299:                         {
 4300:                             printf("+++Fatal : Aucun point d'entrée\n");
 4301:                         }
 4302:                         else
 4303:                         {
 4304:                             printf("+++Fatal : Any entry point\n");
 4305:                         }
 4306: 
 4307:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 4308:                         {
 4309:                             printf("%s", ds_beep);
 4310:                         }
 4311: 
 4312:                         return(EXIT_FAILURE);
 4313:                     }
 4314: 
 4315:                     if (recherche_variable(s_etat_processus,
 4316:                             (*s_etat_processus)
 4317:                             .instruction_courante) == d_faux)
 4318:                     {
 4319: #                       ifndef SEMAPHORES_NOMMES
 4320:                             sem_post(&((*s_etat_processus).semaphore_fork));
 4321:                             sem_post(&semaphore_gestionnaires_signaux);
 4322:                             sem_destroy(&semaphore_gestionnaires_signaux);
 4323:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 4324: #                       else
 4325:                             sem_post((*s_etat_processus).semaphore_fork);
 4326:                             sem_post(semaphore_gestionnaires_signaux);
 4327:                             sem_destroy2(semaphore_gestionnaires_signaux,
 4328:                                     getpid(), SEM_SIGNAUX);
 4329:                             sem_destroy3((*s_etat_processus).semphore_fork,
 4330:                                     getpid(), pthread_self(), SEM_FORK);
 4331: #                       endif
 4332: 
 4333:                         liberation_contexte_cas(s_etat_processus);
 4334:                         liberation_queue_signaux(s_etat_processus);
 4335: 
 4336: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4337:                             stackoverflow_deinstall_handler();
 4338: #                       endif
 4339: 
 4340: #                       ifdef HAVE_SIGSEGV_RECOVERY
 4341:                             if (debug == d_faux)
 4342:                             {
 4343:                                 sigsegv_deinstall_handler();
 4344:                             }
 4345: #                       endif
 4346: 
 4347:                         if ((*s_etat_processus).langue == 'F')
 4348:                         {
 4349:                             printf("+++Fatal : Aucun point d'entrée\n");
 4350:                         }
 4351:                         else
 4352:                         {
 4353:                             printf("+++Fatal : Any entry point\n");
 4354:                         }
 4355: 
 4356:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 4357:                         {
 4358:                             printf("%s", ds_beep);
 4359:                         }
 4360: 
 4361:                         return(EXIT_FAILURE);
 4362:                     }
 4363: 
 4364:                     if ((*(*s_etat_processus).pointeur_variable_courante)
 4365:                             .niveau != 0)
 4366:                     {
 4367: #                       ifndef SEMAPHORES_NOMMES
 4368:                             sem_post(&((*s_etat_processus).semaphore_fork));
 4369:                             sem_post(&semaphore_gestionnaires_signaux);
 4370:                             sem_destroy(&semaphore_gestionnaires_signaux);
 4371:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 4372: #                       else
 4373:                             sem_post((*s_etat_processus).semaphore_fork);
 4374:                             sem_post(semaphore_gestionnaires_signaux);
 4375:                             sem_destroy2(semaphore_gestionnaires_signaux,
 4376:                                     getpid(), SEM_SIGNAUX);
 4377:                             sem_destroy3((*s_etat_processus).semphore_fork,
 4378:                                     getpid(), pthread_self(), SEM_FORK);
 4379: #                       endif
 4380: 
 4381:                         liberation_contexte_cas(s_etat_processus);
 4382:                         liberation_queue_signaux(s_etat_processus);
 4383: 
 4384: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4385:                             stackoverflow_deinstall_handler();
 4386: #                       endif
 4387: 
 4388: #                       ifdef HAVE_SIGSEGV_RECOVERY
 4389:                             if (debug == d_faux)
 4390:                             {
 4391:                                 sigsegv_deinstall_handler();
 4392:                             }
 4393: #                       endif
 4394: 
 4395:                         if ((*s_etat_processus).langue == 'F')
 4396:                         {
 4397:                             printf("+++Fatal : Aucun point d'entrée\n");
 4398:                         }
 4399:                         else
 4400:                         {
 4401:                             printf("+++Fatal : Any entry point\n");
 4402:                         }
 4403: 
 4404:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 4405:                         {
 4406:                             printf("%s", ds_beep);
 4407:                         }
 4408: 
 4409:                         return(EXIT_FAILURE);
 4410:                     }
 4411: 
 4412:                     free((*s_etat_processus).instruction_courante);
 4413:                     (*s_etat_processus).position_courante = 0;
 4414: 
 4415:                     if (((*s_etat_processus).nom_fichier_historique =
 4416:                             malloc((strlen(home) +
 4417:                             strlen(ds_fichier_historique) + 2) *
 4418:                             sizeof(unsigned char))) == NULL)
 4419:                     {
 4420: #                       ifndef SEMAPHORES_NOMMES
 4421:                             sem_post(&((*s_etat_processus).semaphore_fork));
 4422:                             sem_post(&semaphore_gestionnaires_signaux);
 4423:                             sem_destroy(&semaphore_gestionnaires_signaux);
 4424:                             sem_destroy(&((*s_etat_processus).semaphore_fork));
 4425: #                       else
 4426:                             sem_post((*s_etat_processus).semaphore_fork);
 4427:                             sem_post(semaphore_gestionnaires_signaux);
 4428:                             sem_destroy2(semaphore_gestionnaires_signaux,
 4429:                                     getpid(), SEM_SIGNAUX);
 4430:                             sem_destroy3((*s_etat_processus).semphore_fork,
 4431:                                     getpid(), pthread_self(), SEM_FORK);
 4432: #                       endif
 4433: 
 4434:                         liberation_contexte_cas(s_etat_processus);
 4435:                         liberation_queue_signaux(s_etat_processus);
 4436: 
 4437: #                       ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4438:                             stackoverflow_deinstall_handler();
 4439: #                       endif
 4440: 
 4441: #                       ifdef HAVE_SIGSEGV_RECOVERY
 4442:                             if (debug == d_faux)
 4443:                             {
 4444:                                 sigsegv_deinstall_handler();
 4445:                             }
 4446: #                       endif
 4447: 
 4448:                         erreur = d_es_allocation_memoire;
 4449: 
 4450:                         if ((*s_etat_processus).langue == 'F')
 4451:                         {
 4452:                             printf("+++Système : Mémoire insuffisante\n");
 4453:                         }
 4454:                         else
 4455:                         {
 4456:                             printf("+++System : Not enough memory\n");
 4457:                         }
 4458: 
 4459:                         return(EXIT_FAILURE);
 4460:                     }
 4461: 
 4462:                     sprintf((*s_etat_processus).nom_fichier_historique, "%s/%s",
 4463:                             home, ds_fichier_historique);
 4464: 
 4465:                     using_history();
 4466: 
 4467:                     // Pour pouvoir utiliser le keymap avant le premier
 4468:                     // appel à readline().
 4469:                     rl_initialize();
 4470: 
 4471:                     erreur_historique = read_history(
 4472:                             (*s_etat_processus).nom_fichier_historique);
 4473: 
 4474:                     gsl_set_error_handler(&traitement_exceptions_gsl);
 4475: 
 4476:                     if (drapeau_encart == 'Y')
 4477:                     {
 4478:                         (*s_etat_processus).erreur_systeme = d_es;
 4479:                         encart(s_etat_processus,
 4480:                                 (unsigned long) (5 * 1000000));
 4481: 
 4482:                         if ((*s_etat_processus).erreur_systeme != d_es)
 4483:                         {
 4484:                             if ((message = messages(s_etat_processus))
 4485:                                     == NULL)
 4486:                             {
 4487: #                               ifndef SEMAPHORES_NOMMES
 4488:                                     sem_post(&((*s_etat_processus)
 4489:                                             .semaphore_fork));
 4490:                                     sem_post(&semaphore_gestionnaires_signaux);
 4491:                                     sem_destroy(
 4492:                                             &semaphore_gestionnaires_signaux);
 4493:                                     sem_destroy(&((*s_etat_processus)
 4494:                                             .semaphore_fork));
 4495: #                               else
 4496:                                     sem_post((*s_etat_processus)
 4497:                                             .semaphore_fork);
 4498:                                     sem_post(semaphore_gestionnaires_signaux);
 4499:                                     sem_destroy2(
 4500:                                             semaphore_gestionnaires_signaux,
 4501:                                             getpid(), SEM_SIGNAUX);
 4502:                                     sem_destroy3((*s_etat_processus)
 4503:                                             .semphore_fork,
 4504:                                             getpid(), pthread_self(), SEM_FORK);
 4505: #                               endif
 4506: 
 4507:                                 liberation_contexte_cas(s_etat_processus);
 4508:                                 liberation_queue_signaux(s_etat_processus);
 4509: 
 4510: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4511:                                     stackoverflow_deinstall_handler();
 4512: #                               endif
 4513: 
 4514: #                               ifdef HAVE_SIGSEGV_RECOVERY
 4515:                                     if (debug == d_faux)
 4516:                                     {
 4517:                                         sigsegv_deinstall_handler();
 4518:                                     }
 4519: #                               endif
 4520: 
 4521:                                 erreur = d_es_allocation_memoire;
 4522: 
 4523:                                 if ((*s_etat_processus).langue == 'F')
 4524:                                 {
 4525:                                     printf("+++Système : Mémoire "
 4526:                                             "insuffisante\n");
 4527:                                 }
 4528:                                 else
 4529:                                 {
 4530:                                     printf("+++System : Not enough "
 4531:                                             "memory\n");
 4532:                                 }
 4533: 
 4534:                                 return(EXIT_FAILURE);
 4535:                             }
 4536: 
 4537:                             printf("%s [%d]\n", message, (int) getpid());
 4538:                             free(message);
 4539: 
 4540:                             return(EXIT_FAILURE);
 4541:                         }
 4542:                     }
 4543: 
 4544:                     fflush(stdout);
 4545: 
 4546:                     if (arguments != NULL)
 4547:                     {
 4548:                         tampon = (*s_etat_processus).definitions_chainees;
 4549:                         (*s_etat_processus).definitions_chainees =
 4550:                                 arguments;
 4551: 
 4552:                         if (analyse_syntaxique(s_etat_processus) ==
 4553:                                 d_erreur)
 4554:                         {
 4555:                             if ((*s_etat_processus).erreur_systeme != d_es)
 4556:                             {
 4557: #                               ifndef SEMAPHORES_NOMMES
 4558:                                     sem_post(&((*s_etat_processus)
 4559:                                             .semaphore_fork));
 4560:                                     sem_post(&semaphore_gestionnaires_signaux);
 4561:                                     sem_destroy(
 4562:                                             &semaphore_gestionnaires_signaux);
 4563:                                     sem_destroy(&((*s_etat_processus)
 4564:                                             .semaphore_fork));
 4565: #                               else
 4566:                                     sem_post((*s_etat_processus)
 4567:                                             .semaphore_fork);
 4568:                                     sem_post(semaphore_gestionnaires_signaux);
 4569:                                     sem_destroy2(
 4570:                                             semaphore_gestionnaires_signaux,
 4571:                                             getpid(), SEM_SIGNAUX);
 4572:                                     sem_destroy3((*s_etat_processus)
 4573:                                             .semphore_fork,
 4574:                                             getpid(), pthread_self(), SEM_FORK);
 4575: #                               endif
 4576: 
 4577:                                 liberation_contexte_cas(s_etat_processus);
 4578:                                 liberation_queue_signaux(s_etat_processus);
 4579: 
 4580: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4581:                                     stackoverflow_deinstall_handler();
 4582: #                               endif
 4583: 
 4584: #                               ifdef HAVE_SIGSEGV_RECOVERY
 4585:                                     if (debug == d_faux)
 4586:                                     {
 4587:                                         sigsegv_deinstall_handler();
 4588:                                     }
 4589: #                               endif
 4590: 
 4591:                                 erreur = d_es_allocation_memoire;
 4592: 
 4593:                                 if ((*s_etat_processus).langue == 'F')
 4594:                                 {
 4595:                                     printf("+++Système : Mémoire "
 4596:                                             "insuffisante\n");
 4597:                                 }
 4598:                                 else
 4599:                                 {
 4600:                                     printf("+++System : Not enough "
 4601:                                             "memory\n");
 4602:                                 }
 4603: 
 4604:                                 return(EXIT_FAILURE);
 4605:                             }
 4606:                             else
 4607:                             {
 4608: #                               ifndef SEMAPHORES_NOMMES
 4609:                                     sem_post(&((*s_etat_processus)
 4610:                                             .semaphore_fork));
 4611:                                     sem_post(&semaphore_gestionnaires_signaux);
 4612:                                     sem_destroy(
 4613:                                             &semaphore_gestionnaires_signaux);
 4614:                                     sem_destroy(&((*s_etat_processus)
 4615:                                             .semaphore_fork));
 4616: #                               else
 4617:                                     sem_post((*s_etat_processus)
 4618:                                             .semaphore_fork);
 4619:                                     sem_post(semaphore_gestionnaires_signaux);
 4620:                                     sem_destroy2(
 4621:                                             semaphore_gestionnaires_signaux,
 4622:                                             getpid(), SEM_SIGNAUX);
 4623:                                     sem_destroy3((*s_etat_processus)
 4624:                                             .semphore_fork,
 4625:                                             getpid(), pthread_self(), SEM_FORK);
 4626: #                               endif
 4627: 
 4628:                                 liberation_contexte_cas(s_etat_processus);
 4629:                                 liberation_queue_signaux(s_etat_processus);
 4630: 
 4631: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4632:                                     stackoverflow_deinstall_handler();
 4633: #                               endif
 4634: 
 4635: #                               ifdef HAVE_SIGSEGV_RECOVERY
 4636:                                     if (debug == d_faux)
 4637:                                     {
 4638:                                         sigsegv_deinstall_handler();
 4639:                                     }
 4640: #                               endif
 4641: 
 4642:                                 if ((*s_etat_processus).langue == 'F')
 4643:                                 {
 4644:                                     printf("+++Erreur : Erreur de "
 4645:                                             "syntaxe\n");
 4646:                                 }
 4647:                                 else
 4648:                                 {
 4649:                                     printf("+++Error : Syntax error\n");
 4650:                                 }
 4651: 
 4652:                                 return(EXIT_FAILURE);
 4653:                             }
 4654:                         }
 4655: 
 4656:                         (*s_etat_processus).instruction_courante
 4657:                                 = arguments;
 4658:                         (*s_etat_processus).definitions_chainees = tampon;
 4659:                         (*s_etat_processus).position_courante = 0;
 4660: 
 4661:                         recherche_type(s_etat_processus);
 4662: 
 4663:                         if ((*s_etat_processus).erreur_systeme != d_es)
 4664:                         {
 4665: #                           ifndef SEMAPHORES_NOMMES
 4666:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 4667:                                 sem_post(&semaphore_gestionnaires_signaux);
 4668:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 4669:                                 sem_destroy(&((*s_etat_processus)
 4670:                                         .semaphore_fork));
 4671: #                           else
 4672:                                 sem_post((*s_etat_processus).semaphore_fork);
 4673:                                 sem_post(semaphore_gestionnaires_signaux);
 4674:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 4675:                                         getpid(), SEM_SIGNAUX);
 4676:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 4677:                                         getpid(), pthread_self(), SEM_FORK);
 4678: #                           endif
 4679: 
 4680:                             liberation_contexte_cas(s_etat_processus);
 4681:                             liberation_queue_signaux(s_etat_processus);
 4682: 
 4683: #                           ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4684:                                 stackoverflow_deinstall_handler();
 4685: #                           endif
 4686: 
 4687: #                           ifdef HAVE_SIGSEGV_RECOVERY
 4688:                                 if (debug == d_faux)
 4689:                                 {
 4690:                                     sigsegv_deinstall_handler();
 4691:                                 }
 4692: #                           endif
 4693: 
 4694:                             if ((message = messages(s_etat_processus))
 4695:                                     == NULL)
 4696:                             {
 4697:                                 erreur = d_es_allocation_memoire;
 4698: 
 4699:                                 if ((*s_etat_processus).langue == 'F')
 4700:                                 {
 4701:                                     printf("+++Système : Mémoire "
 4702:                                             "insuffisante\n");
 4703:                                 }
 4704:                                 else
 4705:                                 {
 4706:                                     printf("+++System : Not enough "
 4707:                                             "memory\n");
 4708:                                 }
 4709: 
 4710:                                 return(EXIT_FAILURE);
 4711:                             }
 4712: 
 4713:                             printf("%s [%d]\n", message, (int) getpid());
 4714:                             free(message);
 4715: 
 4716:                             return(EXIT_FAILURE);
 4717:                         }
 4718: 
 4719:                         if ((*s_etat_processus).erreur_execution != d_ex)
 4720:                         {
 4721:                             if ((message = messages(s_etat_processus))
 4722:                                     == NULL)
 4723:                             {
 4724: #                               ifndef SEMAPHORES_NOMMES
 4725:                                     sem_post(&((*s_etat_processus)
 4726:                                             .semaphore_fork));
 4727:                                     sem_post(&semaphore_gestionnaires_signaux);
 4728:                                     sem_destroy(
 4729:                                             &semaphore_gestionnaires_signaux);
 4730:                                     sem_destroy(&((*s_etat_processus)
 4731:                                             .semaphore_fork));
 4732: #                               else
 4733:                                     sem_post((*s_etat_processus)
 4734:                                             .semaphore_fork);
 4735:                                     sem_post(semaphore_gestionnaires_signaux);
 4736:                                     sem_destroy2(
 4737:                                             semaphore_gestionnaires_signaux,
 4738:                                             getpid(), SEM_SIGNAUX);
 4739:                                     sem_destroy3((*s_etat_processus)
 4740:                                             .semphore_fork,
 4741:                                             getpid(), pthread_self(), SEM_FORK);
 4742: #                               endif
 4743: 
 4744:                                 liberation_contexte_cas(s_etat_processus);
 4745:                                 liberation_queue_signaux(s_etat_processus);
 4746: 
 4747: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4748:                                     stackoverflow_deinstall_handler();
 4749: #                               endif
 4750: 
 4751: #                               ifdef HAVE_SIGSEGV_RECOVERY
 4752:                                     if (debug == d_faux)
 4753:                                     {
 4754:                                         sigsegv_deinstall_handler();
 4755:                                     }
 4756: #                               endif
 4757: 
 4758:                                 erreur = d_es_allocation_memoire;
 4759: 
 4760:                                 if ((*s_etat_processus).langue == 'F')
 4761:                                 {
 4762:                                     printf("+++Erreur : Mémoire "
 4763:                                             "insuffisante\n");
 4764:                                 }
 4765:                                 else
 4766:                                 {
 4767:                                     printf("+++Error : Not enough "
 4768:                                             "memory\n");
 4769:                                 }
 4770: 
 4771:                                 return(EXIT_FAILURE);
 4772:                             }
 4773: 
 4774:                             printf("%s [%d]\n", message, (int) getpid());
 4775:                             free(message);
 4776: 
 4777: #                           ifndef SEMAPHORES_NOMMES
 4778:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 4779:                                 sem_post(&semaphore_gestionnaires_signaux);
 4780:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 4781:                                 sem_destroy(&((*s_etat_processus)
 4782:                                         .semaphore_fork));
 4783: #                           else
 4784:                                 sem_post((*s_etat_processus).semaphore_fork);
 4785:                                 sem_post(semaphore_gestionnaires_signaux);
 4786:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 4787:                                         getpid(), SEM_SIGNAUX);
 4788:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 4789:                                         getpid(), pthread_self(), SEM_FORK);
 4790: #                           endif
 4791: 
 4792:                             liberation_contexte_cas(s_etat_processus);
 4793:                             liberation_queue_signaux(s_etat_processus);
 4794: 
 4795: #                           ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4796:                                 stackoverflow_deinstall_handler();
 4797: #                           endif
 4798: 
 4799: #                           ifdef HAVE_SIGSEGV_RECOVERY
 4800:                                 if (debug == d_faux)
 4801:                                 {
 4802:                                     sigsegv_deinstall_handler();
 4803:                                 }
 4804: #                           endif
 4805: 
 4806:                             return(EXIT_FAILURE);
 4807:                         }
 4808: 
 4809:                         if (depilement(s_etat_processus,
 4810:                                 &((*s_etat_processus).l_base_pile),
 4811:                                 &s_objet) == d_erreur)
 4812:                         {
 4813:                             if ((message = messages(s_etat_processus))
 4814:                                     == NULL)
 4815:                             {
 4816: #                               ifndef SEMAPHORES_NOMMES
 4817:                                     sem_post(&((*s_etat_processus)
 4818:                                             .semaphore_fork));
 4819:                                     sem_post(&semaphore_gestionnaires_signaux);
 4820:                                     sem_destroy(
 4821:                                             &semaphore_gestionnaires_signaux);
 4822:                                     sem_destroy(&((*s_etat_processus)
 4823:                                             .semaphore_fork));
 4824: #                               else
 4825:                                     sem_post((*s_etat_processus)
 4826:                                             .semaphore_fork);
 4827:                                     sem_post(semaphore_gestionnaires_signaux);
 4828:                                     sem_destroy2(
 4829:                                             semaphore_gestionnaires_signaux,
 4830:                                             getpid(), SEM_SIGNAUX);
 4831:                                     sem_destroy3((*s_etat_processus)
 4832:                                             .semphore_fork,
 4833:                                             getpid(), pthread_self(), SEM_FORK);
 4834: #                               endif
 4835: 
 4836:                                 liberation_contexte_cas(s_etat_processus);
 4837:                                 liberation_queue_signaux(s_etat_processus);
 4838: 
 4839: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4840:                                     stackoverflow_deinstall_handler();
 4841: #                               endif
 4842: 
 4843: #                               ifdef HAVE_SIGSEGV_RECOVERY
 4844:                                     if (debug == d_faux)
 4845:                                     {
 4846:                                         sigsegv_deinstall_handler();
 4847:                                     }
 4848: #                               endif
 4849: 
 4850:                                 erreur = d_es_allocation_memoire;
 4851:                                 erreur = d_es_allocation_memoire;
 4852: 
 4853:                                 if ((*s_etat_processus).langue == 'F')
 4854:                                 {
 4855:                                     printf("+++Erreur : Mémoire "
 4856:                                             "insuffisante\n");
 4857:                                 }
 4858:                                 else
 4859:                                 {
 4860:                                     printf("+++Error : Not enough "
 4861:                                             "memory\n");
 4862:                                 }
 4863: 
 4864:                                 return(EXIT_FAILURE);
 4865:                             }
 4866: 
 4867:                             printf("%s [%d]\n", message, (int) getpid());
 4868:                             free(message);
 4869: 
 4870: #                           ifndef SEMAPHORES_NOMMES
 4871:                                 sem_post(&((*s_etat_processus).semaphore_fork));
 4872:                                 sem_post(&semaphore_gestionnaires_signaux);
 4873:                                 sem_destroy(&semaphore_gestionnaires_signaux);
 4874:                                 sem_destroy(&((*s_etat_processus)
 4875:                                         .semaphore_fork));
 4876: #                           else
 4877:                                 sem_post((*s_etat_processus).semaphore_fork);
 4878:                                 sem_post(semaphore_gestionnaires_signaux);
 4879:                                 sem_destroy2(semaphore_gestionnaires_signaux,
 4880:                                         getpid(), SEM_SIGNAUX);
 4881:                                 sem_destroy3((*s_etat_processus).semphore_fork,
 4882:                                         getpid(), pthread_self(), SEM_FORK);
 4883: #                           endif
 4884: 
 4885:                             liberation_contexte_cas(s_etat_processus);
 4886:                             liberation_queue_signaux(s_etat_processus);
 4887: 
 4888: #                           ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4889:                                 stackoverflow_deinstall_handler();
 4890: #                           endif
 4891: 
 4892: #                           ifdef HAVE_SIGSEGV_RECOVERY
 4893:                                 if (debug == d_faux)
 4894:                                 {
 4895:                                     sigsegv_deinstall_handler();
 4896:                                 }
 4897: #                           endif
 4898: 
 4899:                             return(EXIT_FAILURE);
 4900:                         }
 4901: 
 4902:                         if (evaluation(s_etat_processus, s_objet, 'E')
 4903:                                 == d_erreur)
 4904:                         {
 4905:                             if ((*s_etat_processus).erreur_systeme != d_es)
 4906:                             {
 4907:                                 if ((message = messages(s_etat_processus))
 4908:                                         == NULL)
 4909:                                 {
 4910: #                                   ifndef SEMAPHORES_NOMMES
 4911:                                         sem_post(&((*s_etat_processus)
 4912:                                                 .semaphore_fork));
 4913:                                         sem_post(
 4914:                                                 &semaphore_gestionnaires_signaux
 4915:                                                 );
 4916:                                         sem_destroy(
 4917:                                                 &semaphore_gestionnaires_signaux
 4918:                                                 );
 4919:                                         sem_destroy(&((*s_etat_processus)
 4920:                                                 .semaphore_fork));
 4921: #                                   else
 4922:                                         sem_post((*s_etat_processus)
 4923:                                                 .semaphore_fork);
 4924:                                         sem_post(
 4925:                                                 semaphore_gestionnaires_signaux
 4926:                                                 );
 4927:                                         sem_destroy2(
 4928:                                                 semaphore_gestionnaires_signaux,
 4929:                                                 getpid(), SEM_SIGNAUX);
 4930:                                         sem_destroy3((*s_etat_processus)
 4931:                                                 .semphore_fork, getpid(),
 4932:                                                 pthread_self(), SEM_FORK);
 4933: #                                   endif
 4934: 
 4935:                                     liberation_contexte_cas(s_etat_processus);
 4936:                                     liberation_queue_signaux(s_etat_processus);
 4937: 
 4938: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4939:                                         stackoverflow_deinstall_handler();
 4940: #                                   endif
 4941: 
 4942: #                                   ifdef HAVE_SIGSEGV_RECOVERY
 4943:                                         if (debug == d_faux)
 4944:                                         {
 4945:                                             sigsegv_deinstall_handler();
 4946:                                         }
 4947: #                                   endif
 4948: 
 4949:                                     erreur = d_es_allocation_memoire;
 4950: 
 4951:                                     if ((*s_etat_processus).langue == 'F')
 4952:                                     {
 4953:                                         printf("+++Système : Mémoire "
 4954:                                                 "insuffisante\n");
 4955:                                     }
 4956:                                     else
 4957:                                     {
 4958:                                         printf("+++System : Not enough "
 4959:                                                 "memory\n");
 4960:                                     }
 4961: 
 4962:                                     return(EXIT_FAILURE);
 4963:                                 }
 4964: 
 4965:                                 printf("%s [%d]\n", message,
 4966:                                         (int) getpid());
 4967:                                 free(message);
 4968: 
 4969: #                               ifndef SEMAPHORES_NOMMES
 4970:                                     sem_post(&((*s_etat_processus)
 4971:                                             .semaphore_fork));
 4972:                                     sem_post(&semaphore_gestionnaires_signaux);
 4973:                                     sem_destroy(
 4974:                                             &semaphore_gestionnaires_signaux);
 4975:                                     sem_destroy(&((*s_etat_processus)
 4976:                                             .semaphore_fork));
 4977: #                               else
 4978:                                     sem_post((*s_etat_processus)
 4979:                                             .semaphore_fork);
 4980:                                     sem_post(semaphore_gestionnaires_signaux);
 4981:                                     sem_destroy2(
 4982:                                             semaphore_gestionnaires_signaux,
 4983:                                             getpid(), SEM_SIGNAUX);
 4984:                                     sem_destroy3((*s_etat_processus)
 4985:                                             .semphore_fork,
 4986:                                             getpid(), pthread_self(), SEM_FORK);
 4987: #                               endif
 4988: 
 4989:                                 liberation_contexte_cas(s_etat_processus);
 4990:                                 liberation_queue_signaux(s_etat_processus);
 4991: 
 4992: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 4993:                                     stackoverflow_deinstall_handler();
 4994: #                               endif
 4995: 
 4996: #                               ifdef HAVE_SIGSEGV_RECOVERY
 4997:                                     if (debug == d_faux)
 4998:                                     {
 4999:                                         sigsegv_deinstall_handler();
 5000:                                     }
 5001: #                               endif
 5002: 
 5003:                                 erreur = d_es_allocation_memoire;
 5004:                                 return(EXIT_FAILURE);
 5005:                             }
 5006: 
 5007:                             if ((*s_etat_processus).erreur_execution
 5008:                                     != d_ex)
 5009:                             {
 5010:                                 if ((message = messages(s_etat_processus))
 5011:                                         == NULL)
 5012:                                 {
 5013: #                                   ifndef SEMAPHORES_NOMMES
 5014:                                         sem_post(&((*s_etat_processus)
 5015:                                                 .semaphore_fork));
 5016:                                         sem_post(
 5017:                                                 &semaphore_gestionnaires_signaux
 5018:                                                 );
 5019:                                         sem_destroy(
 5020:                                                 &semaphore_gestionnaires_signaux
 5021:                                                 );
 5022:                                         sem_destroy(&((*s_etat_processus)
 5023:                                                 .semaphore_fork));
 5024: #                                   else
 5025:                                         sem_post((*s_etat_processus)
 5026:                                                 .semaphore_fork);
 5027:                                         sem_post(
 5028:                                                 semaphore_gestionnaires_signaux
 5029:                                                 );
 5030:                                         sem_destroy2(
 5031:                                                 semaphore_gestionnaires_signaux,
 5032:                                                 getpid(), SEM_SIGNAUX);
 5033:                                         sem_destroy3((*s_etat_processus)
 5034:                                                 .semphore_fork, getpid(),
 5035:                                                 pthread_self(), SEM_FORK);
 5036: #                                   endif
 5037: 
 5038:                                     liberation_contexte_cas(s_etat_processus);
 5039:                                     liberation_queue_signaux(s_etat_processus);
 5040: 
 5041: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 5042:                                         stackoverflow_deinstall_handler();
 5043: #                                   endif
 5044: 
 5045: #                                   ifdef HAVE_SIGSEGV_RECOVERY
 5046:                                         if (debug == d_faux)
 5047:                                         {
 5048:                                             sigsegv_deinstall_handler();
 5049:                                         }
 5050: #                                   endif
 5051: 
 5052:                                     erreur = d_es_allocation_memoire;
 5053: 
 5054:                                     if ((*s_etat_processus).langue == 'F')
 5055:                                     {
 5056:                                         printf("+++Erreur : Mémoire "
 5057:                                                 "insuffisante\n");
 5058:                                     }
 5059:                                     else
 5060:                                     {
 5061:                                         printf("+++Error : Not enough "
 5062:                                                 "memory\n");
 5063:                                     }
 5064: 
 5065:                                     return(EXIT_FAILURE);
 5066:                                 }
 5067: 
 5068:                                 printf("%s [%d]\n", message,
 5069:                                         (int) getpid());
 5070:                                 free(message);
 5071: 
 5072: #                               ifndef SEMAPHORES_NOMMES
 5073:                                     sem_post(&((*s_etat_processus)
 5074:                                             .semaphore_fork));
 5075:                                     sem_post(&semaphore_gestionnaires_signaux);
 5076:                                     sem_destroy(
 5077:                                             &semaphore_gestionnaires_signaux);
 5078:                                     sem_destroy(&((*s_etat_processus)
 5079:                                             .semaphore_fork));
 5080: #                               else
 5081:                                     sem_post((*s_etat_processus)
 5082:                                             .semaphore_fork);
 5083:                                     sem_post(semaphore_gestionnaires_signaux);
 5084:                                     sem_destroy2(
 5085:                                             semaphore_gestionnaires_signaux,
 5086:                                             getpid(), SEM_SIGNAUX);
 5087:                                     sem_destroy3((*s_etat_processus)
 5088:                                             .semphore_fork,
 5089:                                             getpid(), pthread_self(), SEM_FORK);
 5090: #                               endif
 5091: 
 5092:                                 liberation_contexte_cas(s_etat_processus);
 5093:                                 liberation_queue_signaux(s_etat_processus);
 5094: 
 5095: #                               ifdef HAVE_STACK_OVERFLOW_RECOVERY
 5096:                                     stackoverflow_deinstall_handler();
 5097: #                               endif
 5098: 
 5099: #                               ifdef HAVE_SIGSEGV_RECOVERY
 5100:                                     if (debug == d_faux)
 5101:                                     {
 5102:                                         sigsegv_deinstall_handler();
 5103:                                     }
 5104: #                               endif
 5105: 
 5106:                                 return(EXIT_FAILURE);
 5107:                             }
 5108:                         }
 5109: 
 5110:                         (*s_etat_processus).instruction_courante = NULL;
 5111:                         liberation(s_etat_processus, s_objet);
 5112: 
 5113:                         free(arguments);
 5114:                     }
 5115: 
 5116:                     if (option_a == d_vrai)
 5117:                     {
 5118:                         fprintf(stdout, "%s\n", (*s_etat_processus)
 5119:                                 .definitions_chainees);
 5120:                     }
 5121:                     else
 5122:                     {
 5123:                         if (option_D == d_vrai)
 5124:                         {
 5125:                             lancement_daemon(s_etat_processus);
 5126:                         }
 5127: 
 5128:                         if (option_p == d_faux)
 5129:                         {
 5130:                             if (setjmp(contexte_initial) == 0)
 5131:                             {
 5132:                                 erreur = sequenceur(s_etat_processus);
 5133: 
 5134:                                 if (erreur == d_absence_erreur)
 5135:                                 {
 5136:                                     if (((*s_etat_processus).var_volatile_alarme
 5137:                                             == 0) && ((*s_etat_processus)
 5138:                                             .arret_depuis_abort == 0) &&
 5139:                                             ((*s_etat_processus).at_exit
 5140:                                             != NULL))
 5141:                                     {
 5142:                                         erreur = evaluation(s_etat_processus,
 5143:                                                 (*s_etat_processus).at_exit,
 5144:                                                 'E');
 5145:                                     }
 5146:                                 }
 5147:                             }
 5148:                         }
 5149:                         else
 5150:                         {
 5151:                             if (setjmp(contexte_initial) == 0)
 5152:                             {
 5153:                                 erreur = sequenceur_optimise(s_etat_processus);
 5154: 
 5155:                                 if (erreur == d_absence_erreur)
 5156:                                 {
 5157:                                     if (((*s_etat_processus).var_volatile_alarme
 5158:                                             == 0) && ((*s_etat_processus)
 5159:                                             .arret_depuis_abort == 0) &&
 5160:                                             ((*s_etat_processus).at_exit
 5161:                                             != NULL))
 5162:                                     {
 5163:                                         erreur = evaluation(s_etat_processus,
 5164:                                                 (*s_etat_processus).at_exit,
 5165:                                                 'E');
 5166:                                     }
 5167:                                 }
 5168:                             }
 5169:                         }
 5170:                     }
 5171: 
 5172:                     for(i = 0; i < (*s_etat_processus).sections_critiques; i++)
 5173:                     {
 5174:                         pthread_mutex_unlock(&mutex_sections_critiques);
 5175:                     }
 5176: 
 5177:                     liberation(s_etat_processus, (*s_etat_processus).at_exit);
 5178:                     liberation(s_etat_processus, (*s_etat_processus).at_poke);
 5179: 
 5180:                     if ((*s_etat_processus).generateur_aleatoire != NULL)
 5181:                     {
 5182:                         liberation_generateur_aleatoire(s_etat_processus);
 5183:                     }
 5184: 
 5185:                     l_element_courant = (*s_etat_processus).liste_mutexes;
 5186:                     while(l_element_courant != NULL)
 5187:                     {
 5188:                         liberation(s_etat_processus,
 5189:                                 (*((struct_liste_chainee *)
 5190:                                 l_element_courant)).donnee);
 5191:                         l_element_suivant = (*((struct_liste_chainee *)
 5192:                                 l_element_courant)).suivant;
 5193:                         free((struct_liste_chainee *) l_element_courant);
 5194:                         l_element_courant = l_element_suivant;
 5195:                     }
 5196: 
 5197:                     /*
 5198:                      * Arrêt des processus fils
 5199:                      */
 5200: 
 5201:                     if ((*s_etat_processus).presence_fusible == d_vrai)
 5202:                     {
 5203:                         pthread_cancel((*s_etat_processus).thread_fusible);
 5204:                     }
 5205: 
 5206:                     pthread_mutex_lock(&((*s_etat_processus).mutex));
 5207: 
 5208:                     l_element_courant = (void *) (*s_etat_processus)
 5209:                             .l_base_pile_processus;
 5210: 
 5211:                     while(l_element_courant != NULL)
 5212:                     {
 5213:                         if ((*s_etat_processus).debug == d_vrai)
 5214:                         {
 5215:                             if (((*s_etat_processus).type_debug &
 5216:                                     d_debug_processus) != 0)
 5217:                             {
 5218:                                 if ((*(*((struct_processus_fils *)
 5219:                                         (*(*((struct_liste_chainee *)
 5220:                                         l_element_courant)).donnee)
 5221:                                         .objet)).thread)
 5222:                                         .processus_detache == d_vrai)
 5223:                                 {
 5224:                                     if ((*s_etat_processus).langue == 'F')
 5225:                                     {
 5226:                                         printf("[%d] Signalement pour arrêt du "
 5227:                                                 "processus %d\n",
 5228:                                                 (int) getpid(), (int)
 5229:                                                 (*(*((struct_processus_fils *)
 5230:                                                 (*(*((struct_liste_chainee *)
 5231:                                                 l_element_courant)).donnee)
 5232:                                                 .objet)).thread).pid);
 5233:                                     }
 5234:                                     else
 5235:                                     {
 5236:                                         printf("[%d] Send stop signal to "
 5237:                                                 "process %d\n",
 5238:                                                 (int) getpid(), (int)
 5239:                                                 (*(*((struct_processus_fils *)
 5240:                                                 (*(*((struct_liste_chainee *)
 5241:                                                 l_element_courant)).donnee)
 5242:                                                 .objet)).thread).pid);
 5243:                                     }
 5244:                                 }
 5245:                                 else
 5246:                                 {
 5247:                                     if ((*s_etat_processus).langue == 'F')
 5248:                                     {
 5249:                                         printf("[%d] Signalement pour arrêt du "
 5250:                                                 "thread %llu\n", (int) getpid(),
 5251:                                                 (unsigned long long)
 5252:                                                 (*(*((struct_processus_fils *)
 5253:                                                 (*(*((struct_liste_chainee *)
 5254:                                                 l_element_courant)).donnee)
 5255:                                                 .objet)).thread).tid);
 5256:                                     }
 5257:                                     else
 5258:                                     {
 5259:                                         printf("[%d] Send stop signal to "
 5260:                                                 "thread %llu\n",
 5261:                                                 (int) getpid(),
 5262:                                                 (unsigned long long)
 5263:                                                 (*(*((struct_processus_fils *)
 5264:                                                 (*(*((struct_liste_chainee *)
 5265:                                                 l_element_courant)).donnee)
 5266:                                                 .objet)).thread).tid);
 5267:                                     }
 5268:                                 }
 5269:                             }
 5270:                         }
 5271: 
 5272:                         if ((*(*((struct_processus_fils *)
 5273:                                 (*(*((struct_liste_chainee *)
 5274:                                 l_element_courant)).donnee).objet))
 5275:                                 .thread).processus_detache == d_vrai)
 5276:                         {
 5277:                             if ((*s_etat_processus).var_volatile_alarme != 0)
 5278:                             {
 5279:                                 envoi_signal_processus(
 5280:                                         (*(*((struct_processus_fils *)
 5281:                                         (*(*((struct_liste_chainee *)
 5282:                                         l_element_courant)).donnee).objet))
 5283:                                         .thread).pid, rpl_sigurg);
 5284:                             }
 5285:                             else
 5286:                             {
 5287:                                 if ((*s_etat_processus).arret_depuis_abort
 5288:                                         == -1)
 5289:                                 {
 5290:                                     envoi_signal_processus(
 5291:                                             (*(*((struct_processus_fils *)
 5292:                                             (*(*((struct_liste_chainee *)
 5293:                                             l_element_courant)).donnee).objet))
 5294:                                             .thread).pid, rpl_sigabort);
 5295:                                 }
 5296:                                 else
 5297:                                 {
 5298:                                     envoi_signal_processus(
 5299:                                             (*(*((struct_processus_fils *)
 5300:                                             (*(*((struct_liste_chainee *)
 5301:                                             l_element_courant)).donnee).objet))
 5302:                                             .thread).pid, rpl_sigstop);
 5303:                                 }
 5304:                             }
 5305:                         }
 5306:                         else
 5307:                         {
 5308:                             pthread_mutex_lock(&((*(*((struct_processus_fils *)
 5309:                                     (*(*((struct_liste_chainee *)
 5310:                                     l_element_courant)).donnee).objet)).thread)
 5311:                                     .mutex));
 5312: 
 5313:                             if ((*(*((struct_processus_fils *)
 5314:                                     (*(*((struct_liste_chainee *)
 5315:                                     l_element_courant)).donnee).objet)).thread)
 5316:                                     .thread_actif == d_vrai)
 5317:                             {
 5318:                                 if ((*s_etat_processus).var_volatile_alarme
 5319:                                         != 0)
 5320:                                 {
 5321:                                     envoi_signal_thread(
 5322:                                             (*(*((struct_processus_fils *)
 5323:                                             (*(*((struct_liste_chainee *)
 5324:                                             l_element_courant)).donnee).objet))
 5325:                                             .thread).tid, rpl_sigurg);
 5326:                                 }
 5327:                                 else
 5328:                                 {
 5329:                                     if ((*s_etat_processus).arret_depuis_abort
 5330:                                             == -1)
 5331:                                     {
 5332:                                         envoi_signal_thread(
 5333:                                                 (*(*((struct_processus_fils *)
 5334:                                                 (*(*((struct_liste_chainee *)
 5335:                                                 l_element_courant)).donnee)
 5336:                                                 .objet)).thread).tid,
 5337:                                                 rpl_sigabort);
 5338:                                     }
 5339:                                     else
 5340:                                     {
 5341:                                         envoi_signal_thread(
 5342:                                                 (*(*((struct_processus_fils *)
 5343:                                                 (*(*((struct_liste_chainee *)
 5344:                                                 l_element_courant)).donnee)
 5345:                                                 .objet)).thread).tid,
 5346:                                                 rpl_sigstop);
 5347:                                     }
 5348:                                 }
 5349:                             }
 5350: 
 5351:                             pthread_mutex_unlock(
 5352:                                     &((*(*((struct_processus_fils *)
 5353:                                     (*(*((struct_liste_chainee *)
 5354:                                     l_element_courant)).donnee).objet)).thread)
 5355:                                     .mutex));
 5356:                         }
 5357: 
 5358:                         l_element_courant = (*((struct_liste_chainee *)
 5359:                                 l_element_courant)).suivant;
 5360:                     }
 5361: 
 5362:                     /*
 5363:                      * Attente de la fin de tous les processus fils
 5364:                      */
 5365: 
 5366:                     for(i = 0; i < d_NOMBRE_INTERRUPTIONS;
 5367:                             (*s_etat_processus).masque_interruptions[i++]
 5368:                             = 'I');
 5369: 
 5370:                     attente.tv_sec = 0;
 5371:                     attente.tv_nsec = GRANULARITE_us * 1000;
 5372: 
 5373:                     while((*s_etat_processus).l_base_pile_processus != NULL)
 5374:                     {
 5375:                         l_element_courant = (void *)
 5376:                                 (*s_etat_processus).l_base_pile_processus;
 5377: 
 5378:                         for(i = 0; i < (unsigned long)
 5379:                                 (*(*((struct_processus_fils *)
 5380:                                 (*(*((struct_liste_chainee *)
 5381:                                 l_element_courant)).donnee).objet)).thread)
 5382:                                 .nombre_objets_dans_pipe; i++)
 5383:                         {
 5384:                             if ((s_objet = lecture_pipe(
 5385:                                     s_etat_processus,
 5386:                                     (*(*((struct_processus_fils *)
 5387:                                     (*(*((struct_liste_chainee *)
 5388:                                     l_element_courant)).donnee).objet)).thread)
 5389:                                     .pipe_objets[0])) != NULL)
 5390:                             {
 5391:                                 liberation(s_etat_processus, s_objet);
 5392: 
 5393:                                 (*(*((struct_processus_fils *)
 5394:                                         (*(*((struct_liste_chainee *)
 5395:                                         l_element_courant)).donnee).objet))
 5396:                                         .thread).nombre_objets_dans_pipe--;
 5397: 
 5398:                                 action.sa_handler = SIG_IGN;
 5399:                                 action.sa_flags = 0;
 5400: 
 5401:                                 if (sigaction(SIGPIPE, &action, &registre)
 5402:                                         != 0)
 5403:                                 {
 5404: #                                   ifndef SEMAPHORES_NOMMES
 5405:                                         sem_post(&((*s_etat_processus)
 5406:                                                 .semaphore_fork));
 5407:                                         sem_post(
 5408:                                                 &semaphore_gestionnaires_signaux
 5409:                                                 );
 5410:                                         sem_destroy(
 5411:                                                 &semaphore_gestionnaires_signaux
 5412:                                                 );
 5413:                                         sem_destroy(&((*s_etat_processus)
 5414:                                                 .semaphore_fork));
 5415: #                                   else
 5416:                                         sem_post((*s_etat_processus)
 5417:                                                 .semaphore_fork);
 5418:                                         sem_post(
 5419:                                                 semaphore_gestionnaires_signaux
 5420:                                                 );
 5421:                                         sem_destroy2(
 5422:                                                 semaphore_gestionnaires_signaux,
 5423:                                                 getpid(), SEM_SIGNAUX);
 5424:                                         sem_destroy3((*s_etat_processus)
 5425:                                                 .semphore_fork, getpid(),
 5426:                                                 pthread_self(), SEM_FORK);
 5427: #                                   endif
 5428: 
 5429:                                     liberation_contexte_cas(s_etat_processus);
 5430:                                     liberation_queue_signaux(s_etat_processus);
 5431: 
 5432: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 5433:                                         stackoverflow_deinstall_handler();
 5434: #                                   endif
 5435: 
 5436: #                                   ifdef HAVE_SIGSEGV_RECOVERY
 5437:                                         if (debug == d_faux)
 5438:                                         {
 5439:                                             sigsegv_deinstall_handler();
 5440:                                         }
 5441: #                                   endif
 5442: 
 5443:                                     pthread_mutex_unlock(
 5444:                                             &((*s_etat_processus).mutex));
 5445:                                     return(EXIT_FAILURE);
 5446:                                 }
 5447: 
 5448:                                 while((longueur_ecriture =
 5449:                                         write_atomic(s_etat_processus,
 5450:                                         (*(*((struct_processus_fils *)
 5451:                                         (*(*((struct_liste_chainee *)
 5452:                                         l_element_courant)).donnee).objet))
 5453:                                         .thread).pipe_nombre_injections[1], "+",
 5454:                                         sizeof(unsigned char))) !=
 5455:                                         sizeof(unsigned char))
 5456:                                 {
 5457:                                     if (longueur_ecriture == -1)
 5458:                                     {
 5459:                                         // Le processus n'existe plus.
 5460:                                         break;
 5461:                                     }
 5462:                                 }
 5463: 
 5464:                                 if (sigaction(SIGPIPE, &registre, NULL)
 5465:                                         != 0)
 5466:                                 {
 5467: #                                   ifndef SEMAPHORES_NOMMES
 5468:                                         sem_post(&((*s_etat_processus)
 5469:                                                 .semaphore_fork));
 5470:                                         sem_post(
 5471:                                                 &semaphore_gestionnaires_signaux
 5472:                                                 );
 5473:                                         sem_destroy(
 5474:                                                 &semaphore_gestionnaires_signaux
 5475:                                                 );
 5476:                                         sem_destroy(&((*s_etat_processus)
 5477:                                                 .semaphore_fork));
 5478: #                                   else
 5479:                                         sem_post((*s_etat_processus)
 5480:                                                 .semaphore_fork);
 5481:                                         sem_post(
 5482:                                                 semaphore_gestionnaires_signaux
 5483:                                                 );
 5484:                                         sem_destroy2(
 5485:                                                 semaphore_gestionnaires_signaux,
 5486:                                                 getpid(), SEM_SIGNAUX);
 5487:                                         sem_destroy3((*s_etat_processus)
 5488:                                                 .semphore_fork, getpid(),
 5489:                                                 pthread_self(), SEM_FORK);
 5490: #                                   endif
 5491: 
 5492:                                     liberation_contexte_cas(s_etat_processus);
 5493:                                     liberation_queue_signaux(s_etat_processus);
 5494: 
 5495: #                                   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 5496:                                         stackoverflow_deinstall_handler();
 5497: #                                   endif
 5498: 
 5499: #                                   ifdef HAVE_SIGSEGV_RECOVERY
 5500:                                         if (debug == d_faux)
 5501:                                         {
 5502:                                             sigsegv_deinstall_handler();
 5503:                                         }
 5504: #                                   endif
 5505: 
 5506:                                     pthread_mutex_unlock(
 5507:                                             &((*s_etat_processus).mutex));
 5508:                                     return(EXIT_FAILURE);
 5509:                                 }
 5510:                             }
 5511:                         }
 5512: 
 5513:                         pthread_mutex_unlock(&((*s_etat_processus).mutex));
 5514: 
 5515:                         if ((*s_etat_processus)
 5516:                                 .nombre_interruptions_non_affectees != 0)
 5517:                         {
 5518:                             affectation_interruptions_logicielles(
 5519:                                     s_etat_processus);
 5520:                         }
 5521: 
 5522:                         nanosleep(&attente, NULL);
 5523:                         scrutation_interruptions(s_etat_processus);
 5524:                         pthread_mutex_lock(&((*s_etat_processus).mutex));
 5525:                     }
 5526: 
 5527:                     pthread_mutex_unlock(&((*s_etat_processus).mutex));
 5528: 
 5529:                     erreur_historique = write_history(
 5530:                             (*s_etat_processus).nom_fichier_historique);
 5531:                     clear_history();
 5532: 
 5533:                     if (erreur_historique != 0)
 5534:                     {
 5535:                         if ((*s_etat_processus).langue == 'F')
 5536:                         {
 5537:                             printf("+++Erreur : L'historique ne peut être "
 5538:                                     "écrit\n");
 5539:                         }
 5540:                         else
 5541:                         {
 5542:                             printf("+++Error : History cannot be "
 5543:                                     "written\n");
 5544:                         }
 5545: 
 5546:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 5547:                         {
 5548:                             printf("%s", ds_beep);
 5549:                         }
 5550:                     }
 5551: 
 5552:                     free((*s_etat_processus).nom_fichier_historique);
 5553: 
 5554:                     if (((*s_etat_processus).core == d_vrai) &&
 5555:                             (erreur == d_erreur) &&
 5556:                             ((*s_etat_processus).var_volatile_traitement_sigint
 5557:                             == 0))
 5558:                     {
 5559:                         printf("\n");
 5560:                         
 5561:                         if ((*s_etat_processus).langue == 'F')
 5562:                         {
 5563:                             printf("+++Information : Génération du fichier "
 5564:                                     "rpl-core [%d]\n", (int) getpid());
 5565:                         }
 5566:                         else
 5567:                         {
 5568:                             printf("+++Information : Writing rpl-core "
 5569:                                     "file [%d]\n", (int) getpid());
 5570:                         }
 5571: 
 5572:                         rplcore(s_etat_processus);
 5573: 
 5574:                         if ((*s_etat_processus).langue == 'F')
 5575:                         {
 5576:                             printf("+++Information : Processus tracé [%d]\n",
 5577:                                     (int) getpid());
 5578:                         }
 5579:                         else
 5580:                         {
 5581:                             printf("+++Information : Done [%d]\n",
 5582:                                     (int) getpid());
 5583:                         }
 5584: 
 5585:                         printf("\n");
 5586:                     }
 5587: 
 5588:                     free((*s_etat_processus).definitions_chainees);
 5589: 
 5590:                     /*
 5591:                      * Libération de l'arbre des instructions
 5592:                      */
 5593: 
 5594:                     liberation_arbre_instructions(s_etat_processus,
 5595:                             (*s_etat_processus).arbre_instructions);
 5596:                     free((*s_etat_processus).pointeurs_caracteres);
 5597: 
 5598:                     if ((*s_etat_processus).entree_standard != NULL)
 5599:                     {
 5600:                         pclose((*s_etat_processus).entree_standard);
 5601:                         (*s_etat_processus).entree_standard = NULL;
 5602:                     }
 5603: 
 5604:                     if ((*s_etat_processus).nom_fichier_impression != NULL)
 5605:                     {
 5606:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 5607:                         {
 5608:                             printf("%s", ds_beep);
 5609:                         }
 5610: 
 5611:                         if ((*s_etat_processus).langue == 'F')
 5612:                         {
 5613:                             printf("+++Attention : Queue d'impression "
 5614:                                     "non vide !\n");
 5615:                         }
 5616:                         else
 5617:                         {
 5618:                             printf("+++Warning : Non empty printing "
 5619:                                     "spool queue !\n");
 5620:                         }
 5621: 
 5622:                         instruction_erase(s_etat_processus);
 5623:                     }
 5624: 
 5625:                     if ((*s_etat_processus).fichiers_graphiques != NULL)
 5626:                     {
 5627:                         instruction_cllcd(s_etat_processus);
 5628:                     }
 5629: 
 5630:                     liberation(s_etat_processus, (*s_etat_processus).indep);
 5631:                     liberation(s_etat_processus, (*s_etat_processus).depend);
 5632: 
 5633:                     free((*s_etat_processus).label_x);
 5634:                     free((*s_etat_processus).label_y);
 5635:                     free((*s_etat_processus).label_z);
 5636:                     free((*s_etat_processus).titre);
 5637:                     free((*s_etat_processus).legende);
 5638: 
 5639:                     liberation(s_etat_processus, (*s_etat_processus)
 5640:                             .parametres_courbes_de_niveau);
 5641: 
 5642:                     for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 5643:                     {
 5644:                         liberation(s_etat_processus,
 5645:                                 (*s_etat_processus).corps_interruptions[i]);
 5646: 
 5647:                         l_element_courant = (*s_etat_processus)
 5648:                                 .pile_origine_interruptions[i];
 5649: 
 5650:                         while(l_element_courant != NULL)
 5651:                         {
 5652:                             l_element_suivant = (*((struct_liste_chainee *)
 5653:                                     l_element_courant)).suivant;
 5654: 
 5655:                             liberation(s_etat_processus,
 5656:                                     (*((struct_liste_chainee *)
 5657:                                     l_element_courant)).donnee);
 5658:                             free(l_element_courant);
 5659: 
 5660:                             l_element_courant = l_element_suivant;
 5661:                         }
 5662:                     }
 5663: 
 5664:                     if ((*s_etat_processus).instruction_derniere_erreur
 5665:                             != NULL)
 5666:                     {
 5667:                         free((*s_etat_processus).instruction_derniere_erreur);
 5668:                         (*s_etat_processus).instruction_derniere_erreur = NULL;
 5669:                     }
 5670: 
 5671:                     /*
 5672:                      * Le pointeur s_etat_processus.nom_fichier_source est
 5673:                      * alloué par le système. Il ne faut donc pas
 5674:                      * le libérer...
 5675:                      */
 5676: 
 5677:                     liberation_arbre_variables_partagees(s_etat_processus,
 5678:                             (*(*s_etat_processus).s_arbre_variables_partagees));
 5679:                     liberation_arbre_variables(s_etat_processus,
 5680:                             (*s_etat_processus).s_arbre_variables, d_vrai);
 5681:                     free((*s_etat_processus).pointeurs_caracteres_variables);
 5682: 
 5683:                     l_element_statique_courant = (*s_etat_processus)
 5684:                             .l_liste_variables_statiques;
 5685: 
 5686:                     while(l_element_statique_courant != NULL)
 5687:                     {
 5688:                         l_element_statique_suivant =
 5689:                             (*l_element_statique_courant).suivant;
 5690:                         free(l_element_statique_courant);
 5691:                         l_element_statique_courant = l_element_statique_suivant;
 5692:                     }
 5693: 
 5694:                     l_element_partage_courant = (*(*s_etat_processus)
 5695:                             .l_liste_variables_partagees);
 5696: 
 5697:                     while(l_element_partage_courant != NULL)
 5698:                     {
 5699:                         l_element_partage_suivant =
 5700:                                 (*l_element_partage_courant).suivant;
 5701:                         free(l_element_partage_courant);
 5702:                         l_element_partage_courant = l_element_partage_suivant;
 5703:                     }
 5704: 
 5705:                     /*
 5706:                      * Si resultats est non nul, rplinit a été appelé
 5707:                      * depuis rpl() [librpl] et non main().
 5708:                      * On copie alors le contenu de la * pile dans un
 5709:                      * tableau **resultats dont le pointeur de base a
 5710:                      * été alloué dans rpl().
 5711:                      */
 5712: 
 5713:                     if (resultats != NULL)
 5714:                     {
 5715:                         if ((*resultats) != NULL)
 5716:                         {
 5717:                             free((*resultats));
 5718: 
 5719:                             if (((*resultats) = malloc(((*s_etat_processus)
 5720:                                     .hauteur_pile_operationnelle + 1)
 5721:                                     * sizeof(unsigned char **))) != NULL)
 5722:                             {
 5723:                                 (*resultats)[(*s_etat_processus)
 5724:                                         .hauteur_pile_operationnelle] = NULL;
 5725:                                 l_element_courant = (void *) (*s_etat_processus)
 5726:                                         .l_base_pile;
 5727: 
 5728:                                 for(i = 0; i < (*s_etat_processus)
 5729:                                         .hauteur_pile_operationnelle; i++)
 5730:                                 {
 5731:                                     if (l_element_courant != NULL)
 5732:                                     {
 5733:                                         (*resultats)[i] =
 5734:                                                 formateur(s_etat_processus,
 5735:                                                 0, (*((struct_liste_chainee *)
 5736:                                                 l_element_courant)).donnee);
 5737: 
 5738:                                         if ((*resultats)[i] == NULL)
 5739:                                         {
 5740:                                             i = (*s_etat_processus).
 5741:                                                     hauteur_pile_operationnelle;
 5742:                                         }
 5743:                                         else
 5744:                                         {
 5745:                                             l_element_suivant =
 5746:                                                     (*((struct_liste_chainee *)
 5747:                                                     l_element_courant)).suivant;
 5748:                                         }
 5749:                                     }
 5750:                                 }
 5751:                             }
 5752:                             else
 5753:                             {
 5754:                                 (*resultats) = NULL;
 5755:                                 erreur = d_es_allocation_memoire;
 5756:                             }
 5757:                         }
 5758:                     }
 5759: 
 5760:                     l_element_courant = (void *) (*s_etat_processus)
 5761:                             .l_base_pile;
 5762:                     while(l_element_courant != NULL)
 5763:                     {
 5764:                         l_element_suivant = (*((struct_liste_chainee *)
 5765:                                 l_element_courant)).suivant;
 5766: 
 5767:                         liberation(s_etat_processus,
 5768:                                 (*((struct_liste_chainee *)
 5769:                                 l_element_courant)).donnee);
 5770:                         free((struct_liste_chainee *) l_element_courant);
 5771: 
 5772:                         l_element_courant = l_element_suivant;
 5773:                     }
 5774: 
 5775:                     l_element_courant = (void *) (*s_etat_processus)
 5776:                             .l_base_pile_contextes;
 5777:                     while(l_element_courant != NULL)
 5778:                     {
 5779:                         l_element_suivant = (*((struct_liste_chainee *)
 5780:                                 l_element_courant)).suivant;
 5781: 
 5782:                         liberation(s_etat_processus,
 5783:                                 (*((struct_liste_chainee *)
 5784:                                 l_element_courant)).donnee);
 5785:                         free((struct_liste_chainee *) l_element_courant);
 5786: 
 5787:                         l_element_courant = l_element_suivant;
 5788:                     }
 5789: 
 5790:                     l_element_courant = (void *) (*s_etat_processus)
 5791:                             .l_base_pile_taille_contextes;
 5792:                     while(l_element_courant != NULL)
 5793:                     {
 5794:                         l_element_suivant = (*((struct_liste_chainee *)
 5795:                                 l_element_courant)).suivant;
 5796: 
 5797:                         liberation(s_etat_processus,
 5798:                                 (*((struct_liste_chainee *)
 5799:                                 l_element_courant)).donnee);
 5800:                         free((struct_liste_chainee *) l_element_courant);
 5801: 
 5802:                         l_element_courant = l_element_suivant;
 5803:                     }
 5804: 
 5805:                     for(i = 0; i < (*s_etat_processus)
 5806:                             .nombre_instructions_externes; i++)
 5807:                     {
 5808:                         free((*s_etat_processus).s_instructions_externes[i]
 5809:                                 .nom);
 5810:                         free((*s_etat_processus).s_instructions_externes[i]
 5811:                                 .nom_bibliotheque);
 5812:                     }
 5813: 
 5814:                     if ((*s_etat_processus).nombre_instructions_externes != 0)
 5815:                     {
 5816:                         free((*s_etat_processus).s_instructions_externes);
 5817:                     }
 5818: 
 5819:                     l_element_courant = (void *) (*s_etat_processus)
 5820:                             .s_bibliotheques;
 5821:                     
 5822:                     while(l_element_courant != NULL)
 5823:                     {
 5824:                         l_element_suivant = (*((struct_liste_chainee *)
 5825:                                 l_element_courant)).suivant;
 5826: 
 5827:                         free((*((struct_bibliotheque *)
 5828:                                 (*((struct_liste_chainee *)
 5829:                                 l_element_courant)).donnee)).nom);
 5830:                         dlclose((*((struct_bibliotheque *)
 5831:                                 (*((struct_liste_chainee *)
 5832:                                 l_element_courant)).donnee)).descripteur);
 5833:                         free((*((struct_liste_chainee *) l_element_courant))
 5834:                                 .donnee);
 5835:                         free(l_element_courant);
 5836: 
 5837:                         l_element_courant = l_element_suivant;
 5838:                     }
 5839: 
 5840:                     l_element_courant = (void *) (*s_etat_processus)
 5841:                             .l_base_pile_last;
 5842:                     while(l_element_courant != NULL)
 5843:                     {
 5844:                         l_element_suivant = (*((struct_liste_chainee *)
 5845:                                 l_element_courant)).suivant;
 5846: 
 5847:                         liberation(s_etat_processus,
 5848:                                 (*((struct_liste_chainee *)
 5849:                                 l_element_courant)).donnee);
 5850:                         free((struct_liste_chainee *) l_element_courant);
 5851: 
 5852:                         l_element_courant = l_element_suivant;
 5853:                     }
 5854: 
 5855:                     l_element_courant = (void *) (*s_etat_processus)
 5856:                             .l_base_pile_systeme;
 5857:                     while(l_element_courant != NULL)
 5858:                     {
 5859:                         l_element_suivant = (*((struct_liste_pile_systeme *)
 5860:                                 l_element_courant)).suivant;
 5861: 
 5862:                         liberation(s_etat_processus,
 5863:                                 (*((struct_liste_pile_systeme *)
 5864:                                 l_element_courant)).indice_boucle);
 5865:                         liberation(s_etat_processus,
 5866:                                 (*((struct_liste_pile_systeme *)
 5867:                                 l_element_courant)).limite_indice_boucle);
 5868:                         liberation(s_etat_processus,
 5869:                                 (*((struct_liste_pile_systeme *)
 5870:                                 l_element_courant)).objet_de_test);
 5871: 
 5872:                         if ((*((struct_liste_pile_systeme *)
 5873:                                 l_element_courant)).nom_variable != NULL)
 5874:                         {
 5875:                             free((*((struct_liste_pile_systeme *)
 5876:                                     l_element_courant)).nom_variable);
 5877:                         }
 5878: 
 5879:                         free((struct_liste_pile_systeme *)
 5880:                                 l_element_courant);
 5881: 
 5882:                         l_element_courant = l_element_suivant;
 5883:                     }
 5884: 
 5885:                     l_element_courant = (void *)
 5886:                             (*s_etat_processus).s_fichiers;
 5887:                     while(l_element_courant != NULL)
 5888:                     {
 5889:                         l_element_suivant = (*((struct_liste_chainee *)
 5890:                                 l_element_courant)).suivant;
 5891: 
 5892:                         fclose((*((struct_descripteur_fichier *)
 5893:                                 (*((struct_liste_chainee *)
 5894:                                 l_element_courant)).donnee))
 5895:                                 .descripteur_c);
 5896: 
 5897:                         if ((*((struct_descripteur_fichier *)
 5898:                                 (*((struct_liste_chainee *)
 5899:                                 l_element_courant)).donnee)).type != 'C')
 5900:                         {
 5901:                             sqlite3_close((*((struct_descripteur_fichier *)
 5902:                                     (*((struct_liste_chainee *)
 5903:                                     l_element_courant)).donnee))
 5904:                                     .descripteur_sqlite);
 5905:                         }
 5906: 
 5907:                         if ((*((struct_descripteur_fichier *)
 5908:                                 (*((struct_liste_chainee *)
 5909:                                 l_element_courant)).donnee))
 5910:                                 .effacement == 'Y')
 5911:                         {
 5912:                             unlink((*((struct_descripteur_fichier *)
 5913:                                     (*((struct_liste_chainee *)
 5914:                                     l_element_courant)).donnee))
 5915:                                     .nom);
 5916:                         }
 5917: 
 5918:                         free((*((struct_descripteur_fichier *)
 5919:                                 (*((struct_liste_chainee *)
 5920:                                 l_element_courant)).donnee)).nom);
 5921:                         free((struct_descripteur_fichier *)
 5922:                                 (*((struct_liste_chainee *)
 5923:                                 l_element_courant)).donnee);
 5924:                         free(l_element_courant);
 5925: 
 5926:                         l_element_courant = l_element_suivant;
 5927:                     }
 5928: 
 5929:                     l_element_courant = (void *)
 5930:                             (*s_etat_processus).s_sockets;
 5931:                     while(l_element_courant != NULL)
 5932:                     {
 5933:                         l_element_suivant = (*((struct_liste_chainee *)
 5934:                                 l_element_courant)).suivant;
 5935: 
 5936:                         if ((*((struct_socket *)
 5937:                                 (*(*((struct_liste_chainee *)
 5938:                                 l_element_courant)).donnee).objet))
 5939:                                 .socket_connectee == d_vrai)
 5940:                         {
 5941:                             shutdown((*((struct_socket *)
 5942:                                     (*(*((struct_liste_chainee *)
 5943:                                     l_element_courant)).donnee).objet))
 5944:                                     .socket, SHUT_RDWR);
 5945:                         }
 5946: 
 5947:                         close((*((struct_socket *)
 5948:                                 (*(*((struct_liste_chainee *)
 5949:                                 l_element_courant)).donnee).objet)).socket);
 5950: 
 5951:                         if ((*((struct_socket *) (*(*((struct_liste_chainee *)
 5952:                                 l_element_courant)).donnee).objet)).effacement
 5953:                                 == 'Y')
 5954:                         {
 5955:                             unlink((*((struct_socket *)
 5956:                                     (*(*((struct_liste_chainee *)
 5957:                                     l_element_courant)).donnee).objet))
 5958:                                     .adresse);
 5959:                         }
 5960: 
 5961:                         liberation(s_etat_processus,
 5962:                                 (*((struct_liste_chainee *)
 5963:                                 l_element_courant)).donnee);
 5964:                         free(l_element_courant);
 5965: 
 5966:                         l_element_courant = l_element_suivant;
 5967:                     }
 5968: 
 5969:                     l_element_courant = (void *)
 5970:                             (*s_etat_processus).s_connecteurs_sql;
 5971:                     while(l_element_courant != NULL)
 5972:                     {
 5973:                         l_element_suivant = (*((struct_liste_chainee *)
 5974:                                 l_element_courant)).suivant;
 5975: 
 5976:                         sqlclose((*((struct_liste_chainee *)
 5977:                                 l_element_courant)).donnee);
 5978:                         liberation(s_etat_processus,
 5979:                                 (*((struct_liste_chainee *)
 5980:                                 l_element_courant)).donnee);
 5981:                         free(l_element_courant);
 5982: 
 5983:                         l_element_courant = l_element_suivant;
 5984:                     }
 5985: 
 5986:                     l_element_courant = (*s_etat_processus).s_marques;
 5987:                     while(l_element_courant != NULL)
 5988:                     {
 5989:                         free((*((struct_marque *) l_element_courant)).label);
 5990:                         free((*((struct_marque *) l_element_courant)).position);
 5991:                         l_element_suivant = (*((struct_marque *)
 5992:                                 l_element_courant)).suivant;
 5993:                         free(l_element_courant);
 5994:                         l_element_courant = l_element_suivant;
 5995:                     }
 5996:                 }
 5997:                 else
 5998:                 {
 5999:                     erreur = d_es_allocation_memoire;
 6000: 
 6001:                     if (test_cfsf(s_etat_processus, 51) == d_faux)
 6002:                     {
 6003:                         printf("%s", ds_beep);
 6004:                     }
 6005: 
 6006:                     if ((*s_etat_processus).langue == 'F')
 6007:                     {
 6008:                         printf("+++Système : Mémoire insuffisante\n");
 6009:                     }
 6010:                     else
 6011:                     {
 6012:                         printf("+++System : Not enough memory\n");
 6013:                     }
 6014:                 }
 6015:             }
 6016: 
 6017:             liberation_allocateur(s_etat_processus);
 6018:         }
 6019: 
 6020:         if (traitement_fichier_temporaire == 'Y')
 6021:         {
 6022:             destruction_fichier(nom_fichier_temporaire);
 6023:             free(nom_fichier_temporaire);
 6024:         }
 6025: 
 6026:         if ((*s_etat_processus).profilage == d_vrai)
 6027:         {
 6028:             ecriture_profil(s_etat_processus);
 6029:             liberation_profil(s_etat_processus);
 6030:         }
 6031:     }
 6032: 
 6033:     closelog();
 6034: 
 6035:     pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes));
 6036: 
 6037:     retrait_thread(s_etat_processus);
 6038: 
 6039:     pthread_mutex_destroy(&((*s_etat_processus).mutex));
 6040:     pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation));
 6041:     pthread_mutex_destroy(&mutex_sections_critiques);
 6042: 
 6043: #   ifndef SEMAPHORES_NOMMES
 6044:     sem_post(&((*s_etat_processus).semaphore_fork));
 6045:     sem_destroy(&((*s_etat_processus).semaphore_fork));
 6046: #   else
 6047:     sem_post((*s_etat_processus).semaphore_fork);
 6048:     sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(),
 6049:             SEM_FORK);
 6050: #   endif
 6051: 
 6052:     free((*s_etat_processus).localisation);
 6053: 
 6054: #   ifndef SEMAPHORES_NOMMES
 6055:     sem_post(&semaphore_gestionnaires_signaux);
 6056:     sem_destroy(&semaphore_gestionnaires_signaux);
 6057: #   else
 6058:     sem_post(semaphore_gestionnaires_signaux);
 6059:     sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
 6060: #   endif
 6061: 
 6062:     destruction_queue_signaux(s_etat_processus);
 6063:     liberation_contexte_cas(s_etat_processus);
 6064: 
 6065:     free((*s_etat_processus).chemin_fichiers_temporaires);
 6066: 
 6067:     if ((*s_etat_processus).requete_redemarrage == d_vrai)
 6068:     {
 6069:         chdir(repertoire_initial);
 6070:         execvp(arg_exec[0], &(arg_exec[0]));
 6071:         erreur = d_erreur;
 6072:     }
 6073: 
 6074:     free(arg_exec);
 6075:     arret_thread_signaux(s_etat_processus);
 6076:     free(s_etat_processus);
 6077: 
 6078: #   ifdef DEBUG_MEMOIRE
 6079:     debug_memoire_verification();
 6080:     analyse_post_mortem();
 6081: #   endif
 6082: 
 6083: #   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 6084:     stackoverflow_deinstall_handler();
 6085: #   endif
 6086: 
 6087: #   ifdef HAVE_SIGSEGV_RECOVERY
 6088:     if (debug == d_faux)
 6089:     {
 6090:         sigsegv_deinstall_handler();
 6091:     }
 6092: #   endif
 6093: 
 6094:     return((erreur == d_absence_erreur) ? EXIT_SUCCESS : EXIT_FAILURE);
 6095: }
 6096: 
 6097: 
 6098: void
 6099: informations(struct_processus *s_etat_processus)
 6100: {
 6101:     printf("\n");
 6102: 
 6103:     if ((*s_etat_processus).langue == 'F')
 6104:     {
 6105:         printf("  rpl [-options] [programme]\n");
 6106:         printf("      -a : analyse du code\n");
 6107:         printf("      -A : paramètres passés au programme principal\n");
 6108:         printf("      -c : génération de fichier de débogage (rpl-core)\n");
 6109:         printf("      -d : option de déverminage interne\n");
 6110:         printf("      -D : lancement d'un daemon\n");
 6111:         printf("      -h : aide sur la ligne de commande\n");
 6112:         printf("      -i : fonctionnement interactif\n");
 6113:         printf("      -l : licence d'utilisation\n");
 6114:         printf("      -n : ignorance du signal HUP\n");
 6115:         printf("      -p : précompilation du script avant exécution\n");
 6116:         printf("      -P : profilage (-P ou -PP)\n");
 6117:         printf("      -s : empêchement de l'ouverture de l'écran initial\n");
 6118:         printf("      -S : exécution du script passé en ligne de commande\n");
 6119:         printf("      -t : trace\n");
 6120:         printf("      -v : version\n");
 6121:     }
 6122:     else
 6123:     {
 6124:         printf("  rpl [-options] [program]\n");
 6125:         printf("      -a : analyzes program\n");
 6126:         printf("      -A : sends parameters to main program\n");
 6127:         printf("      -c : allows creation of a rpl-core file, providing a way"
 6128:                 "\n"
 6129:                 "           to debug a program\n");
 6130:         printf("      -d : internal debug process\n");
 6131:         printf("      -D : starts in daemon mode\n");
 6132:         printf("      -h : shows a summary of available options\n");
 6133:         printf("      -i : runs the RPL/2 sequencer in interactive mode\n");
 6134:         printf("      -l : prints the user licence of the software\n");
 6135:         printf("      -n : ignores HUP signal\n");
 6136:         printf("      -p : precompiles script\n");
 6137:         printf("      -P : computes profile data (-P or -PP)\n");
 6138:         printf("      -s : disables splash screen\n");
 6139:         printf("      -S : executes script written in command line\n");
 6140:         printf("      -t : enables tracing mode\n");
 6141:         printf("      -v : prints the version number\n");
 6142:     }
 6143: 
 6144:     printf("\n");
 6145: 
 6146:     return;
 6147: }
 6148: 
 6149: 
 6150: logical1
 6151: controle_integrite(struct_processus *s_etat_processus,
 6152:         unsigned char *executable_candidat, unsigned char *executable)
 6153: {
 6154:     unsigned char       *md5;
 6155:     unsigned char       *sha1;
 6156: 
 6157:     if (strcmp(executable, "rplpp") == 0)
 6158:     {
 6159:         md5 = rplpp_md5;
 6160:         sha1 = rplpp_sha1;
 6161:     }
 6162:     else if (strcmp(executable, "rplfile") == 0)
 6163:     {
 6164:         md5 = rplfile_md5;
 6165:         sha1 = rplfile_sha1;
 6166:     }
 6167:     else if (strcmp(executable, "rpliconv") == 0)
 6168:     {
 6169:         md5 = rpliconv_md5;
 6170:         sha1 = rpliconv_sha1;
 6171:     }
 6172:     else if (strcmp(executable, "rplawk") == 0)
 6173:     {
 6174:         md5 = rplawk_md5;
 6175:         sha1 = rplawk_sha1;
 6176:     }
 6177:     else if (strcmp(executable, "rplconvert") == 0)
 6178:     {
 6179:         md5 = rplconvert_md5;
 6180:         sha1 = rplconvert_sha1;
 6181:     }
 6182:     else
 6183:     {
 6184:         return(d_faux);
 6185:     }
 6186: 
 6187:     if (controle(s_etat_processus, executable_candidat, "md5", md5) != d_vrai)
 6188:     {
 6189:         return(d_faux);
 6190:     }
 6191: 
 6192:     if (controle(s_etat_processus, executable_candidat, "sha1", sha1) != d_vrai)
 6193:     {
 6194:         return(d_faux);
 6195:     }
 6196: 
 6197:     return(d_vrai);
 6198: }
 6199: 
 6200: 
 6201: unsigned char *
 6202: date_compilation()
 6203: {
 6204:     unsigned char       *date;
 6205: 
 6206:     if ((date = malloc((strlen(d_date_en_rpl) + 1) * sizeof(unsigned char)))
 6207:             == NULL)
 6208:     {
 6209:         return(NULL);
 6210:     }
 6211: 
 6212:     strcpy(date, d_date_en_rpl);
 6213: 
 6214:     return(date);
 6215: }
 6216: 
 6217: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>