| 1 |
/* message.h: extend the standard programming environment a little. */ |
| 2 |
|
| 3 |
#ifndef MESSAGE_H |
| 4 |
#define MESSAGE_H |
| 5 |
|
| 6 |
#include <stdio.h> |
| 7 |
#include <stdlib.h> |
| 8 |
|
| 9 |
#include "logreport.h" |
| 10 |
|
| 11 |
/* Define common sorts of messages. */ |
| 12 |
|
| 13 |
#define START_FATAL() do { fputs ("fatal: ", stderr); LOG("fatal: ") |
| 14 |
#define END_FATAL() fputs (".\n", stderr); exit (1); } while (0) |
| 15 |
|
| 16 |
#define FATAL(s) \ |
| 17 |
START_FATAL (); fprintf (stderr, "%s", s); LOG (s); END_FATAL () |
| 18 |
#define FATAL1(s, e1) \ |
| 19 |
START_FATAL (); fprintf (stderr, s, e1); LOG1 (s, e1); END_FATAL () |
| 20 |
|
| 21 |
|
| 22 |
#define START_WARNING() do { fputs ("warning: ", stderr); LOG ("warning: ") |
| 23 |
#define END_WARNING() fputs (".\n", stderr); } while (0) |
| 24 |
|
| 25 |
#define WARNING(s) \ |
| 26 |
START_WARNING (); fprintf (stderr, "%s", s); LOG (s); END_WARNING () |
| 27 |
#define WARNING1(s, e1) \ |
| 28 |
START_WARNING (); fprintf (stderr, s, e1); LOG1 (s, e1); END_WARNING () |
| 29 |
|
| 30 |
#endif /* not MESSAGE_H */ |
| 31 |
|