From 6f592e3f4abced46f70c011cedf02f75767988bd Mon Sep 17 00:00:00 2001 From: Guaxinim5573 Date: Wed, 31 Mar 2021 12:47:07 -0300 Subject: [PATCH] Add long options support --- uwufetch.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/uwufetch.c b/uwufetch.c index 70e5e1c..6f12a8b 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -57,8 +58,17 @@ void remove_brackets(char*); int main(int argc, char *argv[]) { int opt = 0; + static struct option long_options[] = { + {"ascii", no_argument, NULL, 'a'}, + {"custom", required_argument, NULL, 'c'}, + {"distro", required_argument, NULL, 'd'}, + {"help", no_argument, NULL, 'h'}, + {"image", no_argument, NULL, 'i'}, + {"list", no_argument, NULL, 'l'}, + {NULL, 0, NULL, 0} + }; get_info(); - while((opt = getopt(argc, argv, "ad:hilc:")) != -1) { + while((opt = getopt_long(argc, argv, "ad:hilc:", long_options, NULL)) != -1) { switch(opt) { case 'a': a_i_flag = 0;