diff options
| author | Pavel Vymetálek <pavel@vym.cz> | 2026-10-28 12:42:39 +0100 |
|---|---|---|
| committer | Pavel Vymetálek <pavel@vym.cz> | 2026-10-28 12:42:39 +0100 |
| commit | 7544bf75b51fc3ecd5df306d626e0db6aad13acd (patch) | |
| tree | e865c59e53be9655caf2a0702f0868bfc5ff03f2 | |
| parent | f98353aa76375f8af48ac5d64f4688ca7ca4b155 (diff) | |
| download | sercp-pc-7544bf75b51fc3ecd5df306d626e0db6aad13acd.tar.gz | |
Fix progress bar displaying
| -rw-r--r-- | sercp.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -84,7 +84,7 @@ static int is_osc_progress_supported = -1; // test KDE Konsole static volatile int interrupted = 0; // ctrl+c signalization size_t out_indx; -float width; // width of terminal +int width; // width of terminal long pos = 0; int scp = 0; int is_lfn_enable = 1; @@ -410,7 +410,7 @@ void DoProgress(size_t pos, size_t max, unsigned char progress_mode) { p = pos; m = max; percent = (100 / m * p) + 0.5; - ipercent = percent / 100 * imax; + ipercent = percent / 100.0 * imax; if (is_binary) progress_char = '#'; else progress_char = '='; printf ("Proceed bytes: %6d/%6d [", (int) pos, (int)max); @@ -424,7 +424,7 @@ void DoProgress(size_t pos, size_t max, unsigned char progress_mode) { fprintf(stderr, "\x1b]9;4;1;%d\x07", (int)percent); } } else if (progress_mode == PROGRESS_COMPLETTE) { - printf ("] OK \r"); + // printf ("] OK \r"); if (is_osc_progress_supported) { fprintf(stderr, "\x1b]9;4;0;0\x07"); } @@ -932,8 +932,8 @@ void sercpSend(void) { } blck_num++; } + DoProgress(overall_sent, st.st_size, PROGRESS_COMPLETTE); printf("\nFile sent...\n"); - DoProgress(0, 0, PROGRESS_COMPLETTE); #ifdef __APPLE__ // FIXME on __APPLE__ this waiting helps sleep_ms(wait_ms); |
