<commit_before>#include <err.h>
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "kcn.h"
#include "kcn_formula.h"
#include "kcn_str.h"
#include "kcn_log.h"
#include "kcn_netstat.h"

#include "kcndb_db.h"
#include "kcndb_server.h"

static void usage(const char *, ...);

static const char *pname;

int
main(int argc, char * const argv[])
{
	const char *p;
	bool fflag;
	int ch;
	unsigned long long llval;

	pname = (p = strrchr(argv[0], '/')) != NULL ? p + 1 : argv[0];

	fflag = false;
	while ((ch = getopt(argc, argv, "d:fp:v?")) != -1) {
		switch (ch) {
		case 'd':
			if (! kcndb_db_path_set(optarg))
				usage("cannot set DB path, \"%s\"", optarg);
				/*NOTREACHED*/
			break;
		case 'f':
			fflag = true;
			break;
		case 'p':
			if (! kcn_strtoull(optarg, KCNDB_NET_PORT_MIN,
			    KCNDB_NET_PORT_MAX, &llval))
				usage("invalid TCP port number");
				/*NOTERACHED*/
			if (! kcndb_server_port_set(llval))
				usage("cannot set TCP port, \"%s\"", optarg);
				/*NOTREACHED*/
			break;
		case 'v':
			kcn_log_priority_increment();
			break;
		case 'h':
		case '?':
		default:
			usage(NULL);
		}
	}
	argc -= optind;
	argv += optind;

	if (! fflag && daemon(1, 1) == -1)
		usage("cannot daemonize");
		/*NOTREACHED*/

	if (! kcndb_server_start())
		usage("cannot launch server");

	kcndb_server_loop();

	return 0;
}

static void
usage(const char *errfmt, ...)<commit_msg>cosmetic change.<commit_after>#include <err.h>
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "kcn.h"
#include "kcn_formula.h"
#include "kcn_str.h"
#include "kcn_log.h"
#include "kcn_netstat.h"

#include "kcndb_db.h"
#include "kcndb_server.h"

static void usage(const char *, ...);

static const char *pname;

int
main(int argc, char * const argv[])
{
	const char *p;
	bool fflag;
	int ch;
	unsigned long long llval;

	pname = (p = strrchr(argv[0], '/')) != NULL ? p + 1 : argv[0];

	fflag = false;
	while ((ch = getopt(argc, argv, "d:fp:v?")) != -1) {
		switch (ch) {
		case 'd':
			if (! kcndb_db_path_set(optarg))
				usage("cannot set DB path, \"%s\"", optarg);
				/*NOTREACHED*/
			break;
		case 'f':
			fflag = true;
			break;
		case 'p':
			if (! kcn_strtoull(optarg, KCNDB_NET_PORT_MIN,
			    KCNDB_NET_PORT_MAX, &llval))
				usage("invalid TCP port number");
				/*NOTERACHED*/
			if (! kcndb_server_port_set(llval))
				usage("cannot set TCP port, \"%s\"", optarg);
				/*NOTREACHED*/
			break;
		case 'v':
			kcn_log_priority_increment();
			break;
		case 'h':
		case '?':
		default:
			usage(NULL);
		}
	}
	argc -= optind;
	argv += optind;

	if (! fflag && daemon(1, 1) == -1)
		usage("cannot daemonize");
		/*NOTREACHED*/

	if (! kcndb_server_start())
		usage("cannot launch server");
		/*NOTREACHED*/

	kcndb_server_loop();

	return 0;
}

static void
usage(const char *errfmt, ...)
{'fraction_non_alphanumeric': 0.18323392975480451, 'fraction_numerical': 0.005301524188204109, 'mean_word_length': 3.574242424242424, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '1832501', 'n_tokens_mistral': 1408, 'n_tokens_neox': 1271, 'n_words': 296}