Re: attach multiple files from command line
* On 2007.03.20, in <20070320143205.GC21029@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
* "Rocco Rutte" <pdmef@xxxxxxx> wrote:
>
> Does getopt() prevent us from allowing any number of additional
> arguments for -j?
Pretty much -- additional arguments are just regular arguments, which is
why -e options always have to be last in the syntax. And mutt already
has a -e.
This would be trivial to implement, if we cast responsibility for
correctness to the C library. A rudimentary fragment, untested:
#include <glob.h>
glob_t glob;
...
int
globerr(const char *path, int err)
{
fprintf(stderr, "-j: error searching %s: %s\n",
path, strerror(err));
return 0; /* do not abort */
}
...main()...
case 'j':
glob(optarg, 0, globerr, &glob);
for (i = 0; i < glob.gl_pathc; i++)
attach = mutt_add_list (attach, glob.gl_pathv[i]);
break;
Should probably have an autoconf check for glob(), but it's a 4.4BSD
libc function that's also available in Solaris, MacOS, and glibc, at
least.
--
-D. dgc@xxxxxxxxxxxx NSIT University of Chicago