Mercurial > ~mikael > mcabber > hg
diff mcabber/src/utils.c @ 1203:c96fef31ff96
Expand startswith()
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 28 Apr 2007 12:16:45 +0200 |
parents | 7b8765c10abb |
children | 2de8f8ba1f34 |
line wrap: on
line diff
--- a/mcabber/src/utils.c Fri Apr 27 23:46:15 2007 +0200 +++ b/mcabber/src/utils.c Sat Apr 28 12:16:45 2007 +0200 @@ -648,11 +648,13 @@ } #endif /* !HAVE_STRCASESTR */ -// startswith(str, word) +// startswith(str, word, ignore_case) // Returns TRUE if string str starts with word. -int startswith(const char *str, const char *word) +int startswith(const char *str, const char *word, guint ignore_case) { - if (!strncmp(str, word, strlen(word))) + if (ignore_case && !strncasecmp(str, word, strlen(word))) + return TRUE; + else if (!ignore_case && !strncmp(str, word, strlen(word))) return TRUE; return FALSE; }