diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-01-11 18:21:13 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-01-11 18:21:13 +0000 |
commit | 78c546d40cff285747ead9c15e5cb5b9496b7164 (patch) | |
tree | a34f5a92d9daa884bdc4548300057d97f4cff230 /mdk-stage1/stdio-frontend.c | |
parent | e7d0a4b83de6168fc5294a605a6c97d2467c4d20 (diff) | |
download | drakx-78c546d40cff285747ead9c15e5cb5b9496b7164.tar drakx-78c546d40cff285747ead9c15e5cb5b9496b7164.tar.gz drakx-78c546d40cff285747ead9c15e5cb5b9496b7164.tar.bz2 drakx-78c546d40cff285747ead9c15e5cb5b9496b7164.tar.xz drakx-78c546d40cff285747ead9c15e5cb5b9496b7164.zip |
- add FTP
- add HTTP
- use single place for mountpoints and static directories
Diffstat (limited to 'mdk-stage1/stdio-frontend.c')
-rw-r--r-- | mdk-stage1/stdio-frontend.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/mdk-stage1/stdio-frontend.c b/mdk-stage1/stdio-frontend.c index 9fe110ca9..277c47da1 100644 --- a/mdk-stage1/stdio-frontend.c +++ b/mdk-stage1/stdio-frontend.c @@ -127,31 +127,42 @@ void remove_wait_message(void) static int size_progress; static int actually_drawn; - +#define PROGRESS_SIZE 60 void init_progression(char *msg, int size) { int i; size_progress = size; - actually_drawn = 0; - printf("%s\n[", msg); - for (i=0; i<60; i++) - printf("."); - printf("]\033[G["); /* only works on ANSI-compatibles */ - fflush(stdout); + printf("%s\n", msg); + if (size) { + printf("["); + actually_drawn = 0; + for (i=0; i<PROGRESS_SIZE; i++) + printf("."); + printf("]\033[G["); /* only works on ANSI-compatibles */ + fflush(stdout); + } } void update_progression(int current_size) { - while ((int)((current_size*60)/size_progress) > actually_drawn) { - printf("*"); - actually_drawn++; - } + if (size_progress) { + while ((int)((current_size*PROGRESS_SIZE)/size_progress) > actually_drawn) { + printf("*"); + actually_drawn++; + } + } else + printf("\033[G%d bytes read", current_size); + fflush(stdout); } void end_progression(void) { - printf("]\n"); + if (size_progress) { + update_progression(size_progress); + printf("]\n"); + } else + printf(" done.\n"); } |