nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit aeae4fb4b915eb47f149499640b636a283b6c352
parent bc22b3c876c10d66d1a481c52252deb0c830a9fb
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu,  7 Oct 2021 19:03:26 +0200

tweaks: reshuffle some lines, one for clarity, others for conciseness

Diffstat:
Msrc/files.c | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -2116,9 +2116,10 @@ int do_writeout(bool exiting, bool withprompt) #endif while (TRUE) { - int response = 0, choice = 0; functionptrtype func; const char *msg; + int response = 0; + int choice = 0; #ifndef NANO_TINY const char *formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") : (openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : ""; @@ -2193,17 +2194,15 @@ int do_writeout(bool exiting, bool withprompt) } else if (func == backup_file_void) { TOGGLE(MAKE_BACKUP); continue; - } else if (func == prepend_void) { - if (strcmp(answer, openfile->filename) == 0) - given[0] = '\0'; - method = (method == PREPEND) ? OVERWRITE : PREPEND; - continue; - } else if (func == append_void) { + } else if (func == prepend_void || func == append_void) { + if (func == prepend_void) + method = (method == PREPEND) ? OVERWRITE : PREPEND; + else + method = (method == APPEND) ? OVERWRITE : APPEND; if (strcmp(answer, openfile->filename) == 0) given[0] = '\0'; - method = (method == APPEND) ? OVERWRITE : APPEND; continue; - } + } else #endif if (func == do_help) continue;