(mu_string_unfold): New function.
Showing
2 changed files
with
18 additions
and
0 deletions
... | @@ -119,6 +119,7 @@ extern int mu_rfc2822_in_reply_to __P((message_t msg, char **pstr)); | ... | @@ -119,6 +119,7 @@ extern int mu_rfc2822_in_reply_to __P((message_t msg, char **pstr)); |
119 | /* Find NEEDLE in the HAYSTACK. Case insensitive comparison */ | 119 | /* Find NEEDLE in the HAYSTACK. Case insensitive comparison */ |
120 | extern char *mu_strcasestr __P((const char *haystack, const char *needle)); | 120 | extern char *mu_strcasestr __P((const char *haystack, const char *needle)); |
121 | 121 | ||
122 | extern int mu_string_unfold __P((char *text, size_t *plen)); | ||
122 | 123 | ||
123 | #ifdef __cplusplus | 124 | #ifdef __cplusplus |
124 | } | 125 | } | ... | ... |
... | @@ -1097,3 +1097,20 @@ ret0: | ... | @@ -1097,3 +1097,20 @@ ret0: |
1097 | 1097 | ||
1098 | #undef U | 1098 | #undef U |
1099 | } | 1099 | } |
1100 | |||
1101 | int | ||
1102 | mu_string_unfold (char *text, size_t *plen) | ||
1103 | { | ||
1104 | char *p, *q; | ||
1105 | |||
1106 | if (!text) | ||
1107 | return EINVAL; | ||
1108 | |||
1109 | for (p = q = text; *q; q++) | ||
1110 | if (*q != '\n') | ||
1111 | *p++ = *q; | ||
1112 | *p++ = 0; | ||
1113 | if (plen) | ||
1114 | *plen = p - text; | ||
1115 | return 0; | ||
1116 | } | ... | ... |
-
Please register or sign in to post a comment