--- rw/libpnmrw.c.~1~	Tue Jun  9 14:08:57 1998
+++ rw/libpnmrw.c	Fri Jul  3 19:23:04 1998
@@ -16,6 +16,10 @@
 #include <sys/param.h>
 #endif
 
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#include <errno.h>
+#endif
+
 #if defined(SVR2) || defined(SVR3) || defined(SVR4)
 #ifndef SYSV
 #define SYSV
@@ -131,6 +135,7 @@
 static void
 pm_perror(char *reason)
 {
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
 #if defined(BSD4_4)
     __const extern char *__const sys_errlist[];
 #else
@@ -140,6 +145,7 @@
 #endif
 #if !defined(__EMX__) || defined(__CYGWIN32__)
     extern int errno;
+#endif
 #endif
     char *e;
 
