68 const char *type,
struct Buffer *command)
73 struct Buffer *param = NULL;
74 struct Buffer *type2 = NULL;
86 else if (*cptr ==
'%')
91 const char *pvalue2 = NULL;
100 while (*cptr && (*cptr !=
'}'))
112 if (c_mailcap_sanitize)
120 else if ((*cptr ==
's') && filename)
126 else if (*cptr ==
't')
131 if (c_mailcap_sanitize)
169 while ((ch = strpbrk(s,
";\\")))
199 const char *filename,
int line)
214 mutt_error(
_(
"Improperly formatted entry for type %s in \"%s\" line %d"),
215 type, filename, line);
248 char *ch = strchr(type,
'/');
251 const int btlen = ch - type;
253 FILE *fp = fopen(filename,
"r");
267 ((buf[btlen] !=
'\0') &&
281 bool copiousoutput =
false;
282 bool composecommand =
false;
283 bool editcommand =
false;
284 bool printcommand =
false;
300 copiousoutput =
true;
308 type, filename, line))
310 composecommand =
true;
316 type, filename, line))
318 composecommand =
true;
324 type, filename, line))
332 type, filename, line))
340 type, filename, line);
350 char *test_command = NULL;
352 if (
get_field_text(field +
plen, &test_command, type, filename, line) && test_command)
358 if (c_mailcap_sanitize)
482 if (!c_mailcap_path || (c_mailcap_path->
count == 0))
497 mutt_error(
_(
"Neither mailcap_path nor MAILCAPS specified"));
521 mutt_error(
_(
"mailcap entry for type %s not found"), type);
547 bool lmatch =
false, rmatch =
false;
553 if (nametemplate && (s = strrchr(nametemplate,
'/')))
554 nametemplate = s + 1;
556 if (oldfile && (s = strrchr(oldfile,
'/')))
575 for (i = 0; nametemplate[i]; i++)
577 if ((nametemplate[i] ==
'%') && (nametemplate[i + 1] ==
's'))
585 if (lmatch && (nametemplate[i] != oldfile[i]))
608 (j >= (lmatch ? i : 0)) && (k >= (i + 2)); j--, k--)
610 if (nametemplate[k] != oldfile[j])
GUI display the mailboxes in a side panel.
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
size_t mutt_buffer_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
static const char * mutt_buffer_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.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
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_buffer_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
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_debug(LEVEL,...)
@ LL_DEBUG2
Log at debug level 2.
struct MailcapEntry * mailcap_entry_new(void)
Allocate memory for a new rfc1524 entry.
bool mailcap_lookup(struct Body *a, char *type, size_t typelen, struct MailcapEntry *entry, enum MailcapLookup opt)
Find given type in the list of mailcap files.
void mailcap_entry_free(struct MailcapEntry **ptr)
Deallocate an struct MailcapEntry.
static bool rfc1524_mailcap_parse(struct Body *a, const char *filename, const char *type, struct MailcapEntry *entry, enum MailcapLookup opt)
Parse a mailcap entry.
static int get_field_text(char *field, char **entry, const char *type, const char *filename, int line)
Get the matching text from a mailcap.
int mailcap_expand_command(struct Body *a, 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 char * get_field(char *s)
NUL terminate a RFC1524 field.
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.
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.
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
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.
void mutt_check_lookup_list(struct Body *b, char *type, size_t len)
Update the mime type.
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
void mutt_buffer_sanitize_filename(struct Buffer *buf, const char *path, short slash)
Replace unsafe characters in a filename.
Some miscellaneous functions.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
static size_t plen
Length of cached packet.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from 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.