aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/server_main.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-04-29 21:42:33 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-04-29 21:42:33 +0200
commit8b4ad891dce51baa3fb306c617f3368d24600e6d (patch)
tree065cbaee51791d3a35f15547a3c3ff77c97db83a /src/server_main.c
parentmake struct storage_settings_sqlite opaque (diff)
downloadcimple-8b4ad891dce51baa3fb306c617f3368d24600e6d.tar.gz
cimple-8b4ad891dce51baa3fb306c617f3368d24600e6d.zip
dedupe command line routines
Diffstat (limited to 'src/server_main.c')
-rw-r--r--src/server_main.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/server_main.c b/src/server_main.c
index 4295b2d..02304b2 100644
--- a/src/server_main.c
+++ b/src/server_main.c
@@ -5,12 +5,11 @@
* Distributed under the MIT License.
*/
+#include "cmd_line.h"
#include "const.h"
#include "server.h"
#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
static struct settings default_settings()
{
@@ -18,28 +17,9 @@ static struct settings default_settings()
return settings;
}
-static void exit_with_usage(int ec, const char *argv0)
+const char *get_usage_string()
{
- FILE *dest = stdout;
- if (ec)
- dest = stderr;
-
- fprintf(dest, "usage: %s [-h|--help] [-V|--version] [-p|--port PORT] [-s|--sqlite PATH]\n",
- argv0);
- exit(ec);
-}
-
-static void exit_with_usage_err(const char *argv0, const char *msg)
-{
- if (msg)
- fprintf(stderr, "usage error: %s\n", msg);
- exit_with_usage(1, argv0);
-}
-
-static void exit_with_version()
-{
- printf("%s\n", VERSION);
- exit(0);
+ return "[-h|--help] [-V|--version] [-p|--port PORT] [-s|--sqlite PATH]";
}
static int parse_settings(struct settings *settings, int argc, char *argv[])