err.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* 4.4BSD utility functions for error messages.
  2. Copyright (C) 1995-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 _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)));
  28. extern void vwarn (const char *__format, __gnuc_va_list)
  29. __attribute__ ((__format__ (__printf__, 1, 0)));
  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)));
  38. extern void verr (int __status, const char *__format, __gnuc_va_list)
  39. __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
  40. extern void errx (int __status, const char *__format, ...)
  41. __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
  42. extern void verrx (int __status, const char *, __gnuc_va_list)
  43. __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
  44. #ifdef __LDBL_COMPAT
  45. # include <bits/err-ldbl.h>
  46. #endif
  47. __END_DECLS
  48. #endif /* err.h */