1 /*
2 * Copyright (C) 2002 Alan Robertson <alanr@unix.sh>
3 * This software licensed under the GNU LGPL.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of version 2.1 of the GNU Lesser General Public
7 * License as published by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19 #include <crm_internal.h>
20 #include <errno.h>
21 #include <stdio.h>
22 extern const char *sys_err[];
23 extern int sys_nerr;
24 char *
25 strerror(int errnum)
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
26 {
27 static char whaterr[32];
28
29 if (errnum < 0) {
30 return "negative errno";
31 }
32 if (errnum >= sys_nerr) {
33 snprintf(whaterr, sizeof(whaterr), "error %d", errnum);
34 return whaterr;
35 }
36 return sys_err[sys_nerr];
37 }