1 /* $OSSEC, os_regex_str.c, v0.1, 2005/12/29, Daniel B. Cid$ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 2) as published by the FSF - Free Software
16 #include "os_regex_internal.h"
19 /** int OS_StrIsNum(char *str) v0.1
20 * Checks if a specific string is numeric (like "129544")
22 int OS_StrIsNum(char *str)
30 return(FALSE); /* 0 */
38 /** int OS_StrHowClosedMatch(char *str1, char *str2) v0.1
39 * Returns the number of characters that both strings
42 int OS_StrHowClosedMatch(char *str1, char *str2)
46 /* They don't match if any of them is null */
54 if(str1[count] != str2[count])
60 }while((str1[count] != '\0') && (str2[count] != '\0'));
67 /** int OS_StrStartsWith(char *str, char *pattern) v0.1
68 * Verifies if a string starts with the provided pattern.
69 * Returns 1 on success or 0 on failure.
71 #define startswith(x,y) (strncmp(x,y,strlen(y)) == 0?1:0)
72 #define OS_StrStartsWith startswith