diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Lexternal.c | 4 | ||||
-rw-r--r-- | src/H5private.h | 15 | ||||
-rw-r--r-- | src/H5system.c | 28 |
3 files changed, 42 insertions, 5 deletions
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 2c6b3a3..8637429 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -121,6 +121,8 @@ H5L_getenv_prefix_name(char **env_prefix/*in,out*/) * * Programmer: Vailin Choi, April 2, 2008 * + * Modification: Raymond Lu, 14 Jan. 2009 + * Added support for OpenVMS pathname --------------------------------------------------------------------------*/ static herr_t H5L_build_name(char *prefix, char *file_name, char **full_name/*out*/) @@ -140,8 +142,10 @@ H5L_build_name(char *prefix, char *file_name, char **full_name/*out*/) /* Copy the prefix into the buffer */ HDstrcpy(*full_name, prefix); +#ifndef H5_VMS if (!CHECK_DELIMITER(prefix[prefix_len-1])) HDstrcat(*full_name, DIR_SEPS); +#endif /* Add the external link's filename to the prefix supplied */ HDstrcat(*full_name, file_name); diff --git a/src/H5private.h b/src/H5private.h index 63bbcf4..2f75f86 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1375,8 +1375,7 @@ extern char *strdup(const char *s); #define HDpthread_self_ulong() ((unsigned long)pthread_self()) #endif /* HDpthread_self_ulong */ - -#ifdef H5_HAVE_WINDOW_PATH +#if defined(H5_HAVE_WINDOW_PATH) /* directory delimiter for Windows: slash and backslash are acceptable on Windows */ #define DIR_SLASH_SEPC '/' @@ -1397,6 +1396,18 @@ extern char *strdup(const char *s); (ptr = slash); \ } +#elif defined(H5_HAVE_VMS_PATH) + +/* OpenVMS pathname: <disk name>$<partition>:[path]<file name> + * i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c */ +#define DIR_SEPC '.' +#define DIR_SEPS "." +#define CHECK_DELIMITER(SS) (SS == DIR_SEPC) +#define CHECK_ABSOLUTE(NAME) (strrchr(NAME, ':') && strrchr(NAME, '[')) +#define CHECK_ABS_DRIVE(NAME) (0) +#define CHECK_ABS_PATH(NAME) (0) +#define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, ']'); + #else #define DIR_SEPC '/' diff --git a/src/H5system.c b/src/H5system.c index 8f91e2f..8956e9b 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -597,9 +597,12 @@ HDremove_all(const char *fname) * * Programmer: Vailin Choi * April 2, 2008 - * Modifications: 2nd Oct, 2008; Vailin Choi + * Modifications: 2nd Oct, 2008; Vailin Choi * Remove compiler warning for "if condition" - * + * + * Raymond Lu + * 14 Jan. 2009 + * Add support for OpenVMS pathname *------------------------------------------------------------------------- */ #define MAX_PATH_LEN 1024 @@ -620,6 +623,8 @@ H5_build_extpath(const char *name, char **extpath/*out*/) /* * Unix: name[0] is a "/" * Windows: name[0-2] is "<drive letter>:\" or "<drive-letter>:/" + * OpenVMS: <disk name>$<partition>:[path]<file name> + * i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c */ if (CHECK_ABSOLUTE(name)) { if ((full_path=H5MM_strdup(name)) == NULL) @@ -634,6 +639,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) * Windows: name[0-1] is "<drive-letter>:" * Get current working directory on the drive specified in NAME * Unix: does not apply + * OpenVMS: does not apply */ if (CHECK_ABS_DRIVE(name)) { drive = name[0] - 'A' + 1; @@ -643,12 +649,13 @@ H5_build_extpath(const char *name, char **extpath/*out*/) * Windows: name[0] is a '/' or '\' * Get current drive * Unix: does not apply + * OpenVMS: does not apply */ } else if (CHECK_ABS_PATH(name) && ((drive=HDgetdrive()) != 0)) { sprintf(cwdpath, "%c:%c", (drive+'A'-1), name[0]); retcwd = cwdpath; HDstrcpy(new_name, &name[1]); - } else /* totally relative for both Unix and Windows: get current working directory */ + } else /* totally relative for Unix, Windows, and OpenVMS: get current working directory */ retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN); if (retcwd != NULL) { @@ -659,9 +666,24 @@ H5_build_extpath(const char *name, char **extpath/*out*/) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDstrcpy(full_path, cwdpath); +#ifdef H5_VMS + /* If the file name contains relative path, cut off the beginning bracket. Also cut off the + * ending bracket of CWDPATH to combine the full path name. i.g. + * cwdpath = SYS$SYSUSERS:[LU.HDF5.TEST] + * new_name = [.tmp]extlinks.h5 + * full_path = SYS$SYSUSERS:[LU.HDF5.TEST.tmp]extlinks.h5 + */ + if(new_name[0] == '[') { + char *tmp = new_name; + full_path[cwdlen-1] = '\0'; + HDstrcat(full_path, ++tmp); + } else + HDstrcat(full_path, new_name); +#else if (!CHECK_DELIMITER(cwdpath[cwdlen-1])) HDstrcat(full_path, DIR_SEPS); HDstrcat(full_path, new_name); +#endif } } |