Added a portable snprintf implementenation in case it's not present.
This commit is contained in:
+1
-1
@@ -132,7 +132,7 @@ AC_TYPE_UID_T
|
||||
dnl Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS(select socket strdup strerror strtol uname cfmakeraw ioperm)
|
||||
AC_CHECK_FUNCS(select socket strdup strerror strtol uname cfmakeraw snprintf)
|
||||
|
||||
dnl Check for various defines and features
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
noinst_LIBRARIES = libLCDstuff.a
|
||||
libLCDstuff_a_SOURCES = LL.c LL.h sockets.c sockets.h str.c str.h debug.h report.c report.h
|
||||
libLCDstuff_a_SOURCES = LL.c LL.h sockets.c sockets.h str.c str.h debug.h report.c report.h snprintf.c snprintf.h
|
||||
|
||||
+3
-5
@@ -1,6 +1,9 @@
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -21,11 +24,6 @@ This way, the global DEBUG macro is off but is locally enabled in
|
||||
certains parts of the software.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
static inline void debug(const char *format, .../*args*/) {
|
||||
#ifdef DEBUG
|
||||
va_list ap;
|
||||
|
||||
+1025
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
#ifndef _PORTABLE_SNPRINTF_H_
|
||||
#define _PORTABLE_SNPRINTF_H_
|
||||
|
||||
#define PORTABLE_SNPRINTF_VERSION_MAJOR 2
|
||||
#define PORTABLE_SNPRINTF_VERSION_MINOR 2
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#include <stdio.h>
|
||||
#else
|
||||
extern int snprintf(char *, size_t, const char *, /*args*/ ...);
|
||||
extern int vsnprintf(char *, size_t, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF)
|
||||
extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
|
||||
extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
|
||||
#define snprintf portable_snprintf
|
||||
#define vsnprintf portable_vsnprintf
|
||||
#endif
|
||||
|
||||
extern int asprintf (char **ptr, const char *fmt, /*args*/ ...);
|
||||
extern int vasprintf (char **ptr, const char *fmt, va_list ap);
|
||||
extern int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...);
|
||||
extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user