source: MondoRescue/trunk/mondo/src/lib/mr_err.c@ 1074

Last change on this file since 1074 was 1074, checked in by Bruno Cornec, 17 years ago

This version of trunk desn't seg fault on mr_msg anymore.
Still not ready for 3.0.0 but improvements ongoing

  • Property svn:eol-style set to native
File size: 955 bytes
RevLine 
[900]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
[1074]12#ifndef _GNU_SOURCE
13#define _GNU_SOURCE
14#endif
15
[900]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}
30
31/*
32 * Function that frees memory if necessary
33 */
34void mr_exit(int errorcode, const char *message) {
35
36 mr_cleanup();
37 fprintf(stderr,"%s\n",message);
38 exit(errorcode);
39}
40
41void mr_log_exit(int errorcode, const char *message) {
[1074]42 mr_msg(0, message);
[900]43 mr_exit(errorcode, message);
44}
Note: See TracBrowser for help on using the repository browser.