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

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

CVSweb interface <joel.bertrand@systella.fr>