fixing compat compilation

include headers if needed and include config.h
This commit is contained in:
Omar Polo 2021-01-22 17:00:56 +00:00
parent 3527b7a58a
commit 7e26256394
9 changed files with 23 additions and 8 deletions

View File

@ -18,9 +18,7 @@
#include <stdio.h>
#include <stdarg.h>
/* cheat: if we don't have getprogname in libc, we will link against
* compat/getprogname.c anyway. */
const char *getprogname(void);
#include "../config.h"
static void vwarn_impl(const char*, va_list);
static void vwarnx_impl(const char*, va_list);

View File

@ -5,6 +5,8 @@
#include <string.h>
#include "../config.h"
void
explicit_bzero(void *buf, size_t len)
{

View File

@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../config.h"
const char *
getprogname(void)
{

View File

@ -20,6 +20,8 @@
#include <string.h>
#include <unistd.h>
#include "../config.h"
/*
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
@ -34,10 +36,6 @@
*/
#define getpagesize() (1UL << 12)
/* cheat: provide a prototype for explicit_bzero: if libc doesn't
* provide it, we will link to compat/explicit_bzero.c anyway. */
void explicit_bzero(void*, size_t);
void *
recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size)
{

View File

@ -17,6 +17,8 @@
#include <sys/types.h>
#include <string.h>
#include "../config.h"
/*
* Appends src to string dst of size dsize (unlike strncat, dsize is the
* full size of dst, not space left). At most dsize-1 characters

View File

@ -17,6 +17,8 @@
#include <sys/types.h>
#include <string.h>
#include "../config.h"
/*
* Copy string src to buffer dst of size dsize. At most dsize-1
* chars will be copied. Always NUL terminates (unless dsize == 0).

View File

@ -14,12 +14,13 @@
* 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>
#include <stdlib.h>
#include "../config.h"
#define INVALID 1
#define TOOSMALL 2
#define TOOLARGE 3

View File

@ -25,6 +25,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "../config.h"
int
vasprintf(char **ret, const char *format, va_list ap)
{

8
configure vendored
View File

@ -272,6 +272,14 @@ cat <<__HEREDOC__
__HEREDOC__
[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
[ ${HAVE_EXPLICIT_BZERO} -eq 0 -o \
${HAVE_RECALLOCARRAY} -eq 0 -o \
${HAVE_STRLCAT} -eq 0 -o \
${HAVE_STRLCPY} -eq 0 -o \
${HAVE_STRTONUM} -eq 0 ] && echo "#include <stddef.h>"
if [ ${HAVE_ERR} -eq 0 ]; then
echo "extern void err(int, const char*, ...);"
echo "extern void errx(int, const char*, ...);"