aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/console.c19
-rw-r--r--src/console.h3
-rw-r--r--src/serdi.c18
3 files changed, 23 insertions, 17 deletions
diff --git a/src/console.c b/src/console.c
index 92c8bd71..75de5f62 100644
--- a/src/console.c
+++ b/src/console.c
@@ -16,6 +16,8 @@
#include "console.h"
+#include "serd/serd.h"
+
#ifdef _WIN32
# ifdef _MSC_VER
# define WIN32_LEAN_AND_MEAN 1
@@ -33,3 +35,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-2022 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 73168e11..11b8e828 100644
--- a/src/console.h
+++ b/src/console.h
@@ -18,3 +18,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 51ae084e..890408d2 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -37,22 +37,6 @@ typedef struct {
} FilterPattern;
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-2021 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."
- "\nThere is NO WARRANTY, to the extent permitted by law.\n");
-
- return 0;
-}
-
-static int
print_usage(const char* const name, const bool error)
{
FILE* const os = error ? stderr : stdout;
@@ -258,7 +242,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 == 'x') {
reader_flags |= SERD_READ_VARIABLES;
} else if (argv[a][1] == 'F') {