File:  [local] / rpl / src / rpl.c
Revision 1.133: download - view: text, annotated - select for diffs - revision graph
Mon Feb 25 11:24:02 2013 UTC (11 years, 2 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
DIGEST supporte maintenant les signatures HMAC avec clef.

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

CVSweb interface <joel.bertrand@systella.fr>