1
0

make use of C-Argh library (#5)

This commit is contained in:
Intel A80486DX2-66 2023-11-21 19:06:12 +03:00
parent 27a3ac1fe3
commit 3517473605
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -7,6 +7,9 @@
#include <string.h>
#include <time.h>
// libraries
#include "../lib/c-argh/argh.h"
// constants
#if defined(_WIN32)
# define __ANSI_CLEAR_STRING "\r"
@ -85,14 +88,17 @@ bytebeat(long double w)
;
}
#define USAGE "render_bytebeat [-s | --silent] [-d | --debug]"
int
main(int argc, char** argv)
{
// * parse CLI arguments
silent_mode = argc > 1 && argv[1] != NULL &&
(!strcmp(argv[1], "-s") || !strcmp(argv[1], "--silent"));
debug_mode = argc > 1 && argv[1] != NULL &&
(!strcmp(argv[1], "-d") || !strcmp(argv[1], "--debug"));
ARGH_PARSE {
ARGH_NEXT();
if ARGH_BOOL("-s", "--silent") { silent_mode = true; }
else if ARGH_BOOL("-d", "--debug") { debug_mode = true; }
}
// * log -> welcome
printf(":: C bytebeat generator runtime unit\n");