diff options
author | davidovski <david@davidovski.xyz> | 2022-02-11 23:48:29 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-02-11 23:48:29 +0000 |
commit | f090af0af78491efbbe41ef0b888dc7e7304e7fe (patch) | |
tree | a89684e76086d24a2b8603e4a51fce7c747411cd /src/hbar/hbar.c | |
parent | 33e775af4521a4861f3e50c6e11faf754a708824 (diff) |
completed hbar
Diffstat (limited to 'src/hbar/hbar.c')
-rw-r--r-- | src/hbar/hbar.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/hbar/hbar.c b/src/hbar/hbar.c deleted file mode 100644 index 5c90349..0000000 --- a/src/hbar/hbar.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * hbar - * - * create a horizontal progres bar across the screen - */ - -#include <sys/ioctl.h> -#include <stdio.h> -#include <unistd.h> -#include <getopt.h> - -int main (int argc, char **argv) { - struct winsize w; - ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); - int width = w.ws_col; - - char *text; - int total; - int completed; - - int opt; - int option_index = 0; - - const char *optstring = "T:ucr:"; - static const struct option opts[] = { - {"text", required_argument, 0, 'T'}, - {"unit", optional_argument, 0, 'u'}, - {"color", optional_argument, 0, 'c'}, - {"reset", optional_argument, 0, 'r'} - }; - - while ((opt = getopt_long(argc, argv, optstring, opts, &option_index)) != -1) { - switch (opt) { - case 'T': - text = optarg; - } - } - - if (argc < optind + 2) { - fprintf(stderr, "Not enough arguments provided"); - } - - completed = atoi(argv[optind]); - total = atoi(argv[optind+1]); - - char output[width+6] = '\0'; - - return 0; -} - |