return -1;
}
mutt_str_strfcpy(exp_dirpart, tmp, sizeof(exp_dirpart));
- mutt_str_substr_cpy(dirpart, buf, p + 1, sizeof(dirpart));
+ mutt_str_substr_copy(buf, p + 1, dirpart, sizeof(dirpart));
mutt_str_strfcpy(filepart, p + 1, sizeof(filepart));
}
else
}
else
{
- mutt_str_substr_cpy(dirpart, buf, p, sizeof(dirpart));
+ mutt_str_substr_copy(buf, p, dirpart, sizeof(dirpart));
mutt_str_strfcpy(filepart, p + 1, sizeof(filepart));
mutt_str_strfcpy(exp_dirpart, dirpart, sizeof(exp_dirpart));
mutt_expand_path(exp_dirpart, sizeof(exp_dirpart));
if ((*end == '@') && (recurse < 20))
{
recurse++;
- mutt_str_substr_cpy(tmp, src, end, sizeof(tmp));
+ mutt_str_substr_copy(src, end, tmp, sizeof(tmp));
mutt_expando_format(tmp, sizeof(tmp), col, cols,
NONULL(mutt_idxfmt_hook(tmp, m, e)),
index_format_str, data, flags);
}
/**
- * mutt_str_substr_cpy - Copy a sub-string into a buffer
- * @param dest Buffer for the result
- * @param begin Start of the string to copy
- * @param end End of the string to copy
- * @param destlen Length of buffer
+ * mutt_str_substr_copy - Copy a sub-string into a buffer
+ * @param begin Start of the string to copy
+ * @param end End of the string to copy
+ * @param buf Buffer for the result
+ * @param buflen Length of buffer
* @retval ptr Destination buffer
*/
-char *mutt_str_substr_cpy(char *dest, const char *begin, const char *end, size_t destlen)
+char *mutt_str_substr_copy(const char *begin, const char *end, char *buf, size_t buflen)
{
- if (!dest || !begin || !end || (destlen == 0))
- return dest;
+ if (!begin || !end || !buf || (buflen == 0))
+ return buf;
size_t len = end - begin;
- if (len > (destlen - 1))
- len = destlen - 1;
- memcpy(dest, begin, len);
- dest[len] = '\0';
- return dest;
+ if (len > (buflen - 1))
+ len = buflen - 1;
+ memcpy(buf, begin, len);
+ buf[len] = '\0';
+ return buf;
}
/**
char * mutt_str_strncat(char *d, size_t l, const char *s, size_t sl);
int mutt_str_strncmp(const char *a, const char *b, size_t l);
size_t mutt_str_strnfcpy(char *dest, const char *src, size_t n, size_t dsize);
-char * mutt_str_substr_cpy(char *dest, const char *begin, const char *end, size_t destlen);
+char * mutt_str_substr_copy(const char *begin, const char *end, char *buf, size_t buflen);
char * mutt_str_substr_dup(const char *begin, const char *end);
const char *mutt_str_sysexit(int e);
int mutt_str_word_casecmp(const char *a, const char *b);
for (q = p; *q && !IS_SPACE(*q); q++)
;
- mutt_str_substr_cpy(subtype, p, q, sizeof(subtype));
+ mutt_str_substr_copy(p, q, subtype, sizeof(subtype));
type = mutt_check_mime_type(ct);
if (type == TYPE_OTHER)