--- rpl/src/instructions_u1.c 2012/05/21 17:25:45 1.40 +++ rpl/src/instructions_u1.c 2020/01/10 11:15:49 1.72 @@ -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.32 + Copyright (C) 1989-2020 Dr. BERTRAND Joël This file is part of RPL/2. @@ -710,7 +710,7 @@ instruction_use(struct_processus *s_etat if ((*s_etat_processus).langue == 'F') { printf("(insertion d'une bibliothèque dynamique)\n\n"); - printf("Si le chemin ne comprend pas de '/', la bibliothèque " + printf("Si le chemin ne commence pas par '/', la bibliothèque " "est recherchée\n"); printf("successivement dans le répertoire courant puis dans %s." "\n\n", d_exec_path); @@ -718,7 +718,7 @@ instruction_use(struct_processus *s_etat else { printf("(insert a shared library)\n\n"); - printf("If this path does not include '/', RPL/2 tries to find " + printf("If this path does not begin with '/', RPL/2 tries to find " "it in current\n"); printf("directory or %s in this order.\n\n", d_exec_path); } @@ -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);