From 7bba6cd7612293796e905885f9ed3072877798ab Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 27 Jun 2022 01:14:42 +0100 Subject: added shmk, building all with shmk --- src/hbar.c | 171 ------------------------------------------------------------- 1 file changed, 171 deletions(-) delete mode 100644 src/hbar.c (limited to 'src/hbar.c') diff --git a/src/hbar.c b/src/hbar.c deleted file mode 100644 index 59cf888..0000000 --- a/src/hbar.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * hbar - * - * create a horizontal progres bar across the screen - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "colors.h" - -#define DEFAULT_COLOR BLACK BG_WHITE -#define DEFAULT_RESET WHITE BG_DEFAULT - -#define SAVE_POS "\033[s" -#define LOAD_POS "\033[u" - -void human_format(int bytes, char *output) { - char *suffix[] = {"B", "KB", "MB", "GB", "TB"}; - char length = sizeof(suffix) / sizeof(suffix[0]); - - int i = 0; - double dblBytes = bytes; - - if (bytes > 1024) { - for (i = 0; (bytes / 1024) > 0 && i 0) { - float percent = (float) completed / (float) total; - reset_at = percent * width; - } - - if (i == reset_at) { - printf(reset); - } - - if (text && i < len(text)) { - printat(text, i); - } else if (i + 1 > width - len(count)) { - printat(count, i - width + len(count)); - } else { - printf(" "); - } - } - - if (line != -1) { - printf("\033[%dB", line); - } - if (terminate) { - printf(RESET "\n"); - } - - return 0; -} - -- cgit v1.2.1