diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-06-15 01:37:14 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-06-15 01:37:14 +0000 |
commit | be382c572561862fee3a7bf3dae1b0236ac3216b (patch) | |
tree | 6b8cbcf67d431133d7ae433b188d2b27534da9e3 | |
parent | 30da7aa93492bbe72c27b4bfca4a30fcf9a11f79 (diff) | |
download | mandoc-be382c572561862fee3a7bf3dae1b0236ac3216b.tar.gz mandoc-be382c572561862fee3a7bf3dae1b0236ac3216b.tar.zst mandoc-be382c572561862fee3a7bf3dae1b0236ac3216b.zip |
Only compile compat_*.c implementations that are actually needed.
That's cleaner and it is supposed to fix compiler warnings with gcc 10
reported by Wynn Wolf Arbor <wolf at oriole dot systems> on discuss@.
-rw-r--r-- | Makefile | 23 | ||||
-rw-r--r-- | compat_err.c | 13 | ||||
-rw-r--r-- | compat_fts.c | 13 | ||||
-rw-r--r-- | compat_getline.c | 13 | ||||
-rw-r--r-- | compat_getsubopt.c | 13 | ||||
-rw-r--r-- | compat_isblank.c | 14 | ||||
-rw-r--r-- | compat_mkdtemp.c | 13 | ||||
-rw-r--r-- | compat_ohash.c | 13 | ||||
-rw-r--r-- | compat_progname.c | 15 | ||||
-rw-r--r-- | compat_reallocarray.c | 15 | ||||
-rw-r--r-- | compat_recallocarray.c | 25 | ||||
-rw-r--r-- | compat_strcasestr.c | 13 | ||||
-rw-r--r-- | compat_stringlist.c | 13 | ||||
-rw-r--r-- | compat_strlcat.c | 12 | ||||
-rw-r--r-- | compat_strlcpy.c | 12 | ||||
-rw-r--r-- | compat_strndup.c | 13 | ||||
-rw-r--r-- | compat_strsep.c | 15 | ||||
-rw-r--r-- | compat_strtonum.c | 15 | ||||
-rw-r--r-- | compat_vasprintf.c | 13 | ||||
-rwxr-xr-x | configure | 89 |
20 files changed, 113 insertions, 252 deletions
@@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.532 2020/03/13 17:31:44 schwarze Exp $ +# $Id: Makefile,v 1.533 2020/06/15 01:37:14 schwarze Exp $ # # Copyright (c) 2011, 2013-2020 Ingo Schwarze <schwarze@openbsd.org> # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> @@ -250,7 +250,7 @@ LIBMANDOC_OBJS = $(LIBMAN_OBJS) \ read.o \ tag.o -COMPAT_OBJS = compat_err.o \ +ALL_COBJS = compat_err.o \ compat_fts.o \ compat_getline.o \ compat_getsubopt.o \ @@ -320,13 +320,6 @@ MANDOCD_OBJS = $(MANDOC_HTML_OBJS) \ DEMANDOC_OBJS = demandoc.o -SOELIM_OBJS = soelim.o \ - compat_err.o \ - compat_getline.o \ - compat_progname.o \ - compat_reallocarray.o \ - compat_stringlist.o - WWW_MANS = apropos.1.html \ demandoc.1.html \ man.1.html \ @@ -394,12 +387,12 @@ distclean: clean rm -f Makefile.local config.h config.h.old config.log config.log.old clean: - rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS) + rm -f libmandoc.a $(LIBMANDOC_OBJS) $(ALL_COBJS) rm -f mandoc man $(MAIN_OBJS) rm -f man.cgi $(CGI_OBJS) rm -f mandocd catman catman.o $(MANDOCD_OBJS) rm -f demandoc $(DEMANDOC_OBJS) - rm -f soelim $(SOELIM_OBJS) + rm -f soelim soelim.o rm -f $(WWW_MANS) $(WWW_INCS) mandoc*.tar.gz mandoc*.sha256 rm -f Makefile.tmp1 Makefile.tmp2 rm -rf *.dSYM @@ -514,8 +507,8 @@ Makefile.local config.h: configure $(TESTSRCS) @echo "$@ is out of date; please run ./configure" @exit 1 -libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) - ar rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) +libmandoc.a: $(MANDOC_COBJS) $(LIBMANDOC_OBJS) + ar rs $@ $(MANDOC_COBJS) $(LIBMANDOC_OBJS) mandoc: $(MAIN_OBJS) libmandoc.a $(CC) -o $@ $(LDFLAGS) $(MAIN_OBJS) libmandoc.a $(LDADD) @@ -535,8 +528,8 @@ catman: catman.o libmandoc.a demandoc: $(DEMANDOC_OBJS) libmandoc.a $(CC) -o $@ $(LDFLAGS) $(DEMANDOC_OBJS) libmandoc.a $(LDADD) -soelim: $(SOELIM_OBJS) - $(CC) -o $@ $(LDFLAGS) $(SOELIM_OBJS) +soelim: $(SOELIM_COBJS) soelim.o + $(CC) -o $@ $(LDFLAGS) $(SOELIM_COBJS) soelim.o # --- maintainer targets --- diff --git a/compat_err.c b/compat_err.c index d8b09cb2..31994cbf 100644 --- a/compat_err.c +++ b/compat_err.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_ERR - -int dummy; - -#else - -/* $Id: compat_err.c,v 1.4 2015/11/26 07:42:11 schwarze Exp $ */ +/* $Id: compat_err.c,v 1.5 2020/06/15 01:37:14 schwarze Exp $ */ /* * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -35,6 +27,7 @@ int dummy; * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include "config.h" #include <errno.h> #include <stdarg.h> @@ -108,5 +101,3 @@ warnx(const char *fmt, ...) va_end(ap); fputc('\n', stderr); } - -#endif diff --git a/compat_fts.c b/compat_fts.c index 177d1c1f..e44298df 100644 --- a/compat_fts.c +++ b/compat_fts.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_FTS - -int dummy; - -#else - -/* $Id: compat_fts.c,v 1.16 2020/06/14 23:08:35 schwarze Exp $ */ +/* $Id: compat_fts.c,v 1.17 2020/06/15 01:37:14 schwarze Exp $ */ /* $OpenBSD: fts.c,v 1.59 2019/06/28 13:32:41 deraadt Exp $ */ /*- @@ -37,6 +29,7 @@ int dummy; * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include "config.h" #include <sys/stat.h> #include <sys/types.h> @@ -701,5 +694,3 @@ fts_maxarglen(char * const *argv) max = len; return (max + 1); } - -#endif diff --git a/compat_getline.c b/compat_getline.c index aed4754f..843a94a6 100644 --- a/compat_getline.c +++ b/compat_getline.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_GETLINE - -int dummy; - -#else - -/* $Id: compat_getline.c,v 1.1 2015/11/07 20:52:52 schwarze Exp $ */ +/* $Id: compat_getline.c,v 1.2 2020/06/15 01:37:14 schwarze Exp $ */ /* * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -22,6 +14,7 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <sys/types.h> #include <errno.h> @@ -64,5 +57,3 @@ getline(char **buf, size_t *bufsz, FILE *fp) return pos; } } - -#endif diff --git a/compat_getsubopt.c b/compat_getsubopt.c index 880f2f78..c442f87e 100644 --- a/compat_getsubopt.c +++ b/compat_getsubopt.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_GETSUBOPT - -int dummy; - -#else - -/* $Id: compat_getsubopt.c,v 1.5 2014/08/17 20:53:50 schwarze Exp $ */ +/* $Id: compat_getsubopt.c,v 1.6 2020/06/15 01:37:15 schwarze Exp $ */ /* $OpenBSD: getsubopt.c,v 1.4 2005/08/08 08:05:36 espie Exp $ */ /*- @@ -37,6 +29,7 @@ int dummy; * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include "config.h" #include <unistd.h> #include <stdlib.h> @@ -92,5 +85,3 @@ getsubopt(char **optionp, char * const *tokens, char **valuep) return(cnt); return(-1); } - -#endif diff --git a/compat_isblank.c b/compat_isblank.c index 9e3c7470..38d1d283 100644 --- a/compat_isblank.c +++ b/compat_isblank.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_ISBLANK - -int dummy; - -#else - -/* $Id: compat_isblank.c,v 1.2 2015/10/06 18:32:19 schwarze Exp $ */ +/* $Id: compat_isblank.c,v 1.3 2020/06/15 01:37:15 schwarze Exp $ */ /* * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -22,12 +14,10 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" int isblank(int c) { - return c == ' ' || c == '\t'; } - -#endif diff --git a/compat_mkdtemp.c b/compat_mkdtemp.c index 1fcb325f..296bfd42 100644 --- a/compat_mkdtemp.c +++ b/compat_mkdtemp.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_MKDTEMP - -int dummy; - -#else - -/* $Id: compat_mkdtemp.c,v 1.2 2015/10/06 18:32:19 schwarze Exp $ */ +/* $Id: compat_mkdtemp.c,v 1.3 2020/06/15 01:37:15 schwarze Exp $ */ /* * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -25,6 +17,7 @@ int dummy; * The algorithm of this function is inspired by OpenBSD mkdtemp(3) * by Theo de Raadt and Todd Miller, but the code differs. */ +#include "config.h" #include <sys/stat.h> #include <errno.h> @@ -57,5 +50,3 @@ mkdtemp(char *path) errno = EEXIST; return NULL; } - -#endif diff --git a/compat_ohash.c b/compat_ohash.c index cbd60521..f29c086c 100644 --- a/compat_ohash.c +++ b/compat_ohash.c @@ -1,11 +1,4 @@ -#include "config.h" - -#if HAVE_OHASH - -int dummy; - -#else - +/* $Id: compat_ohash.c,v 1.7 2020/06/15 01:37:15 schwarze Exp $ */ /* $OpenBSD: ohash.c,v 1.1 2014/06/02 18:52:03 deraadt Exp $ */ /* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org> @@ -22,9 +15,9 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <sys/types.h> - #include <stddef.h> #include <stdint.h> #include <stdlib.h> @@ -335,5 +328,3 @@ ohash_qlookupi(struct ohash *h, const char *s, const char **e) hv = ohash_interval(s, e); return ohash_lookup_interval(h, s, *e, hv); } - -#endif /*!HAVE_OHASH*/ diff --git a/compat_progname.c b/compat_progname.c index 9840cc7c..e067e489 100644 --- a/compat_progname.c +++ b/compat_progname.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_PROGNAME - -int dummy; - -#else - -/* $Id: compat_progname.c,v 1.1 2015/11/06 16:30:33 schwarze Exp $ */ +/* $Id: compat_progname.c,v 1.2 2020/06/15 01:37:15 schwarze Exp $ */ /* * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -22,21 +14,18 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" static const char *progname; void setprogname(const char *name) { - progname = name; } const char * getprogname(void) { - return progname; } - -#endif diff --git a/compat_reallocarray.c b/compat_reallocarray.c index 66151904..a12cec13 100644 --- a/compat_reallocarray.c +++ b/compat_reallocarray.c @@ -1,13 +1,5 @@ -#include "config.h" - -#if HAVE_REALLOCARRAY - -int dummy; - -#else - -/* $Id: compat_reallocarray.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */ -/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */ +/* $Id: compat_reallocarray.c,v 1.5 2020/06/15 01:37:15 schwarze Exp $ */ +/* $OpenBSD: reallocarray.c,v 1.3 2015/09/13 08:31:47 guenther Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> * @@ -23,6 +15,7 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <sys/types.h> #include <errno.h> @@ -45,5 +38,3 @@ reallocarray(void *optr, size_t nmemb, size_t size) } return realloc(optr, size * nmemb); } - -#endif /*!HAVE_REALLOCARRAY*/ diff --git a/compat_recallocarray.c b/compat_recallocarray.c index d86dc509..723e145c 100644 --- a/compat_recallocarray.c +++ b/compat_recallocarray.c @@ -1,15 +1,7 @@ -#include "config.h" - -#if HAVE_RECALLOCARRAY - -int dummy; - -#else - -/* $Id: compat_recallocarray.c,v 1.1 2017/06/12 19:05:47 schwarze Exp $ */ -/* $OpenBSD: malloc.c,v 1.225 2017/05/13 07:11:29 otto Exp $ */ +/* $Id: compat_recallocarray.c,v 1.2 2020/06/15 01:37:15 schwarze Exp $ */ +/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */ /* - * Copyright (c) 2017 Otto Moerbeek <otto@drijf.net> + * Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -23,18 +15,19 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <sys/types.h> #include <errno.h> -#include <stdint.h> #include <stdlib.h> +#include <stdint.h> #include <string.h> /* * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW */ -#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) +#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) /* * Even though specified in POSIX, the PAGESIZE and PAGE_SIZE @@ -42,7 +35,7 @@ int dummy; * to avoid free() overhead for small shrinking, simply pick * an arbitrary number. */ -#define MALLOC_PAGESIZE (1UL << 12) +#define getpagesize() (1UL << 12) void * @@ -75,7 +68,7 @@ recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size) if (newsize <= oldsize) { size_t d = oldsize - newsize; - if (d < oldsize / 2 && d < MALLOC_PAGESIZE) { + if (d < oldsize / 2 && d < getpagesize()) { memset((char *)ptr + newsize, 0, d); return ptr; } @@ -104,5 +97,3 @@ recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size) return newptr; } - -#endif /* !HAVE_RECALLOCARRAY */ diff --git a/compat_strcasestr.c b/compat_strcasestr.c index 62c0ff74..5eba8257 100644 --- a/compat_strcasestr.c +++ b/compat_strcasestr.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_STRCASESTR - -int dummy; - -#else - -/* $Id: compat_strcasestr.c,v 1.4 2014/12/11 09:19:32 schwarze Exp $ */ +/* $Id: compat_strcasestr.c,v 1.5 2020/06/15 01:37:15 schwarze Exp $ */ /* $NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $ */ /*- @@ -40,6 +32,7 @@ int dummy; * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include "config.h" #include <sys/types.h> #include <ctype.h> @@ -69,5 +62,3 @@ strcasestr(const char *s, const char *find) } return __UNCONST(s); } - -#endif diff --git a/compat_stringlist.c b/compat_stringlist.c index 17eba772..b23b16d5 100644 --- a/compat_stringlist.c +++ b/compat_stringlist.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_STRINGLIST - -int dummy; - -#else - -/* $Id: compat_stringlist.c,v 1.6 2015/11/07 14:22:29 schwarze Exp $ */ +/* $Id: compat_stringlist.c,v 1.7 2020/06/15 01:37:15 schwarze Exp $ */ /* * Copyright (c) 1994 Christos Zoulas <christos@netbsd.org> * All rights reserved. @@ -32,6 +24,7 @@ int dummy; * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include "config.h" #if HAVE_ERR #include <err.h> @@ -115,5 +108,3 @@ sl_find(StringList *sl, const char *name) return NULL; } - -#endif diff --git a/compat_strlcat.c b/compat_strlcat.c index acaae4fb..a5fa75fd 100644 --- a/compat_strlcat.c +++ b/compat_strlcat.c @@ -1,11 +1,4 @@ -#include "config.h" - -#if HAVE_STRLCAT - -int dummy; - -#else - +/* $Id: compat_strlcat.c,v 1.5 2020/06/15 01:37:15 schwarze Exp $ */ /* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ /* @@ -23,6 +16,7 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <sys/types.h> #include <string.h> @@ -61,5 +55,3 @@ strlcat(char *dst, const char *src, size_t siz) return(dlen + (s - src)); /* count does not include NUL */ } - -#endif diff --git a/compat_strlcpy.c b/compat_strlcpy.c index a00d5118..b6085053 100644 --- a/compat_strlcpy.c +++ b/compat_strlcpy.c @@ -1,11 +1,4 @@ -#include "config.h" - -#if HAVE_STRLCPY - -int dummy; - -#else - +/* $Id: compat_strlcpy.c,v 1.5 2020/06/15 01:37:15 schwarze Exp $ */ /* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ /* @@ -23,6 +16,7 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <sys/types.h> #include <string.h> @@ -57,5 +51,3 @@ strlcpy(char *dst, const char *src, size_t siz) return(s - src - 1); /* count does not include NUL */ } - -#endif diff --git a/compat_strndup.c b/compat_strndup.c index 5e127364..b714a5a4 100644 --- a/compat_strndup.c +++ b/compat_strndup.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_STRNDUP - -int dummy; - -#else - -/* $Id: compat_strndup.c,v 1.1 2018/02/27 11:16:23 schwarze Exp $ */ +/* $Id: compat_strndup.c,v 1.2 2020/06/15 01:37:15 schwarze Exp $ */ /* OpenBSD: strndup.c,v 1.2 2015/08/31 02:53:57 guenther Exp */ /* * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com> @@ -23,6 +15,7 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <sys/types.h> @@ -46,5 +39,3 @@ strndup(const char *str, size_t maxlen) return copy; } - -#endif diff --git a/compat_strsep.c b/compat_strsep.c index 1df57582..9765ac82 100644 --- a/compat_strsep.c +++ b/compat_strsep.c @@ -1,13 +1,5 @@ -#include "config.h" - -#if HAVE_STRSEP - -int dummy; - -#else - -/* $Id: compat_strsep.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */ -/* $OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $ */ +/* $Id: compat_strsep.c,v 1.5 2020/06/15 01:37:15 schwarze Exp $ */ +/* $OpenBSD: strsep.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,6 +29,7 @@ int dummy; * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#include "config.h" /* * Get next token from string *stringp, where tokens are possibly-empty @@ -75,5 +68,3 @@ strsep(char **stringp, const char *delim) } /* NOTREACHED */ } - -#endif diff --git a/compat_strtonum.c b/compat_strtonum.c index 628e5d51..ce0459fa 100644 --- a/compat_strtonum.c +++ b/compat_strtonum.c @@ -1,13 +1,5 @@ -#include "config.h" - -#if HAVE_STRTONUM - -int dummy; - -#else - -/* $Id: compat_strtonum.c,v 1.1 2015/02/16 14:56:22 schwarze Exp $ */ -/* $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $ */ +/* $Id: compat_strtonum.c,v 1.2 2020/06/15 01:37:15 schwarze Exp $ */ +/* $OpenBSD: strtonum.c,v 1.8 2015/09/13 08:31:48 guenther Exp $ */ /* * Copyright (c) 2004 Ted Unangst and Todd Miller @@ -25,6 +17,7 @@ int dummy; * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "config.h" #include <errno.h> #include <limits.h> @@ -72,5 +65,3 @@ strtonum(const char *numstr, long long minval, long long maxval, return (ll); } - -#endif /* !HAVE_STRTONUM */ diff --git a/compat_vasprintf.c b/compat_vasprintf.c index 9040822b..11556c01 100644 --- a/compat_vasprintf.c +++ b/compat_vasprintf.c @@ -1,12 +1,4 @@ -#include "config.h" - -#if HAVE_VASPRINTF - -int dummy; - -#else - -/* $Id: compat_vasprintf.c,v 1.3 2015/10/06 18:32:19 schwarze Exp $ */ +/* $Id: compat_vasprintf.c,v 1.4 2020/06/15 01:37:15 schwarze Exp $ */ /* * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -28,6 +20,7 @@ int dummy; * printf(3) or completely reimplementing printf(3), i can't think * of another portable solution. */ +#include "config.h" #include <stdarg.h> #include <stdio.h> @@ -52,5 +45,3 @@ vasprintf(char **ret, const char *format, va_list ap) *ret = NULL; return -1; } - -#endif @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: configure,v 1.74 2020/06/14 23:40:31 schwarze Exp $ +# $Id: configure,v 1.75 2020/06/15 01:37:15 schwarze Exp $ # # Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org> # @@ -96,6 +96,9 @@ NEED_GNU_SOURCE=0 NEED_OPENBSD_SOURCE=0 NEED_XPG4_2=0 +MANDOC_COBJS= +SOELIM_COBJS= + PREFIX="/usr/local" BINDIR= SBINDIR= @@ -499,52 +502,78 @@ if [ ${HAVE_ERR} -eq 0 ]; then echo "extern void errx(int, const char *, ...);" echo "extern void warn(const char *, ...);" echo "extern void warnx(const char *, ...);" + MANDOC_COBJS="${MANDOC_COBJS} compat_err.o" + SOELIM_COBJS="${SOELIM_COBJS} compat_err.o" fi - -[ ${HAVE_GETLINE} -eq 0 ] && \ +if [ ${HAVE_FTS} -eq 0 ]; then + MANDOC_COBJS="${MANDOC_COBJS} compat_fts.o" +fi +if [ ${HAVE_GETLINE} -eq 0 ]; then echo "extern ssize_t getline(char **, size_t *, FILE *);" - -[ ${HAVE_GETSUBOPT} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_getline.o" + SOELIM_COBJS="${SOELIM_COBJS} compat_getline.o" +fi +if [ ${HAVE_GETSUBOPT} -eq 0 ]; then echo "extern int getsubopt(char **, char * const *, char **);" - -[ ${HAVE_ISBLANK} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_getsubopt.o" +fi +if [ ${HAVE_ISBLANK} -eq 0 ]; then echo "extern int isblank(int);" - -[ ${HAVE_MKDTEMP} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_isblank.o" +fi +if [ ${HAVE_MKDTEMP} -eq 0 ]; then echo "extern char *mkdtemp(char *);" - + MANDOC_COBJS="${MANDOC_COBJS} compat_mkdtemp.o" +fi +if [ ${HAVE_OHASH} -eq 0 ]; then + MANDOC_COBJS="${MANDOC_COBJS} compat_ohash.o" +fi if [ ${HAVE_PROGNAME} -eq 0 ]; then echo "extern const char *getprogname(void);" echo "extern void setprogname(const char *);" + MANDOC_COBJS="${MANDOC_COBJS} compat_progname.o" + SOELIM_COBJS="${SOELIM_COBJS} compat_progname.o" fi - -[ ${HAVE_REALLOCARRAY} -eq 0 ] && \ +if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then echo "extern void *reallocarray(void *, size_t, size_t);" - -[ ${HAVE_RECALLOCARRAY} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_reallocarray.o" + SOELIM_COBJS="${SOELIM_COBJS} compat_reallocarray.o" +fi +if [ ${HAVE_RECALLOCARRAY} -eq 0 ]; then echo "extern void *recallocarray(void *, size_t, size_t, size_t);" - -[ ${HAVE_STRCASESTR} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_recallocarray.o" +fi +if [ ${HAVE_STRCASESTR} -eq 0 ]; then echo "extern char *strcasestr(const char *, const char *);" - -[ ${HAVE_STRLCAT} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_strcasestr.o" +fi +if [ ${HAVE_STRINGLIST} -eq 0 ]; then + SOELIM_COBJS="${SOELIM_COBJS} compat_stringlist.o" +fi +if [ ${HAVE_STRLCAT} -eq 0 ]; then echo "extern size_t strlcat(char *, const char *, size_t);" - -[ ${HAVE_STRLCPY} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_strlcat.o" +fi +if [ ${HAVE_STRLCPY} -eq 0 ]; then echo "extern size_t strlcpy(char *, const char *, size_t);" - -[ ${HAVE_STRNDUP} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_strlcpy.o" +fi +if [ ${HAVE_STRNDUP} -eq 0 ]; then echo "extern char *strndup(const char *, size_t);" - -[ ${HAVE_STRSEP} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_strndup.o" +fi +if [ ${HAVE_STRSEP} -eq 0 ]; then echo "extern char *strsep(char **, const char *);" - -[ ${HAVE_STRTONUM} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_strsep.o" +fi +if [ ${HAVE_STRTONUM} -eq 0 ]; then echo "extern long long strtonum(const char *, long long, long long, const char **);" - -[ ${HAVE_VASPRINTF} -eq 0 ] && \ + MANDOC_COBJS="${MANDOC_COBJS} compat_strtonum.o" +fi +if [ ${HAVE_VASPRINTF} -eq 0 ]; then echo "extern int vasprintf(char **, const char *, va_list);" - + MANDOC_COBJS="${MANDOC_COBJS} compat_vasprintf.o" +fi echo "file config.h: written" 1>&2 echo "file config.h: written" 1>&3 @@ -584,6 +613,8 @@ CC = ${CC} CFLAGS = ${CFLAGS} LDADD = ${LDADD} LDFLAGS = ${LDFLAGS} +MANDOC_COBJS = ${MANDOC_COBJS} +SOELIM_COBJS = ${SOELIM_COBJS} STATIC = ${STATIC} PREFIX = ${PREFIX} BINDIR = ${BINDIR} |