Commit 0325bb6e 0325bb6e97212f49c52e80fefa62ed324e6bc382 by Sergey Poznyakoff

Use mu_tempname

1 parent 42ad4962
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......