<commit_before>#include <errno.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <sys/socket.h>

#include <netinet/in.h>
#include <netinet/tcp.h>

#include <arpa/inet.h>

#ifndef TCP_FASTOPEN
#define TCP_FASTOPEN 23
#endif

struct {
    struct sockaddr_storage remote, local;
    int port;
    int count;
    int timeout;
    struct {
        char *data;
        int size;
    } req, buf;
} ht = {
    .port = 80,
    .count = 3,
    .timeout = 1,
    .buf = {
        .size = 4096,
    },
};

static int
ht_opt_str(int argc, char **argv, void *data)
{
    if (argc <= 1)
        return 1;

    memcpy(data, argv + 1, sizeof(char *));

    return 0;
}

static int
ht_opt_ushort(int argc, char **argv, void *data)
{
    if (argc <= 1)
        return 1;

    errno = 0;

    char *end = NULL;
    long val = strtol(argv[1], &end, 0);
    unsigned short res = val;

    if (errno || argv[1] == end || val != (long)res)
        return 1;<commit_msg>Set timeout to 5 by default<commit_after>#include <errno.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <sys/socket.h>

#include <netinet/in.h>
#include <netinet/tcp.h>

#include <arpa/inet.h>

#ifndef TCP_FASTOPEN
#define TCP_FASTOPEN 23
#endif

struct {
    struct sockaddr_storage remote, local;
    int port;
    int count;
    int timeout;
    struct {
        char *data;
        int size;
    } req, buf;
} ht = {
    .port = 80,
    .count = 3,
    .timeout = 5,
    .buf = {
        .size = 4096,
    },
};

static int
ht_opt_str(int argc, char **argv, void *data)
{
    if (argc <= 1)
        return 1;

    memcpy(data, argv + 1, sizeof(char *));

    return 0;
}

static int
ht_opt_ushort(int argc, char **argv, void *data)
{
    if (argc <= 1)
        return 1;

    errno = 0;

    char *end = NULL;
    long val = strtol(argv[1], &end, 0);
    unsigned short res = val;

    if (errno || argv[1] == end || val != (long)res)
        return 1;
{'fraction_non_alphanumeric': 0.15118577075098813, 'fraction_numerical': 0.021245059288537548, 'mean_word_length': 2.3976510067114094, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 23, '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': '4238218', 'n_tokens_mistral': 825, 'n_tokens_neox': 774, 'n_words': 220}