| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | /* messages.h -- a library for uniform output and error messages |
| 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation; either version 3 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 16 | |
| 17 | #ifndef _MESSAGES_H |
| 18 | #define _MESSAGES_H 1 |
| 19 | |
| 20 | #include "common.h" |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" |
| 24 | { |
| 25 | #endif |
| 26 | |
| 27 | /* Print a message with 'fprintf (stderr, FORMAT, ...)'; |
| 28 | if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). |
| 29 | If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ |
| 30 | _Noreturn void plugin_error (nagstatus status, int errnum, |
| 31 | const char *message, ...) |
| 32 | _attribute_format_printf_ (3, 4); |
| 33 | |
| 34 | /* This variable is incremented each time 'error' is called. */ |
| 35 | extern unsigned int error_message_count; |
| 36 | |
| 37 | const char *state_text (nagstatus status); |
| 38 | |
| 39 | #ifdef __cplusplus |
| 40 | } |
| 41 | #endif |
| 42 | |
| 43 | #endif /* _MESSAGES_H */ |