diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-01-01 17:14:26 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-01-01 17:14:26 +0000 |
commit | 73aca81b50073109b137bba659d38af11d7194ac (patch) | |
tree | db3b28024b3493b57e793eb072a69c9da331b8da | |
parent | 9702d475f59435139db2b0794a26dd69937fab7c (diff) | |
download | mandoc-73aca81b50073109b137bba659d38af11d7194ac.tar.gz mandoc-73aca81b50073109b137bba659d38af11d7194ac.tar.zst mandoc-73aca81b50073109b137bba659d38af11d7194ac.zip |
Big check-in of compatibility layer. This should work on most major architectures. Thanks to Joerg Sonnenberger.
-rw-r--r-- | Makefile | 30 | ||||
-rw-r--r-- | arch.c | 6 | ||||
-rw-r--r-- | att.c | 6 | ||||
-rw-r--r-- | chars.c | 6 | ||||
-rw-r--r-- | compat.c | 9 | ||||
-rw-r--r-- | config.h.post | 25 | ||||
-rw-r--r-- | config.h.pre | 6 | ||||
-rw-r--r-- | html.c | 11 | ||||
-rw-r--r-- | lib.c | 6 | ||||
-rw-r--r-- | main.c | 11 | ||||
-rw-r--r-- | man.c | 10 | ||||
-rw-r--r-- | man_action.c | 6 | ||||
-rw-r--r-- | man_argv.c | 6 | ||||
-rw-r--r-- | man_hash.c | 6 | ||||
-rw-r--r-- | man_html.c | 11 | ||||
-rw-r--r-- | man_macro.c | 6 | ||||
-rw-r--r-- | man_term.c | 11 | ||||
-rw-r--r-- | man_validate.c | 6 | ||||
-rw-r--r-- | mandoc.c | 6 | ||||
-rw-r--r-- | mdoc.c | 23 | ||||
-rw-r--r-- | mdoc_action.c | 10 | ||||
-rw-r--r-- | mdoc_argv.c | 6 | ||||
-rw-r--r-- | mdoc_hash.c | 6 | ||||
-rw-r--r-- | mdoc_html.c | 16 | ||||
-rw-r--r-- | mdoc_macro.c | 6 | ||||
-rw-r--r-- | mdoc_strings.c | 6 | ||||
-rw-r--r-- | mdoc_term.c | 11 | ||||
-rw-r--r-- | mdoc_validate.c | 10 | ||||
-rw-r--r-- | msec.c | 6 | ||||
-rw-r--r-- | out.c | 10 | ||||
-rw-r--r-- | st.c | 6 | ||||
-rw-r--r-- | term.c | 6 | ||||
-rw-r--r-- | test-strlcat.c | 8 | ||||
-rw-r--r-- | test-strlcpy.c | 8 | ||||
-rw-r--r-- | tree.c | 6 | ||||
-rw-r--r-- | vol.c | 6 |
36 files changed, 237 insertions, 97 deletions
@@ -13,9 +13,9 @@ INSTALL_MAN = $(INSTALL_DATA) VERSION = 1.9.14 VDATE = 16 November 2009 -VFLAGS = -DVERSION="\"$(VERSION)\"" -CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -g -CFLAGS += $(VFLAGS) +VFLAGS = -DVERSION="\"$(VERSION)\"" -DHAVE_CONFIG_H +WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings +CFLAGS += -g $(VFLAGS) $(WFLAGS) #CFLAGS += -DOSNAME="\"OpenBSD 4.5\"" LINTFLAGS += $(VFLAGS) @@ -74,11 +74,13 @@ TARGZS = mdocml-$(VERSION).tar.gz MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \ man.7 man.3 BINS = mandoc +TESTS = test-strlcat.c test-strlcpy.c +CONFIGS = config.h.pre config.h.post CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \ $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \ - $(GHTMLS) + $(GHTMLS) config.h config.log INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \ - $(DATAS) $(XSLS) $(EXAMPLES) + $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS) all: $(BINS) @@ -123,6 +125,8 @@ uninstall: rm -f $(MANDIR)/man7/man.7 rm -f $(EXAMPLEDIR)/example.style.css +$(OBJS): config.h + man_macro.ln: man_macro.c libman.h man_macro.o: man_macro.c libman.h @@ -254,3 +258,19 @@ mandoc: $(MAINOBJS) libmdoc.a libman.a .tar.gz.md5: md5 $< > $@ + +config.h: config.h.pre config.h.post + rm -f config.log + ( cat config.h.pre; \ + echo; \ + if $(CC) $(CFLAGS) -c test-strlcat.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCAT'; \ + rm test-strlcat.o; \ + fi; \ + if $(CC) $(CFLAGS) -c test-strlcpy.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCPY'; \ + rm test-strlcpy.o; \ + fi; \ + echo; \ + cat config.h.post \ + ) > $@ @@ -1,4 +1,4 @@ -/* $Id: arch.c,v 1.5 2009/10/26 17:05:43 kristaps Exp $ */ +/* $Id: arch.c,v 1.6 2010/01/01 17:14:26 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdlib.h> #include <string.h> #include <time.h> @@ -1,4 +1,4 @@ -/* $Id: att.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Id: att.c,v 1.6 2010/01/01 17:14:26 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdlib.h> #include <string.h> #include <time.h> @@ -1,4 +1,4 @@ -/* $Id: chars.c,v 1.13 2009/11/05 07:21:01 kristaps Exp $ */ +/* $Id: chars.c,v 1.14 2010/01/01 17:14:26 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdio.h> #include <stdlib.h> @@ -15,12 +15,16 @@ * 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 <string.h> -#ifdef __linux__ +int dummy; /* To prevent an empty object file */ +#ifndef HAVE_STRLCAT /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters @@ -55,7 +59,9 @@ strlcat(char *dst, const char *src, size_t siz) return(dlen + (s - src)); /* count does not include NUL */ } +#endif +#ifndef HAVE_STRLCPY /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). @@ -86,5 +92,4 @@ strlcpy(char *dst, const char *src, size_t siz) return(s - src - 1); /* count does not include NUL */ } - #endif diff --git a/config.h.post b/config.h.post new file mode 100644 index 00000000..81c01b93 --- /dev/null +++ b/config.h.post @@ -0,0 +1,25 @@ +#include <sys/types.h> + +#if !defined(__BEGIN_DECLS) +# ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# else +# define __BEGIN_DECLS +# endif +#endif +#if !defined(__END_DECLS) +# ifdef __cplusplus +# define __END_DECLS } +# else +# define __END_DECLS +# endif +#endif + +#ifndef HAVE_STRLCAT +extern size_t strlcat(char *, const char *, size_t); +#endif +#ifndef HAVE_STRLCPY +extern size_t strlcpy(char *, const char *, size_t); +#endif + +#endif /* MANDOC_CONFIG_H */ diff --git a/config.h.pre b/config.h.pre new file mode 100644 index 00000000..a309ed95 --- /dev/null +++ b/config.h.pre @@ -0,0 +1,6 @@ +#ifndef MANDOC_CONFIG_H +#define MANDOC_CONFIG_H + +#if defined(__linux__) || defined(__MINT__) +# define _GNU_SOURCE /* strptime(), getsubopt() */ +#endif @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.91 2009/11/16 08:46:58 kristaps Exp $ */ +/* $Id: html.c,v 1.92 2010/01/01 17:14:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -89,11 +93,6 @@ static const char *const htmlattrs[ATTR_MAX] = { "summary", }; -#ifdef __linux__ -extern int getsubopt(char **, char * const *, char **); -#endif - - static void print_spec(struct html *, const char *, size_t); static void print_res(struct html *, const char *, size_t); static void print_ctag(struct html *, enum htmltag); @@ -1,4 +1,4 @@ -/* $Id: lib.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Id: lib.c,v 1.6 2010/01/01 17:14:27 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdlib.h> #include <string.h> #include <time.h> @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.57 2009/11/02 08:29:25 kristaps Exp $ */ +/* $Id: main.c,v 1.58 2010/01/01 17:14:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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/stat.h> #include <assert.h> @@ -38,11 +42,6 @@ # endif #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ -#ifdef __linux__ -extern int getsubopt(char **, char * const *, char **); -extern size_t strlcat(char *, const char *, size_t); -#endif - typedef void (*out_mdoc)(void *, const struct mdoc *); typedef void (*out_man)(void *, const struct man *); typedef void (*out_free)(void *); @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.46 2009/11/02 08:40:31 kristaps Exp $ */ +/* $Id: man.c,v 1.47 2010/01/01 17:14:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -72,10 +76,6 @@ static int pstring(struct man *, int, int, const char *, size_t); static int macrowarn(struct man *, int, const char *); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -#endif - const struct man_node * man_node(const struct man *m) diff --git a/man_action.c b/man_action.c index 5a660715..2b8eba9f 100644 --- a/man_action.c +++ b/man_action.c @@ -1,4 +1,4 @@ -/* $Id: man_action.c,v 1.24 2009/11/02 06:22:45 kristaps Exp $ */ +/* $Id: man_action.c,v 1.25 2010/01/01 17:14:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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/utsname.h> #include <assert.h> @@ -1,4 +1,4 @@ -/* $Id: man_argv.c,v 1.1 2009/08/13 11:45:29 kristaps Exp $ */ +/* $Id: man_argv.c,v 1.2 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -1,4 +1,4 @@ -/* $Id: man_hash.c,v 1.15 2009/09/23 11:53:45 kristaps Exp $ */ +/* $Id: man_hash.c,v 1.16 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.24 2009/11/16 08:46:59 kristaps Exp $ */ +/* $Id: man_html.c,v 1.25 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -66,11 +70,6 @@ static int man_SH_pre(MAN_ARGS); static int man_SM_pre(MAN_ARGS); static int man_SS_pre(MAN_ARGS); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static const struct htmlman mans[MAN_MAX] = { { man_br_pre, NULL }, /* br */ { NULL, NULL }, /* TH */ diff --git a/man_macro.c b/man_macro.c index df649b99..845cc29b 100644 --- a/man_macro.c +++ b/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.29 2009/10/24 05:45:05 kristaps Exp $ */ +/* $Id: man_macro.c,v 1.30 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <ctype.h> #include <stdlib.h> @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.54 2009/11/12 08:21:05 kristaps Exp $ */ +/* $Id: man_term.c,v 1.55 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -63,11 +67,6 @@ struct termact { void (*post)(DECL_ARGS); }; -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static int a2width(const struct man_node *); static int a2height(const struct man_node *); diff --git a/man_validate.c b/man_validate.c index ed90d873..0d4eceec 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.27 2009/11/02 06:22:45 kristaps Exp $ */ +/* $Id: man_validate.c,v 1.28 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.8 2009/11/05 10:16:01 kristaps Exp $ */ +/* $Id: mandoc.c,v 1.9 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,8 +14,8 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if defined(__linux__) || defined(__MINT__) -# define _GNU_SOURCE /* strptime() */ +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h> @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.113 2009/10/30 05:58:38 kristaps Exp $ */ +/* $Id: mdoc.c,v 1.114 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -93,11 +97,11 @@ const char *const __mdoc_macronames[MDOC_MAX] = { "Nm", "Op", "Ot", "Pa", "Rv", "St", "Va", "Vt", /* LINTED */ - "Xr", "\%A", "\%B", "\%D", + "Xr", "%A", "%B", "%D", /* LINTED */ - "\%I", "\%J", "\%N", "\%O", + "%I", "%J", "%N", "%O", /* LINTED */ - "\%P", "\%R", "\%T", "\%V", + "%P", "%R", "%T", "%V", "Ac", "Ao", "Aq", "At", "Bc", "Bf", "Bo", "Bq", "Bsx", "Bx", "Db", "Dc", @@ -114,11 +118,11 @@ const char *const __mdoc_macronames[MDOC_MAX] = { "Fr", "Ud", "Lb", "Lp", "Lk", "Mt", "Brq", "Bro", /* LINTED */ - "Brc", "\%C", "Es", "En", + "Brc", "%C", "Es", "En", /* LINTED */ - "Dx", "\%Q", "br", "sp", + "Dx", "%Q", "br", "sp", /* LINTED */ - "\%U" + "%U" }; const char *const __mdoc_argnames[MDOC_ARG_MAX] = { @@ -148,11 +152,6 @@ static int macrowarn(struct mdoc *, int, const char *); static int pstring(struct mdoc *, int, int, const char *, size_t); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -#endif - - const struct mdoc_node * mdoc_node(const struct mdoc *m) { diff --git a/mdoc_action.c b/mdoc_action.c index aed126d9..f39e1a22 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.49 2009/11/02 06:22:45 kristaps Exp $ */ +/* $Id: mdoc_action.c,v 1.50 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 + #ifndef OSNAME #include <sys/utsname.h> #endif @@ -42,10 +46,6 @@ static int concat(struct mdoc *, char *, const struct mdoc_node *, size_t); static inline int order_rs(int); -#ifdef __linux__ -extern size_t strlcat(char *, const char *, size_t); -#endif - static int post_ar(POST_ARGS); static int post_at(POST_ARGS); static int post_bl(POST_ARGS); diff --git a/mdoc_argv.c b/mdoc_argv.c index 71fa9408..2d9ed2d1 100644 --- a/mdoc_argv.c +++ b/mdoc_argv.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_argv.c,v 1.32 2009/10/30 05:58:38 kristaps Exp $ */ +/* $Id: mdoc_argv.c,v 1.33 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> diff --git a/mdoc_hash.c b/mdoc_hash.c index 678ae0e3..58959dfd 100644 --- a/mdoc_hash.c +++ b/mdoc_hash.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_hash.c,v 1.11 2009/09/17 07:41:28 kristaps Exp $ */ +/* $Id: mdoc_hash.c,v 1.12 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> diff --git a/mdoc_html.c b/mdoc_html.c index e6d3dace..88e9b2f5 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.51 2010/01/01 13:35:30 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.52 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,8 +14,11 @@ * 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 <sys/param.h> #include <assert.h> #include <ctype.h> @@ -36,6 +39,10 @@ const struct mdoc_node *n, \ struct html *h +#ifndef MIN +#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b)) +#endif + struct htmlmdoc { int (*pre)(MDOC_ARGS); void (*post)(MDOC_ARGS); @@ -126,11 +133,6 @@ static int mdoc_vt_pre(MDOC_ARGS); static int mdoc_xr_pre(MDOC_ARGS); static int mdoc_xx_pre(MDOC_ARGS); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static const struct htmlmdoc mdocs[MDOC_MAX] = { {mdoc_ap_pre, NULL}, /* Ap */ {NULL, NULL}, /* Dd */ diff --git a/mdoc_macro.c b/mdoc_macro.c index fa4432e9..52eda379 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.39 2010/01/01 13:17:58 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.40 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <ctype.h> #include <stdlib.h> diff --git a/mdoc_strings.c b/mdoc_strings.c index 1d732734..95e0e67c 100644 --- a/mdoc_strings.c +++ b/mdoc_strings.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_strings.c,v 1.13 2009/11/02 06:22:46 kristaps Exp $ */ +/* $Id: mdoc_strings.c,v 1.14 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> diff --git a/mdoc_term.c b/mdoc_term.c index 1eea180d..e3b19209 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.106 2010/01/01 14:32:52 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.107 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -64,11 +68,6 @@ static void print_mdoc_head(DECL_ARGS); static void print_mdoc_nodelist(DECL_ARGS); static void print_foot(DECL_ARGS); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static void termp____post(DECL_ARGS); static void termp_an_post(DECL_ARGS); static void termp_aq_post(DECL_ARGS); diff --git a/mdoc_validate.c b/mdoc_validate.c index b6ee5c62..f4be3773 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.55 2010/01/01 15:14:03 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.56 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -62,10 +66,6 @@ static int warn_count(struct mdoc *, const char *, static int err_count(struct mdoc *, const char *, int, const char *, int); -#ifdef __linux__ -extern size_t strlcat(char *, const char *, size_t); -#endif - static int berr_ge1(POST_ARGS); static int bwarn_ge1(POST_ARGS); static int ebool(POST_ARGS); @@ -1,4 +1,4 @@ -/* $Id: msec.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Id: msec.c,v 1.6 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdlib.h> #include <string.h> #include <time.h> @@ -1,4 +1,4 @@ -/* $Id: out.c,v 1.11 2009/11/12 08:21:05 kristaps Exp $ */ +/* $Id: out.c,v 1.12 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> @@ -45,10 +49,6 @@ (t) = 3; } \ while (/* CONSTCOND */ 0) -#ifdef __linux__ -extern size_t strlcat(char *, const char *, size_t); -#endif - /* * Convert a `scaling unit' to a consistent form, or fail. Scaling * units are documented in groff.7, mdoc.7, man.7. @@ -1,4 +1,4 @@ -/* $Id: st.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Id: st.c,v 1.6 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdlib.h> #include <string.h> #include <time.h> @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.127 2009/11/12 08:21:06 kristaps Exp $ */ +/* $Id: term.c,v 1.128 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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> diff --git a/test-strlcat.c b/test-strlcat.c new file mode 100644 index 00000000..5d450dd0 --- /dev/null +++ b/test-strlcat.c @@ -0,0 +1,8 @@ +#include <string.h> + +int +main(int argc, char **argv) +{ + strlcat(argv[0], argv[1], 10); + return 0; +} diff --git a/test-strlcpy.c b/test-strlcpy.c new file mode 100644 index 00000000..c7d182aa --- /dev/null +++ b/test-strlcpy.c @@ -0,0 +1,8 @@ +#include <string.h> + +int +main(int argc, char **argv) +{ + strlcpy(argv[0], argv[1], 10); + return 0; +} @@ -1,4 +1,4 @@ -/* $Id: tree.c,v 1.18 2009/10/30 18:53:09 kristaps Exp $ */ +/* $Id: tree.c,v 1.19 2010/01/01 17:14:31 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdio.h> #include <stdlib.h> @@ -1,4 +1,4 @@ -/* $Id: vol.c,v 1.5 2009/10/26 17:05:45 kristaps Exp $ */ +/* $Id: vol.c,v 1.6 2010/01/01 17:14:31 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * 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 <stdlib.h> #include <string.h> #include <time.h> |