esac
AC_CHECK_FUNCS(uname updwtmp updwtmpx vsprintf)
+case "$host" in
+ *-*-sunos4*)
+ AC_DEFINE(SPRINTF_CHAR, 1, [*s*printf() functions are char*])
+ ;;
+esac
+
AC_CACHE_CHECK(number of arguments to gettimeofday(), ac_cv_func_Xettimeofday_nargs,
[AC_TRY_COMPILE([#include <sys/time.h>],[
gettimeofday((struct timeval*)0,(struct timezone*)0);
ntp_request.h \
ntp_rfc2553.h \
ntp_select.h \
+ ntp_sprintf.h \
ntp_stdlib.h \
ntp_string.h \
ntp_syscall.h \
--- /dev/null
+/*
+ * Handle ancient char* *s*printf*() systems
+ */
+
+#ifdef SPRINTF_CHAR
+# define SPRINTF(x) strlen(sprintf/**/x)
+# define SNPRINTF(x) strlen(snprintf/**/x)
+# define VSNPRINTF(x) strlen(vsnprintf/**/x)
+#else
+# define SPRINTF(x) ((size_t)sprintf x)
+# define SNPRINTF(x) ((size_t)snprintf x)
+# define VSNPRINTF(x) ((size_t)vsnprintf x)
+#endif
#include <isc/net.h>
+#include "ntp_sprintf.h"
+
#define NS_INT16SZ 2
#define NS_IN6ADDRSZ 16
tp += strlen(tp);
break;
}
- tp += sprintf(tp, "%x", words[i]);
+ tp += SPRINTF((tp, "%x", words[i]));
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) ==
# include <sys/ppsclock.h>
#endif
+#include "ntp_sprintf.h"
+
#ifndef HAVE_STRUCT_PPSCLOCKEV
struct ppsclockev {
# ifdef HAVE_STRUCT_TIMESPEC
cp = buf;
*cp++ = '$';
-#ifdef notdef
- /* BSD is rational */
- n = vsnprintf(cp, sizeof(buf) - 1, fmt, ap);
-#else
- /* SunOS sucks */
- (void)vsprintf(cp, fmt, ap);
- n = strlen(cp);
-#endif /* notdef */
+ n = VSNPRINTF((cp, sizeof(buf) - 1, fmt, ap));
ck = mx4200_cksum(cp, n);
cp += n;
++n;
-#ifdef notdef
- /* BSD is rational */
- n += snprintf(cp, sizeof(buf) - n - 5, "*%02X\r\n", ck);
-#else
- /* SunOS sucks */
- sprintf(cp, "*%02X\r\n", ck);
- n += strlen(cp);
-#endif /* notdef */
+ n += SNPRINTF((cp, sizeof(buf) - n - 5, "*%02X\r\n", ck));
m = write(pp->io.fd, buf, (unsigned)n);
if (m < 0)