Last change
on this file since 1047 was 900, checked in by Bruno Cornec, 18 years ago |
Huge patch to introduce low level functions that will bw used everywhere (mr_free, mr_asprintf, ...)
Nearly linking now due to that.
|
-
Property svn:eol-style
set to
native
|
File size:
906 bytes
|
Rev | Line | |
---|
[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 |
|
---|
| 12 | #include <stdio.h>
|
---|
| 13 | #include <stdlib.h>
|
---|
| 14 |
|
---|
| 15 | #include "mr_msg.h"
|
---|
| 16 |
|
---|
| 17 | /* This should be a pointer to func setup by the main function */
|
---|
| 18 | /* Highly incomplete function for the moment */
|
---|
| 19 | static void mr_cleanup(void) {
|
---|
| 20 | /* We have to free all allocated memory */
|
---|
| 21 | /* We have to remove all temporary files */
|
---|
| 22 | /* We have to unmount what has been mounted */
|
---|
| 23 | /* We have to properly end newt */
|
---|
| 24 | /* We have to remind people of log files */
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | /*
|
---|
| 28 | * Function that frees memory if necessary
|
---|
| 29 | */
|
---|
| 30 | void mr_exit(int errorcode, const char *message) {
|
---|
| 31 |
|
---|
| 32 | mr_cleanup();
|
---|
| 33 | fprintf(stderr,"%s\n",message);
|
---|
| 34 | exit(errorcode);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | void mr_log_exit(int errorcode, const char *message) {
|
---|
| 38 | mr_msg(0,message);
|
---|
| 39 | mr_exit(errorcode, message);
|
---|
| 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.