mirror of https://github.com/omar-polo/gmid.git
fixing compat compilation
include headers if needed and include config.h
This commit is contained in:
parent
3527b7a58a
commit
7e26256394
|
@ -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);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
void
|
||||
explicit_bzero(void *buf, size_t len)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
const char *
|
||||
getprogname(void)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
int
|
||||
vasprintf(char **ret, const char *format, va_list ap)
|
||||
{
|
||||
|
|
|
@ -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*, ...);"
|
||||
|
|
Loading…
Reference in New Issue