1 /* GNU Mailutils -- a suite of utilities for electronic mail 2 Copyright (C) 2009-2021 Free Software Foundation, Inc. 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 3 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General 15 Public License along with this library. If not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _MAILUTILS_CSTR_H 19 #define _MAILUTILS_CSTR_H 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 # include <mailutils/types.h> 26 27 int mu_strlower (char *); 28 int mu_strupper (char *); 29 30 int mu_c_strcasecmp (const char *a, const char *b); 31 int mu_c_strncasecmp (const char *a, const char *b, size_t n); 32 char *mu_c_strcasestr (const char *haystack, const char *needle); 33 34 int mu_string_prefix (char const *str, char const *pfx); 35 int mu_string_suffix (char const *str, char const *sfx); 36 37 size_t mu_rtrim_class (char *str, int __class); 38 size_t mu_rtrim_cset (char *str, const char *cset); 39 size_t mu_ltrim_class (char *str, int __class); 40 size_t mu_ltrim_cset (char *str, const char *cset); 41 42 char *mu_str_skip_class (const char *str, int __class); 43 char *mu_str_skip_cset (const char *str, const char *cset); 44 45 char *mu_str_skip_class_comp (const char *str, int __class); 46 char *mu_str_skip_cset_comp (const char *str, const char *cset); 47 48 char *mu_str_stripws (char *string); 49 50 int mu_string_split (const char *string, char *delim, mu_list_t list); 51 52 size_t mu_str_count (char const *str, char const *chr, size_t *cnt); 53 size_t mu_mem_c_count (char const *str, int c, size_t len); 54 size_t mu_mem_8bit_count (char const *str, size_t len); 55 56 int mu_c_str_escape (char const *str, char const *chr, char const *xtab, 57 char **ret_str); 58 int mu_c_str_escape_trans (char const *str, char const *trans, char **ret_str); 59 60 int mu_c_str_unescape_inplace (char *str, char const *chr, char const *xtab); 61 int mu_c_str_unescape (char const *str, char const *chr, char const *xtab, 62 char **ret_str); 63 int mu_c_str_unescape_trans (char const *str, char const *trans, 64 char **ret_str); 65 66 67 int mu_version_string_parse (char const *verstr, int version[3], char **endp); 68 int mu_version_string_cmp (char const *a, char const *b, int ignoresuf, int *res); 69 70 int mu_str_expand (char **output, char const *input, mu_assoc_t assoc); 71 int mu_str_vexpand (char **output, char const *input, ...); 72 73 int mu_strtosize (char const *str, char **endp, size_t *ret_val); 74 75 #ifdef __cplusplus 76 } 77 #endif 78 79 #endif 80 81