3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-24 23:42:42 +01:00

client: display table header for the empty lists

This commit is contained in:
Tim Kourt 2017-05-19 15:13:42 -07:00 committed by Denis Kenzior
parent fd4ab5d3df
commit e42aee89b1
3 changed files with 13 additions and 14 deletions

View File

@ -248,13 +248,13 @@ static void ordered_networks_display(struct l_queue *ordered_networks)
const struct l_queue_entry *entry; const struct l_queue_entry *entry;
bool is_first; bool is_first;
if (l_queue_length(ordered_networks)) { display_table_header("Available networks", "%s%-*s%-*s%-*s%*s",
display_table_header("Available networks", MARGIN, 2, "", 32, "Network name",
"%s%-*s%-*s%-*s%*s", MARGIN, 2, "", 10, "Security", 4, "dbms");
32, "Network name", 10, "Security",
4, "dbms"); if (!l_queue_length(ordered_networks)) {
} else {
display("No networks available\n"); display("No networks available\n");
display_table_footer();
return; return;
} }

View File

@ -78,12 +78,11 @@ static void known_networks_display(struct l_queue *known_networks)
{ {
const struct l_queue_entry *entry; const struct l_queue_entry *entry;
if (l_queue_length(known_networks)) display_table_header("Known Networks", " %-*s%-*s%-*s%-*s",
display_table_header("Known Networks",
" %-*s%-*s%-*s%-*s",
32, "Name", 11, "Security", 32, "Name", 11, "Security",
19, "Last connected", 17, "Last seen"); 19, "Last connected", 17, "Last seen");
else
if (!l_queue_length(known_networks))
display(MARGIN "No known networks\n"); display(MARGIN "No known networks\n");
for (entry = l_queue_get_entries(known_networks); entry; for (entry = l_queue_get_entries(known_networks); entry;

View File

@ -146,11 +146,11 @@ static enum cmd_status cmd_list(const char *device_name, char *args)
proxy_interface_find_all(IWD_WSC_INTERFACE, proxy_interface_find_all(IWD_WSC_INTERFACE,
match_by_device, NULL); match_by_device, NULL);
if (match) { display_table_header("WSC-capable Devices", MARGIN "%-*s", 20, "Name");
display_table_header("WSC-capable Devices",
MARGIN "%-*s", 20, "Name"); if (!match) {
} else {
display("No WSC-capable devices available\n"); display("No WSC-capable devices available\n");
display_table_footer();
return CMD_STATUS_OK; return CMD_STATUS_OK;
} }