mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
client: Simplify printing logic
This commit is contained in:
parent
34cd8d5f3e
commit
a5928f0e4c
@ -338,7 +338,6 @@ static void ordered_networks_display(struct l_queue *ordered_networks)
|
|||||||
{
|
{
|
||||||
char *dbms = NULL;
|
char *dbms = NULL;
|
||||||
const struct l_queue_entry *entry;
|
const struct l_queue_entry *entry;
|
||||||
bool is_first;
|
|
||||||
|
|
||||||
display_table_header("Available networks", "%s%-*s%-*s%-*s%*s",
|
display_table_header("Available networks", "%s%-*s%-*s%-*s%*s",
|
||||||
MARGIN, 2, "", 32, "Network name",
|
MARGIN, 2, "", 32, "Network name",
|
||||||
@ -351,7 +350,7 @@ static void ordered_networks_display(struct l_queue *ordered_networks)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (is_first = true, entry = l_queue_get_entries(ordered_networks);
|
for (entry = l_queue_get_entries(ordered_networks);
|
||||||
entry; entry = entry->next) {
|
entry; entry = entry->next) {
|
||||||
struct ordered_network *network = entry->data;
|
struct ordered_network *network = entry->data;
|
||||||
const struct proxy_interface *network_i =
|
const struct proxy_interface *network_i =
|
||||||
@ -362,24 +361,17 @@ static void ordered_networks_display(struct l_queue *ordered_networks)
|
|||||||
if (display_signal_as_dbms)
|
if (display_signal_as_dbms)
|
||||||
dbms = l_strdup_printf("%d", network->signal_strength);
|
dbms = l_strdup_printf("%d", network->signal_strength);
|
||||||
|
|
||||||
if (is_first && network_is_connected(network_i)) {
|
display("%s%-*s%-*s%-*s%-*s\n", MARGIN, 2,
|
||||||
display("%s%-*s%-*s%-*s%-*s\n", MARGIN,
|
network_is_connected(network_i) ?
|
||||||
2, COLOR_BOLDGRAY "> " COLOR_OFF,
|
COLOR_BOLDGRAY "> " COLOR_OFF : "",
|
||||||
32, network_name, 10, network_type,
|
32, network_name, 10, network_type,
|
||||||
6, display_signal_as_dbms ? dbms :
|
6, display_signal_as_dbms ? dbms :
|
||||||
dbms_tostars(network->signal_strength));
|
dbms_tostars(network->signal_strength));
|
||||||
|
|
||||||
|
if (display_signal_as_dbms) {
|
||||||
l_free(dbms);
|
l_free(dbms);
|
||||||
is_first = false;
|
dbms = NULL;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
display("%s%-*s%-*s%-*s%-*s\n", MARGIN, 2, "",
|
|
||||||
32, network_name, 10, network_type,
|
|
||||||
6, display_signal_as_dbms ? dbms :
|
|
||||||
dbms_tostars(network->signal_strength));
|
|
||||||
|
|
||||||
l_free(dbms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
display_table_footer();
|
display_table_footer();
|
||||||
|
Loading…
Reference in New Issue
Block a user