summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2022-11-21 10:12:27 +0100
committerJo-Philipp Wich <jo@mein.io>2022-12-16 00:09:07 +0100
commitf36b72b00db577494d98c88e60fcc17b1a72e42e (patch)
tree6e259b53e0ecd04c944b4c49d75a5716089f2ed9
parent91be7e0d288f068814a3e42642a5c98df3f795fb (diff)
downloadiwinfo-f36b72b00db577494d98c88e60fcc17b1a72e42e.tar.gz
cli: use IWINFO_KMGMT_NAMES
There's no need to duplicate the strings or even miss new ones. Signed-off-by: Andre Heider <a.heider@gmail.com>
-rw-r--r--iwinfo_cli.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 944c6c8..b43c52e 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -160,21 +160,11 @@ static char * format_enc_suites(int suites)
{
static char str[64] = { 0 };
char *pos = str;
+ int i;
- if (suites & IWINFO_KMGMT_PSK)
- pos += sprintf(pos, "PSK/");
-
- if (suites & IWINFO_KMGMT_8021x)
- pos += sprintf(pos, "802.1X/");
-
- if (suites & IWINFO_KMGMT_SAE)
- pos += sprintf(pos, "SAE/");
-
- if (suites & IWINFO_KMGMT_OWE)
- pos += sprintf(pos, "OWE/");
-
- if (!suites || (suites & IWINFO_KMGMT_NONE))
- pos += sprintf(pos, "NONE/");
+ for (i = 0; i < IWINFO_KMGMT_COUNT; i++)
+ if (suites & (1 << i))
+ pos += sprintf(pos, "%s/", IWINFO_KMGMT_NAMES[i]);
*(pos - 1) = 0;