Last change
on this file since 3864 was 1422, checked in by Bruno Cornec, 17 years ago |
mr_conf now handles # inside strings correctly (before they were considered as a comment which they are not !)
|
-
Property svn:eol-style
set to
native
|
File size:
612 bytes
|
Rev | Line | |
---|
[1054] | 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 |
|
---|
[1064] | 12 | #ifndef _GNU_SOURCE
|
---|
| 13 | #define _GNU_SOURCE
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
[1054] | 16 | #include <stdio.h>
|
---|
| 17 | #include <stdlib.h>
|
---|
| 18 |
|
---|
[1264] | 19 | /* Pointer to the right cleanup function provided by each main */
|
---|
[1269] | 20 | extern void (*mr_cleanup)(void);
|
---|
[1054] | 21 |
|
---|
| 22 | /*
|
---|
| 23 | * Function that frees memory if necessary
|
---|
| 24 | */
|
---|
| 25 | void mr_exit(int errorcode, const char *message) {
|
---|
| 26 |
|
---|
[1422] | 27 | if (mr_cleanup != NULL) {
|
---|
| 28 | mr_cleanup();
|
---|
| 29 | }
|
---|
[1256] | 30 | if (message != NULL) {
|
---|
| 31 | fprintf(stderr,"%s\n",message);
|
---|
| 32 | }
|
---|
[1054] | 33 | exit(errorcode);
|
---|
| 34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.