fmtmsg.h 3.2 KB

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