summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 528cc91f..ee703754 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,7 +1,7 @@
/*
* util.c
*
- * Copyright (c) 2002-2005 by Judd Vinet <jvinet@zeroflux.org>
+ * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -433,7 +433,11 @@ int reg_match(char *string, char *pattern)
int result;
regex_t reg;
- regcomp(&reg, pattern, REG_EXTENDED | REG_NOSUB);
+ if (regcomp(&reg, pattern, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0)
+ {
+ fprintf(stderr, "error: %s is not a valid regular expression.\n", pattern);
+ exit(1);
+ }
result = regexec(&reg, string, 0, 0, 0);
regfree(&reg);
return(!(result));