]> git.wh0rd.org Git - nano.git/commitdiff
prompt before saving the current file under a different name
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 31 Oct 2003 17:58:44 +0000 (17:58 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 31 Oct 2003 17:58:44 +0000 (17:58 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1581 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/files.c

index 6fa836d70d1985b5f4821af806f267c139ca39ce..c52b99e176bab7178f52ab4f749157fc4ea3fb29 100644 (file)
--- 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)
index af19dc51038fca3a8890341610d0a68286278031..dd1def3dc726f7330f8ff4fdf01e5b25b6aadaba 100644 (file)
@@ -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