--- rpl/src/instructions_u1.c 2013/02/26 19:56:16 1.45 +++ rpl/src/instructions_u1.c 2017/07/02 22:28:20 1.64 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.12 - Copyright (C) 1989-2013 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.27 + Copyright (C) 1989-2017 Dr. BERTRAND Joël This file is part of RPL/2. @@ -752,12 +752,12 @@ instruction_use(struct_processus *s_etat if ((*s_objet_argument).type == CHN) { /* - * Si le nom contient un '/', il est traité comme un chemin + * Si le nom commence par un '/', il est traité comme un chemin * absolu. Dans le cas contraire, on essaye successivement * './' puis le répertoire lib de l'installation du langage. */ - if (index((unsigned char *) (*s_objet_argument).objet, '/') == NULL) + if (((unsigned char *) (*s_objet_argument).objet)[0] != '/') { if ((tampon = malloc((strlen((unsigned char *) (*s_objet_argument) .objet) + 3) * sizeof(unsigned char))) == NULL) @@ -811,6 +811,14 @@ instruction_use(struct_processus *s_etat (unsigned char *) (*s_objet_argument).objet); } + // Si la chaîne commence par '//', on supprime un '/'. + // tampon[1] existe toujours. + + if (tampon[1] == '/') + { + memmove(tampon, tampon + 1, strlen(tampon)); + } + caracteristiques_fichier(s_etat_processus, tampon, &existence, &ouverture, &unite);