diff options
Diffstat (limited to 'vpath.c')
-rw-r--r-- | vpath.c | 40 |
1 files changed, 30 insertions, 10 deletions
@@ -387,6 +387,10 @@ selective_vpath_search (struct vpath *path, const char *file, { #ifndef VMS *p++ = '/'; +#else + /* VMS: if this is not in VMS format, treat as Unix format */ + if ((*p != ':') && (*p != ']') && (*p != '>')) + *p++ = '/'; #endif memcpy (p, file, name_dplen); p += name_dplen; @@ -405,6 +409,15 @@ selective_vpath_search (struct vpath *path, const char *file, memcpy (p + 1, filename, flen + 1); } else +#else + /* VMS use a slash if no directory terminator present */ + if (p != name && p[-1] != '/' && p[-1] != ':' && + p[-1] != '>' && p[-1] != ']') + { + *p = '/'; + memcpy (p + 1, filename, flen + 1); + } + else #endif memcpy (p, filename, flen + 1); @@ -449,17 +462,20 @@ selective_vpath_search (struct vpath *path, const char *file, See if it actually exists. */ #ifdef VMS - exists_in_cache = exists = dir_file_exists_p (vpath[i], filename); -#else - /* Clobber a null into the name at the last slash. - Now NAME is the name of the directory to look in. */ - *p = '\0'; - - /* We know the directory is in the hash table now because either - construct_vpath_list or the code just above put it there. - Does the file we seek exist in it? */ - exists_in_cache = exists = dir_file_exists_p (name, filename); + /* For VMS syntax just use the original vpath */ + if (*p != '/') + exists_in_cache = exists = dir_file_exists_p (vpath[i], filename); + else #endif + { + /* Clobber a null into the name at the last slash. + Now NAME is the name of the directory to look in. */ + *p = '\0'; + /* We know the directory is in the hash table now because either + construct_vpath_list or the code just above put it there. + Does the file we seek exist in it? */ + exists_in_cache = exists = dir_file_exists_p (name, filename); + } } if (exists) @@ -475,6 +491,10 @@ selective_vpath_search (struct vpath *path, const char *file, #ifndef VMS /* Put the slash back in NAME. */ *p = '/'; +#else + /* If the slash was removed, put it back */ + if (*p == 0) + *p = '/'; #endif if (exists_in_cache) /* Makefile-mentioned file need not exist. */ |