<commit_before>/*
*
* PURPOSE : Create the data folder to store outputs
*
* RETURN : void
*
*/
int initDataFolder() {
	char cmd[30];
	FILE *fp;
	sprintf(cmd, "%s%i", "mkdir -p ../commandexe/data/", getpid());
	fp = popen(cmd, "r");
	if (fp == NULL) {
		printf("[Error] - Error initialing process folder\n");
		exit(1);
	}
	return 0;
}

/*
*
* PURPOSE : Function that execute the c command and log the output in ../commandexe/data/[pid]/out.[index]
*
* PARAMS : char* -> command string
* PARAMS : int -> index of out.[index] log
* RETURN : int -> 0
*
*/
int execCommandAndLog(char* c, int index) {
	FILE *fp;
	char path[1035];
	char filename[7];

	sprintf(filename, "data/%i/%s.%i", getpid(), "out", index);
	FILE *f = fopen(filename, "w");
	if (f == NULL) {
		printf("[Error] - Error opening file!\n");
		exit(1);
	}

	// command open to read
	sprintf(c, "%s %s", c, "2>&1");
	fp = popen(c, "r");

	if (fp == NULL) {
		fprintf(f, "[Error] - Error executing the command\n");
	}

	// read the output a line at a time - output it.
	while (fgets(path, sizeof(path) - 1, fp) != NULL) {
		fprintf(f, "%s", path);
	}

	// closing files
	pclose(fp);
	fclose(f);

	return 0;
}<commit_msg>solve conflict in functions.h<commit_after>/*
*
* PURPOSE : Create the data folder to store outputs
*
* RETURN : void
*
*/
int initDataFolder() {
	char cmd[30];
	FILE *fp;
	sprintf(cmd, "%s%i", "mkdir -p ../commandexe/data/", getpid());
	fp = popen(cmd, "r");
	if (fp == NULL) {
		printf("[Error] - Error initialing process folder\n");
		exit(1);
	}
	return 0;
}

/*
*
* PURPOSE : Function that execute the c command and log the output in ../commandexe/data/[pid]/out.[index]
*
* PARAMS : char* -> command string
* PARAMS : int -> index of out.[index] log
* RETURN : int -> 0
*
*/
int execCommandAndLog(char* c, int index) {
	FILE *fp;
	char path[1035];
	char filename[7];

	sprintf(filename, "data/%i/%s.%i", getpid(), "out", index);
	FILE *f = fopen(filename, "w");
	if (f == NULL) {
		printf("[Error] - Error opening file!\n");
		exit(1);
	}

	// command open to read
	sprintf(c, "%s %s", c, "2>&1");
	fp = popen(c, "r");

	if (fp == NULL) {
		fprintf(f, "[Error] - Error executing the command\n");
	}

	// read the output a line at a time - output it.
	while (fgets(path, sizeof(path) - 1, fp) != NULL) {
		fprintf(f, "%s", path);
	}

	// closing files
	pclose(fp);
	fclose(f);

	return 0;
}

{'fraction_non_alphanumeric': 0.2008421052631579, 'fraction_numerical': 0.01263157894736842, 'mean_word_length': 3.335766423357664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '504154', 'n_tokens_mistral': 962, 'n_tokens_neox': 916, 'n_words': 277}