-/* $Id: apropos_db.c,v 1.17 2011/12/01 23:46:26 kristaps Exp $ */
+/* $Id: apropos_db.c,v 1.21 2011/12/03 18:47:09 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <assert.h>
#include <fcntl.h>
#include <regex.h>
#include <string.h>
#include <unistd.h>
-#include <arpa/inet.h>
-
-#ifdef __linux__
+#if defined(__linux__)
+# include <endian.h>
# include <db_185.h>
+#elif defined(__APPLE__)
+# include <libkern/OSByteOrder.h>
+# include <db.h>
#else
# include <db.h>
#endif
vp = v->data;
norm_string((const char *)k->data, mc, buf);
- dbv->rec = ntohl(vp->rec);
- dbv->mask = vp->mask;
+ dbv->rec = betoh32(vp->rec);
+ dbv->mask = betoh64(vp->mask);
return(1);
}