diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-24 20:16:53 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-24 20:16:53 +0300 |
commit | 1cd34f5283bcf1d4973a351dc5235094608e3d2d (patch) | |
tree | 2d6185294cfea7c3c062c8d2123df96f5e02e1b0 /src/fstring.c | |
parent | 606128de4cb33a2727d6609df46ecf0c72006a73 (diff) | |
download | rspamd-1cd34f5283bcf1d4973a351dc5235094608e3d2d.tar.gz rspamd-1cd34f5283bcf1d4973a351dc5235094608e3d2d.zip |
* Add initial LMTP support and LDA delivery to rspamd
Diffstat (limited to 'src/fstring.c')
-rw-r--r-- | src/fstring.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/fstring.c b/src/fstring.c index 75be14442..82d0b095e 100644 --- a/src/fstring.c +++ b/src/fstring.c @@ -92,6 +92,37 @@ fstrstr (f_str_t *orig, f_str_t *pattern) } /* + * Search for pattern in orig ignoring case + */ +ssize_t +fstrstri (f_str_t *orig, f_str_t *pattern) +{ + register ssize_t cur = 0, pcur = 0; + + if (pattern->len > orig->len) { + return -1; + } + + while (cur < orig->len) { + if (tolower (*(orig->begin + cur)) == tolower (*pattern->begin)) { + while (cur < orig->len && pcur < pattern->len) { + if (tolower (*(orig->begin + cur)) != tolower (*(pattern->begin + pcur))) { + pcur = 0; + break; + } + cur ++; + pcur ++; + } + return cur - pattern->len; + } + cur ++; + } + + return -1; + +} + +/* * Split string by tokens * word contains parsed word * |