File:  [local] / rpl / src / rpl.c
Revision 1.195: download - view: text, annotated - select for diffs - revision graph
Tue Jul 4 10:28:08 2017 UTC (6 years, 10 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Ajout de l'option -m.

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

CVSweb interface <joel.bertrand@systella.fr>