op = '+';
category--;
}
- if (mutt_str_strncasecmp(category, "attachment", strlen(category)) == 0)
+ if (mutt_str_startswith("attachment", category, CASE_IGNORE))
{
if (op == '+')
head = &AttachAllow;
else
head = &AttachExclude;
}
- else if (mutt_str_strncasecmp(category, "inline", strlen(category)) == 0)
+ else if (mutt_str_startswith("inline", category, CASE_IGNORE))
{
if (op == '+')
head = &InlineAllow;
query = true;
s->dptr++;
}
- else if (mutt_str_strncmp("no", s->dptr, 2) == 0)
+ else if (mutt_str_startswith(s->dptr, "no", CASE_MATCH))
{
prefix = true;
unset = !unset;
s->dptr += 2;
}
- else if (mutt_str_strncmp("inv", s->dptr, 3) == 0)
+ else if (mutt_str_startswith(s->dptr, "inv", CASE_MATCH))
{
prefix = true;
inv = !inv;
bool equals = false;
struct HashElem *he = NULL;
- bool my = (mutt_str_strncmp("my_", buf->data, 3) == 0);
+ bool my = mutt_str_startswith(buf->data, "my_", CASE_MATCH);
if (!my)
{
he = cs_get_elem(Config, buf->data);
/* get variable name */
mutt_extract_token(buf, s, MUTT_TOKEN_EQUAL);
- int len = strlen(buf->data);
if (query)
{
while (envp && *envp)
{
/* This will display all matches for "^QUERY" */
- if (mutt_str_strncmp(buf->data, *envp, len) == 0)
+ if (mutt_str_startswith(*envp, buf->data, CASE_MATCH))
{
if (!found)
{
op = '+';
p--;
}
- if (mutt_str_strncasecmp(p, "attachment", strlen(p)) == 0)
+ if (mutt_str_startswith("attachment", p, CASE_IGNORE))
{
if (op == '+')
head = &AttachAllow;
else
head = &AttachExclude;
}
- else if (mutt_str_strncasecmp(p, "inline", strlen(p)) == 0)
+ else if (mutt_str_startswith("inline", p, CASE_IGNORE))
{
if (op == '+')
head = &InlineAllow;
/* return the completed command */
strncpy(buf, Completed, buflen - spaces);
}
- else if ((mutt_str_strncmp(buf, "set", 3) == 0) ||
- (mutt_str_strncmp(buf, "unset", 5) == 0) ||
- (mutt_str_strncmp(buf, "reset", 5) == 0) ||
- (mutt_str_strncmp(buf, "toggle", 6) == 0))
+ else if (mutt_str_startswith(buf, "set", CASE_MATCH) ||
+ mutt_str_startswith(buf, "unset", CASE_MATCH) ||
+ mutt_str_startswith(buf, "reset", CASE_MATCH) ||
+ mutt_str_startswith(buf, "toggle", CASE_MATCH))
{ /* complete variables */
static const char *const prefixes[] = { "no", "inv", "?", "&", 0 };
pt++;
/* loop through all the possible prefixes (no, inv, ...) */
- if (mutt_str_strncmp(buf, "set", 3) == 0)
+ if (mutt_str_startswith(buf, "set", CASE_MATCH))
{
for (num = 0; prefixes[num]; num++)
{
- if (mutt_str_strncmp(pt, prefixes[num], mutt_str_strlen(prefixes[num])) == 0)
+ if (mutt_str_startswith(pt, prefixes[num], CASE_MATCH))
{
pt += mutt_str_strlen(prefixes[num]);
break;
strncpy(pt, Completed, buf + buflen - pt - spaces);
}
- else if (mutt_str_strncmp(buf, "exec", 4) == 0)
+ else if (mutt_str_startswith(buf, "exec", CASE_MATCH))
{
const struct Binding *menu = km_get_table(CurrentMenu);
if (*pt == '=') /* abort if no var before the '=' */
return 0;
- if (mutt_str_strncmp(buf, "set", 3) == 0)
+ if (mutt_str_startswith(buf, "set", CASE_MATCH))
{
const char *myvarval = NULL;
char var[STRING];