<commit_before>/*
 * Copyright (C) 2021 Google LLC
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @ingroup     sys_shell_commands
 * @{
 *
 * @file
 * @brief       Shell command for printing lwIP network interface status
 *
 * @author      <NAME> <<EMAIL>>
 *
 * @}
 */

#include <stdio.h>
#include "lwip/netif.h"
#include "net/netdev.h"
#include "net/netopt.h"

#ifdef MODULE_LWIP_IPV6
static void _netif_list_ipv6(struct netif *netif, int addr_index) {
    printf("        inet6 addr: ");
    ip_addr_debug_print(LWIP_DBG_ON, netif_ip_addr6(netif, addr_index));
    printf(" scope: ");
    if (ip6_addr_isglobal(netif_ip6_addr(netif, addr_index))) {
        printf("global");
    } else if (ip6_addr_islinklocal(netif_ip6_addr(netif, addr_index))) {
        printf("link");
    } else if (ip6_addr_issitelocal(netif_ip6_addr(netif, addr_index))) {
        printf("site");
    } else {
        printf("unknown");
    }
    printf("\n");
}
#endif

static void _netif_list(struct netif *netif) {
    int i;
    struct netdev *dev = netif->state;
    printf("Iface %c%c%u ", netif->name[0], netif->name[1], netif->num);
    printf("HWaddr: ");
    for (i = 0; i < netif->hwaddr_len; i++) {
        printf("%02x", netif->hwaddr[i]);
        if ((i+1) < netif->hwaddr_len) {
            printf(":");
        }
    }<commit_msg>sys/shell: lwIP: make use of netif_get_name()<commit_after>/*
 * Copyright (C) 2021 Google LLC
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @ingroup     sys_shell_commands
 * @{
 *
 * @file
 * @brief       Shell command for printing lwIP network interface status
 *
 * @author      <NAME> <<EMAIL>>
 *
 * @}
 */

#include <stdio.h>
#include "lwip/netif.h"
#include "net/netdev.h"
#include "net/netopt.h"

#ifdef MODULE_LWIP_IPV6
static void _netif_list_ipv6(struct netif *netif, int addr_index) {
    printf("        inet6 addr: ");
    ip_addr_debug_print(LWIP_DBG_ON, netif_ip_addr6(netif, addr_index));
    printf(" scope: ");
    if (ip6_addr_isglobal(netif_ip6_addr(netif, addr_index))) {
        printf("global");
    } else if (ip6_addr_islinklocal(netif_ip6_addr(netif, addr_index))) {
        printf("link");
    } else if (ip6_addr_issitelocal(netif_ip6_addr(netif, addr_index))) {
        printf("site");
    } else {
        printf("unknown");
    }
    printf("\n");
}
#endif

static void _netif_list(struct netif *netif) {
    int i;
    char name[8];
    struct netdev *dev = netif->state;
    netif_get_name((netif_t *)netif, name);
    printf("Iface %s HWaddr: ", name);
    for (i = 0; i < netif->hwaddr_len; i++) {
        printf("%02x", netif->hwaddr[i]);
        if ((i+1) < netif->hwaddr_len) {
            printf(":");
        }
    }
{'fraction_non_alphanumeric': 0.14864864864864866, 'fraction_numerical': 0.014527027027027028, 'mean_word_length': 3.1125, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5305914', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1074, 'n_words': 252}