Changeset 5059:339fd21bf139

Show
Ignore:
Timestamp:
2007-04-03 14:08:46 (22 months ago)
Author:
Christoph Berg <cb@…>
Branch:
HEAD
Message:

When -- is present in the argument list, allow attachment globs.
The -- separates file names from recipients.
Also works for -A and -Q.

Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5055 r5059  
     12007-04-03 10:54 -0700  Fabian Groffen  <grobian@orakel.ods.org>  (89abe8bd0713) 
     2 
     3        * hdrline.c, imap/message.c, mh.c, muttlib.c, regex.c, sendlib.c: Fix 
     4        some warnings. 
     5 
     62007-04-03 08:59 -0700  Brendan Cully  <brendan@kublai.com>  (e363d7a69046) 
     7 
     8        * pop_auth.c, rfc822.c, rfc822.h: Validate msgid in APOP 
     9        authentication. Closes #2846 
     10 
     11        * hcache.c: Fix DB4 crash introduced in d5ab883ef90a 
     12 
     13        * imap/util.c: Add missing hcache.h include 
     14 
    1152007-04-02 20:44 -0700  Brendan Cully  <brendan@kublai.com>  (59fcc37f8c75) 
    216 
  • doc/manual.xml.head

    r5007 r5059  
    59745974 
    59755975<para> 
    5976 <literal>mutt</literal> &lsqb; -n &rsqb; &lsqb; -F <emphasis>muttrc</emphasis> &rsqb; &lsqb; -a <emphasis>file</emphasis> &rsqb; &lsqb; -c <emphasis>address</emphasis> &rsqb; &lsqb; -i <emphasis>filename</emphasis> &rsqb; &lsqb; -s <emphasis>subject</emphasis> &rsqb; <emphasis>address</emphasis> &lsqb; <emphasis>address</emphasis> ... &rsqb;  
     5976<literal>mutt</literal> &lsqb; -n &rsqb; &lsqb; -F <emphasis>muttrc</emphasis> &rsqb; &lsqb; -a <emphasis>file</emphasis> &rsqb; &lsqb; -c <emphasis>address</emphasis> &rsqb; &lsqb; -i <emphasis>filename</emphasis> &rsqb; &lsqb; -s <emphasis>subject</emphasis> &rsqb; 
     5977&lsqb; &lsqb; <emphasis>file</emphasis> ... &rsqb; -- &rsqb; <emphasis>address</emphasis> &lsqb; <emphasis>address</emphasis> ... &rsqb;  
    59775978</para> 
    59785979 
     
    59935994</para> 
    59945995 
     5996<para> 
     5997All files passed with -a <emphasis>file</emphasis> will be attached as a MIME 
     5998part to the message. To attach several files, use ``--'' to separate files and 
     5999recipient addresses: <literal>mutt -a *.png -- some@one.org</literal> 
     6000</para> 
     6001 
    59956002</sect1> 
    59966003 
  • doc/mutt.man

    r4988 r5059  
    3030[-nx]  
    3131[-e \fIcmd\fP]  
    32 [-a \fIfile\fP] 
    3332[-F \fIfile\fP] 
    3433[-H \fIfile\fP] 
     
    3736[-b \fIaddr\fP] 
    3837[-c \fIaddr\fP] 
    39 [--] 
     38[\-a \fIfile\fP [...]] 
     39[\-\-] 
    4040\fIaddr\fP [...] 
    4141.PP 
     
    6363.IP "-A \fIalias\fP" 
    6464An expanded version of the given alias is passed to stdout. 
    65 .IP "-a \fIfile\fP" 
     65.IP "-a \fIfile\fP [...]" 
    6666Attach a file to your message using MIME. 
     67To attach multiple files, separating filenames and recipient addresses with 
     68"\-\-" is mandatory, e.g. \fBmutt \-a img.jpg *.png \-\- addr1 addr2\fP. 
    6769.IP "-b \fIaddress\fP" 
    6870Specify a blind-carbon-copy (BCC) recipient 
     
    118120Causes Mutt to open the first mailbox specified by the \fImailboxes\fP 
    119121command which contains new mail. 
    120 .IP "--" 
     122.IP "\-\-" 
    121123Treat remaining arguments as \fIaddr\fP even if they start with a dash. 
     124See also "\-a" above. 
    122125.SH ENVIRONMENT 
    123126.PP 
  • main.c

    r5011 r5059  
    106106 
    107107  puts _( 
    108 "usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]\n\ 
    109        mutt [ -nR ] [ -e <cmd> ] [ -F <file> ] -Q <query> [ -Q <query> ] [...]\n\ 
    110        mutt [ -nR ] [ -e <cmd> ] [ -F <file> ] -A <alias> [ -A <alias> ] [...]\n\ 
    111        mutt [ -nR ] [ -e <cmd> ] [ -F <file> ] -D\n\ 
    112        mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] [ -- ] <addr> [ ... ]\n\ 
    113        mutt [ -n ] [ -e <cmd> ] [ -F <file> ] -p\n\ 
     108"usage: mutt [<options>] [-z] [-f <file> | -yZ]\n\ 
     109       mutt [<options>] [-x] [-Hi <file>] [-s <subj>] [-bc <addr>] [-a <file> [...]] [--] <addr> [...]\n\ 
     110       mutt [<options>] -p\n\ 
     111       mutt [<options>] -A <alias> [...]\n\ 
     112       mutt [<options>] -Q <query> [...]\n\ 
     113       mutt [<options>] -D\n\ 
    114114       mutt -v[v]\n"); 
    115115 
     
    144144  -Z\t\topen the first folder with new message, exit immediately if none\n\ 
    145145  -h\t\tthis help message"); 
    146   puts _("  --\t\ttreat remaining arguments as addr even if starting with a dash"); 
     146  puts _("  --\t\ttreat remaining arguments as addr even if starting with a dash\n\ 
     147\t\twhen using -a with multiple filenames using -- is mandatory"); 
    147148 
    148149  exit (0); 
     
    542543  extern char *optarg; 
    543544  extern int optind; 
     545  int attach_sep = 0; 
    544546 
    545547  /* sanity check against stupid administrators */ 
     
    568570  memset (Options, 0, sizeof (Options)); 
    569571  memset (QuadOptions, 0, sizeof (QuadOptions)); 
    570    
     572 
     573  for (i = 1; i < argc; i++) 
     574    if (!strcmp(argv[i], "--")) 
     575    { 
     576      attach_sep = i; 
     577      break; 
     578    } 
     579 
    571580  while ((i = getopt (argc, argv, "A:a:b:F:f:c:Dd:e:H:s:i:hm:npQ:RvxyzZ")) != EOF) 
    572581    switch (i) 
     
    710719 
    711720  if (queries) 
     721  { 
     722    for (; optind < argc; optind++) 
     723      queries = mutt_add_list (queries, argv[optind]); 
    712724    return mutt_query_variables (queries); 
     725  } 
    713726  if (dump_variables) 
    714727    return mutt_dump_variables(); 
     
    718731    int rv = 0; 
    719732    ADDRESS *a; 
     733    for (; optind < argc; optind++) 
     734      alias_queries = mutt_add_list (alias_queries, argv[optind]); 
    720735    for (; alias_queries; alias_queries = alias_queries->next) 
    721736    { 
     
    734749    return rv; 
    735750  } 
    736    
     751 
     752  /* if an -a option is present, all non-option arguments before -- are considered attachments */ 
     753  if (attach) 
     754    for (; optind <= attach_sep; optind++) 
     755      attach = mutt_add_list (attach, argv[optind]); 
     756 
    737757  if (newMagic) 
    738758    mx_set_magic (newMagic);