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