diff --git a/misc/badblocks.c b/misc/badblocks.c index 2fc1b0dfe..e1db910c4 100644 --- a/misc/badblocks.c +++ b/misc/badblocks.c @@ -73,6 +73,8 @@ extern int optind; static const char * program_name = "badblocks"; static const char * done_string = N_("done \n"); +static const char * curs_off = "\e[?25l"; +static const char * curs_on = "\e[?25h"; static int v_flag; /* verbose */ static int w_flag; /* do r/w test: 0=no, 1=yes, @@ -125,6 +127,11 @@ static ext2_badblocks_iterate bb_iter = NULL; enum error_types { READ_ERROR, WRITE_ERROR, CORRUPTION_ERROR }; +void cursor_on(void) +{ + fputs(curs_on, stderr); +} + static void *allocate_buffer(size_t size) { void *ret = 0; @@ -1312,6 +1319,9 @@ int main (int argc, char ** argv) else out = stdout; + if (! atexit(cursor_on)) + fputs(curs_off, stderr); + errcode = ext2fs_badblocks_list_create(&bb_list,0); if (errcode) { com_err(program_name, errcode, "%s",