From 34e133bd0e2d5bb4eed5d5091d14d9e6fce1ff2b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 29 May 2024 13:19:20 -0400 Subject: Embed more configuration info in bfs --version --- src/main.c | 1 + src/parse.c | 11 ++++++++++- src/prelude.h | 6 ++++++ src/version.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/version.c (limited to 'src') 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 +// 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" +}; -- cgit v1.2.3