/*
 * $Id$
 *
 * Code (c)2006 Bruno Cornec <bruno@mondorescue.org>
 *
 *     Main file of mr_err : a very small and simple
 *     library for error management
 *
 * Provided under the GPLv2
 */

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <stdio.h>
#include <stdlib.h>

#include "mr_msg.h"

/* This should be a pointer to func setup by the main function */
	/* Highly incomplete function for the moment */
static void mr_cleanup(void) {
		/* We have to free all allocated memory */
		/* We have to remove all temporary files */
		/* We have to unmount what has been mounted */
		/* We have to properly end newt */
		/* We have to remind people of log files */
		mr_msg_close();
}

/*
 * Function that frees memory if necessary
 */
void mr_exit(int errorcode, const char *message) {

	mr_cleanup();
	fprintf(stderr,"%s\n",message);
	exit(errorcode);
}
