summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2009-06-13 21:21:48 +0000
committerPaul Smith <psmith@gnu.org>2009-06-13 21:21:48 +0000
commitbf9822658f50510d997da9d8c0c828dd7e26d6a6 (patch)
tree47ab9802e84026d85beb9e0b409872069bfb0e93 /read.c
parentc8840352acf40443a70ea3748130cee055154492 (diff)
downloadgunmake-bf9822658f50510d997da9d8c0c828dd7e26d6a6.tar.gz
- Fix Savannah bug 17825
- Fix Savannah bug 21231
Diffstat (limited to 'read.c')
-rw-r--r--read.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/read.c b/read.c
index d77ed33..3071ae5 100644
--- a/read.c
+++ b/read.c
@@ -836,7 +836,7 @@ eval (struct ebuffer *ebuf, int set_default)
files = multi_glob (parse_file_seq (&p2, '\0',
sizeof (struct nameseq),
1),
- sizeof (struct nameseq));
+ sizeof (struct nameseq), 0);
free (p);
/* Save the state of conditionals and start
@@ -1021,7 +1021,7 @@ eval (struct ebuffer *ebuf, int set_default)
filenames = multi_glob (parse_file_seq (&p2, '\0',
sizeof (struct nameseq),
1),
- sizeof (struct nameseq));
+ sizeof (struct nameseq), 0);
*p2 = ':';
if (!filenames)
@@ -3069,10 +3069,12 @@ tilde_expand (const char *name)
SIZE is how big to construct chain elements.
This is useful if we want them actually to be other structures
- that have room for additional info. */
+ that have room for additional info.
+
+ If EXISTS_ONLY is true only return existing files. */
struct nameseq *
-multi_glob (struct nameseq *chain, unsigned int size)
+multi_glob (struct nameseq *chain, unsigned int size, int exists_only)
{
void dir_setup_glob (glob_t *);
struct nameseq *new = 0;
@@ -3125,8 +3127,16 @@ multi_glob (struct nameseq *chain, unsigned int size)
nlist = (const char **)gl.gl_pathv;
break;
+ case GLOB_NOMATCH:
+ if (exists_only)
+ {
+ i = 0;
+ break;
+ }
+ /* FALLTHROUGH */
+
default:
- /* Not a match or another error; keep this name. */
+ /* By default keep this name. */
i = 1;
nlist = &gname;
break;