Mercurial > ~mikael > mcabber > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
1202:ede6c7aa59b0 | 1203:c96fef31ff96 |
---|---|
646 } | 646 } |
647 return NULL; | 647 return NULL; |
648 } | 648 } |
649 #endif /* !HAVE_STRCASESTR */ | 649 #endif /* !HAVE_STRCASESTR */ |
650 | 650 |
651 // startswith(str, word) | 651 // startswith(str, word, ignore_case) |
652 // Returns TRUE if string str starts with word. | 652 // Returns TRUE if string str starts with word. |
653 int startswith(const char *str, const char *word) | 653 int startswith(const char *str, const char *word, guint ignore_case) |
654 { | 654 { |
655 if (!strncmp(str, word, strlen(word))) | 655 if (ignore_case && !strncasecmp(str, word, strlen(word))) |
656 return TRUE; | |
657 else if (!ignore_case && !strncmp(str, word, strlen(word))) | |
656 return TRUE; | 658 return TRUE; |
657 return FALSE; | 659 return FALSE; |
658 } | 660 } |
659 | 661 |
660 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ | 662 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ |