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>
This commit is contained in:
Andre Heider 2022-11-21 10:12:27 +01:00 committed by Jo-Philipp Wich
parent 91be7e0d28
commit f36b72b00d

View file

@ -160,21 +160,11 @@ static char * format_enc_suites(int suites)
{ {
static char str[64] = { 0 }; static char str[64] = { 0 };
char *pos = str; char *pos = str;
int i;
if (suites & IWINFO_KMGMT_PSK) for (i = 0; i < IWINFO_KMGMT_COUNT; i++)
pos += sprintf(pos, "PSK/"); if (suites & (1 << i))
pos += sprintf(pos, "%s/", IWINFO_KMGMT_NAMES[i]);
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/");
*(pos - 1) = 0; *(pos - 1) = 0;