diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-09-01 22:05:48 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-09-01 22:05:48 +0000 |
commit | 0325bb6e97212f49c52e80fefa62ed324e6bc382 (patch) | |
tree | 75eb916f893f96ccad20693a7b9f902453481b2e | |
parent | 42ad49625167131af5054cd4c42cefb260eb88e8 (diff) | |
download | mailutils-0325bb6e97212f49c52e80fefa62ed324e6bc382.tar.gz mailutils-0325bb6e97212f49c52e80fefa62ed324e6bc382.tar.bz2 |
Use mu_tempname
-rw-r--r-- | examples/mimetest.c | 15 | ||||
-rw-r--r-- | mail/edit.c | 4 | ||||
-rw-r--r-- | mail/visual.c | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/examples/mimetest.c b/examples/mimetest.c index 428a91b9e..fba093ab7 100644 --- a/examples/mimetest.c +++ b/examples/mimetest.c @@ -222,7 +222,8 @@ message_display_parts (message_t msg, int indent) } if ((ret = message_get_header (part, &hdr)) != 0) { - fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); + fprintf (stderr, "message_get_header - %s\n", + mu_errstring (ret)); exit (2); } header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); @@ -233,7 +234,8 @@ message_display_parts (message_t msg, int indent) printf ("%*.*sBegin\n", indent, indent, ""); if ((ret = message_get_num_parts (part, &nsubparts)) != 0) { - fprintf (stderr, "mime_get_num_parts - %s\n", mu_errstring (ret)); + fprintf (stderr, "mime_get_num_parts - %s\n", + mu_errstring (ret)); exit (2); } message_display_parts (part, indent+indent_level); @@ -265,11 +267,10 @@ message_display_parts (message_t msg, int indent) char *fname = NULL; message_aget_attachment_name (part, &fname); if (fname == NULL) - { - char buffer[PATH_MAX + 1]; - fname = tempnam (getcwd (buffer, PATH_MAX), "msg-"); - } - printf ("%*.*sAttachment - saving [%s]\n", indent, indent, "", fname); + fname = mu_tempname (NULL); + + printf ("%*.*sAttachment - saving [%s]\n", indent, indent, "", + fname); printf ("%*.*sBegin\n", indent, indent, ""); /*FIXME: What is the 'data' argument for? */ message_save_attachment (part, NULL, NULL); diff --git a/mail/edit.c b/mail/edit.c index 47d2d3d4e..ce8d7c07e 100644 --- a/mail/edit.c +++ b/mail/edit.c @@ -28,9 +28,9 @@ mail_edit (int argc, char **argv) return util_msglist_command (mail_edit, argc, argv, 1); else { - char *file = tempnam(getenv("TMPDIR"), "mu"); + char *file = mu_tempname (NULL); util_do_command ("copy %s", file); - util_do_command ("shell %s %s", getenv("EDITOR"), file); + util_do_command ("shell %s %s", getenv ("EDITOR"), file); remove (file); free (file); return 0; diff --git a/mail/visual.c b/mail/visual.c index b775fc707..6630425b2 100644 --- a/mail/visual.c +++ b/mail/visual.c @@ -30,9 +30,9 @@ mail_visual (int argc, char **argv) { message_t msg = NULL; attribute_t attr = NULL; - char *file = tempnam(getenv("TMPDIR"), "mu"); + char *file = mu_tempname (NULL); - util_do_command ("copy %s", file); /* NOTE: copy does not set flags */ + util_do_command ("copy %s", file); util_do_command ("shell %s %s", getenv("VISUAL"), file); remove (file); |