File:  [local] / rpl / src / rpl.c
Revision 1.214: download - view: text, annotated - select for diffs - revision graph
Fri Jan 10 11:15:50 2020 UTC (4 years, 3 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Modification du copyright.

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

CVSweb interface <joel.bertrand@systella.fr>