summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-21 22:17:02 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2014-03-21 22:17:02 +0000
commit8c2e8278819af3eeaaa829b00554902f74fb874c (patch)
tree82205b7994857117842eece204daf0a68a2761ed /usr.bin
parentcb68898005a73d46a81daffaa82a6939883a6e32 (diff)
The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary functions. Split the auxiliaries out into their own file and header. While here, do some #include cleanup.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/Makefile5
-rw-r--r--usr.bin/mandoc/arch.c5
-rw-r--r--usr.bin/mandoc/att.c5
-rw-r--r--usr.bin/mandoc/chars.c3
-rw-r--r--usr.bin/mandoc/eqn.c7
-rw-r--r--usr.bin/mandoc/html.c3
-rw-r--r--usr.bin/mandoc/lib.c5
-rw-r--r--usr.bin/mandoc/main.c3
-rw-r--r--usr.bin/mandoc/man.c3
-rw-r--r--usr.bin/mandoc/man_hash.c3
-rw-r--r--usr.bin/mandoc/man_validate.c3
-rw-r--r--usr.bin/mandoc/mandoc.c71
-rw-r--r--usr.bin/mandoc/mandoc.h9
-rw-r--r--usr.bin/mandoc/mandoc_aux.c86
-rw-r--r--usr.bin/mandoc/mandoc_aux.h30
-rw-r--r--usr.bin/mandoc/mandocdb.c3
-rw-r--r--usr.bin/mandoc/manpath.c4
-rw-r--r--usr.bin/mandoc/mansearch.c3
-rw-r--r--usr.bin/mandoc/mdoc.c3
-rw-r--r--usr.bin/mandoc/mdoc_argv.c3
-rw-r--r--usr.bin/mandoc/mdoc_hash.c3
-rw-r--r--usr.bin/mandoc/mdoc_man.c7
-rw-r--r--usr.bin/mandoc/mdoc_validate.c3
-rw-r--r--usr.bin/mandoc/msec.c3
-rw-r--r--usr.bin/mandoc/out.c3
-rw-r--r--usr.bin/mandoc/read.c3
-rw-r--r--usr.bin/mandoc/roff.c3
-rw-r--r--usr.bin/mandoc/st.c5
-rw-r--r--usr.bin/mandoc/tbl.c3
-rw-r--r--usr.bin/mandoc/tbl_data.c3
-rw-r--r--usr.bin/mandoc/tbl_layout.c4
-rw-r--r--usr.bin/mandoc/term.c4
-rw-r--r--usr.bin/mandoc/term_ascii.c4
-rw-r--r--usr.bin/mandoc/term_ps.c7
-rw-r--r--usr.bin/mandoc/vol.c5
35 files changed, 177 insertions, 140 deletions
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
index d7dbbc98c99..df0da28cdab 100644
--- a/usr.bin/mandoc/Makefile
+++ b/usr.bin/mandoc/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.74 2014/01/19 00:09:33 schwarze Exp $
+# $OpenBSD: Makefile,v 1.75 2014/03/21 22:17:01 schwarze Exp $
.include <bsd.own.mk>
@@ -6,7 +6,8 @@ CFLAGS += -DVERSION=\"1.13.0\"
CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter
LDADD += -lsqlite3
-SRCS= roff.c tbl.c tbl_opts.c tbl_layout.c tbl_data.c eqn.c mandoc.c read.c
+SRCS= mandoc.c mandoc_aux.c read.c \
+ roff.c tbl.c tbl_opts.c tbl_layout.c tbl_data.c eqn.c
SRCS+= mdoc_macro.c mdoc.c mdoc_hash.c \
mdoc_argv.c mdoc_validate.c lib.c att.c \
arch.c vol.c msec.c st.c
diff --git a/usr.bin/mandoc/arch.c b/usr.bin/mandoc/arch.c
index d754c038ca2..5d4fedade99 100644
--- a/usr.bin/mandoc/arch.c
+++ b/usr.bin/mandoc/arch.c
@@ -1,4 +1,4 @@
-/* $Id: arch.c,v 1.6 2011/04/24 16:22:02 schwarze Exp $ */
+/* $Id: arch.c,v 1.7 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,12 +14,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
diff --git a/usr.bin/mandoc/att.c b/usr.bin/mandoc/att.c
index 2ed01b6cd52..fd96e56a160 100644
--- a/usr.bin/mandoc/att.c
+++ b/usr.bin/mandoc/att.c
@@ -1,4 +1,4 @@
-/* $Id: att.c,v 1.6 2011/04/24 16:22:02 schwarze Exp $ */
+/* $Id: att.c,v 1.7 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,12 +14,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
diff --git a/usr.bin/mandoc/chars.c b/usr.bin/mandoc/chars.c
index 6506ed3a0a0..2102f13ed93 100644
--- a/usr.bin/mandoc/chars.c
+++ b/usr.bin/mandoc/chars.c
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.26 2014/01/22 20:58:35 schwarze Exp $ */
+/* $Id: chars.c,v 1.27 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -21,6 +21,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#define PRINT_HI 126
diff --git a/usr.bin/mandoc/eqn.c b/usr.bin/mandoc/eqn.c
index 8f7773d2b45..327f3fa0b92 100644
--- a/usr.bin/mandoc/eqn.c
+++ b/usr.bin/mandoc/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.5 2011/09/18 15:54:48 schwarze Exp $ */
+/* $Id: eqn.c,v 1.6 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,10 +14,6 @@
* 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 <limits.h>
#include <stdio.h>
@@ -26,6 +22,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index ea13cca9d91..976d18bf11e 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.33 2014/01/22 20:58:35 schwarze Exp $ */
+/* $Id: html.c,v 1.34 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -27,6 +27,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "out.h"
#include "html.h"
diff --git a/usr.bin/mandoc/lib.c b/usr.bin/mandoc/lib.c
index 20b9e29c934..c32fc05844b 100644
--- a/usr.bin/mandoc/lib.c
+++ b/usr.bin/mandoc/lib.c
@@ -1,4 +1,4 @@
-/* $Id: lib.c,v 1.6 2011/04/24 16:22:02 schwarze Exp $ */
+/* $Id: lib.c,v 1.7 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,12 +14,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index 1a1c7f9818c..c5e59d29ad0 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.88 2014/03/19 22:20:36 schwarze Exp $ */
+/* $Id: main.c,v 1.89 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -25,6 +25,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "main.h"
#include "mdoc.h"
#include "man.h"
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index a6841a191d0..a69c0e36b38 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.74 2014/01/06 00:53:14 schwarze Exp $ */
+/* $Id: man.c,v 1.75 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,6 +26,7 @@
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libman.h"
#include "libmandoc.h"
diff --git a/usr.bin/mandoc/man_hash.c b/usr.bin/mandoc/man_hash.c
index bf45210ad0e..d0b83c8d7b9 100644
--- a/usr.bin/mandoc/man_hash.c
+++ b/usr.bin/mandoc/man_hash.c
@@ -1,4 +1,4 @@
-/* $Id: man_hash.c,v 1.15 2011/09/18 15:54:48 schwarze Exp $ */
+/* $Id: man_hash.c,v 1.16 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -19,7 +19,6 @@
#include <assert.h>
#include <ctype.h>
#include <limits.h>
-#include <stdlib.h>
#include <string.h>
#include "man.h"
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index b1031376ded..e8b96b564df 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.60 2014/01/06 22:39:19 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.61 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -28,6 +28,7 @@
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libman.h"
#include "libmandoc.h"
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index d65f286d1cd..92f888bdb25 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.44 2013/12/30 18:27:15 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.45 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -27,6 +27,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#define DATESIZE 32
@@ -349,74 +350,6 @@ mandoc_escape(const char **end, const char **start, int *sz)
return(gly);
}
-void *
-mandoc_calloc(size_t num, size_t size)
-{
- void *ptr;
-
- ptr = calloc(num, size);
- if (NULL == ptr) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(ptr);
-}
-
-
-void *
-mandoc_malloc(size_t size)
-{
- void *ptr;
-
- ptr = malloc(size);
- if (NULL == ptr) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(ptr);
-}
-
-
-void *
-mandoc_realloc(void *ptr, size_t size)
-{
-
- ptr = realloc(ptr, size);
- if (NULL == ptr) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(ptr);
-}
-
-char *
-mandoc_strndup(const char *ptr, size_t sz)
-{
- char *p;
-
- p = mandoc_malloc(sz + 1);
- memcpy(p, ptr, sz);
- p[(int)sz] = '\0';
- return(p);
-}
-
-char *
-mandoc_strdup(const char *ptr)
-{
- char *p;
-
- p = strdup(ptr);
- if (NULL == p) {
- perror(NULL);
- exit((int)MANDOCLEVEL_SYSERR);
- }
-
- return(p);
-}
-
/*
* Parse a quoted or unquoted roff-style request or macro argument.
* Return a pointer to the parsed argument, which is either the original
diff --git a/usr.bin/mandoc/mandoc.h b/usr.bin/mandoc/mandoc.h
index 22ffcc74999..2ec65964e1a 100644
--- a/usr.bin/mandoc/mandoc.h
+++ b/usr.bin/mandoc/mandoc.h
@@ -1,7 +1,7 @@
-/* $Id: mandoc.h,v 1.61 2014/03/19 22:20:36 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.62 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2014 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
@@ -405,12 +405,7 @@ struct man;
__BEGIN_DECLS
-void *mandoc_calloc(size_t, size_t);
enum mandoc_esc mandoc_escape(const char **, const char **, int *);
-void *mandoc_malloc(size_t);
-void *mandoc_realloc(void *, size_t);
-char *mandoc_strdup(const char *);
-char *mandoc_strndup(const char *, size_t);
struct mchars *mchars_alloc(void);
void mchars_free(struct mchars *);
char mchars_num2char(const char *, size_t);
diff --git a/usr.bin/mandoc/mandoc_aux.c b/usr.bin/mandoc/mandoc_aux.c
new file mode 100644
index 00000000000..439b7958223
--- /dev/null
+++ b/usr.bin/mandoc/mandoc_aux.c
@@ -0,0 +1,86 @@
+/* $Id: mandoc_aux.c,v 1.1 2014/03/21 22:17:01 schwarze Exp $ */
+/*
+ * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "mandoc.h"
+#include "mandoc_aux.h"
+
+void *
+mandoc_calloc(size_t num, size_t size)
+{
+ void *ptr;
+
+ ptr = calloc(num, size);
+ if (NULL == ptr) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(ptr);
+}
+
+void *
+mandoc_malloc(size_t size)
+{
+ void *ptr;
+
+ ptr = malloc(size);
+ if (NULL == ptr) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(ptr);
+}
+
+void *
+mandoc_realloc(void *ptr, size_t size)
+{
+
+ ptr = realloc(ptr, size);
+ if (NULL == ptr) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(ptr);
+}
+
+char *
+mandoc_strdup(const char *ptr)
+{
+ char *p;
+
+ p = strdup(ptr);
+ if (NULL == p) {
+ perror(NULL);
+ exit((int)MANDOCLEVEL_SYSERR);
+ }
+ return(p);
+}
+
+char *
+mandoc_strndup(const char *ptr, size_t sz)
+{
+ char *p;
+
+ p = mandoc_malloc(sz + 1);
+ memcpy(p, ptr, sz);
+ p[(int)sz] = '\0';
+ return(p);
+}
diff --git a/usr.bin/mandoc/mandoc_aux.h b/usr.bin/mandoc/mandoc_aux.h
new file mode 100644
index 00000000000..1d2077eaebc
--- /dev/null
+++ b/usr.bin/mandoc/mandoc_aux.h
@@ -0,0 +1,30 @@
+/* $Id: mandoc_aux.h,v 1.1 2014/03/21 22:17:01 schwarze Exp $ */
+/*
+ * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifndef MANDOC_AUX_H
+#define MANDOC_AUX_H
+
+__BEGIN_DECLS
+
+void *mandoc_calloc(size_t, size_t);
+void *mandoc_malloc(size_t);
+void *mandoc_realloc(void *, size_t);
+char *mandoc_strdup(const char *);
+char *mandoc_strndup(const char *, size_t);
+
+__END_DECLS
+
+#endif /*!MANDOC_AUX_H*/
diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c
index 00180ad4baf..3546cfa1f53 100644
--- a/usr.bin/mandoc/mandocdb.c
+++ b/usr.bin/mandoc/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.75 2014/03/19 22:33:04 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.76 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -38,6 +38,7 @@
#include "mdoc.h"
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#include "mansearch.h"
diff --git a/usr.bin/mandoc/manpath.c b/usr.bin/mandoc/manpath.c
index 3e7a45ba423..30380347da8 100644
--- a/usr.bin/mandoc/manpath.c
+++ b/usr.bin/mandoc/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.7 2013/11/21 01:47:10 schwarze Exp $ */
+/* $Id: manpath.c,v 1.8 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
-#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#define MAN_CONF_FILE "/etc/man.conf"
diff --git a/usr.bin/mandoc/mansearch.c b/usr.bin/mandoc/mansearch.c
index 214b5cefe63..c7ac15b85b8 100644
--- a/usr.bin/mandoc/mansearch.c
+++ b/usr.bin/mandoc/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.13 2014/03/17 16:29:22 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.14 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -31,6 +31,7 @@
#include <sqlite3.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#include "mansearch.h"
diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c
index 3c4370aa29c..0b9b141db08 100644
--- a/usr.bin/mandoc/mdoc.c
+++ b/usr.bin/mandoc/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.98 2014/01/05 20:26:27 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.99 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,6 +26,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
diff --git a/usr.bin/mandoc/mdoc_argv.c b/usr.bin/mandoc/mdoc_argv.c
index ce82851bead..9dedb776463 100644
--- a/usr.bin/mandoc/mdoc_argv.c
+++ b/usr.bin/mandoc/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.46 2013/12/25 00:50:03 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.47 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -24,6 +24,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
diff --git a/usr.bin/mandoc/mdoc_hash.c b/usr.bin/mandoc/mdoc_hash.c
index f0b75358cb3..5daf3bce99b 100644
--- a/usr.bin/mandoc/mdoc_hash.c
+++ b/usr.bin/mandoc/mdoc_hash.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_hash.c,v 1.13 2011/09/18 15:54:48 schwarze Exp $ */
+/* $Id: mdoc_hash.c,v 1.14 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -24,7 +24,6 @@
#include <string.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
static unsigned char table[27 * 12];
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index f4647974021..f33f8d1b354 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.58 2014/01/24 11:56:34 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.59 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -19,6 +19,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "man.h"
#include "mdoc.h"
@@ -457,7 +458,7 @@ print_offs(const char *v)
/*
* Set up the indentation for a list item; used from pre_it().
*/
-void
+static void
print_width(const char *v, const struct mdoc_node *child, size_t defsz)
{
char buf[24];
@@ -509,7 +510,7 @@ print_width(const char *v, const struct mdoc_node *child, size_t defsz)
TPremain = remain;
}
-void
+static void
print_count(int *count)
{
char buf[12];
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index bae8ea76ee4..39b302bd16d 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.121 2014/02/16 14:26:51 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.122 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -32,6 +32,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
diff --git a/usr.bin/mandoc/msec.c b/usr.bin/mandoc/msec.c
index 5fc778e9b0f..d5b27d27a70 100644
--- a/usr.bin/mandoc/msec.c
+++ b/usr.bin/mandoc/msec.c
@@ -1,4 +1,4 @@
-/* $Id: msec.c,v 1.7 2011/12/02 01:45:43 schwarze Exp $ */
+/* $Id: msec.c,v 1.8 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,7 +14,6 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
diff --git a/usr.bin/mandoc/out.c b/usr.bin/mandoc/out.c
index ff927116310..a281b9d744f 100644
--- a/usr.bin/mandoc/out.c
+++ b/usr.bin/mandoc/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.19 2013/10/05 21:17:29 schwarze Exp $ */
+/* $Id: out.c,v 1.20 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -24,6 +24,7 @@
#include <string.h>
#include <time.h>
+#include "mandoc_aux.h"
#include "mandoc.h"
#include "out.h"
diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c
index 71032888f39..114bdeefbaa 100644
--- a/usr.bin/mandoc/read.c
+++ b/usr.bin/mandoc/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.23 2014/03/19 22:20:36 schwarze Exp $ */
+/* $Id: read.c,v 1.24 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -30,6 +30,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "mdoc.h"
#include "man.h"
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index fcd5335506b..caced523938 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.73 2014/03/20 02:57:13 schwarze Exp $ */
+/* $Id: roff.c,v 1.74 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -22,6 +22,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libroff.h"
#include "libmandoc.h"
diff --git a/usr.bin/mandoc/st.c b/usr.bin/mandoc/st.c
index fc1c10f2331..8d972934165 100644
--- a/usr.bin/mandoc/st.c
+++ b/usr.bin/mandoc/st.c
@@ -1,4 +1,4 @@
-/* $Id: st.c,v 1.6 2011/04/24 16:22:02 schwarze Exp $ */
+/* $Id: st.c,v 1.7 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,12 +14,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \
diff --git a/usr.bin/mandoc/tbl.c b/usr.bin/mandoc/tbl.c
index ca6e4268712..4f1aa0bc28f 100644
--- a/usr.bin/mandoc/tbl.c
+++ b/usr.bin/mandoc/tbl.c
@@ -1,4 +1,4 @@
-/* $Id: tbl.c,v 1.8 2013/05/31 22:08:03 schwarze Exp $ */
+/* $Id: tbl.c,v 1.9 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -22,6 +22,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
diff --git a/usr.bin/mandoc/tbl_data.c b/usr.bin/mandoc/tbl_data.c
index 65327595286..a1e4d5bfbeb 100644
--- a/usr.bin/mandoc/tbl_data.c
+++ b/usr.bin/mandoc/tbl_data.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_data.c,v 1.15 2014/01/05 21:02:43 schwarze Exp $ */
+/* $Id: tbl_data.c,v 1.16 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -22,6 +22,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
diff --git a/usr.bin/mandoc/tbl_layout.c b/usr.bin/mandoc/tbl_layout.c
index 456e077b10a..717e7c7dd1a 100644
--- a/usr.bin/mandoc/tbl_layout.c
+++ b/usr.bin/mandoc/tbl_layout.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_layout.c,v 1.11 2012/05/26 20:03:34 schwarze Exp $ */
+/* $Id: tbl_layout.c,v 1.12 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,13 +15,13 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index cb803c31b04..3da0c8fe710 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.78 2014/03/13 19:23:11 schwarze Exp $ */
+/* $Id: term.c,v 1.79 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -19,12 +19,12 @@
#include <assert.h>
#include <ctype.h>
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
#include "main.h"
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c
index 88c7d621fb9..bebec35bfbc 100644
--- a/usr.bin/mandoc/term_ascii.c
+++ b/usr.bin/mandoc/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.10 2013/06/01 14:27:13 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.11 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -16,7 +16,6 @@
*/
#include <sys/types.h>
-#include <assert.h>
#include <locale.h>
#include <stdint.h>
#include <stdio.h>
@@ -25,6 +24,7 @@
#include <wchar.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
#include "main.h"
diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c
index 2fd0ee73bfc..7b0a5c9625a 100644
--- a/usr.bin/mandoc/term_ps.c
+++ b/usr.bin/mandoc/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.20 2014/01/05 21:21:08 schwarze Exp $ */
+/* $Id: term_ps.c,v 1.21 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,10 +14,6 @@
* 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 <sys/types.h>
#include <assert.h>
@@ -30,6 +26,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "main.h"
#include "term.h"
diff --git a/usr.bin/mandoc/vol.c b/usr.bin/mandoc/vol.c
index 156ff5e8f54..5030ebd86e2 100644
--- a/usr.bin/mandoc/vol.c
+++ b/usr.bin/mandoc/vol.c
@@ -1,4 +1,4 @@
-/* $Id: vol.c,v 1.6 2011/04/24 16:22:02 schwarze Exp $ */
+/* $Id: vol.c,v 1.7 2014/03/21 22:17:01 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -14,12 +14,9 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \