From b8a6765874054e3f3966896a8763f7352d9ff8f1 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Tue, 12 Dec 2000 21:49:14 +0000 Subject: progressbar for newt+stdio while loading ramdisk --- mdk-stage1/stdio-frontend.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mdk-stage1/stdio-frontend.c') diff --git a/mdk-stage1/stdio-frontend.c b/mdk-stage1/stdio-frontend.c index bb6755176..ec448224a 100644 --- a/mdk-stage1/stdio-frontend.c +++ b/mdk-stage1/stdio-frontend.c @@ -106,6 +106,37 @@ void remove_wait_message(void) } +static int size_progress; +static int actually_drawn; + +void init_progression(char *msg, int size) +{ + size_progress = size; + actually_drawn = 0; + printf("%s\n[", msg); +} + +void update_progression(int current_size) +{ + while ((int)((current_size*40)/size_progress) > actually_drawn) { + printf("."); + actually_drawn++; + if (actually_drawn == 10) + printf("(25%%)"); + if (actually_drawn == 20) + printf("(50%%)"); + if (actually_drawn == 30) + printf("(75%%)"); + } + fflush(stdout); +} + +void end_progression(void) +{ + printf("]\n"); +} + + enum return_type ask_from_list_comments(char *msg, char ** elems, char ** elems_comments, char ** choice) { char ** sav_elems = elems; -- cgit v1.2.1