summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-01-08 19:22:07 +0100
committerxengineering <me@xengineering.eu>2023-01-08 19:22:07 +0100
commit62ea56e48aa4026fe7f7f91d528d433220a87be7 (patch)
tree6cf7fd42fc300d5b675ad880c5e23d1d71cf7ab3
parented58cf39d6d2d10a28033c93a4cb00fa2db26591 (diff)
downloadlimox-62ea56e48aa4026fe7f7f91d528d433220a87be7.tar
limox-62ea56e48aa4026fe7f7f91d528d433220a87be7.tar.zst
limox-62ea56e48aa4026fe7f7f91d528d433220a87be7.zip
Update code style for main
-rw-r--r--main.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/main.c b/main.c
index 1bde997..88cfec1 100644
--- a/main.c
+++ b/main.c
@@ -24,21 +24,23 @@
#include "gui.h"
-// configuration struct for all command line options
+/*
+ * Configuration struct for all options
+ */
typedef struct options {
bool unknown;
bool help;
} Options;
-// parses all command line arguments.
-static void get_opts(Options* opts, int argc, char* argv[]) {
-
- // initialize Options struct
+/*
+ * Parse command line arguments
+ */
+static void get_opts(Options* opts, int argc, char* argv[])
+{
opts->unknown = false;
opts->help = false;
- // parse all arguments to Options struct
int c;
while ((c=getopt(argc, argv, "h")) != -1) {
@@ -52,9 +54,11 @@ static void get_opts(Options* opts, int argc, char* argv[]) {
}
}
-// prints out the help page.
-static void print_help(void) {
-
+/*
+ * Print help page to command line
+ */
+static void print_help(void)
+{
printf(
"The Linux on mobile XMPP (LimoX) client.\n"
"\n"
@@ -63,20 +67,19 @@ static void print_help(void) {
"Options:\n"
" -h print help page\n"
);
-
}
-int main(int argc, char* argv[]) {
-
- // parse command line options
+/*
+ * Run control flow of the application
+ */
+int main(int argc, char* argv[])
+{
Options opts;
get_opts(&opts, argc, argv);
- // handle correct use case
if (opts.unknown || opts.help) {
print_help();
} else {
gui_run();
}
-
}