aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-03-23 11:25:25 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-03-23 11:25:25 +0000
commit6a81c8460007e1d52bf6aab06460b9ce75c1ae4b (patch)
tree5a3bfa345c1f70d7d3c6ad760fe291cc75bd6730
parent4f632f9feb86ec93aaa9cd7d8ee145bf5788b13c (diff)
downloadmandoc-6a81c8460007e1d52bf6aab06460b9ce75c1ae4b.tar.gz
mandoc-6a81c8460007e1d52bf6aab06460b9ce75c1ae4b.tar.zst
mandoc-6a81c8460007e1d52bf6aab06460b9ce75c1ae4b.zip
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.
-rw-r--r--Makefile10
-rw-r--r--arch.c5
-rw-r--r--att.c5
-rw-r--r--chars.c3
-rw-r--r--eqn.c3
-rw-r--r--html.c3
-rw-r--r--lib.c5
-rw-r--r--main.c3
-rw-r--r--man.c3
-rw-r--r--man_hash.c3
-rw-r--r--man_validate.c3
-rw-r--r--mandoc.384
-rw-r--r--mandoc.c71
-rw-r--r--mandoc.h9
-rw-r--r--mandocdb.c3
-rw-r--r--manpath.c4
-rw-r--r--mansearch.c3
-rw-r--r--mdoc.c3
-rw-r--r--mdoc_argv.c3
-rw-r--r--mdoc_hash.c3
-rw-r--r--mdoc_man.c7
-rw-r--r--mdoc_validate.c3
-rw-r--r--msec.c3
-rw-r--r--out.c3
-rw-r--r--read.c3
-rw-r--r--roff.c3
-rw-r--r--st.c5
-rw-r--r--tbl.c3
-rw-r--r--tbl_data.c3
-rw-r--r--tbl_layout.c4
-rw-r--r--term.c4
-rw-r--r--term_ascii.c4
-rw-r--r--term_ps.c3
-rw-r--r--vol.c5
34 files changed, 122 insertions, 160 deletions
diff --git a/Makefile b/Makefile
index e29946e6..6338839b 100644
--- a/Makefile
+++ b/Makefile
@@ -124,6 +124,8 @@ SRCS = Makefile \
mandoc.3 \
mandoc.c \
mandoc.h \
+ mandoc_aux.c \
+ mandoc_aux.h \
mandoc_char.7 \
mandocdb.8 \
mandocdb.c \
@@ -201,6 +203,7 @@ LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
$(LIBROFF_OBJS) \
chars.o \
mandoc.o \
+ mandoc_aux.o \
msec.o \
read.o
@@ -225,7 +228,7 @@ vol.o: vol.in
$(LIBMAN_OBJS): libman.h
$(LIBMDOC_OBJS): libmdoc.h
$(LIBROFF_OBJS): libroff.h
-$(LIBMANDOC_OBJS): mandoc.h mdoc.h man.h libmandoc.h config.h
+$(LIBMANDOC_OBJS): mandoc.h mandoc_aux.h mdoc.h man.h libmandoc.h config.h
$(COMPAT_OBJS): config.h compat_ohash.h
MANDOC_HTML_OBJS = eqn_html.o \
@@ -252,10 +255,11 @@ MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
main.o \
out.o \
tree.o
-$(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
+$(MANDOC_OBJS): main.h mandoc.h mandoc_aux.h mdoc.h man.h config.h out.h
MANDOCDB_OBJS = mandocdb.o mansearch_const.o manpath.o
-$(MANDOCDB_OBJS): mansearch.h mandoc.h mdoc.h man.h config.h manpath.h
+$(MANDOCDB_OBJS): mansearch.h mandoc.h mandoc_aux.h \
+ mdoc.h man.h config.h manpath.h
PRECONV_OBJS = preconv.o
$(PRECONV_OBJS): config.h
diff --git a/arch.c b/arch.c
index e764bfe9..8a8b038e 100644
--- a/arch.c
+++ b/arch.c
@@ -1,4 +1,4 @@
-/* $Id: arch.c,v 1.9 2011/03/22 14:33:05 kristaps Exp $ */
+/* $Id: arch.c,v 1.10 2014/03/23 11:25:25 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#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/att.c b/att.c
index 24d757dd..3790ab9e 100644
--- a/att.c
+++ b/att.c
@@ -1,4 +1,4 @@
-/* $Id: att.c,v 1.9 2011/03/22 14:33:05 kristaps Exp $ */
+/* $Id: att.c,v 1.10 2014/03/23 11:25:25 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#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/chars.c b/chars.c
index 35046202..d59becfa 100644
--- a/chars.c
+++ b/chars.c
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.55 2014/01/22 20:58:39 schwarze Exp $ */
+/* $Id: chars.c,v 1.56 2014/03/23 11:25:25 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -25,6 +25,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#define PRINT_HI 126
diff --git a/eqn.c b/eqn.c
index 37f01bcb..2a46ec6d 100644
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/* $Id: eqn.c,v 1.38 2011/07/25 15:37:00 kristaps Exp $ */
+/* $Id: eqn.c,v 1.39 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -26,6 +26,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
diff --git a/html.c b/html.c
index bbc9ec5b..32c31e50 100644
--- a/html.c
+++ b/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.154 2014/01/22 20:58:39 schwarze Exp $ */
+/* $Id: html.c,v 1.155 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -31,6 +31,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "out.h"
#include "html.h"
diff --git a/lib.c b/lib.c
index 7a18a5dd..8cc8a778 100644
--- a/lib.c
+++ b/lib.c
@@ -1,4 +1,4 @@
-/* $Id: lib.c,v 1.9 2011/03/22 14:33:05 kristaps Exp $ */
+/* $Id: lib.c,v 1.10 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#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/main.c b/main.c
index 85ad99ef..4fb29d0e 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.171 2014/03/19 22:20:43 schwarze Exp $ */
+/* $Id: main.c,v 1.172 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -28,6 +28,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "main.h"
#include "mdoc.h"
#include "man.h"
diff --git a/man.c b/man.c
index 9e4ded35..113c72da 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.124 2014/01/06 00:53:33 schwarze Exp $ */
+/* $Id: man.c,v 1.125 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -30,6 +30,7 @@
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libman.h"
#include "libmandoc.h"
diff --git a/man_hash.c b/man_hash.c
index 86c5c40a..9961377c 100644
--- a/man_hash.c
+++ b/man_hash.c
@@ -1,4 +1,4 @@
-/* $Id: man_hash.c,v 1.25 2011/07/24 18:15:14 kristaps Exp $ */
+/* $Id: man_hash.c,v 1.26 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -23,7 +23,6 @@
#include <assert.h>
#include <ctype.h>
#include <limits.h>
-#include <stdlib.h>
#include <string.h>
#include "man.h"
diff --git a/man_validate.c b/man_validate.c
index ded50ba4..647dbcca 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.88 2014/01/06 22:39:25 schwarze Exp $ */
+/* $Id: man_validate.c,v 1.89 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -32,6 +32,7 @@
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libman.h"
#include "libmandoc.h"
diff --git a/mandoc.3 b/mandoc.3
index db763749..2e6b78b9 100644
--- a/mandoc.3
+++ b/mandoc.3
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.3,v 1.23 2014/01/05 20:26:36 schwarze Exp $
+.\" $Id: mandoc.3,v 1.24 2014/03/23 11:25:26 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,12 +15,17 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 5 2014 $
+.Dd $Mdocdate: March 23 2014 $
.Dt MANDOC 3
.Os
.Sh NAME
.Nm mandoc ,
+.Nm mandoc_calloc ,
.Nm mandoc_escape ,
+.Nm mandoc_malloc ,
+.Nm mandoc_realloc ,
+.Nm mandoc_strdup ,
+.Nm mandoc_strndup ,
.Nm man_meta ,
.Nm man_mparse ,
.Nm man_node ,
@@ -45,28 +50,30 @@
.Sh LIBRARY
.Lb libmandoc
.Sh SYNOPSIS
-.In man.h
-.In mdoc.h
.In mandoc.h
+.Fd "#define ASCII_NBRSP"
+.Fd "#define ASCII_HYPH"
+.Fd "#define ASCII_BREAK"
+.Ft "void *"
+.Fo mandoc_calloc
+.Fa "size_t nmemb"
+.Fa "size_t size"
+.Fc
.Ft "enum mandoc_esc"
.Fo mandoc_escape
.Fa "const char **end"
.Fa "const char **start"
.Fa "int *sz"
.Fc
-.Ft "const struct man_meta *"
-.Fo man_meta
-.Fa "const struct man *man"
-.Fc
-.Ft "const struct mparse *"
-.Fo man_mparse
-.Fa "const struct man *man"
-.Fc
-.Ft "const struct man_node *"
-.Fo man_node
-.Fa "const struct man *man"
-.Fc
+.Ft "void *"
+.Fn mandoc_malloc "size_t size"
.Ft "struct mchars *"
+.Fo mandoc_realloc
+.Fa "void *ptr"
+.Fa "size_t size"
+.Fc
+.Ft "char *"
+.Fn mandoc_strdup
.Fn mchars_alloc "void"
.Ft void
.Fn mchars_free "struct mchars *p"
@@ -87,14 +94,6 @@
.Fa "const char *cp"
.Fa "size_t sz"
.Fc
-.Ft "const struct mdoc_meta *"
-.Fo mdoc_meta
-.Fa "const struct mdoc *mdoc"
-.Fc
-.Ft "const struct mdoc_node *"
-.Fo mdoc_node
-.Fa "const struct mdoc *mdoc"
-.Fc
.Ft void
.Fo mparse_alloc
.Fa "enum mparset inttype"
@@ -104,6 +103,15 @@
.Fa "int quick"
.Fc
.Ft void
+.Fo (*mandocmsg)
+.Fa "enum mandocerr errtype"
+.Fa "enum mandoclevel level"
+.Fa "const char *file"
+.Fa "int line"
+.Fa "int col"
+.Fa "const char *msg"
+.Fc
+.Ft void
.Fo mparse_free
.Fa "struct mparse *parse"
.Fc
@@ -139,11 +147,33 @@
.Fo mparse_strlevel
.Fa "enum mandoclevel"
.Fc
-.Vt extern const char * const * man_macronames;
+.In mandoc.h
+.In mdoc.h
+.Ft "const struct mdoc_meta *"
+.Fo mdoc_meta
+.Fa "const struct mdoc *mdoc"
+.Fc
+.Ft "const struct mdoc_node *"
+.Fo mdoc_node
+.Fa "const struct mdoc *mdoc"
+.Fc
.Vt extern const char * const * mdoc_argnames;
.Vt extern const char * const * mdoc_macronames;
-.Fd "#define ASCII_NBRSP"
-.Fd "#define ASCII_HYPH"
+.In mandoc.h
+.In man.h
+.Ft "const struct man_meta *"
+.Fo man_meta
+.Fa "const struct man *man"
+.Fc
+.Ft "const struct mparse *"
+.Fo man_mparse
+.Fa "const struct man *man"
+.Fc
+.Ft "const struct man_node *"
+.Fo man_node
+.Fa "const struct man *man"
+.Fc
+.Vt extern const char * const * man_macronames;
.Sh DESCRIPTION
The
.Nm mandoc
diff --git a/mandoc.c b/mandoc.c
index b3928ae4..2df01659 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.75 2013/12/31 23:23:10 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.76 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -31,6 +31,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#define DATESIZE 32
@@ -353,74 +354,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/mandoc.h b/mandoc.h
index 011f1b06..a6900ee6 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -1,7 +1,7 @@
-/* $Id: mandoc.h,v 1.117 2014/03/19 22:20:43 schwarze Exp $ */
+/* $Id: mandoc.h,v 1.118 2014/03/23 11:25:26 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/mandocdb.c b/mandocdb.c
index 16a1acc4..70c66e40 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.118 2014/03/19 22:33:09 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.119 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -46,6 +46,7 @@
#include "mdoc.h"
#include "man.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#include "mansearch.h"
diff --git a/manpath.c b/manpath.c
index c33e0ecf..f301c0d6 100644
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.12 2013/11/21 01:49:18 schwarze Exp $ */
+/* $Id: manpath.c,v 1.13 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -26,7 +26,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/mansearch.c b/mansearch.c
index dd7ab9cd..d53cc2a6 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.22 2014/03/17 16:31:44 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.23 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -39,6 +39,7 @@
#include <sqlite3.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "manpath.h"
#include "mansearch.h"
diff --git a/mdoc.c b/mdoc.c
index a586e11c..612f259a 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.208 2014/01/05 20:26:36 schwarze Exp $ */
+/* $Id: mdoc.c,v 1.209 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -30,6 +30,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
diff --git a/mdoc_argv.c b/mdoc_argv.c
index bb9bc6c3..3bb07f55 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_argv.c,v 1.89 2013/12/25 00:50:05 schwarze Exp $ */
+/* $Id: mdoc_argv.c,v 1.90 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -28,6 +28,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
diff --git a/mdoc_hash.c b/mdoc_hash.c
index 59a8d26a..1a5dcc4b 100644
--- a/mdoc_hash.c
+++ b/mdoc_hash.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_hash.c,v 1.18 2011/07/24 18:15:14 kristaps Exp $ */
+/* $Id: mdoc_hash.c,v 1.19 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -28,7 +28,6 @@
#include <string.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
static unsigned char table[27 * 12];
diff --git a/mdoc_man.c b/mdoc_man.c
index a6517df5..e4db5aed 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.58 2014/01/22 20:58:39 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.59 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -23,6 +23,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "man.h"
#include "mdoc.h"
@@ -461,7 +462,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];
@@ -513,7 +514,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/mdoc_validate.c b/mdoc_validate.c
index bf6b5ffc..2e725d1c 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.202 2014/01/11 22:16:10 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.203 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -36,6 +36,7 @@
#include "mdoc.h"
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmdoc.h"
#include "libmandoc.h"
diff --git a/msec.c b/msec.c
index dd7d11c6..3db04d66 100644
--- a/msec.c
+++ b/msec.c
@@ -1,4 +1,4 @@
-/* $Id: msec.c,v 1.10 2011/12/02 01:37:14 schwarze Exp $ */
+/* $Id: msec.c,v 1.11 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,7 +18,6 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
#include "mandoc.h"
diff --git a/out.c b/out.c
index c9316649..96d1d771 100644
--- a/out.c
+++ b/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.46 2013/10/05 20:30:05 schwarze Exp $ */
+/* $Id: out.c,v 1.47 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -28,6 +28,7 @@
#include <string.h>
#include <time.h>
+#include "mandoc_aux.h"
#include "mandoc.h"
#include "out.h"
diff --git a/read.c b/read.c
index a99ca058..d78a0b0d 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.45 2014/03/19 22:20:43 schwarze Exp $ */
+/* $Id: read.c,v 1.46 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -37,6 +37,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "mdoc.h"
#include "man.h"
diff --git a/roff.c b/roff.c
index 7c46e9a5..64235529 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.200 2014/03/20 02:57:28 schwarze Exp $ */
+/* $Id: roff.c,v 1.201 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,6 +26,7 @@
#include <string.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libroff.h"
#include "libmandoc.h"
diff --git a/st.c b/st.c
index 70c21a26..ab6f0f29 100644
--- a/st.c
+++ b/st.c
@@ -1,4 +1,4 @@
-/* $Id: st.c,v 1.9 2011/03/22 14:33:05 kristaps Exp $ */
+/* $Id: st.c,v 1.10 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#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/tbl.c b/tbl.c
index b244ac80..a99436ed 100644
--- a/tbl.c
+++ b/tbl.c
@@ -1,4 +1,4 @@
-/* $Id: tbl.c,v 1.27 2013/05/31 22:08:09 schwarze Exp $ */
+/* $Id: tbl.c,v 1.28 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,6 +26,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
diff --git a/tbl_data.c b/tbl_data.c
index 9c56002f..dfb85bd2 100644
--- a/tbl_data.c
+++ b/tbl_data.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_data.c,v 1.28 2014/01/05 18:37:53 joerg Exp $ */
+/* $Id: tbl_data.c,v 1.29 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -26,6 +26,7 @@
#include <time.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "libmandoc.h"
#include "libroff.h"
diff --git a/tbl_layout.c b/tbl_layout.c
index 6cce977f..c30ea25b 100644
--- a/tbl_layout.c
+++ b/tbl_layout.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_layout.c,v 1.23 2012/05/27 17:54:54 schwarze Exp $ */
+/* $Id: tbl_layout.c,v 1.24 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012 Ingo Schwarze <schwarze@openbsd.org>
@@ -19,13 +19,13 @@
#include "config.h"
#endif
-#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/term.c b/term.c
index d3b21774..158b7d14 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.217 2014/03/13 19:23:50 schwarze Exp $ */
+/* $Id: term.c,v 1.218 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -23,12 +23,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/term_ascii.c b/term_ascii.c
index cb7ac294..d6531167 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.21 2013/06/01 14:27:20 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.22 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -20,7 +20,6 @@
#include <sys/types.h>
-#include <assert.h>
#ifdef USE_WCHAR
# include <locale.h>
#endif
@@ -33,6 +32,7 @@
#endif
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "term.h"
#include "main.h"
diff --git a/term_ps.c b/term_ps.c
index b464b842..c8010591 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.55 2014/01/05 19:10:56 joerg Exp $ */
+/* $Id: term_ps.c,v 1.56 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -30,6 +30,7 @@
#include <unistd.h>
#include "mandoc.h"
+#include "mandoc_aux.h"
#include "out.h"
#include "main.h"
#include "term.h"
diff --git a/vol.c b/vol.c
index 3ea7441a..7658ea42 100644
--- a/vol.c
+++ b/vol.c
@@ -1,4 +1,4 @@
-/* $Id: vol.c,v 1.9 2011/03/22 14:33:05 kristaps Exp $ */
+/* $Id: vol.c,v 1.10 2014/03/23 11:25:26 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <stdlib.h>
#include <string.h>
-#include <time.h>
#include "mdoc.h"
-#include "mandoc.h"
#include "libmdoc.h"
#define LINE(x, y) \