Annotation of rpl/src/rpl.c, revision 1.157

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

CVSweb interface <joel.bertrand@systella.fr>