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

#include "opts.h"
#include "stats.h"


char *make_absolute(char *name) {
	static char cwd[PATHLEN_MAX];
	static size_t cwdlen = 0;
	if (*name == '/') return name;

	if (!cwdlen) {
		if (!getcwd(cwd, PATHLEN_MAX)) {
			perror("Unable to get current working directory");
		} else {
			cwdlen = strlen(cwd);
		}
	}

	if (cwdlen) {
		char *save = name;
		name = (char *)malloc(cwdlen + strlen(save) + 2);
		strcpy (name, cwd);
		name[cwdlen] = '/';
		name[cwdlen+1] = '\0';
		strcat (name, save);
	}

	return name;
}

int unionfs_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) {
	(void)data;

	switch (key) {
		case FUSE_OPT_KEY_NONOPT:
			if (!nroots) {
				char **ptr = (char **)&arg;
				char *root;
				while ((root = strsep(ptr, ROOT_SEP)) != NULL) {
					if (strlen(root) == 0) continue;

					roots = realloc(roots, (nroots+1) * sizeof(root));
					roots[nroots++] = root;

					printf("%s\n", root);
				}
				return 0;
			}
			return 1;
		case KEY_STATS:
			stats_enabled = 1;
			return 0;
		case KEY_HELP:
			fprintf (stderr,
			"unionfs-fuse version 0.13 by <NAME>\n"
			"Usage: %s [options] root[:root...] mountpoint\n"
			"The first argument is a colon separated list of directories to merge\n"
			"\n"
			"general options:\n"
			"    -o opt,[opt...]        mount options\n"
			"    -h   --help            print help\n"
			"    -V   --version         print version\n"
			"\n"
			"UnionFS options:\n"
			"    -o stats               show statistics in the file 'stats' under the mountpoint\n"
			"\n",
			outargs->argv[0]);
			fuse_opt_add_arg(outargs, "-ho");
			doexit = 1;
			return 0;
		case KEY_VERSION:
			printf("unionfs-fuse version: 0.13\n");
			doexit = 1;
			return 1;
		default:
			return 1;
	}
}
<commit_msg>Forgot to make paths absolute<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>

#include "opts.h"
#include "stats.h"


char *make_absolute(char *name) {
	static char cwd[PATHLEN_MAX];
	static size_t cwdlen = 0;
	if (*name == '/') return name;

	if (!cwdlen) {
		if (!getcwd(cwd, PATHLEN_MAX)) {
			perror("Unable to get current working directory");
		} else {
			cwdlen = strlen(cwd);
		}
	}

	if (cwdlen) {
		char *save = name;
		name = (char *)malloc(cwdlen + strlen(save) + 2);
		strcpy (name, cwd);
		name[cwdlen] = '/';
		name[cwdlen+1] = '\0';
		strcat (name, save);
	}

	return name;
}

int unionfs_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) {
	(void)data;

	switch (key) {
		case FUSE_OPT_KEY_NONOPT:
			if (!nroots) {
				char **ptr = (char **)&arg;
				char *root;
				while ((root = strsep(ptr, ROOT_SEP)) != NULL) {
					if (strlen(root) == 0) continue;

					roots = realloc(roots, (nroots+1) * sizeof(root));
					roots[nroots++] = make_absolute(root);
				}
				return 0;
			}
			return 1;
		case KEY_STATS:
			stats_enabled = 1;
			return 0;
		case KEY_HELP:
			fprintf (stderr,
			"unionfs-fuse version 0.13 by <NAME>\n"
			"Usage: %s [options] root[:root...] mountpoint\n"
			"The first argument is a colon separated list of directories to merge\n"
			"\n"
			"general options:\n"
			"    -o opt,[opt...]        mount options\n"
			"    -h   --help            print help\n"
			"    -V   --version         print version\n"
			"\n"
			"UnionFS options:\n"
			"    -o stats               show statistics in the file 'stats' under the mountpoint\n"
			"\n",
			outargs->argv[0]);
			fuse_opt_add_arg(outargs, "-ho");
			doexit = 1;
			return 0;
		case KEY_VERSION:
			printf("unionfs-fuse version: 0.13\n");
			doexit = 1;
			return 1;
		default:
			return 1;
	}
}

{'fraction_non_alphanumeric': 0.16041047799081826, 'fraction_numerical': 0.0118822576289495, 'mean_word_length': 2.704, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '4161016', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1425, 'n_words': 376}