error.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* Declaration for error-reporting function
  2. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
  3. NOTE: The canonical source of this file is maintained with the GNU C
  4. Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
  5. This program is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by the
  7. Free Software Foundation; either version 2, or (at your option) any
  8. later version.
  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. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. USA. */
  17. #ifndef _ERROR_H
  18. #define _ERROR_H 1
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #if defined (__STDC__) && __STDC__
  23. /* Print a message with `fprintf (stderr, FORMAT, ...)';
  24. if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
  25. If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
  26. extern void error (int status, int errnum, const char *format, ...)
  27. PRINTFFORMAT(3, 4);
  28. extern void error_at_line (int status, int errnum, const char *fname,
  29. unsigned int lineno, const char *format, ...)
  30. PRINTFFORMAT(5, 6);
  31. /* If NULL, error will flush stdout, then print on stderr the program
  32. name, a colon and a space. Otherwise, error will call this
  33. function without parameters instead. */
  34. extern void (*error_print_progname) (void);
  35. #else
  36. void error ();
  37. void error_at_line ();
  38. extern void (*error_print_progname) ();
  39. #endif
  40. /* This variable is incremented each time `error' is called. */
  41. extern unsigned int error_message_count;
  42. /* Sometimes we want to have at most one error per line. This
  43. variable controls whether this mode is selected or not. */
  44. extern int error_one_per_line;
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif /* error.h */