tweaks: reshuffle a line, elide two braces, and adjust the indentation
And improve a comment.master
parent
f660f22623
commit
bc14fc35d7
21
src/files.c
21
src/files.c
|
@ -2043,11 +2043,11 @@ bool write_marked_file(const char *name, FILE *stream, bool tmp,
|
||||||
* the buffer is to be discarded. */
|
* the buffer is to be discarded. */
|
||||||
int do_writeout(bool exiting, bool withprompt)
|
int do_writeout(bool exiting, bool withprompt)
|
||||||
{
|
{
|
||||||
kind_of_writing_type method = OVERWRITE;
|
|
||||||
char *given;
|
char *given;
|
||||||
/* The filename we offer, or what the user typed so far. */
|
/* The filename we offer, or what the user typed so far. */
|
||||||
bool maychange = (openfile->filename[0] == '\0');
|
bool maychange = (openfile->filename[0] == '\0');
|
||||||
/* Whether it's okay to save the file under a different name. */
|
/* Whether it's okay to save the file under a different name. */
|
||||||
|
kind_of_writing_type method = OVERWRITE;
|
||||||
#ifdef ENABLE_EXTRA
|
#ifdef ENABLE_EXTRA
|
||||||
static bool did_credits = FALSE;
|
static bool did_credits = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2147,9 +2147,8 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (func == do_help) {
|
if (func == do_help)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_EXTRA
|
#ifdef ENABLE_EXTRA
|
||||||
/* If the user pressed Ctrl-X in the edit window, and answered "Y" at
|
/* If the user pressed Ctrl-X in the edit window, and answered "Y" at
|
||||||
|
@ -2178,6 +2177,7 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
full_filename = get_full_path(openfile->filename);
|
full_filename = get_full_path(openfile->filename);
|
||||||
name_exists = (stat((full_answer == NULL) ?
|
name_exists = (stat((full_answer == NULL) ?
|
||||||
answer : full_answer, &st) != -1);
|
answer : full_answer, &st) != -1);
|
||||||
|
|
||||||
if (openfile->filename[0] == '\0')
|
if (openfile->filename[0] == '\0')
|
||||||
do_warning = name_exists;
|
do_warning = name_exists;
|
||||||
else
|
else
|
||||||
|
@ -2268,16 +2268,15 @@ int do_writeout(bool exiting, bool withprompt)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Here's where we allow the selected text to be written to
|
/* When the mark is on (and we've prompted for a name and we're
|
||||||
* a separate file. If we're using restricted mode, this
|
* not exiting and we're not in restricted mode), then write out
|
||||||
* function is disabled, since it allows reading from or
|
* the marked region; otherwise, write out the whole buffer. */
|
||||||
* writing to files not specified on the command line. */
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark && !exiting && withprompt && !ISSET(RESTRICTED))
|
if (openfile->mark && withprompt && !exiting && !ISSET(RESTRICTED))
|
||||||
return write_marked_file(answer, NULL, FALSE, method);
|
return write_marked_file(answer, NULL, FALSE, method);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
return write_file(answer, NULL, FALSE, method, TRUE);
|
return write_file(answer, NULL, FALSE, method, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the current buffer to disk, or discard it. */
|
/* Write the current buffer to disk, or discard it. */
|
||||||
|
|
Loading…
Reference in New Issue