summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authortjg <tjg>1999-10-13 15:37:34 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:16 +0100
commit32514265eae23c9196b09477c63ab26850ecbe6a (patch)
tree444e58a6c77df0aabfc8d950a698afe5bfbf1a55 /proto.h
parent55187d8e921d611b3fa9ff4a166125c44b7dd6d9 (diff)
Portability: use POSIX strerror() where it's available; fake it with
sys_errlist[] where not.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 0f24fb5..7d2fe2a 100644
--- a/proto.h
+++ b/proto.h
@@ -59,6 +59,15 @@ extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *));
#endif /* STDC_HEADERS */
+#if HAVE_STRERROR
+/* Smells like POSIX. */
+#else
+/* Assume BSD-style sys_errlist[]. */
+extern int sys_nerr;
+extern char *sys_errlist[];
+#define strerror(x) ((0 <= (x)) && (errno < (x)) ? sys_errlist[x] : (char *)0)
+#endif
+
#if HAVE_UNISTD_H
#include <unistd.h>
#endif