NeoMutt  2018-07-16 +952-a2da0a
Teaching an old dog new tricks
DOXYGEN
rfc1524.c File Reference

RFC1524 Mailcap routines. More...

#include "config.h"
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "mutt/mutt.h"
#include "email/lib.h"
#include "mutt.h"
#include "rfc1524.h"
#include "globals.h"
#include "mutt_attach.h"
#include "muttlib.h"
#include "protos.h"
+ Include dependency graph for rfc1524.c:

Go to the source code of this file.

Functions

int rfc1524_expand_command (struct Body *a, char *filename, char *type, char *command, int clen)
 Expand expandos in a command. More...
 
static char * get_field (char *s)
 NUL terminate a RFC1524 field. More...
 
static int get_field_text (char *field, char **entry, char *type, char *filename, int line)
 Get the matching text from a mailcap. More...
 
static int rfc1524_mailcap_parse (struct Body *a, char *filename, char *type, struct Rfc1524MailcapEntry *entry, int opt)
 Parse a mailcap entry. More...
 
struct Rfc1524MailcapEntryrfc1524_new_entry (void)
 Allocate memory for a new rfc1524 entry. More...
 
void rfc1524_free_entry (struct Rfc1524MailcapEntry **entry)
 Deallocate an struct Rfc1524MailcapEntry. More...
 
int rfc1524_mailcap_lookup (struct Body *a, char *type, struct Rfc1524MailcapEntry *entry, int opt)
 Find given type in the list of mailcap files. More...
 
int rfc1524_expand_filename (char *nametemplate, char *oldfile, char *newfile, size_t nflen)
 Expand a new filename from a template or existing filename. More...
 

Variables

bool MailcapSanitize
 Config: Restrict the possible characters in mailcap expandos. More...
 

Detailed Description

RFC1524 Mailcap routines.

Authors
  • Michael R. Elkins

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file rfc1524.c.

Function Documentation

int rfc1524_expand_command ( struct Body a,
char *  filename,
char *  type,
char *  command,
int  clen 
)

Expand expandos in a command.

Parameters
aEmail Body
filenameFile containing the email text
typeType, e.g. "text/plain"
commandBuffer containing command
clenLength of buffer
Return values
0Command works on a file
1Command works on a pipe

The command semantics include the following: s is the filename that contains the mail body data t is the content type, like text/plain %{parameter} is replaced by the parameter value from the content-type field % is % Unsupported rfc1524 parameters: these would probably require some doing by neomutt, and can probably just be done by piping the message to metamail n is the integer number of sub-parts in the multipart F is "content-type filename" repeated for each sub-part

Definition at line 72 of file rfc1524.c.

73 {
74  int x = 0, y = 0;
75  int needspipe = true;
76  char buf[HUGE_STRING];
77  char type2[LONG_STRING];
78 
79  mutt_str_strfcpy(type2, type, sizeof(type2));
80 
81  if (MailcapSanitize)
82  mutt_file_sanitize_filename(type2, false);
83 
84  while (x < clen - 1 && command[x] && y < sizeof(buf) - 1)
85  {
86  if (command[x] == '\\')
87  {
88  x++;
89  buf[y++] = command[x++];
90  }
91  else if (command[x] == '%')
92  {
93  x++;
94  if (command[x] == '{')
95  {
96  char param[STRING];
97  char pvalue[STRING];
98  char *pvalue2 = NULL;
99  int z = 0;
100 
101  x++;
102  while (command[x] && command[x] != '}' && z < sizeof(param) - 1)
103  param[z++] = command[x++];
104  param[z] = '\0';
105 
106  pvalue2 = mutt_param_get(&a->parameter, param);
107  mutt_str_strfcpy(pvalue, pvalue2, sizeof(pvalue));
108  if (MailcapSanitize)
109  mutt_file_sanitize_filename(pvalue, false);
110 
111  y += mutt_file_quote_filename(pvalue, buf + y, sizeof(buf) - y);
112  }
113  else if (command[x] == 's' && filename)
114  {
115  y += mutt_file_quote_filename(filename, buf + y, sizeof(buf) - y);
116  needspipe = false;
117  }
118  else if (command[x] == 't')
119  {
120  y += mutt_file_quote_filename(type2, buf + y, sizeof(buf) - y);
121  }
122  x++;
123  }
124  else
125  buf[y++] = command[x++];
126  }
127  buf[y] = '\0';
128  mutt_str_strfcpy(command, buf, clen);
129 
130  return needspipe;
131 }
#define LONG_STRING
Definition: string2.h:36
void mutt_file_sanitize_filename(char *f, bool slash)
Replace unsafe characters in a filename.
Definition: file.c:578
#define HUGE_STRING
Definition: string2.h:37
bool MailcapSanitize
Config: Restrict the possible characters in mailcap expandos.
Definition: rfc1524.c:50
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:742
char * mutt_param_get(const struct ParameterList *p, const char *s)
Find a matching Parameter.
Definition: parameter.c:81
#define STRING
Definition: string2.h:35
size_t mutt_file_quote_filename(const char *filename, char *buf, size_t buflen)
Quote a filename to survive the shell&#39;s quoting rules.
Definition: file.c:749
struct ParameterList parameter
parameters of the content-type
Definition: body.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* get_field ( char *  s)
static

NUL terminate a RFC1524 field.

Parameters
sString to alter
Return values
ptrStart of next field
NULLError

Definition at line 139 of file rfc1524.c.

140 {
141  char *ch = NULL;
142 
143  if (!s)
144  return NULL;
145 
146  while ((ch = strpbrk(s, ";\\")))
147  {
148  if (*ch == '\\')
149  {
150  s = ch + 1;
151  if (*s)
152  s++;
153  }
154  else
155  {
156  *ch = 0;
157  ch = mutt_str_skip_email_wsp(ch + 1);
158  break;
159  }
160  }
162  return ch;
163 }
void mutt_str_remove_trailing_ws(char *s)
Trim trailing whitespace from a string.
Definition: string.c:729
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
Definition: string.c:768

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int get_field_text ( char *  field,
char **  entry,
char *  type,
char *  filename,
int  line 
)
static

Get the matching text from a mailcap.

Parameters
fieldString to parse
entrySave the entry here
typeType, e.g. "text/plain"
filenameMailcap filename
lineMailcap line
Return values
1Success
0Failure

Definition at line 175 of file rfc1524.c.

176 {
177  field = mutt_str_skip_whitespace(field);
178  if (*field == '=')
179  {
180  if (entry)
181  {
182  field++;
183  field = mutt_str_skip_whitespace(field);
184  mutt_str_replace(entry, field);
185  }
186  return 1;
187  }
188  else
189  {
190  mutt_error(_("Improperly formatted entry for type %s in \"%s\" line %d"),
191  type, filename, line);
192  return 0;
193  }
194 }
char * mutt_str_skip_whitespace(char *p)
Find the first non-whitespace character in a string.
Definition: string.c:717
#define _(a)
Definition: message.h:28
const char * line
Definition: common.c:35
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:460
#define mutt_error(...)
Definition: logging.h:88

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int rfc1524_mailcap_parse ( struct Body a,
char *  filename,
char *  type,
struct Rfc1524MailcapEntry entry,
int  opt 
)
static

Parse a mailcap entry.

Parameters
aEmail Body
filenameFilename
typeType, e.g. "text/plain"
entryEntry, e.g. "compose"
optOption, e.g. MUTT_EDIT
Return values
1Success
0Failure

Definition at line 206 of file rfc1524.c.

208 {
209  char *buf = NULL;
210  int found = false;
211  int line = 0;
212 
213  /* rfc1524 mailcap file is of the format:
214  * base/type; command; extradefs
215  * type can be * for matching all
216  * base with no /type is an implicit wild
217  * command contains a %s for the filename to pass, default to pipe on stdin
218  * extradefs are of the form:
219  * def1="definition"; def2="define \;";
220  * line wraps with a \ at the end of the line
221  * # for comments
222  */
223 
224  /* find length of basetype */
225  char *ch = strchr(type, '/');
226  if (!ch)
227  return false;
228  const int btlen = ch - type;
229 
230  FILE *fp = fopen(filename, "r");
231  if (fp)
232  {
233  size_t buflen;
234  while (!found && (buf = mutt_file_read_line(buf, &buflen, fp, &line, MUTT_CONT)))
235  {
236  /* ignore comments */
237  if (*buf == '#')
238  continue;
239  mutt_debug(2, "mailcap entry: %s\n", buf);
240 
241  /* check type */
242  ch = get_field(buf);
243  if ((mutt_str_strcasecmp(buf, type) != 0) &&
244  ((mutt_str_strncasecmp(buf, type, btlen) != 0) ||
245  (buf[btlen] != 0 && /* implicit wild */
246  (mutt_str_strcmp(buf + btlen, "/*") != 0)))) /* wildsubtype */
247  {
248  continue;
249  }
250 
251  /* next field is the viewcommand */
252  char *field = ch;
253  ch = get_field(ch);
254  if (entry)
255  entry->command = mutt_str_strdup(field);
256 
257  /* parse the optional fields */
258  found = true;
259  bool copiousoutput = false;
260  bool composecommand = false;
261  bool editcommand = false;
262  bool printcommand = false;
263 
264  while (ch)
265  {
266  field = ch;
267  ch = get_field(ch);
268  mutt_debug(2, "field: %s\n", field);
269  size_t plen;
270 
271  if (mutt_str_strcasecmp(field, "needsterminal") == 0)
272  {
273  if (entry)
274  entry->needsterminal = true;
275  }
276  else if (mutt_str_strcasecmp(field, "copiousoutput") == 0)
277  {
278  copiousoutput = true;
279  if (entry)
280  entry->copiousoutput = true;
281  }
282  else if ((plen = mutt_str_startswith(field, "composetyped", CASE_IGNORE)))
283  {
284  /* this compare most occur before compose to match correctly */
285  if (get_field_text(field + plen, entry ? &entry->composetypecommand : NULL,
286  type, filename, line))
287  {
288  composecommand = true;
289  }
290  }
291  else if ((plen = mutt_str_startswith(field, "compose", CASE_IGNORE)))
292  {
293  if (get_field_text(field + plen, entry ? &entry->composecommand : NULL,
294  type, filename, line))
295  {
296  composecommand = true;
297  }
298  }
299  else if ((plen = mutt_str_startswith(field, "print", CASE_IGNORE)))
300  {
301  if (get_field_text(field + plen, entry ? &entry->printcommand : NULL,
302  type, filename, line))
303  {
304  printcommand = true;
305  }
306  }
307  else if ((plen = mutt_str_startswith(field, "edit", CASE_IGNORE)))
308  {
309  if (get_field_text(field + plen, entry ? &entry->editcommand : NULL,
310  type, filename, line))
311  editcommand = true;
312  }
313  else if ((plen = mutt_str_startswith(field, "nametemplate", CASE_IGNORE)))
314  {
315  get_field_text(field + plen, entry ? &entry->nametemplate : NULL,
316  type, filename, line);
317  }
318  else if ((plen = mutt_str_startswith(field, "x-convert", CASE_IGNORE)))
319  {
320  get_field_text(field + plen, entry ? &entry->convert : NULL, type, filename, line);
321  }
322  else if ((plen = mutt_str_startswith(field, "test", CASE_IGNORE)))
323  {
324  /* This routine executes the given test command to determine
325  * if this is the right entry.
326  */
327  char *test_command = NULL;
328 
329  if (get_field_text(field + plen, &test_command, type, filename, line) && test_command)
330  {
331  const size_t len = mutt_str_strlen(test_command) + STRING;
332  mutt_mem_realloc(&test_command, len);
333  if (rfc1524_expand_command(a, a->filename, type, test_command, len) == 1)
334  {
335  mutt_debug(1, "Command is expecting to be piped\n");
336  }
337  if (mutt_system(test_command) != 0)
338  {
339  /* a non-zero exit code means test failed */
340  found = false;
341  }
342  FREE(&test_command);
343  }
344  }
345  else if (mutt_str_startswith(field, "x-neomutt-keep", CASE_IGNORE))
346  {
347  if (entry)
348  entry->xneomuttkeep = true;
349  }
350  } /* while (ch) */
351 
352  if (opt == MUTT_AUTOVIEW)
353  {
354  if (!copiousoutput)
355  found = false;
356  }
357  else if (opt == MUTT_COMPOSE)
358  {
359  if (!composecommand)
360  found = false;
361  }
362  else if (opt == MUTT_EDIT)
363  {
364  if (!editcommand)
365  found = false;
366  }
367  else if (opt == MUTT_PRINT)
368  {
369  if (!printcommand)
370  found = false;
371  }
372 
373  if (!found)
374  {
375  /* reset */
376  if (entry)
377  {
378  FREE(&entry->command);
379  FREE(&entry->composecommand);
380  FREE(&entry->composetypecommand);
381  FREE(&entry->editcommand);
382  FREE(&entry->printcommand);
383  FREE(&entry->nametemplate);
384  FREE(&entry->convert);
385  entry->needsterminal = false;
386  entry->copiousoutput = false;
387  entry->xneomuttkeep = false;
388  }
389  }
390  } /* while (!found && (buf = mutt_file_read_line ())) */
391  mutt_file_fclose(&fp);
392  } /* if ((fp = fopen ())) */
393  FREE(&buf);
394  return found;
395 }
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:47
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, int flags)
Read a line from a file.
Definition: file.c:632
static size_t plen
Length of cached packet.
Definition: pgppacket.c:38
bool needsterminal
endwin() and system
Definition: rfc1524.h:47
bool xneomuttkeep
do not remove the file on command exit
Definition: rfc1524.h:49
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:663
Mailcap edit field.
Definition: mutt.h:176
#define MUTT_CONT
-continuation
Definition: file.h:36
static int get_field_text(char *field, char **entry, char *type, char *filename, int line)
Get the matching text from a mailcap.
Definition: rfc1524.c:175
const char * line
Definition: common.c:35
char * nametemplate
Definition: rfc1524.h:45
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:124
int mutt_str_strncasecmp(const char *a, const char *b, size_t l)
Compare two strings ignoring case (to a maximum), safely.
Definition: string.c:653
Ignore case when comparing strings.
Definition: string2.h:70
Mailcap print field.
Definition: mutt.h:178
char * composetypecommand
Definition: rfc1524.h:42
size_t mutt_str_startswith(const char *str, const char *prefix, enum CaseSensitivity cs)
Check whether a string starts with a prefix.
Definition: string.c:166
char * composecommand
Definition: rfc1524.h:41
#define STRING
Definition: string2.h:35
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:384
int mutt_file_fclose(FILE **f)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
Mailcap autoview field.
Definition: mutt.h:179
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:625
char * editcommand
Definition: rfc1524.h:43
char * printcommand
Definition: rfc1524.h:44
#define FREE(x)
Definition: memory.h:46
static char * get_field(char *s)
NUL terminate a RFC1524 field.
Definition: rfc1524.c:139
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
Mailcap compose field.
Definition: mutt.h:177
int rfc1524_expand_command(struct Body *a, char *filename, char *type, char *command, int clen)
Expand expandos in a command.
Definition: rfc1524.c:72
int mutt_str_strcmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:612
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:50
bool copiousoutput
needs pager, basically
Definition: rfc1524.h:48

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct Rfc1524MailcapEntry* rfc1524_new_entry ( void  )

Allocate memory for a new rfc1524 entry.

Return values
ptrAn un-initialized struct Rfc1524MailcapEntry

Definition at line 401 of file rfc1524.c.

402 {
403  return mutt_mem_calloc(1, sizeof(struct Rfc1524MailcapEntry));
404 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
A mailcap entry.
Definition: rfc1524.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rfc1524_free_entry ( struct Rfc1524MailcapEntry **  entry)

Deallocate an struct Rfc1524MailcapEntry.

Parameters
entryRfc1524MailcapEntry to deallocate

Definition at line 410 of file rfc1524.c.

411 {
412  struct Rfc1524MailcapEntry *p = *entry;
413 
414  FREE(&p->command);
415  FREE(&p->testcommand);
416  FREE(&p->composecommand);
418  FREE(&p->editcommand);
419  FREE(&p->printcommand);
420  FREE(&p->nametemplate);
421  FREE(entry);
422 }
char * nametemplate
Definition: rfc1524.h:45
A mailcap entry.
Definition: rfc1524.h:37
char * composetypecommand
Definition: rfc1524.h:42
char * composecommand
Definition: rfc1524.h:41
char * editcommand
Definition: rfc1524.h:43
char * printcommand
Definition: rfc1524.h:44
#define FREE(x)
Definition: memory.h:46
char * testcommand
Definition: rfc1524.h:40

+ Here is the caller graph for this function:

int rfc1524_mailcap_lookup ( struct Body a,
char *  type,
struct Rfc1524MailcapEntry entry,
int  opt 
)

Find given type in the list of mailcap files.

Parameters
aMessage body
typeText type in "type/subtype" format
entrystruct Rfc1524MailcapEntry to populate with results
optType of mailcap entry to lookup
Return values
1Success. If *entry is not NULL it populates it with the mailcap entry
0No matching entry is found

opt can be one of: MUTT_EDIT, MUTT_COMPOSE, MUTT_PRINT, MUTT_AUTOVIEW

Find the given type in the list of mailcap files.

Definition at line 437 of file rfc1524.c.

439 {
440  char path[PATH_MAX];
441  int found = false;
442  char *curr = MailcapPath;
443 
444  /* rfc1524 specifies that a path of mailcap files should be searched.
445  * joy. They say
446  * $HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap, etc
447  * and overridden by the MAILCAPS environment variable, and, just to be nice,
448  * we'll make it specifiable in .neomuttrc
449  */
450  if (!curr || !*curr)
451  {
452  mutt_error(_("No mailcap path specified"));
453  return 0;
454  }
455 
457 
458  while (!found && *curr)
459  {
460  int x = 0;
461  while (*curr && *curr != ':' && x < sizeof(path) - 1)
462  {
463  path[x++] = *curr;
464  curr++;
465  }
466  if (*curr)
467  curr++;
468 
469  if (!x)
470  continue;
471 
472  path[x] = '\0';
473  mutt_expand_path(path, sizeof(path));
474 
475  mutt_debug(2, "Checking mailcap file: %s\n", path);
476  found = rfc1524_mailcap_parse(a, path, type, entry, opt);
477  }
478 
479  if (entry && !found)
480  mutt_error(_("mailcap entry for type %s not found"), type);
481 
482  return found;
483 }
WHERE char * MailcapPath
Config: Colon-separated list of mailcap files.
Definition: globals.h:118
#define SHORT_STRING
Definition: string2.h:34
#define _(a)
Definition: message.h:28
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:157
#define PATH_MAX
Definition: mutt.h:46
void mutt_check_lookup_list(struct Body *b, char *type, size_t len)
Update the mime type.
Definition: mutt_attach.c:325
#define mutt_error(...)
Definition: logging.h:88
static int rfc1524_mailcap_parse(struct Body *a, char *filename, char *type, struct Rfc1524MailcapEntry *entry, int opt)
Parse a mailcap entry.
Definition: rfc1524.c:206
#define mutt_debug(LEVEL,...)
Definition: logging.h:85

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rfc1524_expand_filename ( char *  nametemplate,
char *  oldfile,
char *  newfile,
size_t  nflen 
)

Expand a new filename from a template or existing filename.

Parameters
nametemplateTemplate
oldfileOriginal filename
newfileBuffer for new filename
nflenBuffer length
Return values
0if the left and right components of the oldfile and newfile match
1otherwise

If there is no nametemplate, the stripped oldfile name is used as the template for newfile.

If there is no oldfile, the stripped nametemplate name is used as the template for newfile.

If both a nametemplate and oldfile are specified, the template is checked for a "%s". If none is found, the nametemplate is used as the template for newfile. The first path component of the nametemplate and oldfile are ignored.

Definition at line 504 of file rfc1524.c.

505 {
506  int i, j, k, ps;
507  char *s = NULL;
508  bool lmatch = false, rmatch = false;
509  char left[PATH_MAX];
510  char right[PATH_MAX];
511 
512  newfile[0] = 0;
513 
514  /* first, ignore leading path components */
515 
516  if (nametemplate && (s = strrchr(nametemplate, '/')))
517  nametemplate = s + 1;
518 
519  if (oldfile && (s = strrchr(oldfile, '/')))
520  oldfile = s + 1;
521 
522  if (!nametemplate)
523  {
524  if (oldfile)
525  mutt_str_strfcpy(newfile, oldfile, nflen);
526  }
527  else if (!oldfile)
528  {
529  mutt_file_expand_fmt(newfile, nflen, nametemplate, "neomutt");
530  }
531  else /* oldfile && nametemplate */
532  {
533  /* first, compare everything left from the "%s"
534  * (if there is one). */
535 
536  lmatch = true;
537  ps = 0;
538  for (i = 0; nametemplate[i]; i++)
539  {
540  if (nametemplate[i] == '%' && nametemplate[i + 1] == 's')
541  {
542  ps = 1;
543  break;
544  }
545 
546  /* note that the following will _not_ read beyond oldfile's end. */
547 
548  if (lmatch && nametemplate[i] != oldfile[i])
549  lmatch = false;
550  }
551 
552  if (ps)
553  {
554  /* If we had a "%s", check the rest. */
555 
556  /* now, for the right part: compare everything right from
557  * the "%s" to the final part of oldfile.
558  *
559  * The logic here is as follows:
560  *
561  * - We start reading from the end.
562  * - There must be a match _right_ from the "%s",
563  * thus the i + 2.
564  * - If there was a left hand match, this stuff
565  * must not be counted again. That's done by the
566  * condition (j >= (lmatch ? i : 0)).
567  */
568 
569  rmatch = true;
570 
571  for (j = mutt_str_strlen(oldfile) - 1, k = mutt_str_strlen(nametemplate) - 1;
572  j >= (lmatch ? i : 0) && k >= i + 2; j--, k--)
573  {
574  if (nametemplate[k] != oldfile[j])
575  {
576  rmatch = false;
577  break;
578  }
579  }
580 
581  /* Now, check if we had a full match. */
582 
583  if (k >= i + 2)
584  rmatch = false;
585 
586  if (lmatch)
587  *left = 0;
588  else
589  mutt_str_strnfcpy(left, nametemplate, i, sizeof(left));
590 
591  if (rmatch)
592  *right = 0;
593  else
594  mutt_str_strfcpy(right, nametemplate + i + 2, sizeof(right));
595 
596  snprintf(newfile, nflen, "%s%s%s", left, oldfile, right);
597  }
598  else
599  {
600  /* no "%s" in the name template. */
601  mutt_str_strfcpy(newfile, nametemplate, nflen);
602  }
603  }
604 
605  mutt_adv_mktemp(newfile, nflen);
606 
607  if (rmatch && lmatch)
608  return 0;
609  else
610  return 1;
611 }
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:663
void mutt_file_expand_fmt(char *dest, size_t destlen, const char *fmt, const char *src)
Replace s in a string with a filename.
Definition: file.c:1338
size_t mutt_str_strnfcpy(char *dest, const char *src, size_t n, size_t dsize)
Copy a limited string into a buffer (guaranteeing NUL-termination)
Definition: string.c:793
char * nametemplate
Definition: rfc1524.h:45
#define PATH_MAX
Definition: mutt.h:46
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:742
void mutt_adv_mktemp(char *buf, size_t buflen)
Advanced mktemp(3)
Definition: muttlib.c:123

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool MailcapSanitize

Config: Restrict the possible characters in mailcap expandos.

Definition at line 50 of file rfc1524.c.