Commit 09bf4941 09bf49414e21c4c99d840309d9c669b7db344cf5 by Sergey Poznyakoff

Updated calls to mh_format.

(format_str): Use printhdr.
(make_draft): Disable interactive prompting when build_only
flag is set.
1 parent 49bd25f7
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2002 Free Software Foundation, Inc. 2 Copyright (C) 2002,2003 Free Software Foundation, Inc.
3 3
4 GNU Mailutils is free software; you can redistribute it and/or modify 4 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -98,8 +98,8 @@ static char *format_str = ...@@ -98,8 +98,8 @@ static char *format_str =
98 "%<(nonnull)%(void(width))%(putaddr cc: )\\n%>" 98 "%<(nonnull)%(void(width))%(putaddr cc: )\\n%>"
99 "%<{fcc}Fcc: %{fcc}\\n%>" 99 "%<{fcc}Fcc: %{fcc}\\n%>"
100 "%<{subject}Subject: Re: %(unre{subject})\\n%>" 100 "%<{subject}Subject: Re: %(unre{subject})\\n%>"
101 "%(lit)%(concat(in_reply_to))%<(nonnull)%(void(width))%(printstr In-reply-to: )\\n%>" 101 "%(lit)%(concat(in_reply_to))%<(nonnull)%(void(width))%(printhdr In-reply-to: )\\n%>"
102 "%(lit)%(concat(references))%<(nonnull)%(void(width))%(printstr References: )\\n%>" 102 "%(lit)%(concat(references))%<(nonnull)%(void(width))%(printhdr References: )\\n%>"
103 "X-Mailer: MH \\(%(package_string)\\)\\n" 103 "X-Mailer: MH \\(%(package_string)\\)\\n"
104 "--------\n"; 104 "--------\n";
105 105
...@@ -216,7 +216,7 @@ make_draft (mailbox_t mbox, int disp, struct mh_whatnow_env *wh) ...@@ -216,7 +216,7 @@ make_draft (mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
216 struct stat st; 216 struct stat st;
217 217
218 /* First check if the draft exists */ 218 /* First check if the draft exists */
219 if (stat (wh->draftfile, &st) == 0) 219 if (!build_only && stat (wh->draftfile, &st) == 0)
220 { 220 {
221 if (use_draft) 221 if (use_draft)
222 disp = DISP_USE; 222 disp = DISP_USE;
...@@ -258,8 +258,7 @@ make_draft (mailbox_t mbox, int disp, struct mh_whatnow_env *wh) ...@@ -258,8 +258,7 @@ make_draft (mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
258 if (disp == DISP_REPLACE) 258 if (disp == DISP_REPLACE)
259 { 259 {
260 FILE *fp = fopen (wh->file, "w+"); 260 FILE *fp = fopen (wh->file, "w+");
261 char buffer[1024]; 261 char *buf = NULL;
262 #define bufsize sizeof(buffer)
263 262
264 if (!fp) 263 if (!fp)
265 { 264 {
...@@ -267,9 +266,10 @@ make_draft (mailbox_t mbox, int disp, struct mh_whatnow_env *wh) ...@@ -267,9 +266,10 @@ make_draft (mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
267 wh->file, strerror (errno)); 266 wh->file, strerror (errno));
268 exit (1); 267 exit (1);
269 } 268 }
270 mh_format (&format, msg, msgset.list[0], buffer, bufsize); 269 mh_format (&format, msg, msgset.list[0], width, &buf);
271 fprintf (fp, "%s", buffer); 270 fprintf (fp, "%s", buf);
272 fclose (fp); 271 fclose (fp);
272 free (buf);
273 } 273 }
274 274
275 { 275 {
......