err.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* 4.4BSD utility functions for error messages.
  2. Copyright (C) 1995-2026 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 _ERR_H
  16. #define _ERR_H 1
  17. #include <features.h>
  18. #define __need___va_list
  19. #include <stdarg.h>
  20. #ifndef __GNUC_VA_LIST
  21. # define __gnuc_va_list void *
  22. #endif
  23. __BEGIN_DECLS
  24. /* Print "program: ", FORMAT, ": ", the standard error string for errno,
  25. and a newline, on stderr. */
  26. extern void warn (const char *__format, ...)
  27. __attribute__ ((__format__ (__printf__, 1, 2))) __COLD;
  28. extern void vwarn (const char *__format, __gnuc_va_list)
  29. __attribute__ ((__format__ (__printf__, 1, 0))) __COLD;
  30. /* Likewise, but without ": " and the standard error string. */
  31. extern void warnx (const char *__format, ...)
  32. __attribute__ ((__format__ (__printf__, 1, 2)));
  33. extern void vwarnx (const char *__format, __gnuc_va_list)
  34. __attribute__ ((__format__ (__printf__, 1, 0)));
  35. /* Likewise, and then exit with STATUS. */
  36. extern void err (int __status, const char *__format, ...)
  37. __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))) __COLD;
  38. extern void verr (int __status, const char *__format, __gnuc_va_list)
  39. __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))) __COLD;
  40. extern void errx (int __status, const char *__format, ...)
  41. __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))) __COLD;
  42. extern void verrx (int __status, const char *, __gnuc_va_list)
  43. __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))) __COLD;
  44. #include <bits/floatn.h>
  45. #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
  46. # include <bits/err-ldbl.h>
  47. #endif
  48. __END_DECLS
  49. #endif /* err.h */