diff options
author | Paul Smith <psmith@gnu.org> | 2000-01-22 05:43:03 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2000-01-22 05:43:03 +0000 |
commit | 5577cdc2616262ae89c28cda49b5dd5449be472d (patch) | |
tree | 9e5b67f4754ce5a2d64bad43d28a7eaf093b6274 /glob | |
parent | b7b83d6398e8e552dd1b9d70d18d7262753e03d4 (diff) | |
download | gunmake-5577cdc2616262ae89c28cda49b5dd5449be472d.tar.gz |
* Merge VMS patches by Hartmut Becker.
Diffstat (limited to 'glob')
-rw-r--r-- | glob/glob.c | 27 | ||||
-rw-r--r-- | glob/glob.h | 12 |
2 files changed, 36 insertions, 3 deletions
diff --git a/glob/glob.c b/glob/glob.c index 65055fb..4bbf7bb 100644 --- a/glob/glob.c +++ b/glob/glob.c @@ -299,6 +299,12 @@ static int glob_in_dir __P ((const char *pattern, const char *directory, static int prefix_array __P ((const char *prefix, char **array, size_t n)); static int collated_compare __P ((const __ptr_t, const __ptr_t)); +#ifdef VMS +/* these compilers like prototypes */ +#if !defined _LIBC || !defined NO_GLOB_PATTERN_P +int __glob_pattern_p (const char *pattern, int quote); +#endif +#endif /* Find the end of the sub-pattern in a brace expression. We define this as an inline function if the compiler permits. */ @@ -609,7 +615,12 @@ glob (pattern, flags, errfunc, pglob) if (dirname[1] == '\0' || dirname[1] == '/') { /* Look up home directory. */ - const char *home_dir = getenv ("HOME"); +#ifdef VMS +/* This isn't obvious, RTLs of DECC and VAXC know about "HOME" */ + const char *home_dir = getenv ("SYS$LOGIN"); +#else + const char *home_dir = getenv ("HOME"); +#endif # ifdef _AMIGA if (home_dir == NULL || home_dir[0] == '\0') home_dir = "SYS:"; @@ -618,6 +629,11 @@ glob (pattern, flags, errfunc, pglob) if (home_dir == NULL || home_dir[0] == '\0') home_dir = "c:/users/default"; /* poor default */ # else +# ifdef VMS +/* Again, this isn't obvious, if "HOME" isn't known "SYS$LOGIN" should be set */ + if (home_dir == NULL || home_dir[0] == '\0') + home_dir = "SYS$DISK:[]"; +# else if (home_dir == NULL || home_dir[0] == '\0') { int success; @@ -676,6 +692,7 @@ glob (pattern, flags, errfunc, pglob) else home_dir = "~"; /* No luck. */ } +# endif /* VMS */ # endif /* WINDOWS32 */ # endif /* Now construct the full directory. */ @@ -696,7 +713,7 @@ glob (pattern, flags, errfunc, pglob) dirname = newp; } } -# if !defined _AMIGA && !defined WINDOWS32 +# if !defined _AMIGA && !defined WINDOWS32 && !defined VMS else { char *end_name = strchr (dirname, '/'); @@ -776,7 +793,7 @@ glob (pattern, flags, errfunc, pglob) home directory. */ return GLOB_NOMATCH; } -# endif /* Not Amiga && not WINDOWS32. */ +# endif /* Not Amiga && not WINDOWS32 && not VMS. */ } #endif /* Not VMS. */ @@ -1213,6 +1230,10 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) int meta; int save; +#ifdef VMS + if (*directory == 0) + directory = "[]"; +#endif meta = __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE)); if (meta == 0) { diff --git a/glob/glob.h b/glob/glob.h index 7c2a67a..9f735fe 100644 --- a/glob/glob.h +++ b/glob/glob.h @@ -51,7 +51,15 @@ extern "C" { typedef __SIZE_TYPE__ __size_t; # else /* This is a guess. */ +/*hb + * Conflicts with DECCs aready defined type __size_t. + * Defining an own type with a name beginning with '__' is no good. + * Anyway if DECC is used and __SIZE_T is defined then __size_t is + * already defined (and I hope it's exactly the one we need here). + */ +#if !(defined __DECC && defined __SIZE_T) typedef unsigned long int __size_t; +#endif # endif #else /* The GNU CC stddef.h version defines __size_t as empty. We need a real @@ -118,7 +126,11 @@ typedef struct struct dirent *(*gl_readdir) __PMT ((void *)); __ptr_t (*gl_opendir) __PMT ((__const char *)); int (*gl_lstat) __PMT ((__const char *, struct stat *)); +#if defined(VMS) && defined(__DECC) && !defined(_POSIX_C_SOURCE) + int (*gl_stat) __PMT ((__const char *, struct stat *, ...)); +#else int (*gl_stat) __PMT ((__const char *, struct stat *)); +#endif } glob_t; #ifdef _LARGEFILE64_SOURCE |