options: introduce OPTION_COMMON_VERSION_WITH_V and version_only()

The man page udevadm(8) have explicitly documented that the option -V is
a short form of --version. Let's not hide the short form in the help
message.

This introduces OPTION_COMMON_VERSION_WITH_V then use it in udevadm,
udevd, and run0.

Alos, this moves print_version() to build.c, and renames it to
version_only(). Now the function is also used in udevd amd test-libudev.

With this change, the -V option is hidden only in dmi_memory_id and
scsi_id. So, this removes the OPTION_COMMON_VERSION_WITH_HIDDEN_V macro
and explicitly list the hidden option in their code.
This commit is contained in:
Yu Watanabe
2026-08-29 07:40:35 +09:00
parent 39cf979007
commit 69a54c37ac
22 changed files with 62 additions and 53 deletions
+6
View File
@@ -280,3 +280,9 @@ int version(void) {
b ?: systemd_features);
return 0;
}
int version_only(void) {
/* Used by udev. Dracut relies on the version being a single integer */
puts(PROJECT_VERSION_STR);
return 0;
}
+1
View File
@@ -6,3 +6,4 @@
extern const char* const systemd_features;
int version(void);
int version_only(void);