- Rearrange the NANO_SMALL #ifdef so that the code to set the
MODIFIED flag in open_files->flags is included only once.
(DLR)
+ write_marked()
+ - Call write_file() with nonamechange set to TRUE so that we
+ don't erroneously change the current filename when writing a
+ selection, and don't take a nonamechange parameter anymore
+ since we don't use it. (DLR)
do_writeout()
- Refactor so that no recursion is needed if we try to exit with
a modified file that has no name when TEMP_OPT is set. (DLR)
- Since all of the calls to finish() use 0 for the value of
sigage, and the return value of finish() is never used, make
it accept and return void. (David Benbennick)
+ die_save_file()
+ - Call write_file() with nonamechange set to TRUE since we don't
+ need to change the current filename if we're writing emergency
+ backup files. (DLR)
do_early_abort()
- Removed, as it's no longer called anywhere. (David Benbennick)
open_pipe()
* append == 1 means we are appending instead of overwriting.
* append == 2 means we are prepending instead of overwriting.
*
- * nonamechange means don't change the current filename, it is ignored
- * if tmp is nonzero or if we're appending/prepending.
+ * nonamechange means don't change the current filename. It is ignored
+ * if tmp is FALSE or if we're appending/prepending.
*
* Return -1 on error, 1 on success. */
int write_file(const char *name, int tmp, int append, int nonamechange)
#ifndef NANO_SMALL
/* Write a marked selection from a file out. First, set fileage and
* filebot as the top and bottom of the mark, respectively. Then call
- * write_file() with the values of name, temp, append, and nonamechange.
- * Finally, set fileage and filebot back to their old values and
- * return. */
-int write_marked(const char *name, int tmp, int append, int
- nonamechange)
+ * write_file() with the values of name, temp, and append, and with
+ * nonamechange set to TRUE so that we don't change the current
+ * filename. Finally, set fileage and filebot back to their old values
+ * and return. */
+int write_marked(const char *name, int tmp, int append)
{
int retval = -1;
filestruct *fileagebak = fileage;
if (filebot->data[0] != '\0' && filebot->next != NULL)
filebot = filebot->next;
- retval = write_file(name, tmp, append, nonamechange);
+ retval = write_file(name, tmp, append, TRUE);
/* Now restore everything. */
fileage->data -= topx;
/* Here's where we allow the selected text to be written to
* a separate file. */
if (!ISSET(RESTRICTED) && !exiting && ISSET(MARK_ISSET))
- i = write_marked(answer, FALSE, append, FALSE);
+ i = write_marked(answer, FALSE, append);
else
#endif /* !NANO_SMALL */
i = write_file(answer, FALSE, append, FALSE);
free(buf);
}
if (ret[0] != '\0')
- i = write_file(ret, 1, 0, 0);
+ i = write_file(ret, TRUE, FALSE, TRUE);
if (i != -1)
fprintf(stderr, _("\nBuffer written to %s\n"), ret);
#ifndef NANO_SMALL
if (ISSET(MARK_ISSET))
- i = write_marked(temp, 1, 0, 0);
+ i = write_marked(temp, TRUE, FALSE);
else
#endif
- i = write_file(temp, 1, 0, 0);
+ i = write_file(temp, TRUE, FALSE, FALSE);
if (i == -1) {
statusbar(_("Unable to write temp file: %s"), strerror(errno));
#endif
int write_file(const char *name, int tmp, int append, int nonamechange);
#ifndef NANO_SMALL
-int write_marked(const char *name, int tmp, int append, int
- nonamechange);
+int write_marked(const char *name, int tmp, int append);
#endif
int do_writeout(int exiting);
int do_writeout_void(void);