xref: /dflybsd-src/contrib/grep/lib/strerror-override.h (revision 91b9ed38d3db6a8a8ac5b66da1d43e6e331e259a)
1200fbe8dSJohn Marino /* strerror-override.h --- POSIX compatible system error routine
2200fbe8dSJohn Marino 
3*09d4459fSDaniel Fojt    Copyright (C) 2010-2020 Free Software Foundation, Inc.
4200fbe8dSJohn Marino 
5200fbe8dSJohn Marino    This program is free software: you can redistribute it and/or modify
6200fbe8dSJohn Marino    it under the terms of the GNU General Public License as published by
7200fbe8dSJohn Marino    the Free Software Foundation; either version 3 of the License, or
8200fbe8dSJohn Marino    (at your option) any later version.
9200fbe8dSJohn Marino 
10200fbe8dSJohn Marino    This program is distributed in the hope that it will be useful,
11200fbe8dSJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
12200fbe8dSJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13200fbe8dSJohn Marino    GNU General Public License for more details.
14200fbe8dSJohn Marino 
15200fbe8dSJohn Marino    You should have received a copy of the GNU General Public License
16*09d4459fSDaniel Fojt    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17200fbe8dSJohn Marino 
18200fbe8dSJohn Marino #ifndef _GL_STRERROR_OVERRIDE_H
19200fbe8dSJohn Marino # define _GL_STRERROR_OVERRIDE_H
20200fbe8dSJohn Marino 
21200fbe8dSJohn Marino # include <errno.h>
22200fbe8dSJohn Marino # include <stddef.h>
23200fbe8dSJohn Marino 
24200fbe8dSJohn Marino /* Reasonable buffer size that should never trigger ERANGE; if this
25200fbe8dSJohn Marino    proves too small, we intentionally abort(), to remind us to fix
26200fbe8dSJohn Marino    this value.  */
27200fbe8dSJohn Marino # define STACKBUF_LEN 256
28200fbe8dSJohn Marino 
29200fbe8dSJohn Marino /* If ERRNUM maps to an errno value defined by gnulib, return a string
30200fbe8dSJohn Marino    describing the error.  Otherwise return NULL.  */
31cf28ed85SJohn Marino # if REPLACE_STRERROR_0 \
32200fbe8dSJohn Marino      || GNULIB_defined_ESOCK \
33a8597f6cSJohn Marino      || GNULIB_defined_ESTREAMS \
34cf28ed85SJohn Marino      || GNULIB_defined_EWINSOCK \
35200fbe8dSJohn Marino      || GNULIB_defined_ENOMSG \
36200fbe8dSJohn Marino      || GNULIB_defined_EIDRM \
37200fbe8dSJohn Marino      || GNULIB_defined_ENOLINK \
38200fbe8dSJohn Marino      || GNULIB_defined_EPROTO \
39200fbe8dSJohn Marino      || GNULIB_defined_EMULTIHOP \
40200fbe8dSJohn Marino      || GNULIB_defined_EBADMSG \
41200fbe8dSJohn Marino      || GNULIB_defined_EOVERFLOW \
42200fbe8dSJohn Marino      || GNULIB_defined_ENOTSUP \
43cf28ed85SJohn Marino      || GNULIB_defined_ENETRESET \
44cf28ed85SJohn Marino      || GNULIB_defined_ECONNABORTED \
45200fbe8dSJohn Marino      || GNULIB_defined_ESTALE \
46200fbe8dSJohn Marino      || GNULIB_defined_EDQUOT \
47a8597f6cSJohn Marino      || GNULIB_defined_ECANCELED \
48a8597f6cSJohn Marino      || GNULIB_defined_EOWNERDEAD \
49680a9cb8SJohn Marino      || GNULIB_defined_ENOTRECOVERABLE \
50680a9cb8SJohn Marino      || GNULIB_defined_EILSEQ
51680a9cb8SJohn Marino extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
52200fbe8dSJohn Marino # else
53200fbe8dSJohn Marino #  define strerror_override(ignored) NULL
54200fbe8dSJohn Marino # endif
55200fbe8dSJohn Marino 
56200fbe8dSJohn Marino #endif /* _GL_STRERROR_OVERRIDE_H */
57