Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwpl.git;a=commitdiff;h=a7487ebc0cf11953fe3f793cb877af0e9a6e1075
commit a7487ebc0cf11953fe3f793cb877af0e9a6e1075 Author: James Buren <[email protected]> Date: Thu Sep 17 16:51:01 2009 -0500 utility.c * new function diff --git a/src/utility.c b/src/utility.c index bff6d9b..ab263c7 100644 --- a/src/utility.c +++ b/src/utility.c @@ -2,6 +2,7 @@ #include <string.h> #include <stdio.h> #include <stdarg.h> +#include <regex.h> #include <iso646.h> #include <assert.h> #include "utility.h" @@ -51,6 +52,30 @@ char *xstrcmb(const char *str1,const char *str2) { return str; } +bool regmatch(const char *str,const char *pat) { + regex_t regex; + int flags; + bool ret; + + flags = REG_EXTENDED | REG_NOSUB; + + ret = true; + + if(regcomp(®ex,pat,flags)) { + ret = false; + goto Bail; + } + + if(regexec(®ex,str,0,NULL,0)) + ret = false; + + regfree(®ex); + + Bail: + + return ret; +} + int eprintf(const char *fmt,...) { va_list args; int ret; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
