71 const char *type,
struct Buffer *command)
76 struct Buffer *param = NULL;
77 struct Buffer *type2 = NULL;
89 else if (*cptr ==
'%')
94 const char *pvalue2 = NULL;
103 while (*cptr && (*cptr !=
'}'))
115 if (c_mailcap_sanitize)
123 else if ((*cptr ==
's') && filename)
129 else if (*cptr ==
't')
134 if (c_mailcap_sanitize)
174 while ((ch = strpbrk(s,
";\\")))
204 const char *filename,
int line)
219 mutt_error(
_(
"Improperly formatted entry for type %s in \"%s\" line %d"),
220 type, filename, line);
253 char *ch = strchr(type,
'/');
256 const int btlen = ch - type;
272 ((buf[btlen] !=
'\0') &&
286 bool copiousoutput =
false;
287 bool composecommand =
false;
288 bool editcommand =
false;
289 bool printcommand =
false;
305 copiousoutput =
true;
313 type, filename, line))
315 composecommand =
true;
321 type, filename, line))
323 composecommand =
true;
329 type, filename, line))
337 type, filename, line))
345 type, filename, line);
355 char *test_command = NULL;
357 if (
get_field_text(field + plen, &test_command, type, filename, line) && test_command)
363 if (c_mailcap_sanitize)
493 if (!c_mailcap_path || (c_mailcap_path->
count == 0))
508 mutt_error(
_(
"Neither mailcap_path nor MAILCAPS specified"));
532 mutt_error(
_(
"mailcap entry for type %s not found"), type);
558 bool lmatch =
false, rmatch =
false;
564 if (nametemplate && (s = strrchr(nametemplate,
'/')))
565 nametemplate = s + 1;
567 if (oldfile && (s = strrchr(oldfile,
'/')))
586 for (i = 0; nametemplate[i]; i++)
588 if ((nametemplate[i] ==
'%') && (nametemplate[i + 1] ==
's'))
596 if (lmatch && (nametemplate[i] != oldfile[i]))
619 (j >= (lmatch ? i : 0)) && (k >= (i + 2)); j--, k--)
621 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.
Representation of the body of 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.
#define FREE(x)
Free memory and set the pointer to NULL.
#define MUTT_MEM_CALLOC(n, type)
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.
Many unsorted constants and some structs.
int mutt_system(const char *cmd)
Run an external command.
void mutt_check_lookup_list(struct Body *b, char *type, size_t len)
Update the mime type.
void expand_path(struct Buffer *buf, bool regex)
Create the canonical path.
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.
Some miscellaneous functions.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
Store attributes associated with a MIME part.
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.
#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.
char * composecommand
Compose command.
bool needsterminal
endwin() and system
char * testcommand
Test command.
char * nametemplate
Filename template.
char * printcommand
Print command.
char * composetypecommand
Compose type command.
char * editcommand
Edit command.
char * command
Command to run.
bool copiousoutput
needs pager, basically
bool xneomuttkeep
do not remove the file on command exit
char * convert
Conversion command.
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.