source: branches/stable/mondo/src/lib/mr_err.c @ 1104

Last change on this file since 1104 was 1104, checked in by Bruno Cornec, 13 years ago

Improvement of the low level library (Usage of LINE and FILE and simplified interfaces using macros)

  • Property svn:eol-style set to native
File size: 864 bytes
Line 
1/*
2 * $Id$
3 *
4 * Code (c)2006 Bruno Cornec <bruno@mondorescue.org>
5 *
6 *     Main file of mr_err : a very small and simple
7 *     library for error management
8 *
9 * Provided under the GPLv2
10 */
11
12#ifndef _GNU_SOURCE
13#define _GNU_SOURCE
14#endif
15
16#include <stdio.h>
17#include <stdlib.h>
18
19#include "mr_msg.h"
20
21/* This should be a pointer to func setup by the main function */
22    /* Highly incomplete function for the moment */
23static void mr_cleanup(void) {
24        /* We have to free all allocated memory */
25        /* We have to remove all temporary files */
26        /* We have to unmount what has been mounted */
27        /* We have to properly end newt */
28        /* We have to remind people of log files */
29        mr_msg_close();
30}
31
32/*
33 * Function that frees memory if necessary
34 */
35void mr_exit(int errorcode, const char *message) {
36
37    mr_cleanup();
38    fprintf(stderr,"%s\n",message);
39    exit(errorcode);
40}
Note: See TracBrowser for help on using the repository browser.