X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lib%2Fstr.h;h=f9ef19f1c6382eb914da7e1ab46b01d4dde4c96d;hp=86fd7584a5d87f6a1a7d1112e9cefda51af3af48;hb=6d838d9aef36d95fa439b3f7cc06d4e81c8581bd;hpb=6729a8ab646a00a661858b7ac7ee21f770bff3d3 diff --git a/lib-lib/str.h b/lib-lib/str.h index 86fd758..f9ef19f 100644 --- a/lib-lib/str.h +++ b/lib-lib/str.h @@ -218,6 +218,28 @@ ssize_t m_strwidth(const char *s); * \return 1 if a match is found, 0 otherwise. */ static inline int m_strstart(const char *s, const char *p, const char **pp) +{ + if (!s) + return 0; + + while (*p) { + if (ascii_tolower(*s++) != ascii_tolower(*p++)) + return 0; + } + if (pp) + *pp = s; + return 1; +} + +/** \brief Tells whether s begins with p, case insensitive. + * + * \param[in] s the input string + * \param[in] p the prefix + * \param[out] pp position in s + * + * \return 1 if a match is found, 0 otherwise. + */ +static inline int m_strcasestart(const char *s, const char *p, const char **pp) { if (!s) return 0; @@ -400,8 +422,7 @@ typedef enum { M_FORMAT_MAKEPRINT = (1 << 2), /* make sure that all chars are printable */ M_FORMAT_OPTIONAL = (1 << 3), M_FORMAT_STAT_FILE = (1 << 4), /* used by mutt_attach_fmt */ - M_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */ - M_FORMAT_INDEX = (1 << 6) /* this is a main index entry */ + M_FORMAT_INDEX = (1 << 6), /* this is a main index entry */ } format_flag; typedef const char *