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

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

CVSweb interface <joel.bertrand@systella.fr>