<commit_before>/* See LICENSE file for copyright and license details. */
#if defined(__OpenBSD__)
#include <sys/types.h>
#include <sys/socket.h>
#endif

#include <errno.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>

#include "../util.h"

const char *
ipv4(const char *iface)
{
	struct ifaddrs *ifaddr, *ifa;
	int s;
	char host[NI_MAXHOST];

	if (getifaddrs(&ifaddr) == -1) {
		fprintf(stderr, "getifaddrs: %s\n", strerror(errno));
		return NULL;
	}

	for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
		if (ifa->ifa_addr == NULL) {
			continue;
		}
		s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
		if ((strcmp(ifa->ifa_name, iface) == 0) && (ifa->ifa_addr->sa_family == AF_INET)) {
			if (s != 0) {
				fprintf(stderr, "getnameinfo: %s\n", gai_strerror(s));
				return NULL;
			}<commit_msg>ip: Sort headers alphabetically<commit_after>/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#if defined(__OpenBSD__)
#include <sys/types.h>
#include <sys/socket.h>
#endif

#include "../util.h"

const char *
ipv4(const char *iface)
{
	struct ifaddrs *ifaddr, *ifa;
	int s;
	char host[NI_MAXHOST];

	if (getifaddrs(&ifaddr) == -1) {
		fprintf(stderr, "getifaddrs: %s\n", strerror(errno));
		return NULL;
	}

	for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
		if (ifa->ifa_addr == NULL) {
			continue;
		}
		s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
		if ((strcmp(ifa->ifa_name, iface) == 0) && (ifa->ifa_addr->sa_family == AF_INET)) {
			if (s != 0) {
				fprintf(stderr, "getnameinfo: %s\n", gai_strerror(s));
				return NULL;
			}
{'fraction_non_alphanumeric': 0.17863105175292154, 'fraction_numerical': 0.005564830272676683, 'mean_word_length': 4.24198250728863, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 29, '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': '3462075', 'n_tokens_mistral': 772, 'n_tokens_neox': 726, 'n_words': 173}