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
|
/* 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
|
* after it. Return TRUE on success, or FALSE if there are no more open
|
||||||
* file buffers.
|
* buffers. quiet means not to print messages when switching buffers. */
|
||||||
* quiet - should we print messages switching bufers
|
|
||||||
*/
|
|
||||||
bool close_buffer(bool quiet)
|
bool close_buffer(bool quiet)
|
||||||
{
|
{
|
||||||
assert(openfile != NULL);
|
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) +
|
backupname = charalloc(strlen(backup_dir) + strlen(backuptemp) + 1);
|
||||||
strlen(backuptemp) + 1);
|
|
||||||
sprintf(backupname, "%s%s", backup_dir, backuptemp);
|
sprintf(backupname, "%s%s", backup_dir, backuptemp);
|
||||||
free(backuptemp);
|
free(backuptemp);
|
||||||
backuptemp = get_next_filename(backupname, "~");
|
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);
|
tempname = safe_tempfile(&f);
|
||||||
|
|
||||||
if (tempname == NULL) {
|
if (tempname == NULL) {
|
||||||
statusbar(_("Error writing temp file: %s"),
|
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
goto cleanup_and_exit;
|
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) {
|
if (f_source == NULL || copy_file(f_source, f) != 0) {
|
||||||
statusbar(_("Error writing %s: %s"), tempname,
|
statusbar(_("Error writing %s: %s"), tempname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
unlink(tempname);
|
unlink(tempname);
|
||||||
goto cleanup_and_exit;
|
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 we couldn't open the file, give up. */
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
statusbar(_("Error writing %s: %s"), realname,
|
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
|
|
||||||
/* tempname has been set only if we're prepending. */
|
|
||||||
if (tempname != NULL)
|
if (tempname != NULL)
|
||||||
unlink(tempname);
|
unlink(tempname);
|
||||||
goto cleanup_and_exit;
|
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");
|
f = fdopen(fd, (append == APPEND) ? "ab" : "wb");
|
||||||
|
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
statusbar(_("Error writing %s: %s"), realname,
|
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
close(fd);
|
close(fd);
|
||||||
goto cleanup_and_exit;
|
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);
|
unsunder(fileptr->data, data_len);
|
||||||
|
|
||||||
if (size < data_len) {
|
if (size < data_len) {
|
||||||
statusbar(_("Error writing %s: %s"), realname,
|
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
goto cleanup_and_exit;
|
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) {
|
if (f_source == NULL) {
|
||||||
statusbar(_("Error reading %s: %s"), tempname,
|
statusbar(_("Error reading %s: %s"), tempname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
beep();
|
beep();
|
||||||
fclose(f);
|
fclose(f);
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy_file(f_source, f) == -1) {
|
if (copy_file(f_source, f) == -1) {
|
||||||
statusbar(_("Error writing %s: %s"), realname,
|
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(tempname);
|
unlink(tempname);
|
||||||
} else if (fclose(f) != 0) {
|
} else if (fclose(f) != 0) {
|
||||||
statusbar(_("Error writing %s: %s"), realname,
|
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2406,8 +2393,8 @@ int do_writeout(bool exiting)
|
||||||
|
|
||||||
full_answer = get_full_path(answer);
|
full_answer = get_full_path(answer);
|
||||||
full_filename = get_full_path(openfile->filename);
|
full_filename = get_full_path(openfile->filename);
|
||||||
name_exists = (stat((full_answer == NULL) ? answer :
|
name_exists = (stat((full_answer == NULL) ?
|
||||||
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
|
||||||
|
@ -2885,8 +2872,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||||
* only one space after the last column. */
|
* only one space after the last column. */
|
||||||
ncols = (COLS + 1) / (longest_name + 2);
|
ncols = (COLS + 1) / (longest_name + 2);
|
||||||
|
|
||||||
/* Blank the edit window, and print the matches out
|
/* Blank the edit window, and print the matches out there. */
|
||||||
* there. */
|
|
||||||
blank_edit();
|
blank_edit();
|
||||||
wmove(edit, 0, 0);
|
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++) {
|
for (match = 0; match < num_matches; match++) {
|
||||||
char *disp;
|
char *disp;
|
||||||
|
|
||||||
wmove(edit, editline, (longest_name + 2) *
|
wmove(edit, editline, (longest_name + 2) * (match % ncols));
|
||||||
(match % ncols));
|
|
||||||
|
|
||||||
if (match % ncols == 0 &&
|
if (match % ncols == 0 && editline == editwinrows - 1 &&
|
||||||
editline == editwinrows - 1 &&
|
|
||||||
num_matches - match > ncols) {
|
num_matches - match > ncols) {
|
||||||
waddstr(edit, _("(more)"));
|
waddstr(edit, _("(more)"));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue