70 const char *type,
struct Buffer *command)
75 struct Buffer *param = NULL;
76 struct Buffer *type2 = NULL;
88 else if (*cptr ==
'%')
93 const char *pvalue2 = NULL;
102 while (*cptr && (*cptr !=
'}'))
114 if (c_mailcap_sanitize)
122 else if ((*cptr ==
's') && filename)
128 else if (*cptr ==
't')
133 if (c_mailcap_sanitize)
173 while ((ch = strpbrk(s,
";\\")))
203 const char *filename,
int line)
218 mutt_error(
_(
"Improperly formatted entry for type %s in \"%s\" line %d"),
219 type, filename, line);
252 char *ch = strchr(type,
'/');
255 const int btlen = ch - type;
271 ((buf[btlen] !=
'\0') &&
285 bool copiousoutput =
false;
286 bool composecommand =
false;
287 bool editcommand =
false;
288 bool printcommand =
false;
304 copiousoutput =
true;
312 type, filename, line))
314 composecommand =
true;
320 type, filename, line))
322 composecommand =
true;
328 type, filename, line))
336 type, filename, line))
344 type, filename, line);
354 char *test_command = NULL;
356 if (
get_field_text(field + plen, &test_command, type, filename, line) && test_command)
362 if (c_mailcap_sanitize)
492 if (!c_mailcap_path || (c_mailcap_path->
count == 0))
507 mutt_error(
_(
"Neither mailcap_path nor MAILCAPS specified"));
531 mutt_error(
_(
"mailcap entry for type %s not found"), type);
557 bool lmatch =
false, rmatch =
false;
563 if (nametemplate && (s = strrchr(nametemplate,
'/')))
564 nametemplate = s + 1;
566 if (oldfile && (s = strrchr(oldfile,
'/')))
585 for (i = 0; nametemplate[i]; i++)
587 if ((nametemplate[i] ==
'%') && (nametemplate[i + 1] ==
's'))
595 if (lmatch && (nametemplate[i] != oldfile[i]))
618 (j >= (lmatch ? i : 0)) && (k >= (i + 2)); j--, k--)
620 if (nametemplate[k] != oldfile[j])
GUI display the mailboxes in a side panel.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
size_t buf_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const struct Slist * cs_subset_slist(const struct ConfigSubset *sub, const char *name)
Get a string-list config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
Structs that make up an email.
void buf_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
void mutt_file_expand_fmt(struct Buffer *dest, const char *fmt, const char *src)
Replace s in a string with a filename.
#define MUTT_RL_CONT
-continuation
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
#define mutt_debug(LEVEL,...)
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
void mailcap_entry_free(struct MailcapEntry **ptr)
Deallocate an struct MailcapEntry.
static int get_field_text(char *field, char **entry, const char *type, const char *filename, int line)
Get the matching text from a mailcap.
struct MailcapEntry * mailcap_entry_new(void)
Allocate memory for a new rfc1524 entry.
static char * get_field(char *s)
NUL terminate a RFC1524 field.
int mailcap_expand_command(struct Body *b, const char *filename, const char *type, struct Buffer *command)
Expand expandos in a command.
void mailcap_expand_filename(const char *nametemplate, const char *oldfile, struct Buffer *newfile)
Expand a new filename from a template or existing filename.
static bool rfc1524_mailcap_parse(struct Body *b, const char *filename, const char *type, struct MailcapEntry *entry, enum MailcapLookup opt)
Parse a mailcap entry.
bool mailcap_lookup(struct Body *b, char *type, size_t typelen, struct MailcapEntry *entry, enum MailcapLookup opt)
Find given type in the list of mailcap files.
RFC1524 Mailcap routines.
MailcapLookup
Mailcap actions.
@ MUTT_MC_PRINT
Mailcap print field.
@ MUTT_MC_EDIT
Mailcap edit field.
@ MUTT_MC_AUTOVIEW
Mailcap autoview field.
@ MUTT_MC_COMPOSE
Mailcap compose field.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Convenience wrapper for the library headers.
void mutt_str_remove_trailing_ws(char *s)
Trim trailing whitespace from a string.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
char * mutt_str_skip_whitespace(const char *p)
Find the first non-whitespace character in a string.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
void mutt_check_lookup_list(struct Body *b, char *type, size_t len)
Update the mime type.
void buf_sanitize_filename(struct Buffer *buf, const char *path, short slash)
Replace unsafe characters in a filename.
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Some miscellaneous functions.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Prototypes for many functions.
int mutt_system(const char *cmd)
Run an external command.
#define STAILQ_FOREACH(var, head, field)
bool noconv
Don't do character set conversion.
char * charset
Send mode: charset of attached file as stored on disk.
struct ParameterList parameter
Parameters of the content-type.
bool nowrap
Do not wrap the output in the pager.
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
bool needsterminal
endwin() and system
char * composetypecommand
bool copiousoutput
needs pager, basically
bool xneomuttkeep
do not remove the file on command exit
bool xneomuttnowrap
do not wrap the output in the pager
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
struct ListHead head
List containing values.
size_t count
Number of values in list.