X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fshared%2Fregex_op.c;h=fe273816e050a88ba6500dc4fc4384114abc8abb;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=7478c317d29248832e39559c6ccbd53b64974bb2;hpb=301048b51990573e58a30dc4a5bb4ec285cad554;p=ossec-hids.git diff --git a/src/shared/regex_op.c b/src/shared/regex_op.c old mode 100755 new mode 100644 index 7478c31..fe27381 --- a/src/shared/regex_op.c +++ b/src/shared/regex_op.c @@ -1,5 +1,3 @@ -/* @(#) $Id$ */ - /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. * @@ -9,43 +7,37 @@ * Foundation */ - #ifndef WIN32 -#include "shared.h" #include +#include "shared.h" -/* OS_PRegex: - * Compile a posix regex, returning NULL on error - * Returns 1 if matches, 0 if not. +/* Compile a POSIX regex, returning NULL on error + * Returns 1 if matches, 0 if not */ -int OS_PRegex(char *str, char *regex) +int OS_PRegex(const char *str, const char *regex) { regex_t preg; - - if(!str || !regex) - return(0); - - - if(regcomp(&preg, regex, REG_EXTENDED|REG_NOSUB) != 0) - { + + if (!str || !regex) { + return (0); + } + + if (regcomp(&preg, regex, REG_EXTENDED | REG_NOSUB) != 0) { merror("%s: Posix Regex compile error (%s).", __local_name, regex); - return(0); + return (0); } - if(regexec(&preg, str, strlen(str), NULL, 0) != 0) - { + if (regexec(&preg, str, strlen(str), NULL, 0) != 0) { /* Didn't match */ regfree(&preg); - return(0); + return (0); } regfree(&preg); - return(1); - -} + return (1); -#endif +} -/* EOF */ +#endif /* !WIN32 */