mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Clear the screen before printing stats
This commit is contained in:
parent
252d613eae
commit
11a8e301f4
4 changed files with 34 additions and 0 deletions
|
|
@ -271,6 +271,28 @@ void os_abort(void)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void os_clear(void)
|
||||
{
|
||||
HANDLE console;
|
||||
CONSOLE_SCREEN_BUFFER_INFO screen;
|
||||
COORD coord;
|
||||
DWORD written;
|
||||
|
||||
/* get the console */
|
||||
console = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (console == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
|
||||
/* get the screen size */
|
||||
if (!GetConsoleScreenBufferInfo(console, &screen))
|
||||
return;
|
||||
|
||||
/* fill the screen with spaces */
|
||||
coord.X = 0;
|
||||
coord.Y = 0;
|
||||
FillConsoleOutputCharacterA(console, ' ', screen.dwSize.X * screen.dwSize.Y, coord, &written);
|
||||
}
|
||||
|
||||
/**
|
||||
* Size in chars of conversion buffers for u8to16() and u16to8().
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -352,6 +352,11 @@ void os_done(void);
|
|||
*/
|
||||
void os_abort(void) __noreturn;
|
||||
|
||||
/**
|
||||
* Clear the screen.
|
||||
*/
|
||||
void os_clear(void);
|
||||
|
||||
/**
|
||||
* Log file.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -4018,6 +4018,7 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
|
|||
out_eta = (countmax - countpos) * delta_time / (60 * delta_pos);
|
||||
|
||||
if (msg_level >= MSG_VERBOSE) {
|
||||
os_clear();
|
||||
state_usage_graph(state, io, state->progress_ptr, oldest);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1226,5 +1226,11 @@ void os_abort(void)
|
|||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
void os_clear(void)
|
||||
{
|
||||
/* ANSI code for clear screen */
|
||||
printf("\033[2J");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue