<commit_before>BIN=./bin

beaksh: linenoise.h linenoise.c build

beaksh: linenoise.c beaksh.c
	$(CC) -Wall -W -Os -g -o $(BIN)/beaksh linenoise.c beaksh.c

build:
	@mkdir -p $(BIN)

clean:
	rm -f $(BIN)/beaksh
	rm -rf `find $(BIN) -name "*.dSYM" -print`
<commit_msg>Add unsafe function auditing. Closes #2.<commit_after>BIN=./bin
SOURCES=$(filter-out linenoise.c, $(wildcard src/**/*.c src/*.c *.c))

beaksh: linenoise.h linenoise.c build check

beaksh: linenoise.c beaksh.c
	$(CC) -Wall -W -Os -g -o $(BIN)/beaksh linenoise.c beaksh.c

build:
	@mkdir -p $(BIN)

clean:
	rm -f $(BIN)/beaksh
	rm -rf `find $(BIN) -name "*.dSYM" -print`

BADFUNCS='[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)'

check:
	@echo Files with potentially dangerous functions:
	@egrep $(BADFUNCS) $(SOURCES) || true

{'fraction_non_alphanumeric': 0.20072115384615385, 'fraction_numerical': 0.003605769230769231, 'mean_word_length': 4.018072289156627, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7667810', 'n_tokens_mistral': 391, 'n_tokens_neox': 370, 'n_words': 88}