blob: 12edb6baccbcc1631f0fffc4a2c901b88dbcd966 [file] [log] [blame]
developer29c4d2d2022-12-26 19:41:22 +08001--- 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;
12@@ -692,7 +692,7 @@ int main(int argc, char *argv[])
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) {
21@@ -729,6 +729,8 @@ int main(int argc, char *argv[])
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"
40@@ -203,7 +204,7 @@ int main(int argc, char *argv[])
41
42 for (;;) {
43 c = getopt(argc, argv,
44- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
45+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
46 if (c < 0)
47 break;
48 switch (c) {
49@@ -306,8 +307,12 @@ int main(int argc, char *argv[])
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++;