Commit fc4e207c fc4e207c8af2c7e8d75a9f452724c6117f00c12d by Jakob Kaivo

Add decode command, for attachment handling. Set up general infrastructure

to support decoding. No implementation (yet).
1 parent ab886e33
......@@ -13,4 +13,4 @@ mail_SOURCES = alias.c alt.c cd.c copy.c delete.c dp.c echo.c \
hold.c if.c inc.c list.c mail.c mail.h mailline.c mbox.c next.c pipe.c \
previous.c print.c quit.c reply.c retain.c save.c send.c set.c shell.c \
size.c source.c summary.c table.c top.c touch.c unalias.c undelete.c \
unset.c util.c var.c version.c visual.c write.c z.c
unset.c util.c var.c version.c visual.c write.c z.c decode.c
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "mail.h"
/*
* dec[ode] ???
* FIXME: the sytnax of this needs to be discussed on bug-mailutils
*/
int
mail_decode (int argc, char **argv)
{
fprintf (stderr, "Sorry, the decode function hasn't been implemented yet");
return 1;
}
......@@ -129,6 +129,7 @@ int mail_alias __P((int argc, char **argv));
int mail_alt __P((int argc, char **argv)); /* command alternates */
int mail_cd __P((int argc, char **argv));
int mail_copy __P((int argc, char **argv));
int mail_decode __P((int argc, char **argv));
int mail_delete __P((int argc, char **argv));
int mail_discard __P((int argc, char **argv));
int mail_dp __P((int argc, char **argv));
......
......@@ -25,6 +25,7 @@ const struct mail_command_entry mail_command_table[] = {
{ "cd", "cd", 0, mail_cd, "cd [directory]" },
{ "ch", "chdir", 0, mail_cd, "ch[dir] directory" },
{ "c", "copy", 0, mail_copy, "c[opy] [[msglist] file]" },
{ "dec", "decode", 0, mail_decode, "dec[ode] ???" },
{ "d", "delete", 0, mail_delete, "d[elete] [msglist]" },
{ "di", "discard", 0, mail_discard,
"di[scard] [header-field...]" },
......
......@@ -225,6 +225,24 @@ util_expand_msglist (const int argc, char **argv, int **list)
current = util_ll_add (current, x);
free (arg);
}
else if (strchr (argv[i], '[') != NULL)
{
/* attachments - GNU extension */
/*
* This is a general extension to the msglist format. Basicallay,
* it adds C-like array subscripting to msg numbers to allow access
* to just a single part of a MIME multipart message. I.e.:
* print 7[1],8[1-2]
* should print the first attachment of message 7 and the first
* and second attachments of message 8. The format inside the
* brackets is the same as a msglist, so we should be able to
* reuse this function for its expansion. This will primarily
* be used by the new decode command, which needs discussion on
* the mailing list to nail its syntax down (should it default to
* saving to a file, printing to stdout, or piping?)
* -- sparky
*/
}
else
{
/* Single message. */
......