mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* edit.c (user_menu): If the error file is missing, treat it as
success. Truncate block file unconditionally.
This commit is contained in:
parent
b1c57095b2
commit
edf0504087
@ -1,3 +1,8 @@
|
||||
2001-10-23 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* edit.c (user_menu): If the error file is missing, treat it as
|
||||
success. Truncate block file unconditionally.
|
||||
|
||||
2001-10-22 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* edit.c: Stop using _EDIT_C definition. Move variable
|
||||
|
53
edit/edit.c
53
edit/edit.c
@ -2700,31 +2700,38 @@ void user_menu (WEdit *edit)
|
||||
/* run shell scripts from menu */
|
||||
user_menu_cmd (edit);
|
||||
|
||||
if (mc_stat (error_file, &status) == 0) {
|
||||
if (!status.st_size) { /* no error messages */
|
||||
if (mc_stat (block_file, &status) == 0)
|
||||
if (!status.st_size)
|
||||
return; /* no block messages */
|
||||
if (! nomark) /* i.e. we have marked block */
|
||||
rc = edit_block_delete_cmd(edit);
|
||||
if (!rc) {
|
||||
edit_cursor_to_bol (edit);
|
||||
edit_insert_file (edit, block_file);
|
||||
edit_cursor_to_eol (edit);
|
||||
if ((fd = fopen (block_file, "w"))) fclose(fd);
|
||||
}
|
||||
} else { /* it is error */
|
||||
edit_cursor_to_bol (edit);
|
||||
edit_insert_file (edit, error_file);
|
||||
if ((fd = fopen (error_file, "w"))) fclose(fd);
|
||||
if ((fd = fopen (block_file, "w"))) fclose(fd);
|
||||
}
|
||||
if (mc_stat (error_file, &status) != 0 || !status.st_size) {
|
||||
/* no error messages */
|
||||
if (mc_stat (block_file, &status) != 0 || !status.st_size) {
|
||||
/* no block messages */
|
||||
return;
|
||||
}
|
||||
|
||||
if (! nomark) {
|
||||
/* i.e. we have marked block */
|
||||
rc = edit_block_delete_cmd(edit);
|
||||
}
|
||||
|
||||
if (!rc) {
|
||||
edit_cursor_to_bol (edit);
|
||||
edit_insert_file (edit, block_file);
|
||||
edit_cursor_to_eol (edit);
|
||||
}
|
||||
} else {
|
||||
edit_error_dialog ("",
|
||||
get_sys_error (catstrs (_ ("Error trying to stat file:"),
|
||||
error_file, 0)));
|
||||
return;
|
||||
/* error file exists and is not empty */
|
||||
edit_cursor_to_bol (edit);
|
||||
edit_insert_file (edit, error_file);
|
||||
|
||||
/* truncate error file */
|
||||
if ((fd = fopen (error_file, "w")))
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
/* truncate block file */
|
||||
if ((fd = fopen (block_file, "w"))) {
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
edit_refresh_cmd (edit);
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user