1 | /* This file is part of GNU Radius.
|
---|
2 | Copyright (C) 2000,2001,2002,2003 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | Written by Sergey Poznyakoff
|
---|
5 |
|
---|
6 | GNU Radius is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2 of the License, or
|
---|
9 | (at your option) any later version.
|
---|
10 |
|
---|
11 | GNU Radius 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 General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public
|
---|
17 | License along with GNU Radius; if not, write to the Free
|
---|
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
---|
19 | Boston, MA 02110-1301 USA. */
|
---|
20 |
|
---|
21 | #ifdef HAVE_CONFIG_H
|
---|
22 | # include <config.h>
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #include <stdio.h>
|
---|
26 | #include <stdlib.h>
|
---|
27 | #include <errno.h>
|
---|
28 |
|
---|
29 | #if defined(HAVE_SYS_ERRLIST)
|
---|
30 |
|
---|
31 | #if !HAVE_DECL_SYS_ERRLIST
|
---|
32 | extern char *sys_errlist[];
|
---|
33 | #endif
|
---|
34 | #if !HAVE_DECL_SYS_NERR
|
---|
35 | extern int sys_nerr;
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | char *
|
---|
39 | strerror (int err)
|
---|
40 | {
|
---|
41 | static char buf[80];
|
---|
42 |
|
---|
43 | if (err > sys_nerr)
|
---|
44 | {
|
---|
45 | sprintf(buf, _("error %d"), err);
|
---|
46 | return buf;
|
---|
47 | }
|
---|
48 | return sys_errlist[err];
|
---|
49 | }
|
---|
50 |
|
---|
51 | #else
|
---|
52 |
|
---|
53 | char *
|
---|
54 | strerror (int err)
|
---|
55 | {
|
---|
56 | static char buf[80];
|
---|
57 |
|
---|
58 | sprintf(buf, _("error %d"), err);
|
---|
59 | return buf;
|
---|
60 | }
|
---|
61 |
|
---|
62 | #endif /* HAVE_SYS_ERRLIST */
|
---|
63 |
|
---|
64 |
|
---|