]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Many files:
authorHarlan Stenn <stenn@ntp.org>
Fri, 17 Mar 2000 05:09:31 +0000 (05:09 -0000)
committerHarlan Stenn <stenn@ntp.org>
Fri, 17 Mar 2000 05:09:31 +0000 (05:09 -0000)
  Added snprintf stuff

bk: 38d1be0bKi8trKCnzdhYFkdscL7kRA

ChangeLog
config.h.in
configure
configure.in
libntp/Makefile.am
libntp/Makefile.in
libntp/snprintf.c [new file with mode: 0644]

index e1bd360120ed480e6156cd877cb835b1a3cee2eb..9f5322bf4b346903e769755c869b96073e4aeb82 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-03-16  Harlan Stenn  <stenn@whimsy.udel.edu>
 
+       * libntp/Makefile.am (EXTRA_DIST): Added snprintf.c
+
+       * configure.in: Look for (and provide if it's missing) snprintf()
+
        * ntpd/ntp_request.c (dns_a): Call crypto_public with the resolved
        name and the peer pointer.
        (dns_a): crypto_public() is only available if PUBKEY is #defined.
index a25caa4cf2160c474f239342c67a73d9b4c5cc42..8dad8e80bbe033a2e85f1d941860f493c14d36af 100644 (file)
 /* Define if you have the `sigvec' function. */
 #undef HAVE_SIGVEC
 
+/* Define if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
 /* Define if you have the `srand48' function. */
 #undef HAVE_SRAND48
 
index 5d22f13a5802147f3ed475807892a1b638bd89aa..34c6051acd00a67e215107ec3f48052ca2f7dd49 100755 (executable)
--- a/configure
+++ b/configure
@@ -6510,7 +6510,7 @@ EOF
 fi
 done
 
-for ac_func in strerror
+for ac_func in snprintf strerror
 do
 ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh`
 echo $ac_n "checking for $ac_func... $ac_c" 1>&6
index b639aa927057ce2d8a06577080a8752569144c11..c3a8ef616cfb8531f6a8f014902a52f0296f3097 100644 (file)
@@ -612,7 +612,7 @@ esac
 AC_CHECK_FUNCS(setlinebuf)
 AC_CHECK_FUNCS(setpgid setpriority setsid settimeofday setvbuf sigaction)
 AC_CHECK_FUNCS(sigvec sigset sigsuspend stime strchr sysconf sysctl)
-AC_REPLACE_FUNCS(strerror)
+AC_REPLACE_FUNCS(snprintf strerror)
 case "$target" in
  *-*-aix4*)
     # Just stubs.  Idiots.
index 51271afdd13cd2604eb2e9da6fdf465e5f106dfc..96735f5c93392d16b606c92d44517616fc1ddde0 100644 (file)
@@ -23,7 +23,7 @@ noinst_HEADERS = lib_strbuf.h log.h
 ../include/des.h:
        touch ../include/des.h
 
-EXTRA_DIST = README $(HEADERS) adjtimex.c log.c strerror.c mktime.c random.c
+EXTRA_DIST = README $(HEADERS) adjtimex.c log.c mktime.c random.c snprintf.c strerror.c
 
 #mktime_.c: mktime.c $(ANSI2KNR)
 #      $(ANSI2KNR) $< mktime_.c
index c69becec61386979545318c9cfebcf0fbefa1376..c566613f387ec8af639e68193c8e353c00984ba8 100644 (file)
@@ -125,7 +125,7 @@ ETAGS_ARGS = Makefile.am
 
 noinst_HEADERS = lib_strbuf.h log.h
 
-EXTRA_DIST = README $(HEADERS) adjtimex.c log.c strerror.c mktime.c random.c
+EXTRA_DIST = README $(HEADERS) adjtimex.c log.c mktime.c random.c snprintf.c strerror.c
 subdir = libntp
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
@@ -187,7 +187,7 @@ $(DEPDIR)/mfptoms$U.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modetoa$U.Po \
 $(DEPDIR)/mstolfp$U.Po $(DEPDIR)/msutotsf$U.Po $(DEPDIR)/msyslog$U.Po \
 $(DEPDIR)/netof$U.Po $(DEPDIR)/numtoa$U.Po $(DEPDIR)/numtohost$U.Po \
 $(DEPDIR)/octtoint$U.Po $(DEPDIR)/prettydate$U.Po $(DEPDIR)/ranny$U.Po \
-$(DEPDIR)/recvbuff$U.Po $(DEPDIR)/refnumtoa$U.Po \
+$(DEPDIR)/recvbuff$U.Po $(DEPDIR)/refnumtoa$U.Po $(DEPDIR)/snprintf.Po \
 $(DEPDIR)/statestr$U.Po $(DEPDIR)/strerror.Po $(DEPDIR)/syssignal$U.Po \
 $(DEPDIR)/systime$U.Po $(DEPDIR)/tsftomsu$U.Po $(DEPDIR)/tstotv$U.Po \
 $(DEPDIR)/tvtoa$U.Po $(DEPDIR)/tvtots$U.Po $(DEPDIR)/uglydate$U.Po \
@@ -494,6 +494,7 @@ distdir: $(DISTFILES)
 @AMDEP@include $(DEPDIR)/ranny$U.Po
 @AMDEP@include $(DEPDIR)/recvbuff$U.Po
 @AMDEP@include $(DEPDIR)/refnumtoa$U.Po
+@AMDEP@include $(DEPDIR)/snprintf.Po
 @AMDEP@include $(DEPDIR)/statestr$U.Po
 @AMDEP@include $(DEPDIR)/strerror.Po
 @AMDEP@include $(DEPDIR)/syssignal$U.Po
diff --git a/libntp/snprintf.c b/libntp/snprintf.c
new file mode 100644 (file)
index 0000000..d4f7f4a
--- /dev/null
@@ -0,0 +1,50 @@
+#include <sys/types.h>
+
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#ifdef __STDC__
+int snprintf(char *str, size_t n, const char *fmt, ...)
+#else
+int snprintf(str, n, fmt, va_alist)
+       char *str;
+       size_t n;
+       const char *fmt;
+       va_dcl
+#endif
+{
+       va_list ap;
+       char *rp;
+       int rval;
+#ifdef __STDC__
+       va_start(ap, fmt);
+#else
+       va_start(ap);
+#endif
+#ifdef VSPRINTF_CHARSTAR
+       rp = vsprintf(str, fmt, ap);
+       va_end(ap);
+       return (strlen(rp));
+#else
+       rval = vsprintf(str, fmt, ap);
+       va_end(ap);
+       return (rval);
+#endif
+}
+
+int
+vsnprintf(str, n, fmt, ap)
+       char *str;
+       size_t n;
+       const char *fmt;
+       va_list ap;
+{
+#ifdef VSPRINTF_CHARSTAR
+       return (strlen(vsprintf(str, fmt, ap)));
+#else
+       return (vsprintf(str, fmt, ap));
+#endif
+}