summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-05-29 13:19:20 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-06-08 12:36:30 -0400
commit34e133bd0e2d5bb4eed5d5091d14d9e6fce1ff2b (patch)
tree2abf64518759de4a84d4ac08e218021e9643d3f8 /src
parent778295321928767552ebc577f15e88c17da4c1c9 (diff)
downloadbfs-34e133bd0e2d5bb4eed5d5091d14d9e6fce1ff2b.tar.xz
Embed more configuration info in bfs --version
Diffstat (limited to 'src')
-rw-r--r--src/main.c1
-rw-r--r--src/parse.c11
-rw-r--r--src/prelude.h6
-rw-r--r--src/version.c28
4 files changed, 45 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 5dd88e4..6f23034 100644
--- a/src/main.c
+++ b/src/main.c
@@ -41,6 +41,7 @@
* - thread.h (multi-threading)
* - trie.[ch] (a trie set/map implementation)
* - typo.[ch] (fuzzy matching for typos)
+ * - version.c (embeds version information)
* - xregex.[ch] (regular expression support)
* - xspawn.[ch] (spawns processes)
* - xtime.[ch] (date/time handling utilities)
diff --git a/src/parse.c b/src/parse.c
index 8e454e4..a626391 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -2958,7 +2958,16 @@ static struct bfs_expr *parse_help(struct bfs_parser *parser, int arg1, int arg2
static struct bfs_expr *parse_version(struct bfs_parser *parser, int arg1, int arg2) {
cfprintf(parser->ctx->cout, "${ex}%s${rs} ${bld}%s${rs}\n\n", BFS_COMMAND, bfs_version);
- printf("%s\n", BFS_HOMEPAGE);
+ printf("Copyright © Tavian Barnes and the bfs contributors\n");
+ printf("No rights reserved (https://opensource.org/license/0BSD)\n\n");
+
+ printf("CONFIG := %s\n", bfs_config);
+ printf("CPPFLAGS := %s\n", bfs_cppflags);
+ printf("CFLAGS := %s\n", bfs_cflags);
+ printf("LDFLAGS := %s\n", bfs_ldflags);
+ printf("LDLIBS := %s\n", bfs_ldlibs);
+
+ printf("\n%s\n", BFS_HOMEPAGE);
parser->just_info = true;
return NULL;
diff --git a/src/prelude.h b/src/prelude.h
index 0944df1..faa84ec 100644
--- a/src/prelude.h
+++ b/src/prelude.h
@@ -40,6 +40,12 @@
// when the version number changes
extern const char bfs_version[];
+extern const char bfs_config[];
+extern const char bfs_cppflags[];
+extern const char bfs_cflags[];
+extern const char bfs_ldflags[];
+extern const char bfs_ldlibs[];
+
// Check for system headers
#ifdef __has_include
diff --git a/src/version.c b/src/version.c
new file mode 100644
index 0000000..e2d4c87
--- /dev/null
+++ b/src/version.c
@@ -0,0 +1,28 @@
+// Copyright © Tavian Barnes <tavianator@tavianator.com>
+// SPDX-License-Identifier: 0BSD
+
+#include "prelude.h"
+
+const char bfs_version[] = {
+#include "version.i"
+};
+
+const char bfs_config[] = {
+#include "config.i"
+};
+
+const char bfs_cppflags[] = {
+#include "cppflags.i"
+};
+
+const char bfs_cflags[] = {
+#include "cflags.i"
+};
+
+const char bfs_ldflags[] = {
+#include "ldflags.i"
+};
+
+const char bfs_ldlibs[] = {
+#include "ldlibs.i"
+};