files: rewrap en reindent some lines
parent
5c5fefc8cf
commit
2815eaa5f8
46
src/files.c
46
src/files.c
|
@ -610,9 +610,7 @@ void switch_to_next_buffer_void(void)
|
|||
|
||||
/* Delete an entry from the openfile filebuffer, and switch to the one
|
||||
* after it. Return TRUE on success, or FALSE if there are no more open
|
||||
* file buffers.
|
||||
* quiet - should we print messages switching bufers
|
||||
*/
|
||||
* buffers. quiet means not to print messages when switching buffers. */
|
||||
bool close_buffer(bool quiet)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
@ -1854,8 +1852,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
}
|
||||
}
|
||||
|
||||
backupname = charalloc(strlen(backup_dir) +
|
||||
strlen(backuptemp) + 1);
|
||||
backupname = charalloc(strlen(backup_dir) + strlen(backuptemp) + 1);
|
||||
sprintf(backupname, "%s%s", backup_dir, backuptemp);
|
||||
free(backuptemp);
|
||||
backuptemp = get_next_filename(backupname, "~");
|
||||
|
@ -2001,8 +1998,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
tempname = safe_tempfile(&f);
|
||||
|
||||
if (tempname == NULL) {
|
||||
statusbar(_("Error writing temp file: %s"),
|
||||
strerror(errno));
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
|
@ -2024,8 +2020,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
}
|
||||
|
||||
if (f_source == NULL || copy_file(f_source, f) != 0) {
|
||||
statusbar(_("Error writing %s: %s"), tempname,
|
||||
strerror(errno));
|
||||
statusbar(_("Error writing %s: %s"), tempname, strerror(errno));
|
||||
unlink(tempname);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
@ -2043,10 +2038,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
|
||||
/* If we couldn't open the file, give up. */
|
||||
if (fd == -1) {
|
||||
statusbar(_("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
|
||||
/* tempname has been set only if we're prepending. */
|
||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||
if (tempname != NULL)
|
||||
unlink(tempname);
|
||||
goto cleanup_and_exit;
|
||||
|
@ -2055,8 +2047,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
f = fdopen(fd, (append == APPEND) ? "ab" : "wb");
|
||||
|
||||
if (f == NULL) {
|
||||
statusbar(_("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||
close(fd);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
@ -2079,8 +2070,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
unsunder(fileptr->data, data_len);
|
||||
|
||||
if (size < data_len) {
|
||||
statusbar(_("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||
fclose(f);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
@ -2131,23 +2121,20 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||
}
|
||||
|
||||
if (f_source == NULL) {
|
||||
statusbar(_("Error reading %s: %s"), tempname,
|
||||
strerror(errno));
|
||||
statusbar(_("Error reading %s: %s"), tempname, strerror(errno));
|
||||
beep();
|
||||
fclose(f);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (copy_file(f_source, f) == -1) {
|
||||
statusbar(_("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
unlink(tempname);
|
||||
} else if (fclose(f) != 0) {
|
||||
statusbar(_("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
|
@ -2406,8 +2393,8 @@ int do_writeout(bool exiting)
|
|||
|
||||
full_answer = get_full_path(answer);
|
||||
full_filename = get_full_path(openfile->filename);
|
||||
name_exists = (stat((full_answer == NULL) ? answer :
|
||||
full_answer, &st) != -1);
|
||||
name_exists = (stat((full_answer == NULL) ?
|
||||
answer : full_answer, &st) != -1);
|
||||
if (openfile->filename[0] == '\0')
|
||||
do_warning = name_exists;
|
||||
else
|
||||
|
@ -2885,8 +2872,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
|||
* only one space after the last column. */
|
||||
ncols = (COLS + 1) / (longest_name + 2);
|
||||
|
||||
/* Blank the edit window, and print the matches out
|
||||
* there. */
|
||||
/* Blank the edit window, and print the matches out there. */
|
||||
blank_edit();
|
||||
wmove(edit, 0, 0);
|
||||
|
||||
|
@ -2896,11 +2882,9 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
|||
for (match = 0; match < num_matches; match++) {
|
||||
char *disp;
|
||||
|
||||
wmove(edit, editline, (longest_name + 2) *
|
||||
(match % ncols));
|
||||
wmove(edit, editline, (longest_name + 2) * (match % ncols));
|
||||
|
||||
if (match % ncols == 0 &&
|
||||
editline == editwinrows - 1 &&
|
||||
if (match % ncols == 0 && editline == editwinrows - 1 &&
|
||||
num_matches - match > ncols) {
|
||||
waddstr(edit, _("(more)"));
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue