<commit_before>/*
 *  Copyright (c) 2009 <NAME>
 *
 *  This is free software; see GPL.txt
 */
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>

#include <net_helper.h>
#include <topmanager.h>

#include "net_helpers.h"
#include "loop.h"

static const char *my_iface = "eth0";
static int port = 6666;
static int srv_port;
static const char *srv_ip = "";
static int period = 500;
static int chunks_per_second = 4;
static int multiply = 1;
static int buff_size = 8;
static const char *fname = "input.mpg";

static void cmdline_parse(int argc, char *argv[])
{
  int o;

  while ((o = getopt(argc, argv, "b:c:t:p:i:P:I:")) != -1) {
    switch(o) {
      case 'b':
        buff_size = atoi(optarg);
        break;
      case 'c':
        chunks_per_second = atoi(optarg);
        break;
      case 't':
        period = atoi(optarg);
        break;
      case 'p':
        srv_port = atoi(optarg);
        break;
      case 'i':
        srv_ip = strdup(optarg);
        break;
      case 'P':
        port =  atoi(optarg);
        break;
      case 'I':
        my_iface = strdup(optarg);
        break;
      default:
        fprintf(stderr, "Error: unknown option %c\n", o);

        exit(-1);
    }
  }
}

static struct nodeID *init(void)
{
  struct nodeID *myID;
  char *my_addr = iface_addr(my_iface);

  myID = net_helper_init(my_addr, port);
  if (myID == NULL) {
    fprintf(stderr, "Error creating my socket (%s:%d)!\n", my_addr, port);
    free(my_addr);

    return NULL;
  }
  free(my_addr);
  topInit(myID);

  return myID;
}


int main(int argc, char *argv[])<commit_msg>Allow setting the input file name<commit_after>/*
 *  Copyright (c) 2009 <NAME>
 *
 *  This is free software; see GPL.txt
 */
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>

#include <net_helper.h>
#include <topmanager.h>

#include "net_helpers.h"
#include "loop.h"

static const char *my_iface = "eth0";
static int port = 6666;
static int srv_port;
static const char *srv_ip = "";
static int period = 500;
static int chunks_per_second = 4;
static int multiply = 1;
static int buff_size = 8;
static const char *fname = "input.mpg";

static void cmdline_parse(int argc, char *argv[])
{
  int o;

  while ((o = getopt(argc, argv, "b:c:t:p:i:P:I:f:")) != -1) {
    switch(o) {
      case 'b':
        buff_size = atoi(optarg);
        break;
      case 'c':
        chunks_per_second = atoi(optarg);
        break;
      case 't':
        period = atoi(optarg);
        break;
      case 'p':
        srv_port = atoi(optarg);
        break;
      case 'i':
        srv_ip = strdup(optarg);
        break;
      case 'P':
        port =  atoi(optarg);
        break;
      case 'I':
        my_iface = strdup(optarg);
        break;
      case 'f':
        fname = strdup(optarg);
        break;
      default:
        fprintf(stderr, "Error: unknown option %c\n", o);

        exit(-1);
    }
  }
}

static struct nodeID *init(void)
{
  struct nodeID *myID;
  char *my_addr = iface_addr(my_iface);

  myID = net_helper_init(my_addr, port);
  if (myID == NULL) {
    fprintf(stderr, "Error creating my socket (%s:%d)!\n", my_addr, port);
    free(my_addr);

    return NULL;
  }
  free(my_addr);
  topInit(myID);

  return myID;
}


int main(int argc, char *argv[])
{'fraction_non_alphanumeric': 0.1469619874289135, 'fraction_numerical': 0.010176593834181383, 'mean_word_length': 2.5935483870967744, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '6133325', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1252, 'n_words': 329}