diff --git a/edit/ChangeLog b/edit/ChangeLog index 166317886..6087cf266 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,3 +1,8 @@ +2001-10-23 Pavel Roskin + + * edit.c (user_menu): If the error file is missing, treat it as + success. Truncate block file unconditionally. + 2001-10-22 Pavel Roskin * edit.c: Stop using _EDIT_C definition. Move variable diff --git a/edit/edit.c b/edit/edit.c index 61ea071d0..143186d17 100644 --- a/edit/edit.c +++ b/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;