File:  [local] / rpl / src / rpl.c
Revision 1.211: download - view: text, annotated - select for diffs - revision graph
Sun Feb 17 16:08:41 2019 UTC (5 years, 2 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Modification des mutexes pour éviter une condition bloquante.

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

CVSweb interface <joel.bertrand@systella.fr>