aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqorg11 <qorg@vxempire.xyz>2021-10-27 03:07:48 +0200
committerqorg11 <qorg@vxempire.xyz>2021-10-27 03:07:48 +0200
commitcb3161ee77f444c190bb41f2d9c2b06bc2d7180e (patch)
tree58add92c073e7a7b6e0115ac018287a4e462ca11
parent8309515c96f75124a718fb8ed599353d5804e2f7 (diff)
downloaddemiurge-cb3161ee77f444c190bb41f2d9c2b06bc2d7180e.tar.gz
demiurge-cb3161ee77f444c190bb41f2d9c2b06bc2d7180e.zip
fix style
-rw-r--r--src/0001-Added-support-for-long-arguments.patch63
-rw-r--r--src/main.c24
-rw-r--r--src/util.c2
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
+
diff --git a/src/main.c b/src/main.c
index 097fc51..3b03672 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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':
diff --git a/src/util.c b/src/util.c
index dadd931..b460c04 100644
--- a/src/util.c
+++ b/src/util.c
@@ -136,7 +136,7 @@ load_config(struct config *config)
fclose(fp);
- return validate_config(config);
+ return validate_config(config);
}
size_t