<commit_before>#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <malloc.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>

static void fix_display()
{
	setenv("DISPLAY", ":0", 1);
}

static void produce_message(char * type, const char *fmt, va_list args)
{
	char *dialog_msg;
	char buf[1024];
	(void) vsnprintf(buf, sizeof(buf), fmt, args);
	asprintf(&dialog_msg, "%s: %s: %s (error type: %s)",
		 program_invocation_short_name, type, buf, strerror(errno));
	fprintf(stderr, "%s", dialog_msg);
	switch (fork()) {
	case -1:
		exit(1);	//what else
	case 0:
		fix_display();
#ifdef USE_KDIALOG
		execlp("kdialog", "kdialog", "--sorry", dialog_msg, NULL);
#else

		execlp("zenity", "zenity", "--error --text", dialog_msg, NULL);
#endif
		exit(1);
	default:;
	}
}

void gui_fatal(const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	produce_message("Fatal error", fmt, args);
	va_end(args);
	exit(1);
}

void gui_nonfatal(const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	produce_message("Information", fmt, args);
	va_end(args);
}
<commit_msg>Fix stupid synatx error that prevented displaing error messages<commit_after>#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <malloc.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>

static void fix_display()
{
	setenv("DISPLAY", ":0", 1);
}

static void produce_message(char * type, const char *fmt, va_list args)
{
	char *dialog_msg;
	char buf[1024];
	(void) vsnprintf(buf, sizeof(buf), fmt, args);
	asprintf(&dialog_msg, "%s: %s: %s (error type: %s)",
		 program_invocation_short_name, type, buf, strerror(errno));
	fprintf(stderr, "%s", dialog_msg);
	switch (fork()) {
	case -1:
		exit(1);	//what else
	case 0:
		fix_display();
#ifdef USE_KDIALOG
		execlp("kdialog", "kdialog", "--sorry", dialog_msg, NULL);
#else

		execlp("zenity", "zenity", "--error",  "--text", dialog_msg, NULL);
#endif
		exit(1);
	default:;
	}
}

void gui_fatal(const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	produce_message("Fatal error", fmt, args);
	va_end(args);
	exit(1);
}

void gui_nonfatal(const char *fmt, ...)
{
	va_list args;
	va_start(args, fmt);
	produce_message("Information", fmt, args);
	va_end(args);
}

{'fraction_non_alphanumeric': 0.18405172413793103, 'fraction_numerical': 0.009482758620689655, 'mean_word_length': 5.14021164021164, 'pattern_counts': {'":': 2, '<': 19, '<?xml version=': 0, '>': 19, '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': '7176026', 'n_tokens_mistral': 973, 'n_tokens_neox': 926, 'n_words': 226}