<commit_before>#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <errno.h>
#include <unistd.h>

#define DEBUG 1

#include "connect_client.h"
#include "port.h"
#include "query.h"

/* FIXME - figuring out calling malloc and free here is a bad thing 
   pass the buffer? */

int
query_main(QueryData *q, char *host)
{
    int connfd, n, m, i;
    char *myhost;
    char *answer = (char *) calloc(1280,1);
    char *query = q->query;
    int cnt;

    if(host == NULL) {
      myhost = "fc00:e968:6179::de52:7100"; // toutatis.taht.net
    } else {
      myhost = host;
    }
    build_query(q);
    if(q->options.verbose) fprintf(stderr,"Connecting: %s\n",myhost);
    connfd = connect_client(myhost, QUERY_PORT, AF_UNSPEC, SOCK_DGRAM);

    if (connfd < 0) {
         fprintf(stderr,
                 "client error:: could not create connected socket "
                 "socket\n");
         return -1;
    }
    if(q->options.verbose) {
      fprintf(stderr,"Writing query: \"%s\" to socket of length %d\n", 
	      query, strlen(query));
    }
    m= write(connfd, query, strlen(query));
    memset(answer, 0, MAX_MTU);
    n = read(connfd,
             answer,
             MAX_MTU); // FIXME, leave running and timeout
    if(q->options.verbose) fprintf(stderr,"Got response: %s\n", answer);
    close(connfd);
    strcpy(q->query,answer); // ycuk - figmeout
    return(answer_parse(q));
}
<commit_msg>It compiles, time to push it out<commit_after>#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <errno.h>
#include <unistd.h>

#define DEBUG 1

#include "connect_client.h"
#include "port.h"
#include "query.h"

/* FIXME - figuring out calling malloc and free here is a bad thing 
   pass the buffer? */

int
query_main(QueryData *q, char *host)
{
    int connfd, n, m, i;
    char *myhost;
    char *answer = (char *) calloc(1280,1);
    char *query = q->query;
    int cnt;

    if(host == NULL) {
      myhost = "fc00:e968:6179::de52:7100"; // toutatis.taht.net
    } else {
      myhost = host;
    }
    build_query(q); 
    if(q->options.verbose) fprintf(stderr,"Connecting: %s\n",myhost);
    connfd = connect_client(myhost, QUERY_PORT, AF_UNSPEC, SOCK_DGRAM);

    if (connfd < 0) {
         fprintf(stderr,
                 "client error:: could not create connected socket "
                 "socket\n");
         return -1;
    }
    if(q->options.verbose) {
      fprintf(stderr,"Writing query: \"%s\" to socket of length %d\n", 
	      query, strlen(query));
    }
    // fixme - generate legal checksum and check length
    m= write(connfd, query, strlen(query));
    memset(answer, 0, MAX_MTU);
    n = read(connfd,
             answer,
             MAX_MTU); // FIXME, leave running and timeout
    if(q->options.verbose) fprintf(stderr,"Got response: %s\n", answer);
    close(connfd);
    strcpy(q->query,answer); // ycuk - figmeout
    return(answer_parse(q));
}

{'fraction_non_alphanumeric': 0.15137614678899083, 'fraction_numerical': 0.015727391874180863, 'mean_word_length': 2.723170731707317, 'pattern_counts': {'":': 0, '<': 21, '<?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': '1427585', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1085, 'n_words': 271}