static void num_to_string (char* dst, size_t dstlen,
struct option_t* option) {
/* XXX puke */
- const char* fmt = (str_cmp (option->option, "umask") == 0) ?
+ const char* fmt = (str_cmp (option->option, "umask") == 0) ?
"%s=%04o" : "%s=%d";
snprintf (dst, dstlen, fmt, option->option,
*((short*) option->data));
* if name starts with $folder, just strip it to keep hierarchy
* $folder=imap://host, path=imap://host/inbox/b -> inbox/b
*/
- if (Maildirlength > 0 && str_ncmp (CurrentFolder, Maildir,
- Maildirlength) == 0 &&
+ if (Maildirlength > 0 && str_ncmp (CurrentFolder, Maildir,
+ Maildirlength) == 0 &&
str_len (CurrentFolder) > Maildirlength) {
val = CurrentFolder + Maildirlength;
if (Maildir[strlen(Maildir)-1]!='/')
static void sort_to_string (char* dst, size_t dstlen,
struct option_t* option) {
const struct mapping_t *map = get_sortmap (option);
- char* p = NULL;
+ const char *p = NULL;
if (!map) {
snprintf (dst, sizeof (dst), "%s=unknown", option->option);
return;
}
- p = mutt_getnamebyvalue (*((short *) option->data) & SORT_MASK,
- map);
+ p = mutt_getnamebyvalue(*((short *)option->data) & SORT_MASK, map);
snprintf (dst, dstlen, "%s=%s%s%s", option->option,
(*((short *) option->data) & SORT_REVERSE) ?
if (!buf->data || *buf->data == '\0')
continue;
-
+
a = mem_malloc(sizeof(ATTACH_MATCH));
-
+
/* some cheap hacks that I expect to remove */
if (!str_casecmp(buf->data, "any"))
a->major = str_dup("*/.*");
a->major = str_dup("cheap_hack/this_should_never_match");
else
a->major = str_dup(buf->data);
-
+
if ((p = strchr(a->major, '/'))) {
*p = '\0';
++p;
tmpminor[0] = '^';
tmpminor[len+1] = '$';
tmpminor[len+2] = '\0';
-
+
a->major_int = mutt_check_mime_type(a->major);
regcomp(&a->minor_rx, tmpminor, REG_ICASE|REG_EXTENDED);
-
+
mem_free (&tmpminor);
debug_print (5, ("parse_attach_list: added %s/%s [%d]\n",
do {
mutt_extract_token (buf, s, 0);
-
+
if (!str_casecmp(buf->data, "any"))
tmp = str_dup("*/.*");
else if (!str_casecmp(buf->data, "none"))
tmp = str_dup("cheap_hack/this_should_never_match");
else
tmp = str_dup(buf->data);
-
+
if ((minor = strchr(tmp, '/'))) {
*minor = '\0';
++minor;
minor = "unknown";
}
major = mutt_check_mime_type(tmp);
-
+
/* We must do our own walk here because remove_from_list() will only
* remove the LIST->data, not anything pointed to by the LIST->data. */
lastp = NULL;
a->major, a->minor, a->major_int));
regfree(&a->minor_rx);
mem_free(&a->major);
-
+
/* Relink backward */
if (lastp)
lastp->next = lp->next;
else
*ldata = lp->next;
-
+
newlp = lp->next;
mem_free(&lp->data); /* same as a */
mem_free(&lp);
lp = newlp;
continue;
}
-
+
lastp = lp;
lp = lp->next;
}
}
while (MoreArgs (s));
-
+
mem_free (&tmp);
_attachments_clean();
return 0;
((ATTACH_MATCH *)lp->data)->minor);
lp = lp->next;
}
-
+
return 0;
}
static int parse_attachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) {
char op, *category;
LIST **listp;
-
+
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
strfcpy(err->data, _("attachments: no disposition"), err->dsize);
return -1;
}
-
+
category = buf->data;
op = *category++;
-
+
if (op == '?') {
mutt_endwin (NULL);
fflush (stdout);
strfcpy(err->data, _("attachments: invalid disposition"), err->dsize);
return -1;
}
-
+
return parse_attach_list(buf, s, listp, err);
}
static int parse_unattachments (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) {
char op, *p;
LIST **listp;
-
+
mutt_extract_token(buf, s, 0);
if (!buf->data || *buf->data == '\0') {
strfcpy(err->data, _("unattachments: no disposition"), err->dsize);
return -1;
}
-
+
p = buf->data;
op = *p++;
if (op != '+' && op != '-') {
strfcpy(err->data, _("unattachments: invalid disposition"), err->dsize);
return -1;
}
-
+
return parse_unattach_list(buf, s, listp, err);
}
mutt_extract_token (tmp, s, M_TOKEN_EQUAL);
/* resolve synonyms */
- if ((option = hash_find (ConfigOptions, tmp->data)) != NULL &&
+ if ((option = hash_find (ConfigOptions, tmp->data)) != NULL &&
DTYPE (option->type == DT_SYN)) {
struct option_t* newopt = hash_find (ConfigOptions, (char*) option->data);
syn_add (newopt, option);
#define NUMVARS (sizeof (MuttVars)/sizeof (MuttVars[0]))
#define NUMCOMMANDS (sizeof (Commands)/sizeof (Commands[0]))
-/* initial string that starts completion. No telling how much crap
+/* initial string that starts completion. No telling how much crap
* the user has typed so far. Allocate LONG_STRING just to be sure! */
char User_typed[LONG_STRING] = { 0 };
int Num_matched = 0; /* Number of matches for completion */
char Completed[STRING] = { 0 }; /* completed string (command or variable) */
-char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */
+const char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1]; /* all the matches + User_typed */
/* helper function for completion. Changes the dest buffer if
necessary/possible to aid completion.
snprintf (tmp, sizeof (tmp), "%d", (*((short *) option->data)));
else if (DTYPE (option->type) == DT_SORT) {
const struct mapping_t *map;
- char *p;
+ const char *p;
switch (option->type & DT_SUBTYPE_MASK) {
case DT_SORT_ALIAS:
map = SortMethods;
break;
}
- p =
- mutt_getnamebyvalue (*((short *) option->data) & SORT_MASK,
- map);
- snprintf (tmp, sizeof (tmp), "%s%s%s",
- (*((short *) option->data) & SORT_REVERSE) ?
- "reverse-" : "",
- (*((short *) option->data) & SORT_LAST) ? "last-" :
- "", p);
- }
+ p = mutt_getnamebyvalue(*((short *) option->data) & SORT_MASK, map);
+ snprintf(tmp, sizeof (tmp), "%s%s%s",
+ (*((short *)option->data) & SORT_REVERSE) ? "reverse-" : "",
+ (*((short *)option->data) & SORT_LAST) ? "last-" : "", p);
+ }
else if (DTYPE (option->type) == DT_MAGIC) {
const char *p;
switch (DefaultMagic) {
err.data = error;
err.dsize = sizeof (error);
- /* use 3*sizeof(muttvars) instead of 2*sizeof()
+ /* use 3*sizeof(muttvars) instead of 2*sizeof()
* to have some room for $user_ vars */
ConfigOptions = hash_create (sizeof (MuttVars) * 3);
for (i = 0; MuttVars[i].option; i++) {
DT_SYS, 0), 0);
}
- /*
+ /*
* XXX - use something even more difficult to predict?
*/
snprintf (AttachmentMarker, sizeof (AttachmentMarker),
if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r"))) {
buffer[0] = '\0';
fgets (buffer, sizeof (buffer), f);
- p = (char*)&buffer;
+ p = buffer;
SKIPWS (p);
- q = p;
+ q = (char*)p;
while (*q && !isspace(*q))
q++;
*q = '\0';
/*
- *
+ *
* BIG FAT WARNING
- *
+ *
* When changing the code which looks for a configuration file,
* please also change the corresponding code in muttbug.sh.in.
- *
- *
+ *
+ *
*/