Last change
on this file since 1064 was
1064,
checked in by Bruno Cornec, 14 years ago
|
More controls at the compiler level
still working with the problems around variable arguments
|
-
Property svn:eol-style set to
native
|
File size:
955 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 */ |
---|
23 | static 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 | */ |
---|
34 | void mr_exit(int errorcode, const char *message) { |
---|
35 | |
---|
36 | mr_cleanup(); |
---|
37 | fprintf(stderr,"%s\n",message); |
---|
38 | exit(errorcode); |
---|
39 | } |
---|
40 | |
---|
41 | void mr_log_exit(int errorcode, const char *message) { |
---|
42 | mr_msg(0, message); |
---|
43 | mr_exit(errorcode, message); |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.