Network information cleanup (#14987)

This commit is contained in:
sonninnos 2023-02-17 21:19:58 +02:00 committed by GitHub
parent b04a926170
commit d7f2bd6ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7417,8 +7417,15 @@ unsigned menu_displaylist_build_list(
for (i = 0; i < interfaces.size; i++)
{
struct net_ifinfo_entry *entry = &interfaces.entries[i];
snprintf(buf + _len, sizeof(buf) - _len, " (%s) : %s\n",
entry->name, entry->host);
char host_trimmed[64];
/* Trim "%"-suffix from host */
strlcpy(host_trimmed, entry->host, sizeof(host_trimmed));
host_trimmed[string_index_last_occurance(host_trimmed, '%')] = '\0';
snprintf(buf + _len, sizeof(buf) - _len, " (%s): %s\n",
entry->name, host_trimmed);
if (menu_entries_append(list, buf, entry->name,
MENU_ENUM_LABEL_NETWORK_INFO_ENTRY,
MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL))