git: 0380d016d9ba - main - libbsdconf: independent version macros
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Sep 2026 21:40:49 UTC
The branch main has been updated by dteske:
URL: https://cgit.FreeBSD.org/src/commit/?id=0380d016d9ba407af12eb743b7c5806d49ddf848
commit 0380d016d9ba407af12eb743b7c5806d49ddf848
Author: Devin Teske <dteske@FreeBSD.org>
AuthorDate: 2026-09-16 21:37:16 +0000
Commit: Devin Teske <dteske@FreeBSD.org>
CommitDate: 2026-09-16 21:37:16 +0000
libbsdconf: independent version macros
sysconf(8) --version now prints the library version alongside its
own so each can move on its own clock. Assigning a bitmask to
bool already converts zero/nonzero; drop the redundant != 0 (fuz).
Reviewed by: fuz, kfv
Differential Revision: https://reviews.freebsd.org/D59720
---
lib/libbsdconf/bsdconf.c | 12 ++++++------
lib/libbsdconf/bsdconf.h | 8 ++++++++
lib/libbsdconf/bsdconf_put.c | 22 +++++++++++-----------
usr.sbin/sysconf/sysconf.8 | 8 ++++++--
usr.sbin/sysconf/sysconf.c | 5 +++--
usr.sbin/sysconf/sysconf_priv.h | 2 +-
6 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/lib/libbsdconf/bsdconf.c b/lib/libbsdconf/bsdconf.c
index 341fad9b841c..07a03a656dbc 100644
--- a/lib/libbsdconf/bsdconf.c
+++ b/lib/libbsdconf/bsdconf.c
@@ -420,12 +420,12 @@ bsdconf_fparse(struct bsdconf_option options[], int fd,
}
/* Processing options */
- bequals = (processing_options & BSDCONF_BREAK_ON_EQUALS) != 0;
- bsemicolon = (processing_options & BSDCONF_BREAK_ON_SEMICOLON) != 0;
- case_sensitive = (processing_options & BSDCONF_CASE_SENSITIVE) != 0;
- operator_equals = (processing_options & BSDCONF_OPERATOR_EQUALS) != 0;
- require_equals = (processing_options & BSDCONF_REQUIRE_EQUALS) != 0;
- strict_equals = (processing_options & BSDCONF_STRICT_EQUALS) != 0;
+ bequals = (processing_options & BSDCONF_BREAK_ON_EQUALS);
+ bsemicolon = (processing_options & BSDCONF_BREAK_ON_SEMICOLON);
+ case_sensitive = (processing_options & BSDCONF_CASE_SENSITIVE);
+ operator_equals = (processing_options & BSDCONF_OPERATOR_EQUALS);
+ require_equals = (processing_options & BSDCONF_REQUIRE_EQUALS);
+ strict_equals = (processing_options & BSDCONF_STRICT_EQUALS);
/* Read the file until EOF */
while (r > 0) {
diff --git a/lib/libbsdconf/bsdconf.h b/lib/libbsdconf/bsdconf.h
index 9fa6e35fd719..02fc4dce8f12 100644
--- a/lib/libbsdconf/bsdconf.h
+++ b/lib/libbsdconf/bsdconf.h
@@ -31,6 +31,14 @@
#endif
#endif
+/*
+ * Library version info
+ */
+#define BSDCONF_VERSION "1.1.0 2026-09-15"
+#define BSDCONF_VERSION_MAJOR 1
+#define BSDCONF_VERSION_MINOR 1
+#define BSDCONF_VERSION_PATCH 0
+
/*
* Union for storing various types of data in a single common container.
*
diff --git a/lib/libbsdconf/bsdconf_put.c b/lib/libbsdconf/bsdconf_put.c
index 55a113a36093..20053f628518 100644
--- a/lib/libbsdconf/bsdconf_put.c
+++ b/lib/libbsdconf/bsdconf_put.c
@@ -100,19 +100,19 @@ bsdconf_put(struct bsdconf_option options[], const char *path,
tpath[0] = '\0';
/* Decode processing options */
- bequals = (processing_options & BSDCONF_BREAK_ON_EQUALS) != 0;
- bsemicolon = (processing_options & BSDCONF_BREAK_ON_SEMICOLON) != 0;
- case_sensitive = (processing_options & BSDCONF_CASE_SENSITIVE) != 0;
- operator_equals = (processing_options & BSDCONF_OPERATOR_EQUALS) != 0;
- require_equals = (processing_options & BSDCONF_REQUIRE_EQUALS) != 0;
- strict_equals = (processing_options & BSDCONF_STRICT_EQUALS) != 0;
+ bequals = (processing_options & BSDCONF_BREAK_ON_EQUALS);
+ bsemicolon = (processing_options & BSDCONF_BREAK_ON_SEMICOLON);
+ case_sensitive = (processing_options & BSDCONF_CASE_SENSITIVE);
+ operator_equals = (processing_options & BSDCONF_OPERATOR_EQUALS);
+ require_equals = (processing_options & BSDCONF_REQUIRE_EQUALS);
+ strict_equals = (processing_options & BSDCONF_STRICT_EQUALS);
/* Decode put options */
- backup = (put_options & BSDCONF_PUT_BACKUP) != 0;
- emptyok = (put_options & BSDCONF_PUT_ALLOW_EMPTY) != 0;
- nodup = (put_options & BSDCONF_PUT_NO_DUPLICATES) != 0;
- quote_always = (put_options & BSDCONF_PUT_QUOTE_ALWAYS) != 0;
- unquoted = (put_options & BSDCONF_PUT_UNQUOTED) != 0;
+ backup = (put_options & BSDCONF_PUT_BACKUP);
+ emptyok = (put_options & BSDCONF_PUT_ALLOW_EMPTY);
+ nodup = (put_options & BSDCONF_PUT_NO_DUPLICATES);
+ quote_always = (put_options & BSDCONF_PUT_QUOTE_ALWAYS);
+ unquoted = (put_options & BSDCONF_PUT_UNQUOTED);
/* Quoting directives are mutually exclusive */
if (unquoted && quote_always) {
diff --git a/usr.sbin/sysconf/sysconf.8 b/usr.sbin/sysconf/sysconf.8
index 3f4cfb355331..c6a8b2126867 100644
--- a/usr.sbin/sysconf/sysconf.8
+++ b/usr.sbin/sysconf/sysconf.8
@@ -3,7 +3,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.Dd August 2, 2026
+.Dd September 15, 2026
\
.Dt SYSCONF 8
.Os
@@ -453,7 +453,11 @@ Print a short usage statement
.Pq or, for the long form, the full option summary
to stderr and exit.
.It Fl Fl version
-Print version information to stdout and exit.
+Print
+.Nm
+and linked
+.Xr bsdconf 3
+versions and exit.
.It Fl i
Ignore unknown names
.Pq and suppress the warning when writing an unknown sysctl OID .
diff --git a/usr.sbin/sysconf/sysconf.c b/usr.sbin/sysconf/sysconf.c
index 98f26a5854f2..9454005ee4dd 100644
--- a/usr.sbin/sysconf/sysconf.c
+++ b/usr.sbin/sysconf/sysconf.c
@@ -266,7 +266,8 @@ main(int argc, char *argv[])
if (strcmp(argv[n], "--help") == 0)
help();
if (strcmp(argv[n], "--version") == 0) {
- puts(SYSCONF_VERSION);
+ printf("%s (libbsdconf %s)\n", SYSCONF_VERSION,
+ BSDCONF_VERSION);
exit(EXIT_SUCCESS);
}
}
@@ -711,7 +712,7 @@ help(void)
fprintf(stderr, OPTFMT, "--help",
"Print this message to stderr and exit.");
fprintf(stderr, OPTFMT, "--version",
- "Print version information to stdout and exit.");
+ "Print the utility and library versions and exit.");
fprintf(stderr, OPTFMT, "-i",
"Ignore unknown names (and quiet unknown sysctl OID warnings).");
fprintf(stderr, OPTFMT, "-j jail",
diff --git a/usr.sbin/sysconf/sysconf_priv.h b/usr.sbin/sysconf/sysconf_priv.h
index 4fe43046b439..6b91221d4380 100644
--- a/usr.sbin/sysconf/sysconf_priv.h
+++ b/usr.sbin/sysconf/sysconf_priv.h
@@ -37,7 +37,7 @@
#define __unused /* not all compilers support attributes */
#endif
-#define SYSCONF_VERSION "1.0 2026-08-16"
+#define SYSCONF_VERSION "1.1 2026-09-15"
/* getopt(3) optstring; shared by parse_options() and find_target() */
#define OPTSTRING "AacdDEeFf:hij:k:lLnNqR:svVx"