File:  [local] / rpl / src / rpl.c
Revision 1.105: download - view: text, annotated - select for diffs - revision graph
Wed Nov 30 20:50:22 2011 UTC (12 years, 5 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Remplacement de execve() par execvp() pour utliser la variable PATH.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.1.5
    4:   Copyright (C) 1989-2011 Dr. BERTRAND Joël
    5: 
    6:   This file is part of RPL/2.
    7: 
    8:   RPL/2 is free software; you can redistribute it and/or modify it
    9:   under the terms of the CeCILL V2 License as published by the french
   10:   CEA, CNRS and INRIA.
   11:  
   12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
   13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
   15:   for more details.
   16:  
   17:   You should have received a copy of the CeCILL License
   18:   along with RPL/2. If not, write to info@cecill.info.
   19: ================================================================================
   20: */
   21: 
   22: 
   23: #define  MAIN_RPL
   24: #include "rpl-conv.h"
   25: 
   26: 
   27: /*
   28: ================================================================================
   29:   Programme principal
   30: ================================================================================
   31: */
   32: 
   33: int
   34: rplinit(int argc, char *argv[], char *envp[],
   35:         unsigned char ***resultats, char *rpl_home)
   36: {
   37: #   include                             "copyright-conv.h"
   38: #   include                             "licence-conv.h"
   39: 
   40:     char                                **arg_exec;
   41: 
   42: #   ifdef HAVE_STACK_OVERFLOW_RECOVERY
   43:     char                                pile_signaux[SIGSTKSZ];
   44: #   endif
   45: 
   46: #   define RPL_PATH_MAX                 1024
   47:     char                                repertoire_initial[RPL_PATH_MAX];
   48: 
   49:     file                                *f_source;
   50: 
   51:     int                                 erreur_historique;
   52:     int                                 option_P;
   53: 
   54:     logical1                            core;
   55:     logical1                            debug;
   56:     logical1                            erreur_fichier;
   57:     logical1                            existence;
   58:     logical1                            mode_interactif;
   59:     logical1                            option_a;
   60:     logical1                            option_A;
   61:     logical1                            option_c;
   62:     logical1                            option_d;
   63:     logical1                            option_D;
   64:     logical1                            option_h;
   65:     logical1                            option_i;
   66:     logical1                            option_l;
   67:     logical1                            option_n;
   68:     logical1                            option_p;
   69:     logical1                            option_s;
   70:     logical1                            option_S;
   71:     logical1                            option_t;
   72:     logical1                            option_v;
   73:     logical1                            ouverture;
   74: 
   75:     pthread_mutexattr_t                 attributs_mutex;
   76: 
   77:     ssize_t                             longueur_ecriture;
   78: 
   79:     struct_objet                        *s_objet;
   80: 
   81:     struct_processus                    *s_etat_processus;
   82: 
   83:     struct_table_variables_partagees    s_variables_partagees;
   84: 
   85:     struct sigaction                    action;
   86:     struct sigaction                    registre;
   87: 
   88:     struct timespec                     attente;
   89: 
   90:     unsigned char                       *arguments;
   91:     unsigned char                       drapeau_encart;
   92:     unsigned char                       *type_debug;
   93:     unsigned char                       *home;
   94:     unsigned char                       *langue;
   95:     unsigned char                       *message;
   96:     unsigned char                       *nom_fichier_temporaire;
   97:     unsigned char                       option;
   98:     unsigned char                       presence_definition;
   99:     unsigned char                       *ptr;
  100:     unsigned char                       *tampon;
  101: 
  102:     unsigned long                       i;
  103:     unsigned long                       unite_fichier;
  104: 
  105:     void                                *l_element_courant;
  106:     void                                *l_element_suivant;
  107: 
  108:     volatile int                        erreur;
  109:     volatile unsigned char              traitement_fichier_temporaire;
  110: 
  111:     errno = 0;
  112:     s_queue_signaux = NULL;
  113:     routine_recursive = 0;
  114:     pid_processus_pere = getpid();
  115: 
  116: #   ifdef DEBUG_MEMOIRE
  117:     debug_memoire_initialisation();
  118: #   endif
  119: 
  120:     setvbuf(stdout, NULL, _IOLBF, 0);
  121:     setvbuf(stderr, NULL, _IOLBF, 0);
  122: 
  123: #   ifndef SEMAPHORES_NOMMES
  124:     sem_init(&semaphore_gestionnaires_signaux, 0, 0);
  125: #   else
  126:     semaphore_gestionnaires_signaux = sem_init2(0, getpid(), SEM_SIGNAUX);
  127:     
  128:     if (semaphore_gestionnaires_signaux == SEM_FAILED)
  129:     {
  130:         erreur = d_es_allocation_memoire;
  131: 
  132:         if ((langue = getenv("LANG")) != NULL)
  133:         {
  134:             if (strncmp(langue, "fr", 2) == 0)
  135:             {
  136:                 uprintf("+++Système : Mémoire insuffisante\n");
  137:             }
  138:             else
  139:             {
  140:                 uprintf("+++System : Not enough memory\n");
  141:             }
  142:         }
  143:         else
  144:         {
  145:             uprintf("+++System : Not enough memory\n");
  146:         }
  147: 
  148:         return(EXIT_FAILURE);
  149:     }
  150: #   endif
  151: 
  152:     if ((s_etat_processus = malloc(sizeof(struct_processus))) == NULL)
  153:     {
  154:         erreur = d_es_allocation_memoire;
  155: 
  156:         if ((langue = getenv("LANG")) != NULL)
  157:         {
  158:             if (strncmp(langue, "fr", 2) == 0)
  159:             {
  160:                 uprintf("+++Système : Mémoire insuffisante\n");
  161:             }
  162:             else
  163:             {
  164:                 uprintf("+++System : Not enough memory\n");
  165:             }
  166:         }
  167:         else
  168:         {
  169:             uprintf("+++System : Not enough memory\n");
  170:         }
  171: 
  172:         return(EXIT_FAILURE);
  173:     }
  174: 
  175:     if ((langue = getenv("LANG")) != NULL)
  176:     {
  177:         (*s_etat_processus).langue = (strncmp(langue, "fr", 2) == 0)
  178:                 ? 'F' : 'E';
  179:     }
  180:     else
  181:     {
  182:         (*s_etat_processus).langue = 'E';
  183:     }
  184: 
  185:     if (getcwd(repertoire_initial, RPL_PATH_MAX) == NULL)
  186:     {
  187:         if ((langue = getenv("LANG")) != NULL)
  188:         {
  189:             if (strncmp(langue, "fr", 2) == 0)
  190:             {
  191:                 uprintf("+++Système : Mémoire insuffisante\n");
  192:             }
  193:             else
  194:             {
  195:                 uprintf("+++System : Not enough memory\n");
  196:             }
  197:         }
  198:         else
  199:         {
  200:             uprintf("+++System : Not enough memory\n");
  201:         }
  202: 
  203:         return(EXIT_FAILURE);
  204:     }
  205: 
  206:     if ((arg_exec = malloc((argc + 1) * sizeof(char *))) == NULL)
  207:     {
  208:         if ((langue = getenv("LANG")) != NULL)
  209:         {
  210:             if (strncmp(langue, "fr", 2) == 0)
  211:             {
  212:                 uprintf("+++Système : Mémoire insuffisante\n");
  213:             }
  214:             else
  215:             {
  216:                 uprintf("+++System : Not enough memory\n");
  217:             }
  218:         }
  219:         else
  220:         {
  221:             uprintf("+++System : Not enough memory\n");
  222:         }
  223: 
  224:         return(EXIT_FAILURE);
  225:     }
  226: 
  227:     for(i = 0; i < (unsigned long) argc; i++)
  228:     {
  229:         arg_exec[i] = argv[i];
  230:     }
  231: 
  232:     argv[argc] = NULL;
  233: 
  234:     initialisation_contexte_cas(s_etat_processus);
  235: 
  236:     (*s_etat_processus).exception = d_ep;
  237:     (*s_etat_processus).erreur_systeme = d_es;
  238:     (*s_etat_processus).erreur_execution = d_ex;
  239: 
  240:     (*s_etat_processus).requete_redemarrage = d_faux;
  241:     (*s_etat_processus).rpl_home = rpl_home;
  242: 
  243:     pthread_mutexattr_init(&attributs_mutex);
  244:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
  245:     pthread_mutex_init(&((*s_etat_processus).mutex), &attributs_mutex);
  246:     pthread_mutexattr_destroy(&attributs_mutex);
  247: 
  248:     pthread_mutexattr_init(&attributs_mutex);
  249:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
  250:     pthread_mutex_init(&((*s_etat_processus).mutex_allocation),
  251:             &attributs_mutex);
  252:     pthread_mutexattr_destroy(&attributs_mutex);
  253: 
  254: #   ifndef SEMAPHORES_NOMMES
  255:         sem_init(&((*s_etat_processus).semaphore_fork), 0, 0);
  256: #   else
  257:         if (((*s_etat_processus).semaphore_fork = sem_init3(0, getpid(),
  258:                 pthread_self(), SEM_FORK)) == SEM_FAILED)
  259:         {
  260:             if ((*s_etat_processus).langue == 'F')
  261:             {
  262:                 uprintf("+++Système : Mémoire insuffisante\n");
  263:             }
  264:             else
  265:             {
  266:                 uprintf("+++System : Not enough memory\n");
  267:             }
  268: 
  269:             return(EXIT_FAILURE);
  270:         }
  271: #   endif
  272: 
  273:     pthread_mutexattr_init(&attributs_mutex);
  274:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
  275:     pthread_mutex_init(&((*s_etat_processus).protection_liste_mutexes),
  276:             &attributs_mutex);
  277:     pthread_mutexattr_destroy(&attributs_mutex);
  278: 
  279:     (*s_etat_processus).s_liste_variables_partagees = &s_variables_partagees;
  280: 
  281:     s_variables_partagees.nombre_variables = 0;
  282:     s_variables_partagees.nombre_variables_allouees = 0;
  283:     s_variables_partagees.table = NULL;
  284: 
  285:     pthread_mutexattr_init(&attributs_mutex);
  286:     pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL);
  287:     pthread_mutex_init(&((*((*s_etat_processus).s_liste_variables_partagees))
  288:             .mutex), &attributs_mutex);
  289:     pthread_mutexattr_destroy(&attributs_mutex);
  290: 
  291:     (*s_etat_processus).chemin_fichiers_temporaires =
  292:             recherche_chemin_fichiers_temporaires(s_etat_processus);
  293: 
  294:     insertion_thread(s_etat_processus, d_vrai);
  295:     creation_queue_signaux(s_etat_processus);
  296: 
  297: #   ifndef OS2
  298:     localisation_courante(s_etat_processus);
  299: #   else
  300:     if ((*s_etat_processus).erreur_systeme != d_es)
  301:     {
  302:         if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + 1) *
  303:                 sizeof(unsigned char))) == NULL)
  304:         {
  305:             if ((*s_etat_processus).langue == 'F')
  306:             {
  307:                 uprintf("+++Système : Mémoire insuffisante\n");
  308:             }
  309:             else
  310:             {
  311:                 uprintf("+++System : Not enough memory\n");
  312:             }
  313: 
  314:             return(EXIT_FAILURE);
  315:         }
  316: 
  317:         strcpy((*s_etat_processus).localisation, d_locale);
  318:     }
  319: #   endif
  320: 
  321:     (*s_etat_processus).erreur_systeme = d_es;
  322: 
  323:     if ((*s_etat_processus).localisation == NULL)
  324:     {
  325:         if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + 1) *
  326:                 sizeof(unsigned char))) == NULL)
  327:         {
  328:             if ((*s_etat_processus).langue == 'F')
  329:             {
  330:                 uprintf("+++Système : Mémoire insuffisante\n");
  331:             }
  332:             else
  333:             {
  334:                 uprintf("+++System : Not enough memory\n");
  335:             }
  336: 
  337:             return(EXIT_FAILURE);
  338:         }
  339: 
  340:         strcpy((*s_etat_processus).localisation, d_locale);
  341:     }
  342: 
  343:     printf("+++RPL/2 (R) version %s (%s)\n", d_version_rpl,
  344:             ((*s_etat_processus).langue == 'F') ? d_date_rpl : d_date_en_rpl);
  345: 
  346:     if ((*s_etat_processus).langue == 'F')
  347:     {
  348:         printf("+++Copyright (C) 1989 à 2010, 2011 BERTRAND Joël\n");
  349:     }
  350:     else
  351:     {
  352:         printf("+++Copyright (C) 1989 to 2010, 2011 BERTRAND Joel\n");
  353:     }
  354: 
  355:     if (getenv("HOME") != NULL)
  356:     {
  357:         home = getenv("HOME");
  358:     }
  359:     else if ((getenv("USER") != NULL) && (getpwnam(getenv("USER")) != NULL))
  360:     {
  361:         home = getpwnam(getenv("USER"))->pw_dir;
  362:     }
  363:     else if ((getenv("LOGNAME") != NULL) && (getpwnam(getenv("LOGNAME"))
  364:             != NULL))
  365:     {
  366:         home = getpwnam(getenv("LOGNAME"))->pw_dir;
  367:     }
  368:     else if ((getuid() != ((uid_t) -1)) && (getpwuid(getuid()) != NULL))
  369:     {
  370:         home = getpwuid(getuid())->pw_dir;
  371:     }
  372:     else
  373:     {
  374:         home = "";
  375:     }
  376: 
  377: #   ifdef HAVE_STACK_OVERFLOW_RECOVERY
  378:         if (stackoverflow_install_handler(interruption_depassement_pile,
  379:                 pile_signaux, sizeof(pile_signaux)) != 0)
  380:         {
  381:             erreur = d_es_signal;
  382: 
  383:             if ((*s_etat_processus).langue == 'F')
  384:             {
  385:                 printf("+++Système : Initialisation de la pile alternative "
  386:                         "impossible\n");
  387:             }
  388:             else
  389:             {
  390:                 printf("+++System : Initialization of alternate "
  391:                         "stack failed\n");
  392:             }
  393: 
  394:             return(EXIT_FAILURE);
  395:         }
  396: #   else
  397:         if ((*s_etat_processus).langue == 'F')
  398:         {
  399:             printf("+++Attention : Le système ne supporte pas de pile "
  400:                     "alternative\n");
  401:         }
  402:         else
  403:         {
  404:             printf("+++Warning : Operating system does not support alternate "
  405:                     "stack\n");
  406:         }
  407: #   endif
  408: 
  409:     action.sa_handler = interruption1;
  410:     action.sa_flags = 0;
  411: 
  412:     if (sigaction(SIGINT, &action, NULL) != 0)
  413:     {
  414:         erreur = d_es_signal;
  415: 
  416:         if ((*s_etat_processus).langue == 'F')
  417:         {
  418:             printf("+++Système : Initialisation des signaux POSIX "
  419:                     "impossible\n");
  420:         }
  421:         else
  422:         {
  423:             printf("+++System : Initialization of POSIX signals failed\n");
  424:         }
  425: 
  426:         return(EXIT_FAILURE);
  427:     }
  428: 
  429:     signal_test = SIGTEST;
  430:     kill(getpid(), SIGINT);
  431: 
  432:     if (signal_test != SIGINT)
  433:     {
  434:         erreur = d_es_signal;
  435: 
  436:         if ((*s_etat_processus).langue == 'F')
  437:         {
  438:             printf("+++Système : Initialisation des signaux POSIX "
  439:                     "impossible\n");
  440:         }
  441:         else
  442:         {
  443:             printf("+++System : Initialization of POSIX signals failed\n");
  444:         }
  445: 
  446:         return(EXIT_FAILURE);
  447:     }
  448: 
  449:     if (sigaction(SIGTERM, &action, NULL) != 0)
  450:     {
  451:         erreur = d_es_signal;
  452: 
  453:         if ((*s_etat_processus).langue == 'F')
  454:         {
  455:             printf("+++Système : Initialisation des signaux POSIX "
  456:                     "impossible\n");
  457:         }
  458:         else
  459:         {
  460:             printf("+++System : Initialization of POSIX signals failed\n");
  461:         }
  462: 
  463:         return(EXIT_FAILURE);
  464:     }
  465: 
  466:     signal_test = SIGTEST;
  467:     kill(getpid(), SIGTERM);
  468: 
  469:     if (signal_test != SIGTERM)
  470:     {
  471:         erreur = d_es_signal;
  472: 
  473:         if ((*s_etat_processus).langue == 'F')
  474:         {
  475:             printf("+++Système : Initialisation des signaux POSIX "
  476:                     "impossible\n");
  477:         }
  478:         else
  479:         {
  480:             printf("+++System : Initialization of POSIX signals failed\n");
  481:         }
  482: 
  483:         return(EXIT_FAILURE);
  484:     }
  485: 
  486:     action.sa_handler = interruption2;
  487:     action.sa_flags = 0;
  488: 
  489:     if (sigaction(SIGTSTP, &action, NULL) != 0)
  490:     {
  491:         if ((*s_etat_processus).langue == 'F')
  492:         {
  493:             printf("+++Système : Initialisation des signaux POSIX "
  494:                     "impossible\n");
  495:         }
  496:         else
  497:         {
  498:             printf("+++System : Initialization of POSIX signals failed\n");
  499:         }
  500: 
  501:         return(EXIT_FAILURE);
  502:     }
  503: 
  504:     signal_test = SIGTEST;
  505:     kill(getpid(), SIGTSTP);
  506: 
  507:     if (signal_test != SIGTSTP)
  508:     {
  509:         erreur = d_es_signal;
  510: 
  511:         if ((*s_etat_processus).langue == 'F')
  512:         {
  513:             printf("+++Système : Initialisation des signaux POSIX "
  514:                     "impossible\n");
  515:         }
  516:         else
  517:         {
  518:             printf("+++System : Initialization of POSIX signals failed\n");
  519:         }
  520: 
  521:         return(EXIT_FAILURE);
  522:     }
  523: 
  524:     action.sa_handler = interruption5;
  525:     action.sa_flags = 0;
  526: 
  527:     if (sigaction(SIGPIPE, &action, NULL) != 0)
  528:     {
  529:         erreur = d_es_signal;
  530: 
  531:         if ((*s_etat_processus).langue == 'F')
  532:         {
  533:             printf("+++Système : Initialisation des signaux POSIX "
  534:                     "impossible\n");
  535:         }
  536:         else
  537:         {
  538:             printf("+++System : Initialization of POSIX signals failed\n");
  539:         }
  540: 
  541:         return(EXIT_FAILURE);
  542:     }
  543: 
  544:     signal_test = SIGTEST;
  545:     kill(getpid(), SIGPIPE);
  546: 
  547:     if (signal_test != SIGPIPE)
  548:     {
  549:         erreur = d_es_signal;
  550: 
  551:         if ((*s_etat_processus).langue == 'F')
  552:         {
  553:             printf("+++Système : Initialisation des signaux POSIX "
  554:                     "impossible\n");
  555:         }
  556:         else
  557:         {
  558:             printf("+++System : Initialization of POSIX signals failed\n");
  559:         }
  560: 
  561:         return(EXIT_FAILURE);
  562:     }
  563: 
  564:     action.sa_handler = interruption1;
  565:     action.sa_flags = 0;
  566: 
  567:     if (sigaction(SIGUSR1, &action, NULL) != 0)
  568:     {
  569:         erreur = d_es_signal;
  570: 
  571:         if ((*s_etat_processus).langue == 'F')
  572:         {
  573:             printf("+++Système : Initialisation des signaux POSIX "
  574:                     "impossible\n");
  575:         }
  576:         else
  577:         {
  578:             printf("+++System : Initialization of POSIX signals failed\n");
  579:         }
  580: 
  581:         return(EXIT_FAILURE);
  582:     }
  583: 
  584:     signal_test = SIGTEST;
  585:     kill(getpid(), SIGUSR1);
  586: 
  587:     if (signal_test != SIGUSR1)
  588:     {
  589:         erreur = d_es_signal;
  590: 
  591:         if ((*s_etat_processus).langue == 'F')
  592:         {
  593:             printf("+++Système : Initialisation des signaux POSIX "
  594:                     "impossible\n");
  595:         }
  596:         else
  597:         {
  598:             printf("+++System : Initialization of POSIX signals failed\n");
  599:         }
  600: 
  601:         return(EXIT_FAILURE);
  602:     }
  603: 
  604:     signal_test = SIGTEST + 1;
  605: 
  606:     erreur = d_absence_erreur;
  607:     core = d_faux;
  608:     mode_interactif = d_faux;
  609:     (*s_etat_processus).nom_fichier_source = NULL;
  610:     (*s_etat_processus).definitions_chainees = NULL;
  611:     (*s_etat_processus).type_debug = 0;
  612:     traitement_fichier_temporaire = 'N';
  613:     option = ' ';
  614:     drapeau_encart = 'Y';
  615:     debug = d_faux;
  616:     arguments = NULL;
  617: 
  618:     (*s_etat_processus).s_fichiers = NULL;
  619:     (*s_etat_processus).s_sockets = NULL;
  620:     (*s_etat_processus).s_connecteurs_sql = NULL;
  621: 
  622:     setlogmask(LOG_MASK(LOG_NOTICE));
  623:     openlog(argv[0], LOG_ODELAY | LOG_PID, LOG_USER);
  624: 
  625:     if (argc == 1)
  626:     {
  627:         erreur = d_erreur;
  628:         informations(s_etat_processus);
  629:     }
  630:     else
  631:     {
  632:         presence_definition = 'N';
  633:         (*s_etat_processus).debug = d_faux;
  634:         (*s_etat_processus).lancement_interactif = d_faux;
  635: 
  636:         option_a = d_faux;
  637:         option_A = d_faux;
  638:         option_c = d_faux;
  639:         option_d = d_faux;
  640:         option_D = d_faux;
  641:         option_h = d_faux;
  642:         option_i = d_faux;
  643:         option_l = d_faux;
  644:         option_n = d_faux;
  645:         option_p = d_faux;
  646:         option_P = 0;
  647:         option_s = d_faux;
  648:         option_S = d_faux;
  649:         option_t = d_faux;
  650:         option_v = d_faux;
  651: 
  652:         // Lorsque le programme est appelé depuis un shebang, argv[0] contient
  653:         // le chemin du programme et argv[1] tous les arguments.
  654:         // argv[2] contient quant à lui le nom du script RPL/2.
  655:         //
  656:         // Exemple :
  657:         // argv[0] : /usr/local/bin/rpl
  658:         // argv[1] : -csdp -t 800
  659:         // argv[2] : ./on_exit.rpl
  660: 
  661:         while((--argc) > 0)
  662:         {
  663:             if ((*(++argv))[0] == '-')
  664:             {
  665:                 while((option = *(++argv[0])) != '\0')
  666:                 {
  667:                     switch(option)
  668:                     {
  669:                         case 'a' :
  670:                         {
  671:                             if (option_a == d_vrai)
  672:                             {
  673:                                 if ((*s_etat_processus).langue == 'F')
  674:                                 {
  675:                                     printf("+++Erreur : option -a présente "
  676:                                             "plus d'une fois\n");
  677:                                 }
  678:                                 else
  679:                                 {
  680:                                     printf("+++Error : more than one -a "
  681:                                             "on command line");
  682:                                 }
  683: 
  684:                                 return(EXIT_FAILURE);
  685:                             }
  686: 
  687:                             option_a = d_vrai;
  688:                             break;
  689:                         }
  690: 
  691:                         case 'A' :
  692:                         {
  693:                             if (option_A == d_vrai)
  694:                             {
  695:                                 if ((*s_etat_processus).langue == 'F')
  696:                                 {
  697:                                     printf("+++Erreur : option -A présente "
  698:                                             "plus d'une fois\n");
  699:                                 }
  700:                                 else
  701:                                 {
  702:                                     printf("+++Error : more than one -A "
  703:                                             "on command line");
  704:                                 }
  705: 
  706:                                 return(EXIT_FAILURE);
  707:                             }
  708: 
  709:                             option_A = d_vrai;
  710: 
  711:                             while(*(++argv[0]) == ' ');
  712:                             argv[0]--;
  713: 
  714:                             if ((*(++argv[0])) != '\0')
  715:                             {
  716:                                 if ((arguments = malloc((strlen(argv[0]) + 7) *
  717:                                         sizeof(unsigned char))) == NULL)
  718:                                 {
  719:                                     if ((*s_etat_processus).langue == 'F')
  720:                                     {
  721:                                         printf("+++Système : Mémoire "
  722:                                                 "insuffisante\n");
  723:                                     }
  724:                                     else
  725:                                     {
  726:                                         printf("+++System : Not enough "
  727:                                                 "memory\n");
  728:                                     }
  729: 
  730:                                     return(EXIT_FAILURE);
  731:                                 }
  732: 
  733:                                 ptr = arguments;
  734:                                 (*ptr) = d_code_fin_chaine;
  735:                                 strcat(ptr, "<< ");
  736:                                 ptr += 3;
  737: 
  738:                                 while(*(argv[0]) != '\0')
  739:                                 {
  740:                                     *(ptr++) = *(argv[0]++);
  741:                                 }
  742: 
  743:                                 (*ptr) = '\0';
  744: 
  745:                                 strcat(arguments, " >>");
  746:                                 argv[0]--;
  747:                             }
  748:                             else if ((--argc) > 0)
  749:                             {
  750:                                 argv++;
  751: 
  752:                                 if ((arguments = malloc((strlen(argv[0]) + 7) *
  753:                                         sizeof(unsigned char))) == NULL)
  754:                                 {
  755:                                     if ((*s_etat_processus).langue == 'F')
  756:                                     {
  757:                                         printf("+++Système : Mémoire "
  758:                                                 "insuffisante\n");
  759:                                     }
  760:                                     else
  761:                                     {
  762:                                         printf("+++System : Not enough "
  763:                                                 "memory\n");
  764:                                     }
  765: 
  766:                                     return(EXIT_FAILURE);
  767:                                 }
  768: 
  769:                                 ptr = arguments;
  770:                                 (*ptr) = d_code_fin_chaine;
  771:                                 strcat(ptr, "<< ");
  772:                                 ptr += 3;
  773: 
  774:                                 while(*(argv[0]) != '\0')
  775:                                 {
  776:                                     *(ptr++) = *(argv[0]++);
  777:                                 }
  778: 
  779:                                 (*ptr) = '\0';
  780: 
  781:                                 strcat(arguments, " >>");
  782:                                 argv[0]--;
  783:                             }
  784:                             else
  785:                             {
  786:                                 if ((*s_etat_processus).langue == 'F')
  787:                                 {
  788:                                     printf("+++Erreur : Aucune donnée "
  789:                                             "spécifié après l'option -A\n");
  790:                                 }
  791:                                 else
  792:                                 {
  793:                                     printf("+++Error : Data required after "
  794:                                             "-A option\n");
  795:                                 }
  796: 
  797:                                 return(EXIT_FAILURE);
  798:                             }
  799: 
  800:                             break;
  801:                         }
  802: 
  803:                         case 'c' :
  804:                         {
  805:                             if (option_c == d_vrai)
  806:                             {
  807:                                 if ((*s_etat_processus).langue == 'F')
  808:                                 {
  809:                                     printf("+++Erreur : option -c présente "
  810:                                             "plus d'une fois\n");
  811:                                 }
  812:                                 else
  813:                                 {
  814:                                     printf("+++Error : more than one -c "
  815:                                             "on command line");
  816:                                 }
  817: 
  818:                                 return(EXIT_FAILURE);
  819:                             }
  820: 
  821:                             option_c = d_vrai;
  822:                             core = d_vrai;
  823:                             break;
  824:                         }
  825: 
  826:                         case 'd' :
  827:                         {
  828:                             if (option_d == d_vrai)
  829:                             {
  830:                                 if ((*s_etat_processus).langue == 'F')
  831:                                 {
  832:                                     printf("+++Erreur : option -d présente "
  833:                                             "plus d'une fois\n");
  834:                                 }
  835:                                 else
  836:                                 {
  837:                                     printf("+++Error : more than one -d "
  838:                                             "on command line");
  839:                                 }
  840: 
  841:                                 return(EXIT_FAILURE);
  842:                             }
  843: 
  844:                             option_d = d_vrai;
  845:                             debug = d_vrai;
  846:                             break;
  847:                         }
  848: 
  849:                         case 'D' :
  850:                         {
  851:                             if (option_D == d_vrai)
  852:                             {
  853:                                 if ((*s_etat_processus).langue == 'F')
  854:                                 {
  855:                                     printf("+++Erreur : option -D présente "
  856:                                             "plus d'une fois\n");
  857:                                 }
  858:                                 else
  859:                                 {
  860:                                     printf("+++Error : more than one -D "
  861:                                             "on command line");
  862:                                 }
  863: 
  864:                                 return(EXIT_FAILURE);
  865:                             }
  866: 
  867:                             option_D = d_vrai;
  868:                             break;
  869:                         }
  870: 
  871:                         case 'h' :
  872:                         {
  873:                             if (option_h == d_vrai)
  874:                             {
  875:                                 if ((*s_etat_processus).langue == 'F')
  876:                                 {
  877:                                     printf("+++Erreur : option -h présente "
  878:                                             "plus d'une fois\n");
  879:                                 }
  880:                                 else
  881:                                 {
  882:                                     printf("+++Error : more than one -h "
  883:                                             "on command line");
  884:                                 }
  885: 
  886:                                 return(EXIT_FAILURE);
  887:                             }
  888: 
  889:                             option_h = d_vrai;
  890:                             informations(s_etat_processus);
  891:                             break;
  892:                         }
  893: 
  894:                         case 'i' :
  895:                         {
  896:                             if (option_i == d_vrai) 
  897:                             {
  898:                                 if ((*s_etat_processus).langue == 'F')
  899:                                 {
  900:                                     printf("+++Erreur : option -i présente "
  901:                                             "plus d'une fois\n");
  902:                                 }
  903:                                 else
  904:                                 {
  905:                                     printf("+++Error : more than one -i "
  906:                                             "on command line");
  907:                                 }
  908: 
  909:                                 return(EXIT_FAILURE);
  910:                             }
  911:                             else if (option_S == d_vrai)
  912:                             {
  913:                                 if ((*s_etat_processus).langue == 'F')
  914:                                 {
  915:                                     printf("+++Erreur : options -i et -S "
  916:                                             "incompatibles\n");
  917:                                 }
  918:                                 else
  919:                                 {
  920:                                     printf("+++Error : incompatible options -i "
  921:                                             "and -S\n");
  922:                                 }
  923: 
  924:                                 return(EXIT_FAILURE);
  925:                             }
  926:                             else if (option_p == d_vrai)
  927:                             {
  928:                                 if ((*s_etat_processus).langue == 'F')
  929:                                 {
  930:                                     printf("+++Erreur : options -i et -p "
  931:                                             "incompatibles\n");
  932:                                 }
  933:                                 else
  934:                                 {
  935:                                     printf("+++Error : incompatible options -i "
  936:                                             "and -p\n");
  937:                                 }
  938: 
  939:                                 return(EXIT_FAILURE);
  940:                             }
  941: 
  942:                             option_i = d_vrai;
  943:                             mode_interactif = d_vrai;
  944:                             presence_definition = 'O';
  945:                             break;
  946:                         }
  947: 
  948:                         case 'l' :
  949:                         {
  950:                             if (option_l == d_vrai)
  951:                             {
  952:                                 if ((*s_etat_processus).langue == 'F')
  953:                                 {
  954:                                     printf("+++Erreur : option -l présente "
  955:                                             "plus d'une fois\n");
  956:                                 }
  957:                                 else
  958:                                 {
  959:                                     printf("+++Error : more than one -l "
  960:                                             "on command line");
  961:                                 }
  962: 
  963:                                 return(EXIT_FAILURE);
  964:                             }
  965: 
  966:                             option_l = d_vrai;
  967: 
  968:                             if ((*s_etat_processus).langue == 'F')
  969:                             {
  970:                                 printf("%s\n\n", CeCILL_fr);
  971:                             }
  972:                             else
  973:                             {
  974:                                 printf("%s\n\n", CeCILL_en);
  975:                             }
  976: 
  977:                             break;
  978:                         }
  979: 
  980:                         case 'n' :
  981:                         {
  982:                             if (option_n == d_vrai)
  983:                             {
  984:                                 if ((*s_etat_processus).langue == 'F')
  985:                                 {
  986:                                     printf("+++Erreur : option -n présente "
  987:                                             "plus d'une fois\n");
  988:                                 }
  989:                                 else
  990:                                 {
  991:                                     printf("+++Error : more than one -n "
  992:                                             "on command line");
  993:                                 }
  994: 
  995:                                 return(EXIT_FAILURE);
  996:                             }
  997: 
  998:                             option_n = d_vrai;
  999: 
 1000:                             break;
 1001:                         }
 1002: 
 1003:                         case 'p' :
 1004:                         {
 1005:                             if (option_p == d_vrai)
 1006:                             {
 1007:                                 if ((*s_etat_processus).langue == 'F')
 1008:                                 {
 1009:                                     printf("+++Erreur : option -p présente "
 1010:                                             "plus d'une fois\n");
 1011:                                 }
 1012:                                 else
 1013:                                 {
 1014:                                     printf("+++Error : more than one -p "
 1015:                                             "on command line");
 1016:                                 }
 1017: 
 1018:                                 return(EXIT_FAILURE);
 1019:                             }
 1020:                             else if (option_i == d_vrai)
 1021:                             {
 1022:                                 if ((*s_etat_processus).langue == 'F')
 1023:                                 {
 1024:                                     printf("+++Erreur : options -i et -p "
 1025:                                             "incompatibles\n");
 1026:                                 }
 1027:                                 else
 1028:                                 {
 1029:                                     printf("+++Error : incompatible options -i "
 1030:                                             "and -p\n");
 1031:                                 }
 1032: 
 1033:                                 return(EXIT_FAILURE);
 1034:                             }
 1035: 
 1036:                             option_p = d_vrai;
 1037: 
 1038:                             break;
 1039:                         }
 1040: 
 1041:                         case 'P' :
 1042:                         {
 1043:                             if (option_P > 2)
 1044:                             {
 1045:                                 if ((*s_etat_processus).langue == 'F')
 1046:                                 {
 1047:                                     printf("+++Erreur : option -P présente "
 1048:                                             "plus de deux fois\n");
 1049:                                 }
 1050:                                 else
 1051:                                 {
 1052:                                     printf("+++Error : more than two -P "
 1053:                                             "on command line");
 1054:                                 }
 1055: 
 1056:                                 return(EXIT_FAILURE);
 1057:                             }
 1058: 
 1059:                             option_P++;
 1060: 
 1061:                             break;
 1062:                         }
 1063: 
 1064:                         case 's' :
 1065:                         {
 1066:                             if (option_s == d_vrai)
 1067:                             {
 1068:                                 if ((*s_etat_processus).langue == 'F')
 1069:                                 {
 1070:                                     printf("+++Erreur : option -s présente "
 1071:                                             "plus d'une fois\n");
 1072:                                 }
 1073:                                 else
 1074:                                 {
 1075:                                     printf("+++Error : more than one -s "
 1076:                                             "on command line");
 1077:                                 }
 1078: 
 1079:                                 return(EXIT_FAILURE);
 1080:                             }
 1081: 
 1082:                             option_s = d_vrai;
 1083:                             drapeau_encart = 'N';
 1084:                             break;
 1085:                         }
 1086: 
 1087:                         case 'S' :
 1088:                         {
 1089:                             if (option_S == d_vrai)
 1090:                             {
 1091:                                 if ((*s_etat_processus).langue == 'F')
 1092:                                 {
 1093:                                     printf("+++Erreur : option -S présente "
 1094:                                             "plus d'une fois\n");
 1095:                                 }
 1096:                                 else
 1097:                                 {
 1098:                                     printf("+++Error : more than one -S "
 1099:                                             "on command line");
 1100:                                 }
 1101: 
 1102:                                 return(EXIT_FAILURE);
 1103:                             }
 1104:                             else if (option_i == d_vrai)
 1105:                             {
 1106:                                 if ((*s_etat_processus).langue == 'F')
 1107:                                 {
 1108:                                     printf("+++Erreur : options -i et -S "
 1109:                                             "incompatibles\n");
 1110:                                 }
 1111:                                 else
 1112:                                 {
 1113:                                     printf("+++Error : incompatible options -S "
 1114:                                             "and -i\n");
 1115:                                 }
 1116: 
 1117:                                 return(EXIT_FAILURE);
 1118:                             }
 1119: 
 1120:                             option_S = d_vrai;
 1121: 
 1122:                             while(*(++argv[0]) == ' ');
 1123:                             argv[0]--;
 1124: 
 1125:                             if ((*(++argv[0])) != '\0')
 1126:                             {
 1127:                                 if (((*s_etat_processus).definitions_chainees =
 1128:                                         malloc((strlen(argv[0]) + 1) *
 1129:                                         sizeof(unsigned char))) == NULL)
 1130:                                 {
 1131:                                     if ((*s_etat_processus).langue == 'F')
 1132:                                     {
 1133:                                         printf("+++Système : Mémoire "
 1134:                                                 "insuffisante\n");
 1135:                                     }
 1136:                                     else
 1137:                                     {
 1138:                                         printf("+++System : Not enough "
 1139:                                                 "memory\n");
 1140:                                     }
 1141: 
 1142:                                     return(EXIT_FAILURE);
 1143:                                 }
 1144: 
 1145:                                 ptr = (*s_etat_processus).definitions_chainees;
 1146: 
 1147:                                 while(*(argv[0]) != '\0')
 1148:                                 {
 1149:                                     *(ptr++) = *(argv[0]++);
 1150:                                 }
 1151: 
 1152:                                 (*ptr) = '\0';
 1153: 
 1154:                                 argv[0]--;
 1155:                                 presence_definition = 'O';
 1156:                             }
 1157:                             else if ((--argc) > 0)
 1158:                             {
 1159:                                 argv++;
 1160: 
 1161:                                 if (((*s_etat_processus).definitions_chainees =
 1162:                                         malloc((strlen(argv[0]) + 1) *
 1163:                                         sizeof(unsigned char))) == NULL)
 1164:                                 {
 1165:                                     if ((*s_etat_processus).langue == 'F')
 1166:                                     {
 1167:                                         printf("+++Système : Mémoire "
 1168:                                                 "insuffisante\n");
 1169:                                     }
 1170:                                     else
 1171:                                     {
 1172:                                         printf("+++System : Not enough "
 1173:                                                 "memory\n");
 1174:                                     }
 1175: 
 1176:                                     return(EXIT_FAILURE);
 1177:                                 }
 1178: 
 1179:                                 ptr = (*s_etat_processus).definitions_chainees;
 1180: 
 1181:                                 while(*(argv[0]) != '\0')
 1182:                                 {
 1183:                                     *(ptr++) = *(argv[0]++);
 1184:                                 }
 1185: 
 1186:                                 (*ptr) = '\0';
 1187: 
 1188:                                 argv[0]--;
 1189:                                 presence_definition = 'O';
 1190:                             }
 1191:                             else
 1192:                             {
 1193:                                 if ((*s_etat_processus).langue == 'F')
 1194:                                 {
 1195:                                     printf("+++Erreur : Aucun script "
 1196:                                             "spécifié après l'option -S\n");
 1197:                                 }
 1198:                                 else
 1199:                                 {
 1200:                                     printf("+++Error : Script required after "
 1201:                                             "-S option\n");
 1202:                                 }
 1203: 
 1204:                                 return(EXIT_FAILURE);
 1205:                             }
 1206: 
 1207:                             if (((*s_etat_processus).definitions_chainees =
 1208:                                     compactage((*s_etat_processus)
 1209:                                     .definitions_chainees)) == NULL)
 1210:                             {
 1211:                                 if ((*s_etat_processus).langue == 'F')
 1212:                                 {
 1213:                                     printf("+++Système : Mémoire "
 1214:                                             "insuffisante\n");
 1215:                                 }
 1216:                                 else
 1217:                                 {
 1218:                                     printf("+++System : Not enough "
 1219:                                             "memory\n");
 1220:                                 }
 1221: 
 1222:                                 return(EXIT_FAILURE);
 1223:                             }
 1224: 
 1225:                             (*s_etat_processus).longueur_definitions_chainees =
 1226:                                     strlen((*s_etat_processus)
 1227:                                     .definitions_chainees);
 1228: 
 1229:                             break;
 1230:                         }
 1231: 
 1232:                         case 't' :
 1233:                         {
 1234:                             if (option_t == d_vrai)
 1235:                             {
 1236:                                 if ((*s_etat_processus).langue == 'F')
 1237:                                 {
 1238:                                     printf("+++Erreur : option -t présente "
 1239:                                             "plus d'une fois\n");
 1240:                                 }
 1241:                                 else
 1242:                                 {
 1243:                                     printf("+++Error : more than one -t "
 1244:                                             "on command line");
 1245:                                 }
 1246: 
 1247:                                 return(EXIT_FAILURE);
 1248:                             }
 1249: 
 1250:                             option_t = d_vrai;
 1251:                             (*s_etat_processus).debug = d_vrai;
 1252: 
 1253:                             while(*(++argv[0]) == ' ');
 1254:                             argv[0]--;
 1255: 
 1256:                             if ((*(++argv[0])) != '\0')
 1257:                             {
 1258:                                 if ((type_debug = malloc((strlen(argv[0]) + 1) *
 1259:                                         sizeof(unsigned char))) == NULL)
 1260:                                 {
 1261:                                     if ((*s_etat_processus).langue == 'F')
 1262:                                     {
 1263:                                         printf("+++Système : Mémoire "
 1264:                                                 "insuffisante\n");
 1265:                                     }
 1266:                                     else
 1267:                                     {
 1268:                                         printf("+++System : Not enough "
 1269:                                                 "memory\n");
 1270:                                     }
 1271: 
 1272:                                     return(EXIT_FAILURE);
 1273:                                 }
 1274: 
 1275:                                 ptr = type_debug;
 1276: 
 1277:                                 while((*(argv[0]) != '\0') &&
 1278:                                         (*(argv[0]) != ' '))
 1279:                                 {
 1280:                                     *(ptr++) = *(argv[0]++);
 1281:                                 }
 1282: 
 1283:                                 (*ptr) = '\0';
 1284: 
 1285:                                 argv[0]--;
 1286:                             }
 1287:                             else if ((--argc) > 0)
 1288:                             {
 1289:                                 argv++;
 1290: 
 1291:                                 if ((type_debug =
 1292:                                         malloc((strlen(argv[0]) + 1) *
 1293:                                         sizeof(unsigned char))) == NULL)
 1294:                                 {
 1295:                                     if ((*s_etat_processus).langue == 'F')
 1296:                                     {
 1297:                                         printf("+++Système : Mémoire "
 1298:                                                 "insuffisante\n");
 1299:                                     }
 1300:                                     else
 1301:                                     {
 1302:                                         printf("+++System : Not enough "
 1303:                                                 "memory\n");
 1304:                                     }
 1305: 
 1306:                                     return(EXIT_FAILURE);
 1307:                                 }
 1308: 
 1309:                                 ptr = type_debug;
 1310: 
 1311:                                 while(*(argv[0]) != '\0')
 1312:                                 {
 1313:                                     *(ptr++) = *(argv[0]++);
 1314:                                 }
 1315: 
 1316:                                 (*ptr) = '\0';
 1317: 
 1318:                                 argv[0]--;
 1319:                             }
 1320:                             else
 1321:                             {
 1322:                                 if ((*s_etat_processus).langue == 'F')
 1323:                                 {
 1324:                                     printf("+++Erreur : Aucun niveau "
 1325:                                             "de débogage spécifié après "
 1326:                                             "l'option -t\n");
 1327:                                 }
 1328:                                 else
 1329:                                 {
 1330:                                     printf("+++Error : Debug level not "
 1331:                                             "specified after -t option\n");
 1332:                                 }
 1333: 
 1334:                                 return(EXIT_FAILURE);
 1335:                             }
 1336: 
 1337:                             ptr = type_debug;
 1338: 
 1339:                             while(*ptr != '\0')
 1340:                             {
 1341:                                 switch(*ptr)
 1342:                                 {
 1343:                                     case '0':
 1344:                                     case '1':
 1345:                                     case '2':
 1346:                                     case '3':
 1347:                                     case '4':
 1348:                                     case '5':
 1349:                                     case '6':
 1350:                                     case '7':
 1351:                                     case '8':
 1352:                                     case '9':
 1353:                                     case 'A':
 1354:                                     case 'B':
 1355:                                     case 'C':
 1356:                                     case 'D':
 1357:                                     case 'E':
 1358:                                     case 'F':
 1359:                                     {
 1360:                                         break;
 1361:                                     }
 1362: 
 1363:                                     default:
 1364:                                     {
 1365:                                         if ((*s_etat_processus).langue == 'F')
 1366:                                         {
 1367:                                             printf("+++Erreur : Niveau "
 1368:                                                     "de débogage non "
 1369:                                                     "hexadécimal\n");
 1370:                                         }
 1371:                                         else
 1372:                                         {
 1373:                                             printf("+++Error : Debug level must"
 1374:                                                     " be hexadecimal "
 1375:                                                     "integer\n");
 1376:                                         }
 1377: 
 1378:                                         return(EXIT_FAILURE);
 1379:                                     }
 1380:                                 }
 1381: 
 1382:                                 ptr++;
 1383:                             }
 1384: 
 1385:                             if (sscanf(type_debug, "%llX",
 1386:                                     &((*s_etat_processus).type_debug)) != 1)
 1387:                             {
 1388:                                 if ((*s_etat_processus).langue == 'F')
 1389:                                 {
 1390:                                     printf("+++Erreur : Niveau "
 1391:                                             "de débogage non entier\n");
 1392:                                 }
 1393:                                 else
 1394:                                 {
 1395:                                     printf("+++Error : Debug level must"
 1396:                                             " be integer\n");
 1397:                                 }
 1398: 
 1399:                                 return(EXIT_FAILURE);
 1400:                             }
 1401: 
 1402:                             free(type_debug);
 1403:                             break;
 1404:                         }
 1405: 
 1406:                         case 'v' :
 1407:                         {
 1408:                             if (option_v == d_vrai)
 1409:                             {
 1410:                                 if ((*s_etat_processus).langue == 'F')
 1411:                                 {
 1412:                                     printf("+++Erreur : option -v présente "
 1413:                                             "plus d'une fois\n");
 1414:                                 }
 1415:                                 else
 1416:                                 {
 1417:                                     printf("+++Error : more than one -v "
 1418:                                             "on command line");
 1419:                                 }
 1420: 
 1421:                                 return(EXIT_FAILURE);
 1422:                             }
 1423: 
 1424:                             option_v = d_vrai;
 1425:                             printf("\n");
 1426: 
 1427:                             if ((*s_etat_processus).langue == 'F')
 1428:                             {
 1429:                                 printf("  Reverse Polish Lisp/2 version %s "
 1430:                                         "pour systèmes "
 1431:                                         "POSIX\n", d_version_rpl);
 1432:                                 printf("      Langage procédural de très haut "
 1433:                                         "niveau, semi-compilé, "
 1434:                                         "extensible,\n");
 1435:                                 printf("      destiné principalement aux "
 1436:                                         "calculs scientifiques et "
 1437:                                         "symboliques\n");
 1438:                                 printf("%s\n", copyright);
 1439:                             }
 1440:                             else
 1441:                             {
 1442:                                 printf("  Reverse Polish Lisp/2 version %s "
 1443:                                         "for POSIX operating systems\n",
 1444:                                         d_version_rpl);
 1445:                                 printf("      Half-compiled, high-level "
 1446:                                         "procedural language,\n");
 1447:                                 printf("      mainly aiming at scientific "
 1448:                                         "calculations\n");
 1449:                                 printf("%s\n", copyright_anglais);
 1450:                             }
 1451: 
 1452:                             printf("\n");
 1453:                             break;
 1454:                         }
 1455: 
 1456:                         case '-':
 1457:                         case ' ':
 1458:                         {
 1459:                             break;
 1460:                         }
 1461: 
 1462:                         default :
 1463:                         {
 1464:                             if ((*s_etat_processus).langue == 'F')
 1465:                             {
 1466:                                 printf("+++Information : Option -%c inconnue\n",
 1467:                                         option);
 1468:                             }
 1469:                             else
 1470:                             {
 1471:                                 printf("+++Warning : -%c option unknown\n",
 1472:                                         option);
 1473:                             }
 1474: 
 1475:                             informations(s_etat_processus);
 1476:                             break;
 1477:                         }
 1478:                     }
 1479:                 }
 1480:             }
 1481:             else
 1482:             {
 1483:                 if (presence_definition == 'O')
 1484:                 {
 1485:                     argc = 0;
 1486: 
 1487:                     if ((*s_etat_processus).langue == 'F')
 1488:                     {
 1489:                         printf("+++Erreur : Plusieurs définitions\n");
 1490:                     }
 1491:                     else
 1492:                     {
 1493:                         printf("+++Error : More than one definition\n");
 1494:                     }
 1495: 
 1496:                     erreur = d_erreur;
 1497:                 }
 1498:                 else
 1499:                 {
 1500:                     (*s_etat_processus).nom_fichier_source = argv[0];
 1501:                     presence_definition = 'O';
 1502:                 }
 1503:             }
 1504:         }
 1505: 
 1506:         /*
 1507:          * Dans le cas où le programme est appelé avec l'option -d,
 1508:          * on ne récupère par les signaux de violation d'accès. On
 1509:          * tente simplement la récupération des dépassements de pile.
 1510:          */
 1511: 
 1512:         if (debug == d_faux)
 1513:         {
 1514: 
 1515: #   ifdef HAVE_SIGSEGV_RECOVERY
 1516:             if (sigsegv_install_handler(interruption_violation_access) != 0)
 1517:             {
 1518:                 erreur = d_es_signal;
 1519: 
 1520:                 if ((*s_etat_processus).langue == 'F')
 1521:                 {
 1522:                     printf("+++Système : Initialisation de la pile alternative "
 1523:                             "impossible\n");
 1524:                 }
 1525:                 else
 1526:                 {
 1527:                     printf("+++System : Initialization of alternate "
 1528:                             "stack failed\n");
 1529:                 }
 1530: 
 1531:                 return(EXIT_FAILURE);
 1532:             }
 1533: #   else
 1534:             action.sa_handler = interruption3;
 1535:             action.sa_flags = 0;
 1536: 
 1537:             if (sigaction(SIGSEGV, &action, NULL) != 0)
 1538:             {
 1539:                 if ((*s_etat_processus).langue == 'F')
 1540:                 {
 1541:                     printf("+++Système : Initialisation des signaux POSIX "
 1542:                             "impossible\n");
 1543:                 }
 1544:                 else
 1545:                 {
 1546:                     printf("+++System : Initialization of POSIX signals "
 1547:                             "failed\n");
 1548:                 }
 1549: 
 1550:                 return(EXIT_FAILURE);
 1551:             }
 1552: 
 1553:             signal_test = SIGTEST;
 1554:             kill(getpid(), SIGSEGV);
 1555: 
 1556:             if (signal_test != SIGSEGV)
 1557:             {
 1558:                 erreur = d_es_signal;
 1559: 
 1560:                 if ((*s_etat_processus).langue == 'F')
 1561:                 {
 1562:                     printf("+++Système : Initialisation des signaux POSIX "
 1563:                             "impossible\n");
 1564:                 }
 1565:                 else
 1566:                 {
 1567:                     printf("+++System : Initialization of POSIX signals "
 1568:                             "failed\n");
 1569:                 }
 1570: 
 1571:                 return(EXIT_FAILURE);
 1572:             }
 1573: #   endif
 1574: 
 1575:             if (sigaction(SIGBUS, &action, NULL) != 0)
 1576:             {
 1577:                 if ((*s_etat_processus).langue == 'F')
 1578:                 {
 1579:                     printf("+++Système : Initialisation des signaux POSIX "
 1580:                             "impossible\n");
 1581:                 }
 1582:                 else
 1583:                 {
 1584:                     printf("+++System : Initialization of POSIX signals "
 1585:                             "failed\n");
 1586:                 }
 1587: 
 1588:                 return(EXIT_FAILURE);
 1589:             }
 1590: 
 1591:             signal_test = SIGTEST;
 1592:             kill(getpid(), SIGBUS);
 1593: 
 1594:             if (signal_test != SIGBUS)
 1595:             {
 1596:                 erreur = d_es_signal;
 1597: 
 1598:                 if ((*s_etat_processus).langue == 'F')
 1599:                 {
 1600:                     printf("+++Système : Initialisation des signaux POSIX "
 1601:                             "impossible\n");
 1602:                 }
 1603:                 else
 1604:                 {
 1605:                     printf("+++System : Initialization of POSIX signals "
 1606:                             "failed\n");
 1607:                 }
 1608: 
 1609:                 return(EXIT_FAILURE);
 1610:             }
 1611: 
 1612:         }
 1613: 
 1614:         if (option_n == d_vrai)
 1615:         {
 1616:             action.sa_handler = interruption4;
 1617:             action.sa_flags = 0;
 1618: 
 1619:             if (sigaction(SIGHUP, &action, NULL) != 0)
 1620:             {
 1621:                 if ((*s_etat_processus).langue == 'F')
 1622:                 {
 1623:                     printf("+++Système : Initialisation des signaux POSIX "
 1624:                             "impossible\n");
 1625:                 }
 1626:                 else
 1627:                 {
 1628:                     printf("+++System : Initialization of POSIX signals "
 1629:                             "failed\n");
 1630:                 }
 1631: 
 1632:                 return(EXIT_FAILURE);
 1633:             }
 1634:         }
 1635: 
 1636:         if (mode_interactif == d_vrai)
 1637:         {
 1638:             printf("\n");
 1639: 
 1640:             if ((*s_etat_processus).langue == 'F')
 1641:             {
 1642:                 printf("+++Ce logiciel est un logiciel libre"
 1643:                         " sans aucune garantie de "
 1644:                         "fonctionnement.\n");
 1645:                 printf("+++Pour plus de détails, utilisez la "
 1646:                         "commande 'warranty'.\n");
 1647:             }
 1648:             else
 1649:             {
 1650:                 printf("+++This is a free software with "
 1651:                         "absolutely no warranty.\n");
 1652:                 printf("+++For details, type 'warranty'.\n");
 1653:             }
 1654: 
 1655:             printf("\n");
 1656: 
 1657:             traitement_fichier_temporaire = 'Y';
 1658: 
 1659:             if ((nom_fichier_temporaire =
 1660:                     creation_nom_fichier(s_etat_processus, (*s_etat_processus)
 1661:                     .chemin_fichiers_temporaires)) == NULL)
 1662:             {
 1663:                 if ((*s_etat_processus).langue == 'F')
 1664:                 {
 1665:                     printf("+++Système : Fichier indisponible\n");
 1666:                 }
 1667:                 else
 1668:                 {
 1669:                     printf("+++System : File unavailable\n");
 1670:                 }
 1671: 
 1672:                 return(EXIT_FAILURE);
 1673:             }
 1674: 
 1675:             if ((f_source = fopen(nom_fichier_temporaire, "w"))
 1676:                     == NULL)
 1677:             {
 1678:                 if ((*s_etat_processus).langue == 'F')
 1679:                 {
 1680:                     printf("+++Système : Fichier introuvable\n");
 1681:                 }
 1682:                 else
 1683:                 {
 1684:                     printf("+++System : File not found\n");
 1685:                 }
 1686: 
 1687:                 return(EXIT_FAILURE);
 1688:             }
 1689: 
 1690:             if (fprintf(f_source, "MODE_INTERACTIF\n") < 0)
 1691:             {
 1692:                 if ((*s_etat_processus).langue == 'F')
 1693:                 {
 1694:                     printf("+++Système : Erreur d'écriture dans un fichier\n");
 1695:                 }
 1696:                 else
 1697:                 {
 1698:                     printf("+++System : Cannot write in file\n");
 1699:                 }
 1700: 
 1701:                 return(EXIT_FAILURE);
 1702:             }
 1703: 
 1704:             if (fprintf(f_source,
 1705:                     "<< DO HALT UNTIL FALSE END >>\n") < 0)
 1706:             {
 1707:                 if ((*s_etat_processus).langue == 'F')
 1708:                 {
 1709:                     printf("+++Système : Erreur d'écriture dans un fichier\n");
 1710:                 }
 1711:                 else
 1712:                 {
 1713:                     printf("+++System : Cannot write in file\n");
 1714:                 }
 1715: 
 1716:                 return(EXIT_FAILURE);
 1717:             }
 1718: 
 1719:             if (fclose(f_source) != 0)
 1720:             {
 1721:                 if ((*s_etat_processus).langue == 'F')
 1722:                 {
 1723:                     printf("+++Système : Fichier indisponible\n");
 1724:                 }
 1725:                 else
 1726:                 {
 1727:                     printf("+++System : File unavailable\n");
 1728:                 }
 1729: 
 1730:                 return(EXIT_FAILURE);
 1731:             }
 1732: 
 1733:             (*s_etat_processus).lancement_interactif = d_vrai;
 1734:             (*s_etat_processus).nom_fichier_source =
 1735:                     nom_fichier_temporaire;
 1736: 
 1737:             presence_definition = 'O';
 1738:         }
 1739:         else
 1740:         {
 1741:             nom_fichier_temporaire = NULL;
 1742:         }
 1743: 
 1744:         if ((*s_etat_processus).nom_fichier_source == NULL)
 1745:         {
 1746:             erreur_fichier = d_erreur;
 1747:         }
 1748:         else
 1749:         {
 1750:             erreur_fichier = caracteristiques_fichier(s_etat_processus,
 1751:                     (*s_etat_processus).nom_fichier_source,
 1752:                     &existence, &ouverture, &unite_fichier);
 1753:         }
 1754: 
 1755:         if (((existence == d_faux) || (erreur_fichier != d_absence_erreur)) &&
 1756:                 (option_S == d_faux))
 1757:         {
 1758:             if (presence_definition == 'O')
 1759:             {
 1760:                 if ((*s_etat_processus).langue == 'F')
 1761:                 {
 1762:                     printf("+++Erreur : Fichier %s inexistant\n",
 1763:                             (*s_etat_processus).nom_fichier_source);
 1764:                 }
 1765:                 else
 1766:                 {
 1767:                     printf("+++Error : File %s not found\n",
 1768:                             (*s_etat_processus).nom_fichier_source);
 1769:                 }
 1770: 
 1771:                 erreur = d_erreur;
 1772:             }
 1773:             else
 1774:             {
 1775:                 if ((*s_etat_processus).langue == 'F')
 1776:                 {
 1777:                     printf("+++Erreur : Absence de définition à exécuter\n");
 1778:                 }
 1779:                 else
 1780:                 {
 1781:                     printf("+++Error : Any executable definition\n");
 1782:                 }
 1783:             }
 1784: 
 1785:             return(EXIT_FAILURE);
 1786:         }
 1787: 
 1788:         if ((*s_etat_processus).chemin_fichiers_temporaires == NULL)
 1789:         {
 1790:             if ((*s_etat_processus).langue == 'F')
 1791:             {
 1792:                 printf("+++Système : Chemin des fichiers temporaires nul\n");
 1793:             }
 1794:             else
 1795:             {
 1796:                 printf("+++System : Null temporary files path\n");
 1797:             }
 1798: 
 1799:             return(EXIT_FAILURE);
 1800:         }
 1801: 
 1802:         if ((*s_etat_processus).debug == d_vrai)
 1803:         {
 1804:             if ((*s_etat_processus).langue == 'F')
 1805:             {
 1806:                 printf("[%d] Chemin des fichiers temporaires %s\n\n",
 1807:                         (int) getpid(),
 1808:                         (*s_etat_processus).chemin_fichiers_temporaires);
 1809:             }
 1810:             else
 1811:             {
 1812:                 printf("[%d] Temporary files path %s\n\n",
 1813:                         (int) getpid(),
 1814:                         (*s_etat_processus).chemin_fichiers_temporaires);
 1815:             }
 1816:         }
 1817: 
 1818:         if ((erreur == d_absence_erreur) && (presence_definition == 'O'))
 1819:         {
 1820:             (*s_etat_processus).profilage = (option_P != 0) ? d_vrai : d_faux;
 1821:             (*s_etat_processus).niveau_profilage = option_P;
 1822:             (*s_etat_processus).pile_profilage = NULL;
 1823:             (*s_etat_processus).pile_profilage_fonctions = NULL;
 1824:             gettimeofday(&((*s_etat_processus).horodatage_profilage), NULL);
 1825: 
 1826:             (*s_etat_processus).liste_mutexes = NULL;
 1827: 
 1828:             (*s_etat_processus).test_instruction = 'N';
 1829:             (*s_etat_processus).nombre_arguments = 0;
 1830:             (*s_etat_processus).affichage_arguments = 'N';
 1831:             (*s_etat_processus).autorisation_conversion_chaine = 'Y';
 1832:             (*s_etat_processus).autorisation_evaluation_nom = 'Y';
 1833: 
 1834:             if (mode_interactif == d_vrai)
 1835:             {
 1836:                 (*s_etat_processus).autorisation_nom_implicite = 'Y';
 1837:             }
 1838:             else
 1839:             {
 1840:                 (*s_etat_processus).autorisation_nom_implicite = 'N';
 1841:             }
 1842: 
 1843:             (*s_etat_processus).autorisation_empilement_programme = 'N';
 1844:             (*s_etat_processus).requete_arret = 'N';
 1845:             (*s_etat_processus).evaluation_forcee = 'N';
 1846:             (*s_etat_processus).recherche_type = 'N';
 1847: 
 1848:             (*s_etat_processus).constante_symbolique = 'N';
 1849:             (*s_etat_processus).traitement_symbolique = 'N';
 1850: 
 1851:             (*s_etat_processus).expression_courante = NULL;
 1852:             (*s_etat_processus).objet_courant = NULL;
 1853:             (*s_etat_processus).evaluation_expression_compilee = 'N';
 1854: 
 1855:             (*s_etat_processus).l_base_pile = NULL;
 1856:             (*s_etat_processus).l_base_pile_last = NULL;
 1857: 
 1858:             (*s_etat_processus).s_arbre_variables = NULL;
 1859:             (*s_etat_processus).l_liste_variables_par_niveau = NULL;
 1860:             (*s_etat_processus).gel_liste_variables = d_faux;
 1861:             (*s_etat_processus).pointeur_variable_courante = NULL;
 1862:             (*s_etat_processus).s_liste_variables_statiques = NULL;
 1863:             (*s_etat_processus).nombre_variables_statiques = 0;
 1864:             (*s_etat_processus).nombre_variables_statiques_allouees = 0;
 1865:             (*s_etat_processus).niveau_courant = 0;
 1866:             (*s_etat_processus).niveau_initial = 0;
 1867:             (*s_etat_processus).creation_variables_statiques = d_faux;
 1868:             (*s_etat_processus).creation_variables_partagees = d_faux;
 1869:             (*s_etat_processus).position_variable_statique_courante = 0;
 1870: 
 1871:             (*s_etat_processus).s_bibliotheques = NULL;
 1872:             (*s_etat_processus).s_instructions_externes = NULL;
 1873:             (*s_etat_processus).nombre_instructions_externes = 0;
 1874: 
 1875:             (*s_etat_processus).systeme_axes = 0;
 1876: 
 1877:             (*s_etat_processus).x_min = -10.;
 1878:             (*s_etat_processus).x_max = 10.;
 1879:             (*s_etat_processus).y_min = -10.;
 1880:             (*s_etat_processus).y_max = 10.;
 1881:             (*s_etat_processus).z_min = -10.;
 1882:             (*s_etat_processus).z_max = 10.;
 1883: 
 1884:             (*s_etat_processus).x2_min = -10.;
 1885:             (*s_etat_processus).x2_max = 10.;
 1886:             (*s_etat_processus).y2_min = -10.;
 1887:             (*s_etat_processus).y2_max = 10.;
 1888:             (*s_etat_processus).z2_min = -10.;
 1889:             (*s_etat_processus).z2_max = 10.;
 1890: 
 1891:             (*s_etat_processus).resolution = .01;
 1892: 
 1893:             (*s_etat_processus).souris_active = d_faux;
 1894: 
 1895:             (*s_etat_processus).echelle_automatique_x = d_faux;
 1896:             (*s_etat_processus).echelle_automatique_y = d_faux;
 1897:             (*s_etat_processus).echelle_automatique_z = d_faux;
 1898: 
 1899:             (*s_etat_processus).echelle_automatique_x2 = d_faux;
 1900:             (*s_etat_processus).echelle_automatique_y2 = d_faux;
 1901:             (*s_etat_processus).echelle_automatique_z2 = d_faux;
 1902: 
 1903:             (*s_etat_processus).echelle_log_x = d_faux;
 1904:             (*s_etat_processus).echelle_log_y = d_faux;
 1905:             (*s_etat_processus).echelle_log_z = d_faux;
 1906: 
 1907:             (*s_etat_processus).echelle_log_x2 = d_faux;
 1908:             (*s_etat_processus).echelle_log_y2 = d_faux;
 1909:             (*s_etat_processus).echelle_log_z2 = d_faux;
 1910: 
 1911:             (*s_etat_processus).point_de_vue_theta = 4 * atan((real8) 1) / 6;
 1912:             (*s_etat_processus).point_de_vue_phi = 4 * atan((real8) 1) / 3;
 1913:             (*s_etat_processus).echelle_3D = 1;
 1914: 
 1915:             strcpy((*s_etat_processus).type_trace_eq, "FONCTION");
 1916:             strcpy((*s_etat_processus).type_trace_sigma, "POINTS");
 1917:             (*s_etat_processus).fichiers_graphiques = NULL;
 1918:             (*s_etat_processus).nom_fichier_impression = NULL;
 1919:             strcpy((*s_etat_processus).format_papier, "a4paper");
 1920:             (*s_etat_processus).entree_standard = NULL;
 1921:             (*s_etat_processus).s_marques = NULL;
 1922:             (*s_etat_processus).requete_nouveau_plan = d_vrai;
 1923:             (*s_etat_processus).mise_a_jour_trace_requise = d_faux;
 1924: 
 1925:             (*s_etat_processus).l_base_pile = NULL;
 1926:             (*s_etat_processus).hauteur_pile_operationnelle = 0;
 1927:             (*s_etat_processus).l_base_pile_contextes = NULL;
 1928:             (*s_etat_processus).l_base_pile_taille_contextes = NULL;
 1929: 
 1930:             (*s_etat_processus).position_courante = 0;
 1931: 
 1932:             (*s_etat_processus).l_base_pile_systeme = NULL;
 1933:             (*s_etat_processus).hauteur_pile_systeme = 0;
 1934: 
 1935:             (*s_etat_processus).l_base_pile_processus = NULL;
 1936:             (*s_etat_processus).presence_pipes = d_faux;
 1937:             (*s_etat_processus).pipe_donnees = 0;
 1938:             (*s_etat_processus).pipe_acquittement = 0;
 1939:             (*s_etat_processus).pipe_injections = 0;
 1940:             (*s_etat_processus).pipe_nombre_injections = 0;
 1941:             (*s_etat_processus).nombre_objets_injectes = 0;
 1942:             (*s_etat_processus).nombre_objets_envoyes_non_lus = 0;
 1943:             (*s_etat_processus).pourcentage_maximal_cpu = 100;
 1944:             (*s_etat_processus).temps_maximal_cpu = 0;
 1945:             (*s_etat_processus).thread_fusible = 0;
 1946:             (*s_etat_processus).presence_fusible = d_faux;
 1947: 
 1948:             (*s_etat_processus).niveau_recursivite = 0;
 1949:             (*s_etat_processus).generateur_aleatoire = NULL;
 1950:             (*s_etat_processus).type_generateur_aleatoire = NULL;
 1951: 
 1952:             (*s_etat_processus).colonne_statistique_1 = 1; 
 1953:             (*s_etat_processus).colonne_statistique_2 = 2; 
 1954: 
 1955:             (*s_etat_processus).debug_programme = d_faux;
 1956:             (*s_etat_processus).execution_pas_suivant = d_faux;
 1957:             (*s_etat_processus).traitement_instruction_halt = d_faux;
 1958: 
 1959:             (*s_etat_processus).derniere_exception = d_ep;
 1960:             (*s_etat_processus).derniere_erreur_systeme = d_es;
 1961:             (*s_etat_processus).derniere_erreur_execution = d_ex;
 1962:             (*s_etat_processus).derniere_erreur_evaluation = d_ex;
 1963:             (*s_etat_processus).derniere_erreur_fonction_externe = 0;
 1964: 
 1965:             (*s_etat_processus).erreur_processus_fils = d_faux;
 1966:             (*s_etat_processus).erreur_systeme_processus_fils = d_es;
 1967:             (*s_etat_processus).erreur_execution_processus_fils = d_ex;
 1968:             (*s_etat_processus).pid_erreur_processus_fils = 0;
 1969:             (*s_etat_processus).exception_processus_fils = d_ep;
 1970:             (*s_etat_processus).core = core;
 1971:             (*s_etat_processus).invalidation_message_erreur = d_faux;
 1972:             (*s_etat_processus).s_objet_errone = NULL;
 1973:             (*s_etat_processus).s_objet_erreur = NULL;
 1974: 
 1975:             (*s_etat_processus).retour_routine_evaluation = 'N';
 1976: 
 1977:             (*s_etat_processus).traitement_interruption = 'N';
 1978:             (*s_etat_processus).traitement_interruptible = 'Y';
 1979:             (*s_etat_processus).nombre_interruptions_en_queue = 0;
 1980:             (*s_etat_processus).nombre_interruptions_non_affectees = 0;
 1981: 
 1982:             for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 1983:             {
 1984:                 (*s_etat_processus).masque_interruptions[i] = 'N';
 1985:                 (*s_etat_processus).queue_interruptions[i] = 0;
 1986:                 (*s_etat_processus).corps_interruptions[i] = NULL;
 1987:                 (*s_etat_processus).pile_origine_interruptions[i] = NULL;
 1988:             }
 1989: 
 1990:             (*s_etat_processus).at_exit = NULL;
 1991:             (*s_etat_processus).at_poke = NULL;
 1992:             (*s_etat_processus).traitement_at_poke = 'N';
 1993: 
 1994:             (*s_etat_processus).pointeurs_caracteres = NULL;
 1995:             (*s_etat_processus).arbre_instructions = NULL;
 1996: 
 1997:             (*s_etat_processus).tid_processus_pere = pthread_self();
 1998:             (*s_etat_processus).pid_processus_pere = getpid();
 1999:             (*s_etat_processus).processus_detache = d_vrai;
 2000:             (*s_etat_processus).var_volatile_processus_pere = -1;
 2001:             (*s_etat_processus).var_volatile_processus_racine = -1;
 2002:             (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
 2003:             (*s_etat_processus).var_volatile_alarme = 0;
 2004:             (*s_etat_processus).var_volatile_requete_arret = 0;
 2005:             (*s_etat_processus).var_volatile_requete_arret2 = 0;
 2006:             (*s_etat_processus).var_volatile_traitement_retarde_stop = 0;
 2007:             (*s_etat_processus).var_volatile_traitement_sigint = 0;
 2008:             (*s_etat_processus).var_volatile_recursivite = 0;
 2009:             (*s_etat_processus).var_volatile_exception_gsl = 0;
 2010:             (*s_etat_processus).arret_depuis_abort = 0;
 2011:             (*s_etat_processus).pointeur_signal_lecture = 0;
 2012:             (*s_etat_processus).pointeur_signal_ecriture = 0;
 2013: 
 2014:             initialisation_allocateur(s_etat_processus);
 2015:             initialisation_drapeaux(s_etat_processus);
 2016:             initialisation_variables(s_etat_processus);
 2017:             initialisation_instructions(s_etat_processus);
 2018: 
 2019:             if ((*s_etat_processus).erreur_systeme != d_es)
 2020:             {
 2021:                 if ((*s_etat_processus).langue == 'F')
 2022:                 {
 2023:                     printf("+++Système : Mémoire insuffisante\n");
 2024:                 }
 2025:                 else
 2026:                 {
 2027:                     printf("+++System : Not enough memory\n");
 2028:                 }
 2029: 
 2030:                 return(EXIT_FAILURE);
 2031:             }
 2032: 
 2033:             if (((*s_etat_processus).instruction_derniere_erreur =
 2034:                     malloc(sizeof(unsigned char))) == NULL)
 2035:             {
 2036:                 erreur = d_es_allocation_memoire;
 2037: 
 2038:                 if ((*s_etat_processus).langue == 'F')
 2039:                 {
 2040:                     printf("+++Système : Mémoire insuffisante\n");
 2041:                 }
 2042:                 else
 2043:                 {
 2044:                     printf("+++System : Not enough memory\n");
 2045:                 }
 2046: 
 2047:                 return(EXIT_FAILURE);
 2048:             }
 2049: 
 2050:             strcpy((*s_etat_processus).instruction_derniere_erreur, "");
 2051:             (*s_etat_processus).niveau_derniere_erreur = 0;
 2052: 
 2053:             if (traitement_fichier_temporaire == 'Y')
 2054:             {
 2055:                 (*s_etat_processus).mode_interactif = 'Y';
 2056:             }
 2057:             else
 2058:             {
 2059:                 (*s_etat_processus).mode_interactif = 'N';
 2060:             }
 2061: 
 2062:             if (((*s_etat_processus).instruction_courante = (unsigned char *)
 2063:                     malloc(sizeof(unsigned char))) == NULL)
 2064:             {
 2065:                 erreur = d_es_allocation_memoire;
 2066: 
 2067:                 if ((*s_etat_processus).langue == 'F')
 2068:                 {
 2069:                     printf("+++Système : Mémoire insuffisante\n");
 2070:                 }
 2071:                 else
 2072:                 {
 2073:                     printf("+++System : Not enough memory\n");
 2074:                 }
 2075: 
 2076:                 return(EXIT_FAILURE);
 2077:             }
 2078: 
 2079:             (*s_etat_processus).instruction_courante[0] = d_code_fin_chaine;
 2080: 
 2081:             empilement_pile_systeme(s_etat_processus);
 2082: 
 2083:             free((*s_etat_processus).instruction_courante);
 2084: 
 2085:             if ((*s_etat_processus).erreur_systeme != d_es)
 2086:             {
 2087:                 erreur = d_es_allocation_memoire;
 2088:             }
 2089:             else
 2090:             {
 2091:                 (*((*s_etat_processus).l_base_pile_systeme))
 2092:                         .retour_definition = 'Y';
 2093: 
 2094:                 (*s_etat_processus).indep = (struct_objet *) malloc(
 2095:                         sizeof(struct_objet));
 2096:                 (*s_etat_processus).depend = (struct_objet *) malloc(
 2097:                         sizeof(struct_objet));
 2098:                 (*s_etat_processus).parametres_courbes_de_niveau =
 2099:                         (struct_objet *) malloc(sizeof(struct_objet));
 2100: 
 2101:                 if (((*s_etat_processus).indep != NULL) &&
 2102:                         ((*s_etat_processus).depend != NULL) &&
 2103:                         ((*s_etat_processus).parametres_courbes_de_niveau
 2104:                         != NULL))
 2105:                 {
 2106:                     (*((*s_etat_processus).indep)).type = NOM;
 2107:                     (*((*s_etat_processus).depend)).type = NOM;
 2108:                     (*((*s_etat_processus).
 2109:                             parametres_courbes_de_niveau)).type = LST;
 2110: 
 2111:                     initialisation_objet((*s_etat_processus).indep);
 2112:                     initialisation_objet((*s_etat_processus).depend);
 2113:                     initialisation_objet((*s_etat_processus)
 2114:                             .parametres_courbes_de_niveau);
 2115: 
 2116:                     (*((*s_etat_processus).indep)).objet = (struct_nom *)
 2117:                             malloc(sizeof(struct_nom));
 2118:                     (*((*s_etat_processus).depend)).objet = (struct_nom *)
 2119:                             malloc(sizeof(struct_nom));
 2120:                     (*((*s_etat_processus).parametres_courbes_de_niveau))
 2121:                             .objet = (struct_liste_chainee *)
 2122:                             malloc(sizeof(struct_liste_chainee));
 2123: 
 2124:                     if (((*((*s_etat_processus).depend)).objet == NULL) ||
 2125:                             ((*((*s_etat_processus).depend)).objet == NULL) ||
 2126:                             ((*((*s_etat_processus).
 2127:                             parametres_courbes_de_niveau)).objet == NULL))
 2128:                     {
 2129:                         erreur = d_es_allocation_memoire;
 2130:                         
 2131:                         if ((*s_etat_processus).langue == 'F')
 2132:                         {
 2133:                             printf("+++Système : Mémoire insuffisante\n");
 2134:                         }
 2135:                         else
 2136:                         {
 2137:                             printf("+++System : Not enough memory\n");
 2138:                         }
 2139: 
 2140:                         return(EXIT_FAILURE);
 2141:                     }
 2142: 
 2143:                     (*((struct_nom *) (*((*s_etat_processus).indep)).objet))
 2144:                             .nom = malloc(2 * sizeof(unsigned char));
 2145:                     (*((struct_nom *) (*((*s_etat_processus).depend)).objet))
 2146:                             .nom = malloc(2 * sizeof(unsigned char));
 2147: 
 2148:                     if (((*((struct_nom *) (*((*s_etat_processus).indep))
 2149:                             .objet)).nom == NULL) || ((*((struct_nom *)
 2150:                             (*((*s_etat_processus).depend)).objet)).nom ==
 2151:                             NULL))
 2152:                     {
 2153:                         erreur = d_es_allocation_memoire;
 2154: 
 2155:                         if ((*s_etat_processus).langue == 'F')
 2156:                         {
 2157:                             printf("+++Système : Mémoire insuffisante\n");
 2158:                         }
 2159:                         else
 2160:                         {
 2161:                             printf("+++System : Not enough memory\n");
 2162:                         }
 2163: 
 2164:                         return(EXIT_FAILURE);
 2165:                     }
 2166: 
 2167:                     strcpy((*((struct_nom *) (*((*s_etat_processus).indep))
 2168:                             .objet)).nom, "X");
 2169:                     strcpy((*((struct_nom *) (*((*s_etat_processus).depend))
 2170:                             .objet)).nom, "Y");
 2171: 
 2172:                     (*((struct_nom *) (*((*s_etat_processus).indep))
 2173:                             .objet)).symbole = d_vrai;
 2174:                     (*((struct_nom *) (*((*s_etat_processus).depend))
 2175:                             .objet)).symbole = d_vrai;
 2176: 
 2177:                     (*((struct_liste_chainee *) (*((*s_etat_processus)
 2178:                             .parametres_courbes_de_niveau)).objet)).suivant
 2179:                             = NULL;
 2180: 
 2181:                     (*((struct_liste_chainee *) (*((*s_etat_processus)
 2182:                             .parametres_courbes_de_niveau)).objet)).donnee
 2183:                             = malloc(sizeof(struct_objet));
 2184: 
 2185:                     (*s_etat_processus).legende =
 2186:                             malloc(sizeof(unsigned char));
 2187:                     (*s_etat_processus).label_x =
 2188:                             malloc(sizeof(unsigned char));
 2189:                     (*s_etat_processus).label_y =
 2190:                             malloc(sizeof(unsigned char));
 2191:                     (*s_etat_processus).label_z =
 2192:                             malloc(sizeof(unsigned char));
 2193:                     (*s_etat_processus).titre =
 2194:                             malloc(sizeof(unsigned char));
 2195: 
 2196:                     if (((*s_etat_processus).label_x == NULL) ||
 2197:                             ((*s_etat_processus).label_y == NULL) ||
 2198:                             ((*s_etat_processus).label_z == NULL) ||
 2199:                             ((*s_etat_processus).titre == NULL) ||
 2200:                             ((*s_etat_processus).legende == NULL) ||
 2201:                             ((*((struct_liste_chainee *) (*((*s_etat_processus)
 2202:                             .parametres_courbes_de_niveau)).objet)).donnee
 2203:                             == NULL))
 2204:                     {
 2205:                         erreur = d_es_allocation_memoire;
 2206: 
 2207:                         if ((*s_etat_processus).langue == 'F')
 2208:                         {
 2209:                             printf("+++Système : Mémoire insuffisante\n");
 2210:                         }
 2211:                         else
 2212:                         {
 2213:                             printf("+++System : Not enough memory\n");
 2214:                         }
 2215: 
 2216:                         return(EXIT_FAILURE);
 2217:                     }
 2218: 
 2219:                     (*(*((struct_liste_chainee *) (*((*s_etat_processus)
 2220:                             .parametres_courbes_de_niveau)).objet)).donnee)
 2221:                             .type = CHN;
 2222: 
 2223:                     initialisation_objet((*((struct_liste_chainee *)
 2224:                             (*((*s_etat_processus)
 2225:                             .parametres_courbes_de_niveau))
 2226:                             .objet)).donnee);
 2227: 
 2228:                     if (((*(*((struct_liste_chainee *) (*((*s_etat_processus)
 2229:                             .parametres_courbes_de_niveau)).objet)).donnee)
 2230:                             .objet = malloc(10 * sizeof(unsigned char)))
 2231:                             == NULL)
 2232:                     {
 2233:                         erreur = d_es_allocation_memoire;
 2234: 
 2235:                         if ((*s_etat_processus).langue == 'F')
 2236:                         {
 2237:                             printf("+++Système : Mémoire insuffisante\n");
 2238:                         }
 2239:                         else
 2240:                         {
 2241:                             printf("+++System : Not enough memory\n");
 2242:                         }
 2243: 
 2244:                         return(EXIT_FAILURE);
 2245:                     }
 2246: 
 2247:                     strcpy((unsigned char *) (*(*((struct_liste_chainee *)
 2248:                             (*((*s_etat_processus)
 2249:                             .parametres_courbes_de_niveau))
 2250:                             .objet)).donnee).objet, "AUTOMATIC");
 2251: 
 2252:                     (*s_etat_processus).label_x[0] = d_code_fin_chaine;
 2253:                     (*s_etat_processus).label_y[0] = d_code_fin_chaine;
 2254:                     (*s_etat_processus).label_z[0] = d_code_fin_chaine;
 2255:                     (*s_etat_processus).titre[0] = d_code_fin_chaine;
 2256:                     (*s_etat_processus).legende[0] = d_code_fin_chaine;
 2257: 
 2258:                     (*s_etat_processus).nom_fichier_gnuplot = NULL;
 2259:                     (*s_etat_processus).type_fichier_gnuplot = NULL;
 2260: 
 2261:                     (*s_etat_processus).x_tics = 0;
 2262:                     (*s_etat_processus).y_tics = 0;
 2263:                     (*s_etat_processus).z_tics = 0;
 2264: 
 2265:                     (*s_etat_processus).x_lines = d_vrai;
 2266:                     (*s_etat_processus).y_lines = d_vrai;
 2267:                     (*s_etat_processus).z_lines = d_vrai;
 2268: 
 2269:                     (*s_etat_processus).mx_tics = -1;
 2270:                     (*s_etat_processus).my_tics = -1;
 2271:                     (*s_etat_processus).mz_tics = -1;
 2272: 
 2273:                     (*s_etat_processus).mx_lines = d_faux;
 2274:                     (*s_etat_processus).my_lines = d_faux;
 2275:                     (*s_etat_processus).mz_lines = d_faux;
 2276: 
 2277:                     (*s_etat_processus).x2_tics = -1;
 2278:                     (*s_etat_processus).y2_tics = -1;
 2279:                     (*s_etat_processus).z2_tics = -1;
 2280: 
 2281:                     (*s_etat_processus).x2_lines = d_faux;
 2282:                     (*s_etat_processus).y2_lines = d_faux;
 2283:                     (*s_etat_processus).z2_lines = d_faux;
 2284: 
 2285:                     (*s_etat_processus).mx2_tics = -1;
 2286:                     (*s_etat_processus).my2_tics = -1;
 2287:                     (*s_etat_processus).mz2_tics = -1;
 2288: 
 2289:                     (*s_etat_processus).mx2_lines = d_faux;
 2290:                     (*s_etat_processus).my2_lines = d_faux;
 2291:                     (*s_etat_processus).mz2_lines = d_faux;
 2292: 
 2293:                     if ((*s_etat_processus).erreur_systeme != d_es)
 2294:                     {
 2295:                         if ((*s_etat_processus).langue == 'F')
 2296:                         {
 2297:                             printf("+++Système : Mémoire insuffisante\n");
 2298:                         }
 2299:                         else
 2300:                         {
 2301:                             printf("+++System : Not enough memory\n");
 2302:                         }
 2303: 
 2304:                         return(EXIT_FAILURE);
 2305:                     }
 2306: 
 2307:                     (*s_etat_processus).mode_evaluation_expression = 'N';
 2308:                     (*s_etat_processus).mode_execution_programme = 'Y';
 2309: 
 2310:                     if ((*s_etat_processus).definitions_chainees == NULL)
 2311:                     {
 2312:                         if ((erreur = chainage(s_etat_processus)) !=
 2313:                                 d_absence_erreur)
 2314:                         {
 2315:                             if ((*s_etat_processus).langue == 'F')
 2316:                             {
 2317:                                 printf("+++Fatal :"
 2318:                                         " Chaînage des définitions"
 2319:                                         " impossible\n");
 2320:                             }
 2321:                             else
 2322:                             {
 2323:                                 printf("+++Fatal : Error in "
 2324:                                         "compilation\n");
 2325:                             }
 2326: 
 2327:                             if (traitement_fichier_temporaire == 'Y')
 2328:                             {
 2329:                                 if (destruction_fichier(
 2330:                                         nom_fichier_temporaire)
 2331:                                         == d_erreur)
 2332:                                 {
 2333:                                     return(EXIT_FAILURE);
 2334:                                 }
 2335: 
 2336:                                 free(nom_fichier_temporaire);
 2337:                             }
 2338: 
 2339:                             return(EXIT_FAILURE);
 2340:                         }
 2341:                     }
 2342: 
 2343:                     if ((erreur = compilation(s_etat_processus)) !=
 2344:                             d_absence_erreur)
 2345:                     {
 2346:                         if (traitement_fichier_temporaire == 'Y')
 2347:                         {
 2348:                             if (destruction_fichier(nom_fichier_temporaire)
 2349:                                     == d_erreur)
 2350:                             {
 2351:                                 return(EXIT_FAILURE);
 2352:                             }
 2353: 
 2354:                             free(nom_fichier_temporaire);
 2355:                         }
 2356: 
 2357:                         printf("%s [%d]\n", message =
 2358:                                 messages(s_etat_processus), (int) getpid());
 2359:                         free(message);
 2360: 
 2361:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 2362:                         {
 2363:                             printf("%s", ds_beep);
 2364:                         }
 2365: 
 2366:                         if ((*s_etat_processus).core == d_vrai)
 2367:                         {
 2368:                             printf("\n");
 2369:                             
 2370:                             if ((*s_etat_processus).langue == 'F')
 2371:                             {
 2372:                                 printf("+++Information : Génération du fichier "
 2373:                                         "rpl-core [%d]\n", (int) getpid());
 2374:                             }
 2375:                             else
 2376:                             {
 2377:                                 printf("+++Information : Writing rpl-core "
 2378:                                         "file [%d]\n", (int) getpid());
 2379:                             }
 2380: 
 2381:                             rplcore(s_etat_processus);
 2382: 
 2383:                             if ((*s_etat_processus).langue == 'F')
 2384:                             {
 2385:                                 printf("+++Information : Processus tracé "
 2386:                                         "[%d]\n", (int) getpid());
 2387:                             }
 2388:                             else
 2389:                             {
 2390:                                 printf("+++Information : Done [%d]\n",
 2391:                                         (int) getpid());
 2392:                             }
 2393: 
 2394:                             printf("\n");
 2395:                         }
 2396: 
 2397:                         return(EXIT_FAILURE);
 2398:                     }
 2399: 
 2400:                     (*s_etat_processus).position_courante = 0;
 2401:                     (*s_etat_processus).traitement_cycle_exit = 'N';
 2402: 
 2403:                     if ((*s_etat_processus).s_arbre_variables == NULL)
 2404:                     {
 2405:                         if ((*s_etat_processus).langue == 'F')
 2406:                         {
 2407:                             printf("+++Fatal : Aucun point d'entrée\n");
 2408:                         }
 2409:                         else
 2410:                         {
 2411:                             printf("+++Fatal : Any entry point\n");
 2412:                         }
 2413: 
 2414:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 2415:                         {
 2416:                             printf("%s", ds_beep);
 2417:                         }
 2418: 
 2419:                         return(EXIT_FAILURE);
 2420:                     }
 2421: 
 2422:                     if (recherche_instruction_suivante(s_etat_processus)
 2423:                             == d_erreur)
 2424:                     {
 2425:                         if ((*s_etat_processus).langue == 'F')
 2426:                         {
 2427:                             printf("+++Fatal : Aucun point d'entrée\n");
 2428:                         }
 2429:                         else
 2430:                         {
 2431:                             printf("+++Fatal : Any entry point\n");
 2432:                         }
 2433: 
 2434:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 2435:                         {
 2436:                             printf("%s", ds_beep);
 2437:                         }
 2438: 
 2439:                         return(EXIT_FAILURE);
 2440:                     }
 2441: 
 2442:                     if (recherche_variable(s_etat_processus,
 2443:                             (*s_etat_processus)
 2444:                             .instruction_courante) == d_faux)
 2445:                     {
 2446:                         if ((*s_etat_processus).langue == 'F')
 2447:                         {
 2448:                             printf("+++Fatal : Aucun point d'entrée\n");
 2449:                         }
 2450:                         else
 2451:                         {
 2452:                             printf("+++Fatal : Any entry point\n");
 2453:                         }
 2454: 
 2455:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 2456:                         {
 2457:                             printf("%s", ds_beep);
 2458:                         }
 2459: 
 2460:                         return(EXIT_FAILURE);
 2461:                     }
 2462: 
 2463:                     if ((*(*s_etat_processus).pointeur_variable_courante)
 2464:                             .niveau != 0)
 2465:                     {
 2466:                         if ((*s_etat_processus).langue == 'F')
 2467:                         {
 2468:                             printf("+++Fatal : Aucun point d'entrée\n");
 2469:                         }
 2470:                         else
 2471:                         {
 2472:                             printf("+++Fatal : Any entry point\n");
 2473:                         }
 2474: 
 2475:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 2476:                         {
 2477:                             printf("%s", ds_beep);
 2478:                         }
 2479: 
 2480:                         return(EXIT_FAILURE);
 2481:                     }
 2482: 
 2483:                     free((*s_etat_processus).instruction_courante);
 2484:                     (*s_etat_processus).position_courante = 0;
 2485: 
 2486:                     if (((*s_etat_processus).nom_fichier_historique =
 2487:                             malloc((strlen(home) +
 2488:                             strlen(ds_fichier_historique) + 2) *
 2489:                             sizeof(unsigned char))) == NULL)
 2490:                     {
 2491:                         erreur = d_es_allocation_memoire;
 2492: 
 2493:                         if ((*s_etat_processus).langue == 'F')
 2494:                         {
 2495:                             printf("+++Système : Mémoire insuffisante\n");
 2496:                         }
 2497:                         else
 2498:                         {
 2499:                             printf("+++System : Not enough memory\n");
 2500:                         }
 2501: 
 2502:                         return(EXIT_FAILURE);
 2503:                     }
 2504: 
 2505:                     sprintf((*s_etat_processus).nom_fichier_historique, "%s/%s",
 2506:                             home, ds_fichier_historique);
 2507: 
 2508:                     using_history();
 2509:                     erreur_historique = read_history(
 2510:                             (*s_etat_processus).nom_fichier_historique);
 2511: 
 2512:                     gsl_set_error_handler(&traitement_exceptions_gsl);
 2513: 
 2514:                     if (drapeau_encart == 'Y')
 2515:                     {
 2516:                         (*s_etat_processus).erreur_systeme = d_es;
 2517:                         encart(s_etat_processus,
 2518:                                 (unsigned long) (5 * 1000000));
 2519: 
 2520:                         if ((*s_etat_processus).erreur_systeme != d_es)
 2521:                         {
 2522:                             if ((message = messages(s_etat_processus))
 2523:                                     == NULL)
 2524:                             {
 2525:                                 erreur = d_es_allocation_memoire;
 2526: 
 2527:                                 if ((*s_etat_processus).langue == 'F')
 2528:                                 {
 2529:                                     printf("+++Système : Mémoire "
 2530:                                             "insuffisante\n");
 2531:                                 }
 2532:                                 else
 2533:                                 {
 2534:                                     printf("+++System : Not enough "
 2535:                                             "memory\n");
 2536:                                 }
 2537: 
 2538:                                 return(EXIT_FAILURE);
 2539:                             }
 2540: 
 2541:                             printf("%s [%d]\n", message, (int) getpid());
 2542:                             free(message);
 2543: 
 2544:                             return(EXIT_FAILURE);
 2545:                         }
 2546:                     }
 2547: 
 2548:                     fflush(stdout);
 2549: 
 2550:                     if (arguments != NULL)
 2551:                     {
 2552:                         tampon = (*s_etat_processus).definitions_chainees;
 2553:                         (*s_etat_processus).definitions_chainees =
 2554:                                 arguments;
 2555: 
 2556:                         if (analyse_syntaxique(s_etat_processus) ==
 2557:                                 d_erreur)
 2558:                         {
 2559:                             if ((*s_etat_processus).erreur_systeme != d_es)
 2560:                             {
 2561:                                 erreur = d_es_allocation_memoire;
 2562: 
 2563:                                 if ((*s_etat_processus).langue == 'F')
 2564:                                 {
 2565:                                     printf("+++Système : Mémoire "
 2566:                                             "insuffisante\n");
 2567:                                 }
 2568:                                 else
 2569:                                 {
 2570:                                     printf("+++System : Not enough "
 2571:                                             "memory\n");
 2572:                                 }
 2573: 
 2574:                                 return(EXIT_FAILURE);
 2575:                             }
 2576:                             else
 2577:                             {
 2578:                                 if ((*s_etat_processus).langue == 'F')
 2579:                                 {
 2580:                                     printf("+++Erreur : Erreur de "
 2581:                                             "syntaxe\n");
 2582:                                 }
 2583:                                 else
 2584:                                 {
 2585:                                     printf("+++Error : Syntax error\n");
 2586:                                 }
 2587: 
 2588:                                 return(EXIT_FAILURE);
 2589:                             }
 2590:                         }
 2591: 
 2592:                         (*s_etat_processus).instruction_courante
 2593:                                 = arguments;
 2594:                         (*s_etat_processus).definitions_chainees = tampon;
 2595:                         (*s_etat_processus).position_courante = 0;
 2596: 
 2597:                         recherche_type(s_etat_processus);
 2598: 
 2599:                         if ((*s_etat_processus).erreur_systeme != d_es)
 2600:                         {
 2601:                             if ((message = messages(s_etat_processus))
 2602:                                     == NULL)
 2603:                             {
 2604:                                 erreur = d_es_allocation_memoire;
 2605: 
 2606:                                 if ((*s_etat_processus).langue == 'F')
 2607:                                 {
 2608:                                     printf("+++Système : Mémoire "
 2609:                                             "insuffisante\n");
 2610:                                 }
 2611:                                 else
 2612:                                 {
 2613:                                     printf("+++System : Not enough "
 2614:                                             "memory\n");
 2615:                                 }
 2616: 
 2617:                                 return(EXIT_FAILURE);
 2618:                             }
 2619: 
 2620:                             printf("%s [%d]\n", message, (int) getpid());
 2621:                             free(message);
 2622: 
 2623:                             return(EXIT_FAILURE);
 2624:                         }
 2625: 
 2626:                         if ((*s_etat_processus).erreur_execution != d_ex)
 2627:                         {
 2628:                             if ((message = messages(s_etat_processus))
 2629:                                     == NULL)
 2630:                             {
 2631:                                 erreur = d_es_allocation_memoire;
 2632: 
 2633:                                 if ((*s_etat_processus).langue == 'F')
 2634:                                 {
 2635:                                     printf("+++Erreur : Mémoire "
 2636:                                             "insuffisante\n");
 2637:                                 }
 2638:                                 else
 2639:                                 {
 2640:                                     printf("+++Error : Not enough "
 2641:                                             "memory\n");
 2642:                                 }
 2643: 
 2644:                                 return(EXIT_FAILURE);
 2645:                             }
 2646: 
 2647:                             printf("%s [%d]\n", message, (int) getpid());
 2648:                             free(message);
 2649: 
 2650:                             return(EXIT_FAILURE);
 2651:                         }
 2652: 
 2653:                         if (depilement(s_etat_processus,
 2654:                                 &((*s_etat_processus).l_base_pile),
 2655:                                 &s_objet) == d_erreur)
 2656:                         {
 2657:                             if ((message = messages(s_etat_processus))
 2658:                                     == NULL)
 2659:                             {
 2660:                                 erreur = d_es_allocation_memoire;
 2661: 
 2662:                                 if ((*s_etat_processus).langue == 'F')
 2663:                                 {
 2664:                                     printf("+++Erreur : Mémoire "
 2665:                                             "insuffisante\n");
 2666:                                 }
 2667:                                 else
 2668:                                 {
 2669:                                     printf("+++Error : Not enough "
 2670:                                             "memory\n");
 2671:                                 }
 2672: 
 2673:                                 return(EXIT_FAILURE);
 2674:                             }
 2675: 
 2676:                             printf("%s [%d]\n", message, (int) getpid());
 2677:                             free(message);
 2678: 
 2679:                             return(EXIT_FAILURE);
 2680:                         }
 2681: 
 2682:                         if (evaluation(s_etat_processus, s_objet, 'E')
 2683:                                 == d_erreur)
 2684:                         {
 2685:                             if ((*s_etat_processus).erreur_systeme != d_es)
 2686:                             {
 2687:                                 if ((message = messages(s_etat_processus))
 2688:                                         == NULL)
 2689:                                 {
 2690:                                     erreur = d_es_allocation_memoire;
 2691: 
 2692:                                     if ((*s_etat_processus).langue == 'F')
 2693:                                     {
 2694:                                         printf("+++Système : Mémoire "
 2695:                                                 "insuffisante\n");
 2696:                                     }
 2697:                                     else
 2698:                                     {
 2699:                                         printf("+++System : Not enough "
 2700:                                                 "memory\n");
 2701:                                     }
 2702: 
 2703:                                     return(EXIT_FAILURE);
 2704:                                 }
 2705: 
 2706:                                 printf("%s [%d]\n", message,
 2707:                                         (int) getpid());
 2708:                                 free(message);
 2709: 
 2710:                                 return(EXIT_FAILURE);
 2711:                             }
 2712: 
 2713:                             if ((*s_etat_processus).erreur_execution
 2714:                                     != d_ex)
 2715:                             {
 2716:                                 if ((message = messages(s_etat_processus))
 2717:                                         == NULL)
 2718:                                 {
 2719:                                     erreur = d_es_allocation_memoire;
 2720: 
 2721:                                     if ((*s_etat_processus).langue == 'F')
 2722:                                     {
 2723:                                         printf("+++Erreur : Mémoire "
 2724:                                                 "insuffisante\n");
 2725:                                     }
 2726:                                     else
 2727:                                     {
 2728:                                         printf("+++Error : Not enough "
 2729:                                                 "memory\n");
 2730:                                     }
 2731: 
 2732:                                     return(EXIT_FAILURE);
 2733:                                 }
 2734: 
 2735:                                 printf("%s [%d]\n", message,
 2736:                                         (int) getpid());
 2737:                                 free(message);
 2738: 
 2739:                                 return(EXIT_FAILURE);
 2740:                             }
 2741:                         }
 2742: 
 2743:                         (*s_etat_processus).instruction_courante = NULL;
 2744:                         liberation(s_etat_processus, s_objet);
 2745: 
 2746:                         free(arguments);
 2747:                     }
 2748: 
 2749:                     if (option_a == d_vrai)
 2750:                     {
 2751:                         fprintf(stdout, "%s\n", (*s_etat_processus)
 2752:                                 .definitions_chainees);
 2753:                     }
 2754:                     else
 2755:                     {
 2756:                         if (option_D == d_vrai)
 2757:                         {
 2758:                             lancement_daemon(s_etat_processus);
 2759:                         }
 2760: 
 2761:                         if (option_p == d_faux)
 2762:                         {
 2763:                             if (setjmp(contexte_initial) == 0)
 2764:                             {
 2765:                                 erreur = sequenceur(s_etat_processus);
 2766: 
 2767:                                 if (erreur == d_absence_erreur)
 2768:                                 {
 2769:                                     if (((*s_etat_processus).var_volatile_alarme
 2770:                                             == 0) && ((*s_etat_processus)
 2771:                                             .arret_depuis_abort == 0) &&
 2772:                                             ((*s_etat_processus).at_exit
 2773:                                             != NULL))
 2774:                                     {
 2775:                                         erreur = evaluation(s_etat_processus,
 2776:                                                 (*s_etat_processus).at_exit,
 2777:                                                 'E');
 2778:                                     }
 2779:                                 }
 2780:                             }
 2781:                         }
 2782:                         else
 2783:                         {
 2784:                             if (setjmp(contexte_initial) == 0)
 2785:                             {
 2786:                                 erreur = sequenceur_optimise(s_etat_processus);
 2787: 
 2788:                                 if (erreur == d_absence_erreur)
 2789:                                 {
 2790:                                     if (((*s_etat_processus).var_volatile_alarme
 2791:                                             == 0) && ((*s_etat_processus)
 2792:                                             .arret_depuis_abort == 0) &&
 2793:                                             ((*s_etat_processus).at_exit
 2794:                                             != NULL))
 2795:                                     {
 2796:                                         erreur = evaluation(s_etat_processus,
 2797:                                                 (*s_etat_processus).at_exit,
 2798:                                                 'E');
 2799:                                     }
 2800:                                 }
 2801:                             }
 2802:                         }
 2803:                     }
 2804: 
 2805:                     liberation(s_etat_processus, (*s_etat_processus).at_exit);
 2806:                     liberation(s_etat_processus, (*s_etat_processus).at_poke);
 2807: 
 2808:                     if ((*s_etat_processus).generateur_aleatoire != NULL)
 2809:                     {
 2810:                         liberation_generateur_aleatoire(s_etat_processus);
 2811:                     }
 2812: 
 2813:                     l_element_courant = (*s_etat_processus).liste_mutexes;
 2814:                     while(l_element_courant != NULL)
 2815:                     {
 2816:                         liberation(s_etat_processus,
 2817:                                 (*((struct_liste_chainee *)
 2818:                                 l_element_courant)).donnee);
 2819:                         l_element_suivant = (*((struct_liste_chainee *)
 2820:                                 l_element_courant)).suivant;
 2821:                         free((struct_liste_chainee *) l_element_courant);
 2822:                         l_element_courant = l_element_suivant;
 2823:                     }
 2824: 
 2825:                     /*
 2826:                      * Arrêt des processus fils
 2827:                      */
 2828: 
 2829:                     if ((*s_etat_processus).presence_fusible == d_vrai)
 2830:                     {
 2831:                         pthread_cancel((*s_etat_processus).thread_fusible);
 2832:                     }
 2833: 
 2834:                     pthread_mutex_lock(&((*s_etat_processus).mutex));
 2835: 
 2836:                     l_element_courant = (void *) (*s_etat_processus)
 2837:                             .l_base_pile_processus;
 2838: 
 2839:                     while(l_element_courant != NULL)
 2840:                     {
 2841:                         if ((*s_etat_processus).debug == d_vrai)
 2842:                         {
 2843:                             if (((*s_etat_processus).type_debug &
 2844:                                     d_debug_processus) != 0)
 2845:                             {
 2846:                                 if ((*(*((struct_processus_fils *)
 2847:                                         (*(*((struct_liste_chainee *)
 2848:                                         l_element_courant)).donnee)
 2849:                                         .objet)).thread)
 2850:                                         .processus_detache == d_vrai)
 2851:                                 {
 2852:                                     if ((*s_etat_processus).langue == 'F')
 2853:                                     {
 2854:                                         printf("[%d] Signalement pour arrêt du "
 2855:                                                 "processus %d\n",
 2856:                                                 (int) getpid(), (int)
 2857:                                                 (*(*((struct_processus_fils *)
 2858:                                                 (*(*((struct_liste_chainee *)
 2859:                                                 l_element_courant)).donnee)
 2860:                                                 .objet)).thread).pid);
 2861:                                     }
 2862:                                     else
 2863:                                     {
 2864:                                         printf("[%d] Send stop signal to "
 2865:                                                 "process %d\n",
 2866:                                                 (int) getpid(), (int)
 2867:                                                 (*(*((struct_processus_fils *)
 2868:                                                 (*(*((struct_liste_chainee *)
 2869:                                                 l_element_courant)).donnee)
 2870:                                                 .objet)).thread).pid);
 2871:                                     }
 2872:                                 }
 2873:                                 else
 2874:                                 {
 2875:                                     if ((*s_etat_processus).langue == 'F')
 2876:                                     {
 2877:                                         printf("[%d] Signalement pour arrêt du "
 2878:                                                 "thread %llu\n", (int) getpid(),
 2879:                                                 (unsigned long long)
 2880:                                                 (*(*((struct_processus_fils *)
 2881:                                                 (*(*((struct_liste_chainee *)
 2882:                                                 l_element_courant)).donnee)
 2883:                                                 .objet)).thread).tid);
 2884:                                     }
 2885:                                     else
 2886:                                     {
 2887:                                         printf("[%d] Send stop signal to "
 2888:                                                 "thread %llu\n",
 2889:                                                 (int) getpid(),
 2890:                                                 (unsigned long long)
 2891:                                                 (*(*((struct_processus_fils *)
 2892:                                                 (*(*((struct_liste_chainee *)
 2893:                                                 l_element_courant)).donnee)
 2894:                                                 .objet)).thread).tid);
 2895:                                     }
 2896:                                 }
 2897:                             }
 2898:                         }
 2899: 
 2900:                         if ((*(*((struct_processus_fils *)
 2901:                                 (*(*((struct_liste_chainee *)
 2902:                                 l_element_courant)).donnee).objet))
 2903:                                 .thread).processus_detache == d_vrai)
 2904:                         {
 2905:                             if ((*s_etat_processus).var_volatile_alarme != 0)
 2906:                             {
 2907:                                 envoi_signal_processus(
 2908:                                         (*(*((struct_processus_fils *)
 2909:                                         (*(*((struct_liste_chainee *)
 2910:                                         l_element_courant)).donnee).objet))
 2911:                                         .thread).pid, rpl_sigurg);
 2912:                             }
 2913:                             else
 2914:                             {
 2915:                                 if ((*s_etat_processus).arret_depuis_abort
 2916:                                         == -1)
 2917:                                 {
 2918:                                     envoi_signal_processus(
 2919:                                             (*(*((struct_processus_fils *)
 2920:                                             (*(*((struct_liste_chainee *)
 2921:                                             l_element_courant)).donnee).objet))
 2922:                                             .thread).pid, rpl_sigabort);
 2923:                                 }
 2924:                                 else
 2925:                                 {
 2926:                                     envoi_signal_processus(
 2927:                                             (*(*((struct_processus_fils *)
 2928:                                             (*(*((struct_liste_chainee *)
 2929:                                             l_element_courant)).donnee).objet))
 2930:                                             .thread).pid, rpl_sigstop);
 2931:                                 }
 2932:                             }
 2933:                         }
 2934:                         else
 2935:                         {
 2936:                             pthread_mutex_lock(&((*(*((struct_processus_fils *)
 2937:                                     (*(*((struct_liste_chainee *)
 2938:                                     l_element_courant)).donnee).objet)).thread)
 2939:                                     .mutex));
 2940: 
 2941:                             if ((*(*((struct_processus_fils *)
 2942:                                     (*(*((struct_liste_chainee *)
 2943:                                     l_element_courant)).donnee).objet)).thread)
 2944:                                     .thread_actif == d_vrai)
 2945:                             {
 2946:                                 if ((*s_etat_processus).var_volatile_alarme
 2947:                                         != 0)
 2948:                                 {
 2949:                                     envoi_signal_thread(
 2950:                                             (*(*((struct_processus_fils *)
 2951:                                             (*(*((struct_liste_chainee *)
 2952:                                             l_element_courant)).donnee).objet))
 2953:                                             .thread).tid, rpl_sigurg);
 2954:                                 }
 2955:                                 else
 2956:                                 {
 2957:                                     if ((*s_etat_processus).arret_depuis_abort
 2958:                                             == -1)
 2959:                                     {
 2960:                                         envoi_signal_thread(
 2961:                                                 (*(*((struct_processus_fils *)
 2962:                                                 (*(*((struct_liste_chainee *)
 2963:                                                 l_element_courant)).donnee)
 2964:                                                 .objet)).thread).tid,
 2965:                                                 rpl_sigabort);
 2966:                                     }
 2967:                                     else
 2968:                                     {
 2969:                                         envoi_signal_thread(
 2970:                                                 (*(*((struct_processus_fils *)
 2971:                                                 (*(*((struct_liste_chainee *)
 2972:                                                 l_element_courant)).donnee)
 2973:                                                 .objet)).thread).tid,
 2974:                                                 rpl_sigstop);
 2975:                                     }
 2976:                                 }
 2977:                             }
 2978: 
 2979:                             pthread_mutex_unlock(
 2980:                                     &((*(*((struct_processus_fils *)
 2981:                                     (*(*((struct_liste_chainee *)
 2982:                                     l_element_courant)).donnee).objet)).thread)
 2983:                                     .mutex));
 2984:                         }
 2985: 
 2986:                         l_element_courant = (*((struct_liste_chainee *)
 2987:                                 l_element_courant)).suivant;
 2988:                     }
 2989: 
 2990:                     /*
 2991:                      * Attente de la fin de tous les processus fils
 2992:                      */
 2993: 
 2994:                     for(i = 0; i < d_NOMBRE_INTERRUPTIONS;
 2995:                             (*s_etat_processus).masque_interruptions[i++]
 2996:                             = 'I');
 2997: 
 2998:                     attente.tv_sec = 0;
 2999:                     attente.tv_nsec = GRANULARITE_us * 1000;
 3000: 
 3001:                     while((*s_etat_processus).l_base_pile_processus != NULL)
 3002:                     {
 3003:                         l_element_courant = (void *)
 3004:                                 (*s_etat_processus).l_base_pile_processus;
 3005: 
 3006:                         for(i = 0; i < (unsigned long)
 3007:                                 (*(*((struct_processus_fils *)
 3008:                                 (*(*((struct_liste_chainee *)
 3009:                                 l_element_courant)).donnee).objet)).thread)
 3010:                                 .nombre_objets_dans_pipe; i++)
 3011:                         {
 3012:                             if ((s_objet = lecture_pipe(
 3013:                                     s_etat_processus,
 3014:                                     (*(*((struct_processus_fils *)
 3015:                                     (*(*((struct_liste_chainee *)
 3016:                                     l_element_courant)).donnee).objet)).thread)
 3017:                                     .pipe_objets[0])) != NULL)
 3018:                             {
 3019:                                 liberation(s_etat_processus, s_objet);
 3020: 
 3021:                                 (*(*((struct_processus_fils *)
 3022:                                         (*(*((struct_liste_chainee *)
 3023:                                         l_element_courant)).donnee).objet))
 3024:                                         .thread).nombre_objets_dans_pipe--;
 3025: 
 3026:                                 action.sa_handler = SIG_IGN;
 3027:                                 action.sa_flags = 0;
 3028: 
 3029:                                 if (sigaction(SIGPIPE, &action, &registre)
 3030:                                         != 0)
 3031:                                 {
 3032:                                     pthread_mutex_unlock(
 3033:                                             &((*s_etat_processus).mutex));
 3034:                                     return(EXIT_FAILURE);
 3035:                                 }
 3036: 
 3037:                                 while((longueur_ecriture =
 3038:                                         write_atomic(s_etat_processus,
 3039:                                         (*(*((struct_processus_fils *)
 3040:                                         (*(*((struct_liste_chainee *)
 3041:                                         l_element_courant)).donnee).objet))
 3042:                                         .thread).pipe_nombre_injections[1], "+",
 3043:                                         sizeof(unsigned char))) !=
 3044:                                         sizeof(unsigned char))
 3045:                                 {
 3046:                                     if (longueur_ecriture == -1)
 3047:                                     {
 3048:                                         // Le processus n'existe plus.
 3049:                                         break;
 3050:                                     }
 3051:                                 }
 3052: 
 3053:                                 if (sigaction(SIGPIPE, &registre, NULL)
 3054:                                         != 0)
 3055:                                 {
 3056:                                     pthread_mutex_unlock(
 3057:                                             &((*s_etat_processus).mutex));
 3058:                                     return(EXIT_FAILURE);
 3059:                                 }
 3060:                             }
 3061:                         }
 3062: 
 3063:                         pthread_mutex_unlock(&((*s_etat_processus).mutex));
 3064: 
 3065:                         if ((*s_etat_processus)
 3066:                                 .nombre_interruptions_non_affectees != 0)
 3067:                         {
 3068:                             affectation_interruptions_logicielles(
 3069:                                     s_etat_processus);
 3070:                         }
 3071: 
 3072:                         nanosleep(&attente, NULL);
 3073:                         scrutation_interruptions(s_etat_processus);
 3074:                         pthread_mutex_lock(&((*s_etat_processus).mutex));
 3075:                     }
 3076: 
 3077:                     pthread_mutex_unlock(&((*s_etat_processus).mutex));
 3078: 
 3079:                     erreur_historique = write_history(
 3080:                             (*s_etat_processus).nom_fichier_historique);
 3081:                     clear_history();
 3082: 
 3083:                     if (erreur_historique != 0)
 3084:                     {
 3085:                         if ((*s_etat_processus).langue == 'F')
 3086:                         {
 3087:                             printf("+++Erreur : L'historique ne peut être "
 3088:                                     "écrit\n");
 3089:                         }
 3090:                         else
 3091:                         {
 3092:                             printf("+++Error : History cannot be "
 3093:                                     "written\n");
 3094:                         }
 3095: 
 3096:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 3097:                         {
 3098:                             printf("%s", ds_beep);
 3099:                         }
 3100:                     }
 3101: 
 3102:                     free((*s_etat_processus).nom_fichier_historique);
 3103: 
 3104:                     if (((*s_etat_processus).core == d_vrai) &&
 3105:                             (erreur == d_erreur) &&
 3106:                             ((*s_etat_processus).var_volatile_traitement_sigint
 3107:                             == 0))
 3108:                     {
 3109:                         printf("\n");
 3110:                         
 3111:                         if ((*s_etat_processus).langue == 'F')
 3112:                         {
 3113:                             printf("+++Information : Génération du fichier "
 3114:                                     "rpl-core [%d]\n", (int) getpid());
 3115:                         }
 3116:                         else
 3117:                         {
 3118:                             printf("+++Information : Writing rpl-core "
 3119:                                     "file [%d]\n", (int) getpid());
 3120:                         }
 3121: 
 3122:                         rplcore(s_etat_processus);
 3123: 
 3124:                         if ((*s_etat_processus).langue == 'F')
 3125:                         {
 3126:                             printf("+++Information : Processus tracé [%d]\n",
 3127:                                     (int) getpid());
 3128:                         }
 3129:                         else
 3130:                         {
 3131:                             printf("+++Information : Done [%d]\n",
 3132:                                     (int) getpid());
 3133:                         }
 3134: 
 3135:                         printf("\n");
 3136:                     }
 3137: 
 3138:                     free((*s_etat_processus).definitions_chainees);
 3139: 
 3140:                     /*
 3141:                      * Libération de l'arbre des instructions
 3142:                      */
 3143: 
 3144:                     liberation_arbre_instructions(s_etat_processus,
 3145:                             (*s_etat_processus).arbre_instructions);
 3146:                     free((*s_etat_processus).pointeurs_caracteres);
 3147: 
 3148:                     if ((*s_etat_processus).entree_standard != NULL)
 3149:                     {
 3150:                         pclose((*s_etat_processus).entree_standard);
 3151:                         (*s_etat_processus).entree_standard = NULL;
 3152:                     }
 3153: 
 3154:                     if ((*s_etat_processus).nom_fichier_impression != NULL)
 3155:                     {
 3156:                         if (test_cfsf(s_etat_processus, 51) == d_faux)
 3157:                         {
 3158:                             printf("%s", ds_beep);
 3159:                         }
 3160: 
 3161:                         if ((*s_etat_processus).langue == 'F')
 3162:                         {
 3163:                             printf("+++Attention : Queue d'impression "
 3164:                                     "non vide !\n");
 3165:                         }
 3166:                         else
 3167:                         {
 3168:                             printf("+++Warning : Non empty printing "
 3169:                                     "spool queue !\n");
 3170:                         }
 3171: 
 3172:                         instruction_erase(s_etat_processus);
 3173:                     }
 3174: 
 3175:                     if ((*s_etat_processus).fichiers_graphiques != NULL)
 3176:                     {
 3177:                         instruction_cllcd(s_etat_processus);
 3178:                     }
 3179: 
 3180:                     liberation(s_etat_processus, (*s_etat_processus).indep);
 3181:                     liberation(s_etat_processus, (*s_etat_processus).depend);
 3182: 
 3183:                     free((*s_etat_processus).label_x);
 3184:                     free((*s_etat_processus).label_y);
 3185:                     free((*s_etat_processus).label_z);
 3186:                     free((*s_etat_processus).titre);
 3187:                     free((*s_etat_processus).legende);
 3188: 
 3189:                     liberation(s_etat_processus, (*s_etat_processus)
 3190:                             .parametres_courbes_de_niveau);
 3191: 
 3192:                     for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++)
 3193:                     {
 3194:                         liberation(s_etat_processus,
 3195:                                 (*s_etat_processus).corps_interruptions[i]);
 3196: 
 3197:                         l_element_courant = (*s_etat_processus)
 3198:                                 .pile_origine_interruptions[i];
 3199: 
 3200:                         while(l_element_courant != NULL)
 3201:                         {
 3202:                             l_element_suivant = (*((struct_liste_chainee *)
 3203:                                     l_element_courant)).suivant;
 3204: 
 3205:                             liberation(s_etat_processus,
 3206:                                     (*((struct_liste_chainee *)
 3207:                                     l_element_courant)).donnee);
 3208:                             free(l_element_courant);
 3209: 
 3210:                             l_element_courant = l_element_suivant;
 3211:                         }
 3212:                     }
 3213: 
 3214:                     if ((*s_etat_processus).instruction_derniere_erreur
 3215:                             != NULL)
 3216:                     {
 3217:                         free((*s_etat_processus).instruction_derniere_erreur);
 3218:                         (*s_etat_processus).instruction_derniere_erreur = NULL;
 3219:                     }
 3220: 
 3221:                     /*
 3222:                      * Le pointeur s_etat_processus.nom_fichier_source est
 3223:                      * alloué par le système. Il ne faut donc pas
 3224:                      * le libérer...
 3225:                      */
 3226: 
 3227:                     liberation_arbre_variables(s_etat_processus,
 3228:                             (*s_etat_processus).s_arbre_variables, d_vrai);
 3229:                     free((*s_etat_processus).pointeurs_caracteres_variables);
 3230: 
 3231:                     for(i = 0; i < (*s_etat_processus)
 3232:                             .nombre_variables_statiques; i++)
 3233:                     {
 3234:                         liberation(s_etat_processus, (*s_etat_processus)
 3235:                                 .s_liste_variables_statiques[i].objet);
 3236:                         free((*s_etat_processus)
 3237:                                 .s_liste_variables_statiques[i].nom);
 3238:                     }
 3239: 
 3240:                     free((*s_etat_processus).s_liste_variables_statiques);
 3241: 
 3242:                     for(i = 0; i < (*((*s_etat_processus)
 3243:                             .s_liste_variables_partagees)).nombre_variables;
 3244:                             i++)
 3245:                     {
 3246:                         liberation(s_etat_processus, (*((*s_etat_processus)
 3247:                                 .s_liste_variables_partagees)).table[i].objet);
 3248:                         free((*((*s_etat_processus)
 3249:                                 .s_liste_variables_partagees)).table[i].nom);
 3250:                     }
 3251: 
 3252:                     free((struct_variable_partagee *)
 3253:                             (*((*s_etat_processus).s_liste_variables_partagees))
 3254:                             .table);
 3255: 
 3256:                     /*
 3257:                      * Si resultats est non nul, rplinit a été appelé
 3258:                      * depuis rpl() [librpl] et non main().
 3259:                      * On copie alors le contenu de la * pile dans un
 3260:                      * tableau **resultats dont le pointeur de base a
 3261:                      * été alloué dans rpl().
 3262:                      */
 3263: 
 3264:                     if (resultats != NULL)
 3265:                     {
 3266:                         if ((*resultats) != NULL)
 3267:                         {
 3268:                             free((*resultats));
 3269: 
 3270:                             if (((*resultats) = malloc(((*s_etat_processus)
 3271:                                     .hauteur_pile_operationnelle + 1)
 3272:                                     * sizeof(unsigned char **))) != NULL)
 3273:                             {
 3274:                                 (*resultats)[(*s_etat_processus)
 3275:                                         .hauteur_pile_operationnelle] = NULL;
 3276:                                 l_element_courant = (void *) (*s_etat_processus)
 3277:                                         .l_base_pile;
 3278: 
 3279:                                 for(i = 0; i < (*s_etat_processus)
 3280:                                         .hauteur_pile_operationnelle; i++)
 3281:                                 {
 3282:                                     if (l_element_courant != NULL)
 3283:                                     {
 3284:                                         (*resultats)[i] =
 3285:                                                 formateur(s_etat_processus,
 3286:                                                 0, (*((struct_liste_chainee *)
 3287:                                                 l_element_courant)).donnee);
 3288: 
 3289:                                         if ((*resultats)[i] == NULL)
 3290:                                         {
 3291:                                             i = (*s_etat_processus).
 3292:                                                     hauteur_pile_operationnelle;
 3293:                                         }
 3294:                                         else
 3295:                                         {
 3296:                                             l_element_suivant =
 3297:                                                     (*((struct_liste_chainee *)
 3298:                                                     l_element_courant)).suivant;
 3299:                                         }
 3300:                                     }
 3301:                                 }
 3302:                             }
 3303:                             else
 3304:                             {
 3305:                                 (*resultats) = NULL;
 3306:                                 erreur = d_es_allocation_memoire;
 3307:                             }
 3308:                         }
 3309:                     }
 3310: 
 3311:                     l_element_courant = (void *) (*s_etat_processus)
 3312:                             .l_base_pile;
 3313:                     while(l_element_courant != NULL)
 3314:                     {
 3315:                         l_element_suivant = (*((struct_liste_chainee *)
 3316:                                 l_element_courant)).suivant;
 3317: 
 3318:                         liberation(s_etat_processus,
 3319:                                 (*((struct_liste_chainee *)
 3320:                                 l_element_courant)).donnee);
 3321:                         free((struct_liste_chainee *) l_element_courant);
 3322: 
 3323:                         l_element_courant = l_element_suivant;
 3324:                     }
 3325: 
 3326:                     l_element_courant = (void *) (*s_etat_processus)
 3327:                             .l_base_pile_contextes;
 3328:                     while(l_element_courant != NULL)
 3329:                     {
 3330:                         l_element_suivant = (*((struct_liste_chainee *)
 3331:                                 l_element_courant)).suivant;
 3332: 
 3333:                         liberation(s_etat_processus,
 3334:                                 (*((struct_liste_chainee *)
 3335:                                 l_element_courant)).donnee);
 3336:                         free((struct_liste_chainee *) l_element_courant);
 3337: 
 3338:                         l_element_courant = l_element_suivant;
 3339:                     }
 3340: 
 3341:                     l_element_courant = (void *) (*s_etat_processus)
 3342:                             .l_base_pile_taille_contextes;
 3343:                     while(l_element_courant != NULL)
 3344:                     {
 3345:                         l_element_suivant = (*((struct_liste_chainee *)
 3346:                                 l_element_courant)).suivant;
 3347: 
 3348:                         liberation(s_etat_processus,
 3349:                                 (*((struct_liste_chainee *)
 3350:                                 l_element_courant)).donnee);
 3351:                         free((struct_liste_chainee *) l_element_courant);
 3352: 
 3353:                         l_element_courant = l_element_suivant;
 3354:                     }
 3355: 
 3356:                     for(i = 0; i < (*s_etat_processus)
 3357:                             .nombre_instructions_externes; i++)
 3358:                     {
 3359:                         free((*s_etat_processus).s_instructions_externes[i]
 3360:                                 .nom);
 3361:                         free((*s_etat_processus).s_instructions_externes[i]
 3362:                                 .nom_bibliotheque);
 3363:                     }
 3364: 
 3365:                     if ((*s_etat_processus).nombre_instructions_externes != 0)
 3366:                     {
 3367:                         free((*s_etat_processus).s_instructions_externes);
 3368:                     }
 3369: 
 3370:                     l_element_courant = (void *) (*s_etat_processus)
 3371:                             .s_bibliotheques;
 3372:                     
 3373:                     while(l_element_courant != NULL)
 3374:                     {
 3375:                         l_element_suivant = (*((struct_liste_chainee *)
 3376:                                 l_element_courant)).suivant;
 3377: 
 3378:                         free((*((struct_bibliotheque *)
 3379:                                 (*((struct_liste_chainee *)
 3380:                                 l_element_courant)).donnee)).nom);
 3381:                         dlclose((*((struct_bibliotheque *)
 3382:                                 (*((struct_liste_chainee *)
 3383:                                 l_element_courant)).donnee)).descripteur);
 3384:                         free((*((struct_liste_chainee *) l_element_courant))
 3385:                                 .donnee);
 3386:                         free(l_element_courant);
 3387: 
 3388:                         l_element_courant = l_element_suivant;
 3389:                     }
 3390: 
 3391:                     l_element_courant = (void *) (*s_etat_processus)
 3392:                             .l_base_pile_last;
 3393:                     while(l_element_courant != NULL)
 3394:                     {
 3395:                         l_element_suivant = (*((struct_liste_chainee *)
 3396:                                 l_element_courant)).suivant;
 3397: 
 3398:                         liberation(s_etat_processus,
 3399:                                 (*((struct_liste_chainee *)
 3400:                                 l_element_courant)).donnee);
 3401:                         free((struct_liste_chainee *) l_element_courant);
 3402: 
 3403:                         l_element_courant = l_element_suivant;
 3404:                     }
 3405: 
 3406:                     l_element_courant = (void *) (*s_etat_processus)
 3407:                             .l_base_pile_systeme;
 3408:                     while(l_element_courant != NULL)
 3409:                     {
 3410:                         l_element_suivant = (*((struct_liste_pile_systeme *)
 3411:                                 l_element_courant)).suivant;
 3412: 
 3413:                         liberation(s_etat_processus,
 3414:                                 (*((struct_liste_pile_systeme *)
 3415:                                 l_element_courant)).indice_boucle);
 3416:                         liberation(s_etat_processus,
 3417:                                 (*((struct_liste_pile_systeme *)
 3418:                                 l_element_courant)).limite_indice_boucle);
 3419:                         liberation(s_etat_processus,
 3420:                                 (*((struct_liste_pile_systeme *)
 3421:                                 l_element_courant)).objet_de_test);
 3422: 
 3423:                         if ((*((struct_liste_pile_systeme *)
 3424:                                 l_element_courant)).nom_variable != NULL)
 3425:                         {
 3426:                             free((*((struct_liste_pile_systeme *)
 3427:                                     l_element_courant)).nom_variable);
 3428:                         }
 3429: 
 3430:                         free((struct_liste_pile_systeme *)
 3431:                                 l_element_courant);
 3432: 
 3433:                         l_element_courant = l_element_suivant;
 3434:                     }
 3435: 
 3436:                     l_element_courant = (void *)
 3437:                             (*s_etat_processus).s_fichiers;
 3438:                     while(l_element_courant != NULL)
 3439:                     {
 3440:                         l_element_suivant = (*((struct_liste_chainee *)
 3441:                                 l_element_courant)).suivant;
 3442: 
 3443:                         fclose((*((struct_descripteur_fichier *)
 3444:                                 (*((struct_liste_chainee *)
 3445:                                 l_element_courant)).donnee))
 3446:                                 .descripteur_c);
 3447: 
 3448:                         if ((*((struct_descripteur_fichier *)
 3449:                                 (*((struct_liste_chainee *)
 3450:                                 l_element_courant)).donnee)).type != 'C')
 3451:                         {
 3452:                             sqlite3_close((*((struct_descripteur_fichier *)
 3453:                                     (*((struct_liste_chainee *)
 3454:                                     l_element_courant)).donnee))
 3455:                                     .descripteur_sqlite);
 3456:                         }
 3457: 
 3458:                         if ((*((struct_descripteur_fichier *)
 3459:                                 (*((struct_liste_chainee *)
 3460:                                 l_element_courant)).donnee))
 3461:                                 .effacement == 'Y')
 3462:                         {
 3463:                             unlink((*((struct_descripteur_fichier *)
 3464:                                     (*((struct_liste_chainee *)
 3465:                                     l_element_courant)).donnee))
 3466:                                     .nom);
 3467:                         }
 3468: 
 3469:                         free((*((struct_descripteur_fichier *)
 3470:                                 (*((struct_liste_chainee *)
 3471:                                 l_element_courant)).donnee)).nom);
 3472:                         free((struct_descripteur_fichier *)
 3473:                                 (*((struct_liste_chainee *)
 3474:                                 l_element_courant)).donnee);
 3475:                         free(l_element_courant);
 3476: 
 3477:                         l_element_courant = l_element_suivant;
 3478:                     }
 3479: 
 3480:                     l_element_courant = (void *)
 3481:                             (*s_etat_processus).s_sockets;
 3482:                     while(l_element_courant != NULL)
 3483:                     {
 3484:                         l_element_suivant = (*((struct_liste_chainee *)
 3485:                                 l_element_courant)).suivant;
 3486: 
 3487:                         if ((*((struct_socket *)
 3488:                                 (*(*((struct_liste_chainee *)
 3489:                                 l_element_courant)).donnee).objet))
 3490:                                 .socket_connectee == d_vrai)
 3491:                         {
 3492:                             shutdown((*((struct_socket *)
 3493:                                     (*(*((struct_liste_chainee *)
 3494:                                     l_element_courant)).donnee).objet))
 3495:                                     .socket, SHUT_RDWR);
 3496:                         }
 3497: 
 3498:                         close((*((struct_socket *)
 3499:                                 (*(*((struct_liste_chainee *)
 3500:                                 l_element_courant)).donnee).objet)).socket);
 3501: 
 3502:                         if ((*((struct_socket *) (*(*((struct_liste_chainee *)
 3503:                                 l_element_courant)).donnee).objet)).effacement
 3504:                                 == 'Y')
 3505:                         {
 3506:                             unlink((*((struct_socket *)
 3507:                                     (*(*((struct_liste_chainee *)
 3508:                                     l_element_courant)).donnee).objet))
 3509:                                     .adresse);
 3510:                         }
 3511: 
 3512:                         liberation(s_etat_processus,
 3513:                                 (*((struct_liste_chainee *)
 3514:                                 l_element_courant)).donnee);
 3515:                         free(l_element_courant);
 3516: 
 3517:                         l_element_courant = l_element_suivant;
 3518:                     }
 3519: 
 3520:                     l_element_courant = (void *)
 3521:                             (*s_etat_processus).s_connecteurs_sql;
 3522:                     while(l_element_courant != NULL)
 3523:                     {
 3524:                         l_element_suivant = (*((struct_liste_chainee *)
 3525:                                 l_element_courant)).suivant;
 3526: 
 3527:                         sqlclose((*((struct_liste_chainee *)
 3528:                                 l_element_courant)).donnee);
 3529:                         liberation(s_etat_processus,
 3530:                                 (*((struct_liste_chainee *)
 3531:                                 l_element_courant)).donnee);
 3532:                         free(l_element_courant);
 3533: 
 3534:                         l_element_courant = l_element_suivant;
 3535:                     }
 3536: 
 3537:                     l_element_courant = (*s_etat_processus).s_marques;
 3538:                     while(l_element_courant != NULL)
 3539:                     {
 3540:                         free((*((struct_marque *) l_element_courant)).label);
 3541:                         free((*((struct_marque *) l_element_courant)).position);
 3542:                         l_element_suivant = (*((struct_marque *)
 3543:                                 l_element_courant)).suivant;
 3544:                         free(l_element_courant);
 3545:                         l_element_courant = l_element_suivant;
 3546:                     }
 3547:                 }
 3548:                 else
 3549:                 {
 3550:                     erreur = d_es_allocation_memoire;
 3551: 
 3552:                     if (test_cfsf(s_etat_processus, 51) == d_faux)
 3553:                     {
 3554:                         printf("%s", ds_beep);
 3555:                     }
 3556: 
 3557:                     if ((*s_etat_processus).langue == 'F')
 3558:                     {
 3559:                         printf("+++Système : Mémoire insuffisante\n");
 3560:                     }
 3561:                     else
 3562:                     {
 3563:                         printf("+++System : Not enough memory\n");
 3564:                     }
 3565:                 }
 3566:             }
 3567: 
 3568:             liberation_allocateur(s_etat_processus);
 3569:         }
 3570: 
 3571:         if (traitement_fichier_temporaire == 'Y')
 3572:         {
 3573:             if (destruction_fichier(nom_fichier_temporaire) == d_erreur)
 3574:             {
 3575:                 return(EXIT_FAILURE);
 3576:             }
 3577: 
 3578:             free(nom_fichier_temporaire);
 3579:         }
 3580: 
 3581:         if ((*s_etat_processus).profilage == d_vrai)
 3582:         {
 3583:             ecriture_profil(s_etat_processus);
 3584:             liberation_profil(s_etat_processus);
 3585:         }
 3586:     }
 3587: 
 3588:     closelog();
 3589: 
 3590:     pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes));
 3591:     pthread_mutex_destroy(&((*((*s_etat_processus).s_liste_variables_partagees))
 3592:             .mutex));
 3593: 
 3594:     retrait_thread(s_etat_processus);
 3595: 
 3596:     pthread_mutex_destroy(&((*s_etat_processus).mutex));
 3597:     pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation));
 3598: 
 3599: #   ifndef SEMAPHORES_NOMMES
 3600:     sem_post(&((*s_etat_processus).semaphore_fork));
 3601:     sem_destroy(&((*s_etat_processus).semaphore_fork));
 3602: #   else
 3603:     sem_post((*s_etat_processus).semaphore_fork);
 3604:     sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(),
 3605:             SEM_FORK);
 3606: #   endif
 3607: 
 3608:     free((*s_etat_processus).localisation);
 3609: 
 3610:     pthread_mutex_destroy(&mutex_liste_threads);
 3611:     pthread_mutex_destroy(&mutex_gestionnaires_signaux_atomique);
 3612: 
 3613: #   ifndef SEMAPHORES_NOMMES
 3614:     sem_post(&semaphore_gestionnaires_signaux);
 3615:     sem_destroy(&semaphore_gestionnaires_signaux);
 3616: #   else
 3617:     sem_post(semaphore_gestionnaires_signaux);
 3618:     sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX);
 3619: #   endif
 3620: 
 3621:     destruction_queue_signaux(s_etat_processus);
 3622:     liberation_contexte_cas(s_etat_processus);
 3623: 
 3624:     free((*s_etat_processus).chemin_fichiers_temporaires);
 3625: 
 3626:     if ((*s_etat_processus).requete_redemarrage == d_vrai)
 3627:     {
 3628:         chdir(repertoire_initial);
 3629:         execvp(arg_exec[0], &(arg_exec[0]));
 3630:         erreur = d_erreur;
 3631:     }
 3632: 
 3633:     free(arg_exec);
 3634:     free(s_etat_processus);
 3635: 
 3636: #   ifdef DEBUG_MEMOIRE
 3637:     debug_memoire_verification();
 3638:     analyse_post_mortem();
 3639: #   endif
 3640: 
 3641: #   ifdef HAVE_STACK_OVERFLOW_RECOVERY
 3642:     stackoverflow_deinstall_handler();
 3643: #   endif
 3644: 
 3645: #   ifdef HAVE_SIGSEGV_RECOVERY
 3646:     if (debug == d_faux)
 3647:     {
 3648:         sigsegv_deinstall_handler();
 3649:     }
 3650: #   endif
 3651: 
 3652:     return((erreur == d_absence_erreur) ? EXIT_SUCCESS : EXIT_FAILURE);
 3653: }
 3654: 
 3655: 
 3656: void
 3657: informations(struct_processus *s_etat_processus)
 3658: {
 3659:     printf("\n");
 3660: 
 3661:     if ((*s_etat_processus).langue == 'F')
 3662:     {
 3663:         printf("  rpl [-options] [programme]\n");
 3664:         printf("      -a : analyse du code\n");
 3665:         printf("      -A : paramètres passés au programme principal\n");
 3666:         printf("      -c : génération de fichier de débogage (rpl-core)\n");
 3667:         printf("      -d : option de déverminage interne\n");
 3668:         printf("      -D : lancement d'un daemon\n");
 3669:         printf("      -h : aide sur la ligne de commande\n");
 3670:         printf("      -i : fonctionnement interactif\n");
 3671:         printf("      -l : licence d'utilisation\n");
 3672:         printf("      -n : ignorance du signal HUP\n");
 3673:         printf("      -p : précompilation du script avant exécution\n");
 3674:         printf("      -P : profilage\n");
 3675:         printf("      -s : empêchement de l'ouverture de l'écran initial\n");
 3676:         printf("      -S : exécution du script passé en ligne de commande\n");
 3677:         printf("      -t : trace\n");
 3678:         printf("      -v : version\n");
 3679:     }
 3680:     else
 3681:     {
 3682:         printf("  rpl [-options] [program]\n");
 3683:         printf("      -a : analyzes program\n");
 3684:         printf("      -A : sends parameters to main program\n");
 3685:         printf("      -c : allows creation of a rpl-core file, providing a way"
 3686:                 "\n"
 3687:                 "           to debug a program\n");
 3688:         printf("      -d : internal debug process\n");
 3689:         printf("      -D : starts in daemon mode\n");
 3690:         printf("      -h : shows a summary of available options\n");
 3691:         printf("      -i : runs the RPL/2 sequencer in interactive mode\n");
 3692:         printf("      -l : prints the user licence of the software\n");
 3693:         printf("      -n : ignores HUP signal\n");
 3694:         printf("      -p : precompiles script\n");
 3695:         printf("      -P : computes profile data\n");
 3696:         printf("      -s : disables splash screen\n");
 3697:         printf("      -S : executes script written in command line\n");
 3698:         printf("      -t : enables tracing mode\n");
 3699:         printf("      -v : prints the version number\n");
 3700:     }
 3701: 
 3702:     printf("\n");
 3703: 
 3704:     return;
 3705: }
 3706: 
 3707: 
 3708: logical1
 3709: controle_integrite(struct_processus *s_etat_processus,
 3710:         unsigned char *executable_candidat, unsigned char *executable)
 3711: {
 3712:     unsigned char       *md5;
 3713:     unsigned char       *sha1;
 3714: 
 3715:     if (strcmp(executable, "rplpp") == 0)
 3716:     {
 3717:         md5 = rplpp_md5;
 3718:         sha1 = rplpp_sha1;
 3719:     }
 3720:     else if (strcmp(executable, "rplfile") == 0)
 3721:     {
 3722:         md5 = rplfile_md5;
 3723:         sha1 = rplfile_sha1;
 3724:     }
 3725:     else if (strcmp(executable, "rpliconv") == 0)
 3726:     {
 3727:         md5 = rpliconv_md5;
 3728:         sha1 = rpliconv_sha1;
 3729:     }
 3730:     else if (strcmp(executable, "rplawk") == 0)
 3731:     {
 3732:         md5 = rplawk_md5;
 3733:         sha1 = rplawk_sha1;
 3734:     }
 3735:     else if (strcmp(executable, "rplconvert") == 0)
 3736:     {
 3737:         md5 = rplconvert_md5;
 3738:         sha1 = rplconvert_sha1;
 3739:     }
 3740:     else
 3741:     {
 3742:         return(d_faux);
 3743:     }
 3744: 
 3745:     if (controle(s_etat_processus, executable_candidat, "md5", md5) != d_vrai)
 3746:     {
 3747:         return(d_faux);
 3748:     }
 3749: 
 3750:     if (controle(s_etat_processus, executable_candidat, "sha1", sha1) != d_vrai)
 3751:     {
 3752:         return(d_faux);
 3753:     }
 3754: 
 3755:     return(d_vrai);
 3756: }
 3757: 
 3758: 
 3759: unsigned char *
 3760: date_compilation()
 3761: {
 3762:     unsigned char       *date;
 3763: 
 3764:     if ((date = malloc((strlen(d_date_en_rpl) + 1) * sizeof(unsigned char)))
 3765:             == NULL)
 3766:     {
 3767:         return(NULL);
 3768:     }
 3769: 
 3770:     strcpy(date, d_date_en_rpl);
 3771: 
 3772:     return(date);
 3773: }
 3774: 
 3775: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>