nano

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

commit 7127857924b228f77fa6ea3d398823c4a0094e6f
parent b7cb6a38c8f818b91a41f6f23ab36eca2749ca16
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Fri, 31 Oct 2003 17:58:44 +0000

prompt before saving the current file under a different name


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1581 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 6+++++-
Msrc/files.c | 11+++++++----
2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,9 @@ CVS code - -search.c: +- files.c: + do_writeout() + - Prompt the user if we're trying to save an existing file under + a different name. (DLR; suggested by Jean-Philippe Guérard) +- search.c: do_replace_loop() - Fix potential infinite loop when doing a forward regex replace of "$". (DLR; found by Mike Frysinger) diff --git a/src/files.c b/src/files.c @@ -1834,12 +1834,15 @@ int do_writeout(const char *path, int exiting, int append) if (append == 0 && strcmp(answer, filename)) { struct stat st; - if (!stat(answer, &st)) { + if (!stat(answer, &st)) i = do_yesno(0, 0, _("File exists, OVERWRITE ?")); + else if (filename[0] != '\0') + i = do_yesno(0, 0, _("Save file under DIFFERENT NAME ?")); + else + i = 1; - if (i == 0 || i == -1) - continue; - } + if (i == 0 || i == -1) + continue; } #ifndef NANO_SMALL