--- rpl/src/instructions_o1.c 2012/05/21 17:25:44 1.55 +++ rpl/src/instructions_o1.c 2013/02/26 19:56:15 1.63 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.9 - Copyright (C) 1989-2012 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.12 + Copyright (C) 1989-2013 Dr. BERTRAND Joël This file is part of RPL/2. @@ -2731,6 +2731,14 @@ instruction_open(struct_processus *s_eta l_element_courant = (*l_element_courant).suivant; } + // Si aucun paramètre n'est discriminant, l'instruction ouvre + // par défaut un fichier. + + if (type_arguments == ' ') + { + type_arguments = 'F'; + } + if (type_arguments == 'F') { /* @@ -3651,12 +3659,30 @@ instruction_open(struct_processus *s_eta unsigned char *vitesses[] = { "0", "50", "75", "110", "134", "150", "200", "300", "600", "1200", "1800", "2400", - "4800", "9600", "19200", "38400", "57600", - "115200", "230400", NULL }; + "4800", "9600", "19200", "38400", +#ifdef B57600 + "57600", +#endif +#ifdef B115200 + "115200", +#endif +#ifdef B230400 + "230400", +#endif + NULL }; int vitesses_constantes[] = { B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, B4800, B9600, B19200, B38400, - B57600, B115200, B230400, 0 }; +#ifdef B57600 + B57600, +#endif +#ifdef B115200 + B115200, +#endif +#ifdef B230400 + B230400, +#endif + 0 }; unsigned int vitesse_courante; vitesse_courante = 0; @@ -3669,8 +3695,15 @@ instruction_open(struct_processus *s_eta if (position[strlen(vitesses[vitesse_courante])] == d_code_espace) { +#ifdef CBAUD tc.c_cflag &= ~CBAUD; tc.c_cflag |= vitesses_constantes[vitesse_courante]; +#else // POSIX + cfsetispeed(&tc, + vitesses_constantes[vitesse_courante]); + cfsetospeed(&tc, + vitesses_constantes[vitesse_courante]); +#endif position += strlen(vitesses[vitesse_courante]); break; @@ -3914,21 +3947,41 @@ instruction_open(struct_processus *s_eta unsigned char *fonctions[] = { "IGNBRK", "BRKINT", "IGNPAR", "PARMRK", "INPCK", "ISTRIP", "INLCR", "IGNCR", "ICRNL", - "IXON", "IXANY", "IXOFF", "OPOST", + "IXON", +#ifdef IXANY + "IXANY", +#endif + "IXOFF", "OPOST", "ONLCR", "OCRNL", "ONOCR", "ONLRET", - "OFILL", "HUPCL", "CLOCAL", "CRTSCTS", +#ifdef OFILL + "OFILL", +#endif + "HUPCL", "CLOCAL", +#ifdef CRTSCTS + "CRTSCTS", +#endif "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, + 1, IXON, +#ifdef IXANY + 1, IXANY, +#endif + 1, IXOFF, /* c_oflag */ 2 , OPOST, 2, ONLCR, 2, OCRNL, 2, ONOCR, 2, ONLRET, - 2, OFILL, 2, HUPCL, +#ifdef OFILL + 2, OFILL, +#endif + 2, HUPCL, /* c_cflag */ - 3, CLOCAL, 3, CRTSCTS, + 3, CLOCAL, +#ifdef CRTSCTS + 3, CRTSCTS, +#endif /* c_lfkag */ 4, ISIG, 4, ICANON, 4, ECHO, 4, ECHOE, 4, ECHOK, 4, ECHONL, 4, NOFLSH, 4, TOSTOP, 4, IEXTEN }; @@ -4682,18 +4735,22 @@ instruction_open(struct_processus *s_eta if (strcmp(protocole_socket, "IPV4") == 0) { protocole_socket[2] = d_code_fin_chaine; + protocole_numerique = 0; } - - if ((s_protocole = getprotobyname(protocole_socket)) == NULL) + else { - liberation(s_etat_processus, s_objet_argument); + if ((s_protocole = getprotobyname(protocole_socket)) + == NULL) + { + liberation(s_etat_processus, s_objet_argument); - (*s_etat_processus).erreur_execution = - d_ex_erreur_parametre_fichier; - return; - } + (*s_etat_processus).erreur_execution = + d_ex_erreur_parametre_fichier; + return; + } - protocole_numerique = (*s_protocole).p_proto; + protocole_numerique = (*s_protocole).p_proto; + } } if ((s_objet_resultat = allocation(s_etat_processus, SCK))