From 19f4248b19f06a26693f610490ae50c7d26a3bc6 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Tamotsu Date: Mon, 3 Oct 2005 07:52:00 +0000 Subject: [PATCH] fix a problem that appears with signatures without newline. --- curs_lib.c | 14 -------------- send.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/curs_lib.c b/curs_lib.c index 6939e0f9..0622dba9 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -156,19 +156,6 @@ void mutt_clear_error (void) CLEARLINE (LINES-1); } -static void fix_end_of_file (const char *data) -{ - FILE *fp; - int c; - - if ((fp = safe_fopen (data, "a+")) == NULL) - return; - fseek (fp,-1,SEEK_END); - if ((c = fgetc(fp)) != '\n') - fputc ('\n', fp); - safe_fclose (&fp); -} - void mutt_edit_file (const char *editor, const char *data) { char cmd[LONG_STRING]; @@ -177,7 +164,6 @@ void mutt_edit_file (const char *editor, const char *data) mutt_expand_file_fmt (cmd, sizeof (cmd), editor, data); if (mutt_system (cmd) == -1) mutt_error (_("Error running \"%s\"!"), cmd); - fix_end_of_file (data); keypad (stdscr, TRUE); clearok (stdscr, TRUE); } diff --git a/send.c b/send.c index 84e395e8..c74dc760 100644 --- a/send.c +++ b/send.c @@ -1033,6 +1033,19 @@ static void decode_descriptions (BODY *b) } } +static void fix_end_of_file (const char *data) +{ + FILE *fp; + int c; + + if ((fp = safe_fopen (data, "a+")) == NULL) + return; + fseek (fp,-1,SEEK_END); + if ((c = fgetc(fp)) != '\n') + fputc ('\n', fp); + safe_fclose (&fp); +} + int mutt_resend_message (FILE *fp, CONTEXT *ctx, HEADER *cur) { HEADER *msg = mutt_new_header (); @@ -1393,7 +1406,16 @@ ci_send_message (int flags, /* send mode */ mutt_env_to_idna (msg->env, NULL, NULL); } else + { mutt_edit_file (Editor, msg->content->filename); + if (stat (msg->content->filename, &st) == 0) + { + if (mtime != st.st_mtime) + fix_end_of_file (msg->content->filename); + } + else + mutt_perror (msg->content->filename); + } mutt_message_hook (NULL, msg, M_SEND2HOOK); } -- 2.40.0