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

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

CVSweb interface <joel.bertrand@systella.fr>