summaryrefslogtreecommitdiff
path: root/pathexp.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1999-02-19 17:11:39 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:52 +0000
commitb72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (patch)
treeb9899162338c2ff3fd83a8aef8831cb119e85cd7 /pathexp.c
parentbc4cd23ce958feda898c618215f94d8a4e8f4ffa (diff)
downloadbash-b72432fdcc59300c6fe7c9d6c8a31ad3447933f5.tar.gz
Imported from ../bash-2.03.tar.gz.
Diffstat (limited to 'pathexp.c')
-rw-r--r--pathexp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/pathexp.c b/pathexp.c
index a7b69c1e..3c02effc 100644
--- a/pathexp.c
+++ b/pathexp.c
@@ -34,7 +34,12 @@
#include "flags.h"
#include <glob/fnmatch.h>
-#include <glob/glob.h>
+
+#if defined (USE_POSIX_GLOB_LIBRARY)
+# include <glob.h>
+#else
+# include <glob/glob.h>
+#endif
/* Control whether * matches .files in globbing. */
int glob_dot_filenames;
@@ -172,7 +177,12 @@ shell_glob_filename (pathname)
filenames.gl_offs = 0;
+# if defined (GLOB_PERIOD)
glob_flags = glob_dot_filenames ? GLOB_PERIOD : 0;
+# else
+ glob_flags = 0;
+# endif /* !GLOB_PERIOD */
+
glob_flags |= (GLOB_ERR | GLOB_DOOFFS);
i = glob (temp, glob_flags, (Function *)NULL, &filenames);
@@ -181,8 +191,9 @@ shell_glob_filename (pathname)
if (i == GLOB_NOSPACE || i == GLOB_ABEND)
return ((char **)NULL);
-
- if (i == GLOB_NOMATCH)
+ else if (i == GLOB_NOMATCH)
+ filenames.gl_pathv = (char **)NULL;
+ else if (i != 0) /* other error codes not in POSIX.2 */
filenames.gl_pathv = (char **)NULL;
return (filenames.gl_pathv);