]> granicus.if.org Git - neomutt/commitdiff
When -- is present in the argument list, allow attachment globs.
authorChristoph Berg <cb@df7cb.de>
Tue, 3 Apr 2007 21:08:46 +0000 (14:08 -0700)
committerChristoph Berg <cb@df7cb.de>
Tue, 3 Apr 2007 21:08:46 +0000 (14:08 -0700)
The -- separates file names from recipients.
Also works for -A and -Q.

ChangeLog
doc/manual.xml.head
doc/mutt.man
main.c

index 3610556241ac00b107a31b82b7d4709e62d02b2e..b2ac5583fbbda60c0851d8f6a3dcfa4b77292ef2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-04-03 10:54 -0700  Fabian Groffen  <grobian@orakel.ods.org>  (89abe8bd0713)
+
+       * hdrline.c, imap/message.c, mh.c, muttlib.c, regex.c, sendlib.c: Fix
+       some warnings.
+
+2007-04-03 08:59 -0700  Brendan Cully  <brendan@kublai.com>  (e363d7a69046)
+
+       * pop_auth.c, rfc822.c, rfc822.h: Validate msgid in APOP
+       authentication. Closes #2846
+
+       * hcache.c: Fix DB4 crash introduced in d5ab883ef90a
+
+       * imap/util.c: Add missing hcache.h include
+
 2007-04-02 20:44 -0700  Brendan Cully  <brendan@kublai.com>  (59fcc37f8c75)
 
        * sendlib.c: Check message for boundary collisions (closes #902)
index c86650747de994cc7bd31145507731d1fd49491e..09873698567dbba5c29b8226431c652016cca9b7 100644 (file)
@@ -5973,7 +5973,8 @@ To compose a new message
 </para>
 
 <para>
-<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; 
+<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;
+&lsqb; &lsqb; <emphasis>file</emphasis> ... &rsqb; -- &rsqb; <emphasis>address</emphasis> &lsqb; <emphasis>address</emphasis> ... &rsqb; 
 </para>
 
 <para>
@@ -5992,6 +5993,12 @@ of ``data set for run &num;2''.  In the body of the message will be the contents
 of the file ``&tilde;/run2.dat''.
 </para>
 
+<para>
+All files passed with -a <emphasis>file</emphasis> will be attached as a MIME
+part to the message. To attach several files, use ``--'' to separate files and
+recipient addresses: <literal>mutt -a *.png -- some@one.org</literal>
+</para>
+
 </sect1>
 
 <sect1 id="commands">
index 52a4d2941735bf2bceacfeb5987fc4dc1e8a01f5..26214f6c6af48ce6221fefffa855d42024f54eaa 100644 (file)
@@ -29,14 +29,14 @@ mutt \- The Mutt Mail User Agent
 .B mutt 
 [-nx] 
 [-e \fIcmd\fP] 
-[-a \fIfile\fP]
 [-F \fIfile\fP]
 [-H \fIfile\fP]
 [-i \fIfile\fP]
 [-s \fIsubj\fP]
 [-b \fIaddr\fP]
 [-c \fIaddr\fP]
-[--]
+[\-a \fIfile\fP [...]]
+[\-\-]
 \fIaddr\fP [...]
 .PP
 .B mutt
@@ -62,8 +62,10 @@ OpenPGP, and a threaded sorting mode.
 .PP
 .IP "-A \fIalias\fP"
 An expanded version of the given alias is passed to stdout.
-.IP "-a \fIfile\fP"
+.IP "-a \fIfile\fP [...]"
 Attach a file to your message using MIME.
+To attach multiple files, separating filenames and recipient addresses with
+"\-\-" is mandatory, e.g. \fBmutt \-a img.jpg *.png \-\- addr1 addr2\fP.
 .IP "-b \fIaddress\fP"
 Specify a blind-carbon-copy (BCC) recipient
 .IP "-c \fIaddress\fP"
@@ -117,8 +119,9 @@ mailbox.
 .IP "-Z"
 Causes Mutt to open the first mailbox specified by the \fImailboxes\fP
 command which contains new mail.
-.IP "--"
+.IP "\-\-"
 Treat remaining arguments as \fIaddr\fP even if they start with a dash.
+See also "\-a" above.
 .SH ENVIRONMENT
 .PP
 .IP "EDITOR"
diff --git a/main.c b/main.c
index bcca8002d173f3f20eb1e185eba2785c37761f1c..66d771203ff4ac375f92d5f31fe510f33c10a7f4 100644 (file)
--- a/main.c
+++ b/main.c
@@ -105,12 +105,12 @@ static void mutt_usage (void)
   puts (mutt_make_version ());
 
   puts _(
-"usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]\n\
-       mutt [ -nR ] [ -e <cmd> ] [ -F <file> ] -Q <query> [ -Q <query> ] [...]\n\
-       mutt [ -nR ] [ -e <cmd> ] [ -F <file> ] -A <alias> [ -A <alias> ] [...]\n\
-       mutt [ -nR ] [ -e <cmd> ] [ -F <file> ] -D\n\
-       mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] [ -- ] <addr> [ ... ]\n\
-       mutt [ -n ] [ -e <cmd> ] [ -F <file> ] -p\n\
+"usage: mutt [<options>] [-z] [-f <file> | -yZ]\n\
+       mutt [<options>] [-x] [-Hi <file>] [-s <subj>] [-bc <addr>] [-a <file> [...]] [--] <addr> [...]\n\
+       mutt [<options>] -p\n\
+       mutt [<options>] -A <alias> [...]\n\
+       mutt [<options>] -Q <query> [...]\n\
+       mutt [<options>] -D\n\
        mutt -v[v]\n");
 
   puts _("\
@@ -143,7 +143,8 @@ options:\n\
   -z\t\texit immediately if there are no messages in the mailbox\n\
   -Z\t\topen the first folder with new message, exit immediately if none\n\
   -h\t\tthis help message");
-  puts _("  --\t\ttreat remaining arguments as addr even if starting with a dash");
+  puts _("  --\t\ttreat remaining arguments as addr even if starting with a dash\n\
+\t\twhen using -a with multiple filenames using -- is mandatory");
 
   exit (0);
 }
@@ -541,6 +542,7 @@ int main (int argc, char **argv)
   int dump_variables = 0;
   extern char *optarg;
   extern int optind;
+  int attach_sep = 0;
 
   /* sanity check against stupid administrators */
   
@@ -567,7 +569,14 @@ int main (int argc, char **argv)
 
   memset (Options, 0, sizeof (Options));
   memset (QuadOptions, 0, sizeof (QuadOptions));
-  
+
+  for (i = 1; i < argc; i++)
+    if (!strcmp(argv[i], "--"))
+    {
+      attach_sep = i;
+      break;
+    }
+
   while ((i = getopt (argc, argv, "A:a:b:F:f:c:Dd:e:H:s:i:hm:npQ:RvxyzZ")) != EOF)
     switch (i)
     {
@@ -709,7 +718,11 @@ int main (int argc, char **argv)
   crypt_init ();
 
   if (queries)
+  {
+    for (; optind < argc; optind++)
+      queries = mutt_add_list (queries, argv[optind]);
     return mutt_query_variables (queries);
+  }
   if (dump_variables)
     return mutt_dump_variables();
 
@@ -717,6 +730,8 @@ int main (int argc, char **argv)
   {
     int rv = 0;
     ADDRESS *a;
+    for (; optind < argc; optind++)
+      alias_queries = mutt_add_list (alias_queries, argv[optind]);
     for (; alias_queries; alias_queries = alias_queries->next)
     {
       if ((a = mutt_lookup_alias (alias_queries->data)))
@@ -733,7 +748,12 @@ int main (int argc, char **argv)
     }
     return rv;
   }
-  
+
+  /* if an -a option is present, all non-option arguments before -- are considered attachments */
+  if (attach)
+    for (; optind <= attach_sep; optind++)
+      attach = mutt_add_list (attach, argv[optind]);
+
   if (newMagic)
     mx_set_magic (newMagic);