From 9413eae50c4f1843dc7cab43dc11fe79fd28b744 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Tue, 1 May 2012 08:20:23 +0200 Subject: [PATCH] Minor refactoring. --- uip/send.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/uip/send.c b/uip/send.c index ed4aca0..6be46db 100644 --- a/uip/send.c +++ b/uip/send.c @@ -42,7 +42,7 @@ static FILE *composition_file; /* composition file pointer */ /* ** static prototypes */ -static int sendsbr(char **, int, char *, struct stat *, int); +static int sendsbr(char **, int, char *, struct stat *); static void armed_done(int) NORETURN; static void anno(struct stat *); static int sendaux(char **, int, char *, struct stat *); @@ -248,7 +248,7 @@ main(int argc, char **argv) } for (msgnum = 0; msgnum < nfiles; msgnum++) { - switch (sendsbr(vec, vecp, files[msgnum], &st, 1)) { + switch (sendsbr(vec, vecp, files[msgnum], &st)) { case DONE: done(++status); case NOTOK: @@ -268,7 +268,7 @@ main(int argc, char **argv) ** message sending back-end */ static int -sendsbr(char **vec, int vecp, char *drft, struct stat *st, int rename_drft) +sendsbr(char **vec, int vecp, char *drft, struct stat *st) { int status; char buffer[BUFSIZ]; @@ -308,11 +308,12 @@ sendsbr(char **vec, int vecp, char *drft, struct stat *st, int rename_drft) case OK: status = sendaux(vec, vecp, drft, st) ? NOTOK : OK; /* rename the original draft */ - if (rename_drft && status == OK && - rename(original_draft, strncpy(buffer, - m_backup(original_draft), sizeof(buffer))) - == NOTOK) { - advise(buffer, "unable to rename %s to", drft); + if (status == OK) { + strncpy(buffer, m_backup(original_draft), + sizeof(buffer)); + if (rename(original_draft, buffer) == NOTOK) { + advise(buffer, "unable to rename %s to", drft); + } } break; -- 1.7.10.4