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 | 92f665747e9d9aecac7c203e53d4eb175e662fc8 (patch) | |
tree | 343b938cade639d1cbcc09a9a00911f2789ee947 | |
parent | 21ddc0a002b54301ac9de5f6dd73928ed0d73a94 (diff) | |
download | mandoc-92f665747e9d9aecac7c203e53d4eb175e662fc8.tar.gz |
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 | 4 | ||||
-rw-r--r-- | att.c | 4 | ||||
-rw-r--r-- | chars.c | 4 | ||||
-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 | 9 | ||||
-rw-r--r-- | lib.c | 4 | ||||
-rw-r--r-- | main.c | 9 | ||||
-rw-r--r-- | man.c | 8 | ||||
-rw-r--r-- | man_action.c | 4 | ||||
-rw-r--r-- | man_argv.c | 4 | ||||
-rw-r--r-- | man_hash.c | 4 | ||||
-rw-r--r-- | man_html.c | 9 | ||||
-rw-r--r-- | man_macro.c | 4 | ||||
-rw-r--r-- | man_term.c | 9 | ||||
-rw-r--r-- | man_validate.c | 4 | ||||
-rw-r--r-- | mandoc.c | 4 | ||||
-rw-r--r-- | mdoc.c | 21 | ||||
-rw-r--r-- | mdoc_action.c | 8 | ||||
-rw-r--r-- | mdoc_argv.c | 4 | ||||
-rw-r--r-- | mdoc_hash.c | 4 | ||||
-rw-r--r-- | mdoc_html.c | 14 | ||||
-rw-r--r-- | mdoc_macro.c | 4 | ||||
-rw-r--r-- | mdoc_strings.c | 4 | ||||
-rw-r--r-- | mdoc_term.c | 9 | ||||
-rw-r--r-- | mdoc_validate.c | 8 | ||||
-rw-r--r-- | msec.c | 4 | ||||
-rw-r--r-- | out.c | 8 | ||||
-rw-r--r-- | st.c | 4 | ||||
-rw-r--r-- | term.c | 4 | ||||
-rw-r--r-- | test-strlcat.c | 8 | ||||
-rw-r--r-- | test-strlcpy.c | 8 | ||||
-rw-r--r-- | tree.c | 4 | ||||
-rw-r--r-- | vol.c | 4 |
36 files changed, 207 insertions, 67 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 \ + ) > $@ @@ -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> @@ -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> @@ -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 @@ -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); @@ -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> @@ -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 *); @@ -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 aa56dda6..2d3000f5 100644 --- a/man_action.c +++ b/man_action.c @@ -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> @@ -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> @@ -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> @@ -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 9c290e45..6f2e8348 100644 --- a/man_macro.c +++ b/man_macro.c @@ -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> @@ -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 3c5944fa..85cc763f 100644 --- a/man_validate.c +++ b/man_validate.c @@ -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> @@ -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> @@ -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 3cd0332c..dfe2aafc 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -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 726a3f3f..4a96436c 100644 --- a/mdoc_argv.c +++ b/mdoc_argv.c @@ -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 be2d457a..871000fc 100644 --- a/mdoc_hash.c +++ b/mdoc_hash.c @@ -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 e43d9809..c9766217 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -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 ca4e554f..106a05db 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -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 44413cbc..be96ca87 100644 --- a/mdoc_strings.c +++ b/mdoc_strings.c @@ -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 6c6c4775..405fde3f 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -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 5a4a92b3..22376c13 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -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); @@ -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> @@ -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. @@ -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> @@ -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; +} @@ -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> @@ -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> |