diff options
author | roberto <roberto@FreeBSD.org> | 2002-10-29 19:58:12 +0000 |
---|---|---|
committer | roberto <roberto@FreeBSD.org> | 2002-10-29 19:58:12 +0000 |
commit | f77146900e35a78aaabf5f88d47b7675304c8445 (patch) | |
tree | daab9e5ccc14bec1f0fee71e35464e6040c6756f /contrib/ntp/ntpdate | |
parent | 40b8e415eb0f835a9dd7a473ddf134ec67877fd7 (diff) | |
download | FreeBSD-src-f77146900e35a78aaabf5f88d47b7675304c8445.zip FreeBSD-src-f77146900e35a78aaabf5f88d47b7675304c8445.tar.gz |
Virgin import of ntpd 4.1.1a
Diffstat (limited to 'contrib/ntp/ntpdate')
-rw-r--r-- | contrib/ntp/ntpdate/Makefile.am | 2 | ||||
-rw-r--r-- | contrib/ntp/ntpdate/Makefile.in | 185 | ||||
-rw-r--r-- | contrib/ntp/ntpdate/ntpdate.c | 58 | ||||
-rw-r--r-- | contrib/ntp/ntpdate/ntptimeset.c | 7 |
4 files changed, 139 insertions, 113 deletions
diff --git a/contrib/ntp/ntpdate/Makefile.am b/contrib/ntp/ntpdate/Makefile.am index ea55108..f4152b0 100644 --- a/contrib/ntp/ntpdate/Makefile.am +++ b/contrib/ntp/ntpdate/Makefile.am @@ -16,5 +16,5 @@ $(PROGRAMS): $(LDADD) cd ../libntp && $(MAKE) version.o: $(ntpdate_OBJECTS) ../libntp/libntp.a @LIBRSAREF@ Makefile - $(top_builddir)/scripts/mkver ntpdate + env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdate $(COMPILE) -c version.c diff --git a/contrib/ntp/ntpdate/Makefile.in b/contrib/ntp/ntpdate/Makefile.in index f66e351..f215cde 100644 --- a/contrib/ntp/ntpdate/Makefile.in +++ b/contrib/ntp/ntpdate/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4e from Makefile.am. +# Makefile.in generated automatically by automake 1.5 from Makefile.am. # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. @@ -11,6 +11,10 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +@SET_MAKE@ + +#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies + SHELL = @SHELL@ srcdir = @srcdir@ @@ -31,11 +35,9 @@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = .. ACLOCAL = @ACLOCAL@ @@ -49,23 +51,18 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ - NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : - build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ - -@SET_MAKE@ -AMDEP = @AMDEP@ AMTAR = @AMTAR@ AUTOKEY = @AUTOKEY@ AWK = @AWK@ @@ -78,13 +75,12 @@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ EF_LIBS = @EF_LIBS@ EF_PROGS = @EF_PROGS@ +EXEEXT = @EXEEXT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ LN_S = @LN_S@ -MAKEINFO = @MAKEINFO@ MAKE_ADJTIMED = @MAKE_ADJTIMED@ MAKE_CHECK_Y2K = @MAKE_CHECK_Y2K@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ @@ -95,6 +91,7 @@ MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OBJEXT = @OBJEXT@ OPENSSL = @OPENSSL@ OPENSSL_INC = @OPENSSL_INC@ OPENSSL_LIB = @OPENSSL_LIB@ @@ -107,16 +104,13 @@ RSADIR = @RSADIR@ RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ RSASRCS = @RSASRCS@ -STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ -_am_include = @_am_include@ +am__include = @am__include@ +am__quote = @am__quote@ install_sh = @install_sh@ -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies - - AUTOMAKE_OPTIONS = ../util/ansi2knr bin_PROGRAMS = ntpdate ntptimeset ntptimeset_SOURCES = ntptimeset.c ntptime_config.c @@ -127,8 +121,6 @@ DISTCLEANFILES = .version version.c stamp-v noinst_HEADERS = ntpdate.h #EXTRA_DIST = ntpdate.mak ETAGS_ARGS = Makefile.am -EXEEXT = -OBJEXT = o subdir = ntpdate mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h @@ -136,46 +128,45 @@ CONFIG_CLEAN_FILES = bin_PROGRAMS = ntpdate$(EXEEXT) ntptimeset$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) - -DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LIBS = @LIBS@ -ANSI2KNR = ../util/ansi2knr ntpdate_SOURCES = ntpdate.c ntpdate_OBJECTS = ntpdate$U.$(OBJEXT) ntpdate_LDADD = $(LDADD) ntpdate_DEPENDENCIES = version.o ../libntp/libntp.a -ntpdate_LDFLAGS = +ntpdate_LDFLAGS = am_ntptimeset_OBJECTS = ntptimeset$U.$(OBJEXT) \ -ntptime_config$U.$(OBJEXT) + ntptime_config$U.$(OBJEXT) ntptimeset_OBJECTS = $(am_ntptimeset_OBJECTS) ntptimeset_LDADD = $(LDADD) ntptimeset_DEPENDENCIES = version.o ../libntp/libntp.a -ntptimeset_LDFLAGS = -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +ntptimeset_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/ntpdate$U.Po \ +@AMDEP_TRUE@ $(DEPDIR)/ntptime_config$U.Po \ +@AMDEP_TRUE@ $(DEPDIR)/ntptimeset$U.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = ntpdate.c $(ntptimeset_SOURCES) HEADERS = $(noinst_HEADERS) -depcomp = $(SHELL) $(top_srcdir)/depcomp -@AMDEP@DEP_FILES = $(DEPDIR)/ntpdate$U.Po $(DEPDIR)/ntptime_config$U.Po \ -@AMDEP@ $(DEPDIR)/ntptimeset$U.Po DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in - SOURCES = ntpdate.c $(ntptimeset_SOURCES) -OBJECTS = ntpdate$U.$(OBJEXT) $(am_ntptimeset_OBJECTS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj - -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu ntpdate/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && \ CONFIG_HEADERS= CONFIG_LINKS= \ CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status @@ -183,8 +174,10 @@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ @@ -200,37 +193,54 @@ uninstall-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +ntpdate$(EXEEXT): $(ntpdate_OBJECTS) $(ntpdate_DEPENDENCIES) + @rm -f ntpdate$(EXEEXT) + $(LINK) $(ntpdate_LDFLAGS) $(ntpdate_OBJECTS) $(ntpdate_LDADD) $(LIBS) +ntptimeset$(EXEEXT): $(ntptimeset_OBJECTS) $(ntptimeset_DEPENDENCIES) + @rm -f ntptimeset$(EXEEXT) + $(LINK) $(ntptimeset_LDFLAGS) $(ntptimeset_OBJECTS) $(ntptimeset_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c -../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr - -../util/ansi2knr.$(OBJEXT): - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) +ANSI2KNR = ../util/ansi2knr +../util/ansi2knr: + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr mostlyclean-kr: -rm -f *_.c -ntpdate: $(ntpdate_OBJECTS) $(ntpdate_DEPENDENCIES) - @rm -f ntpdate - $(LINK) $(ntpdate_LDFLAGS) $(ntpdate_OBJECTS) $(ntpdate_LDADD) $(LIBS) +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ntpdate$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ntptime_config$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ntptimeset$U.Po@am__quote@ -ntptimeset: $(ntptimeset_OBJECTS) $(ntptimeset_DEPENDENCIES) - @rm -f ntptimeset - $(LINK) $(ntptimeset_LDFLAGS) $(ntptimeset_OBJECTS) $(ntptimeset_LDADD) $(LIBS) +distclean-depend: + -rm -rf $(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` +CCDEPMODE = @CCDEPMODE@ ntpdate_.c: ntpdate.c $(ANSI2KNR) - $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdate.c; then echo $(srcdir)/ntpdate.c; else echo ntpdate.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpdate_.c + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdate.c; then echo $(srcdir)/ntpdate.c; else echo ntpdate.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntpdate_.c || rm -f ntpdate_.c ntptime_config_.c: ntptime_config.c $(ANSI2KNR) - $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptime_config.c; then echo $(srcdir)/ntptime_config.c; else echo ntptime_config.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptime_config_.c + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptime_config.c; then echo $(srcdir)/ntptime_config.c; else echo ntptime_config.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptime_config_.c || rm -f ntptime_config_.c ntptimeset_.c: ntptimeset.c $(ANSI2KNR) - $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptimeset.c; then echo $(srcdir)/ntptimeset.c; else echo ntptimeset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptimeset_.c + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntptimeset.c; then echo $(srcdir)/ntptimeset.c; else echo ntptimeset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ntptimeset_.c || rm -f ntptimeset_.c ntpdate_.$(OBJEXT) ntptime_config_.$(OBJEXT) ntptimeset_.$(OBJEXT) : \ $(ANSI2KNR) +uninstall-info-am: tags: TAGS @@ -243,7 +253,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) END { for (i in files) print i; }'`; \ mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -259,32 +269,10 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ GTAGS: here=`CDPATH=: && cd $(top_builddir) && pwd` \ && cd $(top_srcdir) \ - && gtags -i $$here + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID - -@AMDEP@@_am_include@ $(DEPDIR)/ntpdate$U.Po -@AMDEP@@_am_include@ $(DEPDIR)/ntptime_config$U.Po -@AMDEP@@_am_include@ $(DEPDIR)/ntptimeset$U.Po - -distclean-depend: - -rm -rf $(DEPDIR) - -@AMDEP@CCDEPMODE = @CCDEPMODE@ - -.c.o: -@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< - -.c.obj: -@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ `cygpath -w $<` - + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -293,7 +281,11 @@ distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @for file in $(DISTFILES); do \ - d=$(srcdir); \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ if test -d $$d/$$file; then \ cp -pR $$d/$$file $(distdir) \ || exit 1; \ @@ -319,24 +311,21 @@ install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am - install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install - + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -rm -f Makefile.in clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am @@ -346,11 +335,11 @@ distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags -dvi: +dvi: dvi-am dvi-am: -info: +info: info-am info-am: @@ -358,7 +347,7 @@ install-data-am: install-exec-am: install-binPROGRAMS -install-info: +install-info: install-info-am install-man: @@ -372,17 +361,18 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr -uninstall-am: uninstall-binPROGRAMS +uninstall-am: uninstall-binPROGRAMS uninstall-info-am -.PHONY: all all-am check check-am clean clean-binPROGRAMS clean-generic \ - distclean distclean-compile distclean-depend distclean-generic \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-binPROGRAMS install-data install-data-am \ - install-exec install-exec-am install-info install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-kr tags \ - uninstall uninstall-am uninstall-binPROGRAMS +.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic distclean distclean-compile distclean-depend \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-kr tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am $(PROGRAMS): $(LDADD) @@ -391,9 +381,8 @@ $(PROGRAMS): $(LDADD) cd ../libntp && $(MAKE) version.o: $(ntpdate_OBJECTS) ../libntp/libntp.a @LIBRSAREF@ Makefile - $(top_builddir)/scripts/mkver ntpdate + env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdate $(COMPILE) -c version.c - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/contrib/ntp/ntpdate/ntpdate.c b/contrib/ntp/ntpdate/ntpdate.c index b01d539..db82375 100644 --- a/contrib/ntp/ntpdate/ntpdate.c +++ b/contrib/ntp/ntpdate/ntpdate.c @@ -10,6 +10,7 @@ #include <netinfo/ni.h> #endif +#include "ntp_machine.h" #include "ntp_fp.h" #include "ntp.h" #include "ntp_io.h" @@ -32,7 +33,11 @@ #endif #ifndef SYS_WINNT # include <netdb.h> -# include <sys/signal.h> +# ifdef HAVE_SYS_SIGNAL_H +# include <sys/signal.h> +# else +# include <signal.h> +# endif # ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> # endif @@ -423,7 +428,7 @@ ntpdatemain ( if (errflg) { (void) fprintf(stderr, - "usage: %s [-bBdqsv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-r rate] [-t timeo] server ...\n", + "usage: %s [-bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-r rate] [-t timeo] server ...\n", progname); exit(2); } @@ -735,7 +740,7 @@ receive( register struct pkt *rpkt; register struct server *server; register s_fp di; - l_fp t10, t23; + l_fp t10, t23, tmp; l_fp org; l_fp rec; l_fp ci; @@ -857,9 +862,15 @@ receive( L_SUB(&t23, &org); /* pkt->org == t3 */ /* now have (t2 - t3) and (t0 - t1). Calculate (ci) and (di) */ + /* + * Calculate (ci) = ((t1 - t0) / 2) + ((t2 - t3) / 2) + * For large offsets this may prevent an overflow on '+' + */ ci = t10; - L_ADD(&ci, &t23); L_RSHIFT(&ci); + tmp = t23; + L_RSHIFT(&tmp); + L_ADD(&ci, &tmp); /* * Calculate di in t23 in full precision, then truncate @@ -1015,23 +1026,44 @@ clock_select(void) */ nlist = 0; /* none yet */ for (server = sys_servers; server != NULL; server = server->next_server) { - if (server->delay == 0) - continue; /* no data */ - if (server->stratum > NTP_INFIN) - continue; /* stratum no good */ + if (server->delay == 0) { + if (debug) + printf("%s: Server dropped: no data\n", ntoa(&server->srcadr)); + continue; /* no data */ + } + if (server->stratum > NTP_INFIN) { + if (debug) + printf("%s: Server dropped: strata too high\n", ntoa(&server->srcadr)); + continue; /* stratum no good */ + } if (server->delay > NTP_MAXWGT) { - continue; /* too far away */ + if (debug) + printf("%s: Server dropped: server too far away\n", + ntoa(&server->srcadr)); + continue; /* too far away */ + } + if (server->leap == LEAP_NOTINSYNC) { + if (debug) + printf("%s: Server dropped: Leap not in sync\n", ntoa(&server->srcadr)); + continue; /* he's in trouble */ } - if (server->leap == LEAP_NOTINSYNC) - continue; /* he's in trouble */ if (!L_ISHIS(&server->org, &server->reftime)) { - continue; /* very broken host */ + if (debug) + printf("%s: Server dropped: server is very broken\n", + ntoa(&server->srcadr)); + continue; /* very broken host */ } if ((server->org.l_ui - server->reftime.l_ui) - >= NTP_MAXAGE) { + >= NTP_MAXAGE) { + if (debug) + printf("%s: Server dropped: Server has gone too long without sync\n", + ntoa(&server->srcadr)); continue; /* too long without sync */ } if (server->trust != 0) { + if (debug) + printf("%s: Server dropped: Server is untrusted\n", + ntoa(&server->srcadr)); continue; } diff --git a/contrib/ntp/ntpdate/ntptimeset.c b/contrib/ntp/ntpdate/ntptimeset.c index 95b70b6..6d9332f 100644 --- a/contrib/ntp/ntpdate/ntptimeset.c +++ b/contrib/ntp/ntpdate/ntptimeset.c @@ -121,6 +121,7 @@ # include <config.h> #endif +#include "ntp_machine.h" #include "ntp_fp.h" #include "ntp.h" #include "ntp_io.h" @@ -141,7 +142,11 @@ #include <ctype.h> #ifndef SYS_WINNT # include <netdb.h> -# include <sys/signal.h> +# ifdef HAVE_SYS_SIGNAL_H +# include <sys/signal.h> +# else +# include <signal.h> +# endif # include <sys/ioctl.h> #endif /* SYS_WINNT */ |