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

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

CVSweb interface <joel.bertrand@systella.fr>