xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 1 | /* Message display handling. |
| 2 | Copyright (C) 1997-2016 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <http://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #ifndef __FMTMSG_H |
| 20 | #define __FMTMSG_H 1 |
| 21 | |
| 22 | #include <features.h> |
| 23 | |
| 24 | |
| 25 | __BEGIN_DECLS |
| 26 | |
| 27 | /* Values to control `fmtmsg' function. */ |
| 28 | enum |
| 29 | { |
| 30 | MM_HARD = 0x001, /* Source of the condition is hardware. */ |
| 31 | #define MM_HARD MM_HARD |
| 32 | MM_SOFT = 0x002, /* Source of the condition is software. */ |
| 33 | #define MM_SOFT MM_SOFT |
| 34 | MM_FIRM = 0x004, /* Source of the condition is firmware. */ |
| 35 | #define MM_FIRM MM_FIRM |
| 36 | MM_APPL = 0x008, /* Condition detected by application. */ |
| 37 | #define MM_APPL MM_APPL |
| 38 | MM_UTIL = 0x010, /* Condition detected by utility. */ |
| 39 | #define MM_UTIL MM_UTIL |
| 40 | MM_OPSYS = 0x020, /* Condition detected by operating system. */ |
| 41 | #define MM_OPSYS MM_OPSYS |
| 42 | MM_RECOVER = 0x040, /* Recoverable error. */ |
| 43 | #define MM_RECOVER MM_RECOVER |
| 44 | MM_NRECOV = 0x080, /* Non-recoverable error. */ |
| 45 | #define MM_NRECOV MM_NRECOV |
| 46 | MM_PRINT = 0x100, /* Display message in standard error. */ |
| 47 | #define MM_PRINT MM_PRINT |
| 48 | MM_CONSOLE = 0x200 /* Display message on system console. */ |
| 49 | #define MM_CONSOLE MM_CONSOLE |
| 50 | }; |
| 51 | |
| 52 | /* Values to be for SEVERITY parameter of `fmtmsg'. */ |
| 53 | enum |
| 54 | { |
| 55 | MM_NOSEV = 0, /* No severity level provided for the message. */ |
| 56 | #define MM_NOSEV MM_NOSEV |
| 57 | MM_HALT, /* Error causing application to halt. */ |
| 58 | #define MM_HALT MM_HALT |
| 59 | MM_ERROR, /* Application has encountered a non-fatal fault. */ |
| 60 | #define MM_ERROR MM_ERROR |
| 61 | MM_WARNING, /* Application has detected unusual non-error |
| 62 | condition. */ |
| 63 | #define MM_WARNING MM_WARNING |
| 64 | MM_INFO /* Informative message. */ |
| 65 | #define MM_INFO MM_INFO |
| 66 | }; |
| 67 | |
| 68 | |
| 69 | /* Macros which can be used as null values for the arguments of `fmtmsg'. */ |
| 70 | #define MM_NULLLBL ((char *) 0) |
| 71 | #define MM_NULLSEV 0 |
| 72 | #define MM_NULLMC ((long int) 0) |
| 73 | #define MM_NULLTXT ((char *) 0) |
| 74 | #define MM_NULLACT ((char *) 0) |
| 75 | #define MM_NULLTAG ((char *) 0) |
| 76 | |
| 77 | |
| 78 | /* Possible return values of `fmtmsg'. */ |
| 79 | enum |
| 80 | { |
| 81 | MM_NOTOK = -1, |
| 82 | #define MM_NOTOK MM_NOTOK |
| 83 | MM_OK = 0, |
| 84 | #define MM_OK MM_OK |
| 85 | MM_NOMSG = 1, |
| 86 | #define MM_NOMSG MM_NOMSG |
| 87 | MM_NOCON = 4 |
| 88 | #define MM_NOCON MM_NOCON |
| 89 | }; |
| 90 | |
| 91 | |
| 92 | /* Print message with given CLASSIFICATION, LABEL, SEVERITY, TEXT, ACTION |
| 93 | and TAG to console or standard error. */ |
| 94 | extern int fmtmsg (long int __classification, const char *__label, |
| 95 | int __severity, const char *__text, |
| 96 | const char *__action, const char *__tag); |
| 97 | |
| 98 | #ifdef __USE_MISC |
| 99 | /* Add or remove severity level. */ |
| 100 | extern int addseverity (int __severity, const char *__string) __THROW; |
| 101 | #endif |
| 102 | |
| 103 | __END_DECLS |
| 104 | |
| 105 | #endif /* fmtmsg.h */ |