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

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

CVSweb interface <joel.bertrand@systella.fr>