--- rpl/src/instructions_u1.c 2017/06/28 09:20:36 1.63 +++ rpl/src/instructions_u1.c 2017/07/02 22:28:20 1.64 @@ -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);