developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 1 | --- a/hostapd/main.c |
| 2 | +++ b/hostapd/main.c |
| 3 | @@ -31,7 +31,7 @@ |
| 4 | #include "config_file.h" |
| 5 | #include "eap_register.h" |
| 6 | #include "ctrl_iface.h" |
| 7 | - |
| 8 | +#include "build_features.h" |
| 9 | |
| 10 | struct hapd_global { |
| 11 | void **drv_priv; |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 12 | @@ -799,7 +799,7 @@ int main(int argc, char *argv[]) |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 13 | wpa_supplicant_event = hostapd_wpa_event; |
| 14 | wpa_supplicant_event_global = hostapd_wpa_event_global; |
| 15 | for (;;) { |
| 16 | - c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:vg:G:q"); |
| 17 | + c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:qv::"); |
| 18 | if (c < 0) |
| 19 | break; |
| 20 | switch (c) { |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 21 | @@ -836,6 +836,8 @@ int main(int argc, char *argv[]) |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 22 | break; |
| 23 | #endif /* CONFIG_DEBUG_LINUX_TRACING */ |
| 24 | case 'v': |
| 25 | + if (optarg) |
| 26 | + exit(!has_feature(optarg)); |
| 27 | show_version(); |
| 28 | exit(1); |
| 29 | case 'g': |
| 30 | --- a/wpa_supplicant/main.c |
| 31 | +++ b/wpa_supplicant/main.c |
| 32 | @@ -12,6 +12,7 @@ |
| 33 | #endif /* __linux__ */ |
| 34 | |
| 35 | #include "common.h" |
| 36 | +#include "build_features.h" |
| 37 | #include "crypto/crypto.h" |
| 38 | #include "fst/fst.h" |
| 39 | #include "wpa_supplicant_i.h" |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 40 | @@ -202,7 +203,7 @@ int main(int argc, char *argv[]) |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 41 | |
| 42 | for (;;) { |
| 43 | c = getopt(argc, argv, |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 44 | - "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW"); |
| 45 | + "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W"); |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 46 | if (c < 0) |
| 47 | break; |
| 48 | switch (c) { |
developer | dfb5098 | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 49 | @@ -302,8 +303,12 @@ int main(int argc, char *argv[]) |
developer | 29c4d2d | 2022-12-26 19:41:22 +0800 | [diff] [blame] | 50 | break; |
| 51 | #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */ |
| 52 | case 'v': |
| 53 | - printf("%s\n", wpa_supplicant_version); |
| 54 | - exitcode = 0; |
| 55 | + if (optarg) { |
| 56 | + exitcode = !has_feature(optarg); |
| 57 | + } else { |
| 58 | + printf("%s\n", wpa_supplicant_version); |
| 59 | + exitcode = 0; |
| 60 | + } |
| 61 | goto out; |
| 62 | case 'W': |
| 63 | params.wait_for_monitor++; |