--- rpl/src/instructions_o1.c 2010/08/09 13:51:47 1.19 +++ rpl/src/instructions_o1.c 2012/01/17 14:44:08 1.44 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.0.18 - Copyright (C) 1989-2010 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.6 + Copyright (C) 1989-2012 Dr. BERTRAND Joël This file is part of RPL/2. @@ -897,6 +897,8 @@ instruction_open(struct_processus *s_eta * Format : * FORMATTED : fichier texte ; * UNFORMATTED : fichier binaire. + * FLOW : chaîne de caractères sans format (en tant qu'objet + * binaire comme "\x00avz\xFD") */ file *descripteur; @@ -1190,6 +1192,34 @@ instruction_open(struct_processus *s_eta type_ouverture = 'R'; } + else if (strcmp(argument_majuscule, "OLD") == 0) + { + if (type_ouverture != ' ') + { + liberation(s_etat_processus, s_objet_argument); + free(argument_majuscule); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_parametre_fichier; + return; + } + + if (type_arguments == ' ') + { + type_arguments = 'F'; + } + else if (type_arguments == 'S') + { + liberation(s_etat_processus, s_objet_argument); + free(argument_majuscule); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_parametre_fichier; + return; + } + + type_ouverture = 'O'; + } else if (strcmp(argument_majuscule, "UNKNOWN") == 0) { if (type_ouverture != ' ') @@ -1942,6 +1972,16 @@ instruction_open(struct_processus *s_eta protocole_socket = (unsigned char *) (*(*l_element_courant_sous_objet) .donnee).objet; + + for(i = 0; i < strlen(protocole_socket); i++) + { + if ((protocole_socket[i] >= 'a') && + (protocole_socket[i] <= 'z')) + { + protocole_socket[i] -= 'a' - 'A'; + } + } + } else { @@ -2782,10 +2822,17 @@ instruction_open(struct_processus *s_eta return; } + sqlite = NULL; + if (sqlite3_open_v2(nom, &sqlite, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK) { + if (sqlite != NULL) + { + sqlite3_close(sqlite); + } + free(nom); liberation(s_etat_processus, s_objet_argument); @@ -2888,10 +2935,17 @@ instruction_open(struct_processus *s_eta } else { + sqlite = NULL; + if (sqlite3_open_v2(nom, &sqlite, SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK) { + if (sqlite != NULL) + { + sqlite3_close(sqlite); + } + free(nom); liberation(s_etat_processus, s_objet_argument); @@ -3027,10 +3081,17 @@ instruction_open(struct_processus *s_eta } else { + sqlite = NULL; + if (sqlite3_open_v2(nom, &sqlite, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK) { + if (sqlite != NULL) + { + sqlite3_close(sqlite); + } + free(nom); liberation(s_etat_processus, s_objet_argument); @@ -3138,10 +3199,17 @@ instruction_open(struct_processus *s_eta } else { + sqlite = NULL; + if (sqlite3_open_v2(nom, &sqlite, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK) { + if (sqlite != NULL) + { + sqlite3_close(sqlite); + } + free(nom); liberation(s_etat_processus, s_objet_argument); @@ -3232,10 +3300,17 @@ instruction_open(struct_processus *s_eta } else { + sqlite = NULL; + if (sqlite3_open_v2(nom, &sqlite, SQLITE_OPEN_READWRITE, NULL) != SQLITE_OK) { + if (sqlite != NULL) + { + sqlite3_close(sqlite); + } + free(nom); liberation(s_etat_processus, s_objet_argument); @@ -3310,10 +3385,17 @@ instruction_open(struct_processus *s_eta return; } + sqlite = NULL; + if (sqlite3_open_v2(nom, &sqlite, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK) { + if (sqlite != NULL) + { + sqlite3_close(sqlite); + } + free(nom); liberation(s_etat_processus, s_objet_argument); @@ -3976,6 +4058,28 @@ instruction_open(struct_processus *s_eta return; } + if ((type_adresse == ' ') && (type_domaine == 'L')) + { + if (strcmp(protocole, "IPV4") == 0) + { + for(i = 0; i < 4; adresse[i++] = 0); + type_adresse = '4'; + } + else if (strcmp(protocole, "IPV6") == 0) + { + for(i = 0; i < 16; adresse[i++] = 0); + type_adresse = '6'; + } + else + { + liberation(s_etat_processus, s_objet_argument); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_parametre_fichier; + return; + } + } + if (((strcmp(protocole, "IPV4") == 0) && (type_adresse == '6')) || ((strcmp(protocole, "IPV6") == 0) && (type_adresse == '4'))) { @@ -4007,16 +4111,7 @@ instruction_open(struct_processus *s_eta } else { - for(i = 0; i < strlen(protocole_socket); i++) - { - if ((protocole_socket[i] >= 'A') && - (protocole_socket[i] <= 'Z')) - { - protocole_socket[i] += 'a' - 'A'; - } - } - - if (strcmp(protocole_socket, "ipv4") == 0) + if (strcmp(protocole_socket, "IPV4") == 0) { protocole_socket[2] = d_code_fin_chaine; } @@ -4185,8 +4280,8 @@ instruction_open(struct_processus *s_eta pointeur++; } - strncpy(socket_unix.sun_path, pointeur, 108); - socket_unix.sun_path[108 - 1] = d_code_fin_chaine; + strncpy(socket_unix.sun_path, pointeur, UNIX_PATH_MAX); + socket_unix.sun_path[UNIX_PATH_MAX - 1] = d_code_fin_chaine; if (options_socket() == d_erreur) { @@ -4443,11 +4538,11 @@ instruction_open(struct_processus *s_eta if ((*s_etat_processus).langue == 'F') { printf("+++Attention : Support du protocole" - " IPv6 indisponble\n"); + " IPv6 indisponible\n"); } else { - printf("+++Attention : IPv6 support " + printf("+++Warning : IPv6 support " "unavailable\n"); } # endif @@ -4613,11 +4708,11 @@ instruction_open(struct_processus *s_eta if ((*s_etat_processus).langue == 'F') { printf("+++Attention : Support du protocole" - " IPv6 indisponble\n"); + " IPv6 indisponible\n"); } else { - printf("+++Attention : IPv6 support " + printf("+++Warning : IPv6 support " "unavailable\n"); } # endif @@ -4724,8 +4819,8 @@ instruction_open(struct_processus *s_eta socket_unix.sun_family = AF_UNIX; strncpy(socket_unix.sun_path, (*((struct_socket *) - (*s_objet_resultat).objet)).adresse, 108); - socket_unix.sun_path[108 - 1] = d_code_fin_chaine; + (*s_objet_resultat).objet)).adresse, UNIX_PATH_MAX); + socket_unix.sun_path[UNIX_PATH_MAX - 1] = d_code_fin_chaine; if ((type_socket == 'S') || (type_socket == 'Q')) { @@ -4983,11 +5078,11 @@ instruction_open(struct_processus *s_eta if ((*s_etat_processus).langue == 'F') { printf("+++Attention : Support du protocole" - " IPv6 indisponble\n"); + " IPv6 indisponible\n"); } else { - printf("+++Attention : IPv6 support " + printf("+++Warning : IPv6 support " "unavailable\n"); } # endif @@ -5195,11 +5290,11 @@ instruction_open(struct_processus *s_eta if ((*s_etat_processus).langue == 'F') { printf("+++Attention : Support du protocole" - " IPv6 indisponble\n"); + " IPv6 indisponible\n"); } else { - printf("+++Attention : IPv6 support " + printf("+++Warning : IPv6 support " "unavailable\n"); } # endif