aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/console.c19
-rw-r--r--src/console.h3
-rw-r--r--src/serdi.c21
3 files changed, 24 insertions, 19 deletions
diff --git a/src/console.c b/src/console.c
index a15c8e7d..4a127c3e 100644
--- a/src/console.c
+++ b/src/console.c
@@ -3,6 +3,8 @@
#include "console.h"
+#include "serd/serd.h"
+
#ifdef _WIN32
# ifdef _MSC_VER
# define WIN32_LEAN_AND_MEAN 1
@@ -20,3 +22,20 @@ serd_set_stream_utf8_mode(FILE* const stream)
(void)stream;
#endif
}
+
+int
+serd_print_version(const char* const program)
+{
+ printf("%s %d.%d.%d <http://drobilla.net/software/serd>\n",
+ program,
+ SERD_MAJOR_VERSION,
+ SERD_MINOR_VERSION,
+ SERD_MICRO_VERSION);
+
+ printf("Copyright 2011-2023 David Robillard <d@drobilla.net>.\n"
+ "License: <http://www.opensource.org/licenses/isc>\n"
+ "This is free software; you are free to change and redistribute it.\n"
+ "There is NO WARRANTY, to the extent permitted by law.\n");
+
+ return 0;
+}
diff --git a/src/console.h b/src/console.h
index ff21e442..65b041ba 100644
--- a/src/console.h
+++ b/src/console.h
@@ -5,3 +5,6 @@
void
serd_set_stream_utf8_mode(FILE* stream);
+
+int
+serd_print_version(const char* program);
diff --git a/src/serdi.c b/src/serdi.c
index bc68e591..fd7fdb15 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -13,7 +13,6 @@
#include "serd/stream.h"
#include "serd/string_view.h"
#include "serd/syntax.h"
-#include "serd/version.h"
#include "serd/world.h"
#include "serd/writer.h"
@@ -29,22 +28,6 @@
#define MAX_DEPTH 128U
static int
-print_version(void)
-{
- printf("serdi %d.%d.%d <http://drobilla.net/software/serd>\n",
- SERD_MAJOR_VERSION,
- SERD_MINOR_VERSION,
- SERD_MICRO_VERSION);
-
- printf("Copyright 2011-2023 David Robillard <d@drobilla.net>.\n"
- "License ISC: <https://spdx.org/licenses/ISC>.\n"
- "This is free software; you are free to change and redistribute it."
- "\nThere is NO WARRANTY, to the extent permitted by law.\n");
-
- return 0;
-}
-
-static int
print_usage(const char* const name, const bool error)
{
static const char* const description =
@@ -120,7 +103,7 @@ main(int argc, char** argv)
}
if (!strcmp(argv[a], "--version")) {
- return print_version();
+ return serd_print_version(argv[0]);
}
for (int o = 1; argv[a][o]; ++o) {
@@ -144,7 +127,7 @@ main(int argc, char** argv)
} else if (opt == 't') {
writer_flags |= SERD_WRITE_TERSE;
} else if (opt == 'v') {
- return print_version();
+ return serd_print_version(argv[0]);
} else if (opt == 's') {
from_string = true;
break;