xref: /dflybsd-src/contrib/grep/lib/strerror-override.h (revision a8597f6c2834b9c79a5491bc214978eb0de0c0ee)
1200fbe8dSJohn Marino /* strerror-override.h --- POSIX compatible system error routine
2200fbe8dSJohn Marino 
3cf28ed85SJohn Marino    Copyright (C) 2010-2012 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
16200fbe8dSJohn Marino    along with this program.  If not, see <http://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 \
33*a8597f6cSJohn 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 \
47*a8597f6cSJohn Marino      || GNULIB_defined_ECANCELED \
48*a8597f6cSJohn Marino      || GNULIB_defined_EOWNERDEAD \
49*a8597f6cSJohn Marino      || GNULIB_defined_ENOTRECOVERABLE
50200fbe8dSJohn Marino extern const char *strerror_override (int errnum);
51200fbe8dSJohn Marino # else
52200fbe8dSJohn Marino #  define strerror_override(ignored) NULL
53200fbe8dSJohn Marino # endif
54200fbe8dSJohn Marino 
55200fbe8dSJohn Marino #endif /* _GL_STRERROR_OVERRIDE_H */
56