tweaks: move a function to a more logical place

Initialization should come first.
master
Benno Schulenberg 2020-05-29 17:12:45 +02:00
parent 6b4e7d0f78
commit e1f80b9707
1 changed files with 15 additions and 14 deletions

View File

@ -1475,20 +1475,6 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp)
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
/* Although this sucks, it sucks less than having a single 'my system is
* messed up and I'm blanket allowing insecure file writing operations'. */
bool user_wants_to_proceed(void)
{
warn_and_briefly_pause(strerror(errno));
if (errno == ENOSPC) {
currmenu = MMOST;
return FALSE;
} else
return (do_yesno_prompt(FALSE, _("Cannot make backup; "
"continue and save actual file? ")) == 1);
}
/* Transform the specified backup directory to an absolute path, /* Transform the specified backup directory to an absolute path,
* and verify that it is usable. */ * and verify that it is usable. */
void init_backup_dir(void) void init_backup_dir(void)
@ -1503,6 +1489,21 @@ void init_backup_dir(void)
free(backup_dir); free(backup_dir);
backup_dir = charealloc(target, strlen(target) + 1); backup_dir = charealloc(target, strlen(target) + 1);
} }
/* Report the reason why the backup failed and ask what to do. Return TRUE
* when the user wants to save the file itself anyway. But refuse to go on
* if the backup failed due to a lack of space. */
bool user_wants_to_proceed(void)
{
warn_and_briefly_pause(strerror(errno));
if (errno == ENOSPC) {
currmenu = MMOST;
return FALSE;
} else
return (do_yesno_prompt(FALSE, _("Cannot make backup; "
"continue and save the file? ")) == 1);
}
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
/* Read all data from inn, and write it to out. File inn must be open for /* Read all data from inn, and write it to out. File inn must be open for