Skip to content

Commit

Permalink
g.mlist: fatal error on bad pattern
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60570 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
HuidaeCho committed May 29, 2014
1 parent af8605c commit 1fa23fd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion general/g.mlist/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char *argv[])
struct Flag *full;
} flag;
int i, n, all, num_types, nlist;
void *filter = NULL, *exclude = NULL;
void *filter, *exclude;
FILE *fp;
const char *mapset;
char *separator;
Expand Down Expand Up @@ -159,15 +159,25 @@ int main(int argc, char *argv[])
(int)flag.extended->answer);
else
filter = G_ls_glob_filter(opt.pattern->answer, 0);
if (!filter)
G_fatal_error(_("Unable to compile pattern <%s>"),
opt.pattern->answer);
}
else
filter = NULL;

if (opt.exclude->answer) {
if (flag.regex->answer || flag.extended->answer)
exclude = G_ls_regex_filter(opt.exclude->answer, 1,
(int)flag.extended->answer);
else
exclude = G_ls_glob_filter(opt.exclude->answer, 1);
if (!exclude)
G_fatal_error(_("Unable to compile pattern <%s>"),
opt.exclude->answer);
}
else
exclude = NULL;

separator = G_option_to_separator(opt.separator);
fp = G_open_option_file(opt.output);
Expand Down

0 comments on commit 1fa23fd

Please sign in to comment.