]>
Commit | Line | Data |
---|---|---|
25f98340 AJ |
1 | #include "config.h" |
2 | #include "compat/xstrerror.h" | |
3 | ||
4 | #if HAVE_STRING_H | |
5 | #include <string.h> | |
6 | #endif | |
7 | ||
8 | const char * | |
9 | xstrerr(int error) | |
10 | { | |
11 | static char xstrerror_buf[BUFSIZ]; | |
12 | const char *errmsg = strerror(error); | |
13 | ||
14 | if (!errmsg || !*errmsg) | |
15 | errmsg = "Unknown error"; | |
16 | ||
17 | snprintf(xstrerror_buf, BUFSIZ, "(%d) %s", error, errmsg); | |
18 | ||
19 | return xstrerror_buf; | |
20 | } |