<commit_before>#ifndef SHELL_H
#define SHELL_H

#include <stdbool.h>
#include <signal.h>

/*More verbose error reporting. Only works if DEBUG is defined at compile time*/
#define report_error() fprintf(stderr, "[%s: %s():%d] %s\n", __FILE__, \
		__FUNCTION__, \
		__LINE__, \
		strerror(errno));

#define sizeof_array(x) (sizeof(x) / sizeof(*x))

/*Ignore most signals since we're an interactive shell*/
#define SET_SIGNALS_SHELL \
	signal(SIGINT, SIG_IGN); \
signal(SIGQUIT, SIG_IGN); \
signal(SIGTSTP, SIG_IGN); \
signal(SIGTTIN, SIG_IGN); \
signal(SIGTTOU, SIG_IGN); \
signal(SIGCHLD, SIG_DFL);

/*Set most signals back to default for spawned processes*/
#define SET_SIGNALS_PROC \
	signal(SIGINT, SIG_DFL); \
signal(SIGQUIT, SIG_DFL); \
signal(SIGTSTP, SIG_DFL); \
signal(SIGTTIN, SIG_DFL); \
signal(SIGTTOU, SIG_DFL); \

/*Error codes for shell_error() in shell.c*/
#define ERR_NO_SUCH_VAR 0
#define ERR_NO_SUCH_COM 1
#define ERR_NO_SUCH_FIL 2
#define ERR_INVAL_INPUT 3
#define ERR_SHELL_ERROR 4
<commit_msg>[BUGFIX]: report_error() is only needed if DEBUG is defined<commit_after>#ifndef SHELL_H
#define SHELL_H

#include <stdbool.h>
#include <signal.h>

/*More verbose error reporting. Only works if DEBUG is defined at compile time*/
#ifdef DEBUG
#define report_error() fprintf(stderr, "[%s: %s():%d] %s\n", __FILE__, \
		__FUNCTION__, \
		__LINE__, \
		strerror(errno));
#endif

#define sizeof_array(x) (sizeof(x) / sizeof(*x))

/*Ignore most signals since we're an interactive shell*/
#define SET_SIGNALS_SHELL \
	signal(SIGINT, SIG_IGN); \
signal(SIGQUIT, SIG_IGN); \
signal(SIGTSTP, SIG_IGN); \
signal(SIGTTIN, SIG_IGN); \
signal(SIGTTOU, SIG_IGN); \
signal(SIGCHLD, SIG_DFL);

/*Set most signals back to default for spawned processes*/
#define SET_SIGNALS_PROC \
	signal(SIGINT, SIG_DFL); \
signal(SIGQUIT, SIG_DFL); \
signal(SIGTSTP, SIG_DFL); \
signal(SIGTTIN, SIG_DFL); \
signal(SIGTTOU, SIG_DFL); \

/*Error codes for shell_error() in shell.c*/
#define ERR_NO_SUCH_VAR 0
#define ERR_NO_SUCH_COM 1
#define ERR_NO_SUCH_FIL 2
#define ERR_INVAL_INPUT 3
#define ERR_SHELL_ERROR 4

{'fraction_non_alphanumeric': 0.13432122370936903, 'fraction_numerical': 0.004780114722753346, 'mean_word_length': 5.3810975609756095, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1724770', 'n_tokens_mistral': 828, 'n_tokens_neox': 799, 'n_words': 209}