File:  [local] / rpl / src / rpl.c
Revision 1.163: download - view: text, annotated - select for diffs - revision graph
Mon Jan 5 15:32:24 2015 UTC (9 years, 4 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
En route vers la 4.1.20.

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

CVSweb interface <joel.bertrand@systella.fr>