(root)/
diffutils-3.10/
lib/
error.in.h
       1  /* Declarations for error-reporting functions.
       2     Copyright (C) 1995-1997, 2003, 2006, 2008-2023 Free Software Foundation,
       3     Inc.
       4     This file is part of the GNU C Library.
       5  
       6     This file is free software: you can redistribute it and/or modify
       7     it under the terms of the GNU Lesser General Public License as
       8     published by the Free Software Foundation; either version 2.1 of the
       9     License, or (at your option) any later version.
      10  
      11     This file is distributed in the hope that it will be useful,
      12     but WITHOUT ANY WARRANTY; without even the implied warranty of
      13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14     GNU Lesser General Public License for more details.
      15  
      16     You should have received a copy of the GNU Lesser General Public License
      17     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      18  
      19  #ifndef _@GUARD_PREFIX@_ERROR_H
      20  
      21  #if __GNUC__ >= 3
      22  @PRAGMA_SYSTEM_HEADER@
      23  #endif
      24  
      25  /* The include_next requires a split double-inclusion guard.  */
      26  #if @HAVE_ERROR_H@
      27  # @INCLUDE_NEXT@ @NEXT_ERROR_H@
      28  #endif
      29  
      30  #ifndef _@GUARD_PREFIX@_ERROR_H
      31  #define _@GUARD_PREFIX@_ERROR_H
      32  
      33  /* This file uses _GL_ATTRIBUTE_FORMAT.  */
      34  #if !_GL_CONFIG_H_INCLUDED
      35   #error "Please include config.h first."
      36  #endif
      37  
      38  /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM.  */
      39  #include <stdio.h>
      40  
      41  /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
      42  
      43  #if GNULIB_VFPRINTF_POSIX
      44  # define _GL_ATTRIBUTE_SPEC_PRINTF_ERROR _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
      45  #else
      46  # define _GL_ATTRIBUTE_SPEC_PRINTF_ERROR _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM
      47  #endif
      48  
      49  #ifdef __cplusplus
      50  extern "C" {
      51  #endif
      52  
      53  /* Print a message with 'fprintf (stderr, FORMAT, ...)';
      54     if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
      55     If STATUS is nonzero, terminate the program with 'exit (STATUS)'.  */
      56  #if @REPLACE_ERROR@
      57  # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
      58  #  undef error
      59  #  define error rpl_error
      60  # endif
      61  _GL_FUNCDECL_RPL (error, void,
      62                    (int __status, int __errnum, const char *__format, ...)
      63                    _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)));
      64  _GL_CXXALIAS_RPL (error, void,
      65                    (int __status, int __errnum, const char *__format, ...));
      66  #else
      67  # if ! @HAVE_ERROR@
      68  _GL_FUNCDECL_SYS (error, void,
      69                    (int __status, int __errnum, const char *__format, ...)
      70                    _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 3, 4)));
      71  # endif
      72  _GL_CXXALIAS_SYS (error, void,
      73                    (int __status, int __errnum, const char *__format, ...));
      74  #endif
      75  #if __GLIBC__ >= 2
      76  _GL_CXXALIASWARN (error);
      77  #endif
      78  
      79  /* Likewise.  If FILENAME is non-NULL, include FILENAME:LINENO: in the
      80     message.  */
      81  #if @REPLACE_ERROR_AT_LINE@
      82  # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
      83  #  undef error_at_line
      84  #  define error_at_line rpl_error_at_line
      85  # endif
      86  _GL_FUNCDECL_RPL (error_at_line, void,
      87                    (int __status, int __errnum, const char *__filename,
      88                     unsigned int __lineno, const char *__format, ...)
      89                    _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)));
      90  _GL_CXXALIAS_RPL (error_at_line, void,
      91                    (int __status, int __errnum, const char *__filename,
      92                     unsigned int __lineno, const char *__format, ...));
      93  #else
      94  # if ! @HAVE_ERROR_AT_LINE@
      95  _GL_FUNCDECL_SYS (error_at_line, void,
      96                    (int __status, int __errnum, const char *__filename,
      97                     unsigned int __lineno, const char *__format, ...)
      98                    _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_ERROR, 5, 6)));
      99  # endif
     100  _GL_CXXALIAS_SYS (error_at_line, void,
     101                    (int __status, int __errnum, const char *__filename,
     102                     unsigned int __lineno, const char *__format, ...));
     103  #endif
     104  _GL_CXXALIASWARN (error_at_line);
     105  
     106  /* If NULL, error will flush stdout, then print on stderr the program
     107     name, a colon and a space.  Otherwise, error will call this
     108     function without parameters instead.  */
     109  extern void (*error_print_progname) (void);
     110  
     111  /* This variable is incremented each time 'error' is called.  */
     112  extern unsigned int error_message_count;
     113  
     114  /* Sometimes we want to have at most one error per line.  This
     115     variable controls whether this mode is selected or not.  */
     116  extern int error_one_per_line;
     117  
     118  #ifdef __cplusplus
     119  }
     120  #endif
     121  
     122  #endif /* _@GUARD_PREFIX@_ERROR_H */
     123  #endif /* _@GUARD_PREFIX@_ERROR_H */