nano

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

commit f82eefa303368a2eb30d5bef7974645b6051f8a4
parent 8e1ce7034d03c10ee7854e7874e3d18ec64e75bc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 24 Jul 2018 19:31:03 +0200

tweaks: exclude the file-prepending code from the tiny version

The prepending and appending toggles are not available in tiny nano,
so there is no need to have the code either.

Diffstat:
Msrc/files.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/files.c b/src/files.c @@ -1782,6 +1782,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, umask(original_umask); } +#ifndef NANO_TINY /* If we're prepending, copy the file to a temp file. */ if (method == PREPEND) { int fd_source; @@ -1828,6 +1829,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, goto cleanup_and_exit; } } +#endif /* !NANO_TINY */ if (f_open == NULL) { /* Now open the file in place. Use O_EXCL if tmp is TRUE. This @@ -1909,6 +1911,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, lineswritten++; } +#ifndef NANO_TINY /* If we're prepending, open the temp file, and append it to f. */ if (method == PREPEND) { int fd_source; @@ -1936,7 +1939,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp, } unlink(tempname); - } else if (fclose(f) != 0) { + } else +#endif + if (fclose(f) != 0) { statusline(ALERT, _("Error writing %s: %s"), realname, strerror(errno)); goto cleanup_and_exit;