$NetBSD: patch-ab,v 1.5 2007/01/08 04:51:44 rillig Exp $

--- libcqcam/port.C.orig	2000-08-23 20:03:19.000000000 +0200
+++ libcqcam/port.C	2007-01-08 05:25:04.000000000 +0100
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <errno.h>
 
 #ifdef LOCKING
@@ -47,6 +48,10 @@
 #include <conio.h>
 #elif defined(FREEBSD)
 #include <machine/cpufunc.h>
+#elif defined(NETBSD)
+#include <sys/types.h>
+#include <machine/sysarch.h>
+#include <machine/pio.h>	/* XXX */
 #elif defined(BSDI)
 #include <machine/inline.h>
 #elif defined(OPENBSD)
@@ -90,6 +95,23 @@ port_t::port_t(int iport) {
     perror("fopen /dev/io");
     return;
   }
+#elif defined(NETBSD)
+# if defined(__alpha__)
+  if (alpha_pci_io_enable(1) != 0) {
+    perror("alpha_pci_io_enable");
+    return;
+  }
+# elif defined(__i386__)
+  if (i386_iopl(3) != 0) {
+    perror("i386_iopl");
+    return;
+  }
+# else
+#  error Not supported on this CPU.
+# endif
+#elif defined(LYNX)
+   if (io_access() < 0) {
+     perror("io_access");
 #elif defined(OPENBSD)
   if (i386_iopl(1) == -1) {
     perror("i386_iopl");
