X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib%2Fstr.c;fp=lib%2Fstr.c;h=0000000000000000000000000000000000000000;hb=93b012884de4ca5e1f2550f767d0b8680b9c0e9f;hp=3d3f10e7d02003c981eb9b44f928415c770ee7a7;hpb=3c3c535e5ed1d651c6024b5acf670e217af473f7;p=apps%2Fmadmutt.git diff --git a/lib/str.c b/lib/str.c deleted file mode 100644 index 3d3f10e..0000000 --- a/lib/str.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright notice from original mutt: - * Copyright (C) 1996-2000 Michael R. Elkins - * Copyright (C) 1999-2000 Thomas Roessler - * - * This file is part of mutt-ng, see http://www.muttng.org/. - * It's licensed under the GNU General Public License, - * please see the file GPL in the top level source directory. - */ - -#include -#include -#include - -#include -#include - -#include "str.h" - -/* convert all characters in the string to lowercase */ -char *str_tolower (char *s) -{ - char *p = s; - - while (*p) { - *p = tolower ((unsigned char) *p); - p++; - } - - return (s); -} - -/* NULL-pointer aware string comparison functions */ - -char *str_substrcpy (char *dest, const char *beg, const char *end, - size_t destlen) -{ - size_t len; - - len = end - beg; - if (len > destlen - 1) - len = destlen - 1; - memcpy (dest, beg, len); - dest[len] = 0; - return dest; -} - -char *str_substrdup(const char *begin, const char *end) -{ - return p_dupstr(begin, (end ? end - begin : strlen(begin))); -} - -const char *str_isstr (const char *haystack, const char *needle) -{ - const char *p, *q; - - if (!haystack) - return NULL; - if (!needle) - return (haystack); - - while (*(p = haystack)) { - for (q = needle; - *p && *q && - tolower ((unsigned char) *p) == tolower ((unsigned char) *q); - p++, q++); - if (!*q) - return (haystack); - haystack++; - } - return NULL; -} - -int str_eq (const char* s1, const char* s2) { - int l = m_strlen(s1); - - if (l != m_strlen(s2)) - return (0); - return (m_strncmp(s1, s2, l) == 0); -} - -void str_skip_trailws (char *s) { - char *p; - - for (p = s + m_strlen(s) - 1; p >= s && ISSPACE (*p); p--) - *p = 0; -}