Back to index

nagios-plugins  1.4.16
error.h
Go to the documentation of this file.
00001 /* Declaration for error-reporting function
00002    Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 Free Software
00003    Foundation, Inc.
00004    This file is part of the GNU C Library.
00005 
00006    This program is free software: you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #ifndef _ERROR_H
00020 #define _ERROR_H 1
00021 
00022 #ifndef __attribute__
00023 /* The __attribute__ feature is available in gcc versions 2.5 and later.
00024    The __-protected variants of the attributes 'format' and 'printf' are
00025    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
00026    We enable __attribute__ only if these are supported too, because
00027    gnulib and libintl do '#define printf __printf__' when they override
00028    the 'printf' function.  */
00029 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
00030 #  define __attribute__(Spec)   /* empty */
00031 # endif
00032 #endif
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 /* Print a message with `fprintf (stderr, FORMAT, ...)';
00039    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
00040    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
00041 
00042 extern void error (int __status, int __errnum, const char *__format, ...)
00043      __attribute__ ((__format__ (__printf__, 3, 4)));
00044 
00045 extern void error_at_line (int __status, int __errnum, const char *__fname,
00046                            unsigned int __lineno, const char *__format, ...)
00047      __attribute__ ((__format__ (__printf__, 5, 6)));
00048 
00049 /* If NULL, error will flush stdout, then print on stderr the program
00050    name, a colon and a space.  Otherwise, error will call this
00051    function without parameters instead.  */
00052 extern void (*error_print_progname) (void);
00053 
00054 /* This variable is incremented each time `error' is called.  */
00055 extern unsigned int error_message_count;
00056 
00057 /* Sometimes we want to have at most one error per line.  This
00058    variable controls whether this mode is selected or not.  */
00059 extern int error_one_per_line;
00060 
00061 #ifdef __cplusplus
00062 }
00063 #endif
00064 
00065 #endif /* error.h */