diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-02-27 13:28:40 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2004-02-27 13:28:40 +0000 |
commit | a783e2c18c6b566b2f4c2b06e6c388a9645c826c (patch) | |
tree | ae12abc157dee99bd4c67bab25316be06d3519a2 /src/strerror.c | |
parent | cb721df9888a296af824a4acab4916694d6dc35d (diff) | |
download | cpio-a783e2c18c6b566b2f4c2b06e6c388a9645c826c.tar.gz cpio-a783e2c18c6b566b2f4c2b06e6c388a9645c826c.tar.bz2 |
Added to the repository
Diffstat (limited to 'src/strerror.c')
-rw-r--r-- | src/strerror.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/strerror.c b/src/strerror.c new file mode 100644 index 0000000..a838ed5 --- /dev/null +++ b/src/strerror.c @@ -0,0 +1,63 @@ +/* This file is part of GNU Radius. + Copyright (C) 2000,2001,2002,2003 Free Software Foundation, Inc. + + Written by Sergey Poznyakoff + + GNU Radius is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + GNU Radius is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Radius; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> + +#if defined(HAVE_SYS_ERRLIST) + +#if !HAVE_DECL_SYS_ERRLIST +extern char *sys_errlist[]; +#endif +#if !HAVE_DECL_SYS_NERR +extern int sys_nerr; +#endif + +char * +strerror (int err) +{ + static char buf[80]; + + if (err > sys_nerr) + { + sprintf(buf, _("error %d"), err); + return buf; + } + return sys_errlist[err]; +} + +#else + +char * +strerror (int err) +{ + static char buf[80]; + + sprintf(buf, _("error %d"), err); + return buf; +} + +#endif /* HAVE_SYS_ERRLIST */ + + |