--- rpl/src/instructions_o1.c 2012/02/23 15:53:27 1.47 +++ rpl/src/instructions_o1.c 2012/02/24 15:02:54 1.48 @@ -919,6 +919,7 @@ instruction_open(struct_processus *s_eta logical1 erreur; logical1 existence; + logical1 negation; logical1 ouverture; logical1 presence_port; @@ -1046,8 +1047,7 @@ instruction_open(struct_processus *s_eta printf(" IMAXBEL, OPOST, ONLCR, OCRNL, ONOCR, ONLRET,\n"); printf(" OFILL, HUPCL, CLOCAL, CRTSCTS, ISIG, ICANON,\n"); printf(" ECHO, ECHOE, ECHOK, ECHONL, NOFLSH, TOSTOP,\n"); - printf(" IEXTEN, VEOF, VEOL, VERASE, VINTR, VKILL,\n"); - printf(" VQUIT, VSTART, VSTOP, VSUSP\n"); + printf(" IEXTEN\n"); printf(" Address : { \"ADDRESS\" [ 127 0 0 1 ] }\n"); printf(" { \"HOST\" \"hostname\" }\n"); @@ -3828,9 +3828,157 @@ instruction_open(struct_processus *s_eta // Autres paramètres free(parametre_courant_majuscule); + parametre_courant = (*parametre_courant).suivant; while(parametre_courant != NULL) { + if ((*(*parametre_courant).donnee).type != CHN) + { + liberation(s_etat_processus, s_objet_argument); + liberation(s_etat_processus, s_objet_resultat); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_parametre_fichier; + return; + } + + if ((parametre_courant_majuscule = conversion_majuscule( + (*(*parametre_courant).donnee).objet)) == NULL) + { + (*s_etat_processus).erreur_systeme = + d_es_allocation_memoire; + return; + } + + position = parametre_courant_majuscule; + negation = d_faux; + + unsigned char *fonctions[] = + { "IGNBRK", "BRKINT", "IGNPAR", "PARMRK", + "INPCK", "ISTRIP", "INLCR", "IGNCR", "ICRNL", + "IXON", "IXANY", "IXOFF", "OPOST", + "ONLCR", "OCRNL", "ONOCR", "ONLRET", + "OFILL", "HUPCL", "CLOCAL", "CRTSCTS", + "ISIG", "ICANON", "ECHO", "ECHOE", "ECHOK", + "ECHONL", "NOFLSH", "TOSTOP", "IEXTEN", NULL }; + int fonctions_constantes[] = + { /* c_iflag */ + 1, IGNBRK, 1, BRKINT, 1, IGNPAR, 1, PARMRK, + 1, INPCK, 1, ISTRIP, 1, INLCR, 1, IGNCR, 1, ICRNL, + 1, IXON, 1, IXANY, 1, IXOFF, + /* c_oflag */ + 2 , OPOST, 2, ONLCR, 2, OCRNL, 2, ONOCR, 2, ONLRET, + 2, OFILL, 2, HUPCL, + /* c_cflag */ + 3, CLOCAL, 3, CRTSCTS, + /* c_lfkag */ + 4, ISIG, 4, ICANON, 4, ECHO, 4, ECHOE, 4, ECHOK, + 4, ECHONL, 4, NOFLSH, 4, TOSTOP, 4, IEXTEN }; + unsigned int fonction_courante; + + if (isalnum((*position)) != 0) + { + // On vient de trouver quelque chose à interpréter. + + if (strncmp(position, "NO ", 3) == 0) + { + position += 3; + negation = d_vrai; + } + } + + for(fonction_courante = 0; + fonctions[fonction_courante] != NULL; + fonction_courante++) + { + if (strcmp(fonctions[fonction_courante], position) + == 0) + { + if (negation == d_vrai) + { + switch(fonctions_constantes + [fonction_courante * 2]) + { + case 1: + { + tc.c_iflag &= ~fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + + case 2: + { + tc.c_oflag &= ~fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + + case 3: + { + tc.c_cflag &= ~fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + + case 4: + { + tc.c_lflag &= ~fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + } + } + else + { + switch(fonctions_constantes + [fonction_courante * 2]) + { + case 1: + { + tc.c_iflag |= fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + + case 2: + { + tc.c_oflag |= fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + + case 3: + { + tc.c_cflag |= fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + + case 4: + { + tc.c_lflag |= fonctions_constantes + [(fonction_courante * 2) - 1]; + break; + } + } + } + + break; + } + } + + if (fonctions[fonction_courante] == NULL) + { + free(parametre_courant_majuscule); + liberation(s_etat_processus, s_objet_argument); + liberation(s_etat_processus, s_objet_resultat); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_parametre_fichier; + return; + } + + free(parametre_courant_majuscule); parametre_courant = (*parametre_courant).suivant; }