aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-07-20 00:23:14 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-07-20 00:23:14 +0000
commit48348154aec21430802ec7a6c5928ca01ff2ad1e (patch)
tree93848dadf38b27688b0bb04bcb6f9b75e607a3dd
parent6b4480e041335acb92e1c76c4bdc9186f5bfb0f2 (diff)
downloadmandoc-48348154aec21430802ec7a6c5928ca01ff2ad1e.tar.gz
mandoc-48348154aec21430802ec7a6c5928ca01ff2ad1e.tar.zst
mandoc-48348154aec21430802ec7a6c5928ca01ff2ad1e.zip
Linux compatibility: Work around the lack of EFTYPE and protect <err.h>.
-rw-r--r--Makefile.depend18
-rwxr-xr-xconfigure3
-rw-r--r--dba_write.c6
-rw-r--r--dbm.c6
-rw-r--r--dbm_map.c6
-rw-r--r--mansearch.c3
-rw-r--r--mansearch.h4
-rw-r--r--test-EFTYPE.c7
8 files changed, 38 insertions, 15 deletions
diff --git a/Makefile.depend b/Makefile.depend
index e0c3a2e9..e55157b7 100644
--- a/Makefile.depend
+++ b/Makefile.depend
@@ -1,13 +1,13 @@
att.o: att.c config.h roff.h mdoc.h libmdoc.h
cgi.o: cgi.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h main.h manconf.h mansearch.h cgi.h
-chars.o: chars.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h libmandoc.h
+chars.o: chars.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h libmandoc.h
compat_err.o: compat_err.c config.h
-compat_fts.o: compat_fts.c config.h
+compat_fts.o: compat_fts.c config.h compat_fts.h
compat_getline.o: compat_getline.c config.h
compat_getsubopt.o: compat_getsubopt.c config.h
compat_isblank.o: compat_isblank.c config.h
compat_mkdtemp.o: compat_mkdtemp.c config.h
-compat_ohash.o: compat_ohash.c config.h
+compat_ohash.o: compat_ohash.c config.h compat_ohash.h
compat_progname.o: compat_progname.c config.h
compat_reallocarray.o: compat_reallocarray.c config.h
compat_strcasestr.o: compat_strcasestr.c config.h
@@ -20,9 +20,9 @@ compat_vasprintf.o: compat_vasprintf.c config.h
dba.o: dba.c mandoc_aux.h mansearch.h dba_write.h dba_array.h dba.h
dba_array.o: dba_array.c mandoc_aux.h dba_write.h dba_array.h
dba_read.o: dba_read.c mandoc_aux.h mansearch.h dba_array.h dba.h dbm.h
-dba_write.o: dba_write.c dba_write.h
-dbm.o: dbm.c mansearch.h dbm_map.h dbm.h
-dbm_map.o: dbm_map.c mansearch.h dbm_map.h dbm.h
+dba_write.o: dba_write.c config.h dba_write.h
+dbm.o: dbm.c config.h mansearch.h dbm_map.h dbm.h
+dbm_map.o: dbm_map.c config.h mansearch.h dbm_map.h dbm.h
demandoc.o: demandoc.c config.h roff.h man.h mdoc.h mandoc.h
eqn.o: eqn.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
eqn_html.o: eqn_html.c config.h mandoc.h out.h html.h
@@ -39,10 +39,10 @@ man_validate.o: man_validate.c config.h mandoc_aux.h mandoc.h roff.h man.h libma
mandoc.o: mandoc.c config.h mandoc.h mandoc_aux.h libmandoc.h
mandoc_aux.o: mandoc_aux.c config.h mandoc.h mandoc_aux.h
mandoc_ohash.o: mandoc_ohash.c mandoc_aux.h mandoc_ohash.h compat_ohash.h
-mandocdb.o: mandocdb.c config.h mandoc_aux.h mandoc_ohash.h mandoc.h roff.h mdoc.h man.h manconf.h mansearch.h dba_array.h dba.h
+mandocdb.o: mandocdb.c config.h compat_fts.h mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc.h roff.h mdoc.h man.h manconf.h mansearch.h dba_array.h dba.h
manpage.o: manpage.c config.h manconf.h mansearch.h
manpath.o: manpath.c config.h mandoc_aux.h manconf.h
-mansearch.o: mansearch.c mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h manconf.h mansearch.h dbm.h
+mansearch.o: mansearch.c config.h mandoc.h mandoc_aux.h mandoc_ohash.h compat_ohash.h manconf.h mansearch.h dbm.h
mdoc.o: mdoc.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
mdoc_argv.o: mdoc_argv.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h libmandoc.h roff_int.h libmdoc.h
mdoc_hash.o: mdoc_hash.c config.h mandoc.h roff.h mdoc.h libmandoc.h libmdoc.h
@@ -59,7 +59,7 @@ read.o: read.c config.h mandoc_aux.h mandoc.h roff.h mdoc.h man.h libmandoc.h ro
roff.o: roff.c config.h mandoc.h mandoc_aux.h roff.h libmandoc.h roff_int.h libroff.h predefs.in
soelim.o: soelim.c config.h compat_stringlist.h
st.o: st.c config.h roff.h mdoc.h libmdoc.h st.in
-tag.o: tag.c config.h mandoc_aux.h mandoc_ohash.h tag.h
+tag.o: tag.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h tag.h
tbl.o: tbl.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
tbl_data.o: tbl_data.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h
tbl_html.o: tbl_html.c config.h mandoc.h out.h html.h
diff --git a/configure b/configure
index 7d61ea81..919b2b9e 100755
--- a/configure
+++ b/configure
@@ -45,6 +45,7 @@ STATIC="-static"
BUILD_CGI=0
HAVE_DIRENT_NAMLEN=
+HAVE_EFTYPE=
HAVE_ERR=
HAVE_FTS=
HAVE_GETLINE=
@@ -173,6 +174,7 @@ runtest() {
# --- library functions ---
runtest dirent-namlen DIRENT_NAMLEN || true
+runtest EFTYPE EFTYPE || true
runtest err ERR || true
runtest fts FTS || true
runtest getline GETLINE || true
@@ -245,6 +247,7 @@ echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
[ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
+[ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
cat << __HEREDOC__
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
diff --git a/dba_write.c b/dba_write.c
index 15a04fc0..31afa4fa 100644
--- a/dba_write.c
+++ b/dba_write.c
@@ -1,4 +1,4 @@
-/* $Id: dba_write.c,v 1.1 2016/07/19 21:31:55 schwarze Exp $ */
+/* $Id: dba_write.c,v 1.2 2016/07/20 00:23:14 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -17,9 +17,13 @@
* Low-level functions for serializing allocation-based data to disk.
* The interface is defined in "dba_write.h".
*/
+#include "config.h"
+
#include <assert.h>
#include <endian.h>
+#if HAVE_ERR
#include <err.h>
+#endif
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
diff --git a/dbm.c b/dbm.c
index d4e69bc3..4f1926cc 100644
--- a/dbm.c
+++ b/dbm.c
@@ -1,4 +1,4 @@
-/* $Id: dbm.c,v 1.1 2016/07/19 21:31:55 schwarze Exp $ */
+/* $Id: dbm.c,v 1.2 2016/07/20 00:23:14 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -17,9 +17,13 @@
* Map-based version of the mandoc database, for read-only access.
* The interface is defined in "dbm.h".
*/
+#include "config.h"
+
#include <assert.h>
#include <endian.h>
+#if HAVE_ERR
#include <err.h>
+#endif
#include <errno.h>
#include <regex.h>
#include <stdint.h>
diff --git a/dbm_map.c b/dbm_map.c
index 486bb29b..724a9f68 100644
--- a/dbm_map.c
+++ b/dbm_map.c
@@ -1,4 +1,4 @@
-/* $Id: dbm_map.c,v 1.1 2016/07/19 21:31:55 schwarze Exp $ */
+/* $Id: dbm_map.c,v 1.2 2016/07/20 00:23:14 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -18,12 +18,16 @@
* of the mandoc database, for read-only access.
* The interface is defined in "dbm_map.h".
*/
+#include "config.h"
+
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <endian.h>
+#if HAVE_ERR
#include <err.h>
+#endif
#include <errno.h>
#include <fcntl.h>
#include <regex.h>
diff --git a/mansearch.c b/mansearch.c
index b2410e99..30e7768b 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,7 +1,7 @@
/* $OpenBSD: mansearch.c,v 1.50 2016/07/09 15:23:36 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013, 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,6 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "config.h"
#include <sys/mman.h>
#include <sys/types.h>
diff --git a/mansearch.h b/mansearch.h
index acad65da..c1532498 100644
--- a/mansearch.h
+++ b/mansearch.h
@@ -1,7 +1,7 @@
-/* $Id: mansearch.h,v 1.25 2016/07/19 21:31:55 schwarze Exp $ */
+/* $Id: mansearch.h,v 1.26 2016/07/20 00:23:14 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013, 2014, 2016 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
diff --git a/test-EFTYPE.c b/test-EFTYPE.c
new file mode 100644
index 00000000..148f54f7
--- /dev/null
+++ b/test-EFTYPE.c
@@ -0,0 +1,7 @@
+#include <errno.h>
+
+int
+main(void)
+{
+ return !EFTYPE;
+}