diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-04-08 13:29:31 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-04-08 13:29:31 +0300 |
commit | d1b1cba265616c7b48948c7f27d4a15f335fd6ae (patch) | |
tree | 0e4c5ab6c4c28c05e2a40b458cb1123353df588b | |
parent | 7287e840118d680efe1795e053500c999a950ade (diff) | |
download | mailutils-d1b1cba265616c7b48948c7f27d4a15f335fd6ae.tar.gz mailutils-d1b1cba265616c7b48948c7f27d4a15f335fd6ae.tar.bz2 |
Bugfixes.
* mailbox/mimehdr.c (_header_get_param): If buf is NULL
on entry, make sure it alwaus points to allocated memory
afterwards.
* examples/mimetest.c (charset): New variable.
(main): New command line option -c.
(message_display_parts): Use mu_message_aget_decoded_attachment_name.
Pass fname to mu_message_save_attachment.
-rw-r--r-- | examples/mimetest.c | 26 | ||||
-rw-r--r-- | mailbox/mimehdr.c | 2 |
2 files changed, 23 insertions, 5 deletions
diff --git a/examples/mimetest.c b/examples/mimetest.c index c42dc4449..53ae37719 100644 --- a/examples/mimetest.c +++ b/examples/mimetest.c @@ -35,6 +35,7 @@ void message_display_parts(mu_message_t msg, int indent); const char *from; const char *subject; +const char *charset = "UTF-8"; int print_attachments; int indent_level = 4; @@ -72,7 +73,23 @@ main (int argc, char **argv) else if (strcmp (argv[i], "-p") == 0) print_attachments = 1; else if (strcmp (argv[i], "-i") == 0) - indent_level = strtoul (argv[++i], NULL, 0); + { + if (++i == argc) + { + mu_error ("-i requires argument"); + exit (1); + } + indent_level = strtoul (argv[i], NULL, 0); + } + else if (strcmp (argv[i], "-c") == 0) + { + if (++i == argc) + { + mu_error ("-c requires argument"); + exit (1); + } + charset = argv[i]; + } else break; } @@ -242,8 +259,9 @@ message_display_parts (mu_message_t msg, int indent) { /* Save the attachements. */ char *fname = NULL; - /* FIXME: CS/Lang info is ignored */ - mu_message_aget_attachment_name (part, &fname, NULL); + + mu_message_aget_decoded_attachment_name (part, charset, + &fname, NULL); if (fname == NULL) fname = mu_tempname (NULL); @@ -251,7 +269,7 @@ message_display_parts (mu_message_t msg, int indent) fname); printf ("%*.*sBegin\n", indent, indent, ""); /*FIXME: What is the 'data' argument for? */ - mu_message_save_attachment (part, NULL, NULL); + mu_message_save_attachment (part, fname, NULL); if (print_attachments) print_file (fname, indent); free (fname); diff --git a/mailbox/mimehdr.c b/mailbox/mimehdr.c index 0c04c23f9..2e0990306 100644 --- a/mailbox/mimehdr.c +++ b/mailbox/mimehdr.c @@ -276,7 +276,7 @@ _header_get_param (const char *field_body, res = ENOMEM; break; } - mem = newmem; + buf = mem = newmem; } } |