strerror: drop strerror_r dependency
[gnulib.git] / lib / strerror-override.h
1 /* strerror-override.h --- POSIX compatible system error routine
2
3    Copyright (C) 2010-2011 Free Software Foundation, Inc.
4
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18 #ifndef _GL_STRERROR_OVERRIDE_H
19 # define _GL_STRERROR_OVERRIDE_H
20
21 # include <string.h>
22
23 /* Reasonable buffer size that should never trigger ERANGE; if this
24    proves too small, we intentionally abort(), to remind us to fix
25    this value.  */
26 # define STACKBUF_LEN 256
27
28 /* If ERRNUM maps to an errno value defined by gnulib, return a string
29    describing the error.  Otherwise return NULL.  */
30 # if GNULIB_defined_ETXTBSY \
31     || GNULIB_defined_ESOCK \
32     || GNULIB_defined_ENOMSG \
33     || GNULIB_defined_EIDRM \
34     || GNULIB_defined_ENOLINK \
35     || GNULIB_defined_EPROTO \
36     || GNULIB_defined_EMULTIHOP \
37     || GNULIB_defined_EBADMSG \
38     || GNULIB_defined_EOVERFLOW \
39     || GNULIB_defined_ENOTSUP \
40     || GNULIB_defined_ESTALE \
41     || GNULIB_defined_EDQUOT \
42     || GNULIB_defined_ECANCELED
43 extern const char *strerror_override (int errnum);
44 # else
45 #  define strerror_override(ignored) NULL
46 # endif
47
48 #endif /* _GL_STRERROR_OVERRIDE_H */