diff options
-rw-r--r-- | src/0001-Added-support-for-long-arguments.patch | 63 | ||||
-rw-r--r-- | src/main.c | 24 | ||||
-rw-r--r-- | src/util.c | 2 |
3 files changed, 77 insertions, 12 deletions
diff --git a/src/0001-Added-support-for-long-arguments.patch b/src/0001-Added-support-for-long-arguments.patch new file mode 100644 index 0000000..aa0d590 --- /dev/null +++ b/src/0001-Added-support-for-long-arguments.patch @@ -0,0 +1,63 @@ +From ac0d9ae25dd487f7cafbda8152753dfe09696399 Mon Sep 17 00:00:00 2001 +From: lovelace <lovelace@kinl.gq> +Date: Wed, 27 Oct 2021 00:59:09 +0000 +Subject: [PATCH] Added support for long arguments + +--- + src/main.c | 32 ++++++++++++++++++++++---------- + 1 file changed, 22 insertions(+), 10 deletions(-) + +diff --git a/src/main.c b/src/main.c +index 4f30290..097fc51 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -41,14 +41,14 @@ usage(const char *progname) + void + help() + { +- puts("-s: status to post"); +- puts("-F: filename to be attatched with the post"); +- puts("-v: The visibility which the post will have, can be: public, " +- "unlisted, private and direct"); +- puts("-f: Follow an account"); +- puts("-u: Unfollow an account"); +- puts("-U: prints usage message"); +- puts("-h: prints this help message"); ++ puts("-s, --status: status to post"); ++ puts("-F, --filename: filename to be attatched with the post"); ++ puts("-v, --visibility: The visibility which the post will have, can" ++ "be: public unlisted, private and direct"); ++ puts("-f, --follow: Follow an account"); ++ puts("-u, --unfollow: Unfollow an account"); ++ puts("-U, --usage: prints usage message"); ++ puts("-h, --help: prints this help message"); + } + + /* prints a string to stderr */ +@@ -79,9 +79,21 @@ main(int argc, char **argv) + return -1; + } + +- while((c = getopt(argc, argv, "s:v:F:f:u:hU")) != -1) { ++ int option_index = 0; ++ static struct option long_options[] = { ++ {"status", required_argument, 0, 's'}, ++ {"filename", required_argument, 0, 'F'}, ++ {"visibility", required_argument, 0, 'v'}, ++ {"follow", required_argument, 0, 'f'}, ++ {"unfollow", required_argument, 0, 'u'}, ++ {"usage", no_argument, 0, 'U'}, ++ {"help", no_argument, 0, 'h'}, ++ {0, 0, 0, 0} ++ }; ++ ++ while((c = getopt_long(argc, argv, "s:v:F:f:u:hU", long_options, &option_index)) != -1) { + switch(c) { +- case 's': ++ case 's': + status = optarg; + break; + case 'v': +-- +2.33.1 + @@ -44,7 +44,7 @@ help() puts("-s, --status: status to post"); puts("-F, --filename: filename to be attatched with the post"); puts("-v, --visibility: The visibility which the post will have, can" - "be: public unlisted, private and direct"); + "be: public unlisted, private and direct"); puts("-f, --follow: Follow an account"); puts("-u, --unfollow: Unfollow an account"); puts("-U, --usage: prints usage message"); @@ -81,19 +81,21 @@ main(int argc, char **argv) int option_index = 0; static struct option long_options[] = { - {"status", required_argument, 0, 's'}, - {"filename", required_argument, 0, 'F'}, - {"visibility", required_argument, 0, 'v'}, - {"follow", required_argument, 0, 'f'}, - {"unfollow", required_argument, 0, 'u'}, - {"usage", no_argument, 0, 'U'}, - {"help", no_argument, 0, 'h'}, - {0, 0, 0, 0} + { "status", required_argument, 0, 's' }, + { "filename", required_argument, 0, 'F' }, + { "visibility", required_argument, 0, 'v' }, + { "follow", required_argument, 0, 'f' }, + { "unfollow", required_argument, 0, 'u' }, + { "usage", no_argument, 0, 'U' }, + { "help", no_argument, 0, 'h' }, + { 0, 0, 0, 0 } }; - while((c = getopt_long(argc, argv, "s:v:F:f:u:hU", long_options, &option_index)) != -1) { + while((c = getopt_long( + argc, argv, "s:v:F:f:u:hU", long_options, &option_index)) != + -1) { switch(c) { - case 's': + case 's': status = optarg; break; case 'v': @@ -136,7 +136,7 @@ load_config(struct config *config) fclose(fp); - return validate_config(config); + return validate_config(config); } size_t |