<commit_before>#include "system.h"
#include "sccs.h"

int
preference_main(int ac, char **av)
{
	unless (ac == 2) return (1);
	fputs(user_preference(av[1]), stdout);
	fputs("\n", stdout);
	return (0);
}


char *
user_preference(char *what)
{
	char *p;

	unless (bk_proj) return "";
	unless (bk_proj->config) {
		unless (bk_proj->root) return "";
		bk_proj->config = loadConfig(bk_proj->root, 0);
		unless (bk_proj->config) return "";
	}
	p = mdbm_fetch_str(bk_proj->config, what);
	unless (p) p = "";
	return (p);
}<commit_msg>Change the loadConfig() interface in preference.c and make  it print the whole config file after parsing.<commit_after>#include "system.h"
#include "sccs.h"

int
preference_main(int ac, char **av)
{
	kvpair	kv;
	MDBM	*db;
	char	**list = 0;
	char	*l;
	int	i;

	if (ac == 2) {
		fputs(user_preference(av[1]), stdout);
		fputs("\n", stdout);
		return (0);
	}
	if (ac != 1) return (1);
	user_preference("xxx");
	unless (bk_proj && (db = bk_proj->config)) return (1);
	for (kv = mdbm_first(db); kv.key.dsize; kv = mdbm_next(db)) {
		l = aprintf("%s: %s", kv.key.dptr, kv.val.dptr);
		list = addLine(list, l);
	}
	sortLines(list);
	EACH(list) {
		printf("%s\n", list[i]);
	}
	freeLines(list);
	return (0);
}


char *
user_preference(char *what)
{
	char *p;

	unless (bk_proj) return "";
	unless (bk_proj->config) {
		unless (bk_proj->root) return "";
		bk_proj->config = loadConfig(bk_proj->root);
		unless (bk_proj->config) return "";
	}
	p = mdbm_fetch_str(bk_proj->config, what);
	unless (p) p = "";
	return (p);
}
{'fraction_non_alphanumeric': 0.19193233571893298, 'fraction_numerical': 0.008458035133376708, 'mean_word_length': 4.303448275862069, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, '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': '5169683', 'n_tokens_mistral': 717, 'n_tokens_neox': 649, 'n_words': 150}