X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_regex%2Fos_regex_str.c;h=dbf73e57b834f2c5e50a34381a7a7c0d124a36c5;hp=cf2342362a69f5995421c1abf81d814d4261ae1b;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b diff --git a/src/os_regex/os_regex_str.c b/src/os_regex/os_regex_str.c old mode 100755 new mode 100644 index cf23423..dbf73e5 --- a/src/os_regex/os_regex_str.c +++ b/src/os_regex/os_regex_str.c @@ -1,5 +1,3 @@ -/* $OSSEC, os_regex_str.c, v0.1, 2005/12/29, Daniel B. Cid$ */ - /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. * @@ -9,7 +7,6 @@ * Foundation */ - #include #include #include @@ -18,51 +15,41 @@ #include "os_regex_internal.h" -/** int OS_StrIsNum(char *str) v0.1 - * Checks if a specific string is numeric (like "129544") - */ +/* Check if a specific string is numeric (like "129544") */ int OS_StrIsNum(const char *str) { - if(str == NULL) - return(FALSE); + if (str == NULL) { + return (FALSE); + } - while(*str != '\0') - { - if(!_IsD(*str)) - return(FALSE); /* 0 */ + while (*str != '\0') { + if (!_IsD(*str)) { + return (FALSE); + } str++; } - return(TRUE); + return (TRUE); } - -/** int OS_StrHowClosedMatch(char *str1, char *str2) v0.1 - * Returns the number of characters that both strings - * have in similar. - */ +/* Return the number of characters that both strings have in common */ size_t OS_StrHowClosedMatch(const char *str1, const char *str2) { size_t count = 0; /* They don't match if any of them is null */ - if(!str1 || !str2) - { - return(0); + if (!str1 || !str2) { + return (0); } - do - { - if(str1[count] != str2[count]) - { + do { + if (str1[count] != str2[count]) { break; } count++; - }while((str1[count] != '\0') && (str2[count] != '\0')); + } while ((str1[count] != '\0') && (str2[count] != '\0')); - return(count); + return (count); } - -/* EOF */