summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpdc
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-07-15 19:21:26 +0000
committerdelphij <delphij@FreeBSD.org>2015-07-15 19:21:26 +0000
commit2a25cee78ab1d37e7d2bc40ae675646974d99f56 (patch)
treeb0302ac4be59e104f4e1e54014561a1389397192 /contrib/ntp/ntpdc
parenta0741a75537b2e0514472ac3b28afc55a7846c30 (diff)
downloadFreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.zip
FreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.tar.gz
MFC r280849,280915-280916,281015-281016,282097,282408,282415,283542,
284864,285169-285170,285435: ntp 4.2.8p3. Relnotes: yes Approved by: re (?)
Diffstat (limited to 'contrib/ntp/ntpdc')
-rw-r--r--contrib/ntp/ntpdc/Makefile.am155
-rw-r--r--contrib/ntp/ntpdc/Makefile.in987
-rw-r--r--contrib/ntp/ntpdc/invoke-ntpdc.menu (renamed from contrib/ntp/ntpdc/ntpdc-opts.menu)0
-rw-r--r--contrib/ntp/ntpdc/invoke-ntpdc.texi349
-rw-r--r--contrib/ntp/ntpdc/layout.std28
-rwxr-xr-xcontrib/ntp/ntpdc/nl.pl10
-rw-r--r--contrib/ntp/ntpdc/nl.pl.in10
-rw-r--r--contrib/ntp/ntpdc/ntpdc-layout.c1
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.c1378
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.def775
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.h274
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.texi278
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1158
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcman874
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc809
-rw-r--r--contrib/ntp/ntpdc/ntpdc.c809
-rw-r--r--contrib/ntp/ntpdc/ntpdc.h10
-rw-r--r--contrib/ntp/ntpdc/ntpdc.html515
-rw-r--r--contrib/ntp/ntpdc/ntpdc.man.in874
-rw-r--r--contrib/ntp/ntpdc/ntpdc.mdoc.in809
-rw-r--r--contrib/ntp/ntpdc/ntpdc.texi88
-rw-r--r--contrib/ntp/ntpdc/ntpdc_ops.c1366
22 files changed, 8139 insertions, 2418 deletions
diff --git a/contrib/ntp/ntpdc/Makefile.am b/contrib/ntp/ntpdc/Makefile.am
index 858c523..a61dab9 100644
--- a/contrib/ntp/ntpdc/Makefile.am
+++ b/contrib/ntp/ntpdc/Makefile.am
@@ -1,40 +1,122 @@
-AUTOMAKE_OPTIONS= ../util/ansi2knr
+NULL=
-bindir= ${exec_prefix}/${BINSUBDIR}
-bin_PROGRAMS= ntpdc
-EXTRA_PROGRAMS= ntpdc-layout
+bin_PROGRAMS= $(NTPDC_DB)
+libexec_PROGRAMS= $(NTPDC_DL)
+sbin_PROGRAMS= $(NTPDC_DS)
+
+EXTRA_PROGRAMS= ntpdc ntpdc-layout
EXTRA_DATA= check-layout
-BUILT_SOURCES= @MAKE_CHECK_LAYOUT@
-AM_CPPFLAGS= -I$(top_srcdir)/include $(LIBOPTS_CFLAGS)
+BUILT_SOURCES= @MAKE_CHECK_LAYOUT@ ntpdc-opts.c ntpdc-opts.h
+
+AM_CFLAGS = $(CFLAGS_NTP)
+
+AM_CPPFLAGS = $(NTP_INCS)
+AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
+AM_CPPFLAGS += $(CPPFLAGS_NTP)
+
+AM_LDFLAGS = $(LDFLAGS_NTP)
+
# LDADD might need RESLIB and ADJLIB
-ntpdc_LDADD= version.o @READLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a
+ntpdc_LDADD = version.o $(LIBOPTS_LDADD)
+ntpdc_LDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
+ntpdc_LDADD += $(PTHREAD_LIBS) $(EDITLINE_LIBS)
+ntpdc_LDADD += $(LDADD_NTP)
# ntpdc-layout doesn't need any additional libraries at all
ntpdc_layout_LDADD=
-DISTCLEANFILES= .version version.c
+
+DISTCLEANFILES= .version version.c config.log $(man_MANS)
CLEANFILES= check-layout layout.here nl.c ntpdc-layout
noinst_HEADERS= ntpdc.h
ETAGS_ARGS= Makefile.am
-EXTRA_DIST= nl_in.c nl.pl layout.std \
- ntpdc-opts.def ntpdc.1 ntpdc-opts.texi ntpdc-opts.menu
-BUILT_SOURCES+= ntpdc-opts.c ntpdc-opts.h ntpdc.1 ntpdc-opts.texi \
- ntpdc-opts.menu
-man_MANS= ntpdc.1
-run_ag= cd $(srcdir) && autogen -L ../include --writable
-std_def_list= $(top_srcdir)/include/debug-opt.def \
- $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/homerc.def \
- $(top_srcdir)/include/version.def
+EXTRA_DIST= \
+ invoke-ntpdc.menu \
+ invoke-ntpdc.texi \
+ layout.std \
+ nl_in.c \
+ nl.pl \
+ ntpdc-opts.def \
+ ntpdc.1ntpdcman \
+ ntpdc.1ntpdcmdoc \
+ ntpdc.man.in \
+ ntpdc.mdoc.in \
+ ntpdc.html \
+ ntpdc.texi \
+ $(NULL)
+
+man1_MANS=
+man8_MANS=
+man_MANS= ntpdc.$(NTPDC_MS)
+
+## HMS: Real Soon Now...
+##info_TEXINFOS= ntpdc.texi
+##ntpdc_TEXINFOS= ntpdc-opts.texi
+
+html_DATA= \
+ $(srcdir)/ntpdc.html \
+ $(NULL)
+
+noinst_DATA= \
+ $(srcdir)/invoke-ntpdc.menu \
+ $(srcdir)/invoke-ntpdc.texi \
+ $(srcdir)/ntpdc.man.in \
+ $(srcdir)/ntpdc.mdoc.in \
+ $(NULL)
+
+install-data-local: install-html
+
+run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D \
+ autogen -L ../sntp/include -L ../sntp/ag-tpl --writable
+
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/ntp.lic \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.c
+ @: do-nothing action to avoid default SCCS get, .h built with .c
+
$(srcdir)/ntpdc-opts.c: $(srcdir)/ntpdc-opts.def $(std_def_list)
$(run_ag) ntpdc-opts.def
-$(srcdir)/ntpdc.1: $(srcdir)/ntpdc-opts.def $(std_def_list)
- $(run_ag) -Tagman1.tpl -bntpdc ntpdc-opts.def
+###
+
+$(srcdir)/ntpdc.1ntpdcman: $(srcdir)/ntpdc-opts.def $(std_def_list)
+ $(run_ag) -DMAN_SECTION=1ntpdcman -Tagman-cmd.tpl ntpdc-opts.def
+
+$(srcdir)/ntpdc.man.in: $(srcdir)/ntpdc.1ntpdcman $(top_srcdir)/sntp/scripts/mansec2subst.sed
+ sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpdc.1ntpdcman > $(srcdir)/ntpdc.man.in+
+ mv $(srcdir)/ntpdc.man.in+ $(srcdir)/ntpdc.man.in
+
+###
+
+$(srcdir)/ntpdc.1ntpdcmdoc: $(srcdir)/ntpdc-opts.def $(std_def_list)
+ $(run_ag) -DMAN_SECTION=1ntpdcmdoc -Tagmdoc-cmd.tpl ntpdc-opts.def
+
+$(srcdir)/ntpdc.mdoc.in: $(srcdir)/ntpdc.1ntpdcmdoc $(top_srcdir)/sntp/scripts/mansec2subst.sed
+ sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpdc.1ntpdcmdoc > $(srcdir)/ntpdc.mdoc.in+
+ mv $(srcdir)/ntpdc.mdoc.in+ $(srcdir)/ntpdc.mdoc.in
-$(srcdir)/ntpdc-opts.texi $(srcdir)/ntpdc-opts.menu: $(srcdir)/ntpdc-opts.def $(std_def_list)
- $(run_ag) -Taginfo.tpl -DLEVEL=section ntpdc-opts.def
+###
+
+ntpdc.$(NTPDC_MS): $(srcdir)/ntpdc.$(MANTAGFMT).in $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=ntpdc.$(NTPDC_MS)+:$(srcdir)/ntpdc.$(MANTAGFMT).in
+ mv ntpdc.$(NTPDC_MS)+ ntpdc.$(NTPDC_MS)
+
+###
+
+$(srcdir)/invoke-ntpdc.menu: $(srcdir)/invoke-ntpdc.texi
+ @: do-nothing action to avoid default SCCS get, .menu built with .texi
+
+$(srcdir)/invoke-ntpdc.texi: $(srcdir)/ntpdc-opts.def $(std_def_list)
+ $(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section ntpdc-opts.def
+ $(top_srcdir)/scripts/build/check--help $@
+
+$(srcdir)/ntpdc.html: $(srcdir)/invoke-ntpdc.menu $(srcdir)/invoke-ntpdc.texi $(srcdir)/ntpdc.texi $(top_srcdir)/sntp/include/version.texi
+ cd $(srcdir) && ( makeinfo --force --html --no-split -I ../sntp -o ntpdc.html ntpdc.texi || true )
ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-opts.c ntpdc-opts.h
@@ -43,24 +125,27 @@ ntpdc-layout.o: nl.c
layout.here: ntpdc-layout
./ntpdc-layout > $@
-check-layout: ntpdc-layout layout.std layout.here
+check-layout: ntpdc-layout $(srcdir)/layout.std layout.here
cmp $(srcdir)/layout.std layout.here && echo stamp > $@
-$(PROGRAMS): $(LDADD)
-
-../libntp/libntp.a:
- cd ../libntp && $(MAKE)
+$(PROGRAMS): version.o
-$(top_srcdir)/version :
- cd $(top_srcdir) && $(MAKE) version
+$(top_srcdir)/sntp/scm-rev:
+ cd ../sntp && $(MAKE) $(AM_MAKEFLAGS) check-scm-rev
-version.o: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
- env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdc
- $(COMPILE) -c version.c
+version.c: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/scm-rev
+ env CSET=`cat $(top_srcdir)/sntp/scm-rev` $(top_builddir)/scripts/build/mkver ntpdc
+
+version.o: version.c
+ env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
# I ran nl_in.c (attached, to be installed into ntpdc) through
# $(CC) -E nl_in.c | nl.pl > nl.c
-nl.c: nl_in.c nl.pl Makefile.am
+nl.c: nl_in.c nl.pl Makefile.am ../config.h ../include/ntp_request.h ntpdc.h
$(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c
-include ../bincheck.mf
+include $(top_srcdir)/bincheck.mf
+include $(top_srcdir)/check-libopts.mf
+include $(top_srcdir)/sntp/check-libntp.mf
+include $(top_srcdir)/depsver.mf
+include $(top_srcdir)/includes.mf
diff --git a/contrib/ntp/ntpdc/Makefile.in b/contrib/ntp/ntpdc/Makefile.in
index 0e4ce77..be8cd55 100644
--- a/contrib/ntp/ntpdc/Makefile.in
+++ b/contrib/ntp/ntpdc/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -20,7 +19,63 @@
# subdir to warn folks if there is another version there.
+
VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -39,50 +94,114 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-ANSI2KNR = ../util/ansi2knr
-bin_PROGRAMS = ntpdc$(EXEEXT)
-EXTRA_PROGRAMS = ntpdc-layout$(EXEEXT)
-DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/../bincheck.mf \
- $(srcdir)/Makefile.am $(srcdir)/Makefile.in $(srcdir)/nl.pl.in
+EXTRA_PROGRAMS = ntpdc$(EXEEXT) ntpdc-layout$(EXEEXT)
subdir = ntpdc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
- $(top_srcdir)/m4/define_dir.m4 \
- $(top_srcdir)/m4/hs_ulong_const.m4 \
- $(top_srcdir)/m4/os_cflags.m4 $(top_srcdir)/version.m4 \
- $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/sntp/libopts/m4/libopts.m4 \
+ $(top_srcdir)/sntp/libopts/m4/stdnoreturn.m4 \
+ $(top_srcdir)/sntp/m4/ax_c99_struct_init.m4 \
+ $(top_srcdir)/sntp/m4/define_dir.m4 \
+ $(top_srcdir)/sntp/m4/hms_search_lib.m4 \
+ $(top_srcdir)/sntp/m4/libtool.m4 \
+ $(top_srcdir)/sntp/m4/ltoptions.m4 \
+ $(top_srcdir)/sntp/m4/ltsugar.m4 \
+ $(top_srcdir)/sntp/m4/ltversion.m4 \
+ $(top_srcdir)/sntp/m4/lt~obsolete.m4 \
+ $(top_srcdir)/sntp/m4/ntp_cacheversion.m4 \
+ $(top_srcdir)/sntp/m4/ntp_compiler.m4 \
+ $(top_srcdir)/sntp/m4/ntp_crosscompile.m4 \
+ $(top_srcdir)/sntp/m4/ntp_crypto_rand.m4 \
+ $(top_srcdir)/sntp/m4/ntp_debug.m4 \
+ $(top_srcdir)/sntp/m4/ntp_dir_sep.m4 \
+ $(top_srcdir)/sntp/m4/ntp_facilitynames.m4 \
+ $(top_srcdir)/sntp/m4/ntp_googletest.m4 \
+ $(top_srcdir)/sntp/m4/ntp_ipv6.m4 \
+ $(top_srcdir)/sntp/m4/ntp_lib_m.m4 \
+ $(top_srcdir)/sntp/m4/ntp_libevent.m4 \
+ $(top_srcdir)/sntp/m4/ntp_libntp.m4 \
+ $(top_srcdir)/sntp/m4/ntp_lineeditlibs.m4 \
+ $(top_srcdir)/sntp/m4/ntp_locinfo.m4 \
+ $(top_srcdir)/sntp/m4/ntp_openssl.m4 \
+ $(top_srcdir)/sntp/m4/ntp_pkg_config.m4 \
+ $(top_srcdir)/sntp/m4/ntp_prog_cc.m4 \
+ $(top_srcdir)/sntp/m4/ntp_rlimit.m4 \
+ $(top_srcdir)/sntp/m4/ntp_sntp.m4 \
+ $(top_srcdir)/sntp/m4/ntp_unitytest.m4 \
+ $(top_srcdir)/sntp/m4/ntp_ver_suffix.m4 \
+ $(top_srcdir)/sntp/m4/ntp_vpathhack.m4 \
+ $(top_srcdir)/sntp/m4/openldap-thread-check.m4 \
+ $(top_srcdir)/sntp/m4/openldap.m4 \
+ $(top_srcdir)/sntp/m4/os_cflags.m4 \
+ $(top_srcdir)/sntp/m4/snprintf.m4 \
+ $(top_srcdir)/sntp/m4/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \
+ $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = nl.pl
CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
-PROGRAMS = $(bin_PROGRAMS)
-am_ntpdc_OBJECTS = ntpdc$U.$(OBJEXT) ntpdc_ops$U.$(OBJEXT) \
- ntpdc-opts$U.$(OBJEXT)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \
+ "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" \
+ "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(htmldir)"
+PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) $(sbin_PROGRAMS)
+am_ntpdc_OBJECTS = ntpdc.$(OBJEXT) ntpdc_ops.$(OBJEXT) \
+ ntpdc-opts.$(OBJEXT)
ntpdc_OBJECTS = $(am_ntpdc_OBJECTS)
am__DEPENDENCIES_1 =
ntpdc_DEPENDENCIES = version.o $(am__DEPENDENCIES_1) \
- ../libntp/libntp.a
+ ../libntp/libntp.a $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
ntpdc_layout_SOURCES = ntpdc-layout.c
-ntpdc_layout_OBJECTS = ntpdc-layout$U.$(OBJEXT)
+ntpdc_layout_OBJECTS = ntpdc-layout.$(OBJEXT)
ntpdc_layout_DEPENDENCIES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
+depcomp = $(SHELL) $(top_srcdir)/sntp/libevent/build-aux/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(ntpdc_SOURCES) ntpdc-layout.c
DIST_SOURCES = $(ntpdc_SOURCES) ntpdc-layout.c
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -104,50 +223,110 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
man1dir = $(mandir)/man1
+man8dir = $(mandir)/man8
NROFF = nroff
-MANS = $(man_MANS)
+MANS = $(man1_MANS) $(man8_MANS) $(man_MANS)
+DATA = $(html_DATA) $(noinst_DATA)
HEADERS = $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/nl.pl.in \
+ $(top_srcdir)/bincheck.mf $(top_srcdir)/check-libopts.mf \
+ $(top_srcdir)/depsver.mf $(top_srcdir)/includes.mf \
+ $(top_srcdir)/sntp/check-libntp.mf \
+ $(top_srcdir)/sntp/libevent/build-aux/depcomp README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
-ARLIB_DIR = @ARLIB_DIR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BINSUBDIR = @BINSUBDIR@
+CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
+CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
+CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
+CALC_TICKADJ_MS = @CALC_TICKADJ_MS@
+CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CFLAGS_NTP = @CFLAGS_NTP@
CHUTEST = @CHUTEST@
-CLKTEST = @CLKTEST@
+CONFIG_SHELL = @CONFIG_SHELL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
+CPPFLAGS_NTP = @CPPFLAGS_NTP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DCFD = @DCFD@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
-ECHO = @ECHO@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
-EF_LIBS = @EF_LIBS@
-EF_PROGS = @EF_PROGS@
+EDITLINE_LIBS = @EDITLINE_LIBS@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+FGREP = @FGREP@
GREP = @GREP@
+GTEST_CONFIG = @GTEST_CONFIG@
+GTEST_CPPFLAGS = @GTEST_CPPFLAGS@
+GTEST_CXXFLAGS = @GTEST_CXXFLAGS@
+GTEST_LDFLAGS = @GTEST_LDFLAGS@
+GTEST_LIBS = @GTEST_LIBS@
HAVE_INLINE = @HAVE_INLINE@
+HAVE_LEAPSMEARINTERVAL = @HAVE_LEAPSMEARINTERVAL@
+HAVE_RLIMIT_MEMLOCK = @HAVE_RLIMIT_MEMLOCK@
+HAVE_RLIMIT_STACK = @HAVE_RLIMIT_STACK@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LCRYPTO = @LCRYPTO@
+LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
+LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
+LDADD_NLIST = @LDADD_NLIST@
+LDADD_NTP = @LDADD_NTP@
LDFLAGS = @LDFLAGS@
+LDFLAGS_NTP = @LDFLAGS_NTP@
+LIBISC_PTHREADS_NOTHREADS = @LIBISC_PTHREADS_NOTHREADS@
+LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
LIBOPTS_DIR = @LIBOPTS_DIR@
@@ -155,6 +334,8 @@ LIBOPTS_LDADD = @LIBOPTS_LDADD@
LIBPARSE = @LIBPARSE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
LN_S = @LN_S@
LSCF = @LSCF@
LTLIBOBJS = @LTLIBOBJS@
@@ -166,15 +347,76 @@ MAKE_LIBNTPSIM = @MAKE_LIBNTPSIM@
MAKE_LIBPARSE = @MAKE_LIBPARSE@
MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@
MAKE_NTPDSIM = @MAKE_NTPDSIM@
+MAKE_NTPSNMPD = @MAKE_NTPSNMPD@
MAKE_NTPTIME = @MAKE_NTPTIME@
MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@
MAKE_TICKADJ = @MAKE_TICKADJ@
MAKE_TIMETRIM = @MAKE_TIMETRIM@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MANTAGFMT = @MANTAGFMT@
MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NTPDATE_DB = @NTPDATE_DB@
+NTPDATE_DL = @NTPDATE_DL@
+NTPDATE_DS = @NTPDATE_DS@
+NTPDATE_MS = @NTPDATE_MS@
+NTPDATE_NI = @NTPDATE_NI@
+NTPDC_DB = @NTPDC_DB@
+NTPDC_DL = @NTPDC_DL@
+NTPDC_DS = @NTPDC_DS@
+NTPDC_MS = @NTPDC_MS@
+NTPDC_NI = @NTPDC_NI@
+NTPDSIM_DB = @NTPDSIM_DB@
+NTPDSIM_DL = @NTPDSIM_DL@
+NTPDSIM_DS = @NTPDSIM_DS@
+NTPDSIM_MS = @NTPDSIM_MS@
+NTPDSIM_NI = @NTPDSIM_NI@
+NTPD_DB = @NTPD_DB@
+NTPD_DL = @NTPD_DL@
+NTPD_DS = @NTPD_DS@
+NTPD_MS = @NTPD_MS@
+NTPD_NI = @NTPD_NI@
+NTPQ_DB = @NTPQ_DB@
+NTPQ_DL = @NTPQ_DL@
+NTPQ_DS = @NTPQ_DS@
+NTPQ_MS = @NTPQ_MS@
+NTPQ_NI = @NTPQ_NI@
+NTPSNMPD_DB = @NTPSNMPD_DB@
+NTPSNMPD_DL = @NTPSNMPD_DL@
+NTPSNMPD_DS = @NTPSNMPD_DS@
+NTPSNMPD_MS = @NTPSNMPD_MS@
+NTPSNMPD_NI = @NTPSNMPD_NI@
+NTPSWEEP_DB = @NTPSWEEP_DB@
+NTPSWEEP_DL = @NTPSWEEP_DL@
+NTPSWEEP_DS = @NTPSWEEP_DS@
+NTPSWEEP_MS = @NTPSWEEP_MS@
+NTPSWEEP_NI = @NTPSWEEP_NI@
+NTPTIME_DB = @NTPTIME_DB@
+NTPTIME_DL = @NTPTIME_DL@
+NTPTIME_DS = @NTPTIME_DS@
+NTPTIME_MS = @NTPTIME_MS@
+NTPTIME_NI = @NTPTIME_NI@
+NTPTRACE_DB = @NTPTRACE_DB@
+NTPTRACE_DL = @NTPTRACE_DL@
+NTPTRACE_DS = @NTPTRACE_DS@
+NTPTRACE_MS = @NTPTRACE_MS@
+NTPTRACE_NI = @NTPTRACE_NI@
+NTP_KEYGEN_DB = @NTP_KEYGEN_DB@
+NTP_KEYGEN_DL = @NTP_KEYGEN_DL@
+NTP_KEYGEN_DS = @NTP_KEYGEN_DS@
+NTP_KEYGEN_MS = @NTP_KEYGEN_MS@
+NTP_KEYGEN_NI = @NTP_KEYGEN_NI@
+NTP_KEYSDIR = @NTP_KEYSDIR@
+NTP_WAIT_DB = @NTP_WAIT_DB@
+NTP_WAIT_DL = @NTP_WAIT_DL@
+NTP_WAIT_DS = @NTP_WAIT_DS@
+NTP_WAIT_MS = @NTP_WAIT_MS@
+NTP_WAIT_NI = @NTP_WAIT_NI@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENSSL = @OPENSSL@
-OPENSSL_INC = @OPENSSL_INC@
-OPENSSL_LIB = @OPENSSL_LIB@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -182,29 +424,65 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_NET_SNMP_CONFIG = @PATH_NET_SNMP_CONFIG@
PATH_PERL = @PATH_PERL@
+PATH_RUBY = @PATH_RUBY@
PATH_SEPARATOR = @PATH_SEPARATOR@
-PATH_SH = @PATH_SH@
+PATH_TEST = @PATH_TEST@
+PERLLIBDIR = @PERLLIBDIR@
+PKG_CONFIG = @PKG_CONFIG@
+POSIX_SHELL = @POSIX_SHELL@
PROPDELAY = @PROPDELAY@
+PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
-READLINE_LIBS = @READLINE_LIBS@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
+SNMP_CFLAGS = @SNMP_CFLAGS@
+SNMP_CPPFLAGS = @SNMP_CPPFLAGS@
+SNMP_LIBS = @SNMP_LIBS@
+SNTP = @SNTP@
+SNTP_DB = @SNTP_DB@
+SNTP_DL = @SNTP_DL@
+SNTP_DS = @SNTP_DS@
+SNTP_MS = @SNTP_MS@
+SNTP_NI = @SNTP_NI@
+STDNORETURN_H = @STDNORETURN_H@
STRIP = @STRIP@
TESTDCF = @TESTDCF@
-U = @U@
+TICKADJ_DB = @TICKADJ_DB@
+TICKADJ_DL = @TICKADJ_DL@
+TICKADJ_DS = @TICKADJ_DS@
+TICKADJ_MS = @TICKADJ_MS@
+TICKADJ_NI = @TICKADJ_NI@
+TIMETRIM_DB = @TIMETRIM_DB@
+TIMETRIM_DL = @TIMETRIM_DL@
+TIMETRIM_DS = @TIMETRIM_DS@
+TIMETRIM_MS = @TIMETRIM_MS@
+TIMETRIM_NI = @TIMETRIM_NI@
+UPDATE_LEAP_DB = @UPDATE_LEAP_DB@
+UPDATE_LEAP_DL = @UPDATE_LEAP_DL@
+UPDATE_LEAP_DS = @UPDATE_LEAP_DS@
+UPDATE_LEAP_MS = @UPDATE_LEAP_MS@
+UPDATE_LEAP_NI = @UPDATE_LEAP_NI@
VERSION = @VERSION@
+VER_SUFFIX = @VER_SUFFIX@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
-bindir = ${exec_prefix}/${BINSUBDIR}
+bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
@@ -245,37 +523,79 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-AUTOMAKE_OPTIONS = ../util/ansi2knr
+NULL =
+bin_PROGRAMS = $(NTPDC_DB)
+libexec_PROGRAMS = $(NTPDC_DL)
+sbin_PROGRAMS = $(NTPDC_DS)
EXTRA_DATA = check-layout
-BUILT_SOURCES = @MAKE_CHECK_LAYOUT@ ntpdc-opts.c ntpdc-opts.h ntpdc.1 \
- ntpdc-opts.texi ntpdc-opts.menu
-AM_CPPFLAGS = -I$(top_srcdir)/include $(LIBOPTS_CFLAGS)
+BUILT_SOURCES = @MAKE_CHECK_LAYOUT@ ntpdc-opts.c ntpdc-opts.h \
+ check-libopts check-libntp .deps-ver
+AM_CFLAGS = $(CFLAGS_NTP)
+AM_CPPFLAGS = $(NTP_INCS) $(LIBOPTS_CFLAGS) $(CPPFLAGS_NTP)
+AM_LDFLAGS = $(LDFLAGS_NTP)
+
# LDADD might need RESLIB and ADJLIB
-ntpdc_LDADD = version.o @READLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a
+ntpdc_LDADD = version.o $(LIBOPTS_LDADD) ../libntp/libntp.a \
+ $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS) $(EDITLINE_LIBS) \
+ $(LDADD_NTP)
# ntpdc-layout doesn't need any additional libraries at all
ntpdc_layout_LDADD =
-DISTCLEANFILES = .version version.c
-CLEANFILES = check-layout layout.here nl.c ntpdc-layout
+DISTCLEANFILES = .version version.c config.log $(man_MANS)
+CLEANFILES = check-layout layout.here nl.c ntpdc-layout check-libopts \
+ check-libntp .deps-ver
noinst_HEADERS = ntpdc.h
ETAGS_ARGS = Makefile.am
-EXTRA_DIST = nl_in.c nl.pl layout.std \
- ntpdc-opts.def ntpdc.1 ntpdc-opts.texi ntpdc-opts.menu
-
-man_MANS = ntpdc.1
-run_ag = cd $(srcdir) && autogen -L ../include --writable
-std_def_list = $(top_srcdir)/include/debug-opt.def \
- $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/homerc.def \
- $(top_srcdir)/include/version.def
+EXTRA_DIST = \
+ invoke-ntpdc.menu \
+ invoke-ntpdc.texi \
+ layout.std \
+ nl_in.c \
+ nl.pl \
+ ntpdc-opts.def \
+ ntpdc.1ntpdcman \
+ ntpdc.1ntpdcmdoc \
+ ntpdc.man.in \
+ ntpdc.mdoc.in \
+ ntpdc.html \
+ ntpdc.texi \
+ $(NULL)
+
+man1_MANS =
+man8_MANS =
+man_MANS = ntpdc.$(NTPDC_MS)
+html_DATA = \
+ $(srcdir)/ntpdc.html \
+ $(NULL)
+
+noinst_DATA = \
+ $(srcdir)/invoke-ntpdc.menu \
+ $(srcdir)/invoke-ntpdc.texi \
+ $(srcdir)/ntpdc.man.in \
+ $(srcdir)/ntpdc.mdoc.in \
+ $(NULL)
+
+run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D \
+ autogen -L ../sntp/include -L ../sntp/ag-tpl --writable
+
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/ntp.lic \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-opts.c ntpdc-opts.h
+NTP_INCS = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
+ -I$(top_srcdir)/lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/include \
+ -I$(top_srcdir)/lib/isc/unix/include
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/../bincheck.mf $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/bincheck.mf $(top_srcdir)/check-libopts.mf $(top_srcdir)/sntp/check-libntp.mf $(top_srcdir)/depsver.mf $(top_srcdir)/includes.mf $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -287,7 +607,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/../bincheck.mf $(am__con
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ntpdc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign ntpdc/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -296,6 +615,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
+$(top_srcdir)/bincheck.mf $(top_srcdir)/check-libopts.mf $(top_srcdir)/sntp/check-libntp.mf $(top_srcdir)/depsver.mf $(top_srcdir)/includes.mf $(am__empty):
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -309,14 +629,19 @@ nl.pl: $(top_builddir)/config.status $(srcdir)/nl.pl.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
- test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
- while read p p1; do if test -f $$p || test -f $$p1; \
- then echo "$$p"; echo "$$p"; else :; fi; \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
- sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -337,7 +662,8 @@ uninstall-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
- -e 's/$$/$(EXEEXT)/' `; \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
@@ -350,73 +676,164 @@ clean-binPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-ntpdc$(EXEEXT): $(ntpdc_OBJECTS) $(ntpdc_DEPENDENCIES)
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-libexecPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
+
+clean-libexecPROGRAMS:
+ @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ || test -f $$p1 \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-sbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+
+clean-sbinPROGRAMS:
+ @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+ntpdc$(EXEEXT): $(ntpdc_OBJECTS) $(ntpdc_DEPENDENCIES) $(EXTRA_ntpdc_DEPENDENCIES)
@rm -f ntpdc$(EXEEXT)
- $(LINK) $(ntpdc_OBJECTS) $(ntpdc_LDADD) $(LIBS)
-ntpdc-layout$(EXEEXT): $(ntpdc_layout_OBJECTS) $(ntpdc_layout_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(ntpdc_OBJECTS) $(ntpdc_LDADD) $(LIBS)
+
+ntpdc-layout$(EXEEXT): $(ntpdc_layout_OBJECTS) $(ntpdc_layout_DEPENDENCIES) $(EXTRA_ntpdc_layout_DEPENDENCIES)
@rm -f ntpdc-layout$(EXEEXT)
- $(LINK) $(ntpdc_layout_OBJECTS) $(ntpdc_layout_LDADD) $(LIBS)
+ $(AM_V_CCLD)$(LINK) $(ntpdc_layout_OBJECTS) $(ntpdc_layout_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
-../util/ansi2knr:
- $(am__cd) ../util && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
-
-mostlyclean-kr:
- -test "$U" = "" || rm -f *_.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc$U.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc-layout$U.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc-opts$U.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc_ops$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc-layout.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc-opts.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntpdc_ops.Po@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
-@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-ntpdc_.c: ntpdc.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdc.c; then echo $(srcdir)/ntpdc.c; else echo ntpdc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
-ntpdc-layout_.c: ntpdc-layout.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdc-layout.c; then echo $(srcdir)/ntpdc-layout.c; else echo ntpdc-layout.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
-ntpdc-opts_.c: ntpdc-opts.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdc-opts.c; then echo $(srcdir)/ntpdc-opts.c; else echo ntpdc-opts.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
-ntpdc_ops_.c: ntpdc_ops.c $(ANSI2KNR)
- $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ntpdc_ops.c; then echo $(srcdir)/ntpdc_ops.c; else echo ntpdc_ops.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
-ntpdc_.$(OBJEXT) ntpdc_.lo ntpdc-layout_.$(OBJEXT) ntpdc-layout_.lo \
-ntpdc-opts_.$(OBJEXT) ntpdc-opts_.lo ntpdc_ops_.$(OBJEXT) \
-ntpdc_ops_.lo : $(ANSI2KNR)
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
-install-man1: $(man_MANS)
+install-man1: $(man1_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
- test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
- @list=''; test -n "$(man1dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.1[a-z]*$$/p'; \
+ @list1='$(man1_MANS)'; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
@@ -439,36 +856,87 @@ install-man1: $(man_MANS)
uninstall-man1:
@$(NORMAL_UNINSTALL)
- @list=''; test -n "$(man1dir)" || exit 0; \
+ @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.1[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
- test -z "$$files" || { \
- echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+install-man8: $(man8_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1='$(man8_MANS)'; \
+ list2='$(man_MANS)'; \
+ test -n "$(man8dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.8[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man8:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.8[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
+install-htmlDATA: $(html_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(html_DATA)'; test -n "$(htmldir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
+ done
+
+uninstall-htmlDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(html_DATA)'; test -n "$(htmldir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(htmldir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -480,15 +948,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -497,24 +961,26 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @list='$(MANS)'; if test -n "$$list"; then \
- list=`for p in $$list; do \
- if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
- if test -n "$$list" && \
- grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
- echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
- grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
- echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
- echo " typically \`make maintainer-clean' will remove them" >&2; \
- exit 1; \
- else :; fi; \
- else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -547,9 +1013,9 @@ distdir: $(DISTFILES)
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS)
+all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(htmldir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -563,10 +1029,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -583,7 +1054,8 @@ maintainer-clean-generic:
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic clean-libexecPROGRAMS \
+ clean-libtool clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -603,13 +1075,14 @@ info: info-am
info-am:
-install-data-am: install-man
+install-data-am: install-data-local install-htmlDATA install-man
install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-binPROGRAMS
+install-exec-am: install-binPROGRAMS install-libexecPROGRAMS \
+ install-sbinPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
@@ -620,7 +1093,7 @@ install-info: install-info-am
install-info-am:
-install-man: install-man1
+install-man: install-man1 install-man8
install-pdf: install-pdf-am
@@ -639,7 +1112,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
@@ -650,74 +1123,184 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-binPROGRAMS uninstall-man
+uninstall-am: uninstall-binPROGRAMS uninstall-htmlDATA \
+ uninstall-libexecPROGRAMS uninstall-man uninstall-sbinPROGRAMS
-uninstall-man: uninstall-man1
+uninstall-man: uninstall-man1 uninstall-man8
-.MAKE: ../util/ansi2knr all check install install-am install-exec-am \
- install-strip
+.MAKE: all check install install-am install-exec-am install-strip
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
- clean-generic clean-libtool ctags distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-binPROGRAMS install-data install-data-am install-dvi \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+ clean-binPROGRAMS clean-generic clean-libexecPROGRAMS \
+ clean-libtool clean-sbinPROGRAMS cscopelist-am ctags ctags-am \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-data-local install-dvi \
install-dvi-am install-exec install-exec-am install-exec-hook \
- install-html install-html-am install-info install-info-am \
- install-man install-man1 install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-kr mostlyclean-libtool pdf pdf-am ps ps-am tags \
- uninstall uninstall-am uninstall-binPROGRAMS uninstall-man \
- uninstall-man1
+ install-html install-html-am install-htmlDATA install-info \
+ install-info-am install-libexecPROGRAMS install-man \
+ install-man1 install-man8 install-pdf install-pdf-am \
+ install-ps install-ps-am install-sbinPROGRAMS install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-htmlDATA uninstall-libexecPROGRAMS uninstall-man \
+ uninstall-man1 uninstall-man8 uninstall-sbinPROGRAMS
+
+.PRECIOUS: Makefile
+
+install-data-local: install-html
$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.c
+ @: do-nothing action to avoid default SCCS get, .h built with .c
+
$(srcdir)/ntpdc-opts.c: $(srcdir)/ntpdc-opts.def $(std_def_list)
$(run_ag) ntpdc-opts.def
-$(srcdir)/ntpdc.1: $(srcdir)/ntpdc-opts.def $(std_def_list)
- $(run_ag) -Tagman1.tpl -bntpdc ntpdc-opts.def
+###
+
+$(srcdir)/ntpdc.1ntpdcman: $(srcdir)/ntpdc-opts.def $(std_def_list)
+ $(run_ag) -DMAN_SECTION=1ntpdcman -Tagman-cmd.tpl ntpdc-opts.def
+
+$(srcdir)/ntpdc.man.in: $(srcdir)/ntpdc.1ntpdcman $(top_srcdir)/sntp/scripts/mansec2subst.sed
+ sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpdc.1ntpdcman > $(srcdir)/ntpdc.man.in+
+ mv $(srcdir)/ntpdc.man.in+ $(srcdir)/ntpdc.man.in
+
+###
+
+$(srcdir)/ntpdc.1ntpdcmdoc: $(srcdir)/ntpdc-opts.def $(std_def_list)
+ $(run_ag) -DMAN_SECTION=1ntpdcmdoc -Tagmdoc-cmd.tpl ntpdc-opts.def
+
+$(srcdir)/ntpdc.mdoc.in: $(srcdir)/ntpdc.1ntpdcmdoc $(top_srcdir)/sntp/scripts/mansec2subst.sed
+ sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpdc.1ntpdcmdoc > $(srcdir)/ntpdc.mdoc.in+
+ mv $(srcdir)/ntpdc.mdoc.in+ $(srcdir)/ntpdc.mdoc.in
+
+###
+
+ntpdc.$(NTPDC_MS): $(srcdir)/ntpdc.$(MANTAGFMT).in $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=ntpdc.$(NTPDC_MS)+:$(srcdir)/ntpdc.$(MANTAGFMT).in
+ mv ntpdc.$(NTPDC_MS)+ ntpdc.$(NTPDC_MS)
+
+###
+
+$(srcdir)/invoke-ntpdc.menu: $(srcdir)/invoke-ntpdc.texi
+ @: do-nothing action to avoid default SCCS get, .menu built with .texi
-$(srcdir)/ntpdc-opts.texi $(srcdir)/ntpdc-opts.menu: $(srcdir)/ntpdc-opts.def $(std_def_list)
- $(run_ag) -Taginfo.tpl -DLEVEL=section ntpdc-opts.def
+$(srcdir)/invoke-ntpdc.texi: $(srcdir)/ntpdc-opts.def $(std_def_list)
+ $(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section ntpdc-opts.def
+ $(top_srcdir)/scripts/build/check--help $@
+
+$(srcdir)/ntpdc.html: $(srcdir)/invoke-ntpdc.menu $(srcdir)/invoke-ntpdc.texi $(srcdir)/ntpdc.texi $(top_srcdir)/sntp/include/version.texi
+ cd $(srcdir) && ( makeinfo --force --html --no-split -I ../sntp -o ntpdc.html ntpdc.texi || true )
ntpdc-layout.o: nl.c
layout.here: ntpdc-layout
./ntpdc-layout > $@
-check-layout: ntpdc-layout layout.std layout.here
+check-layout: ntpdc-layout $(srcdir)/layout.std layout.here
cmp $(srcdir)/layout.std layout.here && echo stamp > $@
-$(PROGRAMS): $(LDADD)
+$(PROGRAMS): version.o
-../libntp/libntp.a:
- cd ../libntp && $(MAKE)
+$(top_srcdir)/sntp/scm-rev:
+ cd ../sntp && $(MAKE) $(AM_MAKEFLAGS) check-scm-rev
-$(top_srcdir)/version :
- cd $(top_srcdir) && $(MAKE) version
+version.c: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/scm-rev
+ env CSET=`cat $(top_srcdir)/sntp/scm-rev` $(top_builddir)/scripts/build/mkver ntpdc
-version.o: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
- env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdc
- $(COMPILE) -c version.c
+version.o: version.c
+ env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
# I ran nl_in.c (attached, to be installed into ntpdc) through
# $(CC) -E nl_in.c | nl.pl > nl.c
-nl.c: nl_in.c nl.pl Makefile.am
+nl.c: nl_in.c nl.pl Makefile.am ../config.h ../include/ntp_request.h ntpdc.h
$(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c
install-exec-hook:
- @case ${BINSUBDIR} in \
- bin) ODIR=${exec_prefix}/sbin ;; \
- sbin) ODIR=${exec_prefix}/bin ;; \
- esac; \
- test -z "${bin_PROGRAMS}${bin_SCRIPTS}" \
- || for i in ${bin_PROGRAMS} ${bin_SCRIPTS} " "; do \
- test ! -f $$ODIR/$$i || echo "*** $$i is also in $$ODIR!"; \
+ @test -z "${bin_PROGRAMS}${bin_SCRIPTS}" \
+ || for i in ${bin_PROGRAMS} ${bin_SCRIPTS} " "; do \
+ test ! -f ${sbindir}/$$i \
+ || echo "*** $$i is also in ${sbindir}!"; \
done
+ @test -z "${sbin_PROGRAMS}${asbin_SCRIPTS}" \
+ || for i in ${sbin_PROGRAMS} ${sbin_SCRIPTS} " "; do \
+ test ! -f ${bindir}/$$i \
+ || echo "*** $$i is also in ${bindir}!"; \
+ done
+
+#
+
+check-libopts: ../sntp/libopts/libopts.la
+ @echo stamp > $@
+
+../sntp/libopts/libopts.la:
+ -cd ../sntp/libopts && $(MAKE) $(AM_MAKEFLAGS) libopts.la
+
+check-libntp: ../libntp/libntp.a
+ @echo stamp > $@
+../libntp/libntp.a:
+ cd ../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
+$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
+ @[ -f $@ ] || \
+ cp $(top_srcdir)/deps-ver $@
+ @[ -w $@ ] || \
+ chmod ug+w $@
+ @cmp $(top_srcdir)/deps-ver $@ > /dev/null || ( \
+ $(MAKE) $(AM_MAKEFLAGS) clean && \
+ echo -n "Prior $(subdir)/$(DEPDIR) version " && \
+ cat $@ && \
+ rm -rf $(DEPDIR) && \
+ mkdir $(DEPDIR) && \
+ case "$(top_builddir)" in \
+ .) \
+ ./config.status Makefile depfiles \
+ ;; \
+ *) \
+ cd "$(top_builddir)" && \
+ ./config.status $(subdir)/Makefile depfiles && \
+ cd $(subdir) \
+ ;; \
+ esac && \
+ echo -n "Cleaned $(subdir)/$(DEPDIR) version " && \
+ cat $(top_srcdir)/deps-ver \
+ )
+ cp $(top_srcdir)/deps-ver $@
+
+.deps-ver: $(top_srcdir)/deps-ver
+ @[ ! -d $(DEPDIR) ] || $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/deps-ver
+ @touch $@
+
+#
+# depsver.mf included in Makefile.am for directories with .deps
+#
+# When building in the same directory with sources that change over
+# time, such as when tracking using bk, the .deps files can become
+# stale with respect to moved, deleted, or superceded headers. Most
+# commonly, this would exhibit as make reporting a failure to make a
+# header file which is no longer in the location given. To address
+# this issue, we use a deps-ver file which is updated with each change
+# that breaks old .deps files. A copy of deps-ver is made into
+# $(DEPDIR) if not already present. If $(DEPDIR)/deps-ver is present
+# with different contents than deps-ver, we make clean to ensure all
+# .o files built before the incompatible change are rebuilt along with
+# their updated .deps files, then remove $(DEPDIR) and recreate it as
+# empty stubs.
+#
+# It is normal when configured with --disable-dependency-tracking for
+# the DEPDIR to not have been created. For this reason, we use the
+# intermediate target .deps-ver, which invokes make recursively if
+# DEPDIR exists.
+#
+# If you modify depsver.mf, please make the changes to the master
+# copy, the one in sntp is copied by the bootstrap script from it.
+#
+# This comment block follows rather than leads the related code so that
+# it stays with it in the generated Makefile.in and Makefile.
#
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.menu b/contrib/ntp/ntpdc/invoke-ntpdc.menu
index 42ca3b4..42ca3b4 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.menu
+++ b/contrib/ntp/ntpdc/invoke-ntpdc.menu
diff --git a/contrib/ntp/ntpdc/invoke-ntpdc.texi b/contrib/ntp/ntpdc/invoke-ntpdc.texi
new file mode 100644
index 0000000..253b8ae
--- /dev/null
+++ b/contrib/ntp/ntpdc/invoke-ntpdc.texi
@@ -0,0 +1,349 @@
+@node ntpdc Invocation
+@section Invoking ntpdc
+@pindex ntpdc
+@cindex vendor-specific NTPD control program
+@ignore
+#
+# EDIT THIS FILE WITH CAUTION (invoke-ntpdc.texi)
+#
+# It has been AutoGen-ed June 29, 2015 at 04:31:05 PM by AutoGen 5.18.5
+# From the definitions ntpdc-opts.def
+# and the template file agtexi-cmd.tpl
+@end ignore
+
+
+
+@code{ntpdc}
+is deprecated.
+Please use
+@code{ntpq(1ntpqmdoc)} instead - it can do everything
+@code{ntpdc}
+used to do, and it does so using a much more sane interface.
+
+@code{ntpdc}
+is a utility program used to query
+@code{ntpd(1ntpdmdoc)}
+about its
+current state and to request changes in that state.
+It uses NTP mode 7 control message formats described in the source code.
+The program may
+be run either in interactive mode or controlled using command line
+arguments.
+Extensive state and statistics information is available
+through the
+@code{ntpdc}
+interface.
+In addition, nearly all the
+configuration options which can be specified at startup using
+ntpd's configuration file may also be specified at run time using
+@code{ntpdc}
+
+This section was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the @code{ntpdc} program.
+This software is released under the NTP license, <http://ntp.org/license>.
+
+@menu
+* ntpdc usage:: ntpdc help/usage (@option{--help})
+* ntpdc ipv4:: ipv4 option (-4)
+* ntpdc ipv6:: ipv6 option (-6)
+* ntpdc command:: command option (-c)
+* ntpdc interactive:: interactive option (-i)
+* ntpdc listpeers:: listpeers option (-l)
+* ntpdc numeric:: numeric option (-n)
+* ntpdc peers:: peers option (-p)
+* ntpdc showpeers:: showpeers option (-s)
+* ntpdc config:: presetting/configuring ntpdc
+* ntpdc exit status:: exit status
+* ntpdc Usage:: Usage
+* ntpdc See Also:: See Also
+* ntpdc Authors:: Authors
+* ntpdc Bugs:: Bugs
+@end menu
+
+@node ntpdc usage
+@subsection ntpdc help/usage (@option{--help})
+@cindex ntpdc help
+
+This is the automatically generated usage text for ntpdc.
+
+The text printed is the same whether selected with the @code{help} option
+(@option{--help}) or the @code{more-help} option (@option{--more-help}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p3
+Usage: ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
+ Flg Arg Option-Name Description
+ -4 no ipv4 Force IPv4 DNS name resolution
+ - prohibits the option 'ipv6'
+ -6 no ipv6 Force IPv6 DNS name resolution
+ - prohibits the option 'ipv4'
+ -c Str command run a command and exit
+ - may appear multiple times
+ -d no debug-level Increase debug verbosity level
+ - may appear multiple times
+ -D Num set-debug-level Set the debug verbosity level
+ - may appear multiple times
+ -i no interactive Force ntpq to operate in interactive mode
+ - prohibits these options:
+ command
+ listpeers
+ peers
+ showpeers
+ -l no listpeers Print a list of the peers
+ - prohibits the option 'command'
+ -n no numeric numeric host addresses
+ -p no peers Print a list of the peers
+ - prohibits the option 'command'
+ -s no showpeers Show a list of the peers
+ - prohibits the option 'command'
+ opt version output version information and exit
+ -? no help display extended usage information and exit
+ -! no more-help extended usage information passed thru pager
+ -> opt save-opts save the option state to a config file
+ -< Str load-opts load options from a config file
+ - disabled as '--no-load-opts'
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+
+The following option preset mechanisms are supported:
+ - reading file $HOME/.ntprc
+ - reading file ./.ntprc
+ - examining environment variables named NTPDC_*
+
+Please send bug reports to: <http://bugs.ntp.org, bugs@@ntp.org>
+@end example
+@exampleindent 4
+
+@node ntpdc ipv4
+@subsection ipv4 option (-4)
+@cindex ntpdc-ipv4
+
+This is the ``force ipv4 dns name resolution'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+ipv6.
+@end itemize
+
+Force DNS resolution of following host names on the command line
+to the IPv4 namespace.
+@node ntpdc ipv6
+@subsection ipv6 option (-6)
+@cindex ntpdc-ipv6
+
+This is the ``force ipv6 dns name resolution'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+ipv4.
+@end itemize
+
+Force DNS resolution of following host names on the command line
+to the IPv6 namespace.
+@node ntpdc command
+@subsection command option (-c)
+@cindex ntpdc-command
+
+This is the ``run a command and exit'' option.
+This option takes a string argument @file{cmd}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+The following argument is interpreted as an interactive format command
+and is added to the list of commands to be executed on the specified
+host(s).
+@node ntpdc interactive
+@subsection interactive option (-i)
+@cindex ntpdc-interactive
+
+This is the ``force ntpq to operate in interactive mode'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+command, listpeers, peers, showpeers.
+@end itemize
+
+Force ntpq to operate in interactive mode. Prompts will be written
+to the standard output and commands read from the standard input.
+@node ntpdc listpeers
+@subsection listpeers option (-l)
+@cindex ntpdc-listpeers
+
+This is the ``print a list of the peers'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+command.
+@end itemize
+
+Print a list of the peers known to the server as well as a summary of
+their state. This is equivalent to the 'listpeers' interactive command.
+@node ntpdc numeric
+@subsection numeric option (-n)
+@cindex ntpdc-numeric
+
+This is the ``numeric host addresses'' option.
+Output all host addresses in dotted-quad numeric format rather than
+converting to the canonical host names.
+@node ntpdc peers
+@subsection peers option (-p)
+@cindex ntpdc-peers
+
+This is the ``print a list of the peers'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+command.
+@end itemize
+
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'peers' interactive command.
+@node ntpdc showpeers
+@subsection showpeers option (-s)
+@cindex ntpdc-showpeers
+
+This is the ``show a list of the peers'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+command.
+@end itemize
+
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'dmpeers' interactive command.
+
+
+@node ntpdc config
+@subsection presetting/configuring ntpdc
+
+Any option that is not marked as @i{not presettable} may be preset by
+loading values from configuration ("rc" or "ini") files, and values from environment variables named @code{NTPDC} and @code{NTPDC_<OPTION_NAME>}. @code{<OPTION_NAME>} must be one of
+the options listed above in upper case and segmented with underscores.
+The @code{NTPDC} variable will be tokenized and parsed like
+the command line. The remaining variables are tested for existence and their
+values are treated like option arguments.
+
+
+@noindent
+@code{libopts} will search in 2 places for configuration files:
+@itemize @bullet
+@item
+$HOME
+@item
+$PWD
+@end itemize
+The environment variables @code{HOME}, and @code{PWD}
+are expanded and replaced when @file{ntpdc} runs.
+For any of these that are plain files, they are simply processed.
+For any that are directories, then a file named @file{.ntprc} is searched for
+within that directory and processed.
+
+Configuration files may be in a wide variety of formats.
+The basic format is an option name followed by a value (argument) on the
+same line. Values may be separated from the option name with a colon,
+equal sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+@example
+[NTPDC]
+@end example
+@noindent
+or by
+@example
+<?program ntpdc>
+@end example
+@noindent
+Do not mix these styles within one configuration file.
+
+Compound values and carefully constructed string values may also be
+specified using XML syntax:
+@example
+<option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+</option-name>
+@end example
+@noindent
+yielding an @code{option-name.sub-opt} string value of
+@example
+"...<...>..."
+@end example
+@code{AutoOpts} does not track suboptions. You simply note that it is a
+hierarchicly valued option. @code{AutoOpts} does provide a means for searching
+the associated name/value pair list (see: optionFindValue).
+
+The command line options relating to configuration and/or usage help are:
+
+@subsubheading version (-)
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much licensing
+detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
+Only the first letter of the argument is examined:
+
+@table @samp
+@item version
+Only print the version. This is the default.
+@item copyright
+Name the copyright usage licensing terms.
+@item verbose
+Print the full copyright usage licensing terms.
+@end table
+
+@node ntpdc exit status
+@subsection ntpdc exit status
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_SUCCESS)
+Successful program execution.
+@item 1 (EXIT_FAILURE)
+The operation failed or the command syntax was not valid.
+@item 66 (EX_NOINPUT)
+A specified configuration file could not be loaded.
+@item 70 (EX_SOFTWARE)
+libopts had an internal operational error. Please report
+it to autogen-users@@lists.sourceforge.net. Thank you.
+@end table
+@node ntpdc Usage
+@subsection ntpdc Usage
+@node ntpdc See Also
+@subsection ntpdc See Also
+@node ntpdc Authors
+@subsection ntpdc Authors
+@node ntpdc Bugs
+@subsection ntpdc Bugs
diff --git a/contrib/ntp/ntpdc/layout.std b/contrib/ntp/ntpdc/layout.std
index daff636..6117f52 100644
--- a/contrib/ntp/ntpdc/layout.std
+++ b/contrib/ntp/ntpdc/layout.std
@@ -1,20 +1,28 @@
-sizeof(struct req_pkt) = 212
+sizeof(union req_data_u_tag) = 176
+offsetof(u32) = 0
+offsetof(data) = 0
+
+sizeof(struct req_pkt) = 216
offsetof(rm_vn_mode) = 0
offsetof(auth_seq) = 1
offsetof(implementation) = 2
offsetof(request) = 3
offsetof(err_nitems) = 4
offsetof(mbz_itemsize) = 6
-offsetof(data) = 8
+offsetof(u) = 8
offsetof(tstamp) = 184
offsetof(keyid) = 192
offsetof(mac) = 196
-sizeof(struct req_pkt_tail) = 28
+sizeof(struct req_pkt_tail) = 32
offsetof(tstamp) = 0
offsetof(keyid) = 8
offsetof(mac) = 12
+sizeof(union resp_pkt_u_tag) = 500
+offsetof(data) = 0
+offsetof(u32) = 0
+
sizeof(struct resp_pkt) = 508
offsetof(rm_vn_mode) = 0
offsetof(auth_seq) = 1
@@ -22,7 +30,7 @@ offsetof(implementation) = 2
offsetof(request) = 3
offsetof(err_nitems) = 4
offsetof(mbz_itemsize) = 6
-offsetof(data) = 8
+offsetof(u) = 8
sizeof(struct info_peer_list) = 32
offsetof(addr) = 0
@@ -269,9 +277,9 @@ offsetof(addr6) = 16
offsetof(mask6) = 32
sizeof(struct info_monitor_1) = 72
-offsetof(lasttime) = 0
-offsetof(firsttime) = 4
-offsetof(lastdrop) = 8
+offsetof(avg_int) = 0
+offsetof(last_int) = 4
+offsetof(restr) = 8
offsetof(count) = 12
offsetof(addr) = 16
offsetof(daddr) = 20
@@ -285,9 +293,9 @@ offsetof(addr6) = 40
offsetof(daddr6) = 56
sizeof(struct info_monitor) = 48
-offsetof(lasttime) = 0
-offsetof(firsttime) = 4
-offsetof(lastdrop) = 8
+offsetof(avg_int) = 0
+offsetof(last_int) = 4
+offsetof(restr) = 8
offsetof(count) = 12
offsetof(addr) = 16
offsetof(port) = 20
diff --git a/contrib/ntp/ntpdc/nl.pl b/contrib/ntp/ntpdc/nl.pl
index afea8b7..73da2a8 100755
--- a/contrib/ntp/ntpdc/nl.pl
+++ b/contrib/ntp/ntpdc/nl.pl
@@ -7,7 +7,7 @@ $debug = 0;
while (<>) {
next if /^#/;
next if /^\s*$/;
- if (/^struct req_pkt/) {
+ if (/^typedef union req_data_u_tag/) {
$found = 1;
}
if (/^struct info_dns_assoc/) {
@@ -20,13 +20,19 @@ while (<>) {
printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
next;
}
+ if (/^typedef (union\s*\w*)\s*{\s*$/) {
+ $type = $1;
+ print STDERR "union = '$type'\n" if $debug;
+ printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
+ next;
+ }
if (/\s*\w+\s+(\w*)\s*(\[.*\])?\s*;\s*$/) {
$field = $1;
print STDERR "\tfield = '$field'\n" if $debug;
printf " printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n";
next;
}
- if (/^}\s*;\s*$/) {
+ if (/^}\s*\w*\s*;\s*$/) {
printf " printf(\"\\n\");\n\n";
$found = 0 if $last;
next;
diff --git a/contrib/ntp/ntpdc/nl.pl.in b/contrib/ntp/ntpdc/nl.pl.in
index 813dc1f..8007538 100644
--- a/contrib/ntp/ntpdc/nl.pl.in
+++ b/contrib/ntp/ntpdc/nl.pl.in
@@ -7,7 +7,7 @@ $debug = 0;
while (<>) {
next if /^#/;
next if /^\s*$/;
- if (/^struct req_pkt/) {
+ if (/^typedef union req_data_u_tag/) {
$found = 1;
}
if (/^struct info_dns_assoc/) {
@@ -20,13 +20,19 @@ while (<>) {
printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
next;
}
+ if (/^typedef (union\s*\w*)\s*{\s*$/) {
+ $type = $1;
+ print STDERR "union = '$type'\n" if $debug;
+ printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
+ next;
+ }
if (/\s*\w+\s+(\w*)\s*(\[.*\])?\s*;\s*$/) {
$field = $1;
print STDERR "\tfield = '$field'\n" if $debug;
printf " printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n";
next;
}
- if (/^}\s*;\s*$/) {
+ if (/^}\s*\w*\s*;\s*$/) {
printf " printf(\"\\n\");\n\n";
$found = 0 if $last;
next;
diff --git a/contrib/ntp/ntpdc/ntpdc-layout.c b/contrib/ntp/ntpdc/ntpdc-layout.c
index b05fbf3..0171488 100644
--- a/contrib/ntp/ntpdc/ntpdc-layout.c
+++ b/contrib/ntp/ntpdc/ntpdc-layout.c
@@ -2,6 +2,7 @@
* ntpdc-layout - print layout of NTP mode 7 request/response packets
*/
+#include <config.h>
#include <stdio.h>
#include <stddef.h>
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.c b/contrib/ntp/ntpdc/ntpdc-opts.c
index 41be37e..3e68aa2 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.c
+++ b/contrib/ntp/ntpdc/ntpdc-opts.c
@@ -1,45 +1,56 @@
-/*
+/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
- *
- * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:00 AM EST
+ *
+ * It has been AutoGen-ed June 29, 2015 at 04:30:51 PM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
- * Generated from AutoOpts 29:0:4 templates.
- */
-
-/*
- * This file was produced by an AutoOpts template. AutoOpts is a
- * copyrighted work. This source file is not encumbered by AutoOpts
- * licensing, but is provided under the licensing terms chosen by the
- * ntpdc author or copyright holder. AutoOpts is licensed under
- * the terms of the LGPL. The redistributable library (``libopts'') is
- * licensed under the terms of either the LGPL or, at the users discretion,
- * the BSD license. See the AutoOpts and/or libopts sources for details.
+ * Generated from AutoOpts 41:0:16 templates.
+ *
+ * AutoOpts is a copyrighted work. This source file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the ntpdc author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
*
- * This source file is copyrighted and licensed under the following terms:
+ * The ntpdc program is copyrighted and licensed
+ * under the following terms:
*
- * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the NTP License, copies of which
+ * can be seen at:
+ * <http://ntp.org/license>
+ * <http://opensource.org/licenses/ntp-license.php>
*
- * see html/copyright.html
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and that
+ * both the copyright notice and this permission notice appear in
+ * supporting documentation, and that the name The University of Delaware not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
+ * representations about the suitability this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
*/
-
-#include <limits.h>
-
+#ifndef __doxygen__
#define OPTION_CODE_COMPILE 1
#include "ntpdc-opts.h"
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
-tSCC zCopyright[] =
- "ntpdc copyright (c) 1970-2009 David L. Mills and/or others, all rights reserved";
-tSCC zCopyrightNotice[] =
-
-/* extracted from ../include/copyright.def near line 8 */
-"see html/copyright.html";
-extern tUsageProc optionUsage;
+extern FILE * option_usage_fp;
+#define zCopyright (ntpdc_opt_strs+0)
+#define zLicenseDescrip (ntpdc_opt_strs+341)
/*
* global included definitions
@@ -53,238 +64,298 @@ extern tUsageProc optionUsage;
#ifndef NULL
# define NULL 0
#endif
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-/*
- * Ipv4 option description:
- */
-tSCC zIpv4Text[] =
- "Force IPv4 DNS name resolution";
-tSCC zIpv4_NAME[] = "IPV4";
-tSCC zIpv4_Name[] = "ipv4";
-#define IPV4_FLAGS (OPTST_DISABLED)
-/*
- * Ipv6 option description:
+/**
+ * static const strings for ntpdc options
*/
-tSCC zIpv6Text[] =
- "Force IPv6 DNS name resolution";
-tSCC zIpv6_NAME[] = "IPV6";
-tSCC zIpv6_Name[] = "ipv6";
-#define IPV6_FLAGS (OPTST_DISABLED)
-
-/*
- * Command option description:
- */
-tSCC zCommandText[] =
- "run a command and exit";
-tSCC zCommand_NAME[] = "COMMAND";
-tSCC zCommand_Name[] = "command";
-#define COMMAND_FLAGS (OPTST_DISABLED | OPTST_STACKED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-/*
- * Listpeers option description with
+static char const ntpdc_opt_strs[1911] =
+/* 0 */ "ntpdc 4.2.8p3\n"
+ "Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
+ "This is free software. It is licensed for use, modification and\n"
+ "redistribution under the terms of the NTP License, copies of which\n"
+ "can be seen at:\n"
+ " <http://ntp.org/license>\n"
+ " <http://opensource.org/licenses/ntp-license.php>\n\0"
+/* 341 */ "Permission to use, copy, modify, and distribute this software and its\n"
+ "documentation for any purpose with or without fee is hereby granted,\n"
+ "provided that the above copyright notice appears in all copies and that\n"
+ "both the copyright notice and this permission notice appear in supporting\n"
+ "documentation, and that the name The University of Delaware not be used in\n"
+ "advertising or publicity pertaining to distribution of the software without\n"
+ "specific, written prior permission. The University of Delaware and Network\n"
+ "Time Foundation makes no representations about the suitability this\n"
+ "software for any purpose. It is provided \"as is\" without express or\n"
+ "implied warranty.\n\0"
+/* 1009 */ "Force IPv4 DNS name resolution\0"
+/* 1040 */ "IPV4\0"
+/* 1045 */ "ipv4\0"
+/* 1050 */ "Force IPv6 DNS name resolution\0"
+/* 1081 */ "IPV6\0"
+/* 1086 */ "ipv6\0"
+/* 1091 */ "run a command and exit\0"
+/* 1114 */ "COMMAND\0"
+/* 1122 */ "command\0"
+/* 1130 */ "Increase debug verbosity level\0"
+/* 1161 */ "DEBUG_LEVEL\0"
+/* 1173 */ "debug-level\0"
+/* 1185 */ "Set the debug verbosity level\0"
+/* 1215 */ "SET_DEBUG_LEVEL\0"
+/* 1231 */ "set-debug-level\0"
+/* 1247 */ "Force ntpq to operate in interactive mode\0"
+/* 1289 */ "INTERACTIVE\0"
+/* 1301 */ "interactive\0"
+/* 1313 */ "Print a list of the peers\0"
+/* 1339 */ "LISTPEERS\0"
+/* 1349 */ "listpeers\0"
+/* 1359 */ "numeric host addresses\0"
+/* 1382 */ "NUMERIC\0"
+/* 1390 */ "numeric\0"
+/* 1398 */ "PEERS\0"
+/* 1404 */ "peers\0"
+/* 1410 */ "Show a list of the peers\0"
+/* 1435 */ "SHOWPEERS\0"
+/* 1445 */ "showpeers\0"
+/* 1455 */ "display extended usage information and exit\0"
+/* 1499 */ "help\0"
+/* 1504 */ "extended usage information passed thru pager\0"
+/* 1549 */ "more-help\0"
+/* 1559 */ "output version information and exit\0"
+/* 1595 */ "version\0"
+/* 1603 */ "save the option state to a config file\0"
+/* 1642 */ "save-opts\0"
+/* 1652 */ "load options from a config file\0"
+/* 1684 */ "LOAD_OPTS\0"
+/* 1694 */ "no-load-opts\0"
+/* 1707 */ "no\0"
+/* 1710 */ "NTPDC\0"
+/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p3\n"
+ "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
+/* 1846 */ "$HOME\0"
+/* 1852 */ ".\0"
+/* 1854 */ ".ntprc\0"
+/* 1861 */ "http://bugs.ntp.org, bugs@ntp.org\0"
+/* 1895 */ "\n\0"
+/* 1897 */ "ntpdc 4.2.8p3";
+
+/**
+ * ipv4 option description with
* "Must also have options" and "Incompatible options":
*/
-tSCC zListpeersText[] =
- "Print a list of the peers";
-tSCC zListpeers_NAME[] = "LISTPEERS";
-tSCC zListpeers_Name[] = "listpeers";
-static const int
- aListpeersCantList[] = {
- INDEX_OPT_COMMAND, NO_EQUIVALENT };
-#define LISTPEERS_FLAGS (OPTST_DISABLED)
-
-/*
- * Peers option description with
+/** Descriptive text for the ipv4 option */
+#define IPV4_DESC (ntpdc_opt_strs+1009)
+/** Upper-cased name for the ipv4 option */
+#define IPV4_NAME (ntpdc_opt_strs+1040)
+/** Name string for the ipv4 option */
+#define IPV4_name (ntpdc_opt_strs+1045)
+/** Other options that appear in conjunction with the ipv4 option */
+static int const aIpv4CantList[] = {
+ INDEX_OPT_IPV6, NO_EQUIVALENT };
+/** Compiled in flag settings for the ipv4 option */
+#define IPV4_FLAGS (OPTST_DISABLED)
+
+/**
+ * ipv6 option description with
* "Must also have options" and "Incompatible options":
*/
-tSCC zPeersText[] =
- "Print a list of the peers";
-tSCC zPeers_NAME[] = "PEERS";
-tSCC zPeers_Name[] = "peers";
-static const int
- aPeersCantList[] = {
- INDEX_OPT_COMMAND, NO_EQUIVALENT };
-#define PEERS_FLAGS (OPTST_DISABLED)
-
-/*
- * Showpeers option description with
- * "Must also have options" and "Incompatible options":
+/** Descriptive text for the ipv6 option */
+#define IPV6_DESC (ntpdc_opt_strs+1050)
+/** Upper-cased name for the ipv6 option */
+#define IPV6_NAME (ntpdc_opt_strs+1081)
+/** Name string for the ipv6 option */
+#define IPV6_name (ntpdc_opt_strs+1086)
+/** Other options that appear in conjunction with the ipv6 option */
+static int const aIpv6CantList[] = {
+ INDEX_OPT_IPV4, NO_EQUIVALENT };
+/** Compiled in flag settings for the ipv6 option */
+#define IPV6_FLAGS (OPTST_DISABLED)
+
+/**
+ * command option description:
*/
-tSCC zShowpeersText[] =
- "Show a list of the peers";
-tSCC zShowpeers_NAME[] = "SHOWPEERS";
-tSCC zShowpeers_Name[] = "showpeers";
-static const int
- aShowpeersCantList[] = {
- INDEX_OPT_COMMAND, NO_EQUIVALENT };
-#define SHOWPEERS_FLAGS (OPTST_DISABLED)
+/** Descriptive text for the command option */
+#define COMMAND_DESC (ntpdc_opt_strs+1091)
+/** Upper-cased name for the command option */
+#define COMMAND_NAME (ntpdc_opt_strs+1114)
+/** Name string for the command option */
+#define COMMAND_name (ntpdc_opt_strs+1122)
+/** Compiled in flag settings for the command option */
+#define COMMAND_FLAGS (OPTST_DISABLED | OPTST_STACKED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-/*
- * Interactive option description with
+/**
+ * debug-level option description:
+ */
+/** Descriptive text for the debug-level option */
+#define DEBUG_LEVEL_DESC (ntpdc_opt_strs+1130)
+/** Upper-cased name for the debug-level option */
+#define DEBUG_LEVEL_NAME (ntpdc_opt_strs+1161)
+/** Name string for the debug-level option */
+#define DEBUG_LEVEL_name (ntpdc_opt_strs+1173)
+/** Compiled in flag settings for the debug-level option */
+#define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
+
+/**
+ * set-debug-level option description:
+ */
+/** Descriptive text for the set-debug-level option */
+#define SET_DEBUG_LEVEL_DESC (ntpdc_opt_strs+1185)
+/** Upper-cased name for the set-debug-level option */
+#define SET_DEBUG_LEVEL_NAME (ntpdc_opt_strs+1215)
+/** Name string for the set-debug-level option */
+#define SET_DEBUG_LEVEL_name (ntpdc_opt_strs+1231)
+/** Compiled in flag settings for the set-debug-level option */
+#define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/**
+ * interactive option description with
* "Must also have options" and "Incompatible options":
*/
-tSCC zInteractiveText[] =
- "Force ntpq to operate in interactive mode";
-tSCC zInteractive_NAME[] = "INTERACTIVE";
-tSCC zInteractive_Name[] = "interactive";
-static const int
- aInteractiveCantList[] = {
+/** Descriptive text for the interactive option */
+#define INTERACTIVE_DESC (ntpdc_opt_strs+1247)
+/** Upper-cased name for the interactive option */
+#define INTERACTIVE_NAME (ntpdc_opt_strs+1289)
+/** Name string for the interactive option */
+#define INTERACTIVE_name (ntpdc_opt_strs+1301)
+/** Other options that appear in conjunction with the interactive option */
+static int const aInteractiveCantList[] = {
INDEX_OPT_COMMAND,
INDEX_OPT_LISTPEERS,
INDEX_OPT_PEERS,
INDEX_OPT_SHOWPEERS, NO_EQUIVALENT };
-#define INTERACTIVE_FLAGS (OPTST_DISABLED)
+/** Compiled in flag settings for the interactive option */
+#define INTERACTIVE_FLAGS (OPTST_DISABLED)
-/*
- * Debug_Level option description:
+/**
+ * listpeers option description with
+ * "Must also have options" and "Incompatible options":
*/
-#ifdef DEBUG
-tSCC zDebug_LevelText[] =
- "Increase output debug message level";
-tSCC zDebug_Level_NAME[] = "DEBUG_LEVEL";
-tSCC zDebug_Level_Name[] = "debug-level";
-#define DEBUG_LEVEL_FLAGS (OPTST_DISABLED)
-
-#else /* disable Debug_Level */
-#define VALUE_OPT_DEBUG_LEVEL NO_EQUIVALENT
-#define DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
-#define zDebug_LevelText NULL
-#define zDebug_Level_NAME NULL
-#define zDebug_Level_Name NULL
-#endif /* DEBUG */
+/** Descriptive text for the listpeers option */
+#define LISTPEERS_DESC (ntpdc_opt_strs+1313)
+/** Upper-cased name for the listpeers option */
+#define LISTPEERS_NAME (ntpdc_opt_strs+1339)
+/** Name string for the listpeers option */
+#define LISTPEERS_name (ntpdc_opt_strs+1349)
+/** Other options that appear in conjunction with the listpeers option */
+static int const aListpeersCantList[] = {
+ INDEX_OPT_COMMAND, NO_EQUIVALENT };
+/** Compiled in flag settings for the listpeers option */
+#define LISTPEERS_FLAGS (OPTST_DISABLED)
-/*
- * Set_Debug_Level option description:
+/**
+ * numeric option description:
*/
-#ifdef DEBUG
-tSCC zSet_Debug_LevelText[] =
- "Set the output debug message level";
-tSCC zSet_Debug_Level_NAME[] = "SET_DEBUG_LEVEL";
-tSCC zSet_Debug_Level_Name[] = "set-debug-level";
-#define SET_DEBUG_LEVEL_FLAGS (OPTST_DISABLED \
- | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
-
-#else /* disable Set_Debug_Level */
-#define VALUE_OPT_SET_DEBUG_LEVEL NO_EQUIVALENT
-#define SET_DEBUG_LEVEL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
-#define zSet_Debug_LevelText NULL
-#define zSet_Debug_Level_NAME NULL
-#define zSet_Debug_Level_Name NULL
-#endif /* DEBUG */
-
-/*
- * Numeric option description:
+/** Descriptive text for the numeric option */
+#define NUMERIC_DESC (ntpdc_opt_strs+1359)
+/** Upper-cased name for the numeric option */
+#define NUMERIC_NAME (ntpdc_opt_strs+1382)
+/** Name string for the numeric option */
+#define NUMERIC_name (ntpdc_opt_strs+1390)
+/** Compiled in flag settings for the numeric option */
+#define NUMERIC_FLAGS (OPTST_DISABLED)
+
+/**
+ * peers option description with
+ * "Must also have options" and "Incompatible options":
*/
-tSCC zNumericText[] =
- "numeric host addresses";
-tSCC zNumeric_NAME[] = "NUMERIC";
-tSCC zNumeric_Name[] = "numeric";
-#define NUMERIC_FLAGS (OPTST_DISABLED)
+/** Descriptive text for the peers option */
+#define PEERS_DESC (ntpdc_opt_strs+1313)
+/** Upper-cased name for the peers option */
+#define PEERS_NAME (ntpdc_opt_strs+1398)
+/** Name string for the peers option */
+#define PEERS_name (ntpdc_opt_strs+1404)
+/** Other options that appear in conjunction with the peers option */
+static int const aPeersCantList[] = {
+ INDEX_OPT_COMMAND, NO_EQUIVALENT };
+/** Compiled in flag settings for the peers option */
+#define PEERS_FLAGS (OPTST_DISABLED)
-/*
- * Help/More_Help/Version option descriptions:
+/**
+ * showpeers option description with
+ * "Must also have options" and "Incompatible options":
*/
-tSCC zHelpText[] = "Display usage information and exit";
-tSCC zHelp_Name[] = "help";
-
-tSCC zMore_HelpText[] = "Extended usage information passed thru pager";
-tSCC zMore_Help_Name[] = "more-help";
-
-tSCC zVersionText[] = "Output version information and exit";
-tSCC zVersion_Name[] = "version";
+/** Descriptive text for the showpeers option */
+#define SHOWPEERS_DESC (ntpdc_opt_strs+1410)
+/** Upper-cased name for the showpeers option */
+#define SHOWPEERS_NAME (ntpdc_opt_strs+1435)
+/** Name string for the showpeers option */
+#define SHOWPEERS_name (ntpdc_opt_strs+1445)
+/** Other options that appear in conjunction with the showpeers option */
+static int const aShowpeersCantList[] = {
+ INDEX_OPT_COMMAND, NO_EQUIVALENT };
+/** Compiled in flag settings for the showpeers option */
+#define SHOWPEERS_FLAGS (OPTST_DISABLED)
/*
- * Save/Load_Opts option description:
+ * Help/More_Help/Version option descriptions:
*/
-tSCC zSave_OptsText[] = "Save the option state to a config file";
-tSCC zSave_Opts_Name[] = "save-opts";
-
-tSCC zLoad_OptsText[] = "Load options from a config file";
-tSCC zLoad_Opts_NAME[] = "LOAD_OPTS";
-
-tSCC zNotLoad_Opts_Name[] = "no-load-opts";
-tSCC zNotLoad_Opts_Pfx[] = "no";
-#define zLoad_Opts_Name (zNotLoad_Opts_Name + 3)
-/*
+#define HELP_DESC (ntpdc_opt_strs+1455)
+#define HELP_name (ntpdc_opt_strs+1499)
+#ifdef HAVE_WORKING_FORK
+#define MORE_HELP_DESC (ntpdc_opt_strs+1504)
+#define MORE_HELP_name (ntpdc_opt_strs+1549)
+#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+#define MORE_HELP_DESC HELP_DESC
+#define MORE_HELP_name HELP_name
+#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#endif
+#ifdef NO_OPTIONAL_OPT_ARGS
+# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
+ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
+#endif
+#define VER_DESC (ntpdc_opt_strs+1559)
+#define VER_name (ntpdc_opt_strs+1595)
+#define SAVE_OPTS_DESC (ntpdc_opt_strs+1603)
+#define SAVE_OPTS_name (ntpdc_opt_strs+1642)
+#define LOAD_OPTS_DESC (ntpdc_opt_strs+1652)
+#define LOAD_OPTS_NAME (ntpdc_opt_strs+1684)
+#define NO_LOAD_OPTS_name (ntpdc_opt_strs+1694)
+#define LOAD_OPTS_pfx (ntpdc_opt_strs+1707)
+#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
+/**
* Declare option callback procedures
*/
-#ifdef DEBUG
- static tOptProc doOptSet_Debug_Level;
-#else /* not DEBUG */
-# define doOptSet_Debug_Level NULL
-#endif /* def/not DEBUG */
-#if defined(TEST_NTPDC_OPTS)
-/*
- * Under test, omit argument processing, or call optionStackArg,
- * if multiple copies are allowed.
- */
-extern tOptProc
- optionPagedUsage, optionStackArg, optionVersionStderr;
-static tOptProc
- doUsageOpt;
-
-/*
- * #define map the "normal" callout procs to the test ones...
- */
-#define SET_DEBUG_LEVEL_OPT_PROC optionStackArg
-
-
-#else /* NOT defined TEST_NTPDC_OPTS */
-/*
- * When not under test, there are different procs to use
- */
extern tOptProc
- optionPagedUsage, optionPrintVersion, optionStackArg;
+ ntpOptionPrintVersion, optionBooleanVal, optionNestedVal,
+ optionNumericVal, optionPagedUsage, optionResetOpt,
+ optionStackArg, optionTimeDate, optionTimeVal,
+ optionUnstackArg, optionVendorOption;
static tOptProc
- doUsageOpt;
-
-/*
- * #define map the "normal" callout procs
+ doOptDebug_Level, doUsageOpt;
+#define VER_PROC ntpOptionPrintVersion
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Define the ntpdc Option Descriptions.
+ * This is an array of OPTION_CT entries, one for each
+ * option that the ntpdc program responds to.
*/
-#define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
-
-#define SET_DEBUG_LEVEL_OPT_PROC doOptSet_Debug_Level
-#endif /* defined(TEST_NTPDC_OPTS) */
-#ifdef TEST_NTPDC_OPTS
-# define DOVERPROC optionVersionStderr
-#else
-# define DOVERPROC optionPrintVersion
-#endif /* TEST_NTPDC_OPTS */
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * Define the Ntpdc Option Descriptions.
- */
-static tOptDesc optDesc[ OPTION_CT ] = {
+static tOptDesc optDesc[OPTION_CT] = {
{ /* entry idx, value */ 0, VALUE_OPT_IPV4,
- /* equiv idx, value */ NO_EQUIVALENT, 0,
+ /* equiv idx, value */ 0, VALUE_OPT_IPV4,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
/* opt state flags */ IPV4_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* last opt argumnt */ { NULL }, /* --ipv4 */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
+ /* must/cannot opts */ NULL, aIpv4CantList,
/* option proc */ NULL,
- /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name,
+ /* desc, NAME, name */ IPV4_DESC, IPV4_NAME, IPV4_name,
/* disablement strs */ NULL, NULL },
{ /* entry idx, value */ 1, VALUE_OPT_IPV6,
- /* equiv idx, value */ NOLIMIT, NOLIMIT,
- /* equivalenced to */ INDEX_OPT_IPV4,
+ /* equiv idx, value */ 1, VALUE_OPT_IPV6,
+ /* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
/* opt state flags */ IPV6_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* last opt argumnt */ { NULL }, /* --ipv6 */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
+ /* must/cannot opts */ NULL, aIpv6CantList,
/* option proc */ NULL,
- /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name,
+ /* desc, NAME, name */ IPV6_DESC, IPV6_NAME, IPV6_name,
/* disablement strs */ NULL, NULL },
{ /* entry idx, value */ 2, VALUE_OPT_COMMAND,
@@ -292,205 +363,184 @@ static tOptDesc optDesc[ OPTION_CT ] = {
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, NOLIMIT, 0,
/* opt state flags */ COMMAND_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* last opt argumnt */ { NULL }, /* --command */
/* arg list/cookie */ NULL,
/* must/cannot opts */ NULL, NULL,
/* option proc */ optionStackArg,
- /* desc, NAME, name */ zCommandText, zCommand_NAME, zCommand_Name,
+ /* desc, NAME, name */ COMMAND_DESC, COMMAND_NAME, COMMAND_name,
/* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 3, VALUE_OPT_LISTPEERS,
- /* equiv idx, value */ 3, VALUE_OPT_LISTPEERS,
+ { /* entry idx, value */ 3, VALUE_OPT_DEBUG_LEVEL,
+ /* equiv idx, value */ 3, VALUE_OPT_DEBUG_LEVEL,
/* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ LISTPEERS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ DEBUG_LEVEL_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --debug-level */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aListpeersCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zListpeersText, zListpeers_NAME, zListpeers_Name,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptDebug_Level,
+ /* desc, NAME, name */ DEBUG_LEVEL_DESC, DEBUG_LEVEL_NAME, DEBUG_LEVEL_name,
/* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 4, VALUE_OPT_PEERS,
- /* equiv idx, value */ 4, VALUE_OPT_PEERS,
+ { /* entry idx, value */ 4, VALUE_OPT_SET_DEBUG_LEVEL,
+ /* equiv idx, value */ 4, VALUE_OPT_SET_DEBUG_LEVEL,
/* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ PEERS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --set-debug-level */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aPeersCantList,
- /* option proc */ NULL,
- /* desc, NAME, name */ zPeersText, zPeers_NAME, zPeers_Name,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionNumericVal,
+ /* desc, NAME, name */ SET_DEBUG_LEVEL_DESC, SET_DEBUG_LEVEL_NAME, SET_DEBUG_LEVEL_name,
/* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 5, VALUE_OPT_SHOWPEERS,
- /* equiv idx, value */ 5, VALUE_OPT_SHOWPEERS,
+ { /* entry idx, value */ 5, VALUE_OPT_INTERACTIVE,
+ /* equiv idx, value */ 5, VALUE_OPT_INTERACTIVE,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ SHOWPEERS_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* opt state flags */ INTERACTIVE_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --interactive */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aShowpeersCantList,
+ /* must/cannot opts */ NULL, aInteractiveCantList,
/* option proc */ NULL,
- /* desc, NAME, name */ zShowpeersText, zShowpeers_NAME, zShowpeers_Name,
+ /* desc, NAME, name */ INTERACTIVE_DESC, INTERACTIVE_NAME, INTERACTIVE_name,
/* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 6, VALUE_OPT_INTERACTIVE,
- /* equiv idx, value */ 6, VALUE_OPT_INTERACTIVE,
+ { /* entry idx, value */ 6, VALUE_OPT_LISTPEERS,
+ /* equiv idx, value */ 6, VALUE_OPT_LISTPEERS,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ INTERACTIVE_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* opt state flags */ LISTPEERS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --listpeers */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, aInteractiveCantList,
+ /* must/cannot opts */ NULL, aListpeersCantList,
/* option proc */ NULL,
- /* desc, NAME, name */ zInteractiveText, zInteractive_NAME, zInteractive_Name,
+ /* desc, NAME, name */ LISTPEERS_DESC, LISTPEERS_NAME, LISTPEERS_name,
/* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 7, VALUE_OPT_DEBUG_LEVEL,
- /* equiv idx, value */ 7, VALUE_OPT_DEBUG_LEVEL,
+ { /* entry idx, value */ 7, VALUE_OPT_NUMERIC,
+ /* equiv idx, value */ 7, VALUE_OPT_NUMERIC,
/* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, NOLIMIT, 0,
- /* opt state flags */ DEBUG_LEVEL_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ NUMERIC_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --numeric */
/* arg list/cookie */ NULL,
/* must/cannot opts */ NULL, NULL,
/* option proc */ NULL,
- /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name,
+ /* desc, NAME, name */ NUMERIC_DESC, NUMERIC_NAME, NUMERIC_name,
/* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL,
- /* equiv idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL,
+ { /* entry idx, value */ 8, VALUE_OPT_PEERS,
+ /* equiv idx, value */ 8, VALUE_OPT_PEERS,
/* equivalenced to */ NO_EQUIVALENT,
- /* min, max, act ct */ 0, NOLIMIT, 0,
- /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PEERS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --peers */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
- /* option proc */ SET_DEBUG_LEVEL_OPT_PROC,
- /* desc, NAME, name */ zSet_Debug_LevelText, zSet_Debug_Level_NAME, zSet_Debug_Level_Name,
+ /* must/cannot opts */ NULL, aPeersCantList,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ PEERS_DESC, PEERS_NAME, PEERS_name,
/* disablement strs */ NULL, NULL },
- { /* entry idx, value */ 9, VALUE_OPT_NUMERIC,
- /* equiv idx, value */ 9, VALUE_OPT_NUMERIC,
+ { /* entry idx, value */ 9, VALUE_OPT_SHOWPEERS,
+ /* equiv idx, value */ 9, VALUE_OPT_SHOWPEERS,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ NUMERIC_FLAGS, 0,
- /* last opt argumnt */ { NULL },
+ /* opt state flags */ SHOWPEERS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --showpeers */
/* arg list/cookie */ NULL,
- /* must/cannot opts */ NULL, NULL,
+ /* must/cannot opts */ NULL, aShowpeersCantList,
/* option proc */ NULL,
- /* desc, NAME, name */ zNumericText, zNumeric_NAME, zNumeric_Name,
+ /* desc, NAME, name */ SHOWPEERS_DESC, SHOWPEERS_NAME, SHOWPEERS_name,
/* disablement strs */ NULL, NULL },
-#ifdef NO_OPTIONAL_OPT_ARGS
-# define VERSION_OPT_FLAGS OPTST_IMM | OPTST_NO_INIT
-#else
-# define VERSION_OPT_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
- OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
-#endif
-
{ /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
- /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ VERSION_OPT_FLAGS, 0,
+ /* opt state flags */ VER_FLAGS, AOUSE_VERSION,
/* last opt argumnt */ { NULL },
/* arg list/cookie */ NULL,
/* must/cannot opts */ NULL, NULL,
- /* option proc */ DOVERPROC,
- /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
+ /* option proc */ VER_PROC,
+ /* desc, NAME, name */ VER_DESC, NULL, VER_name,
/* disablement strs */ NULL, NULL },
-#undef VERSION_OPT_FLAGS
{ /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
- /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP,
/* last opt argumnt */ { NULL },
/* arg list/cookie */ NULL,
/* must/cannot opts */ NULL, NULL,
/* option proc */ doUsageOpt,
- /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
+ /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
/* disablement strs */ NULL, NULL },
{ /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
- /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
- /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP,
/* last opt argumnt */ { NULL },
/* arg list/cookie */ NULL,
/* must/cannot opts */ NULL, NULL,
/* option proc */ optionPagedUsage,
- /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
+ /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
/* disablement strs */ NULL, NULL },
{ /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
- /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, 1, 0,
/* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
- | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
+ | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS,
/* last opt argumnt */ { NULL },
/* arg list/cookie */ NULL,
/* must/cannot opts */ NULL, NULL,
/* option proc */ NULL,
- /* desc, NAME, name */ zSave_OptsText, NULL, zSave_Opts_Name,
+ /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
/* disablement strs */ NULL, NULL },
{ /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
- /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS,
/* equivalenced to */ NO_EQUIVALENT,
/* min, max, act ct */ 0, NOLIMIT, 0,
- /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \
- | OPTST_DISABLE_IMM, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS,
/* last opt argumnt */ { NULL },
/* arg list/cookie */ NULL,
/* must/cannot opts */ NULL, NULL,
/* option proc */ optionLoadOpt,
- /* desc, NAME, name */ zLoad_OptsText, zLoad_Opts_NAME, zLoad_Opts_Name,
- /* disablement strs */ zNotLoad_Opts_Name, zNotLoad_Opts_Pfx }
+ /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name,
+ /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx }
};
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- *
- * Define the Ntpdc Option Environment
- */
-tSCC zPROGNAME[] = "NTPDC";
-tSCC zUsageTitle[] =
-"ntpdc - vendor-specific NTP query program - Ver. 4.2.4p8\n\
-USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n";
-tSCC zRcName[] = ".ntprc";
-tSCC* apzHomeList[] = {
- "$HOME",
- ".",
- NULL };
-
-tSCC zBugsAddr[] = "http://bugs.ntp.org, bugs@ntp.org";
-#define zExplain NULL
-tSCC zDetail[] = "\n\
-The\n\
-[= prog-name =]\n\
-utility program is used to query an NTP daemon about its\n\
-current state and to request changes in that state.\n\
-It uses NTP mode 7 control message formats described in the source code.\n\
-The program may\n\
-be run either in interactive mode or controlled using command line\n\
-arguments.\n\
-Extensive state and statistics information is available\n\
-through the\n\
-[= prog-name =]\n\
-interface.\n\
-In addition, nearly all the\n\
-configuration options which can be specified at startup using\n\
-ntpd's configuration file may also be specified at run time using\n\
-[= prog-name =] .\n";
-tSCC zFullVersion[] = NTPDC_FULL_VERSION;
-/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 408 */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/** Reference to the upper cased version of ntpdc. */
+#define zPROGNAME (ntpdc_opt_strs+1710)
+/** Reference to the title line for ntpdc usage. */
+#define zUsageTitle (ntpdc_opt_strs+1716)
+/** ntpdc configuration file name. */
+#define zRcName (ntpdc_opt_strs+1854)
+/** Directories to search for ntpdc config files. */
+static char const * const apzHomeList[3] = {
+ ntpdc_opt_strs+1846,
+ ntpdc_opt_strs+1852,
+ NULL };
+/** The ntpdc program bug email address. */
+#define zBugsAddr (ntpdc_opt_strs+1861)
+/** Clarification/explanation of what ntpdc does. */
+#define zExplain (ntpdc_opt_strs+1895)
+/** Extra detail explaining what ntpdc does. */
+#define zDetail (NULL)
+/** The full version string for ntpdc. */
+#define zFullVersion (ntpdc_opt_strs+1897)
+/* extracted from optcode.tlib near line 364 */
#if defined(ENABLE_NLS)
# define OPTPROC_BASE OPTPROC_TRANSLATE
@@ -500,6 +550,90 @@ tSCC zFullVersion[] = NTPDC_FULL_VERSION;
# define translate_option_strings NULL
#endif /* ENABLE_NLS */
+#define ntpdc_full_usage (NULL)
+#define ntpdc_short_usage (NULL)
+
+#endif /* not defined __doxygen__ */
+
+/*
+ * Create the static procedure(s) declared above.
+ */
+/**
+ * The callout function that invokes the optionUsage function.
+ *
+ * @param[in] opts the AutoOpts option description structure
+ * @param[in] od the descriptor for the "help" (usage) option.
+ * @noreturn
+ */
+static void
+doUsageOpt(tOptions * opts, tOptDesc * od)
+{
+ int ex_code;
+ ex_code = NTPDC_EXIT_SUCCESS;
+ optionUsage(&ntpdcOptions, ex_code);
+ /* NOTREACHED */
+ exit(1);
+ (void)opts;
+ (void)od;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the debug-level option.
+ *
+ * @param[in] pOptions the ntpdc options data structure
+ * @param[in,out] pOptDesc the option descriptor for this option.
+ */
+static void
+doOptDebug_Level(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /*
+ * Be sure the flag-code[0] handles special values for the options pointer
+ * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit
+ * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to
+ * reset its state.
+ */
+ /* extracted from debug-opt.def, line 15 */
+OPT_VALUE_SET_DEBUG_LEVEL++;
+ (void)pOptDesc;
+ (void)pOptions;
+}
+/* extracted from optmain.tlib near line 1250 */
+
+/**
+ * The directory containing the data associated with ntpdc.
+ */
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+/**
+ * Information about the person or institution that packaged ntpdc
+ * for the current distribution.
+ */
+#ifndef WITH_PACKAGER
+# define ntpdc_packager_info NULL
+#else
+/** Packager information for ntpdc. */
+static char const ntpdc_packager_info[] =
+ "Packaged by " WITH_PACKAGER
+
+# ifdef WITH_PACKAGER_VERSION
+ " ("WITH_PACKAGER_VERSION")"
+# endif
+
+# ifdef WITH_PACKAGER_BUG_REPORTS
+ "\nReport ntpdc bugs to " WITH_PACKAGER_BUG_REPORTS
+# endif
+ "\n";
+#endif
+#ifndef __doxygen__
+
+#endif /* __doxygen__ */
+/**
+ * The option definitions for ntpdc. The one structure that
+ * binds them all.
+ */
tOptions ntpdcOptions = {
OPTIONS_STRUCT_VERSION,
0, NULL, /* original argc + argv */
@@ -509,158 +643,532 @@ tOptions ntpdcOptions = {
+ OPTPROC_LONGOPT
+ OPTPROC_NO_REQ_OPT
+ OPTPROC_ENVIRON
- + OPTPROC_HAS_IMMED ),
+ + OPTPROC_MISUSE ),
0, NULL, /* current option index, current option */
NULL, NULL, zPROGNAME,
- zRcName, zCopyright, zCopyrightNotice,
+ zRcName, zCopyright, zLicenseDescrip,
zFullVersion, apzHomeList, zUsageTitle,
zExplain, zDetail, optDesc,
zBugsAddr, /* address to send bugs to */
NULL, NULL, /* extensions/saved state */
- optionUsage, /* usage procedure */
+ optionUsage, /* usage procedure */
translate_option_strings, /* translation procedure */
/*
* Indexes to special options
*/
- { INDEX_OPT_MORE_HELP,
- INDEX_OPT_SAVE_OPTS,
- NO_EQUIVALENT /* index of '-#' option */,
+ { INDEX_OPT_MORE_HELP, /* more-help option index */
+ INDEX_OPT_SAVE_OPTS, /* save option index */
+ NO_EQUIVALENT, /* '-#' option index */
NO_EQUIVALENT /* index of default opt */
},
- 15 /* full option count */, 10 /* user option count */
+ 15 /* full option count */, 10 /* user option count */,
+ ntpdc_full_usage, ntpdc_short_usage,
+ NULL, NULL,
+ PKGDATADIR, ntpdc_packager_info
};
-/*
- * Create the static procedure(s) declared above.
- */
-static void
-doUsageOpt(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
-{
- USAGE( EXIT_SUCCESS );
-}
-
-#if ! defined(TEST_NTPDC_OPTS)
-
-/* * * * * * *
- *
- * For the set-debug-level option, when DEBUG is #define-d.
- */
-#ifdef DEBUG
-static void
-doOptSet_Debug_Level(
- tOptions* pOptions,
- tOptDesc* pOptDesc )
-{
- /* extracted from ../include/debug-opt.def, line 29 */
-DESC(DEBUG_LEVEL).optOccCt = atoi( pOptDesc->pzLastArg );
-}
-#endif /* defined DEBUG */
-
-#endif /* defined(TEST_NTPDC_OPTS) */
-
-/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optmain.tpl near line 92 */
-
-#if defined(TEST_NTPDC_OPTS) /* TEST MAIN PROCEDURE: */
-
-int
-main( int argc, char** argv )
-{
- int res = EXIT_SUCCESS;
- (void)optionProcess( &ntpdcOptions, argc, argv );
- {
- void optionPutShell( tOptions* );
- optionPutShell( &ntpdcOptions );
- }
- return res;
-}
-#endif /* defined TEST_NTPDC_OPTS */
-/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/optcode.tpl near line 514 */
-
#if ENABLE_NLS
+/**
+ * This code is designed to translate translatable option text for the
+ * ntpdc program. These translations happen upon entry
+ * to optionProcess().
+ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#ifdef HAVE_DCGETTEXT
+# include <gettext.h>
+#endif
#include <autoopts/usage-txt.h>
-static char* AO_gettext( char const* pz );
-static void coerce_it(void** s);
+static char * AO_gettext(char const * pz);
+static void coerce_it(void ** s);
-static char*
-AO_gettext( char const* pz )
+/**
+ * AutoGen specific wrapper function for gettext. It relies on the macro _()
+ * to convert from English to the target language, then strdup-duplicates the
+ * result string. It tries the "libopts" domain first, then whatever has been
+ * set via the \a textdomain(3) call.
+ *
+ * @param[in] pz the input text used as a lookup key.
+ * @returns the translated text (if there is one),
+ * or the original text (if not).
+ */
+static char *
+AO_gettext(char const * pz)
{
- char* pzRes;
+ char * res;
if (pz == NULL)
return NULL;
- pzRes = _(pz);
- if (pzRes == pz)
- return pzRes;
- pzRes = strdup( pzRes );
- if (pzRes == NULL) {
- fputs( _("No memory for duping translated strings\n"), stderr );
- exit( EXIT_FAILURE );
+#ifdef HAVE_DCGETTEXT
+ /*
+ * While processing the option_xlateable_txt data, try to use the
+ * "libopts" domain. Once we switch to the option descriptor data,
+ * do *not* use that domain.
+ */
+ if (option_xlateable_txt.field_ct != 0) {
+ res = dgettext("libopts", pz);
+ if (res == pz)
+ res = (char *)VOIDP(_(pz));
+ } else
+ res = (char *)VOIDP(_(pz));
+#else
+ res = (char *)VOIDP(_(pz));
+#endif
+ if (res == pz)
+ return res;
+ res = strdup(res);
+ if (res == NULL) {
+ fputs(_("No memory for duping translated strings\n"), stderr);
+ exit(NTPDC_EXIT_FAILURE);
}
- return pzRes;
+ return res;
}
-static void coerce_it(void** s) { *s = AO_gettext(*s); }
-#define COERSION(_f) \
- coerce_it((void*)&(ntpdcOptions._f))
+/**
+ * All the pointers we use are marked "* const", but they are stored in
+ * writable memory. Coerce the mutability and set the pointer.
+ */
+static void coerce_it(void ** s) { *s = AO_gettext(*s);
+}
-/*
- * This invokes the translation code (e.g. gettext(3)).
+/**
+ * Translate all the translatable strings in the ntpdcOptions
+ * structure defined above. This is done only once.
*/
static void
-translate_option_strings( void )
+translate_option_strings(void)
{
+ tOptions * const opts = &ntpdcOptions;
+
/*
* Guard against re-translation. It won't work. The strings will have
* been changed by the first pass through this code. One shot only.
*/
- if (option_usage_text.field_ct == 0)
- return;
- /*
- * Do the translations. The first pointer follows the field count field.
- * The field count field is the size of a pointer.
- */
- {
- char** ppz = (char**)(void*)&(option_usage_text);
- int ix = option_usage_text.field_ct;
+ if (option_xlateable_txt.field_ct != 0) {
+ /*
+ * Do the translations. The first pointer follows the field count
+ * field. The field count field is the size of a pointer.
+ */
+ char ** ppz = (char**)VOIDP(&(option_xlateable_txt));
+ int ix = option_xlateable_txt.field_ct;
do {
- ppz++;
+ ppz++; /* skip over field_ct */
*ppz = AO_gettext(*ppz);
} while (--ix > 0);
- }
- option_usage_text.field_ct = 0;
-
- {
- tOptDesc* pOD = ntpdcOptions.pOptDesc;
- int ix = ntpdcOptions.optCt;
-
- for (;;) {
- pOD->pzText = AO_gettext(pOD->pzText);
- pOD->pz_NAME = AO_gettext(pOD->pz_NAME);
- pOD->pz_Name = AO_gettext(pOD->pz_Name);
- pOD->pz_DisableName = AO_gettext(pOD->pz_DisableName);
- pOD->pz_DisablePfx = AO_gettext(pOD->pz_DisablePfx);
- if (--ix <= 0)
- break;
- pOD++;
+ /* prevent re-translation and disable "libopts" domain lookup */
+ option_xlateable_txt.field_ct = 0;
+
+ coerce_it(VOIDP(&(opts->pzCopyright)));
+ coerce_it(VOIDP(&(opts->pzCopyNotice)));
+ coerce_it(VOIDP(&(opts->pzFullVersion)));
+ coerce_it(VOIDP(&(opts->pzUsageTitle)));
+ coerce_it(VOIDP(&(opts->pzExplain)));
+ coerce_it(VOIDP(&(opts->pzDetail)));
+ {
+ tOptDesc * od = opts->pOptDesc;
+ for (ix = opts->optCt; ix > 0; ix--, od++)
+ coerce_it(VOIDP(&(od->pzText)));
}
}
- COERSION(pzCopyright);
- COERSION(pzCopyNotice);
- COERSION(pzFullVersion);
- COERSION(pzUsageTitle);
- COERSION(pzExplain);
- COERSION(pzDetail);
}
-
#endif /* ENABLE_NLS */
+#ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT
+/** I18N function strictly for xgettext. Do not compile. */
+static void bogus_function(void) {
+ /* TRANSLATORS:
+
+ The following dummy function was crated solely so that xgettext can
+ extract the correct strings. These strings are actually referenced
+ by a field name in the ntpdcOptions structure noted in the
+ comments below. The literal text is defined in ntpdc_opt_strs.
+
+ NOTE: the strings below are segmented with respect to the source string
+ ntpdc_opt_strs. The strings above are handed off for translation
+ at run time a paragraph at a time. Consequently, they are presented here
+ for translation a paragraph at a time.
+
+ ALSO: often the description for an option will reference another option
+ by name. These are set off with apostrophe quotes (I hope). Do not
+ translate option names.
+ */
+ /* referenced via ntpdcOptions.pzCopyright */
+ puts(_("ntpdc 4.2.8p3\n\
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
+This is free software. It is licensed for use, modification and\n\
+redistribution under the terms of the NTP License, copies of which\n\
+can be seen at:\n"));
+ puts(_(" <http://ntp.org/license>\n\
+ <http://opensource.org/licenses/ntp-license.php>\n"));
+
+ /* referenced via ntpdcOptions.pzCopyNotice */
+ puts(_("Permission to use, copy, modify, and distribute this software and its\n\
+documentation for any purpose with or without fee is hereby granted,\n\
+provided that the above copyright notice appears in all copies and that\n\
+both the copyright notice and this permission notice appear in supporting\n\
+documentation, and that the name The University of Delaware not be used in\n\
+advertising or publicity pertaining to distribution of the software without\n\
+specific, written prior permission. The University of Delaware and Network\n\
+Time Foundation makes no representations about the suitability this\n\
+software for any purpose. It is provided \"as is\" without express or\n\
+implied warranty.\n"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Force IPv4 DNS name resolution"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Force IPv6 DNS name resolution"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("run a command and exit"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Increase debug verbosity level"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Set the debug verbosity level"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Force ntpq to operate in interactive mode"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Print a list of the peers"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("numeric host addresses"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Print a list of the peers"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("Show a list of the peers"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("display extended usage information and exit"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("extended usage information passed thru pager"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("output version information and exit"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("save the option state to a config file"));
+
+ /* referenced via ntpdcOptions.pOptDesc->pzText */
+ puts(_("load options from a config file"));
+
+ /* referenced via ntpdcOptions.pzUsageTitle */
+ puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p3\n\
+Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
+
+ /* referenced via ntpdcOptions.pzExplain */
+ puts(_("\n"));
+
+ /* referenced via ntpdcOptions.pzFullVersion */
+ puts(_("ntpdc 4.2.8p3"));
+
+ /* referenced via ntpdcOptions.pzFullUsage */
+ puts(_("<<<NOT-FOUND>>>"));
+
+ /* referenced via ntpdcOptions.pzShortUsage */
+ puts(_("<<<NOT-FOUND>>>"));
+ /* LIBOPTS-MESSAGES: */
+#line 67 "../autoopts.c"
+ puts(_("allocation of %d bytes failed\n"));
+#line 93 "../autoopts.c"
+ puts(_("allocation of %d bytes failed\n"));
+#line 53 "../init.c"
+ puts(_("AutoOpts function called without option descriptor\n"));
+#line 86 "../init.c"
+ puts(_("\tThis exceeds the compiled library version: "));
+#line 84 "../init.c"
+ puts(_("Automated Options Processing Error!\n"
+ "\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
+#line 80 "../autoopts.c"
+ puts(_("realloc of %d bytes at 0x%p failed\n"));
+#line 88 "../init.c"
+ puts(_("\tThis is less than the minimum library version: "));
+#line 121 "../version.c"
+ puts(_("Automated Options version %s\n"
+ "\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n"));
+#line 87 "../makeshell.c"
+ puts(_("(AutoOpts bug): %s.\n"));
+#line 90 "../reset.c"
+ puts(_("optionResetOpt() called, but reset-option not configured"));
+#line 292 "../usage.c"
+ puts(_("could not locate the 'help' option"));
+#line 336 "../autoopts.c"
+ puts(_("optionProcess() was called with invalid data"));
+#line 748 "../usage.c"
+ puts(_("invalid argument type specified"));
+#line 598 "../find.c"
+ puts(_("defaulted to option with optional arg"));
+#line 76 "../alias.c"
+ puts(_("aliasing option is out of range."));
+#line 234 "../enum.c"
+ puts(_("%s error: the keyword '%s' is ambiguous for %s\n"));
+#line 108 "../find.c"
+ puts(_(" The following options match:\n"));
+#line 293 "../find.c"
+ puts(_("%s: ambiguous option name: %s (matches %d options)\n"));
+#line 161 "../check.c"
+ puts(_("%s: Command line arguments required\n"));
+#line 43 "../alias.c"
+ puts(_("%d %s%s options allowed\n"));
+#line 94 "../makeshell.c"
+ puts(_("%s error %d (%s) calling %s for '%s'\n"));
+#line 306 "../makeshell.c"
+ puts(_("interprocess pipe"));
+#line 168 "../version.c"
+ puts(_("error: version option argument '%c' invalid. Use:\n"
+ "\t'v' - version only\n"
+ "\t'c' - version and copyright\n"
+ "\t'n' - version and full copyright notice\n"));
+#line 58 "../check.c"
+ puts(_("%s error: the '%s' and '%s' options conflict\n"));
+#line 217 "../find.c"
+ puts(_("%s: The '%s' option has been disabled."));
+#line 430 "../find.c"
+ puts(_("%s: The '%s' option has been disabled."));
+#line 38 "../alias.c"
+ puts(_("-equivalence"));
+#line 469 "../find.c"
+ puts(_("%s: illegal option -- %c\n"));
+#line 110 "../reset.c"
+ puts(_("%s: illegal option -- %c\n"));
+#line 271 "../find.c"
+ puts(_("%s: illegal option -- %s\n"));
+#line 755 "../find.c"
+ puts(_("%s: illegal option -- %s\n"));
+#line 118 "../reset.c"
+ puts(_("%s: illegal option -- %s\n"));
+#line 335 "../find.c"
+ puts(_("%s: unknown vendor extension option -- %s\n"));
+#line 159 "../enum.c"
+ puts(_(" or an integer from %d through %d\n"));
+#line 169 "../enum.c"
+ puts(_(" or an integer from %d through %d\n"));
+#line 747 "../usage.c"
+ puts(_("%s error: invalid option descriptor for %s\n"));
+#line 1081 "../usage.c"
+ puts(_("%s error: invalid option descriptor for %s\n"));
+#line 385 "../find.c"
+ puts(_("%s: invalid option name: %s\n"));
+#line 527 "../find.c"
+ puts(_("%s: The '%s' option requires an argument.\n"));
+#line 156 "../autoopts.c"
+ puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n"
+ "\t'%s' and '%s'."));
+#line 94 "../check.c"
+ puts(_("%s error: The %s option is required\n"));
+#line 632 "../find.c"
+ puts(_("%s: The '%s' option cannot have an argument.\n"));
+#line 151 "../check.c"
+ puts(_("%s: Command line arguments are not allowed.\n"));
+#line 535 "../save.c"
+ puts(_("error %d (%s) creating %s\n"));
+#line 234 "../enum.c"
+ puts(_("%s error: '%s' does not match any %s keywords.\n"));
+#line 93 "../reset.c"
+ puts(_("%s error: The '%s' option requires an argument.\n"));
+#line 184 "../save.c"
+ puts(_("error %d (%s) stat-ing %s\n"));
+#line 238 "../save.c"
+ puts(_("error %d (%s) stat-ing %s\n"));
+#line 143 "../restore.c"
+ puts(_("%s error: no saved option state\n"));
+#line 231 "../autoopts.c"
+ puts(_("'%s' is not a command line option.\n"));
+#line 111 "../time.c"
+ puts(_("%s error: '%s' is not a recognizable date/time.\n"));
+#line 132 "../save.c"
+ puts(_("'%s' not defined\n"));
+#line 50 "../time.c"
+ puts(_("%s error: '%s' is not a recognizable time duration.\n"));
+#line 92 "../check.c"
+ puts(_("%s error: The %s option must appear %d times.\n"));
+#line 164 "../numeric.c"
+ puts(_("%s error: '%s' is not a recognizable number.\n"));
+#line 200 "../enum.c"
+ puts(_("%s error: %s exceeds %s keyword count\n"));
+#line 330 "../usage.c"
+ puts(_("Try '%s %s' for more information.\n"));
+#line 45 "../alias.c"
+ puts(_("one %s%s option allowed\n"));
+#line 208 "../makeshell.c"
+ puts(_("standard output"));
+#line 943 "../makeshell.c"
+ puts(_("standard output"));
+#line 274 "../usage.c"
+ puts(_("standard output"));
+#line 415 "../usage.c"
+ puts(_("standard output"));
+#line 625 "../usage.c"
+ puts(_("standard output"));
+#line 175 "../version.c"
+ puts(_("standard output"));
+#line 274 "../usage.c"
+ puts(_("standard error"));
+#line 415 "../usage.c"
+ puts(_("standard error"));
+#line 625 "../usage.c"
+ puts(_("standard error"));
+#line 175 "../version.c"
+ puts(_("standard error"));
+#line 208 "../makeshell.c"
+ puts(_("write"));
+#line 943 "../makeshell.c"
+ puts(_("write"));
+#line 273 "../usage.c"
+ puts(_("write"));
+#line 414 "../usage.c"
+ puts(_("write"));
+#line 624 "../usage.c"
+ puts(_("write"));
+#line 174 "../version.c"
+ puts(_("write"));
+#line 60 "../numeric.c"
+ puts(_("%s error: %s option value %ld is out of range.\n"));
+#line 44 "../check.c"
+ puts(_("%s error: %s option requires the %s option\n"));
+#line 131 "../save.c"
+ puts(_("%s warning: cannot save options - %s not regular file\n"));
+#line 183 "../save.c"
+ puts(_("%s warning: cannot save options - %s not regular file\n"));
+#line 237 "../save.c"
+ puts(_("%s warning: cannot save options - %s not regular file\n"));
+#line 256 "../save.c"
+ puts(_("%s warning: cannot save options - %s not regular file\n"));
+#line 534 "../save.c"
+ puts(_("%s warning: cannot save options - %s not regular file\n"));
+ /* END-LIBOPTS-MESSAGES */
+
+ /* USAGE-TEXT: */
+#line 873 "../usage.c"
+ puts(_("\t\t\t\t- an alternate for '%s'\n"));
+#line 1148 "../usage.c"
+ puts(_("Version, usage and configuration options:"));
+#line 924 "../usage.c"
+ puts(_("\t\t\t\t- default option for unnamed options\n"));
+#line 837 "../usage.c"
+ puts(_("\t\t\t\t- disabled as '--%s'\n"));
+#line 1117 "../usage.c"
+ puts(_(" --- %-14s %s\n"));
+#line 1115 "../usage.c"
+ puts(_("This option has been disabled"));
+#line 864 "../usage.c"
+ puts(_("\t\t\t\t- enabled by default\n"));
+#line 40 "../alias.c"
+ puts(_("%s error: only "));
+#line 1194 "../usage.c"
+ puts(_(" - examining environment variables named %s_*\n"));
+#line 168 "../file.c"
+ puts(_("\t\t\t\t- file must not pre-exist\n"));
+#line 172 "../file.c"
+ puts(_("\t\t\t\t- file must pre-exist\n"));
+#line 380 "../usage.c"
+ puts(_("Options are specified by doubled hyphens and their name or by a single\n"
+ "hyphen and the flag character.\n"));
+#line 921 "../makeshell.c"
+ puts(_("\n"
+ "= = = = = = = =\n\n"
+ "This incarnation of genshell will produce\n"
+ "a shell script to parse the options for %s:\n\n"));
+#line 166 "../enum.c"
+ puts(_(" or an integer mask with any of the lower %d bits set\n"));
+#line 897 "../usage.c"
+ puts(_("\t\t\t\t- is a set membership option\n"));
+#line 918 "../usage.c"
+ puts(_("\t\t\t\t- must appear between %d and %d times\n"));
+#line 382 "../usage.c"
+ puts(_("Options are specified by single or double hyphens and their name.\n"));
+#line 904 "../usage.c"
+ puts(_("\t\t\t\t- may appear multiple times\n"));
+#line 891 "../usage.c"
+ puts(_("\t\t\t\t- may not be preset\n"));
+#line 1309 "../usage.c"
+ puts(_(" Arg Option-Name Description\n"));
+#line 1245 "../usage.c"
+ puts(_(" Flg Arg Option-Name Description\n"));
+#line 1303 "../usage.c"
+ puts(_(" Flg Arg Option-Name Description\n"));
+#line 1304 "../usage.c"
+ puts(_(" %3s %s"));
+#line 1310 "../usage.c"
+ puts(_(" %3s %s"));
+#line 387 "../usage.c"
+ puts(_("The '-#<number>' option may omit the hash char\n"));
+#line 383 "../usage.c"
+ puts(_("All arguments are named options.\n"));
+#line 971 "../usage.c"
+ puts(_(" - reading file %s"));
+#line 409 "../usage.c"
+ puts(_("\n"
+ "Please send bug reports to: <%s>\n"));
+#line 100 "../version.c"
+ puts(_("\n"
+ "Please send bug reports to: <%s>\n"));
+#line 129 "../version.c"
+ puts(_("\n"
+ "Please send bug reports to: <%s>\n"));
+#line 903 "../usage.c"
+ puts(_("\t\t\t\t- may NOT appear - preset only\n"));
+#line 944 "../usage.c"
+ puts(_("\n"
+ "The following option preset mechanisms are supported:\n"));
+#line 1192 "../usage.c"
+ puts(_("\n"
+ "The following option preset mechanisms are supported:\n"));
+#line 682 "../usage.c"
+ puts(_("prohibits these options:\n"));
+#line 677 "../usage.c"
+ puts(_("prohibits the option '%s'\n"));
+#line 81 "../numeric.c"
+ puts(_("%s%ld to %ld"));
+#line 79 "../numeric.c"
+ puts(_("%sgreater than or equal to %ld"));
+#line 75 "../numeric.c"
+ puts(_("%s%ld exactly"));
+#line 68 "../numeric.c"
+ puts(_("%sit must lie in one of the ranges:\n"));
+#line 68 "../numeric.c"
+ puts(_("%sit must be in the range:\n"));
+#line 88 "../numeric.c"
+ puts(_(", or\n"));
+#line 66 "../numeric.c"
+ puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"));
+#line 77 "../numeric.c"
+ puts(_("%sless than or equal to %ld"));
+#line 390 "../usage.c"
+ puts(_("Operands and options may be intermixed. They will be reordered.\n"));
+#line 652 "../usage.c"
+ puts(_("requires the option '%s'\n"));
+#line 655 "../usage.c"
+ puts(_("requires these options:\n"));
+#line 1321 "../usage.c"
+ puts(_(" Arg Option-Name Req? Description\n"));
+#line 1315 "../usage.c"
+ puts(_(" Flg Arg Option-Name Req? Description\n"));
+#line 167 "../enum.c"
+ puts(_("or you may use a numeric representation. Preceding these with a '!'\n"
+ "will clear the bits, specifying 'none' will clear all bits, and 'all'\n"
+ "will set them all. Multiple entries may be passed as an option\n"
+ "argument list.\n"));
+#line 910 "../usage.c"
+ puts(_("\t\t\t\t- may appear up to %d times\n"));
+#line 77 "../enum.c"
+ puts(_("The valid \"%s\" option keywords are:\n"));
+#line 1152 "../usage.c"
+ puts(_("The next option supports vendor supported extra options:"));
+#line 773 "../usage.c"
+ puts(_("These additional options are:"));
+ /* END-USAGE-TEXT */
+}
+#endif /* uncompilable code */
#ifdef __cplusplus
}
#endif
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.def b/contrib/ntp/ntpdc/ntpdc-opts.def
index 0b5aefe..df3350e 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.def
+++ b/contrib/ntp/ntpdc/ntpdc-opts.def
@@ -2,20 +2,19 @@
autogen definitions options;
+#include autogen-version.def
+#include copyright.def
+
prog-name = "ntpdc";
-prog-title = "vendor-specific NTP query program";
+prog-title = "vendor-specific NTPD control program";
argument = '[ host ...]';
-#include copyright.def
#include homerc.def
-#include autogen-version.def
-
-test-main;
flag = {
name = ipv4;
value = 4;
- equivalence = ipv4;
+ flags-cant = ipv6;
descrip = "Force IPv4 DNS name resolution";
doc = <<- _EndOfDoc_
Force DNS resolution of following host names on the command line
@@ -26,7 +25,7 @@ flag = {
flag = {
name = ipv6;
value = 6;
- equivalence = ipv4;
+ flags-cant = ipv4;
descrip = "Force IPv6 DNS name resolution";
doc = <<- _EndOfDoc_
Force DNS resolution of following host names on the command line
@@ -49,6 +48,19 @@ flag = {
_EndOfDoc_;
};
+#include debug-opt.def
+
+flag = {
+ name = interactive;
+ value = i;
+ flags-cant = command, listpeers, peers, showpeers;
+ descrip = "Force ntpq to operate in interactive mode";
+ doc = <<- _EndOfDoc_
+ Force ntpq to operate in interactive mode. Prompts will be written
+ to the standard output and commands read from the standard input.
+ _EndOfDoc_;
+};
+
flag = {
name = listpeers;
value = l;
@@ -61,6 +73,16 @@ flag = {
};
flag = {
+ name = numeric;
+ value = n;
+ descrip = "numeric host addresses";
+ doc = <<- _EndOfDoc_
+ Output all host addresses in dotted-quad numeric format rather than
+ converting to the canonical host names.
+ _EndOfDoc_;
+};
+
+flag = {
name = peers;
value = p;
descrip = "Print a list of the peers";
@@ -82,46 +104,709 @@ flag = {
_EndOfDoc_;
};
-flag = {
- name = interactive;
- value = i;
- flags-cant = command, listpeers, peers, showpeers;
- descrip = "Force ntpq to operate in interactive mode";
- doc = <<- _EndOfDoc_
- Force ntpq to operate in interactive mode. Prompts will be written
- to the standard output and commands read from the standard input.
- _EndOfDoc_;
+/* explain: Additional information whenever the usage routine is invoked */
+explain = <<- _END_EXPLAIN
+ _END_EXPLAIN;
+
+doc-section = {
+ ds-type = 'DESCRIPTION';
+ ds-format = 'mdoc';
+ ds-text = <<- _END_PROG_MDOC_DESCRIP
+.Nm
+is deprecated.
+Please use
+.Xr ntpq 1ntpqmdoc instead - it can do everything
+.Nm
+used to do, and it does so using a much more sane interface.
+.Pp
+.Nm
+is a utility program used to query
+.Xr ntpd 1ntpdmdoc
+about its
+current state and to request changes in that state.
+It uses NTP mode 7 control message formats described in the source code.
+The program may
+be run either in interactive mode or controlled using command line
+arguments.
+Extensive state and statistics information is available
+through the
+.Nm
+interface.
+In addition, nearly all the
+configuration options which can be specified at startup using
+ntpd's configuration file may also be specified at run time using
+.Nm .
+ _END_PROG_MDOC_DESCRIP;
};
-#include debug-opt.def
-flag = {
- name = numeric;
- value = n;
- descrip = "numeric host addresses";
- doc = <<- _EndOfDoc_
- Output all host addresses in dotted-quad numeric format rather than
- converting to the canonical host names.
- _EndOfDoc_;
+doc-section = {
+ ds-type = 'USAGE';
+ ds-format = 'mdoc';
+ ds-text = <<- _END_MDOC_USAGE
+If one or more request options are included on the command line
+when
+.Nm
+is executed, each of the requests will be sent
+to the NTP servers running on each of the hosts given as command
+line arguments, or on localhost by default.
+If no request options
+are given,
+.Nm
+will attempt to read commands from the
+standard input and execute these on the NTP server running on the
+first host given on the command line, again defaulting to localhost
+when no other host is specified.
+The
+.Nm
+utility will prompt for
+commands if the standard input is a terminal device.
+.Pp
+The
+.Nm
+utility uses NTP mode 7 packets to communicate with the
+NTP server, and hence can be used to query any compatible server on
+the network which permits it.
+Note that since NTP is a UDP protocol
+this communication will be somewhat unreliable, especially over
+large distances in terms of network topology.
+The
+.Nm
+utility makes
+no attempt to retransmit requests, and will time requests out if
+the remote host is not heard from within a suitable timeout
+time.
+.Pp
+The operation of
+.Nm
+are specific to the particular
+implementation of the
+.Xr ntpd 1ntpdmdoc
+daemon and can be expected to
+work only with this and maybe some previous versions of the daemon.
+Requests from a remote
+.Nm
+utility which affect the
+state of the local server must be authenticated, which requires
+both the remote program and local server share a common key and key
+identifier.
+.Pp
+Note that in contexts where a host name is expected, a
+.Fl 4
+qualifier preceding the host name forces DNS resolution to the IPv4 namespace,
+while a
+.Fl 6
+qualifier forces DNS resolution to the IPv6 namespace.
+Specifying a command line option other than
+.Fl i
+or
+.Fl n
+will cause the specified query (queries) to be sent to
+the indicated host(s) immediately.
+Otherwise,
+.Nm
+will
+attempt to read interactive format commands from the standard
+input.
+.Ss "Interactive Commands"
+Interactive format commands consist of a keyword followed by zero
+to four arguments.
+Only enough characters of the full keyword to
+uniquely identify the command need be typed.
+The output of a
+command is normally sent to the standard output, but optionally the
+output of individual commands may be sent to a file by appending a
+.Ql \&> ,
+followed by a file name, to the command line.
+.Pp
+A number of interactive format commands are executed entirely
+within the
+.Nm
+utility itself and do not result in NTP
+mode 7 requests being sent to a server.
+These are described
+following.
+.Bl -tag -width indent
+.It Ic \&? Ar command_keyword
+.It Ic help Ar command_keyword
+A
+.Sq Ic \&?
+will print a list of all the command
+keywords known to this incarnation of
+.Nm .
+A
+.Sq Ic \&?
+followed by a command keyword will print function and usage
+information about the command.
+This command is probably a better
+source of information about
+.Xr ntpq 1ntpqmdoc
+than this manual
+page.
+.It Ic delay Ar milliseconds
+Specify a time interval to be added to timestamps included in
+requests which require authentication.
+This is used to enable
+(unreliable) server reconfiguration over long delay network paths
+or between machines whose clocks are unsynchronized.
+Actually the
+server does not now require timestamps in authenticated requests,
+so this command may be obsolete.
+.It Ic host Ar hostname
+Set the host to which future queries will be sent.
+Hostname may
+be either a host name or a numeric address.
+.It Ic hostnames Op Cm yes | Cm no
+If
+.Cm yes
+is specified, host names are printed in
+information displays.
+If
+.Cm no
+is specified, numeric
+addresses are printed instead.
+The default is
+.Cm yes ,
+unless
+modified using the command line
+.Fl n
+switch.
+.It Ic keyid Ar keyid
+This command allows the specification of a key number to be
+used to authenticate configuration requests.
+This must correspond
+to a key number the server has been configured to use for this
+purpose.
+.It Ic quit
+Exit
+.Nm .
+.It Ic passwd
+This command prompts you to type in a password (which will not
+be echoed) which will be used to authenticate configuration
+requests.
+The password must correspond to the key configured for
+use by the NTP server for this purpose if such requests are to be
+successful.
+.It Ic timeout Ar milliseconds
+Specify a timeout period for responses to server queries.
+The
+default is about 8000 milliseconds.
+Note that since
+.Nm
+retries each query once after a timeout, the total waiting time for
+a timeout will be twice the timeout value set.
+.El
+.Ss "Control Message Commands"
+Query commands result in NTP mode 7 packets containing requests for
+information being sent to the server.
+These are read-only commands
+in that they make no modification of the server configuration
+state.
+.Bl -tag -width indent
+.It Ic listpeers
+Obtains and prints a brief list of the peers for which the
+server is maintaining state.
+These should include all configured
+peer associations as well as those peers whose stratum is such that
+they are considered by the server to be possible future
+synchronization candidates.
+.It Ic peers
+Obtains a list of peers for which the server is maintaining
+state, along with a summary of that state.
+Summary information
+includes the address of the remote peer, the local interface
+address (0.0.0.0 if a local address has yet to be determined), the
+stratum of the remote peer (a stratum of 16 indicates the remote
+peer is unsynchronized), the polling interval, in seconds, the
+reachability register, in octal, and the current estimated delay,
+offset and dispersion of the peer, all in seconds.
+.Pp
+The character in the left margin indicates the mode this peer
+entry is operating in.
+A
+.Ql \&+
+denotes symmetric active, a
+.Ql \&-
+indicates symmetric passive, a
+.Ql \&=
+means the
+remote server is being polled in client mode, a
+.Ql \&^
+indicates that the server is broadcasting to this address, a
+.Ql \&~
+denotes that the remote peer is sending broadcasts and a
+.Ql \&~
+denotes that the remote peer is sending broadcasts and a
+.Ql \&*
+marks the peer the server is currently synchronizing
+to.
+.Pp
+The contents of the host field may be one of four forms.
+It may
+be a host name, an IP address, a reference clock implementation
+name with its parameter or
+.Fn REFCLK "implementation_number" "parameter" .
+On
+.Ic hostnames
+.Cm no
+only IP-addresses
+will be displayed.
+.It Ic dmpeers
+A slightly different peer summary list.
+Identical to the output
+of the
+.Ic peers
+command, except for the character in the
+leftmost column.
+Characters only appear beside peers which were
+included in the final stage of the clock selection algorithm.
+A
+.Ql \&.
+indicates that this peer was cast off in the falseticker
+detection, while a
+.Ql \&+
+indicates that the peer made it
+through.
+A
+.Ql \&*
+denotes the peer the server is currently
+synchronizing with.
+.It Ic showpeer Ar peer_address Oo Ar ... Oc
+Shows a detailed display of the current peer variables for one
+or more peers.
+Most of these values are described in the NTP
+Version 2 specification.
+.It Ic pstats Ar peer_address Oo Ar ... Oc
+Show per-peer statistic counters associated with the specified
+peer(s).
+.It Ic clockstat Ar clock_peer_address Oo Ar ... Oc
+Obtain and print information concerning a peer clock.
+The
+values obtained provide information on the setting of fudge factors
+and other clock performance information.
+.It Ic kerninfo
+Obtain and print kernel phase-lock loop operating parameters.
+This information is available only if the kernel has been specially
+modified for a precision timekeeping function.
+.It Ic loopinfo Op Cm oneline | Cm multiline
+Print the values of selected loop filter variables.
+The loop
+filter is the part of NTP which deals with adjusting the local
+system clock.
+The
+.Sq offset
+is the last offset given to the
+loop filter by the packet processing code.
+The
+.Sq frequency
+is the frequency error of the local clock in parts-per-million
+(ppm).
+The
+.Sq time_const
+controls the stiffness of the
+phase-lock loop and thus the speed at which it can adapt to
+oscillator drift.
+The
+.Sq watchdog timer
+value is the number
+of seconds which have elapsed since the last sample offset was
+given to the loop filter.
+The
+.Cm oneline
+and
+.Cm multiline
+options specify the format in which this
+information is to be printed, with
+.Cm multiline
+as the
+default.
+.It Ic sysinfo
+Print a variety of system state variables, i.e., state related
+to the local server.
+All except the last four lines are described
+in the NTP Version 3 specification, RFC-1305.
+.Pp
+The
+.Sq system flags
+show various system flags, some of
+which can be set and cleared by the
+.Ic enable
+and
+.Ic disable
+configuration commands, respectively.
+These are
+the
+.Cm auth ,
+.Cm bclient ,
+.Cm monitor ,
+.Cm pll ,
+.Cm pps
+and
+.Cm stats
+flags.
+See the
+.Xr ntpd 1ntpdmdoc
+documentation for the meaning of these flags.
+There
+are two additional flags which are read only, the
+.Cm kernel_pll
+and
+.Cm kernel_pps .
+These flags indicate
+the synchronization status when the precision time kernel
+modifications are in use.
+The
+.Sq kernel_pll
+indicates that
+the local clock is being disciplined by the kernel, while the
+.Sq kernel_pps
+indicates the kernel discipline is provided by the PPS
+signal.
+.Pp
+The
+.Sq stability
+is the residual frequency error remaining
+after the system frequency correction is applied and is intended for
+maintenance and debugging.
+In most architectures, this value will
+initially decrease from as high as 500 ppm to a nominal value in
+the range .01 to 0.1 ppm.
+If it remains high for some time after
+starting the daemon, something may be wrong with the local clock,
+or the value of the kernel variable
+.Va kern.clockrate.tick
+may be
+incorrect.
+.Pp
+The
+.Sq broadcastdelay
+shows the default broadcast delay,
+as set by the
+.Ic broadcastdelay
+configuration command.
+.Pp
+The
+.Sq authdelay
+shows the default authentication delay,
+as set by the
+.Ic authdelay
+configuration command.
+.It Ic sysstats
+Print statistics counters maintained in the protocol
+module.
+.It Ic memstats
+Print statistics counters related to memory allocation
+code.
+.It Ic iostats
+Print statistics counters maintained in the input-output
+module.
+.It Ic timerstats
+Print statistics counters maintained in the timer/event queue
+support code.
+.It Ic reslist
+Obtain and print the server's restriction list.
+This list is
+(usually) printed in sorted order and may help to understand how
+the restrictions are applied.
+.It Ic monlist Op Ar version
+Obtain and print traffic counts collected and maintained by the
+monitor facility.
+The version number should not normally need to be
+specified.
+.It Ic clkbug Ar clock_peer_address Oo Ar ... Oc
+Obtain debugging information for a reference clock driver.
+This
+information is provided only by some clock drivers and is mostly
+undecodable without a copy of the driver source in hand.
+.El
+.Ss "Runtime Configuration Requests"
+All requests which cause state changes in the server are
+authenticated by the server using a configured NTP key (the
+facility can also be disabled by the server by not configuring a
+key).
+The key number and the corresponding key must also be made
+known to
+.Nm .
+This can be done using the
+.Ic keyid
+and
+.Ic passwd
+commands, the latter of which will prompt at the terminal for a
+password to use as the encryption key.
+You will also be prompted
+automatically for both the key number and password the first time a
+command which would result in an authenticated request to the
+server is given.
+Authentication not only provides verification that
+the requester has permission to make such changes, but also gives
+an extra degree of protection again transmission errors.
+.Pp
+Authenticated requests always include a timestamp in the packet
+data, which is included in the computation of the authentication
+code.
+This timestamp is compared by the server to its receive time
+stamp.
+If they differ by more than a small amount the request is
+rejected.
+This is done for two reasons.
+First, it makes simple
+replay attacks on the server, by someone who might be able to
+overhear traffic on your LAN, much more difficult.
+Second, it makes
+it more difficult to request configuration changes to your server
+from topologically remote hosts.
+While the reconfiguration facility
+will work well with a server on the local host, and may work
+adequately between time-synchronized hosts on the same LAN, it will
+work very poorly for more distant hosts.
+As such, if reasonable
+passwords are chosen, care is taken in the distribution and
+protection of keys and appropriate source address restrictions are
+applied, the run time reconfiguration facility should provide an
+adequate level of security.
+.Pp
+The following commands all make authenticated requests.
+.Bl -tag -width indent
+.It Xo Ic addpeer Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Add a configured peer association at the given address and
+operating in symmetric active mode.
+Note that an existing
+association with the same peer may be deleted when this command is
+executed, or may simply be converted to conform to the new
+configuration, as appropriate.
+If the optional
+.Ar keyid
+is a
+nonzero integer, all outgoing packets to the remote server will
+have an authentication field attached encrypted with this key.
+If
+the value is 0 (or not given) no authentication will be done.
+The
+.Ar version
+can be 1, 2 or 3 and defaults to 3.
+The
+.Cm prefer
+keyword indicates a preferred peer (and thus will
+be used primarily for clock synchronisation if possible).
+The
+preferred peer also determines the validity of the PPS signal - if
+the preferred peer is suitable for synchronisation so is the PPS
+signal.
+.It Xo Ic addserver Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Identical to the addpeer command, except that the operating
+mode is client.
+.It Xo Ic broadcast Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Identical to the addpeer command, except that the operating
+mode is broadcast.
+In this case a valid key identifier and key are
+required.
+The
+.Ar peer_address
+parameter can be the broadcast
+address of the local network or a multicast group address assigned
+to NTP.
+If a multicast address, a multicast-capable kernel is
+required.
+.It Ic unconfig Ar peer_address Oo Ar ... Oc
+This command causes the configured bit to be removed from the
+specified peer(s).
+In many cases this will cause the peer
+association to be deleted.
+When appropriate, however, the
+association may persist in an unconfigured mode if the remote peer
+is willing to continue on in this fashion.
+.It Xo Ic fudge Ar peer_address
+.Op Cm time1
+.Op Cm time2
+.Op Ar stratum
+.Op Ar refid
+.Xc
+This command provides a way to set certain data for a reference
+clock.
+See the source listing for further information.
+.It Xo Ic enable
+.Oo
+.Cm auth | Cm bclient |
+.Cm calibrate | Cm kernel |
+.Cm monitor | Cm ntp |
+.Cm pps | Cm stats
+.Oc
+.Xc
+.It Xo Ic disable
+.Oo
+.Cm auth | Cm bclient |
+.Cm calibrate | Cm kernel |
+.Cm monitor | Cm ntp |
+.Cm pps | Cm stats
+.Oc
+.Xc
+These commands operate in the same way as the
+.Ic enable
+and
+.Ic disable
+configuration file commands of
+.Xr ntpd 1ntpdmdoc .
+.Bl -tag -width indent
+.It Cm auth
+Enables the server to synchronize with unconfigured peers only
+if the peer has been correctly authenticated using either public key
+or private key cryptography.
+The default for this flag is enable.
+.It Cm bclient
+Enables the server to listen for a message from a broadcast or
+multicast server, as in the multicastclient command with
+default address.
+The default for this flag is disable.
+.It Cm calibrate
+Enables the calibrate feature for reference clocks.
+The default for this flag is disable.
+.It Cm kernel
+Enables the kernel time discipline, if available.
+The default for this flag is enable if support is available, otherwise disable.
+.It Cm monitor
+Enables the monitoring facility.
+See the documentation here about the
+.Cm monlist
+command or further information.
+The default for this flag is enable.
+.It Cm ntp
+Enables time and frequency discipline.
+In effect, this switch opens and closes the feedback loop,
+which is useful for testing.
+The default for this flag is enable.
+.It Cm pps
+Enables the pulse-per-second (PPS) signal when frequency
+and time is disciplined by the precision time kernel modifications.
+See the
+.Qq A Kernel Model for Precision Timekeeping
+(available as part of the HTML documentation
+provided in
+.Pa /usr/share/doc/ntp )
+page for further information.
+The default for this flag is disable.
+.It Cm stats
+Enables the statistics facility.
+See the
+.Sx Monitoring Options
+section of
+.Xr ntp.conf 5
+for further information.
+The default for this flag is disable.
+.El
+.It Xo Ic restrict Ar address Ar mask
+.Ar flag Oo Ar ... Oc
+.Xc
+This command operates in the same way as the
+.Ic restrict
+configuration file commands of
+.Xr ntpd 1ntpdmdoc .
+.It Xo Ic unrestrict Ar address Ar mask
+.Ar flag Oo Ar ... Oc
+.Xc
+Unrestrict the matching entry from the restrict list.
+.It Xo Ic delrestrict Ar address Ar mask
+.Op Cm ntpport
+.Xc
+Delete the matching entry from the restrict list.
+.It Ic readkeys
+Causes the current set of authentication keys to be purged and
+a new set to be obtained by rereading the keys file (which must
+have been specified in the
+.Xr ntpd 1ntpdmdoc
+configuration file).
+This
+allows encryption keys to be changed without restarting the
+server.
+.It Ic trustedkey Ar keyid Oo Ar ... Oc
+.It Ic untrustedkey Ar keyid Oo Ar ... Oc
+These commands operate in the same way as the
+.Ic trustedkey
+and
+.Ic untrustedkey
+configuration file
+commands of
+.Xr ntpd 1ntpdmdoc .
+.It Ic authinfo
+Returns information concerning the authentication module,
+including known keys and counts of encryptions and decryptions
+which have been done.
+.It Ic traps
+Display the traps set in the server.
+See the source listing for
+further information.
+.It Xo Ic addtrap Ar address
+.Op Ar port
+.Op Ar interface
+.Xc
+Set a trap for asynchronous messages.
+See the source listing
+for further information.
+.It Xo Ic clrtrap Ar address
+.Op Ar port
+.Op Ar interface
+.Xc
+Clear a trap for asynchronous messages.
+See the source listing
+for further information.
+.It Ic reset
+Clear the statistics counters in various modules of the server.
+See the source listing for further information.
+.El
+ _END_MDOC_USAGE;
+};
+
+
+doc-section = {
+ ds-type = 'SEE ALSO';
+ ds-format = 'mdoc';
+ ds-text = <<- _END_MDOC_SEEALSO
+.Xr ntp.conf 5 ,
+.Xr ntpd 1ntpdmdoc
+.Rs
+.%A David L. Mills
+.%T Network Time Protocol (Version 3)
+.%O RFC1305
+.Re
+ _END_MDOC_SEEALSO;
};
-detail = <<- _END_DETAIL
- The
- [= prog-name =]
- utility program is used to query an NTP daemon about its
- current state and to request changes in that state.
- It uses NTP mode 7 control message formats described in the source code.
- The program may
- be run either in interactive mode or controlled using command line
- arguments.
- Extensive state and statistics information is available
- through the
- [= prog-name =]
- interface.
- In addition, nearly all the
- configuration options which can be specified at startup using
- ntpd's configuration file may also be specified at run time using
- [= prog-name =] .
-
-
- _END_DETAIL;
+
+doc-section = {
+ ds-type = 'AUTHORS';
+ ds-format = 'mdoc';
+ ds-text = <<- _END_MDOC_AUTHORS
+The formatting directives in this document came from FreeBSD.
+ _END_MDOC_AUTHORS;
+};
+
+
+doc-section = {
+ ds-type = 'BUGS';
+ ds-format = 'mdoc';
+ ds-text = <<- _END_MDOC_BUGS
+The
+.Nm
+utility is a crude hack.
+Much of the information it shows is
+deadly boring and could only be loved by its implementer.
+The
+program was designed so that new (and temporary) features were easy
+to hack in, at great expense to the program's ease of use.
+Despite
+this, the program is occasionally useful.
+.Pp
+Please report bugs to http://bugs.ntp.org .
+ _END_MDOC_BUGS;
+};
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.h b/contrib/ntp/ntpdc/ntpdc-opts.h
index f6eef65..e4965a0 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.h
+++ b/contrib/ntp/ntpdc/ntpdc-opts.h
@@ -1,100 +1,140 @@
-/*
+/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.h)
- *
- * It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:00 AM EST
+ *
+ * It has been AutoGen-ed June 29, 2015 at 04:30:50 PM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
- * Generated from AutoOpts 29:0:4 templates.
- */
-
-/*
- * This file was produced by an AutoOpts template. AutoOpts is a
- * copyrighted work. This header file is not encumbered by AutoOpts
- * licensing, but is provided under the licensing terms chosen by the
- * ntpdc author or copyright holder. AutoOpts is licensed under
- * the terms of the LGPL. The redistributable library (``libopts'') is
- * licensed under the terms of either the LGPL or, at the users discretion,
- * the BSD license. See the AutoOpts and/or libopts sources for details.
+ * Generated from AutoOpts 41:0:16 templates.
+ *
+ * AutoOpts is a copyrighted work. This header file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the ntpdc author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
*
- * This source file is copyrighted and licensed under the following terms:
+ * The ntpdc program is copyrighted and licensed
+ * under the following terms:
*
- * ntpdc copyright 1970-2009 David L. Mills and/or others - all rights reserved
+ * Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the NTP License, copies of which
+ * can be seen at:
+ * <http://ntp.org/license>
+ * <http://opensource.org/licenses/ntp-license.php>
*
- * see html/copyright.html
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose with or without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and that
+ * both the copyright notice and this permission notice appear in
+ * supporting documentation, and that the name The University of Delaware not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. The University of Delaware and Network Time Foundation makes no
+ * representations about the suitability this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
*/
-/*
+/**
* This file contains the programmatic interface to the Automated
* Options generated for the ntpdc program.
* These macros are documented in the AutoGen info file in the
* "AutoOpts" chapter. Please refer to that doc for usage help.
*/
#ifndef AUTOOPTS_NTPDC_OPTS_H_GUARD
-#define AUTOOPTS_NTPDC_OPTS_H_GUARD
+#define AUTOOPTS_NTPDC_OPTS_H_GUARD 1
#include "config.h"
#include <autoopts/options.h>
-/*
+/**
* Ensure that the library used for compiling this generated header is at
* least as new as the version current when the header template was released
* (not counting patch version increments). Also ensure that the oldest
* tolerable version is at least as old as what was current when the header
* template was released.
*/
-#define AO_TEMPLATE_VERSION 118784
+#define AO_TEMPLATE_VERSION 167936
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
# error option template version mismatches autoopts/options.h header
Choke Me.
#endif
-/*
- * Enumeration of each option:
+/**
+ * Enumeration of each option type for ntpdc
*/
typedef enum {
- INDEX_OPT_IPV4 = 0,
- INDEX_OPT_IPV6 = 1,
- INDEX_OPT_COMMAND = 2,
- INDEX_OPT_LISTPEERS = 3,
- INDEX_OPT_PEERS = 4,
- INDEX_OPT_SHOWPEERS = 5,
- INDEX_OPT_INTERACTIVE = 6,
- INDEX_OPT_DEBUG_LEVEL = 7,
- INDEX_OPT_SET_DEBUG_LEVEL = 8,
- INDEX_OPT_NUMERIC = 9,
- INDEX_OPT_VERSION = 10,
- INDEX_OPT_HELP = 11,
- INDEX_OPT_MORE_HELP = 12,
- INDEX_OPT_SAVE_OPTS = 13,
- INDEX_OPT_LOAD_OPTS = 14
+ INDEX_OPT_IPV4 = 0,
+ INDEX_OPT_IPV6 = 1,
+ INDEX_OPT_COMMAND = 2,
+ INDEX_OPT_DEBUG_LEVEL = 3,
+ INDEX_OPT_SET_DEBUG_LEVEL = 4,
+ INDEX_OPT_INTERACTIVE = 5,
+ INDEX_OPT_LISTPEERS = 6,
+ INDEX_OPT_NUMERIC = 7,
+ INDEX_OPT_PEERS = 8,
+ INDEX_OPT_SHOWPEERS = 9,
+ INDEX_OPT_VERSION = 10,
+ INDEX_OPT_HELP = 11,
+ INDEX_OPT_MORE_HELP = 12,
+ INDEX_OPT_SAVE_OPTS = 13,
+ INDEX_OPT_LOAD_OPTS = 14
} teOptIndex;
-
+/** count of all options for ntpdc */
#define OPTION_CT 15
-#define NTPDC_VERSION "4.2.4p8"
-#define NTPDC_FULL_VERSION "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p8"
+/** ntpdc version */
+#define NTPDC_VERSION "4.2.8p3"
+/** Full ntpdc version text */
+#define NTPDC_FULL_VERSION "ntpdc 4.2.8p3"
-/*
+/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
* option name (as in the teOptIndex enumeration above).
- * e.g. HAVE_OPT( IPV4 )
+ * e.g. HAVE_OPT(IPV4)
*/
#define DESC(n) (ntpdcOptions.pOptDesc[INDEX_OPT_## n])
+/** 'true' if an option has been specified in any way */
#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
+/** The string argument to an option. The argument type must be \"string\". */
#define OPT_ARG(n) (DESC(n).optArg.argString)
+/** Mask the option state revealing how an option was specified.
+ * It will be one and only one of \a OPTST_SET, \a OPTST_PRESET,
+ * \a OPTST_DEFINED, \a OPTST_RESET or zero.
+ */
#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
+/** Count of option's occurrances *on the command line*. */
#define COUNT_OPT(n) (DESC(n).optOccCt)
+/** mask of \a OPTST_SET and \a OPTST_DEFINED. */
#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
+/** 'true' if \a HAVE_OPT would yield 'false'. */
#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
+/** 'true' if OPTST_DISABLED bit not set. */
#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
+/** number of stacked option arguments.
+ * Valid only for stacked option arguments. */
#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
+/** stacked argument vector.
+ * Valid only for stacked option arguments. */
#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
+/** Reset an option. */
#define CLEAR_OPT(n) STMTS( \
DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
- if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \
+ if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
DESC(n).fOptState |= OPTST_DISABLED; \
DESC(n).optCookie = NULL )
-
-/*
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Enumeration of ntpdc exit codes
+ */
+typedef enum {
+ NTPDC_EXIT_SUCCESS = 0,
+ NTPDC_EXIT_FAILURE = 1,
+ NTPDC_EXIT_USAGE_ERROR = 64,
+ NTPDC_EXIT_NO_CONFIG_INPUT = 66,
+ NTPDC_EXIT_LIBOPTS_FAILURE = 70
+} ntpdc_exit_code_t;
+/** @} */
+/**
* Make sure there are no #define name conflicts with the option names
*/
#ifndef NO_OPTION_NAME_WARNINGS
@@ -110,22 +150,6 @@ typedef enum {
# warning undefining COMMAND due to option name conflict
# undef COMMAND
# endif
-# ifdef LISTPEERS
-# warning undefining LISTPEERS due to option name conflict
-# undef LISTPEERS
-# endif
-# ifdef PEERS
-# warning undefining PEERS due to option name conflict
-# undef PEERS
-# endif
-# ifdef SHOWPEERS
-# warning undefining SHOWPEERS due to option name conflict
-# undef SHOWPEERS
-# endif
-# ifdef INTERACTIVE
-# warning undefining INTERACTIVE due to option name conflict
-# undef INTERACTIVE
-# endif
# ifdef DEBUG_LEVEL
# warning undefining DEBUG_LEVEL due to option name conflict
# undef DEBUG_LEVEL
@@ -134,89 +158,137 @@ typedef enum {
# warning undefining SET_DEBUG_LEVEL due to option name conflict
# undef SET_DEBUG_LEVEL
# endif
+# ifdef INTERACTIVE
+# warning undefining INTERACTIVE due to option name conflict
+# undef INTERACTIVE
+# endif
+# ifdef LISTPEERS
+# warning undefining LISTPEERS due to option name conflict
+# undef LISTPEERS
+# endif
# ifdef NUMERIC
# warning undefining NUMERIC due to option name conflict
# undef NUMERIC
# endif
+# ifdef PEERS
+# warning undefining PEERS due to option name conflict
+# undef PEERS
+# endif
+# ifdef SHOWPEERS
+# warning undefining SHOWPEERS due to option name conflict
+# undef SHOWPEERS
+# endif
#else /* NO_OPTION_NAME_WARNINGS */
# undef IPV4
# undef IPV6
# undef COMMAND
-# undef LISTPEERS
-# undef PEERS
-# undef SHOWPEERS
-# undef INTERACTIVE
# undef DEBUG_LEVEL
# undef SET_DEBUG_LEVEL
+# undef INTERACTIVE
+# undef LISTPEERS
# undef NUMERIC
+# undef PEERS
+# undef SHOWPEERS
#endif /* NO_OPTION_NAME_WARNINGS */
-/*
+/**
* Interface defines for specific options.
+ * @{
*/
#define VALUE_OPT_IPV4 '4'
-#define WHICH_OPT_IPV4 (DESC(IPV4).optActualValue)
-#define WHICH_IDX_IPV4 (DESC(IPV4).optActualIndex)
#define VALUE_OPT_IPV6 '6'
#define VALUE_OPT_COMMAND 'c'
-#define VALUE_OPT_LISTPEERS 'l'
-#define VALUE_OPT_PEERS 'p'
-#define VALUE_OPT_SHOWPEERS 's'
-#define VALUE_OPT_INTERACTIVE 'i'
-#ifdef DEBUG
#define VALUE_OPT_DEBUG_LEVEL 'd'
-#endif /* DEBUG */
-#ifdef DEBUG
#define VALUE_OPT_SET_DEBUG_LEVEL 'D'
-#endif /* DEBUG */
-#define VALUE_OPT_NUMERIC 'n'
-#define VALUE_OPT_VERSION 'v'
+#define OPT_VALUE_SET_DEBUG_LEVEL (DESC(SET_DEBUG_LEVEL).optArg.argInt)
+#define VALUE_OPT_INTERACTIVE 'i'
+#define VALUE_OPT_LISTPEERS 'l'
+#define VALUE_OPT_NUMERIC 'n'
+#define VALUE_OPT_PEERS 'p'
+#define VALUE_OPT_SHOWPEERS 's'
+/** option flag (value) for help-value option */
#define VALUE_OPT_HELP '?'
+/** option flag (value) for more-help-value option */
#define VALUE_OPT_MORE_HELP '!'
+/** option flag (value) for version-value option */
+#define VALUE_OPT_VERSION 0x1001
+/** option flag (value) for save-opts-value option */
#define VALUE_OPT_SAVE_OPTS '>'
+/** option flag (value) for load-opts-value option */
#define VALUE_OPT_LOAD_OPTS '<'
#define SET_OPT_SAVE_OPTS(a) STMTS( \
DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
- DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
+ DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
/*
* Interface defines not associated with particular options
*/
-#define ERRSKIP_OPTERR STMTS( ntpdcOptions.fOptSet &= ~OPTPROC_ERRSTOP )
-#define ERRSTOP_OPTERR STMTS( ntpdcOptions.fOptSet |= OPTPROC_ERRSTOP )
+#define ERRSKIP_OPTERR STMTS(ntpdcOptions.fOptSet &= ~OPTPROC_ERRSTOP)
+#define ERRSTOP_OPTERR STMTS(ntpdcOptions.fOptSet |= OPTPROC_ERRSTOP)
#define RESTART_OPT(n) STMTS( \
ntpdcOptions.curOptIdx = (n); \
ntpdcOptions.pzCurOpt = NULL )
#define START_OPT RESTART_OPT(1)
-#define USAGE(c) (*ntpdcOptions.pUsageProc)( &ntpdcOptions, c )
-/* extracted from /usr/local/gnu/autogen-5.9.1/share/autogen/opthead.tpl near line 360 */
+#define USAGE(c) (*ntpdcOptions.pUsageProc)(&ntpdcOptions, c)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* * * * * *
*
* Declare the ntpdc option descriptor.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
+extern tOptions ntpdcOptions;
-extern tOptions ntpdcOptions;
-
-#ifndef _
-# if ENABLE_NLS
-# include <stdio.h>
- static inline char* aoGetsText( char const* pz ) {
- if (pz == NULL) return NULL;
- return (char*)gettext( pz );
- }
-# define _(s) aoGetsText(s)
-# else /* ENABLE_NLS */
-# define _(s) s
-# endif /* ENABLE_NLS */
-#endif
+#if defined(ENABLE_NLS)
+# ifndef _
+# include <stdio.h>
+# ifndef HAVE_GETTEXT
+ extern char * gettext(char const *);
+# else
+# include <libintl.h>
+# endif
+
+# ifndef ATTRIBUTE_FORMAT_ARG
+# define ATTRIBUTE_FORMAT_ARG(_a)
+# endif
+
+static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
+static inline char* aoGetsText(char const* pz) {
+ if (pz == NULL) return NULL;
+ return (char*)gettext(pz);
+}
+# define _(s) aoGetsText(s)
+# endif /* _() */
+
+# define OPT_NO_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet |= \
+ OPTPROC_NXLAT_OPT_CFG;)
+# define OPT_NO_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet |= \
+ OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
+
+# define OPT_XLAT_CFG_NAMES STMTS(ntpdcOptions.fOptSet &= \
+ ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
+# define OPT_XLAT_OPT_NAMES STMTS(ntpdcOptions.fOptSet &= \
+ ~OPTPROC_NXLAT_OPT;)
+
+#else /* ENABLE_NLS */
+# define OPT_NO_XLAT_CFG_NAMES
+# define OPT_NO_XLAT_OPT_NAMES
+
+# define OPT_XLAT_CFG_NAMES
+# define OPT_XLAT_OPT_NAMES
+
+# ifndef _
+# define _(_s) _s
+# endif
+#endif /* ENABLE_NLS */
#ifdef __cplusplus
}
#endif
#endif /* AUTOOPTS_NTPDC_OPTS_H_GUARD */
+
/* ntpdc-opts.h ends here */
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.texi b/contrib/ntp/ntpdc/ntpdc-opts.texi
deleted file mode 100644
index 121c270..0000000
--- a/contrib/ntp/ntpdc/ntpdc-opts.texi
+++ /dev/null
@@ -1,278 +0,0 @@
-@node ntpdc Invocation
-@section Invoking ntpdc
-@pindex ntpdc
-@cindex vendor-specific NTP query program
-@ignore
-#
-# EDIT THIS FILE WITH CAUTION (ntpdc-opts.texi)
-#
-# It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:02 AM EST
-# From the definitions ntpdc-opts.def
-# and the template file aginfo.tpl
-@end ignore
-This program has no explanation.
-
-The
-[= prog-name =]
-utility program is used to query an NTP daemon about its
-current state and to request changes in that state.
-It uses NTP mode 7 control message formats described in the source code.
-The program may
-be run either in interactive mode or controlled using command line
-arguments.
-Extensive state and statistics information is available
-through the
-[= prog-name =]
-interface.
-In addition, nearly all the
-configuration options which can be specified at startup using
-ntpd's configuration file may also be specified at run time using
-[= prog-name =] .
-
-
-
-This section was generated by @strong{AutoGen},
-the aginfo template and the option descriptions for the @command{ntpdc} program. It documents the ntpdc usage text and option meanings.
-
-This software is released under a specialized copyright license.
-
-@menu
-* ntpdc usage:: ntpdc usage help (-?)
-* ntpdc command:: command option (-c)
-* ntpdc debug-level:: debug-level option (-d)
-* ntpdc interactive:: interactive option (-i)
-* ntpdc ipv4:: ipv4 option (-4)
-* ntpdc ipv6:: ipv6 option (-6)
-* ntpdc listpeers:: listpeers option (-l)
-* ntpdc numeric:: numeric option (-n)
-* ntpdc peers:: peers option (-p)
-* ntpdc set-debug-level:: set-debug-level option (-D)
-* ntpdc showpeers:: showpeers option (-s)
-@end menu
-
-@node ntpdc usage
-@subsection ntpdc usage help (-?)
-@cindex ntpdc usage
-
-This is the automatically generated usage text for ntpdc:
-
-@exampleindent 0
-@example
-ntpdc - vendor-specific NTP query program - Ver. 4.2.5p247-RC
-USAGE: ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
- Flg Arg Option-Name Description
- -4 no ipv4 Force IPv4 DNS name resolution
- - prohibits these options:
- ipv6
- -6 no ipv6 Force IPv6 DNS name resolution
- - prohibits these options:
- ipv4
- -c Str command run a command and exit
- - may appear multiple times
- -l no listpeers Print a list of the peers
- - prohibits these options:
- command
- -p no peers Print a list of the peers
- - prohibits these options:
- command
- -s no showpeers Show a list of the peers
- - prohibits these options:
- command
- -i no interactive Force ntpq to operate in interactive mode
- - prohibits these options:
- command
- listpeers
- peers
- showpeers
- -d no debug-level Increase output debug message level
- - may appear multiple times
- -D Str set-debug-level Set the output debug message level
- - may appear multiple times
- -n no numeric numeric host addresses
- opt version Output version information and exit
- -? no help Display extended usage information and exit
- -! no more-help Extended usage information passed thru pager
- -> opt save-opts Save the option state to a config file
- -< Str load-opts Load options from a config file
- - disabled as --no-load-opts
- - may appear multiple times
-
-Options are specified by doubled hyphens and their name
-or by a single hyphen and the flag character.
-
-The following option preset mechanisms are supported:
- - reading file /users/stenn/.ntprc
- - reading file /deacon/backroom/snaps/ntp-stable/ntpdc/.ntprc
- - examining environment variables named NTPDC_*
-
-The
-[= prog-name =]
-utility program is used to query an NTP daemon about its
-current state and to request changes in that state.
-It uses NTP mode 7 control message formats described in the source code.
-The program may
-be run either in interactive mode or controlled using command line
-arguments.
-Extensive state and statistics information is available
-through the
-[= prog-name =]
-interface.
-In addition, nearly all the
-configuration options which can be specified at startup using
-ntpd's configuration file may also be specified at run time using
-[= prog-name =] .
-
-please send bug reports to: http://bugs.ntp.org, bugs@@ntp.org
-@end example
-@exampleindent 4
-
-@node ntpdc ipv4
-@subsection ipv4 option (-4)
-@cindex ntpdc-ipv4
-
-This is the ``force ipv4 dns name resolution'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-is a member of the ipv4 class of options.
-@end itemize
-
-Force DNS resolution of following host names on the command line
-to the IPv4 namespace.
-
-@node ntpdc ipv6
-@subsection ipv6 option (-6)
-@cindex ntpdc-ipv6
-
-This is the ``force ipv6 dns name resolution'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-is a member of the ipv4 class of options.
-@end itemize
-
-Force DNS resolution of following host names on the command line
-to the IPv6 namespace.
-
-@node ntpdc command
-@subsection command option (-c)
-@cindex ntpdc-command
-
-This is the ``run a command and exit'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-may appear an unlimited number of times.
-@end itemize
-
-The following argument is interpreted as an interactive format command
-and is added to the list of commands to be executed on the specified
-host(s).
-
-@node ntpdc listpeers
-@subsection listpeers option (-l)
-@cindex ntpdc-listpeers
-
-This is the ``print a list of the peers'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-must not appear in combination with any of the following options:
-command.
-@end itemize
-
-Print a list of the peers known to the server as well as a summary of
-their state. This is equivalent to the 'listpeers' interactive command.
-
-@node ntpdc peers
-@subsection peers option (-p)
-@cindex ntpdc-peers
-
-This is the ``print a list of the peers'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-must not appear in combination with any of the following options:
-command.
-@end itemize
-
-Print a list of the peers known to the server as well as a summary
-of their state. This is equivalent to the 'peers' interactive command.
-
-@node ntpdc showpeers
-@subsection showpeers option (-s)
-@cindex ntpdc-showpeers
-
-This is the ``show a list of the peers'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-must not appear in combination with any of the following options:
-command.
-@end itemize
-
-Print a list of the peers known to the server as well as a summary
-of their state. This is equivalent to the 'dmpeers' interactive command.
-
-@node ntpdc interactive
-@subsection interactive option (-i)
-@cindex ntpdc-interactive
-
-This is the ``force ntpq to operate in interactive mode'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-must not appear in combination with any of the following options:
-command, listpeers, peers, showpeers.
-@end itemize
-
-Force ntpq to operate in interactive mode. Prompts will be written
-to the standard output and commands read from the standard input.
-
-@node ntpdc debug-level
-@subsection debug-level option (-d)
-@cindex ntpdc-debug-level
-
-This is the ``increase output debug message level'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-may appear an unlimited number of times.
-@item
-must be compiled in by defining @code{DEBUG} during the compilation.
-@end itemize
-
-Increase the debugging message output level.
-
-@node ntpdc set-debug-level
-@subsection set-debug-level option (-D)
-@cindex ntpdc-set-debug-level
-
-This is the ``set the output debug message level'' option.
-
-This option has some usage constraints. It:
-@itemize @bullet
-@item
-may appear an unlimited number of times.
-@item
-must be compiled in by defining @code{DEBUG} during the compilation.
-@end itemize
-
-Set the output debugging level. Can be supplied multiple times,
-but each overrides the previous value(s).
-
-@node ntpdc numeric
-@subsection numeric option (-n)
-@cindex ntpdc-numeric
-
-This is the ``numeric host addresses'' option.
-Output all host addresses in dotted-quad numeric format rather than
-converting to the canonical host names.
diff --git a/contrib/ntp/ntpdc/ntpdc.1 b/contrib/ntp/ntpdc/ntpdc.1
deleted file mode 100644
index 4227065..0000000
--- a/contrib/ntp/ntpdc/ntpdc.1
+++ /dev/null
@@ -1,158 +0,0 @@
-.TH NTPDC 1 2009-12-08 "( 4.2.4p8)" "Programmer's Manual"
-.\" EDIT THIS FILE WITH CAUTION (ntpdc.1)
-.\"
-.\" It has been AutoGen-ed Tuesday December 8, 2009 at 08:14:01 AM EST
-.\" From the definitions ntpdc-opts.def
-.\" and the template file agman1.tpl
-.\"
-.SH NAME
-ntpdc \- vendor-specific NTP query program
-.SH SYNOPSIS
-.B ntpdc
-.\" Mixture of short (flag) options and long options
-.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \--\fIopt-name\fP " [[=| ]\fIvalue\fP]]..."
-.br
-.in +8
-[ host ...]
-.SH "DESCRIPTION"
-This manual page documents, briefly, the \fBntpdc\fP command.
-The
-[= prog-name =]
-utility program is used to query an NTP daemon about its
-current state and to request changes in that state.
-It uses NTP mode 7 control message formats described in the source code.
-The program may
-be run either in interactive mode or controlled using command line
-arguments.
-Extensive state and statistics information is available
-through the
-[= prog-name =]
-interface.
-In addition, nearly all the
-configuration options which can be specified at startup using
-ntpd's configuration file may also be specified at run time using
-[= prog-name =] .
-
-
-.SH OPTIONS
-.TP
-.BR \-4 ", " \--ipv4
-Force IPv4 DNS name resolution.
-This option is a member of the ipv4 class of options.
-.sp
-Force DNS resolution of following host names on the command line
-to the IPv4 namespace.
-.TP
-.BR \-6 ", " \--ipv6
-Force IPv6 DNS name resolution.
-This option is a member of the ipv4 class of options.
-.sp
-Force DNS resolution of following host names on the command line
-to the IPv6 namespace.
-.TP
-.BR \-c " \fIcmd\fP, " \--command "=" \fIcmd\fP
-run a command and exit.
-This option may appear an unlimited number of times.
-.sp
-The following argument is interpreted as an interactive format command
-and is added to the list of commands to be executed on the specified
-host(s).
-.TP
-.BR \-l ", " \--listpeers
-Print a list of the peers.
-This option must not appear in combination with any of the following options:
-command.
-.sp
-Print a list of the peers known to the server as well as a summary of
-their state. This is equivalent to the 'listpeers' interactive command.
-.TP
-.BR \-p ", " \--peers
-Print a list of the peers.
-This option must not appear in combination with any of the following options:
-command.
-.sp
-Print a list of the peers known to the server as well as a summary
-of their state. This is equivalent to the 'peers' interactive command.
-.TP
-.BR \-s ", " \--showpeers
-Show a list of the peers.
-This option must not appear in combination with any of the following options:
-command.
-.sp
-Print a list of the peers known to the server as well as a summary
-of their state. This is equivalent to the 'dmpeers' interactive command.
-.TP
-.BR \-i ", " \--interactive
-Force ntpq to operate in interactive mode.
-This option must not appear in combination with any of the following options:
-command, listpeers, peers, showpeers.
-.sp
-Force ntpq to operate in interactive mode. Prompts will be written
-to the standard output and commands read from the standard input.
-.TP
-.BR \-d ", " \--debug-level
-Increase output debug message level.
-This option may appear an unlimited number of times.
-.sp
-Increase the debugging message output level.
-.TP
-.BR \-D " \fIstring\fP, " \--set-debug-level "=" \fIstring\fP
-Set the output debug message level.
-This option may appear an unlimited number of times.
-.sp
-Set the output debugging level. Can be supplied multiple times,
-but each overrides the previous value(s).
-.TP
-.BR \-n ", " \--numeric
-numeric host addresses.
-.sp
-Output all host addresses in dotted-quad numeric format rather than
-converting to the canonical host names.
-.TP
-.BR \-? , " \--help"
-Display usage information and exit.
-.TP
-.BR \-! , " \--more-help"
-Extended usage information passed thru pager.
-.TP
-.BR \-> " [\fIrcfile\fP]," " \--save-opts" "[=\fIrcfile\fP]"
-Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
-configuration file listed in the \fBOPTION PRESETS\fP section, below.
-.TP
-.BR \-< " \fIrcfile\fP," " \--load-opts" "=\fIrcfile\fP," " \--no-load-opts"
-Load options from \fIrcfile\fP.
-The \fIno-load-opts\fP form will disable the loading
-of earlier RC/INI files. \fI--no-load-opts\fP is handled early,
-out of order.
-.TP
-.BR \-v " [{\fIv|c|n\fP}]," " \--version" "[=\fI{v|c|n}\fP]"
-Output version of program and exit. The default mode is `v', a simple
-version. The `c' mode will print copyright information and `n' will
-print the full copyright notice.
-.SH OPTION PRESETS
-Any option that is not marked as \fInot presettable\fP may be preset
-by loading values from configuration ("RC" or ".INI") file(s) and values from
-environment variables named:
-.nf
- \fBNTPDC_<option-name>\fP or \fBNTPDC\fP
-.fi
-.aj
-The environmental presets take precedence (are processed later than)
-the configuration files.
-The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
-If any of these are directories, then the file \fI.ntprc\fP
-is searched for within those directories.
-.SH AUTHOR
-David L. Mills and/or others
-.br
-Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
-
-.PP
-.nf
-.na
-see html/copyright.html
-.fi
-.ad
-.PP
-This manual page was \fIAutoGen\fP-erated from the \fBntpdc\fP
-option definitions.
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcman b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
new file mode 100644
index 0000000..cbc58d0
--- /dev/null
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
@@ -0,0 +1,874 @@
+.de1 NOP
+. it 1 an-trap
+. if \\n[.$] \,\\$*\/
+..
+.ie t \
+.ds B-Font [CB]
+.ds I-Font [CI]
+.ds R-Font [CR]
+.el \
+.ds B-Font B
+.ds I-Font I
+.ds R-Font R
+.TH ntpdc 1ntpdcman "29 Jun 2015" "4.2.8p3" "User Commands"
+.\"
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-91aOeF/ag-i2aGdF)
+.\"
+.\" It has been AutoGen-ed June 29, 2015 at 04:31:01 PM by AutoGen 5.18.5
+.\" From the definitions ntpdc-opts.def
+.\" and the template file agman-cmd.tpl
+.SH NAME
+\f\*[B-Font]ntpdc\fP
+\- vendor-specific NTPD control program
+.SH SYNOPSIS
+\f\*[B-Font]ntpdc\fP
+.\" Mixture of short (flag) options and long options
+[\f\*[B-Font]\-flags\f[]]
+[\f\*[B-Font]\-flag\f[] [\f\*[I-Font]value\f[]]]
+[\f\*[B-Font]\-\-option-name\f[][[=| ]\f\*[I-Font]value\f[]]]
+[ host ...]
+.sp \n(Ppu
+.ne 2
+
+.SH DESCRIPTION
+\f\*[B-Font]ntpdc\fP
+is deprecated.
+Please use
+\fCntpq\f[]\fR(1ntpqmdoc)\f[] instead \- it can do everything
+\f\*[B-Font]ntpdc\fP
+used to do, and it does so using a much more sane interface.
+.sp \n(Ppu
+.ne 2
+
+\f\*[B-Font]ntpdc\fP
+is a utility program used to query
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+about its
+current state and to request changes in that state.
+It uses NTP mode 7 control message formats described in the source code.
+The program may
+be run either in interactive mode or controlled using command line
+arguments.
+Extensive state and statistics information is available
+through the
+\f\*[B-Font]ntpdc\fP
+interface.
+In addition, nearly all the
+configuration options which can be specified at startup using
+ntpd's configuration file may also be specified at run time using
+\f\*[B-Font]ntpdc\fP.
+.SH "OPTIONS"
+.TP
+.NOP \f\*[B-Font]\-4\f[], \f\*[B-Font]\-\-ipv4\f[]
+Force IPv4 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv6.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv4 namespace.
+.TP
+.NOP \f\*[B-Font]\-6\f[], \f\*[B-Font]\-\-ipv6\f[]
+Force IPv6 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv4.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv6 namespace.
+.TP
+.NOP \f\*[B-Font]\-c\f[] \f\*[I-Font]cmd\f[], \f\*[B-Font]\-\-command\f[]=\f\*[I-Font]cmd\f[]
+run a command and exit.
+This option may appear an unlimited number of times.
+.sp
+The following argument is interpreted as an interactive format command
+and is added to the list of commands to be executed on the specified
+host(s).
+.TP
+.NOP \f\*[B-Font]\-d\f[], \f\*[B-Font]\-\-debug\-level\f[]
+Increase debug verbosity level.
+This option may appear an unlimited number of times.
+.sp
+.TP
+.NOP \f\*[B-Font]\-D\f[] \f\*[I-Font]number\f[], \f\*[B-Font]\-\-set\-debug\-level\f[]=\f\*[I-Font]number\f[]
+Set the debug verbosity level.
+This option may appear an unlimited number of times.
+This option takes an integer number as its argument.
+.sp
+.TP
+.NOP \f\*[B-Font]\-i\f[], \f\*[B-Font]\-\-interactive\f[]
+Force ntpq to operate in interactive mode.
+This option must not appear in combination with any of the following options:
+command, listpeers, peers, showpeers.
+.sp
+Force ntpq to operate in interactive mode. Prompts will be written
+to the standard output and commands read from the standard input.
+.TP
+.NOP \f\*[B-Font]\-l\f[], \f\*[B-Font]\-\-listpeers\f[]
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary of
+their state. This is equivalent to the 'listpeers' interactive command.
+.TP
+.NOP \f\*[B-Font]\-n\f[], \f\*[B-Font]\-\-numeric\f[]
+numeric host addresses.
+.sp
+Output all host addresses in dotted-quad numeric format rather than
+converting to the canonical host names.
+.TP
+.NOP \f\*[B-Font]\-p\f[], \f\*[B-Font]\-\-peers\f[]
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'peers' interactive command.
+.TP
+.NOP \f\*[B-Font]\-s\f[], \f\*[B-Font]\-\-showpeers\f[]
+Show a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'dmpeers' interactive command.
+.TP
+.NOP \f\*[B-Font]\-\&?\f[], \f\*[B-Font]\-\-help\f[]
+Display usage information and exit.
+.TP
+.NOP \f\*[B-Font]\-\&!\f[], \f\*[B-Font]\-\-more-help\f[]
+Pass the extended usage information through a pager.
+.TP
+.NOP \f\*[B-Font]\->\f[] [\f\*[I-Font]cfgfile\f[]], \f\*[B-Font]\-\-save-opts\f[] [=\f\*[I-Font]cfgfile\f[]]
+Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+The command will exit after updating the config file.
+.TP
+.NOP \f\*[B-Font]\-<\f[] \f\*[I-Font]cfgfile\f[], \f\*[B-Font]\-\-load-opts\f[]=\f\*[I-Font]cfgfile\f[], \f\*[B-Font]\-\-no-load-opts\f[]
+Load options from \fIcfgfile\fP.
+The \fIno-load-opts\fP form will disable the loading
+of earlier config/rc/ini files. \fI\-\-no-load-opts\fP is handled early,
+out of order.
+.TP
+.NOP \f\*[B-Font]\-\-version\f[] [{\f\*[I-Font]v|c|n\f[]}]
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.
+.PP
+.SH "OPTION PRESETS"
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from configuration ("RC" or ".INI") file(s) and values from
+environment variables named:
+.nf
+ \fBNTPDC_<option-name>\fP or \fBNTPDC\fP
+.fi
+.ad
+The environmental presets take precedence (are processed later than)
+the configuration files.
+The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
+If any of these are directories, then the file \fI.ntprc\fP
+is searched for within those directories.
+.SH USAGE
+If one or more request options are included on the command line
+when
+\f\*[B-Font]ntpdc\fP
+is executed, each of the requests will be sent
+to the NTP servers running on each of the hosts given as command
+line arguments, or on localhost by default.
+If no request options
+are given,
+\f\*[B-Font]ntpdc\fP
+will attempt to read commands from the
+standard input and execute these on the NTP server running on the
+first host given on the command line, again defaulting to localhost
+when no other host is specified.
+The
+\f\*[B-Font]ntpdc\fP
+utility will prompt for
+commands if the standard input is a terminal device.
+.sp \n(Ppu
+.ne 2
+
+The
+\f\*[B-Font]ntpdc\fP
+utility uses NTP mode 7 packets to communicate with the
+NTP server, and hence can be used to query any compatible server on
+the network which permits it.
+Note that since NTP is a UDP protocol
+this communication will be somewhat unreliable, especially over
+large distances in terms of network topology.
+The
+\f\*[B-Font]ntpdc\fP
+utility makes
+no attempt to retransmit requests, and will time requests out if
+the remote host is not heard from within a suitable timeout
+time.
+.sp \n(Ppu
+.ne 2
+
+The operation of
+\f\*[B-Font]ntpdc\fP
+are specific to the particular
+implementation of the
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+daemon and can be expected to
+work only with this and maybe some previous versions of the daemon.
+Requests from a remote
+\f\*[B-Font]ntpdc\fP
+utility which affect the
+state of the local server must be authenticated, which requires
+both the remote program and local server share a common key and key
+identifier.
+.sp \n(Ppu
+.ne 2
+
+Note that in contexts where a host name is expected, a
+\f\*[B-Font]\-4\f[]
+qualifier preceding the host name forces DNS resolution to the IPv4 namespace,
+while a
+\f\*[B-Font]\-6\f[]
+qualifier forces DNS resolution to the IPv6 namespace.
+Specifying a command line option other than
+\f\*[B-Font]\-i\f[]
+or
+\f\*[B-Font]\-n\f[]
+will cause the specified query (queries) to be sent to
+the indicated host(s) immediately.
+Otherwise,
+\f\*[B-Font]ntpdc\fP
+will
+attempt to read interactive format commands from the standard
+input.
+.SS "Interactive Commands"
+Interactive format commands consist of a keyword followed by zero
+to four arguments.
+Only enough characters of the full keyword to
+uniquely identify the command need be typed.
+The output of a
+command is normally sent to the standard output, but optionally the
+output of individual commands may be sent to a file by appending a
+\[oq]\&>\[cq],
+followed by a file name, to the command line.
+.sp \n(Ppu
+.ne 2
+
+A number of interactive format commands are executed entirely
+within the
+\f\*[B-Font]ntpdc\fP
+utility itself and do not result in NTP
+mode 7 requests being sent to a server.
+These are described
+following.
+.TP 7
+.NOP \f\*[B-Font]\&?\f[] \f\*[I-Font]command_keyword\f[]
+.TP 7
+.NOP \f\*[B-Font]help\f[] \f\*[I-Font]command_keyword\f[]
+A
+\[oq]\f\*[B-Font]\&?\f[]\[cq]
+will print a list of all the command
+keywords known to this incarnation of
+\f\*[B-Font]ntpdc\fP.
+A
+\[oq]\f\*[B-Font]\&?\f[]\[cq]
+followed by a command keyword will print function and usage
+information about the command.
+This command is probably a better
+source of information about
+\fCntpq\f[]\fR(1ntpqmdoc)\f[]
+than this manual
+page.
+.TP 7
+.NOP \f\*[B-Font]delay\f[] \f\*[I-Font]milliseconds\f[]
+Specify a time interval to be added to timestamps included in
+requests which require authentication.
+This is used to enable
+(unreliable) server reconfiguration over long delay network paths
+or between machines whose clocks are unsynchronized.
+Actually the
+server does not now require timestamps in authenticated requests,
+so this command may be obsolete.
+.TP 7
+.NOP \f\*[B-Font]host\f[] \f\*[I-Font]hostname\f[]
+Set the host to which future queries will be sent.
+Hostname may
+be either a host name or a numeric address.
+.TP 7
+.NOP \f\*[B-Font]hostnames\f[] [\f\*[B-Font]yes\f[] | \f\*[B-Font]no\f[]]
+If
+\f\*[B-Font]yes\f[]
+is specified, host names are printed in
+information displays.
+If
+\f\*[B-Font]no\f[]
+is specified, numeric
+addresses are printed instead.
+The default is
+\f\*[B-Font]yes\f[],
+unless
+modified using the command line
+\f\*[B-Font]\-n\f[]
+switch.
+.TP 7
+.NOP \f\*[B-Font]keyid\f[] \f\*[I-Font]keyid\f[]
+This command allows the specification of a key number to be
+used to authenticate configuration requests.
+This must correspond
+to a key number the server has been configured to use for this
+purpose.
+.TP 7
+.NOP \f\*[B-Font]quit\f[]
+Exit
+\f\*[B-Font]ntpdc\fP.
+.TP 7
+.NOP \f\*[B-Font]passwd\f[]
+This command prompts you to type in a password (which will not
+be echoed) which will be used to authenticate configuration
+requests.
+The password must correspond to the key configured for
+use by the NTP server for this purpose if such requests are to be
+successful.
+.TP 7
+.NOP \f\*[B-Font]timeout\f[] \f\*[I-Font]milliseconds\f[]
+Specify a timeout period for responses to server queries.
+The
+default is about 8000 milliseconds.
+Note that since
+\f\*[B-Font]ntpdc\fP
+retries each query once after a timeout, the total waiting time for
+a timeout will be twice the timeout value set.
+.PP
+.SS "Control Message Commands"
+Query commands result in NTP mode 7 packets containing requests for
+information being sent to the server.
+These are read-only commands
+in that they make no modification of the server configuration
+state.
+.TP 7
+.NOP \f\*[B-Font]listpeers\f[]
+Obtains and prints a brief list of the peers for which the
+server is maintaining state.
+These should include all configured
+peer associations as well as those peers whose stratum is such that
+they are considered by the server to be possible future
+synchronization candidates.
+.TP 7
+.NOP \f\*[B-Font]peers\f[]
+Obtains a list of peers for which the server is maintaining
+state, along with a summary of that state.
+Summary information
+includes the address of the remote peer, the local interface
+address (0.0.0.0 if a local address has yet to be determined), the
+stratum of the remote peer (a stratum of 16 indicates the remote
+peer is unsynchronized), the polling interval, in seconds, the
+reachability register, in octal, and the current estimated delay,
+offset and dispersion of the peer, all in seconds.
+.sp \n(Ppu
+.ne 2
+
+The character in the left margin indicates the mode this peer
+entry is operating in.
+A
+\[oq]\&+\[cq]
+denotes symmetric active, a
+\[oq]\&-\[cq]
+indicates symmetric passive, a
+\[oq]\&=\[cq]
+means the
+remote server is being polled in client mode, a
+\[oq]\&^\[cq]
+indicates that the server is broadcasting to this address, a
+\[oq]\&~\[cq]
+denotes that the remote peer is sending broadcasts and a
+\[oq]\&~\[cq]
+denotes that the remote peer is sending broadcasts and a
+\[oq]\&*\[cq]
+marks the peer the server is currently synchronizing
+to.
+.sp \n(Ppu
+.ne 2
+
+The contents of the host field may be one of four forms.
+It may
+be a host name, an IP address, a reference clock implementation
+name with its parameter or
+\fBREFCLK\f[]\fR()\f[]
+On
+\f\*[B-Font]hostnames\f[]
+\f\*[B-Font]no\f[]
+only IP-addresses
+will be displayed.
+.TP 7
+.NOP \f\*[B-Font]dmpeers\f[]
+A slightly different peer summary list.
+Identical to the output
+of the
+\f\*[B-Font]peers\f[]
+command, except for the character in the
+leftmost column.
+Characters only appear beside peers which were
+included in the final stage of the clock selection algorithm.
+A
+\[oq]\&.\[cq]
+indicates that this peer was cast off in the falseticker
+detection, while a
+\[oq]\&+\[cq]
+indicates that the peer made it
+through.
+A
+\[oq]\&*\[cq]
+denotes the peer the server is currently
+synchronizing with.
+.TP 7
+.NOP \f\*[B-Font]showpeer\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]...\f[]]
+Shows a detailed display of the current peer variables for one
+or more peers.
+Most of these values are described in the NTP
+Version 2 specification.
+.TP 7
+.NOP \f\*[B-Font]pstats\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]...\f[]]
+Show per-peer statistic counters associated with the specified
+peer(s).
+.TP 7
+.NOP \f\*[B-Font]clockstat\f[] \f\*[I-Font]clock_peer_address\f[] [\f\*[I-Font]...\f[]]
+Obtain and print information concerning a peer clock.
+The
+values obtained provide information on the setting of fudge factors
+and other clock performance information.
+.TP 7
+.NOP \f\*[B-Font]kerninfo\f[]
+Obtain and print kernel phase-lock loop operating parameters.
+This information is available only if the kernel has been specially
+modified for a precision timekeeping function.
+.TP 7
+.NOP \f\*[B-Font]loopinfo\f[] [\f\*[B-Font]oneline\f[] | \f\*[B-Font]multiline\f[]]
+Print the values of selected loop filter variables.
+The loop
+filter is the part of NTP which deals with adjusting the local
+system clock.
+The
+\[oq]offset\[cq]
+is the last offset given to the
+loop filter by the packet processing code.
+The
+\[oq]frequency\[cq]
+is the frequency error of the local clock in parts-per-million
+(ppm).
+The
+\[oq]time_const\[cq]
+controls the stiffness of the
+phase-lock loop and thus the speed at which it can adapt to
+oscillator drift.
+The
+\[oq]watchdog timer\[cq]
+value is the number
+of seconds which have elapsed since the last sample offset was
+given to the loop filter.
+The
+\f\*[B-Font]oneline\f[]
+and
+\f\*[B-Font]multiline\f[]
+options specify the format in which this
+information is to be printed, with
+\f\*[B-Font]multiline\f[]
+as the
+default.
+.TP 7
+.NOP \f\*[B-Font]sysinfo\f[]
+Print a variety of system state variables, i.e., state related
+to the local server.
+All except the last four lines are described
+in the NTP Version 3 specification, RFC-1305.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]system flags\[cq]
+show various system flags, some of
+which can be set and cleared by the
+\f\*[B-Font]enable\f[]
+and
+\f\*[B-Font]disable\f[]
+configuration commands, respectively.
+These are
+the
+\f\*[B-Font]auth\f[],
+\f\*[B-Font]bclient\f[],
+\f\*[B-Font]monitor\f[],
+\f\*[B-Font]pll\f[],
+\f\*[B-Font]pps\f[]
+and
+\f\*[B-Font]stats\f[]
+flags.
+See the
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+documentation for the meaning of these flags.
+There
+are two additional flags which are read only, the
+\f\*[B-Font]kernel_pll\f[]
+and
+\f\*[B-Font]kernel_pps\f[].
+These flags indicate
+the synchronization status when the precision time kernel
+modifications are in use.
+The
+\[oq]kernel_pll\[cq]
+indicates that
+the local clock is being disciplined by the kernel, while the
+\[oq]kernel_pps\[cq]
+indicates the kernel discipline is provided by the PPS
+signal.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]stability\[cq]
+is the residual frequency error remaining
+after the system frequency correction is applied and is intended for
+maintenance and debugging.
+In most architectures, this value will
+initially decrease from as high as 500 ppm to a nominal value in
+the range .01 to 0.1 ppm.
+If it remains high for some time after
+starting the daemon, something may be wrong with the local clock,
+or the value of the kernel variable
+\fIkern.clockrate.tick\f[]
+may be
+incorrect.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]broadcastdelay\[cq]
+shows the default broadcast delay,
+as set by the
+\f\*[B-Font]broadcastdelay\f[]
+configuration command.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]authdelay\[cq]
+shows the default authentication delay,
+as set by the
+\f\*[B-Font]authdelay\f[]
+configuration command.
+.TP 7
+.NOP \f\*[B-Font]sysstats\f[]
+Print statistics counters maintained in the protocol
+module.
+.TP 7
+.NOP \f\*[B-Font]memstats\f[]
+Print statistics counters related to memory allocation
+code.
+.TP 7
+.NOP \f\*[B-Font]iostats\f[]
+Print statistics counters maintained in the input-output
+module.
+.TP 7
+.NOP \f\*[B-Font]timerstats\f[]
+Print statistics counters maintained in the timer/event queue
+support code.
+.TP 7
+.NOP \f\*[B-Font]reslist\f[]
+Obtain and print the server's restriction list.
+This list is
+(usually) printed in sorted order and may help to understand how
+the restrictions are applied.
+.TP 7
+.NOP \f\*[B-Font]monlist\f[] [\f\*[I-Font]version\f[]]
+Obtain and print traffic counts collected and maintained by the
+monitor facility.
+The version number should not normally need to be
+specified.
+.TP 7
+.NOP \f\*[B-Font]clkbug\f[] \f\*[I-Font]clock_peer_address\f[] [\f\*[I-Font]...\f[]]
+Obtain debugging information for a reference clock driver.
+This
+information is provided only by some clock drivers and is mostly
+undecodable without a copy of the driver source in hand.
+.PP
+.SS "Runtime Configuration Requests"
+All requests which cause state changes in the server are
+authenticated by the server using a configured NTP key (the
+facility can also be disabled by the server by not configuring a
+key).
+The key number and the corresponding key must also be made
+known to
+\f\*[B-Font]ntpdc\fP.
+This can be done using the
+\f\*[B-Font]keyid\f[]
+and
+\f\*[B-Font]passwd\f[]
+commands, the latter of which will prompt at the terminal for a
+password to use as the encryption key.
+You will also be prompted
+automatically for both the key number and password the first time a
+command which would result in an authenticated request to the
+server is given.
+Authentication not only provides verification that
+the requester has permission to make such changes, but also gives
+an extra degree of protection again transmission errors.
+.sp \n(Ppu
+.ne 2
+
+Authenticated requests always include a timestamp in the packet
+data, which is included in the computation of the authentication
+code.
+This timestamp is compared by the server to its receive time
+stamp.
+If they differ by more than a small amount the request is
+rejected.
+This is done for two reasons.
+First, it makes simple
+replay attacks on the server, by someone who might be able to
+overhear traffic on your LAN, much more difficult.
+Second, it makes
+it more difficult to request configuration changes to your server
+from topologically remote hosts.
+While the reconfiguration facility
+will work well with a server on the local host, and may work
+adequately between time-synchronized hosts on the same LAN, it will
+work very poorly for more distant hosts.
+As such, if reasonable
+passwords are chosen, care is taken in the distribution and
+protection of keys and appropriate source address restrictions are
+applied, the run time reconfiguration facility should provide an
+adequate level of security.
+.sp \n(Ppu
+.ne 2
+
+The following commands all make authenticated requests.
+.TP 7
+.NOP \f\*[B-Font]addpeer\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]keyid\f[]] [\f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]]
+Add a configured peer association at the given address and
+operating in symmetric active mode.
+Note that an existing
+association with the same peer may be deleted when this command is
+executed, or may simply be converted to conform to the new
+configuration, as appropriate.
+If the optional
+\f\*[I-Font]keyid\f[]
+is a
+nonzero integer, all outgoing packets to the remote server will
+have an authentication field attached encrypted with this key.
+If
+the value is 0 (or not given) no authentication will be done.
+The
+\f\*[I-Font]version\f[]
+can be 1, 2 or 3 and defaults to 3.
+The
+\f\*[B-Font]prefer\f[]
+keyword indicates a preferred peer (and thus will
+be used primarily for clock synchronisation if possible).
+The
+preferred peer also determines the validity of the PPS signal \- if
+the preferred peer is suitable for synchronisation so is the PPS
+signal.
+.TP 7
+.NOP \f\*[B-Font]addserver\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]keyid\f[]] [\f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]]
+Identical to the addpeer command, except that the operating
+mode is client.
+.TP 7
+.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]keyid\f[]] [\f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]]
+Identical to the addpeer command, except that the operating
+mode is broadcast.
+In this case a valid key identifier and key are
+required.
+The
+\f\*[I-Font]peer_address\f[]
+parameter can be the broadcast
+address of the local network or a multicast group address assigned
+to NTP.
+If a multicast address, a multicast-capable kernel is
+required.
+.TP 7
+.NOP \f\*[B-Font]unconfig\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]...\f[]]
+This command causes the configured bit to be removed from the
+specified peer(s).
+In many cases this will cause the peer
+association to be deleted.
+When appropriate, however, the
+association may persist in an unconfigured mode if the remote peer
+is willing to continue on in this fashion.
+.TP 7
+.NOP \f\*[B-Font]fudge\f[] \f\*[I-Font]peer_address\f[] [\f\*[B-Font]time1\f[]] [\f\*[B-Font]time2\f[]] [\f\*[I-Font]stratum\f[]] [\f\*[I-Font]refid\f[]]
+This command provides a way to set certain data for a reference
+clock.
+See the source listing for further information.
+.TP 7
+.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]pps\f[] | \f\*[B-Font]stats\f[]]
+.TP 7
+.NOP \f\*[B-Font]disable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]pps\f[] | \f\*[B-Font]stats\f[]]
+These commands operate in the same way as the
+\f\*[B-Font]enable\f[]
+and
+\f\*[B-Font]disable\f[]
+configuration file commands of
+\fCntpd\f[]\fR(1ntpdmdoc)\f[].
+.RS
+.TP 7
+.NOP \f\*[B-Font]auth\f[]
+Enables the server to synchronize with unconfigured peers only
+if the peer has been correctly authenticated using either public key
+or private key cryptography.
+The default for this flag is enable.
+.TP 7
+.NOP \f\*[B-Font]bclient\f[]
+Enables the server to listen for a message from a broadcast or
+multicast server, as in the multicastclient command with
+default address.
+The default for this flag is disable.
+.TP 7
+.NOP \f\*[B-Font]calibrate\f[]
+Enables the calibrate feature for reference clocks.
+The default for this flag is disable.
+.TP 7
+.NOP \f\*[B-Font]kernel\f[]
+Enables the kernel time discipline, if available.
+The default for this flag is enable if support is available, otherwise disable.
+.TP 7
+.NOP \f\*[B-Font]monitor\f[]
+Enables the monitoring facility.
+See the documentation here about the
+\f\*[B-Font]monlist\f[]
+command or further information.
+The default for this flag is enable.
+.TP 7
+.NOP \f\*[B-Font]ntp\f[]
+Enables time and frequency discipline.
+In effect, this switch opens and closes the feedback loop,
+which is useful for testing.
+The default for this flag is enable.
+.TP 7
+.NOP \f\*[B-Font]pps\f[]
+Enables the pulse-per-second (PPS) signal when frequency
+and time is disciplined by the precision time kernel modifications.
+See the
+"A Kernel Model for Precision Timekeeping"
+(available as part of the HTML documentation
+provided in
+\fI/usr/share/doc/ntp\f[])
+page for further information.
+The default for this flag is disable.
+.TP 7
+.NOP \f\*[B-Font]stats\f[]
+Enables the statistics facility.
+See the
+\fIMonitoring\f[] \fIOptions\f[]
+section of
+\fCntp.conf\f[]\fR(5)\f[]
+for further information.
+The default for this flag is disable.
+.RE
+.TP 7
+.NOP \f\*[B-Font]restrict\f[] \f\*[I-Font]address\f[] \f\*[I-Font]mask\f[] \f\*[I-Font]flag\f[] [\f\*[I-Font]...\f[]]
+This command operates in the same way as the
+\f\*[B-Font]restrict\f[]
+configuration file commands of
+\fCntpd\f[]\fR(1ntpdmdoc)\f[].
+.TP 7
+.NOP \f\*[B-Font]unrestrict\f[] \f\*[I-Font]address\f[] \f\*[I-Font]mask\f[] \f\*[I-Font]flag\f[] [\f\*[I-Font]...\f[]]
+Unrestrict the matching entry from the restrict list.
+.TP 7
+.NOP \f\*[B-Font]delrestrict\f[] \f\*[I-Font]address\f[] \f\*[I-Font]mask\f[] [\f\*[B-Font]ntpport\f[]]
+Delete the matching entry from the restrict list.
+.TP 7
+.NOP \f\*[B-Font]readkeys\f[]
+Causes the current set of authentication keys to be purged and
+a new set to be obtained by rereading the keys file (which must
+have been specified in the
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+configuration file).
+This
+allows encryption keys to be changed without restarting the
+server.
+.TP 7
+.NOP \f\*[B-Font]trustedkey\f[] \f\*[I-Font]keyid\f[] [\f\*[I-Font]...\f[]]
+.TP 7
+.NOP \f\*[B-Font]untrustedkey\f[] \f\*[I-Font]keyid\f[] [\f\*[I-Font]...\f[]]
+These commands operate in the same way as the
+\f\*[B-Font]trustedkey\f[]
+and
+\f\*[B-Font]untrustedkey\f[]
+configuration file
+commands of
+\fCntpd\f[]\fR(1ntpdmdoc)\f[].
+.TP 7
+.NOP \f\*[B-Font]authinfo\f[]
+Returns information concerning the authentication module,
+including known keys and counts of encryptions and decryptions
+which have been done.
+.TP 7
+.NOP \f\*[B-Font]traps\f[]
+Display the traps set in the server.
+See the source listing for
+further information.
+.TP 7
+.NOP \f\*[B-Font]addtrap\f[] \f\*[I-Font]address\f[] [\f\*[I-Font]port\f[]] [\f\*[I-Font]interface\f[]]
+Set a trap for asynchronous messages.
+See the source listing
+for further information.
+.TP 7
+.NOP \f\*[B-Font]clrtrap\f[] \f\*[I-Font]address\f[] [\f\*[I-Font]port\f[]] [\f\*[I-Font]interface\f[]]
+Clear a trap for asynchronous messages.
+See the source listing
+for further information.
+.TP 7
+.NOP \f\*[B-Font]reset\f[]
+Clear the statistics counters in various modules of the server.
+See the source listing for further information.
+.PP
+.SH "ENVIRONMENT"
+See \fBOPTION PRESETS\fP for configuration environment variables.
+.SH "FILES"
+See \fBOPTION PRESETS\fP for configuration files.
+.SH "EXIT STATUS"
+One of the following exit values will be returned:
+.TP
+.NOP 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.TP
+.NOP 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.TP
+.NOP 66 " (EX_NOINPUT)"
+A specified configuration file could not be loaded.
+.TP
+.NOP 70 " (EX_SOFTWARE)"
+libopts had an internal operational error. Please report
+it to autogen-users@lists.sourceforge.net. Thank you.
+.PP
+.SH "SEE ALSO"
+\fCntp.conf\f[]\fR(5)\f[],
+\fCntpd\f[]\fR(1ntpdmdoc)\f[]
+David L. Mills,
+\fINetwork Time Protocol (Version 3)\fR,
+RFC1305
+.PP
+
+.SH AUTHORS
+The formatting directives in this document came from FreeBSD.
+.SH "COPYRIGHT"
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
+This program is released under the terms of the NTP license, <http://ntp.org/license>.
+.SH BUGS
+The
+\f\*[B-Font]ntpdc\fP
+utility is a crude hack.
+Much of the information it shows is
+deadly boring and could only be loved by its implementer.
+The
+program was designed so that new (and temporary) features were easy
+to hack in, at great expense to the program's ease of use.
+Despite
+this, the program is occasionally useful.
+.sp \n(Ppu
+.ne 2
+
+Please report bugs to http://bugs.ntp.org .
+.sp \n(Ppu
+.ne 2
+
+Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
+.SH "NOTES"
+This manual page was \fIAutoGen\fP-erated from the \fBntpdc\fP
+option definitions.
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
new file mode 100644
index 0000000..534a6d4
--- /dev/null
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
@@ -0,0 +1,809 @@
+.Dd June 29 2015
+.Dt NTPDC 1ntpdcmdoc User Commands
+.Os
+.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
+.\"
+.\" It has been AutoGen-ed June 29, 2015 at 04:31:08 PM by AutoGen 5.18.5
+.\" From the definitions ntpdc-opts.def
+.\" and the template file agmdoc-cmd.tpl
+.Sh NAME
+.Nm ntpdc
+.Nd vendor-specific NTPD control program
+.Sh SYNOPSIS
+.Nm
+.\" Mixture of short (flag) options and long options
+.Op Fl flags
+.Op Fl flag Op Ar value
+.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
+[ host ...]
+.Pp
+.Sh DESCRIPTION
+.Nm
+is deprecated.
+Please use
+.Xr ntpq 1ntpqmdoc instead \- it can do everything
+.Nm
+used to do, and it does so using a much more sane interface.
+.Pp
+.Nm
+is a utility program used to query
+.Xr ntpd 1ntpdmdoc
+about its
+current state and to request changes in that state.
+It uses NTP mode 7 control message formats described in the source code.
+The program may
+be run either in interactive mode or controlled using command line
+arguments.
+Extensive state and statistics information is available
+through the
+.Nm
+interface.
+In addition, nearly all the
+configuration options which can be specified at startup using
+ntpd's configuration file may also be specified at run time using
+.Nm .
+.Sh "OPTIONS"
+.Bl -tag
+.It Fl 4 , Fl \-ipv4
+Force IPv4 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv6.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv4 namespace.
+.It Fl 6 , Fl \-ipv6
+Force IPv6 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv4.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv6 namespace.
+.It Fl c Ar cmd , Fl \-command Ns = Ns Ar cmd
+run a command and exit.
+This option may appear an unlimited number of times.
+.sp
+The following argument is interpreted as an interactive format command
+and is added to the list of commands to be executed on the specified
+host(s).
+.It Fl d , Fl \-debug\-level
+Increase debug verbosity level.
+This option may appear an unlimited number of times.
+.sp
+.It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
+Set the debug verbosity level.
+This option may appear an unlimited number of times.
+This option takes an integer number as its argument.
+.sp
+.It Fl i , Fl \-interactive
+Force ntpq to operate in interactive mode.
+This option must not appear in combination with any of the following options:
+command, listpeers, peers, showpeers.
+.sp
+Force ntpq to operate in interactive mode. Prompts will be written
+to the standard output and commands read from the standard input.
+.It Fl l , Fl \-listpeers
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary of
+their state. This is equivalent to the 'listpeers' interactive command.
+.It Fl n , Fl \-numeric
+numeric host addresses.
+.sp
+Output all host addresses in dotted\-quad numeric format rather than
+converting to the canonical host names.
+.It Fl p , Fl \-peers
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'peers' interactive command.
+.It Fl s , Fl \-showpeers
+Show a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'dmpeers' interactive command.
+.It Fl \&? , Fl \-help
+Display usage information and exit.
+.It Fl \&! , Fl \-more\-help
+Pass the extended usage information through a pager.
+.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
+Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+The command will exit after updating the config file.
+.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
+Load options from \fIcfgfile\fP.
+The \fIno\-load\-opts\fP form will disable the loading
+of earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early,
+out of order.
+.It Fl \-version Op Brq Ar v|c|n
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.
+.El
+.Sh "OPTION PRESETS"
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from configuration ("RC" or ".INI") file(s) and values from
+environment variables named:
+.nf
+ \fBNTPDC_<option\-name>\fP or \fBNTPDC\fP
+.fi
+.ad
+The environmental presets take precedence (are processed later than)
+the configuration files.
+The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
+If any of these are directories, then the file \fI.ntprc\fP
+is searched for within those directories.
+.Sh USAGE
+If one or more request options are included on the command line
+when
+.Nm
+is executed, each of the requests will be sent
+to the NTP servers running on each of the hosts given as command
+line arguments, or on localhost by default.
+If no request options
+are given,
+.Nm
+will attempt to read commands from the
+standard input and execute these on the NTP server running on the
+first host given on the command line, again defaulting to localhost
+when no other host is specified.
+The
+.Nm
+utility will prompt for
+commands if the standard input is a terminal device.
+.Pp
+The
+.Nm
+utility uses NTP mode 7 packets to communicate with the
+NTP server, and hence can be used to query any compatible server on
+the network which permits it.
+Note that since NTP is a UDP protocol
+this communication will be somewhat unreliable, especially over
+large distances in terms of network topology.
+The
+.Nm
+utility makes
+no attempt to retransmit requests, and will time requests out if
+the remote host is not heard from within a suitable timeout
+time.
+.Pp
+The operation of
+.Nm
+are specific to the particular
+implementation of the
+.Xr ntpd 1ntpdmdoc
+daemon and can be expected to
+work only with this and maybe some previous versions of the daemon.
+Requests from a remote
+.Nm
+utility which affect the
+state of the local server must be authenticated, which requires
+both the remote program and local server share a common key and key
+identifier.
+.Pp
+Note that in contexts where a host name is expected, a
+.Fl 4
+qualifier preceding the host name forces DNS resolution to the IPv4 namespace,
+while a
+.Fl 6
+qualifier forces DNS resolution to the IPv6 namespace.
+Specifying a command line option other than
+.Fl i
+or
+.Fl n
+will cause the specified query (queries) to be sent to
+the indicated host(s) immediately.
+Otherwise,
+.Nm
+will
+attempt to read interactive format commands from the standard
+input.
+.Ss "Interactive Commands"
+Interactive format commands consist of a keyword followed by zero
+to four arguments.
+Only enough characters of the full keyword to
+uniquely identify the command need be typed.
+The output of a
+command is normally sent to the standard output, but optionally the
+output of individual commands may be sent to a file by appending a
+.Ql \&> ,
+followed by a file name, to the command line.
+.Pp
+A number of interactive format commands are executed entirely
+within the
+.Nm
+utility itself and do not result in NTP
+mode 7 requests being sent to a server.
+These are described
+following.
+.Bl -tag -width indent
+.It Ic \&? Ar command_keyword
+.It Ic help Ar command_keyword
+A
+.Sq Ic \&?
+will print a list of all the command
+keywords known to this incarnation of
+.Nm .
+A
+.Sq Ic \&?
+followed by a command keyword will print function and usage
+information about the command.
+This command is probably a better
+source of information about
+.Xr ntpq 1ntpqmdoc
+than this manual
+page.
+.It Ic delay Ar milliseconds
+Specify a time interval to be added to timestamps included in
+requests which require authentication.
+This is used to enable
+(unreliable) server reconfiguration over long delay network paths
+or between machines whose clocks are unsynchronized.
+Actually the
+server does not now require timestamps in authenticated requests,
+so this command may be obsolete.
+.It Ic host Ar hostname
+Set the host to which future queries will be sent.
+Hostname may
+be either a host name or a numeric address.
+.It Ic hostnames Op Cm yes | Cm no
+If
+.Cm yes
+is specified, host names are printed in
+information displays.
+If
+.Cm no
+is specified, numeric
+addresses are printed instead.
+The default is
+.Cm yes ,
+unless
+modified using the command line
+.Fl n
+switch.
+.It Ic keyid Ar keyid
+This command allows the specification of a key number to be
+used to authenticate configuration requests.
+This must correspond
+to a key number the server has been configured to use for this
+purpose.
+.It Ic quit
+Exit
+.Nm .
+.It Ic passwd
+This command prompts you to type in a password (which will not
+be echoed) which will be used to authenticate configuration
+requests.
+The password must correspond to the key configured for
+use by the NTP server for this purpose if such requests are to be
+successful.
+.It Ic timeout Ar milliseconds
+Specify a timeout period for responses to server queries.
+The
+default is about 8000 milliseconds.
+Note that since
+.Nm
+retries each query once after a timeout, the total waiting time for
+a timeout will be twice the timeout value set.
+.El
+.Ss "Control Message Commands"
+Query commands result in NTP mode 7 packets containing requests for
+information being sent to the server.
+These are read\-only commands
+in that they make no modification of the server configuration
+state.
+.Bl -tag -width indent
+.It Ic listpeers
+Obtains and prints a brief list of the peers for which the
+server is maintaining state.
+These should include all configured
+peer associations as well as those peers whose stratum is such that
+they are considered by the server to be possible future
+synchronization candidates.
+.It Ic peers
+Obtains a list of peers for which the server is maintaining
+state, along with a summary of that state.
+Summary information
+includes the address of the remote peer, the local interface
+address (0.0.0.0 if a local address has yet to be determined), the
+stratum of the remote peer (a stratum of 16 indicates the remote
+peer is unsynchronized), the polling interval, in seconds, the
+reachability register, in octal, and the current estimated delay,
+offset and dispersion of the peer, all in seconds.
+.Pp
+The character in the left margin indicates the mode this peer
+entry is operating in.
+A
+.Ql \&+
+denotes symmetric active, a
+.Ql \&\-
+indicates symmetric passive, a
+.Ql \&=
+means the
+remote server is being polled in client mode, a
+.Ql \&^
+indicates that the server is broadcasting to this address, a
+.Ql \&~
+denotes that the remote peer is sending broadcasts and a
+.Ql \&~
+denotes that the remote peer is sending broadcasts and a
+.Ql \&*
+marks the peer the server is currently synchronizing
+to.
+.Pp
+The contents of the host field may be one of four forms.
+It may
+be a host name, an IP address, a reference clock implementation
+name with its parameter or
+.Fn REFCLK "implementation_number" "parameter" .
+On
+.Ic hostnames
+.Cm no
+only IP\-addresses
+will be displayed.
+.It Ic dmpeers
+A slightly different peer summary list.
+Identical to the output
+of the
+.Ic peers
+command, except for the character in the
+leftmost column.
+Characters only appear beside peers which were
+included in the final stage of the clock selection algorithm.
+A
+.Ql \&.
+indicates that this peer was cast off in the falseticker
+detection, while a
+.Ql \&+
+indicates that the peer made it
+through.
+A
+.Ql \&*
+denotes the peer the server is currently
+synchronizing with.
+.It Ic showpeer Ar peer_address Oo Ar ... Oc
+Shows a detailed display of the current peer variables for one
+or more peers.
+Most of these values are described in the NTP
+Version 2 specification.
+.It Ic pstats Ar peer_address Oo Ar ... Oc
+Show per\-peer statistic counters associated with the specified
+peer(s).
+.It Ic clockstat Ar clock_peer_address Oo Ar ... Oc
+Obtain and print information concerning a peer clock.
+The
+values obtained provide information on the setting of fudge factors
+and other clock performance information.
+.It Ic kerninfo
+Obtain and print kernel phase\-lock loop operating parameters.
+This information is available only if the kernel has been specially
+modified for a precision timekeeping function.
+.It Ic loopinfo Op Cm oneline | Cm multiline
+Print the values of selected loop filter variables.
+The loop
+filter is the part of NTP which deals with adjusting the local
+system clock.
+The
+.Sq offset
+is the last offset given to the
+loop filter by the packet processing code.
+The
+.Sq frequency
+is the frequency error of the local clock in parts\-per\-million
+(ppm).
+The
+.Sq time_const
+controls the stiffness of the
+phase\-lock loop and thus the speed at which it can adapt to
+oscillator drift.
+The
+.Sq watchdog timer
+value is the number
+of seconds which have elapsed since the last sample offset was
+given to the loop filter.
+The
+.Cm oneline
+and
+.Cm multiline
+options specify the format in which this
+information is to be printed, with
+.Cm multiline
+as the
+default.
+.It Ic sysinfo
+Print a variety of system state variables, i.e., state related
+to the local server.
+All except the last four lines are described
+in the NTP Version 3 specification, RFC\-1305.
+.Pp
+The
+.Sq system flags
+show various system flags, some of
+which can be set and cleared by the
+.Ic enable
+and
+.Ic disable
+configuration commands, respectively.
+These are
+the
+.Cm auth ,
+.Cm bclient ,
+.Cm monitor ,
+.Cm pll ,
+.Cm pps
+and
+.Cm stats
+flags.
+See the
+.Xr ntpd 1ntpdmdoc
+documentation for the meaning of these flags.
+There
+are two additional flags which are read only, the
+.Cm kernel_pll
+and
+.Cm kernel_pps .
+These flags indicate
+the synchronization status when the precision time kernel
+modifications are in use.
+The
+.Sq kernel_pll
+indicates that
+the local clock is being disciplined by the kernel, while the
+.Sq kernel_pps
+indicates the kernel discipline is provided by the PPS
+signal.
+.Pp
+The
+.Sq stability
+is the residual frequency error remaining
+after the system frequency correction is applied and is intended for
+maintenance and debugging.
+In most architectures, this value will
+initially decrease from as high as 500 ppm to a nominal value in
+the range .01 to 0.1 ppm.
+If it remains high for some time after
+starting the daemon, something may be wrong with the local clock,
+or the value of the kernel variable
+.Va kern.clockrate.tick
+may be
+incorrect.
+.Pp
+The
+.Sq broadcastdelay
+shows the default broadcast delay,
+as set by the
+.Ic broadcastdelay
+configuration command.
+.Pp
+The
+.Sq authdelay
+shows the default authentication delay,
+as set by the
+.Ic authdelay
+configuration command.
+.It Ic sysstats
+Print statistics counters maintained in the protocol
+module.
+.It Ic memstats
+Print statistics counters related to memory allocation
+code.
+.It Ic iostats
+Print statistics counters maintained in the input\-output
+module.
+.It Ic timerstats
+Print statistics counters maintained in the timer/event queue
+support code.
+.It Ic reslist
+Obtain and print the server's restriction list.
+This list is
+(usually) printed in sorted order and may help to understand how
+the restrictions are applied.
+.It Ic monlist Op Ar version
+Obtain and print traffic counts collected and maintained by the
+monitor facility.
+The version number should not normally need to be
+specified.
+.It Ic clkbug Ar clock_peer_address Oo Ar ... Oc
+Obtain debugging information for a reference clock driver.
+This
+information is provided only by some clock drivers and is mostly
+undecodable without a copy of the driver source in hand.
+.El
+.Ss "Runtime Configuration Requests"
+All requests which cause state changes in the server are
+authenticated by the server using a configured NTP key (the
+facility can also be disabled by the server by not configuring a
+key).
+The key number and the corresponding key must also be made
+known to
+.Nm .
+This can be done using the
+.Ic keyid
+and
+.Ic passwd
+commands, the latter of which will prompt at the terminal for a
+password to use as the encryption key.
+You will also be prompted
+automatically for both the key number and password the first time a
+command which would result in an authenticated request to the
+server is given.
+Authentication not only provides verification that
+the requester has permission to make such changes, but also gives
+an extra degree of protection again transmission errors.
+.Pp
+Authenticated requests always include a timestamp in the packet
+data, which is included in the computation of the authentication
+code.
+This timestamp is compared by the server to its receive time
+stamp.
+If they differ by more than a small amount the request is
+rejected.
+This is done for two reasons.
+First, it makes simple
+replay attacks on the server, by someone who might be able to
+overhear traffic on your LAN, much more difficult.
+Second, it makes
+it more difficult to request configuration changes to your server
+from topologically remote hosts.
+While the reconfiguration facility
+will work well with a server on the local host, and may work
+adequately between time\-synchronized hosts on the same LAN, it will
+work very poorly for more distant hosts.
+As such, if reasonable
+passwords are chosen, care is taken in the distribution and
+protection of keys and appropriate source address restrictions are
+applied, the run time reconfiguration facility should provide an
+adequate level of security.
+.Pp
+The following commands all make authenticated requests.
+.Bl -tag -width indent
+.It Xo Ic addpeer Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Add a configured peer association at the given address and
+operating in symmetric active mode.
+Note that an existing
+association with the same peer may be deleted when this command is
+executed, or may simply be converted to conform to the new
+configuration, as appropriate.
+If the optional
+.Ar keyid
+is a
+nonzero integer, all outgoing packets to the remote server will
+have an authentication field attached encrypted with this key.
+If
+the value is 0 (or not given) no authentication will be done.
+The
+.Ar version
+can be 1, 2 or 3 and defaults to 3.
+The
+.Cm prefer
+keyword indicates a preferred peer (and thus will
+be used primarily for clock synchronisation if possible).
+The
+preferred peer also determines the validity of the PPS signal \- if
+the preferred peer is suitable for synchronisation so is the PPS
+signal.
+.It Xo Ic addserver Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Identical to the addpeer command, except that the operating
+mode is client.
+.It Xo Ic broadcast Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Identical to the addpeer command, except that the operating
+mode is broadcast.
+In this case a valid key identifier and key are
+required.
+The
+.Ar peer_address
+parameter can be the broadcast
+address of the local network or a multicast group address assigned
+to NTP.
+If a multicast address, a multicast\-capable kernel is
+required.
+.It Ic unconfig Ar peer_address Oo Ar ... Oc
+This command causes the configured bit to be removed from the
+specified peer(s).
+In many cases this will cause the peer
+association to be deleted.
+When appropriate, however, the
+association may persist in an unconfigured mode if the remote peer
+is willing to continue on in this fashion.
+.It Xo Ic fudge Ar peer_address
+.Op Cm time1
+.Op Cm time2
+.Op Ar stratum
+.Op Ar refid
+.Xc
+This command provides a way to set certain data for a reference
+clock.
+See the source listing for further information.
+.It Xo Ic enable
+.Oo
+.Cm auth | Cm bclient |
+.Cm calibrate | Cm kernel |
+.Cm monitor | Cm ntp |
+.Cm pps | Cm stats
+.Oc
+.Xc
+.It Xo Ic disable
+.Oo
+.Cm auth | Cm bclient |
+.Cm calibrate | Cm kernel |
+.Cm monitor | Cm ntp |
+.Cm pps | Cm stats
+.Oc
+.Xc
+These commands operate in the same way as the
+.Ic enable
+and
+.Ic disable
+configuration file commands of
+.Xr ntpd 1ntpdmdoc .
+.Bl -tag -width indent
+.It Cm auth
+Enables the server to synchronize with unconfigured peers only
+if the peer has been correctly authenticated using either public key
+or private key cryptography.
+The default for this flag is enable.
+.It Cm bclient
+Enables the server to listen for a message from a broadcast or
+multicast server, as in the multicastclient command with
+default address.
+The default for this flag is disable.
+.It Cm calibrate
+Enables the calibrate feature for reference clocks.
+The default for this flag is disable.
+.It Cm kernel
+Enables the kernel time discipline, if available.
+The default for this flag is enable if support is available, otherwise disable.
+.It Cm monitor
+Enables the monitoring facility.
+See the documentation here about the
+.Cm monlist
+command or further information.
+The default for this flag is enable.
+.It Cm ntp
+Enables time and frequency discipline.
+In effect, this switch opens and closes the feedback loop,
+which is useful for testing.
+The default for this flag is enable.
+.It Cm pps
+Enables the pulse\-per\-second (PPS) signal when frequency
+and time is disciplined by the precision time kernel modifications.
+See the
+.Qq A Kernel Model for Precision Timekeeping
+(available as part of the HTML documentation
+provided in
+.Pa /usr/share/doc/ntp )
+page for further information.
+The default for this flag is disable.
+.It Cm stats
+Enables the statistics facility.
+See the
+.Sx Monitoring Options
+section of
+.Xr ntp.conf 5
+for further information.
+The default for this flag is disable.
+.El
+.It Xo Ic restrict Ar address Ar mask
+.Ar flag Oo Ar ... Oc
+.Xc
+This command operates in the same way as the
+.Ic restrict
+configuration file commands of
+.Xr ntpd 1ntpdmdoc .
+.It Xo Ic unrestrict Ar address Ar mask
+.Ar flag Oo Ar ... Oc
+.Xc
+Unrestrict the matching entry from the restrict list.
+.It Xo Ic delrestrict Ar address Ar mask
+.Op Cm ntpport
+.Xc
+Delete the matching entry from the restrict list.
+.It Ic readkeys
+Causes the current set of authentication keys to be purged and
+a new set to be obtained by rereading the keys file (which must
+have been specified in the
+.Xr ntpd 1ntpdmdoc
+configuration file).
+This
+allows encryption keys to be changed without restarting the
+server.
+.It Ic trustedkey Ar keyid Oo Ar ... Oc
+.It Ic untrustedkey Ar keyid Oo Ar ... Oc
+These commands operate in the same way as the
+.Ic trustedkey
+and
+.Ic untrustedkey
+configuration file
+commands of
+.Xr ntpd 1ntpdmdoc .
+.It Ic authinfo
+Returns information concerning the authentication module,
+including known keys and counts of encryptions and decryptions
+which have been done.
+.It Ic traps
+Display the traps set in the server.
+See the source listing for
+further information.
+.It Xo Ic addtrap Ar address
+.Op Ar port
+.Op Ar interface
+.Xc
+Set a trap for asynchronous messages.
+See the source listing
+for further information.
+.It Xo Ic clrtrap Ar address
+.Op Ar port
+.Op Ar interface
+.Xc
+Clear a trap for asynchronous messages.
+See the source listing
+for further information.
+.It Ic reset
+Clear the statistics counters in various modules of the server.
+See the source listing for further information.
+.El
+.Sh "ENVIRONMENT"
+See \fBOPTION PRESETS\fP for configuration environment variables.
+.Sh "FILES"
+See \fBOPTION PRESETS\fP for configuration files.
+.Sh "EXIT STATUS"
+One of the following exit values will be returned:
+.Bl -tag
+.It 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.It 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.It 66 " (EX_NOINPUT)"
+A specified configuration file could not be loaded.
+.It 70 " (EX_SOFTWARE)"
+libopts had an internal operational error. Please report
+it to autogen\-users@lists.sourceforge.net. Thank you.
+.El
+.Sh "SEE ALSO"
+.Xr ntp.conf 5 ,
+.Xr ntpd 1ntpdmdoc
+.Rs
+.%A David L. Mills
+.%T Network Time Protocol (Version 3)
+.%O RFC1305
+.Re
+.Sh AUTHORS
+The formatting directives in this document came from FreeBSD.
+.Sh "COPYRIGHT"
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
+This program is released under the terms of the NTP license, <http://ntp.org/license>.
+.Sh BUGS
+The
+.Nm
+utility is a crude hack.
+Much of the information it shows is
+deadly boring and could only be loved by its implementer.
+The
+program was designed so that new (and temporary) features were easy
+to hack in, at great expense to the program's ease of use.
+Despite
+this, the program is occasionally useful.
+.Pp
+Please report bugs to http://bugs.ntp.org .
+.Pp
+Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
+.Sh "NOTES"
+This manual page was \fIAutoGen\fP\-erated from the \fBntpdc\fP
+option definitions.
diff --git a/contrib/ntp/ntpdc/ntpdc.c b/contrib/ntp/ntpdc/ntpdc.c
index 9126533..ce35bd4 100644
--- a/contrib/ntp/ntpdc/ntpdc.c
+++ b/contrib/ntp/ntpdc/ntpdc.c
@@ -1,36 +1,38 @@
/*
* ntpdc - control and monitor your ntpd daemon
*/
-
+#include <config.h>
#include <stdio.h>
-
+#include <stddef.h>
#include <ctype.h>
#include <signal.h>
#include <setjmp.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+#ifdef SYS_WINNT
+# include <mswsock.h>
+#endif
+#include <isc/net.h>
+#include <isc/result.h>
#include "ntpdc.h"
#include "ntp_select.h"
-#include "ntp_io.h"
#include "ntp_stdlib.h"
-/* Don't include ISC's version of IPv6 variables and structures */
-#define ISC_IPV6_H 1
-#include "isc/net.h"
-#include "isc/result.h"
+#include "ntp_assert.h"
+#include "ntp_lineedit.h"
+#ifdef OPENSSL
+#include "openssl/evp.h"
+#include "openssl/objects.h"
+#endif
+#include <ssl_applink.c>
+#include "ntp_libopts.h"
#include "ntpdc-opts.h"
-#ifdef SYS_WINNT
-# include <Mswsock.h>
-# include <io.h>
-#else
-# define closesocket close
-#endif /* SYS_WINNT */
-
-#if defined(HAVE_LIBREADLINE) || defined (HAVE_LIBEDIT)
-# include <readline/readline.h>
-# include <readline/history.h>
-#endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */
-
#ifdef SYS_VXWORKS
/* vxWorks needs mode flag -casey*/
# define open(name, flags) open(name, flags, 0777)
@@ -56,12 +58,8 @@ static const char * prompt = "ntpdc> "; /* prompt to ask him about */
static u_long info_auth_keyid;
static int keyid_entered = 0;
-/*
- * Type of key md5
- */
-#define KEY_TYPE_MD5 4
-
-static int info_auth_keytype = KEY_TYPE_MD5; /* MD5 */
+static int info_auth_keytype = NID_md5; /* MD5 */
+static size_t info_auth_hashlen = 16; /* MD5 */
u_long current_time; /* needed by authkeys; not used */
/*
@@ -69,42 +67,40 @@ u_long current_time; /* needed by authkeys; not used */
*/
s_char sys_precision; /* local clock precision (log2 s) */
-int ntpdcmain P((int, char **));
+int ntpdcmain (int, char **);
/*
* Built in command handler declarations
*/
-static int openhost P((const char *));
-static int sendpkt P((char *, int));
-static void growpktdata P((void));
-static int getresponse P((int, int, int *, int *, char **, int));
-static int sendrequest P((int, int, int, int, int, char *));
-static void getcmds P((void));
-static RETSIGTYPE abortcmd P((int));
-static void docmd P((const char *));
-static void tokenize P((const char *, char **, int *));
-static int findcmd P((char *, struct xcmd *, struct xcmd *, struct xcmd **));
-static int getarg P((char *, int, arg_v *));
-static int getnetnum P((const char *, struct sockaddr_storage *, char *, int));
-static void help P((struct parse *, FILE *));
-#ifdef QSORT_USES_VOID_P
-static int helpsort P((const void *, const void *));
-#else
-static int helpsort P((char **, char **));
-#endif
-static void printusage P((struct xcmd *, FILE *));
-static void timeout P((struct parse *, FILE *));
-static void my_delay P((struct parse *, FILE *));
-static void host P((struct parse *, FILE *));
-static void keyid P((struct parse *, FILE *));
-static void keytype P((struct parse *, FILE *));
-static void passwd P((struct parse *, FILE *));
-static void hostnames P((struct parse *, FILE *));
-static void setdebug P((struct parse *, FILE *));
-static void quit P((struct parse *, FILE *));
-static void version P((struct parse *, FILE *));
-static void warning P((const char *, const char *, const char *));
-static void error P((const char *, const char *, const char *));
-static u_long getkeyid P((const char *));
+static int openhost (const char *);
+static int sendpkt (void *, size_t);
+static void growpktdata (void);
+static int getresponse (int, int, int *, int *, char **, int);
+static int sendrequest (int, int, int, u_int, size_t, char *);
+static void getcmds (void);
+static RETSIGTYPE abortcmd (int);
+static void docmd (const char *);
+static void tokenize (const char *, char **, int *);
+static int findcmd (char *, struct xcmd *, struct xcmd *, struct xcmd **);
+static int getarg (char *, int, arg_v *);
+static int getnetnum (const char *, sockaddr_u *, char *, int);
+static void help (struct parse *, FILE *);
+static int helpsort (const void *, const void *);
+static void printusage (struct xcmd *, FILE *);
+static void timeout (struct parse *, FILE *);
+static void my_delay (struct parse *, FILE *);
+static void host (struct parse *, FILE *);
+static void keyid (struct parse *, FILE *);
+static void keytype (struct parse *, FILE *);
+static void passwd (struct parse *, FILE *);
+static void hostnames (struct parse *, FILE *);
+static void setdebug (struct parse *, FILE *);
+static void quit (struct parse *, FILE *);
+static void version (struct parse *, FILE *);
+static void warning (const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+static void error (const char *, ...)
+ __attribute__((__format__(__printf__, 1, 2)));
+static u_long getkeyid (const char *);
@@ -159,10 +155,10 @@ static struct xcmd builtins[] = {
/*
* Default values we use.
*/
+#define DEFHOST "localhost" /* default host name */
#define DEFTIMEOUT (5) /* 5 second time out */
#define DEFSTIMEOUT (2) /* 2 second time out after first */
#define DEFDELAY 0x51EB852 /* 20 milliseconds, l_fp fraction */
-#define DEFHOST "localhost" /* default host name */
#define LENHOSTNAME 256 /* host name is 256 characters long */
#define MAXCMDS 100 /* maximum commands on cmd line */
#define MAXHOSTS 200 /* maximum hosts on cmd line */
@@ -173,8 +169,8 @@ static struct xcmd builtins[] = {
/*
* Some variables used and manipulated locally
*/
-static struct timeval tvout = { DEFTIMEOUT, 0 }; /* time out for reads */
-static struct timeval tvsout = { DEFSTIMEOUT, 0 }; /* secondary time out */
+static struct sock_timeval tvout = { DEFTIMEOUT, 0 }; /* time out for reads */
+static struct sock_timeval tvsout = { DEFSTIMEOUT, 0 };/* secondary time out */
static l_fp delay_time; /* delay time */
static char currenthost[LENHOSTNAME]; /* current host name */
int showhostnames = 1; /* show host names by default */
@@ -185,18 +181,6 @@ static SOCKET sockfd; /* fd socket is opened on */
static int havehost = 0; /* set to 1 when host open */
int s_port = 0;
-#if defined (SYS_WINNT) || defined (SYS_VXWORKS)
-char password[9];
-#endif /* SYS_WINNT || SYS_VXWORKS */
-
-#ifdef SYS_WINNT
-DWORD NumberOfBytesWritten;
-
-HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */
-void timer(void) { ; }; /* 1998/06/03 - Used in ntplib/machines.c */
-
-#endif /* SYS_WINNT */
-
/*
* Holds data returned from queries. We allocate INITDATASIZE
* octets to begin with, increasing this as we need to.
@@ -241,11 +225,6 @@ static const char *chosts[MAXHOSTS];
#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
/*
- * For converting time stamps to dates
- */
-#define JAN_1970 2208988800 /* 1970 - 1900 in seconds */
-
-/*
* Jump buffer for longjumping back to the command level
*/
static jmp_buf interrupt_buf;
@@ -262,7 +241,6 @@ static FILE *current_output;
extern struct xcmd opcmds[];
char *progname;
-volatile int debug;
#ifdef NO_MAIN_ALLOWED
CALL(ntpdc,"ntpdc",ntpdcmain);
@@ -296,7 +274,6 @@ ntpdcmain(
char *argv[]
)
{
- extern int ntp_optind;
delay_time.l_ui = 0;
delay_time.l_uf = DEFDELAY;
@@ -306,38 +283,28 @@ ntpdcmain(
taskPrioritySet(taskIdSelf(), 100 );
#endif
-#ifdef SYS_WINNT
- if (!Win32InitSockets())
- {
- fprintf(stderr, "No useable winsock.dll:");
- exit(1);
- }
-#endif /* SYS_WINNT */
+ init_lib(); /* sets up ipv4_works, ipv6_works */
+ ssl_applink();
+ init_auth();
- /* Check to see if we have IPv6. Otherwise force the -4 flag */
- if (isc_net_probeipv6() != ISC_R_SUCCESS) {
+ /* Check to see if we have IPv6. Otherwise default to IPv4 */
+ if (!ipv6_works)
ai_fam_default = AF_INET;
- }
progname = argv[0];
{
- int optct = optionProcess(&ntpdcOptions, argc, argv);
+ int optct = ntpOptionProcess(&ntpdcOptions, argc, argv);
argc -= optct;
argv += optct;
}
- switch (WHICH_IDX_IPV4) {
- case INDEX_OPT_IPV4:
+ if (HAVE_OPT(IPV4))
ai_fam_templ = AF_INET;
- break;
- case INDEX_OPT_IPV6:
+ else if (HAVE_OPT(IPV6))
ai_fam_templ = AF_INET6;
- break;
- default:
+ else
ai_fam_templ = ai_fam_default;
- break;
- }
if (HAVE_OPT(COMMAND)) {
int cmdct = STACKCT_OPT( COMMAND );
@@ -348,7 +315,7 @@ ntpdcmain(
}
}
- debug = DESC(DEBUG_LEVEL).optOccCt;
+ debug = OPT_VALUE_SET_DEBUG_LEVEL;
if (HAVE_OPT(INTERACTIVE)) {
interactive = 1;
@@ -382,62 +349,6 @@ ntpdcmain(
interactive = 1;
}
-#if 0
- ai_fam_templ = ai_fam_default;
- while ((c = ntp_getopt(argc, argv, "46c:dilnps")) != EOF)
- switch (c) {
- case '4':
- ai_fam_templ = AF_INET;
- break;
- case '6':
- ai_fam_templ = AF_INET6;
- break;
- case 'c':
- ADDCMD(ntp_optarg);
- break;
- case 'd':
- ++debug;
- break;
- case 'i':
- interactive = 1;
- break;
- case 'l':
- ADDCMD("listpeers");
- break;
- case 'n':
- showhostnames = 0;
- break;
- case 'p':
- ADDCMD("peers");
- break;
- case 's':
- ADDCMD("dmpeers");
- break;
- default:
- errflg++;
- break;
- }
-
- if (errflg) {
- (void) fprintf(stderr,
- "usage: %s [-46dilnps] [-c cmd] host ...\n",
- progname);
- exit(2);
- }
-
- if (ntp_optind == argc) {
- ADDHOST(DEFHOST);
- } else {
- for (; ntp_optind < argc; ntp_optind++)
- ADDHOST(argv[ntp_optind]);
- }
-
- if (numcmds == 0 && interactive == 0
- && isatty(fileno(stdin)) && isatty(fileno(stderr))) {
- interactive = 1;
- }
-#endif
-
#ifndef SYS_WINNT /* Under NT cannot handle SIGINT, WIN32 spawns a handler */
if (interactive)
(void) signal_no_reset(SIGINT, abortcmd);
@@ -446,12 +357,8 @@ ntpdcmain(
/*
* Initialize the packet data buffer
*/
- pktdata = (char *)malloc(INITDATASIZE);
- if (pktdata == NULL) {
- (void) fprintf(stderr, "%s: malloc() failed!\n", progname);
- exit(1);
- }
pktdatasize = INITDATASIZE;
+ pktdata = emalloc(INITDATASIZE);
if (numcmds == 0) {
(void) openhost(chosts[0]);
@@ -487,6 +394,8 @@ openhost(
char temphost[LENHOSTNAME];
int a_info, i;
struct addrinfo hints, *ai = NULL;
+ sockaddr_u addr;
+ size_t octets;
register const char *cp;
char name[LENHOSTNAME];
char service[5];
@@ -499,10 +408,14 @@ openhost(
if (*cp == '[') {
cp++;
- for(i = 0; *cp != ']'; cp++, i++)
- name[i] = *cp;
- name[i] = '\0';
- hname = name;
+ for (i = 0; *cp && *cp != ']'; cp++, i++)
+ name[i] = *cp;
+ if (*cp == ']') {
+ name[i] = '\0';
+ hname = name;
+ } else {
+ return 0;
+ }
}
/*
@@ -512,12 +425,12 @@ openhost(
* will return an "IPv4-mapped IPv6 address" address if you
* give it an IPv4 address to lookup.
*/
- strcpy(service, "ntp");
- memset((char *)&hints, 0, sizeof(struct addrinfo));
+ strlcpy(service, "ntp", sizeof(service));
+ ZERO(hints);
hints.ai_family = ai_fam_templ;
hints.ai_protocol = IPPROTO_UDP;
hints.ai_socktype = SOCK_DGRAM;
- hints.ai_flags = AI_NUMERICHOST;
+ hints.ai_flags = Z_AI_NUMERICHOST;
a_info = getaddrinfo(hname, service, &hints, &ai);
if (a_info == EAI_NONAME
@@ -537,34 +450,39 @@ openhost(
a_info = getaddrinfo(hname, service, &hints, &ai);
}
if (a_info != 0) {
- (void) fprintf(stderr, "%s\n", gai_strerror(a_info));
+ fprintf(stderr, "%s\n", gai_strerror(a_info));
if (ai != NULL)
freeaddrinfo(ai);
return 0;
}
- if (ai->ai_canonname == NULL) {
- strncpy(temphost, stoa((struct sockaddr_storage *)ai->ai_addr),
- LENHOSTNAME);
- temphost[LENHOSTNAME-1] = '\0';
- } else {
- strncpy(temphost, ai->ai_canonname, LENHOSTNAME);
- temphost[LENHOSTNAME-1] = '\0';
- }
+ /*
+ * getaddrinfo() has returned without error so ai should not
+ * be NULL.
+ */
+ INSIST(ai != NULL);
+ ZERO(addr);
+ octets = min(sizeof(addr), ai->ai_addrlen);
+ memcpy(&addr, ai->ai_addr, octets);
+
+ if (ai->ai_canonname == NULL)
+ strlcpy(temphost, stoa(&addr), sizeof(temphost));
+ else
+ strlcpy(temphost, ai->ai_canonname, sizeof(temphost));
if (debug > 2)
- printf("Opening host %s\n", temphost);
+ printf("Opening host %s\n", temphost);
if (havehost == 1) {
if (debug > 2)
- printf("Closing old host %s\n", currenthost);
- (void) closesocket(sockfd);
+ printf("Closing old host %s\n", currenthost);
+ closesocket(sockfd);
havehost = 0;
}
- (void) strcpy(currenthost, temphost);
+ strlcpy(currenthost, temphost, sizeof(currenthost));
/* port maps to the same in both families */
- s_port = ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port;
+ s_port = NSRCPORT(&addr);;
#ifdef SYS_VXWORKS
((struct sockaddr_in6 *)&hostaddr)->sin6_port = htons(SERVER_PORT_NUM);
if (ai->ai_family == AF_INET)
@@ -586,18 +504,13 @@ openhost(
exit(1);
}
}
+#endif /* SYS_WINNT */
sockfd = socket(ai->ai_family, SOCK_DGRAM, 0);
if (sockfd == INVALID_SOCKET) {
- error("socket", "", "");
+ error("socket");
exit(-1);
}
-#else
- sockfd = socket(ai->ai_family, SOCK_DGRAM, 0);
- if (sockfd == -1)
- error("socket", "", "");
-#endif /* SYS_WINNT */
-
#ifdef NEED_RCVBUF_SLOP
# ifdef SO_RCVBUF
@@ -606,21 +519,22 @@ openhost(
if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF,
&rbufsize, sizeof(int)) == -1)
- error("setsockopt", "", "");
+ error("setsockopt");
}
# endif
#endif
#ifdef SYS_VXWORKS
if (connect(sockfd, (struct sockaddr *)&hostaddr,
- sizeof(hostaddr)) == -1)
+ sizeof(hostaddr)) == -1) {
#else
- if (connect(sockfd, (struct sockaddr *)ai->ai_addr,
- ai->ai_addrlen) == -1)
+ if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) == -1) {
#endif /* SYS_VXWORKS */
- error("connect", "", "");
- if (ai != NULL)
- freeaddrinfo(ai);
+ error("connect");
+ exit(-1);
+ }
+
+ freeaddrinfo(ai);
havehost = 1;
req_pkt_size = REQ_LEN_NOMAC;
impl_ver = IMPL_XNTPD;
@@ -634,12 +548,12 @@ openhost(
*/
static int
sendpkt(
- char *xdata,
- int xdatalen
+ void * xdata,
+ size_t xdatalen
)
{
- if (send(sockfd, xdata, (size_t)xdatalen, 0) == -1) {
- warning("write to %s failed", currenthost, "");
+ if (send(sockfd, xdata, xdatalen, 0) == -1) {
+ warning("write to %s failed", currenthost);
return -1;
}
@@ -653,12 +567,11 @@ sendpkt(
static void
growpktdata(void)
{
+ size_t priorsz;
+
+ priorsz = (size_t)pktdatasize;
pktdatasize += INCDATASIZE;
- pktdata = (char *)realloc(pktdata, (unsigned)pktdatasize);
- if (pktdata == 0) {
- (void) fprintf(stderr, "%s: realloc() failed!\n", progname);
- exit(1);
- }
+ pktdata = erealloc_zero(pktdata, (size_t)pktdatasize, priorsz);
}
@@ -676,7 +589,7 @@ getresponse(
)
{
struct resp_pkt rpkt;
- struct timeval tvo;
+ struct sock_timeval tvo;
int items;
int i;
int size;
@@ -689,7 +602,7 @@ getresponse(
int numrecv;
int seq;
fd_set fds;
- int n;
+ ssize_t n;
int pad;
/*
@@ -705,20 +618,20 @@ getresponse(
numrecv = 0;
*rdata = datap = pktdata;
lastseq = 999; /* too big to be a sequence number */
- memset(haveseq, 0, sizeof(haveseq));
+ ZERO(haveseq);
FD_ZERO(&fds);
again:
if (firstpkt)
- tvo = tvout;
+ tvo = tvout;
else
- tvo = tvsout;
+ tvo = tvsout;
FD_SET(sockfd, &fds);
n = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvo);
if (n == -1) {
- warning("select fails", "", "");
+ warning("select fails");
return -1;
}
if (n == 0) {
@@ -737,7 +650,7 @@ getresponse(
printf("Received sequence numbers");
for (n = 0; n <= MAXSEQ; n++)
if (haveseq[n])
- printf(" %d,", n);
+ printf(" %zd,", n);
if (lastseq != 999)
printf(" last frame received\n");
else
@@ -749,7 +662,7 @@ getresponse(
n = recv(sockfd, (char *)&rpkt, sizeof(rpkt), 0);
if (n == -1) {
- warning("read", "", "");
+ warning("read");
return -1;
}
@@ -757,37 +670,37 @@ getresponse(
/*
* Check for format errors. Bug proofing.
*/
- if (n < RESP_HEADER_SIZE) {
+ if (n < (ssize_t)RESP_HEADER_SIZE) {
if (debug)
- printf("Short (%d byte) packet received\n", n);
+ printf("Short (%zd byte) packet received\n", n);
goto again;
}
if (INFO_VERSION(rpkt.rm_vn_mode) > NTP_VERSION ||
INFO_VERSION(rpkt.rm_vn_mode) < NTP_OLDVERSION) {
if (debug)
- printf("Packet received with version %d\n",
- INFO_VERSION(rpkt.rm_vn_mode));
+ printf("Packet received with version %d\n",
+ INFO_VERSION(rpkt.rm_vn_mode));
goto again;
}
if (INFO_MODE(rpkt.rm_vn_mode) != MODE_PRIVATE) {
if (debug)
- printf("Packet received with mode %d\n",
- INFO_MODE(rpkt.rm_vn_mode));
+ printf("Packet received with mode %d\n",
+ INFO_MODE(rpkt.rm_vn_mode));
goto again;
}
if (INFO_IS_AUTH(rpkt.auth_seq)) {
if (debug)
- printf("Encrypted packet received\n");
+ printf("Encrypted packet received\n");
goto again;
}
if (!ISRESPONSE(rpkt.rm_vn_mode)) {
if (debug)
- printf("Received request packet, wanted response\n");
+ printf("Received request packet, wanted response\n");
goto again;
}
if (INFO_MBZ(rpkt.mbz_itemsize) != 0) {
if (debug)
- printf("Received packet with nonzero MBZ field!\n");
+ printf("Received packet with nonzero MBZ field!\n");
goto again;
}
@@ -796,7 +709,7 @@ getresponse(
*/
if (rpkt.implementation != implcode || rpkt.request != reqcode) {
if (debug)
- printf(
+ printf(
"Received implementation/request of %d/%d, wanted %d/%d",
rpkt.implementation, rpkt.request,
implcode, reqcode);
@@ -823,10 +736,11 @@ getresponse(
pad = esize - size;
else
pad = 0;
- if ((datasize = items*size) > (n-RESP_HEADER_SIZE)) {
+ datasize = items * size;
+ if ((size_t)datasize > (n-RESP_HEADER_SIZE)) {
if (debug)
printf(
- "Received items %d, size %d (total %d), data in packet is %d\n",
+ "Received items %d, size %d (total %d), data in packet is %zu\n",
items, size, datasize, n-RESP_HEADER_SIZE);
goto again;
}
@@ -835,7 +749,7 @@ getresponse(
* If this isn't our first packet, make sure the size matches
* the other ones.
*/
- if (!firstpkt && esize != *rsize) {
+ if (!firstpkt && size != *rsize) {
if (debug)
printf("Received itemsize %d, previous %d\n",
size, *rsize);
@@ -869,7 +783,7 @@ getresponse(
if ((datap + datasize + (pad * items)) > (pktdata + pktdatasize)) {
int offset = datap - pktdata;
growpktdata();
- *rdata = pktdata; /* might have been realloced ! */
+ *rdata = pktdata; /* might have been realloced ! */
datap = pktdata + offset;
}
/*
@@ -877,11 +791,11 @@ getresponse(
* items. This is so we can play nice with older implementations
*/
- tmp_data = (char *)rpkt.data;
- for(i = 0; i <items; i++){
- memmove(datap, tmp_data, (unsigned)size);
+ tmp_data = rpkt.u.data;
+ for (i = 0; i < items; i++) {
+ memcpy(datap, tmp_data, (unsigned)size);
tmp_data += size;
- memset(datap + size, 0, pad);
+ zero_mem(datap + size, pad);
datap += size + pad;
}
@@ -897,36 +811,61 @@ getresponse(
*/
++numrecv;
if (numrecv <= lastseq)
- goto again;
+ goto again;
return INFO_OKAY;
}
/*
* sendrequest - format and send a request packet
+ *
+ * Historically, ntpdc has used a fixed-size request packet regardless
+ * of the actual payload size. When authenticating, the timestamp, key
+ * ID, and digest have been placed just before the end of the packet.
+ * With the introduction in late 2009 of support for authenticated
+ * ntpdc requests using larger 20-octet digests (vs. 16 for MD5), we
+ * come up four bytes short.
+ *
+ * To maintain interop while allowing for larger digests, the behavior
+ * is unchanged when using 16-octet digests. For larger digests, the
+ * timestamp, key ID, and digest are placed immediately following the
+ * request payload, with the overall packet size variable. ntpd can
+ * distinguish 16-octet digests by the overall request size being
+ * REQ_LEN_NOMAC + 4 + 16 with the auth bit enabled. When using a
+ * longer digest, that request size should be avoided.
+ *
+ * With the form used with 20-octet and larger digests, the timestamp,
+ * key ID, and digest are located by ntpd relative to the start of the
+ * packet, and the size of the digest is then implied by the packet
+ * size.
*/
static int
sendrequest(
int implcode,
int reqcode,
int auth,
- int qitems,
- int qsize,
+ u_int qitems,
+ size_t qsize,
char *qdata
)
{
struct req_pkt qpkt;
- int datasize;
-
- memset((char *)&qpkt, 0, sizeof qpkt);
-
+ size_t datasize;
+ size_t reqsize;
+ u_long key_id;
+ l_fp ts;
+ l_fp * ptstamp;
+ int maclen;
+ char * pass;
+
+ ZERO(qpkt);
qpkt.rm_vn_mode = RM_VN_MODE(0, 0, 0);
qpkt.implementation = (u_char)implcode;
qpkt.request = (u_char)reqcode;
datasize = qitems * qsize;
- if (datasize != 0 && qdata != NULL) {
- memmove((char *)qpkt.data, qdata, (unsigned)datasize);
+ if (datasize && qdata != NULL) {
+ memcpy(qpkt.u.data, qdata, datasize);
qpkt.err_nitems = ERR_NITEMS(0, qitems);
qpkt.mbz_itemsize = MBZ_ITEMSIZE(qsize);
} else {
@@ -936,53 +875,61 @@ sendrequest(
if (!auth || (keyid_entered && info_auth_keyid == 0)) {
qpkt.auth_seq = AUTH_SEQ(0, 0);
- return sendpkt((char *)&qpkt, req_pkt_size);
- } else {
- l_fp ts;
- int maclen = 0;
- const char *pass = "\0";
- struct req_pkt_tail *qpktail;
-
- qpktail = (struct req_pkt_tail *)((char *)&qpkt + req_pkt_size
- + MAX_MAC_LEN - sizeof(struct req_pkt_tail));
+ return sendpkt(&qpkt, req_pkt_size);
+ }
- if (info_auth_keyid == 0) {
- if (((struct conf_peer *)qpkt.data)->keyid > 0)
- info_auth_keyid = ((struct conf_peer *)qpkt.data)->keyid;
- else {
- maclen = getkeyid("Keyid: ");
- if (maclen == 0) {
- (void) fprintf(stderr,
- "Invalid key identifier\n");
- return 1;
- }
- info_auth_keyid = maclen;
- }
+ if (info_auth_keyid == 0) {
+ key_id = getkeyid("Keyid: ");
+ if (!key_id) {
+ fprintf(stderr, "Invalid key identifier\n");
+ return 1;
}
- if (!authistrusted(info_auth_keyid)) {
- pass = getpass("MD5 Password: ");
- if (*pass == '\0') {
- (void) fprintf(stderr,
- "Invalid password\n");
- return (1);
- }
+ info_auth_keyid = key_id;
+ }
+ if (!authistrusted(info_auth_keyid)) {
+ pass = getpass_keytype(info_auth_keytype);
+ if ('\0' == pass[0]) {
+ fprintf(stderr, "Invalid password\n");
+ return 1;
}
- authusekey(info_auth_keyid, info_auth_keytype, (const u_char *)pass);
+ authusekey(info_auth_keyid, info_auth_keytype,
+ (u_char *)pass);
authtrust(info_auth_keyid, 1);
- qpkt.auth_seq = AUTH_SEQ(1, 0);
- qpktail->keyid = htonl(info_auth_keyid);
- get_systime(&ts);
- L_ADD(&ts, &delay_time);
- HTONL_FP(&ts, &qpktail->tstamp);
- maclen = authencrypt(info_auth_keyid, (u_int32 *)&qpkt,
- req_pkt_size);
- if (maclen == 0) {
- (void) fprintf(stderr, "Key not found\n");
- return (1);
- }
- return sendpkt((char *)&qpkt, (int)(req_pkt_size + maclen));
}
- /*NOTREACHED*/
+ qpkt.auth_seq = AUTH_SEQ(1, 0);
+ if (info_auth_hashlen > 16) {
+ /*
+ * Only ntpd which expects REQ_LEN_NOMAC plus maclen
+ * octets in an authenticated request using a 16 octet
+ * digest (that is, a newer ntpd) will handle digests
+ * larger than 16 octets, so for longer digests, do
+ * not attempt to shorten the requests for downlevel
+ * ntpd compatibility.
+ */
+ if (REQ_LEN_NOMAC != req_pkt_size)
+ return 1;
+ reqsize = REQ_LEN_HDR + datasize + sizeof(*ptstamp);
+ /* align to 32 bits */
+ reqsize = (reqsize + 3) & ~3;
+ } else
+ reqsize = req_pkt_size;
+ ptstamp = (void *)((char *)&qpkt + reqsize);
+ ptstamp--;
+ get_systime(&ts);
+ L_ADD(&ts, &delay_time);
+ HTONL_FP(&ts, ptstamp);
+ maclen = authencrypt(info_auth_keyid, (void *)&qpkt, reqsize);
+ if (!maclen) {
+ fprintf(stderr, "Key not found\n");
+ return 1;
+ } else if (maclen != (int)(info_auth_hashlen + sizeof(keyid_t))) {
+ fprintf(stderr,
+ "%d octet MAC, %zu expected with %zu octet digest\n",
+ maclen, (info_auth_hashlen + sizeof(keyid_t)),
+ info_auth_hashlen);
+ return 1;
+ }
+ return sendpkt(&qpkt, reqsize + maclen);
}
@@ -1007,7 +954,7 @@ doquery(
int res;
char junk[512];
fd_set fds;
- struct timeval tvzero;
+ struct sock_timeval tvzero;
/*
* Check to make sure host is open
@@ -1028,7 +975,7 @@ again:
res = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvzero);
if (res == -1) {
- warning("polling select", "", "");
+ warning("polling select");
return -1;
} else if (res > 0)
@@ -1041,7 +988,7 @@ again:
*/
res = sendrequest(implcode, reqcode, auth, qitems, qsize, qdata);
if (res != 0)
- return res;
+ return res;
/*
* Get the response. If we got a standard error, print a message
@@ -1079,36 +1026,36 @@ again:
/* log error message if not told to be quiet */
if ((res > 0) && (((1 << res) & quiet_mask) == 0)) {
switch(res) {
- case INFO_ERR_IMPL:
+ case INFO_ERR_IMPL:
/* Give us a chance to try the older implementation. */
if (implcode == IMPL_XNTPD)
break;
(void) fprintf(stderr,
- "***Server implementation incompatable with our own\n");
+ "***Server implementation incompatible with our own\n");
break;
- case INFO_ERR_REQ:
+ case INFO_ERR_REQ:
(void) fprintf(stderr,
"***Server doesn't implement this request\n");
break;
- case INFO_ERR_FMT:
+ case INFO_ERR_FMT:
(void) fprintf(stderr,
"***Server reports a format error in the received packet (shouldn't happen)\n");
break;
- case INFO_ERR_NODATA:
+ case INFO_ERR_NODATA:
(void) fprintf(stderr,
"***Server reports data not found\n");
break;
- case INFO_ERR_AUTH:
+ case INFO_ERR_AUTH:
(void) fprintf(stderr, "***Permission denied\n");
break;
- case ERR_TIMEOUT:
+ case ERR_TIMEOUT:
(void) fprintf(stderr, "***Request timed out\n");
break;
- case ERR_INCOMPLETE:
+ case ERR_INCOMPLETE:
(void) fprintf(stderr,
"***Response from server was incomplete\n");
break;
- default:
+ default:
(void) fprintf(stderr,
"***Server returns unknown error code %d\n", res);
break;
@@ -1124,33 +1071,20 @@ again:
static void
getcmds(void)
{
-#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)
- char *line;
+ char * line;
+ int count;
+
+ ntp_readline_init(interactive ? prompt : NULL);
for (;;) {
- if ((line = readline(interactive?prompt:"")) == NULL) return;
- if (*line) add_history(line);
+ line = ntp_readline(&count);
+ if (NULL == line)
+ break;
docmd(line);
free(line);
}
-#else /* not (HAVE_LIBREADLINE || HAVE_LIBEDIT) */
- char line[MAXLINE];
- for (;;) {
- if (interactive) {
-#ifdef VMS /* work around a problem with mixing stdout & stderr */
- fputs("",stdout);
-#endif
- (void) fputs(prompt, stderr);
- (void) fflush(stderr);
- }
-
- if (fgets(line, sizeof line, stdin) == NULL)
- return;
-
- docmd(line);
- }
-#endif /* not HAVE_LIBREADLINE || HAVE_LIBEDIT */
+ ntp_readline_uninit();
}
@@ -1191,6 +1125,11 @@ docmd(
/*
* Tokenize the command line. If nothing on it, return.
*/
+ if (strlen(cmdline) >= MAXLINE) {
+ fprintf(stderr, "***Command ignored, more than %d characters:\n%s\n",
+ MAXLINE - 1, cmdline);
+ return;
+ }
tokenize(cmdline, tokens, &ntok);
if (ntok == 0)
return;
@@ -1408,8 +1347,7 @@ getarg(
char *cp, *np;
static const char *digits = "0123456789";
- memset(argp, 0, sizeof(*argp));
-
+ ZERO(*argp);
argp->string = str;
argp->type = code & ~OPT;
@@ -1482,58 +1420,63 @@ getarg(
static int
getnetnum(
const char *hname,
- struct sockaddr_storage *num,
+ sockaddr_u *num,
char *fullhost,
int af
)
{
- int sockaddr_len;
struct addrinfo hints, *ai = NULL;
- sockaddr_len = (af == AF_INET)
- ? sizeof(struct sockaddr_in)
- : sizeof(struct sockaddr_in6);
- memset((char *)&hints, 0, sizeof(struct addrinfo));
+ ZERO(hints);
hints.ai_flags = AI_CANONNAME;
#ifdef AI_ADDRCONFIG
hints.ai_flags |= AI_ADDRCONFIG;
#endif
- /* decodenetnum only works with addresses */
+ /*
+ * decodenetnum only works with addresses, but handles syntax
+ * that getaddrinfo doesn't: [2001::1]:1234
+ */
if (decodenetnum(hname, num)) {
- if (fullhost != 0) {
- getnameinfo((struct sockaddr *)num, sockaddr_len,
- fullhost, sizeof(fullhost), NULL, 0,
- NI_NUMERICHOST);
- }
+ if (fullhost != NULL)
+ getnameinfo(&num->sa, SOCKLEN(num), fullhost,
+ LENHOSTNAME, NULL, 0, 0);
return 1;
} else if (getaddrinfo(hname, "ntp", &hints, &ai) == 0) {
- memmove((char *)num, ai->ai_addr, ai->ai_addrlen);
- if (fullhost != 0)
- (void) strcpy(fullhost, ai->ai_canonname);
+ NTP_INSIST(sizeof(*num) >= ai->ai_addrlen);
+ memcpy(num, ai->ai_addr, ai->ai_addrlen);
+ if (fullhost != NULL) {
+ if (ai->ai_canonname != NULL)
+ strlcpy(fullhost, ai->ai_canonname,
+ LENHOSTNAME);
+ else
+ getnameinfo(&num->sa, SOCKLEN(num),
+ fullhost, LENHOSTNAME, NULL,
+ 0, 0);
+ }
return 1;
- } else {
- (void) fprintf(stderr, "***Can't find host %s\n", hname);
- return 0;
}
- /*NOTREACHED*/
+ fprintf(stderr, "***Can't find host %s\n", hname);
+
+ return 0;
}
+
/*
* nntohost - convert network number to host name. This routine enforces
* the showhostnames setting.
*/
-char *
+const char *
nntohost(
- struct sockaddr_storage *netnum
+ sockaddr_u *netnum
)
{
- if (!showhostnames)
- return stoa(netnum);
-
- if ((netnum->ss_family == AF_INET) && ISREFCLOCKADR(netnum))
+ if (!showhostnames || SOCK_UNSPEC(netnum))
+ return stoa(netnum);
+ else if (ISREFCLOCKADR(netnum))
return refnumtoa(netnum);
- return socktohost(netnum);
+ else
+ return socktohost(netnum);
}
@@ -1553,58 +1496,51 @@ help(
struct xcmd *xcp;
char *cmd;
const char *list[100];
- int word, words;
- int row, rows;
- int col, cols;
+ size_t word, words;
+ size_t row, rows;
+ size_t col, cols;
+ size_t length;
if (pcmd->nargs == 0) {
words = 0;
for (xcp = builtins; xcp->keyword != 0; xcp++) {
if (*(xcp->keyword) != '?')
- list[words++] = xcp->keyword;
+ list[words++] = xcp->keyword;
}
- for (xcp = opcmds; xcp->keyword != 0; xcp++)
- list[words++] = xcp->keyword;
+ for (xcp = opcmds; xcp->keyword != 0; xcp++)
+ list[words++] = xcp->keyword;
- qsort(
-#ifdef QSORT_USES_VOID_P
- (void *)
-#else
- (char *)
-#endif
- (list), (size_t)(words), sizeof(char *), helpsort);
+ qsort((void *)list, words, sizeof(list[0]), helpsort);
col = 0;
for (word = 0; word < words; word++) {
- int length = strlen(list[word]);
- if (col < length) {
- col = length;
- }
+ length = strlen(list[word]);
+ col = max(col, length);
}
cols = SCREENWIDTH / ++col;
- rows = (words + cols - 1) / cols;
+ rows = (words + cols - 1) / cols;
- (void) fprintf(fp, "ntpdc commands:\n");
+ fprintf(fp, "ntpdc commands:\n");
for (row = 0; row < rows; row++) {
- for (word = row; word < words; word += rows) {
- (void) fprintf(fp, "%-*.*s", col, col-1, list[word]);
- }
- (void) fprintf(fp, "\n");
+ for (word = row; word < words; word += rows)
+ fprintf(fp, "%-*.*s", (int)col,
+ (int)col - 1, list[word]);
+ fprintf(fp, "\n");
}
} else {
cmd = pcmd->argval[0].string;
words = findcmd(cmd, builtins, opcmds, &xcp);
if (words == 0) {
- (void) fprintf(stderr,
- "Command `%s' is unknown\n", cmd);
+ fprintf(stderr,
+ "Command `%s' is unknown\n", cmd);
return;
} else if (words >= 2) {
- (void) fprintf(stderr,
- "Command `%s' is ambiguous\n", cmd);
+ fprintf(stderr,
+ "Command `%s' is ambiguous\n", cmd);
return;
}
- (void) fprintf(fp, "function: %s\n", xcp->comment);
+ fprintf(fp, "function: %s\n", xcp->comment);
printusage(xcp, fp);
}
}
@@ -1613,28 +1549,17 @@ help(
/*
* helpsort - do hostname qsort comparisons
*/
-#ifdef QSORT_USES_VOID_P
static int
helpsort(
const void *t1,
const void *t2
)
{
- char const * const * name1 = (char const * const *)t1;
- char const * const * name2 = (char const * const *)t2;
+ const char * const * name1 = t1;
+ const char * const * name2 = t2;
return strcmp(*name1, *name2);
}
-#else
-static int
-helpsort(
- char **name1,
- char **name2
- )
-{
- return strcmp(*name1, *name2);
-}
-#endif
/*
@@ -1799,21 +1724,34 @@ keytype(
FILE *fp
)
{
- if (pcmd->nargs == 0)
- fprintf(fp, "keytype is %s\n",
- (info_auth_keytype == KEY_TYPE_MD5) ? "MD5" : "???");
- else
- switch (*(pcmd->argval[0].string)) {
- case 'm':
- case 'M':
- info_auth_keytype = KEY_TYPE_MD5;
- break;
+ const char * digest_name;
+ size_t digest_len;
+ int key_type;
+
+ if (!pcmd->nargs) {
+ fprintf(fp, "keytype is %s with %lu octet digests\n",
+ keytype_name(info_auth_keytype),
+ (u_long)info_auth_hashlen);
+ return;
+ }
- default:
- fprintf(fp, "keytype must be 'md5'\n");
- }
-}
+ digest_name = pcmd->argval[0].string;
+ digest_len = 0;
+ key_type = keytype_from_text(digest_name, &digest_len);
+ if (!key_type) {
+ fprintf(fp, "keytype must be 'md5'%s\n",
+#ifdef OPENSSL
+ " or a digest type provided by OpenSSL");
+#else
+ "");
+#endif
+ return;
+ }
+
+ info_auth_keytype = key_type;
+ info_auth_hashlen = digest_len;
+}
/*
@@ -1835,20 +1773,17 @@ passwd(
return;
}
}
- if (!interactive) {
- authusekey(info_auth_keyid, info_auth_keytype,
- (u_char *)pcmd->argval[0].string);
- authtrust(info_auth_keyid, 1);
- } else {
- pass = getpass("MD5 Password: ");
- if (*pass == '\0')
- (void) fprintf(fp, "Password unchanged\n");
- else {
- authusekey(info_auth_keyid, info_auth_keytype,
- (u_char *)pass);
- authtrust(info_auth_keyid, 1);
+ if (pcmd->nargs >= 1)
+ pass = pcmd->argval[0].string;
+ else {
+ pass = getpass_keytype(info_auth_keytype);
+ if ('\0' == *pass) {
+ fprintf(fp, "Password unchanged\n");
+ return;
}
}
+ authusekey(info_auth_keyid, info_auth_keytype, (u_char *)pass);
+ authtrust(info_auth_keyid, 1);
}
@@ -1935,34 +1870,44 @@ version(
}
+static void __attribute__((__format__(__printf__, 1, 0)))
+vwarning(const char *fmt, va_list ap)
+{
+ int serrno = errno;
+ (void) fprintf(stderr, "%s: ", progname);
+ vfprintf(stderr, fmt, ap);
+ (void) fprintf(stderr, ": %s\n", strerror(serrno));
+}
+
/*
* warning - print a warning message
*/
-static void
+static void __attribute__((__format__(__printf__, 1, 2)))
warning(
const char *fmt,
- const char *st1,
- const char *st2
+ ...
)
{
- (void) fprintf(stderr, "%s: ", progname);
- (void) fprintf(stderr, fmt, st1, st2);
- (void) fprintf(stderr, ": ");
- perror("");
+ va_list ap;
+ va_start(ap, fmt);
+ vwarning(fmt, ap);
+ va_end(ap);
}
/*
* error - print a message and exit
*/
-static void
+static void __attribute__((__format__(__printf__, 1, 2)))
error(
const char *fmt,
- const char *st1,
- const char *st2
+ ...
)
{
- warning(fmt, st1, st2);
+ va_list ap;
+ va_start(ap, fmt);
+ vwarning(fmt, ap);
+ va_end(ap);
exit(1);
}
@@ -1974,26 +1919,28 @@ getkeyid(
const char *keyprompt
)
{
- register char *p;
- register int c;
+ int c;
FILE *fi;
char pbuf[20];
+ size_t i;
+ size_t ilim;
#ifndef SYS_WINNT
if ((fi = fdopen(open("/dev/tty", 2), "r")) == NULL)
#else
- if ((fi = _fdopen((int)GetStdHandle(STD_INPUT_HANDLE), "r")) == NULL)
+ if ((fi = _fdopen(open("CONIN$", _O_TEXT), "r")) == NULL)
#endif /* SYS_WINNT */
fi = stdin;
- else
+ else
setbuf(fi, (char *)NULL);
fprintf(stderr, "%s", keyprompt); fflush(stderr);
- for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) {
- if (p < &pbuf[18])
- *p++ = (char) c;
- }
- *p = '\0';
+ for (i = 0, ilim = COUNTOF(pbuf) - 1;
+ i < ilim && (c = getc(fi)) != '\n' && c != EOF;
+ )
+ pbuf[i++] = (char)c;
+ pbuf[i] = '\0';
if (fi != stdin)
- fclose(fi);
- return (u_int32)atoi(pbuf);
+ fclose(fi);
+
+ return (u_long) atoi(pbuf);
}
diff --git a/contrib/ntp/ntpdc/ntpdc.h b/contrib/ntp/ntpdc/ntpdc.h
index 785c312..6da4a5c 100644
--- a/contrib/ntp/ntpdc/ntpdc.h
+++ b/contrib/ntp/ntpdc/ntpdc.h
@@ -34,7 +34,7 @@ typedef struct {
char *string;
long ival;
u_long uval;
- struct sockaddr_storage netnum;
+ sockaddr_u netnum;
} arg_v;
/*
@@ -43,7 +43,7 @@ typedef struct {
struct parse {
char *keyword;
arg_v argval[MAXARGS + MOREARGS];
- int nargs;
+ size_t nargs;
};
/*
@@ -53,7 +53,7 @@ struct parse {
*/
struct xcmd {
const char *keyword; /* command key word */
- void (*handler) P((struct parse *, FILE *)); /* command handler */
+ void (*handler) (struct parse *, FILE *); /* command handler */
u_char arg[MAXARGS]; /* descriptors for arguments */
const char *desc[MAXARGS]; /* descriptions for arguments */
const char *comment;
@@ -63,5 +63,5 @@ extern int impl_ver;
extern int showhostnames;
extern int s_port;
-extern int doquery P((int, int, int, int, int, char *, int *, int *, char **, int, int));
-extern char * nntohost P((struct sockaddr_storage *));
+extern int doquery (int, int, int, int, int, char *, int *, int *, char **, int, int);
+extern const char * nntohost (sockaddr_u *);
diff --git a/contrib/ntp/ntpdc/ntpdc.html b/contrib/ntp/ntpdc/ntpdc.html
new file mode 100644
index 0000000..34cfcc1
--- /dev/null
+++ b/contrib/ntp/ntpdc/ntpdc.html
@@ -0,0 +1,515 @@
+<html lang="en">
+<head>
+<title>ntpdc: NTPD Control User's Manual</title>
+<meta http-equiv="Content-Type" content="text/html">
+<meta name="description" content="ntpdc: NTPD Control User's Manual">
+<meta name="generator" content="makeinfo 4.7">
+<link title="Top" rel="top" href="#Top">
+<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
+<meta http-equiv="Content-Style-Type" content="text/css">
+<style type="text/css"><!--
+ pre.display { font-family:inherit }
+ pre.format { font-family:inherit }
+ pre.smalldisplay { font-family:inherit; font-size:smaller }
+ pre.smallformat { font-family:inherit; font-size:smaller }
+ pre.smallexample { font-size:smaller }
+ pre.smalllisp { font-size:smaller }
+ span.sc { font-variant:small-caps }
+ span.roman { font-family: serif; font-weight: normal; }
+--></style>
+</head>
+<body>
+<h1 class="settitle">ntpdc: NTPD Control User's Manual</h1>
+<div class="node">
+<p><hr>
+<a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-Description">ntpdc Description</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
+<br>
+</div>
+
+<h2 class="unnumbered">ntpdc: NTPD Control User Manual</h2>
+
+<p>This document describes the use of the NTP Project's <code>ntpdc</code> program,
+that can be used to query a Network Time Protocol (NTP) server and
+display the time offset of the system clock relative to the server
+clock. Run as root, it can correct the system clock to this offset as
+well. It can be run as an interactive command or from a cron job.
+
+ <p>This document applies to version 4.2.8p3 of <code>ntpdc</code>.
+
+ <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
+IETF specification.
+
+ <div class="shortcontents">
+<h2>Short Contents</h2>
+<ul>
+<a href="#Top">ntpdc: NTPD Control User Manual</a>
+</ul>
+</div>
+
+<ul class="menu">
+<li><a accesskey="1" href="#ntpdc-Description">ntpdc Description</a>: Description
+<li><a accesskey="2" href="#ntpdc-Invocation">ntpdc Invocation</a>: Invoking ntpdc
+<li><a accesskey="3" href="#Usage">Usage</a>: Usage
+</ul>
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-Description"></a>
+<br>
+</div>
+
+<!-- node-name, next, previous, up -->
+<h3 class="section">Description</h3>
+
+<p>By default, <code>ntpdc</code> writes the local data and time (i.e., not UTC) to the
+standard output in the format:
+
+<pre class="example"> 1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
+</pre>
+ <p>where
+YYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time,
+(+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC),
+and
+the +4.567 +/- 0.089 secs indicates the time offset and
+error bound of the system clock relative to the server clock.
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-Invocation"></a>
+<br>
+</div>
+
+<h3 class="section">Invoking ntpdc</h3>
+
+<p><a name="index-ntpdc-1"></a><a name="index-vendor_002dspecific-NTPD-control-program-2"></a>
+
+ <p><code>ntpdc</code>
+is deprecated.
+Please use
+<code>ntpq(1ntpqmdoc)</code> instead - it can do everything
+<code>ntpdc</code>
+used to do, and it does so using a much more sane interface.
+
+ <p><code>ntpdc</code>
+is a utility program used to query
+<code>ntpd(1ntpdmdoc)</code>
+about its
+current state and to request changes in that state.
+It uses NTP mode 7 control message formats described in the source code.
+The program may
+be run either in interactive mode or controlled using command line
+arguments.
+Extensive state and statistics information is available
+through the
+<code>ntpdc</code>
+interface.
+In addition, nearly all the
+configuration options which can be specified at startup using
+ntpd's configuration file may also be specified at run time using
+<code>ntpdc</code>
+
+ <p>This section was generated by <strong>AutoGen</strong>,
+using the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntpdc</code> program.
+This software is released under the NTP license, &lt;http://ntp.org/license&gt;.
+
+<ul class="menu">
+<li><a accesskey="1" href="#ntpdc-usage">ntpdc usage</a>: ntpdc help/usage (<span class="option">--help</span>)
+<li><a accesskey="2" href="#ntpdc-ipv4">ntpdc ipv4</a>: ipv4 option (-4)
+<li><a accesskey="3" href="#ntpdc-ipv6">ntpdc ipv6</a>: ipv6 option (-6)
+<li><a accesskey="4" href="#ntpdc-command">ntpdc command</a>: command option (-c)
+<li><a accesskey="5" href="#ntpdc-interactive">ntpdc interactive</a>: interactive option (-i)
+<li><a accesskey="6" href="#ntpdc-listpeers">ntpdc listpeers</a>: listpeers option (-l)
+<li><a accesskey="7" href="#ntpdc-numeric">ntpdc numeric</a>: numeric option (-n)
+<li><a accesskey="8" href="#ntpdc-peers">ntpdc peers</a>: peers option (-p)
+<li><a accesskey="9" href="#ntpdc-showpeers">ntpdc showpeers</a>: showpeers option (-s)
+<li><a href="#ntpdc-config">ntpdc config</a>: presetting/configuring ntpdc
+<li><a href="#ntpdc-exit-status">ntpdc exit status</a>: exit status
+<li><a href="#ntpdc-Usage">ntpdc Usage</a>: Usage
+<li><a href="#ntpdc-See-Also">ntpdc See Also</a>: See Also
+<li><a href="#ntpdc-Authors">ntpdc Authors</a>: Authors
+<li><a href="#ntpdc-Bugs">ntpdc Bugs</a>: Bugs
+</ul>
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-ipv4">ntpdc ipv4</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ntpdc help/usage (<span class="option">--help</span>)</h4>
+
+<p><a name="index-ntpdc-help-3"></a>
+This is the automatically generated usage text for ntpdc.
+
+ <p>The text printed is the same whether selected with the <code>help</code> option
+(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>). <code>more-help</code> will print
+the usage text by passing it through a pager program.
+<code>more-help</code> is disabled on platforms without a working
+<code>fork(2)</code> function. The <code>PAGER</code> environment variable is
+used to select the program, defaulting to <span class="file">more</span>. Both will exit
+with a status code of 0.
+
+<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p3
+Usage: ntpdc [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
+ Flg Arg Option-Name Description
+ -4 no ipv4 Force IPv4 DNS name resolution
+ - prohibits the option 'ipv6'
+ -6 no ipv6 Force IPv6 DNS name resolution
+ - prohibits the option 'ipv4'
+ -c Str command run a command and exit
+ - may appear multiple times
+ -d no debug-level Increase debug verbosity level
+ - may appear multiple times
+ -D Num set-debug-level Set the debug verbosity level
+ - may appear multiple times
+ -i no interactive Force ntpq to operate in interactive mode
+ - prohibits these options:
+ command
+ listpeers
+ peers
+ showpeers
+ -l no listpeers Print a list of the peers
+ - prohibits the option 'command'
+ -n no numeric numeric host addresses
+ -p no peers Print a list of the peers
+ - prohibits the option 'command'
+ -s no showpeers Show a list of the peers
+ - prohibits the option 'command'
+ opt version output version information and exit
+ -? no help display extended usage information and exit
+ -! no more-help extended usage information passed thru pager
+ -&gt; opt save-opts save the option state to a config file
+ -&lt; Str load-opts load options from a config file
+ - disabled as '--no-load-opts'
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+
+The following option preset mechanisms are supported:
+ - reading file $HOME/.ntprc
+ - reading file ./.ntprc
+ - examining environment variables named NTPDC_*
+
+Please send bug reports to: &lt;http://bugs.ntp.org, bugs@ntp.org&gt;
+</pre>
+ <div class="node">
+<p><hr>
+<a name="ntpdc-ipv4"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-ipv6">ntpdc ipv6</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-usage">ntpdc usage</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ipv4 option (-4)</h4>
+
+<p><a name="index-ntpdc_002dipv4-4"></a>
+This is the &ldquo;force ipv4 dns name resolution&rdquo; option.
+
+<p class="noindent">This option has some usage constraints. It:
+ <ul>
+<li>must not appear in combination with any of the following options:
+ipv6.
+</ul>
+
+ <p>Force DNS resolution of following host names on the command line
+to the IPv4 namespace.
+<div class="node">
+<p><hr>
+<a name="ntpdc-ipv6"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-command">ntpdc command</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-ipv4">ntpdc ipv4</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ipv6 option (-6)</h4>
+
+<p><a name="index-ntpdc_002dipv6-5"></a>
+This is the &ldquo;force ipv6 dns name resolution&rdquo; option.
+
+<p class="noindent">This option has some usage constraints. It:
+ <ul>
+<li>must not appear in combination with any of the following options:
+ipv4.
+</ul>
+
+ <p>Force DNS resolution of following host names on the command line
+to the IPv6 namespace.
+<div class="node">
+<p><hr>
+<a name="ntpdc-command"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-interactive">ntpdc interactive</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-ipv6">ntpdc ipv6</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">command option (-c)</h4>
+
+<p><a name="index-ntpdc_002dcommand-6"></a>
+This is the &ldquo;run a command and exit&rdquo; option.
+This option takes a string argument <span class="file">cmd</span>.
+
+<p class="noindent">This option has some usage constraints. It:
+ <ul>
+<li>may appear an unlimited number of times.
+</ul>
+
+ <p>The following argument is interpreted as an interactive format command
+and is added to the list of commands to be executed on the specified
+host(s).
+<div class="node">
+<p><hr>
+<a name="ntpdc-interactive"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-listpeers">ntpdc listpeers</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-command">ntpdc command</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">interactive option (-i)</h4>
+
+<p><a name="index-ntpdc_002dinteractive-7"></a>
+This is the &ldquo;force ntpq to operate in interactive mode&rdquo; option.
+
+<p class="noindent">This option has some usage constraints. It:
+ <ul>
+<li>must not appear in combination with any of the following options:
+command, listpeers, peers, showpeers.
+</ul>
+
+ <p>Force ntpq to operate in interactive mode. Prompts will be written
+to the standard output and commands read from the standard input.
+<div class="node">
+<p><hr>
+<a name="ntpdc-listpeers"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-numeric">ntpdc numeric</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-interactive">ntpdc interactive</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">listpeers option (-l)</h4>
+
+<p><a name="index-ntpdc_002dlistpeers-8"></a>
+This is the &ldquo;print a list of the peers&rdquo; option.
+
+<p class="noindent">This option has some usage constraints. It:
+ <ul>
+<li>must not appear in combination with any of the following options:
+command.
+</ul>
+
+ <p>Print a list of the peers known to the server as well as a summary of
+their state. This is equivalent to the 'listpeers' interactive command.
+<div class="node">
+<p><hr>
+<a name="ntpdc-numeric"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-peers">ntpdc peers</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-listpeers">ntpdc listpeers</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">numeric option (-n)</h4>
+
+<p><a name="index-ntpdc_002dnumeric-9"></a>
+This is the &ldquo;numeric host addresses&rdquo; option.
+Output all host addresses in dotted-quad numeric format rather than
+converting to the canonical host names.
+<div class="node">
+<p><hr>
+<a name="ntpdc-peers"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-showpeers">ntpdc showpeers</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-numeric">ntpdc numeric</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">peers option (-p)</h4>
+
+<p><a name="index-ntpdc_002dpeers-10"></a>
+This is the &ldquo;print a list of the peers&rdquo; option.
+
+<p class="noindent">This option has some usage constraints. It:
+ <ul>
+<li>must not appear in combination with any of the following options:
+command.
+</ul>
+
+ <p>Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'peers' interactive command.
+<div class="node">
+<p><hr>
+<a name="ntpdc-showpeers"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-config">ntpdc config</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-peers">ntpdc peers</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">showpeers option (-s)</h4>
+
+<p><a name="index-ntpdc_002dshowpeers-11"></a>
+This is the &ldquo;show a list of the peers&rdquo; option.
+
+<p class="noindent">This option has some usage constraints. It:
+ <ul>
+<li>must not appear in combination with any of the following options:
+command.
+</ul>
+
+ <p>Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'dmpeers' interactive command.
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-config"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-exit-status">ntpdc exit status</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-showpeers">ntpdc showpeers</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">presetting/configuring ntpdc</h4>
+
+<p>Any option that is not marked as <i>not presettable</i> may be preset by
+loading values from configuration ("rc" or "ini") files, and values from environment variables named <code>NTPDC</code> and <code>NTPDC_&lt;OPTION_NAME&gt;</code>. <code>&lt;OPTION_NAME&gt;</code> must be one of
+the options listed above in upper case and segmented with underscores.
+The <code>NTPDC</code> variable will be tokenized and parsed like
+the command line. The remaining variables are tested for existence and their
+values are treated like option arguments.
+
+<p class="noindent"><code>libopts</code> will search in 2 places for configuration files:
+ <ul>
+<li>$HOME
+<li>$PWD
+</ul>
+ The environment variables <code>HOME</code>, and <code>PWD</code>
+are expanded and replaced when <span class="file">ntpdc</span> runs.
+For any of these that are plain files, they are simply processed.
+For any that are directories, then a file named <span class="file">.ntprc</span> is searched for
+within that directory and processed.
+
+ <p>Configuration files may be in a wide variety of formats.
+The basic format is an option name followed by a value (argument) on the
+same line. Values may be separated from the option name with a colon,
+equal sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+ <p>Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+<pre class="example"> [NTPDC]
+</pre>
+ <p class="noindent">or by
+<pre class="example"> &lt;?program ntpdc&gt;
+</pre>
+ <p class="noindent">Do not mix these styles within one configuration file.
+
+ <p>Compound values and carefully constructed string values may also be
+specified using XML syntax:
+<pre class="example"> &lt;option-name&gt;
+ &lt;sub-opt&gt;...&amp;lt;...&amp;gt;...&lt;/sub-opt&gt;
+ &lt;/option-name&gt;
+</pre>
+ <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of
+<pre class="example"> "...&lt;...&gt;..."
+</pre>
+ <p><code>AutoOpts</code> does not track suboptions. You simply note that it is a
+hierarchicly valued option. <code>AutoOpts</code> does provide a means for searching
+the associated name/value pair list (see: optionFindValue).
+
+ <p>The command line options relating to configuration and/or usage help are:
+
+<h5 class="subsubheading">version (-)</h5>
+
+<p>Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much licensing
+detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
+Only the first letter of the argument is examined:
+
+ <dl>
+<dt><span class="samp">version</span><dd>Only print the version. This is the default.
+<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms.
+<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms.
+</dl>
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-exit-status"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-Usage">ntpdc Usage</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-config">ntpdc config</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ntpdc exit status</h4>
+
+<p>One of the following exit values will be returned:
+ <dl>
+<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution.
+<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid.
+<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded.
+<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error. Please report
+it to autogen-users@lists.sourceforge.net. Thank you.
+</dl>
+ <div class="node">
+<p><hr>
+<a name="ntpdc-Usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-See-Also">ntpdc See Also</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-exit-status">ntpdc exit status</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ntpdc Usage</h4>
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-See-Also"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-Authors">ntpdc Authors</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-Usage">ntpdc Usage</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ntpdc See Also</h4>
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-Authors"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpdc-Bugs">ntpdc Bugs</a>,
+Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-See-Also">ntpdc See Also</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ntpdc Authors</h4>
+
+<div class="node">
+<p><hr>
+<a name="ntpdc-Bugs"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpdc-Authors">ntpdc Authors</a>,
+Up:&nbsp;<a rel="up" accesskey="u" href="#ntpdc-Invocation">ntpdc Invocation</a>
+<br>
+</div>
+
+<h4 class="subsection">ntpdc Bugs</h4>
+
+<div class="node">
+<p><hr>
+<a name="Usage"></a>
+<br>
+</div>
+
+<!-- node-name, next, previous, up -->
+<h3 class="section">Usage</h3>
+
+<p>The simplest use of this program is as an unprivileged command to
+check the current time, offset, and error in the local clock.
+For example:
+
+<pre class="example"> ntpdc ntpserver.somewhere
+</pre>
+ <p>With suitable privilege, it can be run as a command or in a
+<code>cron</code> job to reset the local clock from a reliable server, like
+the <code>ntpdate</code> and <code>rdate</code> commands.
+For example:
+
+<pre class="example"> ntpdc -a ntpserver.somewhere
+</pre>
+ </body></html>
+
diff --git a/contrib/ntp/ntpdc/ntpdc.man.in b/contrib/ntp/ntpdc/ntpdc.man.in
new file mode 100644
index 0000000..84266fb
--- /dev/null
+++ b/contrib/ntp/ntpdc/ntpdc.man.in
@@ -0,0 +1,874 @@
+.de1 NOP
+. it 1 an-trap
+. if \\n[.$] \,\\$*\/
+..
+.ie t \
+.ds B-Font [CB]
+.ds I-Font [CI]
+.ds R-Font [CR]
+.el \
+.ds B-Font B
+.ds I-Font I
+.ds R-Font R
+.TH ntpdc @NTPDC_MS@ "29 Jun 2015" "4.2.8p3" "User Commands"
+.\"
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-91aOeF/ag-i2aGdF)
+.\"
+.\" It has been AutoGen-ed June 29, 2015 at 04:31:01 PM by AutoGen 5.18.5
+.\" From the definitions ntpdc-opts.def
+.\" and the template file agman-cmd.tpl
+.SH NAME
+\f\*[B-Font]ntpdc\fP
+\- vendor-specific NTPD control program
+.SH SYNOPSIS
+\f\*[B-Font]ntpdc\fP
+.\" Mixture of short (flag) options and long options
+[\f\*[B-Font]\-flags\f[]]
+[\f\*[B-Font]\-flag\f[] [\f\*[I-Font]value\f[]]]
+[\f\*[B-Font]\-\-option-name\f[][[=| ]\f\*[I-Font]value\f[]]]
+[ host ...]
+.sp \n(Ppu
+.ne 2
+
+.SH DESCRIPTION
+\f\*[B-Font]ntpdc\fP
+is deprecated.
+Please use
+\fCntpq\f[]\fR(@NTPQ_MS@)\f[] instead \- it can do everything
+\f\*[B-Font]ntpdc\fP
+used to do, and it does so using a much more sane interface.
+.sp \n(Ppu
+.ne 2
+
+\f\*[B-Font]ntpdc\fP
+is a utility program used to query
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+about its
+current state and to request changes in that state.
+It uses NTP mode 7 control message formats described in the source code.
+The program may
+be run either in interactive mode or controlled using command line
+arguments.
+Extensive state and statistics information is available
+through the
+\f\*[B-Font]ntpdc\fP
+interface.
+In addition, nearly all the
+configuration options which can be specified at startup using
+ntpd's configuration file may also be specified at run time using
+\f\*[B-Font]ntpdc\fP.
+.SH "OPTIONS"
+.TP
+.NOP \f\*[B-Font]\-4\f[], \f\*[B-Font]\-\-ipv4\f[]
+Force IPv4 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv6.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv4 namespace.
+.TP
+.NOP \f\*[B-Font]\-6\f[], \f\*[B-Font]\-\-ipv6\f[]
+Force IPv6 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv4.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv6 namespace.
+.TP
+.NOP \f\*[B-Font]\-c\f[] \f\*[I-Font]cmd\f[], \f\*[B-Font]\-\-command\f[]=\f\*[I-Font]cmd\f[]
+run a command and exit.
+This option may appear an unlimited number of times.
+.sp
+The following argument is interpreted as an interactive format command
+and is added to the list of commands to be executed on the specified
+host(s).
+.TP
+.NOP \f\*[B-Font]\-d\f[], \f\*[B-Font]\-\-debug\-level\f[]
+Increase debug verbosity level.
+This option may appear an unlimited number of times.
+.sp
+.TP
+.NOP \f\*[B-Font]\-D\f[] \f\*[I-Font]number\f[], \f\*[B-Font]\-\-set\-debug\-level\f[]=\f\*[I-Font]number\f[]
+Set the debug verbosity level.
+This option may appear an unlimited number of times.
+This option takes an integer number as its argument.
+.sp
+.TP
+.NOP \f\*[B-Font]\-i\f[], \f\*[B-Font]\-\-interactive\f[]
+Force ntpq to operate in interactive mode.
+This option must not appear in combination with any of the following options:
+command, listpeers, peers, showpeers.
+.sp
+Force ntpq to operate in interactive mode. Prompts will be written
+to the standard output and commands read from the standard input.
+.TP
+.NOP \f\*[B-Font]\-l\f[], \f\*[B-Font]\-\-listpeers\f[]
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary of
+their state. This is equivalent to the 'listpeers' interactive command.
+.TP
+.NOP \f\*[B-Font]\-n\f[], \f\*[B-Font]\-\-numeric\f[]
+numeric host addresses.
+.sp
+Output all host addresses in dotted-quad numeric format rather than
+converting to the canonical host names.
+.TP
+.NOP \f\*[B-Font]\-p\f[], \f\*[B-Font]\-\-peers\f[]
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'peers' interactive command.
+.TP
+.NOP \f\*[B-Font]\-s\f[], \f\*[B-Font]\-\-showpeers\f[]
+Show a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'dmpeers' interactive command.
+.TP
+.NOP \f\*[B-Font]\-\&?\f[], \f\*[B-Font]\-\-help\f[]
+Display usage information and exit.
+.TP
+.NOP \f\*[B-Font]\-\&!\f[], \f\*[B-Font]\-\-more-help\f[]
+Pass the extended usage information through a pager.
+.TP
+.NOP \f\*[B-Font]\->\f[] [\f\*[I-Font]cfgfile\f[]], \f\*[B-Font]\-\-save-opts\f[] [=\f\*[I-Font]cfgfile\f[]]
+Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+The command will exit after updating the config file.
+.TP
+.NOP \f\*[B-Font]\-<\f[] \f\*[I-Font]cfgfile\f[], \f\*[B-Font]\-\-load-opts\f[]=\f\*[I-Font]cfgfile\f[], \f\*[B-Font]\-\-no-load-opts\f[]
+Load options from \fIcfgfile\fP.
+The \fIno-load-opts\fP form will disable the loading
+of earlier config/rc/ini files. \fI\-\-no-load-opts\fP is handled early,
+out of order.
+.TP
+.NOP \f\*[B-Font]\-\-version\f[] [{\f\*[I-Font]v|c|n\f[]}]
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.
+.PP
+.SH "OPTION PRESETS"
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from configuration ("RC" or ".INI") file(s) and values from
+environment variables named:
+.nf
+ \fBNTPDC_<option-name>\fP or \fBNTPDC\fP
+.fi
+.ad
+The environmental presets take precedence (are processed later than)
+the configuration files.
+The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
+If any of these are directories, then the file \fI.ntprc\fP
+is searched for within those directories.
+.SH USAGE
+If one or more request options are included on the command line
+when
+\f\*[B-Font]ntpdc\fP
+is executed, each of the requests will be sent
+to the NTP servers running on each of the hosts given as command
+line arguments, or on localhost by default.
+If no request options
+are given,
+\f\*[B-Font]ntpdc\fP
+will attempt to read commands from the
+standard input and execute these on the NTP server running on the
+first host given on the command line, again defaulting to localhost
+when no other host is specified.
+The
+\f\*[B-Font]ntpdc\fP
+utility will prompt for
+commands if the standard input is a terminal device.
+.sp \n(Ppu
+.ne 2
+
+The
+\f\*[B-Font]ntpdc\fP
+utility uses NTP mode 7 packets to communicate with the
+NTP server, and hence can be used to query any compatible server on
+the network which permits it.
+Note that since NTP is a UDP protocol
+this communication will be somewhat unreliable, especially over
+large distances in terms of network topology.
+The
+\f\*[B-Font]ntpdc\fP
+utility makes
+no attempt to retransmit requests, and will time requests out if
+the remote host is not heard from within a suitable timeout
+time.
+.sp \n(Ppu
+.ne 2
+
+The operation of
+\f\*[B-Font]ntpdc\fP
+are specific to the particular
+implementation of the
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+daemon and can be expected to
+work only with this and maybe some previous versions of the daemon.
+Requests from a remote
+\f\*[B-Font]ntpdc\fP
+utility which affect the
+state of the local server must be authenticated, which requires
+both the remote program and local server share a common key and key
+identifier.
+.sp \n(Ppu
+.ne 2
+
+Note that in contexts where a host name is expected, a
+\f\*[B-Font]\-4\f[]
+qualifier preceding the host name forces DNS resolution to the IPv4 namespace,
+while a
+\f\*[B-Font]\-6\f[]
+qualifier forces DNS resolution to the IPv6 namespace.
+Specifying a command line option other than
+\f\*[B-Font]\-i\f[]
+or
+\f\*[B-Font]\-n\f[]
+will cause the specified query (queries) to be sent to
+the indicated host(s) immediately.
+Otherwise,
+\f\*[B-Font]ntpdc\fP
+will
+attempt to read interactive format commands from the standard
+input.
+.SS "Interactive Commands"
+Interactive format commands consist of a keyword followed by zero
+to four arguments.
+Only enough characters of the full keyword to
+uniquely identify the command need be typed.
+The output of a
+command is normally sent to the standard output, but optionally the
+output of individual commands may be sent to a file by appending a
+\[oq]\&>\[cq],
+followed by a file name, to the command line.
+.sp \n(Ppu
+.ne 2
+
+A number of interactive format commands are executed entirely
+within the
+\f\*[B-Font]ntpdc\fP
+utility itself and do not result in NTP
+mode 7 requests being sent to a server.
+These are described
+following.
+.TP 7
+.NOP \f\*[B-Font]\&?\f[] \f\*[I-Font]command_keyword\f[]
+.TP 7
+.NOP \f\*[B-Font]help\f[] \f\*[I-Font]command_keyword\f[]
+A
+\[oq]\f\*[B-Font]\&?\f[]\[cq]
+will print a list of all the command
+keywords known to this incarnation of
+\f\*[B-Font]ntpdc\fP.
+A
+\[oq]\f\*[B-Font]\&?\f[]\[cq]
+followed by a command keyword will print function and usage
+information about the command.
+This command is probably a better
+source of information about
+\fCntpq\f[]\fR(@NTPQ_MS@)\f[]
+than this manual
+page.
+.TP 7
+.NOP \f\*[B-Font]delay\f[] \f\*[I-Font]milliseconds\f[]
+Specify a time interval to be added to timestamps included in
+requests which require authentication.
+This is used to enable
+(unreliable) server reconfiguration over long delay network paths
+or between machines whose clocks are unsynchronized.
+Actually the
+server does not now require timestamps in authenticated requests,
+so this command may be obsolete.
+.TP 7
+.NOP \f\*[B-Font]host\f[] \f\*[I-Font]hostname\f[]
+Set the host to which future queries will be sent.
+Hostname may
+be either a host name or a numeric address.
+.TP 7
+.NOP \f\*[B-Font]hostnames\f[] [\f\*[B-Font]yes\f[] | \f\*[B-Font]no\f[]]
+If
+\f\*[B-Font]yes\f[]
+is specified, host names are printed in
+information displays.
+If
+\f\*[B-Font]no\f[]
+is specified, numeric
+addresses are printed instead.
+The default is
+\f\*[B-Font]yes\f[],
+unless
+modified using the command line
+\f\*[B-Font]\-n\f[]
+switch.
+.TP 7
+.NOP \f\*[B-Font]keyid\f[] \f\*[I-Font]keyid\f[]
+This command allows the specification of a key number to be
+used to authenticate configuration requests.
+This must correspond
+to a key number the server has been configured to use for this
+purpose.
+.TP 7
+.NOP \f\*[B-Font]quit\f[]
+Exit
+\f\*[B-Font]ntpdc\fP.
+.TP 7
+.NOP \f\*[B-Font]passwd\f[]
+This command prompts you to type in a password (which will not
+be echoed) which will be used to authenticate configuration
+requests.
+The password must correspond to the key configured for
+use by the NTP server for this purpose if such requests are to be
+successful.
+.TP 7
+.NOP \f\*[B-Font]timeout\f[] \f\*[I-Font]milliseconds\f[]
+Specify a timeout period for responses to server queries.
+The
+default is about 8000 milliseconds.
+Note that since
+\f\*[B-Font]ntpdc\fP
+retries each query once after a timeout, the total waiting time for
+a timeout will be twice the timeout value set.
+.PP
+.SS "Control Message Commands"
+Query commands result in NTP mode 7 packets containing requests for
+information being sent to the server.
+These are read-only commands
+in that they make no modification of the server configuration
+state.
+.TP 7
+.NOP \f\*[B-Font]listpeers\f[]
+Obtains and prints a brief list of the peers for which the
+server is maintaining state.
+These should include all configured
+peer associations as well as those peers whose stratum is such that
+they are considered by the server to be possible future
+synchronization candidates.
+.TP 7
+.NOP \f\*[B-Font]peers\f[]
+Obtains a list of peers for which the server is maintaining
+state, along with a summary of that state.
+Summary information
+includes the address of the remote peer, the local interface
+address (0.0.0.0 if a local address has yet to be determined), the
+stratum of the remote peer (a stratum of 16 indicates the remote
+peer is unsynchronized), the polling interval, in seconds, the
+reachability register, in octal, and the current estimated delay,
+offset and dispersion of the peer, all in seconds.
+.sp \n(Ppu
+.ne 2
+
+The character in the left margin indicates the mode this peer
+entry is operating in.
+A
+\[oq]\&+\[cq]
+denotes symmetric active, a
+\[oq]\&-\[cq]
+indicates symmetric passive, a
+\[oq]\&=\[cq]
+means the
+remote server is being polled in client mode, a
+\[oq]\&^\[cq]
+indicates that the server is broadcasting to this address, a
+\[oq]\&~\[cq]
+denotes that the remote peer is sending broadcasts and a
+\[oq]\&~\[cq]
+denotes that the remote peer is sending broadcasts and a
+\[oq]\&*\[cq]
+marks the peer the server is currently synchronizing
+to.
+.sp \n(Ppu
+.ne 2
+
+The contents of the host field may be one of four forms.
+It may
+be a host name, an IP address, a reference clock implementation
+name with its parameter or
+\fBREFCLK\f[]\fR()\f[]
+On
+\f\*[B-Font]hostnames\f[]
+\f\*[B-Font]no\f[]
+only IP-addresses
+will be displayed.
+.TP 7
+.NOP \f\*[B-Font]dmpeers\f[]
+A slightly different peer summary list.
+Identical to the output
+of the
+\f\*[B-Font]peers\f[]
+command, except for the character in the
+leftmost column.
+Characters only appear beside peers which were
+included in the final stage of the clock selection algorithm.
+A
+\[oq]\&.\[cq]
+indicates that this peer was cast off in the falseticker
+detection, while a
+\[oq]\&+\[cq]
+indicates that the peer made it
+through.
+A
+\[oq]\&*\[cq]
+denotes the peer the server is currently
+synchronizing with.
+.TP 7
+.NOP \f\*[B-Font]showpeer\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]...\f[]]
+Shows a detailed display of the current peer variables for one
+or more peers.
+Most of these values are described in the NTP
+Version 2 specification.
+.TP 7
+.NOP \f\*[B-Font]pstats\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]...\f[]]
+Show per-peer statistic counters associated with the specified
+peer(s).
+.TP 7
+.NOP \f\*[B-Font]clockstat\f[] \f\*[I-Font]clock_peer_address\f[] [\f\*[I-Font]...\f[]]
+Obtain and print information concerning a peer clock.
+The
+values obtained provide information on the setting of fudge factors
+and other clock performance information.
+.TP 7
+.NOP \f\*[B-Font]kerninfo\f[]
+Obtain and print kernel phase-lock loop operating parameters.
+This information is available only if the kernel has been specially
+modified for a precision timekeeping function.
+.TP 7
+.NOP \f\*[B-Font]loopinfo\f[] [\f\*[B-Font]oneline\f[] | \f\*[B-Font]multiline\f[]]
+Print the values of selected loop filter variables.
+The loop
+filter is the part of NTP which deals with adjusting the local
+system clock.
+The
+\[oq]offset\[cq]
+is the last offset given to the
+loop filter by the packet processing code.
+The
+\[oq]frequency\[cq]
+is the frequency error of the local clock in parts-per-million
+(ppm).
+The
+\[oq]time_const\[cq]
+controls the stiffness of the
+phase-lock loop and thus the speed at which it can adapt to
+oscillator drift.
+The
+\[oq]watchdog timer\[cq]
+value is the number
+of seconds which have elapsed since the last sample offset was
+given to the loop filter.
+The
+\f\*[B-Font]oneline\f[]
+and
+\f\*[B-Font]multiline\f[]
+options specify the format in which this
+information is to be printed, with
+\f\*[B-Font]multiline\f[]
+as the
+default.
+.TP 7
+.NOP \f\*[B-Font]sysinfo\f[]
+Print a variety of system state variables, i.e., state related
+to the local server.
+All except the last four lines are described
+in the NTP Version 3 specification, RFC-1305.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]system flags\[cq]
+show various system flags, some of
+which can be set and cleared by the
+\f\*[B-Font]enable\f[]
+and
+\f\*[B-Font]disable\f[]
+configuration commands, respectively.
+These are
+the
+\f\*[B-Font]auth\f[],
+\f\*[B-Font]bclient\f[],
+\f\*[B-Font]monitor\f[],
+\f\*[B-Font]pll\f[],
+\f\*[B-Font]pps\f[]
+and
+\f\*[B-Font]stats\f[]
+flags.
+See the
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+documentation for the meaning of these flags.
+There
+are two additional flags which are read only, the
+\f\*[B-Font]kernel_pll\f[]
+and
+\f\*[B-Font]kernel_pps\f[].
+These flags indicate
+the synchronization status when the precision time kernel
+modifications are in use.
+The
+\[oq]kernel_pll\[cq]
+indicates that
+the local clock is being disciplined by the kernel, while the
+\[oq]kernel_pps\[cq]
+indicates the kernel discipline is provided by the PPS
+signal.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]stability\[cq]
+is the residual frequency error remaining
+after the system frequency correction is applied and is intended for
+maintenance and debugging.
+In most architectures, this value will
+initially decrease from as high as 500 ppm to a nominal value in
+the range .01 to 0.1 ppm.
+If it remains high for some time after
+starting the daemon, something may be wrong with the local clock,
+or the value of the kernel variable
+\fIkern.clockrate.tick\f[]
+may be
+incorrect.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]broadcastdelay\[cq]
+shows the default broadcast delay,
+as set by the
+\f\*[B-Font]broadcastdelay\f[]
+configuration command.
+.sp \n(Ppu
+.ne 2
+
+The
+\[oq]authdelay\[cq]
+shows the default authentication delay,
+as set by the
+\f\*[B-Font]authdelay\f[]
+configuration command.
+.TP 7
+.NOP \f\*[B-Font]sysstats\f[]
+Print statistics counters maintained in the protocol
+module.
+.TP 7
+.NOP \f\*[B-Font]memstats\f[]
+Print statistics counters related to memory allocation
+code.
+.TP 7
+.NOP \f\*[B-Font]iostats\f[]
+Print statistics counters maintained in the input-output
+module.
+.TP 7
+.NOP \f\*[B-Font]timerstats\f[]
+Print statistics counters maintained in the timer/event queue
+support code.
+.TP 7
+.NOP \f\*[B-Font]reslist\f[]
+Obtain and print the server's restriction list.
+This list is
+(usually) printed in sorted order and may help to understand how
+the restrictions are applied.
+.TP 7
+.NOP \f\*[B-Font]monlist\f[] [\f\*[I-Font]version\f[]]
+Obtain and print traffic counts collected and maintained by the
+monitor facility.
+The version number should not normally need to be
+specified.
+.TP 7
+.NOP \f\*[B-Font]clkbug\f[] \f\*[I-Font]clock_peer_address\f[] [\f\*[I-Font]...\f[]]
+Obtain debugging information for a reference clock driver.
+This
+information is provided only by some clock drivers and is mostly
+undecodable without a copy of the driver source in hand.
+.PP
+.SS "Runtime Configuration Requests"
+All requests which cause state changes in the server are
+authenticated by the server using a configured NTP key (the
+facility can also be disabled by the server by not configuring a
+key).
+The key number and the corresponding key must also be made
+known to
+\f\*[B-Font]ntpdc\fP.
+This can be done using the
+\f\*[B-Font]keyid\f[]
+and
+\f\*[B-Font]passwd\f[]
+commands, the latter of which will prompt at the terminal for a
+password to use as the encryption key.
+You will also be prompted
+automatically for both the key number and password the first time a
+command which would result in an authenticated request to the
+server is given.
+Authentication not only provides verification that
+the requester has permission to make such changes, but also gives
+an extra degree of protection again transmission errors.
+.sp \n(Ppu
+.ne 2
+
+Authenticated requests always include a timestamp in the packet
+data, which is included in the computation of the authentication
+code.
+This timestamp is compared by the server to its receive time
+stamp.
+If they differ by more than a small amount the request is
+rejected.
+This is done for two reasons.
+First, it makes simple
+replay attacks on the server, by someone who might be able to
+overhear traffic on your LAN, much more difficult.
+Second, it makes
+it more difficult to request configuration changes to your server
+from topologically remote hosts.
+While the reconfiguration facility
+will work well with a server on the local host, and may work
+adequately between time-synchronized hosts on the same LAN, it will
+work very poorly for more distant hosts.
+As such, if reasonable
+passwords are chosen, care is taken in the distribution and
+protection of keys and appropriate source address restrictions are
+applied, the run time reconfiguration facility should provide an
+adequate level of security.
+.sp \n(Ppu
+.ne 2
+
+The following commands all make authenticated requests.
+.TP 7
+.NOP \f\*[B-Font]addpeer\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]keyid\f[]] [\f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]]
+Add a configured peer association at the given address and
+operating in symmetric active mode.
+Note that an existing
+association with the same peer may be deleted when this command is
+executed, or may simply be converted to conform to the new
+configuration, as appropriate.
+If the optional
+\f\*[I-Font]keyid\f[]
+is a
+nonzero integer, all outgoing packets to the remote server will
+have an authentication field attached encrypted with this key.
+If
+the value is 0 (or not given) no authentication will be done.
+The
+\f\*[I-Font]version\f[]
+can be 1, 2 or 3 and defaults to 3.
+The
+\f\*[B-Font]prefer\f[]
+keyword indicates a preferred peer (and thus will
+be used primarily for clock synchronisation if possible).
+The
+preferred peer also determines the validity of the PPS signal \- if
+the preferred peer is suitable for synchronisation so is the PPS
+signal.
+.TP 7
+.NOP \f\*[B-Font]addserver\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]keyid\f[]] [\f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]]
+Identical to the addpeer command, except that the operating
+mode is client.
+.TP 7
+.NOP \f\*[B-Font]broadcast\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]keyid\f[]] [\f\*[I-Font]version\f[]] [\f\*[B-Font]prefer\f[]]
+Identical to the addpeer command, except that the operating
+mode is broadcast.
+In this case a valid key identifier and key are
+required.
+The
+\f\*[I-Font]peer_address\f[]
+parameter can be the broadcast
+address of the local network or a multicast group address assigned
+to NTP.
+If a multicast address, a multicast-capable kernel is
+required.
+.TP 7
+.NOP \f\*[B-Font]unconfig\f[] \f\*[I-Font]peer_address\f[] [\f\*[I-Font]...\f[]]
+This command causes the configured bit to be removed from the
+specified peer(s).
+In many cases this will cause the peer
+association to be deleted.
+When appropriate, however, the
+association may persist in an unconfigured mode if the remote peer
+is willing to continue on in this fashion.
+.TP 7
+.NOP \f\*[B-Font]fudge\f[] \f\*[I-Font]peer_address\f[] [\f\*[B-Font]time1\f[]] [\f\*[B-Font]time2\f[]] [\f\*[I-Font]stratum\f[]] [\f\*[I-Font]refid\f[]]
+This command provides a way to set certain data for a reference
+clock.
+See the source listing for further information.
+.TP 7
+.NOP \f\*[B-Font]enable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]pps\f[] | \f\*[B-Font]stats\f[]]
+.TP 7
+.NOP \f\*[B-Font]disable\f[] [\f\*[B-Font]auth\f[] | \f\*[B-Font]bclient\f[] | \f\*[B-Font]calibrate\f[] | \f\*[B-Font]kernel\f[] | \f\*[B-Font]monitor\f[] | \f\*[B-Font]ntp\f[] | \f\*[B-Font]pps\f[] | \f\*[B-Font]stats\f[]]
+These commands operate in the same way as the
+\f\*[B-Font]enable\f[]
+and
+\f\*[B-Font]disable\f[]
+configuration file commands of
+\fCntpd\f[]\fR(@NTPD_MS@)\f[].
+.RS
+.TP 7
+.NOP \f\*[B-Font]auth\f[]
+Enables the server to synchronize with unconfigured peers only
+if the peer has been correctly authenticated using either public key
+or private key cryptography.
+The default for this flag is enable.
+.TP 7
+.NOP \f\*[B-Font]bclient\f[]
+Enables the server to listen for a message from a broadcast or
+multicast server, as in the multicastclient command with
+default address.
+The default for this flag is disable.
+.TP 7
+.NOP \f\*[B-Font]calibrate\f[]
+Enables the calibrate feature for reference clocks.
+The default for this flag is disable.
+.TP 7
+.NOP \f\*[B-Font]kernel\f[]
+Enables the kernel time discipline, if available.
+The default for this flag is enable if support is available, otherwise disable.
+.TP 7
+.NOP \f\*[B-Font]monitor\f[]
+Enables the monitoring facility.
+See the documentation here about the
+\f\*[B-Font]monlist\f[]
+command or further information.
+The default for this flag is enable.
+.TP 7
+.NOP \f\*[B-Font]ntp\f[]
+Enables time and frequency discipline.
+In effect, this switch opens and closes the feedback loop,
+which is useful for testing.
+The default for this flag is enable.
+.TP 7
+.NOP \f\*[B-Font]pps\f[]
+Enables the pulse-per-second (PPS) signal when frequency
+and time is disciplined by the precision time kernel modifications.
+See the
+"A Kernel Model for Precision Timekeeping"
+(available as part of the HTML documentation
+provided in
+\fI/usr/share/doc/ntp\f[])
+page for further information.
+The default for this flag is disable.
+.TP 7
+.NOP \f\*[B-Font]stats\f[]
+Enables the statistics facility.
+See the
+\fIMonitoring\f[] \fIOptions\f[]
+section of
+\fCntp.conf\f[]\fR(5)\f[]
+for further information.
+The default for this flag is disable.
+.RE
+.TP 7
+.NOP \f\*[B-Font]restrict\f[] \f\*[I-Font]address\f[] \f\*[I-Font]mask\f[] \f\*[I-Font]flag\f[] [\f\*[I-Font]...\f[]]
+This command operates in the same way as the
+\f\*[B-Font]restrict\f[]
+configuration file commands of
+\fCntpd\f[]\fR(@NTPD_MS@)\f[].
+.TP 7
+.NOP \f\*[B-Font]unrestrict\f[] \f\*[I-Font]address\f[] \f\*[I-Font]mask\f[] \f\*[I-Font]flag\f[] [\f\*[I-Font]...\f[]]
+Unrestrict the matching entry from the restrict list.
+.TP 7
+.NOP \f\*[B-Font]delrestrict\f[] \f\*[I-Font]address\f[] \f\*[I-Font]mask\f[] [\f\*[B-Font]ntpport\f[]]
+Delete the matching entry from the restrict list.
+.TP 7
+.NOP \f\*[B-Font]readkeys\f[]
+Causes the current set of authentication keys to be purged and
+a new set to be obtained by rereading the keys file (which must
+have been specified in the
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+configuration file).
+This
+allows encryption keys to be changed without restarting the
+server.
+.TP 7
+.NOP \f\*[B-Font]trustedkey\f[] \f\*[I-Font]keyid\f[] [\f\*[I-Font]...\f[]]
+.TP 7
+.NOP \f\*[B-Font]untrustedkey\f[] \f\*[I-Font]keyid\f[] [\f\*[I-Font]...\f[]]
+These commands operate in the same way as the
+\f\*[B-Font]trustedkey\f[]
+and
+\f\*[B-Font]untrustedkey\f[]
+configuration file
+commands of
+\fCntpd\f[]\fR(@NTPD_MS@)\f[].
+.TP 7
+.NOP \f\*[B-Font]authinfo\f[]
+Returns information concerning the authentication module,
+including known keys and counts of encryptions and decryptions
+which have been done.
+.TP 7
+.NOP \f\*[B-Font]traps\f[]
+Display the traps set in the server.
+See the source listing for
+further information.
+.TP 7
+.NOP \f\*[B-Font]addtrap\f[] \f\*[I-Font]address\f[] [\f\*[I-Font]port\f[]] [\f\*[I-Font]interface\f[]]
+Set a trap for asynchronous messages.
+See the source listing
+for further information.
+.TP 7
+.NOP \f\*[B-Font]clrtrap\f[] \f\*[I-Font]address\f[] [\f\*[I-Font]port\f[]] [\f\*[I-Font]interface\f[]]
+Clear a trap for asynchronous messages.
+See the source listing
+for further information.
+.TP 7
+.NOP \f\*[B-Font]reset\f[]
+Clear the statistics counters in various modules of the server.
+See the source listing for further information.
+.PP
+.SH "ENVIRONMENT"
+See \fBOPTION PRESETS\fP for configuration environment variables.
+.SH "FILES"
+See \fBOPTION PRESETS\fP for configuration files.
+.SH "EXIT STATUS"
+One of the following exit values will be returned:
+.TP
+.NOP 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.TP
+.NOP 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.TP
+.NOP 66 " (EX_NOINPUT)"
+A specified configuration file could not be loaded.
+.TP
+.NOP 70 " (EX_SOFTWARE)"
+libopts had an internal operational error. Please report
+it to autogen-users@lists.sourceforge.net. Thank you.
+.PP
+.SH "SEE ALSO"
+\fCntp.conf\f[]\fR(5)\f[],
+\fCntpd\f[]\fR(@NTPD_MS@)\f[]
+David L. Mills,
+\fINetwork Time Protocol (Version 3)\fR,
+RFC1305
+.PP
+
+.SH AUTHORS
+The formatting directives in this document came from FreeBSD.
+.SH "COPYRIGHT"
+Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation all rights reserved.
+This program is released under the terms of the NTP license, <http://ntp.org/license>.
+.SH BUGS
+The
+\f\*[B-Font]ntpdc\fP
+utility is a crude hack.
+Much of the information it shows is
+deadly boring and could only be loved by its implementer.
+The
+program was designed so that new (and temporary) features were easy
+to hack in, at great expense to the program's ease of use.
+Despite
+this, the program is occasionally useful.
+.sp \n(Ppu
+.ne 2
+
+Please report bugs to http://bugs.ntp.org .
+.sp \n(Ppu
+.ne 2
+
+Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
+.SH "NOTES"
+This manual page was \fIAutoGen\fP-erated from the \fBntpdc\fP
+option definitions.
diff --git a/contrib/ntp/ntpdc/ntpdc.mdoc.in b/contrib/ntp/ntpdc/ntpdc.mdoc.in
new file mode 100644
index 0000000..649e895
--- /dev/null
+++ b/contrib/ntp/ntpdc/ntpdc.mdoc.in
@@ -0,0 +1,809 @@
+.Dd June 29 2015
+.Dt NTPDC @NTPDC_MS@ User Commands
+.Os
+.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
+.\"
+.\" It has been AutoGen-ed June 29, 2015 at 04:31:08 PM by AutoGen 5.18.5
+.\" From the definitions ntpdc-opts.def
+.\" and the template file agmdoc-cmd.tpl
+.Sh NAME
+.Nm ntpdc
+.Nd vendor-specific NTPD control program
+.Sh SYNOPSIS
+.Nm
+.\" Mixture of short (flag) options and long options
+.Op Fl flags
+.Op Fl flag Op Ar value
+.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
+[ host ...]
+.Pp
+.Sh DESCRIPTION
+.Nm
+is deprecated.
+Please use
+.Xr ntpq @NTPQ_MS@ instead \- it can do everything
+.Nm
+used to do, and it does so using a much more sane interface.
+.Pp
+.Nm
+is a utility program used to query
+.Xr ntpd @NTPD_MS@
+about its
+current state and to request changes in that state.
+It uses NTP mode 7 control message formats described in the source code.
+The program may
+be run either in interactive mode or controlled using command line
+arguments.
+Extensive state and statistics information is available
+through the
+.Nm
+interface.
+In addition, nearly all the
+configuration options which can be specified at startup using
+ntpd's configuration file may also be specified at run time using
+.Nm .
+.Sh "OPTIONS"
+.Bl -tag
+.It Fl 4 , Fl \-ipv4
+Force IPv4 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv6.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv4 namespace.
+.It Fl 6 , Fl \-ipv6
+Force IPv6 DNS name resolution.
+This option must not appear in combination with any of the following options:
+ipv4.
+.sp
+Force DNS resolution of following host names on the command line
+to the IPv6 namespace.
+.It Fl c Ar cmd , Fl \-command Ns = Ns Ar cmd
+run a command and exit.
+This option may appear an unlimited number of times.
+.sp
+The following argument is interpreted as an interactive format command
+and is added to the list of commands to be executed on the specified
+host(s).
+.It Fl d , Fl \-debug\-level
+Increase debug verbosity level.
+This option may appear an unlimited number of times.
+.sp
+.It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
+Set the debug verbosity level.
+This option may appear an unlimited number of times.
+This option takes an integer number as its argument.
+.sp
+.It Fl i , Fl \-interactive
+Force ntpq to operate in interactive mode.
+This option must not appear in combination with any of the following options:
+command, listpeers, peers, showpeers.
+.sp
+Force ntpq to operate in interactive mode. Prompts will be written
+to the standard output and commands read from the standard input.
+.It Fl l , Fl \-listpeers
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary of
+their state. This is equivalent to the 'listpeers' interactive command.
+.It Fl n , Fl \-numeric
+numeric host addresses.
+.sp
+Output all host addresses in dotted\-quad numeric format rather than
+converting to the canonical host names.
+.It Fl p , Fl \-peers
+Print a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'peers' interactive command.
+.It Fl s , Fl \-showpeers
+Show a list of the peers.
+This option must not appear in combination with any of the following options:
+command.
+.sp
+Print a list of the peers known to the server as well as a summary
+of their state. This is equivalent to the 'dmpeers' interactive command.
+.It Fl \&? , Fl \-help
+Display usage information and exit.
+.It Fl \&! , Fl \-more\-help
+Pass the extended usage information through a pager.
+.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
+Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+The command will exit after updating the config file.
+.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
+Load options from \fIcfgfile\fP.
+The \fIno\-load\-opts\fP form will disable the loading
+of earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early,
+out of order.
+.It Fl \-version Op Brq Ar v|c|n
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.
+.El
+.Sh "OPTION PRESETS"
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from configuration ("RC" or ".INI") file(s) and values from
+environment variables named:
+.nf
+ \fBNTPDC_<option\-name>\fP or \fBNTPDC\fP
+.fi
+.ad
+The environmental presets take precedence (are processed later than)
+the configuration files.
+The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
+If any of these are directories, then the file \fI.ntprc\fP
+is searched for within those directories.
+.Sh USAGE
+If one or more request options are included on the command line
+when
+.Nm
+is executed, each of the requests will be sent
+to the NTP servers running on each of the hosts given as command
+line arguments, or on localhost by default.
+If no request options
+are given,
+.Nm
+will attempt to read commands from the
+standard input and execute these on the NTP server running on the
+first host given on the command line, again defaulting to localhost
+when no other host is specified.
+The
+.Nm
+utility will prompt for
+commands if the standard input is a terminal device.
+.Pp
+The
+.Nm
+utility uses NTP mode 7 packets to communicate with the
+NTP server, and hence can be used to query any compatible server on
+the network which permits it.
+Note that since NTP is a UDP protocol
+this communication will be somewhat unreliable, especially over
+large distances in terms of network topology.
+The
+.Nm
+utility makes
+no attempt to retransmit requests, and will time requests out if
+the remote host is not heard from within a suitable timeout
+time.
+.Pp
+The operation of
+.Nm
+are specific to the particular
+implementation of the
+.Xr ntpd @NTPD_MS@
+daemon and can be expected to
+work only with this and maybe some previous versions of the daemon.
+Requests from a remote
+.Nm
+utility which affect the
+state of the local server must be authenticated, which requires
+both the remote program and local server share a common key and key
+identifier.
+.Pp
+Note that in contexts where a host name is expected, a
+.Fl 4
+qualifier preceding the host name forces DNS resolution to the IPv4 namespace,
+while a
+.Fl 6
+qualifier forces DNS resolution to the IPv6 namespace.
+Specifying a command line option other than
+.Fl i
+or
+.Fl n
+will cause the specified query (queries) to be sent to
+the indicated host(s) immediately.
+Otherwise,
+.Nm
+will
+attempt to read interactive format commands from the standard
+input.
+.Ss "Interactive Commands"
+Interactive format commands consist of a keyword followed by zero
+to four arguments.
+Only enough characters of the full keyword to
+uniquely identify the command need be typed.
+The output of a
+command is normally sent to the standard output, but optionally the
+output of individual commands may be sent to a file by appending a
+.Ql \&> ,
+followed by a file name, to the command line.
+.Pp
+A number of interactive format commands are executed entirely
+within the
+.Nm
+utility itself and do not result in NTP
+mode 7 requests being sent to a server.
+These are described
+following.
+.Bl -tag -width indent
+.It Ic \&? Ar command_keyword
+.It Ic help Ar command_keyword
+A
+.Sq Ic \&?
+will print a list of all the command
+keywords known to this incarnation of
+.Nm .
+A
+.Sq Ic \&?
+followed by a command keyword will print function and usage
+information about the command.
+This command is probably a better
+source of information about
+.Xr ntpq @NTPQ_MS@
+than this manual
+page.
+.It Ic delay Ar milliseconds
+Specify a time interval to be added to timestamps included in
+requests which require authentication.
+This is used to enable
+(unreliable) server reconfiguration over long delay network paths
+or between machines whose clocks are unsynchronized.
+Actually the
+server does not now require timestamps in authenticated requests,
+so this command may be obsolete.
+.It Ic host Ar hostname
+Set the host to which future queries will be sent.
+Hostname may
+be either a host name or a numeric address.
+.It Ic hostnames Op Cm yes | Cm no
+If
+.Cm yes
+is specified, host names are printed in
+information displays.
+If
+.Cm no
+is specified, numeric
+addresses are printed instead.
+The default is
+.Cm yes ,
+unless
+modified using the command line
+.Fl n
+switch.
+.It Ic keyid Ar keyid
+This command allows the specification of a key number to be
+used to authenticate configuration requests.
+This must correspond
+to a key number the server has been configured to use for this
+purpose.
+.It Ic quit
+Exit
+.Nm .
+.It Ic passwd
+This command prompts you to type in a password (which will not
+be echoed) which will be used to authenticate configuration
+requests.
+The password must correspond to the key configured for
+use by the NTP server for this purpose if such requests are to be
+successful.
+.It Ic timeout Ar milliseconds
+Specify a timeout period for responses to server queries.
+The
+default is about 8000 milliseconds.
+Note that since
+.Nm
+retries each query once after a timeout, the total waiting time for
+a timeout will be twice the timeout value set.
+.El
+.Ss "Control Message Commands"
+Query commands result in NTP mode 7 packets containing requests for
+information being sent to the server.
+These are read\-only commands
+in that they make no modification of the server configuration
+state.
+.Bl -tag -width indent
+.It Ic listpeers
+Obtains and prints a brief list of the peers for which the
+server is maintaining state.
+These should include all configured
+peer associations as well as those peers whose stratum is such that
+they are considered by the server to be possible future
+synchronization candidates.
+.It Ic peers
+Obtains a list of peers for which the server is maintaining
+state, along with a summary of that state.
+Summary information
+includes the address of the remote peer, the local interface
+address (0.0.0.0 if a local address has yet to be determined), the
+stratum of the remote peer (a stratum of 16 indicates the remote
+peer is unsynchronized), the polling interval, in seconds, the
+reachability register, in octal, and the current estimated delay,
+offset and dispersion of the peer, all in seconds.
+.Pp
+The character in the left margin indicates the mode this peer
+entry is operating in.
+A
+.Ql \&+
+denotes symmetric active, a
+.Ql \&\-
+indicates symmetric passive, a
+.Ql \&=
+means the
+remote server is being polled in client mode, a
+.Ql \&^
+indicates that the server is broadcasting to this address, a
+.Ql \&~
+denotes that the remote peer is sending broadcasts and a
+.Ql \&~
+denotes that the remote peer is sending broadcasts and a
+.Ql \&*
+marks the peer the server is currently synchronizing
+to.
+.Pp
+The contents of the host field may be one of four forms.
+It may
+be a host name, an IP address, a reference clock implementation
+name with its parameter or
+.Fn REFCLK "implementation_number" "parameter" .
+On
+.Ic hostnames
+.Cm no
+only IP\-addresses
+will be displayed.
+.It Ic dmpeers
+A slightly different peer summary list.
+Identical to the output
+of the
+.Ic peers
+command, except for the character in the
+leftmost column.
+Characters only appear beside peers which were
+included in the final stage of the clock selection algorithm.
+A
+.Ql \&.
+indicates that this peer was cast off in the falseticker
+detection, while a
+.Ql \&+
+indicates that the peer made it
+through.
+A
+.Ql \&*
+denotes the peer the server is currently
+synchronizing with.
+.It Ic showpeer Ar peer_address Oo Ar ... Oc
+Shows a detailed display of the current peer variables for one
+or more peers.
+Most of these values are described in the NTP
+Version 2 specification.
+.It Ic pstats Ar peer_address Oo Ar ... Oc
+Show per\-peer statistic counters associated with the specified
+peer(s).
+.It Ic clockstat Ar clock_peer_address Oo Ar ... Oc
+Obtain and print information concerning a peer clock.
+The
+values obtained provide information on the setting of fudge factors
+and other clock performance information.
+.It Ic kerninfo
+Obtain and print kernel phase\-lock loop operating parameters.
+This information is available only if the kernel has been specially
+modified for a precision timekeeping function.
+.It Ic loopinfo Op Cm oneline | Cm multiline
+Print the values of selected loop filter variables.
+The loop
+filter is the part of NTP which deals with adjusting the local
+system clock.
+The
+.Sq offset
+is the last offset given to the
+loop filter by the packet processing code.
+The
+.Sq frequency
+is the frequency error of the local clock in parts\-per\-million
+(ppm).
+The
+.Sq time_const
+controls the stiffness of the
+phase\-lock loop and thus the speed at which it can adapt to
+oscillator drift.
+The
+.Sq watchdog timer
+value is the number
+of seconds which have elapsed since the last sample offset was
+given to the loop filter.
+The
+.Cm oneline
+and
+.Cm multiline
+options specify the format in which this
+information is to be printed, with
+.Cm multiline
+as the
+default.
+.It Ic sysinfo
+Print a variety of system state variables, i.e., state related
+to the local server.
+All except the last four lines are described
+in the NTP Version 3 specification, RFC\-1305.
+.Pp
+The
+.Sq system flags
+show various system flags, some of
+which can be set and cleared by the
+.Ic enable
+and
+.Ic disable
+configuration commands, respectively.
+These are
+the
+.Cm auth ,
+.Cm bclient ,
+.Cm monitor ,
+.Cm pll ,
+.Cm pps
+and
+.Cm stats
+flags.
+See the
+.Xr ntpd @NTPD_MS@
+documentation for the meaning of these flags.
+There
+are two additional flags which are read only, the
+.Cm kernel_pll
+and
+.Cm kernel_pps .
+These flags indicate
+the synchronization status when the precision time kernel
+modifications are in use.
+The
+.Sq kernel_pll
+indicates that
+the local clock is being disciplined by the kernel, while the
+.Sq kernel_pps
+indicates the kernel discipline is provided by the PPS
+signal.
+.Pp
+The
+.Sq stability
+is the residual frequency error remaining
+after the system frequency correction is applied and is intended for
+maintenance and debugging.
+In most architectures, this value will
+initially decrease from as high as 500 ppm to a nominal value in
+the range .01 to 0.1 ppm.
+If it remains high for some time after
+starting the daemon, something may be wrong with the local clock,
+or the value of the kernel variable
+.Va kern.clockrate.tick
+may be
+incorrect.
+.Pp
+The
+.Sq broadcastdelay
+shows the default broadcast delay,
+as set by the
+.Ic broadcastdelay
+configuration command.
+.Pp
+The
+.Sq authdelay
+shows the default authentication delay,
+as set by the
+.Ic authdelay
+configuration command.
+.It Ic sysstats
+Print statistics counters maintained in the protocol
+module.
+.It Ic memstats
+Print statistics counters related to memory allocation
+code.
+.It Ic iostats
+Print statistics counters maintained in the input\-output
+module.
+.It Ic timerstats
+Print statistics counters maintained in the timer/event queue
+support code.
+.It Ic reslist
+Obtain and print the server's restriction list.
+This list is
+(usually) printed in sorted order and may help to understand how
+the restrictions are applied.
+.It Ic monlist Op Ar version
+Obtain and print traffic counts collected and maintained by the
+monitor facility.
+The version number should not normally need to be
+specified.
+.It Ic clkbug Ar clock_peer_address Oo Ar ... Oc
+Obtain debugging information for a reference clock driver.
+This
+information is provided only by some clock drivers and is mostly
+undecodable without a copy of the driver source in hand.
+.El
+.Ss "Runtime Configuration Requests"
+All requests which cause state changes in the server are
+authenticated by the server using a configured NTP key (the
+facility can also be disabled by the server by not configuring a
+key).
+The key number and the corresponding key must also be made
+known to
+.Nm .
+This can be done using the
+.Ic keyid
+and
+.Ic passwd
+commands, the latter of which will prompt at the terminal for a
+password to use as the encryption key.
+You will also be prompted
+automatically for both the key number and password the first time a
+command which would result in an authenticated request to the
+server is given.
+Authentication not only provides verification that
+the requester has permission to make such changes, but also gives
+an extra degree of protection again transmission errors.
+.Pp
+Authenticated requests always include a timestamp in the packet
+data, which is included in the computation of the authentication
+code.
+This timestamp is compared by the server to its receive time
+stamp.
+If they differ by more than a small amount the request is
+rejected.
+This is done for two reasons.
+First, it makes simple
+replay attacks on the server, by someone who might be able to
+overhear traffic on your LAN, much more difficult.
+Second, it makes
+it more difficult to request configuration changes to your server
+from topologically remote hosts.
+While the reconfiguration facility
+will work well with a server on the local host, and may work
+adequately between time\-synchronized hosts on the same LAN, it will
+work very poorly for more distant hosts.
+As such, if reasonable
+passwords are chosen, care is taken in the distribution and
+protection of keys and appropriate source address restrictions are
+applied, the run time reconfiguration facility should provide an
+adequate level of security.
+.Pp
+The following commands all make authenticated requests.
+.Bl -tag -width indent
+.It Xo Ic addpeer Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Add a configured peer association at the given address and
+operating in symmetric active mode.
+Note that an existing
+association with the same peer may be deleted when this command is
+executed, or may simply be converted to conform to the new
+configuration, as appropriate.
+If the optional
+.Ar keyid
+is a
+nonzero integer, all outgoing packets to the remote server will
+have an authentication field attached encrypted with this key.
+If
+the value is 0 (or not given) no authentication will be done.
+The
+.Ar version
+can be 1, 2 or 3 and defaults to 3.
+The
+.Cm prefer
+keyword indicates a preferred peer (and thus will
+be used primarily for clock synchronisation if possible).
+The
+preferred peer also determines the validity of the PPS signal \- if
+the preferred peer is suitable for synchronisation so is the PPS
+signal.
+.It Xo Ic addserver Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Identical to the addpeer command, except that the operating
+mode is client.
+.It Xo Ic broadcast Ar peer_address
+.Op Ar keyid
+.Op Ar version
+.Op Cm prefer
+.Xc
+Identical to the addpeer command, except that the operating
+mode is broadcast.
+In this case a valid key identifier and key are
+required.
+The
+.Ar peer_address
+parameter can be the broadcast
+address of the local network or a multicast group address assigned
+to NTP.
+If a multicast address, a multicast\-capable kernel is
+required.
+.It Ic unconfig Ar peer_address Oo Ar ... Oc
+This command causes the configured bit to be removed from the
+specified peer(s).
+In many cases this will cause the peer
+association to be deleted.
+When appropriate, however, the
+association may persist in an unconfigured mode if the remote peer
+is willing to continue on in this fashion.
+.It Xo Ic fudge Ar peer_address
+.Op Cm time1
+.Op Cm time2
+.Op Ar stratum
+.Op Ar refid
+.Xc
+This command provides a way to set certain data for a reference
+clock.
+See the source listing for further information.
+.It Xo Ic enable
+.Oo
+.Cm auth | Cm bclient |
+.Cm calibrate | Cm kernel |
+.Cm monitor | Cm ntp |
+.Cm pps | Cm stats
+.Oc
+.Xc
+.It Xo Ic disable
+.Oo
+.Cm auth | Cm bclient |
+.Cm calibrate | Cm kernel |
+.Cm monitor | Cm ntp |
+.Cm pps | Cm stats
+.Oc
+.Xc
+These commands operate in the same way as the
+.Ic enable
+and
+.Ic disable
+configuration file commands of
+.Xr ntpd @NTPD_MS@ .
+.Bl -tag -width indent
+.It Cm auth
+Enables the server to synchronize with unconfigured peers only
+if the peer has been correctly authenticated using either public key
+or private key cryptography.
+The default for this flag is enable.
+.It Cm bclient
+Enables the server to listen for a message from a broadcast or
+multicast server, as in the multicastclient command with
+default address.
+The default for this flag is disable.
+.It Cm calibrate
+Enables the calibrate feature for reference clocks.
+The default for this flag is disable.
+.It Cm kernel
+Enables the kernel time discipline, if available.
+The default for this flag is enable if support is available, otherwise disable.
+.It Cm monitor
+Enables the monitoring facility.
+See the documentation here about the
+.Cm monlist
+command or further information.
+The default for this flag is enable.
+.It Cm ntp
+Enables time and frequency discipline.
+In effect, this switch opens and closes the feedback loop,
+which is useful for testing.
+The default for this flag is enable.
+.It Cm pps
+Enables the pulse\-per\-second (PPS) signal when frequency
+and time is disciplined by the precision time kernel modifications.
+See the
+.Qq A Kernel Model for Precision Timekeeping
+(available as part of the HTML documentation
+provided in
+.Pa /usr/share/doc/ntp )
+page for further information.
+The default for this flag is disable.
+.It Cm stats
+Enables the statistics facility.
+See the
+.Sx Monitoring Options
+section of
+.Xr ntp.conf 5
+for further information.
+The default for this flag is disable.
+.El
+.It Xo Ic restrict Ar address Ar mask
+.Ar flag Oo Ar ... Oc
+.Xc
+This command operates in the same way as the
+.Ic restrict
+configuration file commands of
+.Xr ntpd @NTPD_MS@ .
+.It Xo Ic unrestrict Ar address Ar mask
+.Ar flag Oo Ar ... Oc
+.Xc
+Unrestrict the matching entry from the restrict list.
+.It Xo Ic delrestrict Ar address Ar mask
+.Op Cm ntpport
+.Xc
+Delete the matching entry from the restrict list.
+.It Ic readkeys
+Causes the current set of authentication keys to be purged and
+a new set to be obtained by rereading the keys file (which must
+have been specified in the
+.Xr ntpd @NTPD_MS@
+configuration file).
+This
+allows encryption keys to be changed without restarting the
+server.
+.It Ic trustedkey Ar keyid Oo Ar ... Oc
+.It Ic untrustedkey Ar keyid Oo Ar ... Oc
+These commands operate in the same way as the
+.Ic trustedkey
+and
+.Ic untrustedkey
+configuration file
+commands of
+.Xr ntpd @NTPD_MS@ .
+.It Ic authinfo
+Returns information concerning the authentication module,
+including known keys and counts of encryptions and decryptions
+which have been done.
+.It Ic traps
+Display the traps set in the server.
+See the source listing for
+further information.
+.It Xo Ic addtrap Ar address
+.Op Ar port
+.Op Ar interface
+.Xc
+Set a trap for asynchronous messages.
+See the source listing
+for further information.
+.It Xo Ic clrtrap Ar address
+.Op Ar port
+.Op Ar interface
+.Xc
+Clear a trap for asynchronous messages.
+See the source listing
+for further information.
+.It Ic reset
+Clear the statistics counters in various modules of the server.
+See the source listing for further information.
+.El
+.Sh "ENVIRONMENT"
+See \fBOPTION PRESETS\fP for configuration environment variables.
+.Sh "FILES"
+See \fBOPTION PRESETS\fP for configuration files.
+.Sh "EXIT STATUS"
+One of the following exit values will be returned:
+.Bl -tag
+.It 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.It 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.It 66 " (EX_NOINPUT)"
+A specified configuration file could not be loaded.
+.It 70 " (EX_SOFTWARE)"
+libopts had an internal operational error. Please report
+it to autogen\-users@lists.sourceforge.net. Thank you.
+.El
+.Sh "SEE ALSO"
+.Xr ntp.conf 5 ,
+.Xr ntpd @NTPD_MS@
+.Rs
+.%A David L. Mills
+.%T Network Time Protocol (Version 3)
+.%O RFC1305
+.Re
+.Sh AUTHORS
+The formatting directives in this document came from FreeBSD.
+.Sh "COPYRIGHT"
+Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
+This program is released under the terms of the NTP license, <http://ntp.org/license>.
+.Sh BUGS
+The
+.Nm
+utility is a crude hack.
+Much of the information it shows is
+deadly boring and could only be loved by its implementer.
+The
+program was designed so that new (and temporary) features were easy
+to hack in, at great expense to the program's ease of use.
+Despite
+this, the program is occasionally useful.
+.Pp
+Please report bugs to http://bugs.ntp.org .
+.Pp
+Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
+.Sh "NOTES"
+This manual page was \fIAutoGen\fP\-erated from the \fBntpdc\fP
+option definitions.
diff --git a/contrib/ntp/ntpdc/ntpdc.texi b/contrib/ntp/ntpdc/ntpdc.texi
new file mode 100644
index 0000000..3a82806
--- /dev/null
+++ b/contrib/ntp/ntpdc/ntpdc.texi
@@ -0,0 +1,88 @@
+\input texinfo @c -*-texinfo-*-
+@c %**start of header
+@setfilename ntpdc.info
+@settitle ntpdc: NTPD Control User's Manual
+@include ../sntp/include/version.texi
+@paragraphindent 2
+@c %**end of header
+
+@ifinfo
+This file documents the use of the NTP Project's ntpdc, a program for
+controlling ntpd.
+@end ifinfo
+
+@direntry
+* ntpdc: (ntpdc). ntpd Control program
+@end direntry
+
+@titlepage
+@title ntpdc: NTPD Control User's Manual
+@subtitle ntpdc, version @value{VERSION}, @value{UPDATED}
+@c @author Max @email{foo@ntp.org}
+@end titlepage
+
+@c @page
+@c @vskip 0pt plus 1filll
+
+@node Top, ntpdc Description, (dir), (dir)
+@top ntpdc: NTPD Control User Manual
+
+This document describes the use of the NTP Project's @code{ntpdc} program,
+that can be used to query a Network Time Protocol (NTP) server and
+display the time offset of the system clock relative to the server
+clock. Run as root, it can correct the system clock to this offset as
+well. It can be run as an interactive command or from a cron job.
+
+This document applies to version @value{VERSION} of @code{ntpdc}.
+
+The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
+IETF specification.
+
+@shortcontents
+
+@menu
+* ntpdc Description:: Description
+* ntpdc Invocation:: Invoking ntpdc
+* Usage:: Usage
+@end menu
+
+@node ntpdc Description
+@comment node-name, next, previous, up
+@section Description
+
+By default, @code{ntpdc} writes the local data and time (i.e., not UTC) to the
+standard output in the format:
+
+@example
+1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
+@end example
+
+where
+YYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time,
+(+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC),
+and
+the +4.567 +/- 0.089 secs indicates the time offset and
+error bound of the system clock relative to the server clock.
+
+@include invoke-ntpdc.texi
+
+@node Usage
+@comment node-name, next, previous, up
+@section Usage
+
+The simplest use of this program is as an unprivileged command to
+check the current time, offset, and error in the local clock.
+For example:
+
+@example
+ntpdc ntpserver.somewhere
+@end example
+
+With suitable privilege, it can be run as a command or in a
+@code{cron} job to reset the local clock from a reliable server, like
+the @code{ntpdate} and @code{rdate} commands.
+For example:
+
+@example
+ntpdc -a ntpserver.somewhere
+@end example
diff --git a/contrib/ntp/ntpdc/ntpdc_ops.c b/contrib/ntp/ntpdc/ntpdc_ops.c
index e40016b..be8ffa2 100644
--- a/contrib/ntp/ntpdc/ntpdc_ops.c
+++ b/contrib/ntp/ntpdc/ntpdc_ops.c
@@ -1,5 +1,6 @@
/*
- * ntpdc_ops.c - subroutines which are called to perform operations by xntpdc
+ * ntpdc_ops.c - subroutines which are called to perform operations by
+ * ntpdc
*/
#ifdef HAVE_CONFIG_H
@@ -10,6 +11,7 @@
#include <stddef.h>
#include "ntpdc.h"
+#include "ntp_net.h"
#include "ntp_control.h"
#include "ntp_refclock.h"
#include "ntp_stdlib.h"
@@ -19,67 +21,73 @@
# include <sys/timex.h>
#endif
#if !defined(__bsdi__) && !defined(apollo)
+#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#endif
#include <arpa/inet.h>
/*
+ * utility functions
+ */
+static int checkitems (int, FILE *);
+static int checkitemsize (int, int);
+static int check1item (int, FILE *);
+
+/*
* Declarations for command handlers in here
*/
-static int checkitems P((int, FILE *));
-static int checkitemsize P((int, int));
-static int check1item P((int, FILE *));
-static void peerlist P((struct parse *, FILE *));
-static void peers P((struct parse *, FILE *));
-static void doconfig P((struct parse *pcmd, FILE *fp, int mode, int refc));
-static void dmpeers P((struct parse *, FILE *));
-static void dopeers P((struct parse *, FILE *, int));
-static void printpeer P((struct info_peer *, FILE *));
-static void showpeer P((struct parse *, FILE *));
-static void peerstats P((struct parse *, FILE *));
-static void loopinfo P((struct parse *, FILE *));
-static void sysinfo P((struct parse *, FILE *));
-static void sysstats P((struct parse *, FILE *));
-static void iostats P((struct parse *, FILE *));
-static void memstats P((struct parse *, FILE *));
-static void timerstats P((struct parse *, FILE *));
-static void addpeer P((struct parse *, FILE *));
-static void addserver P((struct parse *, FILE *));
-static void addrefclock P((struct parse *, FILE *));
-static void broadcast P((struct parse *, FILE *));
-static void doconfig P((struct parse *, FILE *, int, int));
-static void unconfig P((struct parse *, FILE *));
-static void set P((struct parse *, FILE *));
-static void sys_clear P((struct parse *, FILE *));
-static void doset P((struct parse *, FILE *, int));
-static void reslist P((struct parse *, FILE *));
-static void new_restrict P((struct parse *, FILE *));
-static void unrestrict P((struct parse *, FILE *));
-static void delrestrict P((struct parse *, FILE *));
-static void do_restrict P((struct parse *, FILE *, int));
-static void monlist P((struct parse *, FILE *));
-static void reset P((struct parse *, FILE *));
-static void preset P((struct parse *, FILE *));
-static void readkeys P((struct parse *, FILE *));
-static void trustkey P((struct parse *, FILE *));
-static void untrustkey P((struct parse *, FILE *));
-static void do_trustkey P((struct parse *, FILE *, int));
-static void authinfo P((struct parse *, FILE *));
-static void traps P((struct parse *, FILE *));
-static void addtrap P((struct parse *, FILE *));
-static void clrtrap P((struct parse *, FILE *));
-static void do_addclr_trap P((struct parse *, FILE *, int));
-static void requestkey P((struct parse *, FILE *));
-static void controlkey P((struct parse *, FILE *));
-static void do_changekey P((struct parse *, FILE *, int));
-static void ctlstats P((struct parse *, FILE *));
-static void clockstat P((struct parse *, FILE *));
-static void fudge P((struct parse *, FILE *));
-static void clkbug P((struct parse *, FILE *));
-static void kerninfo P((struct parse *, FILE *));
-static void get_if_stats P((struct parse *, FILE *));
-static void do_if_reload P((struct parse *, FILE *));
+static void peerlist (struct parse *, FILE *);
+static void peers (struct parse *, FILE *);
+static void doconfig (struct parse *pcmd, FILE *fp, int mode, int refc);
+static void dmpeers (struct parse *, FILE *);
+static void dopeers (struct parse *, FILE *, int);
+static void printpeer (struct info_peer *, FILE *);
+static void showpeer (struct parse *, FILE *);
+static void peerstats (struct parse *, FILE *);
+static void loopinfo (struct parse *, FILE *);
+static void sysinfo (struct parse *, FILE *);
+static void sysstats (struct parse *, FILE *);
+static void iostats (struct parse *, FILE *);
+static void memstats (struct parse *, FILE *);
+static void timerstats (struct parse *, FILE *);
+static void addpeer (struct parse *, FILE *);
+static void addserver (struct parse *, FILE *);
+static void addrefclock (struct parse *, FILE *);
+static void broadcast (struct parse *, FILE *);
+static void doconfig (struct parse *, FILE *, int, int);
+static void unconfig (struct parse *, FILE *);
+static void set (struct parse *, FILE *);
+static void sys_clear (struct parse *, FILE *);
+static void doset (struct parse *, FILE *, int);
+static void reslist (struct parse *, FILE *);
+static void new_restrict (struct parse *, FILE *);
+static void unrestrict (struct parse *, FILE *);
+static void delrestrict (struct parse *, FILE *);
+static void do_restrict (struct parse *, FILE *, int);
+static void monlist (struct parse *, FILE *);
+static void reset (struct parse *, FILE *);
+static void preset (struct parse *, FILE *);
+static void readkeys (struct parse *, FILE *);
+static void trustkey (struct parse *, FILE *);
+static void untrustkey (struct parse *, FILE *);
+static void do_trustkey (struct parse *, FILE *, int);
+static void authinfo (struct parse *, FILE *);
+static void traps (struct parse *, FILE *);
+static void addtrap (struct parse *, FILE *);
+static void clrtrap (struct parse *, FILE *);
+static void do_addclr_trap (struct parse *, FILE *, int);
+static void requestkey (struct parse *, FILE *);
+static void controlkey (struct parse *, FILE *);
+static void do_changekey (struct parse *, FILE *, int);
+static void ctlstats (struct parse *, FILE *);
+static void clockstat (struct parse *, FILE *);
+static void fudge (struct parse *, FILE *);
+static void clkbug (struct parse *, FILE *);
+static void kerninfo (struct parse *, FILE *);
+static void get_if_stats (struct parse *, FILE *);
+static void do_if_reload (struct parse *, FILE *);
/*
* Commands we understand. Ntpdc imports this.
@@ -136,7 +144,7 @@ struct xcmd opcmds[] = {
{ "enable", set, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
{ "auth|bclient|monitor|pll|kernel|stats", "...", "...", "..." },
"set a system flag (auth, bclient, monitor, pll, kernel, stats)" },
- { "disable", sys_clear, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
+ { "disable", sys_clear, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
{ "auth|bclient|monitor|pll|kernel|stats", "...", "...", "..." },
"clear a system flag (auth, bclient, monitor, pll, kernel, stats)" },
{ "reslist", reslist, {OPT|IP_VERSION, NO, NO, NO },
@@ -159,7 +167,7 @@ struct xcmd opcmds[] = {
{ "version", "", "", "" },
"display data the server's monitor routines have collected" },
{ "reset", reset, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
- { "io|sys|mem|timer|auth|allpeers", "...", "...", "..." },
+ { "io|sys|mem|timer|auth|ctl|allpeers", "...", "...", "..." },
"reset various subsystem statistics counters" },
{ "preset", preset, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD },
{ "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" },
@@ -221,6 +229,59 @@ struct xcmd opcmds[] = {
*/
#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
+/*
+ * SET_SS_LEN_IF_PRESENT - used by SET_ADDR, SET_ADDRS macros
+ */
+
+#ifdef ISC_PLATFORM_HAVESALEN
+#define SET_SS_LEN_IF_PRESENT(psau) \
+ do { \
+ (psau)->sa.sa_len = SOCKLEN(psau); \
+ } while (0)
+#else
+#define SET_SS_LEN_IF_PRESENT(psau) do { } while (0)
+#endif
+
+/*
+ * SET_ADDR - setup address for v4/v6 as needed
+ */
+#define SET_ADDR(address, v6flag, v4addr, v6addr) \
+do { \
+ ZERO(address); \
+ if (v6flag) { \
+ AF(&(address)) = AF_INET6; \
+ SOCK_ADDR6(&(address)) = (v6addr); \
+ } else { \
+ AF(&(address)) = AF_INET; \
+ NSRCADR(&(address)) = (v4addr); \
+ } \
+ SET_SS_LEN_IF_PRESENT(&(address)); \
+} while (0)
+
+
+/*
+ * SET_ADDRS - setup source and destination addresses for
+ * v4/v6 as needed
+ */
+#define SET_ADDRS(a1, a2, info, a1prefix, a2prefix) \
+do { \
+ ZERO(a1); \
+ ZERO(a2); \
+ if ((info)->v6_flag) { \
+ AF(&(a1)) = AF_INET6; \
+ AF(&(a2)) = AF_INET6; \
+ SOCK_ADDR6(&(a1)) = (info)->a1prefix##6; \
+ SOCK_ADDR6(&(a2)) = (info)->a2prefix##6; \
+ } else { \
+ AF(&(a1)) = AF_INET; \
+ AF(&(a2)) = AF_INET; \
+ NSRCADR(&(a1)) = (info)->a1prefix; \
+ NSRCADR(&(a2)) = (info)->a2prefix; \
+ } \
+ SET_SS_LEN_IF_PRESENT(&(a1)); \
+ SET_SS_LEN_IF_PRESENT(&(a2)); \
+} while (0)
+
/*
* checkitems - utility to print a message if no items were returned
@@ -280,7 +341,6 @@ check1item(
}
-
/*
* peerlist - get a short list of peers
*/
@@ -292,7 +352,7 @@ peerlist(
)
{
struct info_peer_list *plist;
- struct sockaddr_storage paddr;
+ sockaddr_u paddr;
int items;
int itemsize;
int res;
@@ -318,17 +378,7 @@ again:
return;
while (items > 0) {
- memset((char *)&paddr, 0, sizeof(paddr));
- if (plist->v6_flag != 0) {
- GET_INADDR6(paddr) = plist->addr6;
- paddr.ss_family = AF_INET6;
- } else {
- GET_INADDR(paddr) = plist->addr;
- paddr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- paddr.ss_len = SOCKLEN(&paddr);
-#endif
+ SET_ADDR(paddr, plist->v6_flag, plist->addr, plist->addr6);
if ((pcmd->nargs == 0) ||
((pcmd->argval->ival == 6) && (plist->v6_flag != 0)) ||
((pcmd->argval->ival == 4) && (plist->v6_flag == 0)))
@@ -378,8 +428,8 @@ dopeers(
)
{
struct info_peer_summary *plist;
- struct sockaddr_storage dstadr;
- struct sockaddr_storage srcadr;
+ sockaddr_u dstadr;
+ sockaddr_u srcadr;
int items;
int itemsize;
int ntp_poll;
@@ -440,28 +490,12 @@ again:
NTOHL_FP(&(plist->offset), &tempts);
ntp_poll = 1<<max(min3(plist->ppoll, plist->hpoll, NTP_MAXPOLL),
NTP_MINPOLL);
- memset((char *)&dstadr, 0, sizeof(dstadr));
- memset((char *)&srcadr, 0, sizeof(srcadr));
- if (plist->v6_flag != 0) {
- GET_INADDR6(dstadr) = plist->dstadr6;
- GET_INADDR6(srcadr) = plist->srcadr6;
- srcadr.ss_family = AF_INET6;
- dstadr.ss_family = AF_INET6;
- } else {
- GET_INADDR(dstadr) = plist->dstadr;
- GET_INADDR(srcadr) = plist->srcadr;
- srcadr.ss_family = AF_INET;
- dstadr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- srcadr.ss_len = SOCKLEN(&srcadr);
- dstadr.ss_len = SOCKLEN(&dstadr);
-#endif
+ SET_ADDRS(dstadr, srcadr, plist, dstadr, srcadr);
if ((pcmd->nargs == 0) ||
((pcmd->argval->ival == 6) && (plist->v6_flag != 0)) ||
((pcmd->argval->ival == 4) && (plist->v6_flag == 0)))
(void) fprintf(fp,
- "%c%-15.15s %-15.15s %2d %4d %3o %7.7s %9.9s %7.7s\n",
+ "%c%-15.15s %-15.15s %2u %4d %3o %7.7s %9.9s %7.7s\n",
c, nntohost(&srcadr), stoa(&dstadr),
plist->stratum, ntp_poll, plist->reach,
fptoa(NTOHS_FP(plist->delay), 5),
@@ -473,7 +507,7 @@ again:
}
/* Convert a refid & stratum (in host order) to a string */
-static char*
+static char *
refid_string(
u_int32 refid,
int stratum
@@ -482,7 +516,7 @@ refid_string(
if (stratum <= 1) {
static char junk[5];
junk[4] = 0;
- memmove(junk, (char *)&refid, 4);
+ memcpy(junk, &refid, 4);
return junk;
}
@@ -491,49 +525,56 @@ refid_string(
static void
print_pflag(
- FILE *fp,
- u_int32 flags
- )
+ FILE * fp,
+ u_int32 flags
+ )
{
- const char *str;
+ static const char none[] = "";
+ static const char comma[] = ",";
+ const char *dlim;
- if (flags == 0) {
- (void) fprintf(fp, " none\n");
- } else {
- str = "";
- if (flags & INFO_FLAG_SYSPEER) {
- (void) fprintf(fp, " system_peer");
- str = ",";
- }
- if (flags & INFO_FLAG_CONFIG) {
- (void) fprintf(fp, "%s config", str);
- str = ",";
- }
- if (flags & INFO_FLAG_REFCLOCK) {
- (void) fprintf(fp, "%s refclock", str);
- str = ",";
- }
- if (flags & INFO_FLAG_AUTHENABLE) {
- (void) fprintf(fp, "%s auth", str);
- str = ",";
- }
- if (flags & INFO_FLAG_BCLIENT) {
- (void) fprintf(fp, "%s bclient", str);
- str = ",";
- }
- if (flags & INFO_FLAG_PREFER) {
- (void) fprintf(fp, "%s prefer", str);
- str = ",";
- }
- if (flags & INFO_FLAG_IBURST) {
- (void) fprintf(fp, "%s iburst", str);
- str = ",";
- }
- if (flags & INFO_FLAG_BURST) {
- (void) fprintf(fp, "%s burst", str);
- }
- (void) fprintf(fp, "\n");
+ if (0 == flags) {
+ fprintf(fp, " none\n");
+ return;
+ }
+ dlim = none;
+ if (flags & INFO_FLAG_SYSPEER) {
+ fprintf(fp, " system_peer");
+ dlim = comma;
}
+ if (flags & INFO_FLAG_CONFIG) {
+ fprintf(fp, "%s config", dlim);
+ dlim = comma;
+ }
+ if (flags & INFO_FLAG_REFCLOCK) {
+ fprintf(fp, "%s refclock", dlim);
+ dlim = comma;
+ }
+ if (flags & INFO_FLAG_AUTHENABLE) {
+ fprintf(fp, "%s auth", dlim);
+ dlim = comma;
+ }
+ if (flags & INFO_FLAG_PREFER) {
+ fprintf(fp, "%s prefer", dlim);
+ dlim = comma;
+ }
+ if (flags & INFO_FLAG_IBURST) {
+ fprintf(fp, "%s iburst", dlim);
+ dlim = comma;
+ }
+ if (flags & INFO_FLAG_BURST) {
+ fprintf(fp, "%s burst", dlim);
+ dlim = comma;
+ }
+ if (flags & INFO_FLAG_SEL_CANDIDATE) {
+ fprintf(fp, "%s candidate", dlim);
+ dlim = comma;
+ }
+ if (flags & INFO_FLAG_SHORTLIST) {
+ fprintf(fp, "%s shortlist", dlim);
+ dlim = comma;
+ }
+ fprintf(fp, "\n");
}
/*
* printpeer - print detail information for a peer
@@ -546,25 +587,10 @@ printpeer(
{
register int i;
l_fp tempts;
- struct sockaddr_storage srcadr, dstadr;
+ sockaddr_u srcadr, dstadr;
+
+ SET_ADDRS(dstadr, srcadr, pp, dstadr, srcadr);
- memset((char *)&srcadr, 0, sizeof(srcadr));
- memset((char *)&dstadr, 0, sizeof(dstadr));
- if (pp->v6_flag != 0) {
- srcadr.ss_family = AF_INET6;
- dstadr.ss_family = AF_INET6;
- GET_INADDR6(srcadr) = pp->srcadr6;
- GET_INADDR6(dstadr) = pp->dstadr6;
- } else {
- srcadr.ss_family = AF_INET;
- dstadr.ss_family = AF_INET;
- GET_INADDR(srcadr) = pp->srcadr;
- GET_INADDR(dstadr) = pp->dstadr;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- srcadr.ss_len = SOCKLEN(&srcadr);
- dstadr.ss_len = SOCKLEN(&dstadr);
-#endif
(void) fprintf(fp, "remote %s, local %s\n",
stoa(&srcadr), stoa(&dstadr));
(void) fprintf(fp, "hmode %s, pmode %s, stratum %d, precision %d\n",
@@ -653,6 +679,7 @@ showpeer(
struct info_peer *pp;
/* 4 is the maximum number of peers which will fit in a packet */
struct info_peer_list *pl, plist[min(MAXARGS, 4)];
+ int qitemlim;
int qitems;
int items;
int itemsize;
@@ -665,9 +692,10 @@ again:
else
sendsize = v4sizeof(struct info_peer_list);
- for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 4); qitems++) {
- if (pcmd->argval[qitems].netnum.ss_family == AF_INET) {
- pl->addr = GET_INADDR(pcmd->argval[qitems].netnum);
+ qitemlim = min(pcmd->nargs, COUNTOF(plist));
+ for (qitems = 0, pl = plist; qitems < qitemlim; qitems++) {
+ if (IS_IPV4(&pcmd->argval[qitems].netnum)) {
+ pl->addr = NSRCADR(&pcmd->argval[qitems].netnum);
if (impl_ver == IMPL_XNTPD)
pl->v6_flag = 0;
} else {
@@ -676,12 +704,12 @@ again:
"***Server doesn't understand IPv6 addresses\n");
return;
}
- pl->addr6 = GET_INADDR6(pcmd->argval[qitems].netnum);
+ pl->addr6 = SOCK_ADDR6(&pcmd->argval[qitems].netnum);
pl->v6_flag = 1;
}
pl->port = (u_short)s_port;
pl->hmode = pl->flags = 0;
- pl = (struct info_peer_list *)((char *)pl + sendsize);
+ pl = (void *)((char *)pl + sendsize);
}
res = doquery(impl_ver, REQ_PEER_INFO, 0, qitems,
@@ -694,19 +722,19 @@ again:
}
if (res != 0)
- return;
+ return;
if (!checkitems(items, fp))
- return;
+ return;
if (!checkitemsize(itemsize, sizeof(struct info_peer)) &&
!checkitemsize(itemsize, v4sizeof(struct info_peer)))
- return;
+ return;
while (items-- > 0) {
printpeer(pp, fp);
if (items > 0)
- (void) fprintf(fp, "\n");
+ fprintf(fp, "\n");
pp++;
}
}
@@ -724,7 +752,8 @@ peerstats(
struct info_peer_stats *pp;
/* 4 is the maximum number of peers which will fit in a packet */
struct info_peer_list *pl, plist[min(MAXARGS, 4)];
- struct sockaddr_storage src, dst;
+ sockaddr_u src, dst;
+ int qitemlim;
int qitems;
int items;
int itemsize;
@@ -737,10 +766,12 @@ again:
else
sendsize = v4sizeof(struct info_peer_list);
- memset((char *)plist, 0, sizeof(struct info_peer_list) * min(MAXARGS, 4));
- for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 4); qitems++) {
- if (pcmd->argval[qitems].netnum.ss_family == AF_INET) {
- pl->addr = GET_INADDR(pcmd->argval[qitems].netnum);
+ ZERO(plist);
+
+ qitemlim = min(pcmd->nargs, COUNTOF(plist));
+ for (qitems = 0, pl = plist; qitems < qitemlim; qitems++) {
+ if (IS_IPV4(&pcmd->argval[qitems].netnum)) {
+ pl->addr = NSRCADR(&pcmd->argval[qitems].netnum);
if (impl_ver == IMPL_XNTPD)
pl->v6_flag = 0;
} else {
@@ -749,12 +780,12 @@ again:
"***Server doesn't understand IPv6 addresses\n");
return;
}
- pl->addr6 = GET_INADDR6(pcmd->argval[qitems].netnum);
+ pl->addr6 = SOCK_ADDR6(&pcmd->argval[qitems].netnum);
pl->v6_flag = 1;
}
pl->port = (u_short)s_port;
pl->hmode = plist[qitems].flags = 0;
- pl = (struct info_peer_list *)((char *)pl + sendsize);
+ pl = (void *)((char *)pl + sendsize);
}
res = doquery(impl_ver, REQ_PEER_STATS, 0, qitems,
@@ -768,7 +799,7 @@ again:
}
if (res != 0)
- return;
+ return;
if (!checkitems(items, fp))
return;
@@ -778,54 +809,54 @@ again:
return;
while (items-- > 0) {
- memset((char *)&src, 0, sizeof(src));
- memset((char *)&dst, 0, sizeof(dst));
+ ZERO_SOCK(&dst);
+ ZERO_SOCK(&src);
if (pp->v6_flag != 0) {
- GET_INADDR6(src) = pp->srcadr6;
- GET_INADDR6(dst) = pp->dstadr6;
- src.ss_family = AF_INET6;
- dst.ss_family = AF_INET6;
+ AF(&dst) = AF_INET6;
+ AF(&src) = AF_INET6;
+ SOCK_ADDR6(&dst) = pp->dstadr6;
+ SOCK_ADDR6(&src) = pp->srcadr6;
} else {
- GET_INADDR(src) = pp->srcadr;
- GET_INADDR(dst) = pp->dstadr;
- src.ss_family = AF_INET;
- dst.ss_family = AF_INET;
+ AF(&dst) = AF_INET;
+ AF(&src) = AF_INET;
+ NSRCADR(&dst) = pp->dstadr;
+ NSRCADR(&src) = pp->srcadr;
}
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- src.ss_len = SOCKLEN(&src);
- dst.ss_len = SOCKLEN(&dst);
+#ifdef ISC_PLATFORM_HAVESALEN
+ src.sa.sa_len = SOCKLEN(&src);
+ dst.sa.sa_len = SOCKLEN(&dst);
#endif
- (void) fprintf(fp, "remote host: %s\n",
- nntohost(&src));
- (void) fprintf(fp, "local interface: %s\n",
- stoa(&dst));
- (void) fprintf(fp, "time last received: %lds\n",
- (long)ntohl(pp->timereceived));
- (void) fprintf(fp, "time until next send: %lds\n",
- (long)ntohl(pp->timetosend));
- (void) fprintf(fp, "reachability change: %lds\n",
- (long)ntohl(pp->timereachable));
- (void) fprintf(fp, "packets sent: %ld\n",
- (long)ntohl(pp->sent));
- (void) fprintf(fp, "packets received: %ld\n",
- (long)ntohl(pp->processed));
- (void) fprintf(fp, "bad authentication: %ld\n",
- (long)ntohl(pp->badauth));
- (void) fprintf(fp, "bogus origin: %ld\n",
- (long)ntohl(pp->bogusorg));
- (void) fprintf(fp, "duplicate: %ld\n",
- (long)ntohl(pp->oldpkt));
- (void) fprintf(fp, "bad dispersion: %ld\n",
- (long)ntohl(pp->seldisp));
- (void) fprintf(fp, "bad reference time: %ld\n",
- (long)ntohl(pp->selbroken));
- (void) fprintf(fp, "candidate order: %d\n",
- (int)pp->candidate);
+ fprintf(fp, "remote host: %s\n",
+ nntohost(&src));
+ fprintf(fp, "local interface: %s\n",
+ stoa(&dst));
+ fprintf(fp, "time last received: %lus\n",
+ (u_long)ntohl(pp->timereceived));
+ fprintf(fp, "time until next send: %lus\n",
+ (u_long)ntohl(pp->timetosend));
+ fprintf(fp, "reachability change: %lus\n",
+ (u_long)ntohl(pp->timereachable));
+ fprintf(fp, "packets sent: %lu\n",
+ (u_long)ntohl(pp->sent));
+ fprintf(fp, "packets received: %lu\n",
+ (u_long)ntohl(pp->processed));
+ fprintf(fp, "bad authentication: %lu\n",
+ (u_long)ntohl(pp->badauth));
+ fprintf(fp, "bogus origin: %lu\n",
+ (u_long)ntohl(pp->bogusorg));
+ fprintf(fp, "duplicate: %lu\n",
+ (u_long)ntohl(pp->oldpkt));
+ fprintf(fp, "bad dispersion: %lu\n",
+ (u_long)ntohl(pp->seldisp));
+ fprintf(fp, "bad reference time: %lu\n",
+ (u_long)ntohl(pp->selbroken));
+ fprintf(fp, "candidate order: %u\n",
+ pp->candidate);
if (items > 0)
- (void) fprintf(fp, "\n");
- (void) fprintf(fp, "flags: ");
+ fprintf(fp, "\n");
+ fprintf(fp, "flags: ");
print_pflag(fp, ntohs(pp->flags));
- pp++;
+ pp++;
}
}
@@ -886,7 +917,7 @@ again:
"offset %s, frequency %s, time_const %ld, watchdog %ld\n",
lfptoa(&tempts, 6),
lfptoa(&temp2ts, 3),
- (long)(int32_t)ntohl((u_long)il->compliance),
+ (long)(int32)ntohl((u_long)il->compliance),
(u_long)ntohl((u_long)il->watchdog_timer));
} else {
NTOHL_FP(&il->last_offset, &tempts);
@@ -896,7 +927,7 @@ again:
(void) fprintf(fp, "frequency: %s ppm\n",
lfptoa(&tempts, 3));
(void) fprintf(fp, "poll adjust: %ld\n",
- (long)(int32_t)ntohl(il->compliance));
+ (long)(int32)ntohl(il->compliance));
(void) fprintf(fp, "watchdog timer: %ld s\n",
(u_long)ntohl(il->watchdog_timer));
}
@@ -914,7 +945,7 @@ sysinfo(
)
{
struct info_sys *is;
- struct sockaddr_storage peeraddr;
+ sockaddr_u peeraddr;
int items;
int itemsize;
int res;
@@ -940,17 +971,8 @@ again:
!checkitemsize(itemsize, v4sizeof(struct info_sys)))
return;
- memset((char *)&peeraddr, 0, sizeof(peeraddr));
- if (is->v6_flag != 0) {
- GET_INADDR6(peeraddr) = is->peer6;
- peeraddr.ss_family = AF_INET6;
- } else {
- GET_INADDR(peeraddr) = is->peer;
- peeraddr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- peeraddr.ss_len = SOCKLEN(&peeraddr);
-#endif
+ SET_ADDR(peeraddr, is->v6_flag, is->peer, is->peer6);
+
(void) fprintf(fp, "system peer: %s\n", nntohost(&peeraddr));
(void) fprintf(fp, "system peer mode: %s\n", modetoa(is->peer_mode));
(void) fprintf(fp, "leap indicator: %c%c\n",
@@ -1039,30 +1061,30 @@ again:
checkitemsize(itemsize, sizeof(struct info_sys_stats));
return;
}
- fprintf(fp, "time since restart: %ld\n",
- (u_long)ntohl(ss->timeup));
- fprintf(fp, "time since reset: %ld\n",
+ fprintf(fp, "time since restart: %lu\n",
+ (u_long)ntohl(ss->timeup));
+ fprintf(fp, "time since reset: %lu\n",
(u_long)ntohl(ss->timereset));
- fprintf(fp, "packets received: %ld\n",
+ fprintf(fp, "packets received: %lu\n",
(u_long)ntohl(ss->received));
- fprintf(fp, "packets processed: %ld\n",
+ fprintf(fp, "packets processed: %lu\n",
(u_long)ntohl(ss->processed));
- fprintf(fp, "current version: %ld\n",
- (u_long)ntohl(ss->newversionpkt));
- fprintf(fp, "previous version: %ld\n",
- (u_long)ntohl(ss->oldversionpkt));
- fprintf(fp, "bad version: %ld\n",
- (u_long)ntohl(ss->unknownversion));
- fprintf(fp, "access denied: %ld\n",
+ fprintf(fp, "current version: %lu\n",
+ (u_long)ntohl(ss->newversionpkt));
+ fprintf(fp, "previous version: %lu\n",
+ (u_long)ntohl(ss->oldversionpkt));
+ fprintf(fp, "declined: %lu\n",
+ (u_long)ntohl(ss->unknownversion));
+ fprintf(fp, "access denied: %lu\n",
(u_long)ntohl(ss->denied));
- fprintf(fp, "bad length or format: %ld\n",
- (u_long)ntohl(ss->badlength));
- fprintf(fp, "bad authentication: %ld\n",
- (u_long)ntohl(ss->badauth));
+ fprintf(fp, "bad length or format: %lu\n",
+ (u_long)ntohl(ss->badlength));
+ fprintf(fp, "bad authentication: %lu\n",
+ (u_long)ntohl(ss->badauth));
if (itemsize != sizeof(struct info_sys_stats))
return;
- fprintf(fp, "rate exceeded: %ld\n",
+ fprintf(fp, "rate exceeded: %lu\n",
(u_long)ntohl(ss->limitrejected));
}
@@ -1084,9 +1106,8 @@ iostats(
int res;
again:
- res = doquery(impl_ver, REQ_IO_STATS, 0, 0, 0, (char *)NULL,
- &items, &itemsize, (void *)&io, 0,
- sizeof(struct info_io_stats));
+ res = doquery(impl_ver, REQ_IO_STATS, 0, 0, 0, NULL, &items,
+ &itemsize, (void *)&io, 0, sizeof(*io));
if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) {
impl_ver = IMPL_XNTPD_OLD;
@@ -1094,38 +1115,38 @@ again:
}
if (res != 0)
- return;
+ return;
if (!check1item(items, fp))
- return;
+ return;
- if (!checkitemsize(itemsize, sizeof(struct info_io_stats)))
- return;
+ if (!checkitemsize(itemsize, sizeof(*io)))
+ return;
- (void) fprintf(fp, "time since reset: %ld\n",
- (u_long)ntohl(io->timereset));
- (void) fprintf(fp, "receive buffers: %d\n",
- ntohs(io->totalrecvbufs));
- (void) fprintf(fp, "free receive buffers: %d\n",
- ntohs(io->freerecvbufs));
- (void) fprintf(fp, "used receive buffers: %d\n",
- ntohs(io->fullrecvbufs));
- (void) fprintf(fp, "low water refills: %d\n",
- ntohs(io->lowwater));
- (void) fprintf(fp, "dropped packets: %ld\n",
- (u_long)ntohl(io->dropped));
- (void) fprintf(fp, "ignored packets: %ld\n",
- (u_long)ntohl(io->ignored));
- (void) fprintf(fp, "received packets: %ld\n",
- (u_long)ntohl(io->received));
- (void) fprintf(fp, "packets sent: %ld\n",
- (u_long)ntohl(io->sent));
- (void) fprintf(fp, "packets not sent: %ld\n",
- (u_long)ntohl(io->notsent));
- (void) fprintf(fp, "interrupts handled: %ld\n",
- (u_long)ntohl(io->interrupts));
- (void) fprintf(fp, "received by int: %ld\n",
- (u_long)ntohl(io->int_received));
+ fprintf(fp, "time since reset: %lu\n",
+ (u_long)ntohl(io->timereset));
+ fprintf(fp, "receive buffers: %u\n",
+ (u_int)ntohs(io->totalrecvbufs));
+ fprintf(fp, "free receive buffers: %u\n",
+ (u_int)ntohs(io->freerecvbufs));
+ fprintf(fp, "used receive buffers: %u\n",
+ (u_int)ntohs(io->fullrecvbufs));
+ fprintf(fp, "low water refills: %u\n",
+ (u_int)ntohs(io->lowwater));
+ fprintf(fp, "dropped packets: %lu\n",
+ (u_long)ntohl(io->dropped));
+ fprintf(fp, "ignored packets: %lu\n",
+ (u_long)ntohl(io->ignored));
+ fprintf(fp, "received packets: %lu\n",
+ (u_long)ntohl(io->received));
+ fprintf(fp, "packets sent: %lu\n",
+ (u_long)ntohl(io->sent));
+ fprintf(fp, "packets not sent: %lu\n",
+ (u_long)ntohl(io->notsent));
+ fprintf(fp, "interrupts handled: %lu\n",
+ (u_long)ntohl(io->interrupts));
+ fprintf(fp, "received by int: %lu\n",
+ (u_long)ntohl(io->int_received));
}
@@ -1146,9 +1167,8 @@ memstats(
int res;
again:
- res = doquery(impl_ver, REQ_MEM_STATS, 0, 0, 0, (char *)NULL,
- &items, &itemsize, (void *)&mem, 0,
- sizeof(struct info_mem_stats));
+ res = doquery(impl_ver, REQ_MEM_STATS, 0, 0, 0, NULL, &items,
+ &itemsize, (void *)&mem, 0, sizeof(*mem));
if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) {
impl_ver = IMPL_XNTPD_OLD;
@@ -1156,35 +1176,34 @@ again:
}
if (res != 0)
- return;
+ return;
if (!check1item(items, fp))
- return;
+ return;
- if (!checkitemsize(itemsize, sizeof(struct info_mem_stats)))
- return;
+ if (!checkitemsize(itemsize, sizeof(*mem)))
+ return;
- (void) fprintf(fp, "time since reset: %ld\n",
- (u_long)ntohl(mem->timereset));
- (void) fprintf(fp, "total peer memory: %d\n",
- ntohs(mem->totalpeermem));
- (void) fprintf(fp, "free peer memory: %d\n",
- ntohs(mem->freepeermem));
- (void) fprintf(fp, "calls to findpeer: %ld\n",
- (u_long)ntohl(mem->findpeer_calls));
- (void) fprintf(fp, "new peer allocations: %ld\n",
- (u_long)ntohl(mem->allocations));
- (void) fprintf(fp, "peer demobilizations: %ld\n",
- (u_long)ntohl(mem->demobilizations));
-
- (void) fprintf(fp, "hash table counts: ");
+ fprintf(fp, "time since reset: %lu\n",
+ (u_long)ntohl(mem->timereset));
+ fprintf(fp, "total peer memory: %u\n",
+ (u_int)ntohs(mem->totalpeermem));
+ fprintf(fp, "free peer memory: %u\n",
+ (u_int)ntohs(mem->freepeermem));
+ fprintf(fp, "calls to findpeer: %lu\n",
+ (u_long)ntohl(mem->findpeer_calls));
+ fprintf(fp, "new peer allocations: %lu\n",
+ (u_long)ntohl(mem->allocations));
+ fprintf(fp, "peer demobilizations: %lu\n",
+ (u_long)ntohl(mem->demobilizations));
+
+ fprintf(fp, "hash table counts: ");
for (i = 0; i < NTP_HASH_SIZE; i++) {
- (void) fprintf(fp, "%4d", (int)mem->hashcount[i]);
- if ((i % 8) == 7 && i != (NTP_HASH_SIZE-1)) {
- (void) fprintf(fp, "\n ");
- }
+ fprintf(fp, "%4d", (int)mem->hashcount[i]);
+ if ((i % 8) == 7 && i != (NTP_HASH_SIZE-1))
+ fprintf(fp, "\n ");
}
- (void) fprintf(fp, "\n");
+ fprintf(fp, "\n");
}
@@ -1205,9 +1224,8 @@ timerstats(
int res;
again:
- res = doquery(impl_ver, REQ_TIMER_STATS, 0, 0, 0, (char *)NULL,
- &items, &itemsize, (void *)&tim, 0,
- sizeof(struct info_timer_stats));
+ res = doquery(impl_ver, REQ_TIMER_STATS, 0, 0, 0, NULL, &items,
+ &itemsize, (void *)&tim, 0, sizeof(*tim));
if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) {
impl_ver = IMPL_XNTPD_OLD;
@@ -1215,22 +1233,22 @@ again:
}
if (res != 0)
- return;
+ return;
if (!check1item(items, fp))
- return;
+ return;
- if (!checkitemsize(itemsize, sizeof(struct info_timer_stats)))
- return;
+ if (!checkitemsize(itemsize, sizeof(*tim)))
+ return;
- (void) fprintf(fp, "time since reset: %ld\n",
- (u_long)ntohl(tim->timereset));
- (void) fprintf(fp, "alarms handled: %ld\n",
- (u_long)ntohl(tim->alarms));
- (void) fprintf(fp, "alarm overruns: %ld\n",
- (u_long)ntohl(tim->overflows));
- (void) fprintf(fp, "calls to transmit: %ld\n",
- (u_long)ntohl(tim->xmtcalls));
+ fprintf(fp, "time since reset: %lu\n",
+ (u_long)ntohl(tim->timereset));
+ fprintf(fp, "alarms handled: %lu\n",
+ (u_long)ntohl(tim->alarms));
+ fprintf(fp, "alarm overruns: %lu\n",
+ (u_long)ntohl(tim->overflows));
+ fprintf(fp, "calls to transmit: %lu\n",
+ (u_long)ntohl(tim->xmtcalls));
}
@@ -1292,7 +1310,7 @@ doconfig(
struct parse *pcmd,
FILE *fp,
int mode,
- int refc
+ int refc
)
{
struct conf_peer cpeer;
@@ -1308,18 +1326,19 @@ doconfig(
int res;
int sendsize;
int numtyp;
+ long val;
again:
keyid = 0;
version = 3;
flags = 0;
- res = 0;
+ res = FALSE;
cmode = 0;
minpoll = NTP_MINDPOLL;
maxpoll = NTP_MAXDPOLL;
numtyp = 1;
if (refc)
- numtyp = 5;
+ numtyp = 5;
if (impl_ver == IMPL_XNTPD)
sendsize = sizeof(struct conf_peer);
@@ -1327,91 +1346,87 @@ again:
sendsize = v4sizeof(struct conf_peer);
items = 1;
- while (pcmd->nargs > items) {
+ while (pcmd->nargs > (size_t)items) {
if (STREQ(pcmd->argval[items].string, "prefer"))
- flags |= CONF_FLAG_PREFER;
+ flags |= CONF_FLAG_PREFER;
else if (STREQ(pcmd->argval[items].string, "burst"))
- flags |= CONF_FLAG_BURST;
- else if (STREQ(pcmd->argval[items].string, "dynamic"))
- (void) fprintf(fp, "Warning: the \"dynamic\" keyword has been obsoleted and will be removed in the next release\n");
+ flags |= CONF_FLAG_BURST;
else if (STREQ(pcmd->argval[items].string, "iburst"))
- flags |= CONF_FLAG_IBURST;
+ flags |= CONF_FLAG_IBURST;
else if (!refc && STREQ(pcmd->argval[items].string, "keyid"))
- numtyp = 1;
+ numtyp = 1;
else if (!refc && STREQ(pcmd->argval[items].string, "version"))
- numtyp = 2;
+ numtyp = 2;
else if (STREQ(pcmd->argval[items].string, "minpoll"))
- numtyp = 3;
+ numtyp = 3;
else if (STREQ(pcmd->argval[items].string, "maxpoll"))
- numtyp = 4;
+ numtyp = 4;
else {
- long val;
if (!atoint(pcmd->argval[items].string, &val))
- numtyp = 0;
+ numtyp = 0;
switch (numtyp) {
case 1:
- keyid = val;
- numtyp = 2;
- break;
-
+ keyid = val;
+ numtyp = 2;
+ break;
+
case 2:
- version = (u_int) val;
- numtyp = 0;
- break;
+ version = (u_int)val;
+ numtyp = 0;
+ break;
case 3:
- minpoll = (u_char)val;
- numtyp = 0;
- break;
+ minpoll = (u_char)val;
+ numtyp = 0;
+ break;
case 4:
- maxpoll = (u_char)val;
- numtyp = 0;
- break;
+ maxpoll = (u_char)val;
+ numtyp = 0;
+ break;
case 5:
- cmode = (u_char)val;
- numtyp = 0;
- break;
+ cmode = (u_char)val;
+ numtyp = 0;
+ break;
default:
- (void) fprintf(fp, "*** '%s' not understood\n",
- pcmd->argval[items].string);
- res++;
- numtyp = 0;
+ fprintf(fp, "*** '%s' not understood\n",
+ pcmd->argval[items].string);
+ res = TRUE;
+ numtyp = 0;
}
if (val < 0) {
- (void) fprintf(stderr,
- "***Value '%s' should be unsigned\n",
- pcmd->argval[items].string);
- res++;
+ fprintf(stderr,
+ "*** Value '%s' should be unsigned\n",
+ pcmd->argval[items].string);
+ res = TRUE;
}
- }
- items++;
+ }
+ items++;
}
if (keyid > 0)
- flags |= CONF_FLAG_AUTHENABLE;
- if (version > NTP_VERSION ||
- version < NTP_OLDVERSION) {
- (void)fprintf(fp, "***invalid version number: %u\n",
- version);
- res++;
+ flags |= CONF_FLAG_AUTHENABLE;
+ if (version > NTP_VERSION || version < NTP_OLDVERSION) {
+ fprintf(fp, "***invalid version number: %u\n",
+ version);
+ res = TRUE;
}
if (minpoll < NTP_MINPOLL || minpoll > NTP_MAXPOLL ||
maxpoll < NTP_MINPOLL || maxpoll > NTP_MAXPOLL ||
minpoll > maxpoll) {
- (void) fprintf(fp, "***min/max-poll must be within %d..%d\n",
- NTP_MINPOLL, NTP_MAXPOLL);
- res++;
+ fprintf(fp, "***min/max-poll must be within %d..%d\n",
+ NTP_MINPOLL, NTP_MAXPOLL);
+ res = TRUE;
}
if (res)
- return;
+ return;
- memset((void *)&cpeer, 0, sizeof(cpeer));
+ ZERO(cpeer);
- if (pcmd->argval[0].netnum.ss_family == AF_INET) {
- cpeer.peeraddr = GET_INADDR(pcmd->argval[0].netnum);
+ if (IS_IPV4(&pcmd->argval[0].netnum)) {
+ cpeer.peeraddr = NSRCADR(&pcmd->argval[0].netnum);
if (impl_ver == IMPL_XNTPD)
cpeer.v6_flag = 0;
} else {
@@ -1420,7 +1435,7 @@ again:
"***Server doesn't understand IPv6 addresses\n");
return;
}
- cpeer.peeraddr6 = GET_INADDR6(pcmd->argval[0].netnum);
+ cpeer.peeraddr6 = SOCK_ADDR6(&pcmd->argval[0].netnum);
cpeer.v6_flag = 1;
}
cpeer.hmode = (u_char) mode;
@@ -1465,6 +1480,7 @@ unconfig(
{
/* 8 is the maximum number of peers which will fit in a packet */
struct conf_unpeer *pl, plist[min(MAXARGS, 8)];
+ int qitemlim;
int qitems;
int items;
int itemsize;
@@ -1478,9 +1494,10 @@ again:
else
sendsize = v4sizeof(struct conf_unpeer);
- for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 8); qitems++) {
- if (pcmd->argval[0].netnum.ss_family == AF_INET) {
- pl->peeraddr = GET_INADDR(pcmd->argval[qitems].netnum);
+ qitemlim = min(pcmd->nargs, COUNTOF(plist));
+ for (qitems = 0, pl = plist; qitems < qitemlim; qitems++) {
+ if (IS_IPV4(&pcmd->argval[0].netnum)) {
+ pl->peeraddr = NSRCADR(&pcmd->argval[qitems].netnum);
if (impl_ver == IMPL_XNTPD)
pl->v6_flag = 0;
} else {
@@ -1490,10 +1507,10 @@ again:
return;
}
pl->peeraddr6 =
- GET_INADDR6(pcmd->argval[qitems].netnum);
+ SOCK_ADDR6(&pcmd->argval[qitems].netnum);
pl->v6_flag = 1;
}
- pl = (struct conf_unpeer *)((char *)pl + sendsize);
+ pl = (void *)((char *)pl + sendsize);
}
res = doquery(impl_ver, REQ_UNCONFIG, 1, qitems,
@@ -1546,7 +1563,6 @@ doset(
int req
)
{
- /* 8 is the maximum number of peers which will fit in a packet */
struct conf_sys_flags sys;
int items;
int itemsize;
@@ -1555,7 +1571,7 @@ doset(
sys.flags = 0;
res = 0;
- for (items = 0; items < pcmd->nargs; items++) {
+ for (items = 0; (size_t)items < pcmd->nargs; items++) {
if (STREQ(pcmd->argval[items].string, "auth"))
sys.flags |= SYS_FLAG_AUTH;
else if (STREQ(pcmd->argval[items].string, "bclient"))
@@ -1632,8 +1648,8 @@ static struct resflags resflagsV3[] = {
{ "lptrap", RES_LPTRAP },
{ "limited", RES_LIMITED },
{ "version", RES_VERSION },
- { "kod", RES_DEMOBILIZE },
- { "timeout", RES_TIMEOUT },
+ { "kod", RES_KOD },
+ { "flake", RES_FLAKE },
{ "", 0 }
};
@@ -1641,6 +1657,7 @@ static struct resflags resflagsV3[] = {
static struct resflags resmflags[] = {
{ "ntpport", RESM_NTPONLY },
{ "interface", RESM_INTERFACE },
+ { "source", RESM_SOURCE },
{ "", 0 }
};
@@ -1656,14 +1673,14 @@ reslist(
)
{
struct info_restrict *rl;
- struct sockaddr_storage resaddr;
- struct sockaddr_storage maskaddr;
+ sockaddr_u resaddr;
+ sockaddr_u maskaddr;
int items;
int itemsize;
int res;
int skip;
- char *addr;
- char *mask;
+ const char *addr;
+ const char *mask;
struct resflags *rf;
u_int32 count;
u_short flags;
@@ -1682,42 +1699,27 @@ again:
}
if (res != 0)
- return;
+ return;
if (!checkitems(items, fp))
- return;
+ return;
if (!checkitemsize(itemsize, sizeof(struct info_restrict)) &&
!checkitemsize(itemsize, v4sizeof(struct info_restrict)))
- return;
+ return;
- (void) fprintf(fp,
- " address mask count flags\n");
- (void) fprintf(fp,
- "=====================================================================\n");
+ fprintf(fp,
+ " address mask count flags\n");
+ fprintf(fp,
+ "=====================================================================\n");
while (items > 0) {
- memset((char *)&resaddr, 0, sizeof(resaddr));
- memset((char *)&maskaddr, 0, sizeof(maskaddr));
+ SET_ADDRS(resaddr, maskaddr, rl, addr, mask);
if (rl->v6_flag != 0) {
- GET_INADDR6(resaddr) = rl->addr6;
- GET_INADDR6(maskaddr) = rl->mask6;
- resaddr.ss_family = AF_INET6;
- maskaddr.ss_family = AF_INET6;
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- resaddr.ss_len = SOCKLEN(&resaddr);
-#endif
addr = nntohost(&resaddr);
} else {
- GET_INADDR(resaddr) = rl->addr;
- GET_INADDR(maskaddr) = rl->mask;
- resaddr.ss_family = AF_INET;
- maskaddr.ss_family = AF_INET;
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- resaddr.ss_len = SOCKLEN(&resaddr);
-#endif
- if ((rl->mask == (u_int32)0xffffffff))
- addr = nntohost(&resaddr);
+ if (rl->mask == (u_int32)0xffffffff)
+ addr = nntohost(&resaddr);
else
addr = stoa(&resaddr);
}
@@ -1737,33 +1739,37 @@ again:
while (rf->bit != 0) {
if (mflags & rf->bit) {
if (!res)
- (void) strcat(flagstr, comma);
+ strlcat(flagstr, comma,
+ sizeof(flagstr));
res = 0;
- (void) strcat(flagstr, rf->str);
+ strlcat(flagstr, rf->str,
+ sizeof(flagstr));
}
rf++;
}
rf = (impl_ver == IMPL_XNTPD_OLD)
- ? &resflagsV2[0]
- : &resflagsV3[0]
- ;
+ ? &resflagsV2[0]
+ : &resflagsV3[0];
+
while (rf->bit != 0) {
if (flags & rf->bit) {
if (!res)
- (void) strcat(flagstr, comma);
+ strlcat(flagstr, comma,
+ sizeof(flagstr));
res = 0;
- (void) strcat(flagstr, rf->str);
+ strlcat(flagstr, rf->str,
+ sizeof(flagstr));
}
rf++;
}
if (flagstr[0] == '\0')
- (void) strcpy(flagstr, "none");
+ strlcpy(flagstr, "none", sizeof(flagstr));
if (!skip)
- (void) fprintf(fp, "%-15.15s %-15.15s %9ld %s\n",
- addr, mask, (u_long)count, flagstr);
+ fprintf(fp, "%-15.15s %-15.15s %9lu %s\n",
+ addr, mask, (u_long)count, flagstr);
rl++;
items--;
}
@@ -1827,7 +1833,7 @@ do_restrict(
u_int32 num;
u_long bit;
int i;
- int res;
+ size_t res;
int err;
int sendsize;
@@ -1844,23 +1850,23 @@ again:
else
sendsize = v4sizeof(struct conf_restrict);
- if (pcmd->argval[0].netnum.ss_family == AF_INET) {
- cres.addr = GET_INADDR(pcmd->argval[0].netnum);
- cres.mask = GET_INADDR(pcmd->argval[1].netnum);
+ if (IS_IPV4(&pcmd->argval[0].netnum)) {
+ cres.addr = NSRCADR(&pcmd->argval[0].netnum);
+ cres.mask = NSRCADR(&pcmd->argval[1].netnum);
if (impl_ver == IMPL_XNTPD)
cres.v6_flag = 0;
} else {
if (impl_ver == IMPL_XNTPD_OLD) {
fprintf(stderr,
- "***Server doesn't understand IPv6 addresses\n");
+ "***Server doesn't understand IPv6 addresses\n");
return;
}
- cres.addr6 = GET_INADDR6(pcmd->argval[0].netnum);
+ cres.addr6 = SOCK_ADDR6(&pcmd->argval[0].netnum);
cres.v6_flag = 1;
}
cres.flags = 0;
cres.mflags = 0;
- err = 0;
+ err = FALSE;
for (res = 2; res < pcmd->nargs; res++) {
if (STREQ(pcmd->argval[res].string, "ntpport")) {
cres.mflags |= RESM_NTPONLY;
@@ -1868,20 +1874,20 @@ again:
for (i = 0; resflagsV3[i].bit != 0; i++) {
if (STREQ(pcmd->argval[res].string,
resflagsV3[i].str))
- break;
+ break;
}
if (resflagsV3[i].bit != 0) {
cres.flags |= resflagsV3[i].bit;
if (req_code == REQ_UNRESTRICT) {
- (void) fprintf(fp,
- "Flag %s inappropriate\n",
- resflagsV3[i].str);
- err++;
+ fprintf(fp,
+ "Flag %s inappropriate\n",
+ resflagsV3[i].str);
+ err = TRUE;
}
} else {
- (void) fprintf(fp, "Unknown flag %s\n",
- pcmd->argval[res].string);
- err++;
+ fprintf(fp, "Unknown flag %s\n",
+ pcmd->argval[res].string);
+ err = TRUE;
}
}
}
@@ -1892,21 +1898,21 @@ again:
* Make sure mask for default address is zero. Otherwise,
* make sure mask bits are contiguous.
*/
- if (pcmd->argval[0].netnum.ss_family == AF_INET) {
+ if (IS_IPV4(&pcmd->argval[0].netnum)) {
if (cres.addr == 0) {
cres.mask = 0;
} else {
num = ntohl(cres.mask);
for (bit = 0x80000000; bit != 0; bit >>= 1)
- if ((num & bit) == 0)
- break;
+ if ((num & bit) == 0)
+ break;
for ( ; bit != 0; bit >>= 1)
- if ((num & bit) != 0)
- break;
+ if ((num & bit) != 0)
+ break;
if (bit != 0) {
- (void) fprintf(fp, "Invalid mask %s\n",
- numtoa(cres.mask));
- err++;
+ fprintf(fp, "Invalid mask %s\n",
+ numtoa(cres.mask));
+ err = TRUE;
}
}
} else {
@@ -1914,11 +1920,10 @@ again:
}
if (err)
- return;
+ return;
- res = doquery(impl_ver, req_code, 1, 1,
- sendsize, (char *)&cres, &items,
- &itemsize, &dummy, 0, sizeof(struct conf_restrict));
+ res = doquery(impl_ver, req_code, 1, 1, sendsize, (char *)&cres,
+ &items, &itemsize, &dummy, 0, sizeof(cres));
if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) {
impl_ver = IMPL_XNTPD_OLD;
@@ -1942,21 +1947,23 @@ monlist(
)
{
char *struct_star;
- struct sockaddr_storage addr;
- struct sockaddr_storage dstadr;
+ struct info_monitor *ml;
+ struct info_monitor_1 *m1;
+ struct old_info_monitor *oml;
+ sockaddr_u addr;
+ sockaddr_u dstadr;
int items;
int itemsize;
int res;
int version = -1;
- if (pcmd->nargs > 0) {
+ if (pcmd->nargs > 0)
version = pcmd->argval[0].ival;
- }
again:
res = doquery(impl_ver,
(version == 1 || version == -1) ? REQ_MON_GETLIST_1 :
- REQ_MON_GETLIST, 0, 0, 0, (char *)NULL,
+ REQ_MON_GETLIST, 0, 0, 0, NULL,
&items, &itemsize, &struct_star,
(version < 0) ? (1 << INFO_ERR_REQ) : 0,
sizeof(struct info_monitor_1));
@@ -1967,121 +1974,86 @@ again:
}
if (res == INFO_ERR_REQ && version < 0)
- res = doquery(impl_ver, REQ_MON_GETLIST, 0, 0, 0, (char *)NULL,
- &items, &itemsize, &struct_star, 0,
- sizeof(struct info_monitor));
+ res = doquery(impl_ver, REQ_MON_GETLIST, 0, 0, 0, NULL,
+ &items, &itemsize, &struct_star, 0,
+ sizeof(struct info_monitor));
if (res != 0)
- return;
+ return;
if (!checkitems(items, fp))
- return;
+ return;
if (itemsize == sizeof(struct info_monitor_1) ||
itemsize == v4sizeof(struct info_monitor_1)) {
- struct info_monitor_1 *ml = (struct info_monitor_1 *) struct_star;
- (void) fprintf(fp,
- "remote address port local address count m ver code avgint lstint\n");
- (void) fprintf(fp,
- "===============================================================================\n");
+ m1 = (void *)struct_star;
+ fprintf(fp,
+ "remote address port local address count m ver rstr avgint lstint\n");
+ fprintf(fp,
+ "===============================================================================\n");
while (items > 0) {
- memset((char *)&addr, 0, sizeof(addr));
- memset((char *)&dstadr, 0, sizeof(dstadr));
- if (ml->v6_flag != 0) {
- GET_INADDR6(addr) = ml->addr6;
- addr.ss_family = AF_INET6;
- GET_INADDR6(dstadr) = ml->daddr6;
- dstadr.ss_family = AF_INET6;
- } else {
- GET_INADDR(addr) = ml->addr;
- addr.ss_family = AF_INET;
- GET_INADDR(dstadr) = ml->daddr;
- dstadr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- addr.ss_len = SOCKLEN(&addr);
- dstadr.ss_len = SOCKLEN(&dstadr);
-#endif
+ SET_ADDRS(dstadr, addr, m1, daddr, addr);
if ((pcmd->nargs == 0) ||
- ((pcmd->argval->ival == 6) && (ml->v6_flag != 0)) ||
- ((pcmd->argval->ival == 4) && (ml->v6_flag == 0)))
- (void) fprintf(fp,
- "%-22.22s %5d %-15s %8ld %1d %1d %6lx %6lu %7lu\n",
+ ((pcmd->argval->ival == 6) && (m1->v6_flag != 0)) ||
+ ((pcmd->argval->ival == 4) && (m1->v6_flag == 0)))
+ fprintf(fp,
+ "%-22.22s %5d %-15s %8lu %1u %1u %6lx %6lu %7lu\n",
nntohost(&addr),
- ntohs(ml->port),
+ ntohs(m1->port),
stoa(&dstadr),
- (u_long)ntohl(ml->count),
- ml->mode,
- ml->version,
- (u_long)ntohl(ml->lastdrop),
- (u_long)ntohl(ml->lasttime),
- (u_long)ntohl(ml->firsttime));
- ml++;
+ (u_long)ntohl(m1->count),
+ m1->mode,
+ m1->version,
+ (u_long)ntohl(m1->restr),
+ (u_long)ntohl(m1->avg_int),
+ (u_long)ntohl(m1->last_int));
+ m1++;
items--;
}
} else if (itemsize == sizeof(struct info_monitor) ||
itemsize == v4sizeof(struct info_monitor)) {
- struct info_monitor *ml = (struct info_monitor *) struct_star;
- (void) fprintf(fp,
- " address port count mode ver code avgint lstint\n");
- (void) fprintf(fp,
- "===============================================================================\n");
+ ml = (void *) struct_star;
+ fprintf(fp,
+ " address port count mode ver rstr avgint lstint\n");
+ fprintf(fp,
+ "===============================================================================\n");
while (items > 0) {
- memset((char *)&dstadr, 0, sizeof(dstadr));
- if (ml->v6_flag != 0) {
- GET_INADDR6(dstadr) = ml->addr6;
- dstadr.ss_family = AF_INET6;
- } else {
- GET_INADDR(dstadr) = ml->addr;
- dstadr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- dstadr.ss_len = SOCKLEN(&dstadr);
-#endif
+ SET_ADDR(dstadr, ml->v6_flag, ml->addr, ml->addr6);
if ((pcmd->nargs == 0) ||
((pcmd->argval->ival == 6) && (ml->v6_flag != 0)) ||
((pcmd->argval->ival == 4) && (ml->v6_flag == 0)))
- (void) fprintf(fp,
- "%-25.25s %5d %9ld %4d %2d %9lx %9lu %9lu\n",
+ fprintf(fp,
+ "%-25.25s %5u %9lu %4u %2u %9lx %9lu %9lu\n",
nntohost(&dstadr),
ntohs(ml->port),
(u_long)ntohl(ml->count),
ml->mode,
ml->version,
- (u_long)ntohl(ml->lastdrop),
- (u_long)ntohl(ml->lasttime),
- (u_long)ntohl(ml->firsttime));
+ (u_long)ntohl(ml->restr),
+ (u_long)ntohl(ml->avg_int),
+ (u_long)ntohl(ml->last_int));
ml++;
items--;
}
} else if (itemsize == sizeof(struct old_info_monitor)) {
- struct old_info_monitor *oml = (struct old_info_monitor *)struct_star;
- (void) fprintf(fp,
- " address port count mode version lasttime firsttime\n");
- (void) fprintf(fp,
- "======================================================================\n");
+
+ oml = (void *)struct_star;
+ fprintf(fp,
+ " address port count mode version lasttime firsttime\n");
+ fprintf(fp,
+ "======================================================================\n");
while (items > 0) {
- memset((char *)&dstadr, 0, sizeof(dstadr));
- if (oml->v6_flag != 0) {
- GET_INADDR6(dstadr) = oml->addr6;
- dstadr.ss_family = AF_INET6;
- } else {
- GET_INADDR(dstadr) = oml->addr;
- dstadr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- dstadr.ss_len = SOCKLEN(&dstadr);
-#endif
- (void) fprintf(fp, "%-20.20s %5d %9ld %4d %3d %9lu %9lu\n",
- nntohost(&dstadr),
- ntohs(oml->port),
- (u_long)ntohl(oml->count),
- oml->mode,
- oml->version,
- (u_long)ntohl(oml->lasttime),
- (u_long)ntohl(oml->firsttime));
+ SET_ADDR(dstadr, oml->v6_flag, oml->addr, oml->addr6);
+ fprintf(fp, "%-20.20s %5u %9lu %4u %3u %9lu %9lu\n",
+ nntohost(&dstadr),
+ ntohs(oml->port),
+ (u_long)ntohl(oml->count),
+ oml->mode,
+ oml->version,
+ (u_long)ntohl(oml->lasttime),
+ (u_long)ntohl(oml->firsttime));
oml++;
items--;
}
@@ -2096,15 +2068,16 @@ again:
* Mapping between command line strings and stat reset flags
*/
struct statreset {
- const char *str;
- int flag;
+ const char * const str;
+ const int flag;
} sreset[] = {
+ { "allpeers", RESET_FLAG_ALLPEERS },
{ "io", RESET_FLAG_IO },
{ "sys", RESET_FLAG_SYS },
{ "mem", RESET_FLAG_MEM },
{ "timer", RESET_FLAG_TIMER },
{ "auth", RESET_FLAG_AUTH },
- { "allpeers", RESET_FLAG_ALLPEERS },
+ { "ctl", RESET_FLAG_CTL },
{ "", 0 }
};
@@ -2122,7 +2095,7 @@ reset(
int itemsize;
char *dummy;
int i;
- int res;
+ size_t res;
int err;
err = 0;
@@ -2130,11 +2103,11 @@ reset(
for (res = 0; res < pcmd->nargs; res++) {
for (i = 0; sreset[i].flag != 0; i++) {
if (STREQ(pcmd->argval[res].string, sreset[i].str))
- break;
+ break;
}
if (sreset[i].flag == 0) {
- (void) fprintf(fp, "Flag %s unknown\n",
- pcmd->argval[res].string);
+ fprintf(fp, "Flag %s unknown\n",
+ pcmd->argval[res].string);
err++;
} else {
rflags.flags |= sreset[i].flag;
@@ -2175,6 +2148,7 @@ preset(
{
/* 8 is the maximum number of peers which will fit in a packet */
struct conf_unpeer *pl, plist[min(MAXARGS, 8)];
+ int qitemlim;
int qitems;
int items;
int itemsize;
@@ -2188,9 +2162,10 @@ again:
else
sendsize = v4sizeof(struct conf_unpeer);
- for (qitems = 0, pl = plist; qitems < min(pcmd->nargs, 8); qitems++) {
- if (pcmd->argval[qitems].netnum.ss_family == AF_INET) {
- pl->peeraddr = GET_INADDR(pcmd->argval[qitems].netnum);
+ qitemlim = min(pcmd->nargs, COUNTOF(plist));
+ for (qitems = 0, pl = plist; qitems < qitemlim; qitems++) {
+ if (IS_IPV4(&pcmd->argval[qitems].netnum)) {
+ pl->peeraddr = NSRCADR(&pcmd->argval[qitems].netnum);
if (impl_ver == IMPL_XNTPD)
pl->v6_flag = 0;
} else {
@@ -2200,10 +2175,10 @@ again:
return;
}
pl->peeraddr6 =
- GET_INADDR6(pcmd->argval[qitems].netnum);
+ SOCK_ADDR6(&pcmd->argval[qitems].netnum);
pl->v6_flag = 1;
}
- pl = (struct conf_unpeer *)((char *)pl + sendsize);
+ pl = (void *)((char *)pl + sendsize);
}
res = doquery(impl_ver, REQ_RESET_PEER, 1, qitems,
@@ -2287,7 +2262,7 @@ do_trustkey(
)
{
u_long keyids[MAXARGS];
- int i;
+ size_t i;
int items;
int itemsize;
char *dummy;
@@ -2332,9 +2307,8 @@ authinfo(
int res;
again:
- res = doquery(impl_ver, REQ_AUTHINFO, 0, 0, 0, (char *)NULL,
- &items, &itemsize, (void *)&ia, 0,
- sizeof(struct info_auth));
+ res = doquery(impl_ver, REQ_AUTHINFO, 0, 0, 0, NULL, &items,
+ &itemsize, (void *)&ia, 0, sizeof(*ia));
if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) {
impl_ver = IMPL_XNTPD_OLD;
@@ -2342,32 +2316,32 @@ again:
}
if (res != 0)
- return;
+ return;
if (!check1item(items, fp))
- return;
+ return;
- if (!checkitemsize(itemsize, sizeof(struct info_auth)))
- return;
+ if (!checkitemsize(itemsize, sizeof(*ia)))
+ return;
- (void) fprintf(fp, "time since reset: %ld\n",
- (u_long)ntohl(ia->timereset));
- (void) fprintf(fp, "stored keys: %ld\n",
- (u_long)ntohl(ia->numkeys));
- (void) fprintf(fp, "free keys: %ld\n",
- (u_long)ntohl(ia->numfreekeys));
- (void) fprintf(fp, "key lookups: %ld\n",
- (u_long)ntohl(ia->keylookups));
- (void) fprintf(fp, "keys not found: %ld\n",
- (u_long)ntohl(ia->keynotfound));
- (void) fprintf(fp, "uncached keys: %ld\n",
- (u_long)ntohl(ia->keyuncached));
- (void) fprintf(fp, "encryptions: %ld\n",
- (u_long)ntohl(ia->encryptions));
- (void) fprintf(fp, "decryptions: %ld\n",
- (u_long)ntohl(ia->decryptions));
- (void) fprintf(fp, "expired keys: %ld\n",
- (u_long)ntohl(ia->expired));
+ fprintf(fp, "time since reset: %lu\n",
+ (u_long)ntohl(ia->timereset));
+ fprintf(fp, "stored keys: %lu\n",
+ (u_long)ntohl(ia->numkeys));
+ fprintf(fp, "free keys: %lu\n",
+ (u_long)ntohl(ia->numfreekeys));
+ fprintf(fp, "key lookups: %lu\n",
+ (u_long)ntohl(ia->keylookups));
+ fprintf(fp, "keys not found: %lu\n",
+ (u_long)ntohl(ia->keynotfound));
+ fprintf(fp, "uncached keys: %lu\n",
+ (u_long)ntohl(ia->keyuncached));
+ fprintf(fp, "encryptions: %lu\n",
+ (u_long)ntohl(ia->encryptions));
+ fprintf(fp, "decryptions: %lu\n",
+ (u_long)ntohl(ia->decryptions));
+ fprintf(fp, "expired keys: %lu\n",
+ (u_long)ntohl(ia->expired));
}
@@ -2384,15 +2358,14 @@ traps(
{
int i;
struct info_trap *it;
- struct sockaddr_storage trap_addr, local_addr;
+ sockaddr_u trap_addr, local_addr;
int items;
int itemsize;
int res;
again:
- res = doquery(impl_ver, REQ_TRAPS, 0, 0, 0, (char *)NULL,
- &items, &itemsize, (void *)&it, 0,
- sizeof(struct info_trap));
+ res = doquery(impl_ver, REQ_TRAPS, 0, 0, 0, NULL, &items,
+ &itemsize, (void *)&it, 0, sizeof(*it));
if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) {
impl_ver = IMPL_XNTPD_OLD;
@@ -2400,55 +2373,38 @@ again:
}
if (res != 0)
- return;
+ return;
if (!checkitems(items, fp))
- return;
+ return;
if (!checkitemsize(itemsize, sizeof(struct info_trap)) &&
!checkitemsize(itemsize, v4sizeof(struct info_trap)))
- return;
+ return;
for (i = 0; i < items; i++ ) {
- if (i != 0)
- (void) fprintf(fp, "\n");
- memset((char *)&trap_addr, 0, sizeof(trap_addr));
- memset((char *)&local_addr, 0, sizeof(local_addr));
- if (it->v6_flag != 0) {
- GET_INADDR6(trap_addr) = it->trap_address6;
- GET_INADDR6(local_addr) = it->local_address6;
- trap_addr.ss_family = AF_INET6;
- local_addr.ss_family = AF_INET6;
- } else {
- GET_INADDR(trap_addr) = it->trap_address;
- GET_INADDR(local_addr) = it->local_address;
- trap_addr.ss_family = AF_INET;
- local_addr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- trap_addr.ss_len = SOCKLEN(&trap_addr);
- local_addr.ss_len = SOCKLEN(&local_addr);
-#endif
- (void) fprintf(fp, "address %s, port %d\n",
- stoa(&trap_addr),
- ntohs(it->trap_port));
- (void) fprintf(fp, "interface: %s, ",
- (it->local_address == 0)
- ? "wildcard"
- : stoa(&local_addr));
+ SET_ADDRS(trap_addr, local_addr, it, trap_address, local_address);
+ fprintf(fp, "%saddress %s, port %d\n",
+ (0 == i)
+ ? ""
+ : "\n",
+ stoa(&trap_addr), ntohs(it->trap_port));
+ fprintf(fp, "interface: %s, ",
+ (0 == it->local_address)
+ ? "wildcard"
+ : stoa(&local_addr));
if (ntohl(it->flags) & TRAP_CONFIGURED)
- (void) fprintf(fp, "configured\n");
+ fprintf(fp, "configured\n");
else if (ntohl(it->flags) & TRAP_NONPRIO)
- (void) fprintf(fp, "low priority\n");
+ fprintf(fp, "low priority\n");
else
- (void) fprintf(fp, "normal priority\n");
+ fprintf(fp, "normal priority\n");
- (void) fprintf(fp, "set for %ld secs, last set %ld secs ago\n",
- (long)ntohl(it->origtime),
- (long)ntohl(it->settime));
- (void) fprintf(fp, "sequence %d, number of resets %ld\n",
- ntohs(it->sequence),
- (long)ntohl(it->resets));
+ fprintf(fp, "set for %ld secs, last set %ld secs ago\n",
+ (long)ntohl(it->origtime),
+ (long)ntohl(it->settime));
+ fprintf(fp, "sequence %d, number of resets %ld\n",
+ ntohs(it->sequence), (long)ntohl(it->resets));
}
}
@@ -2502,8 +2458,8 @@ again:
else
sendsize = v4sizeof(struct conf_trap);
- if (pcmd->argval[0].netnum.ss_family == AF_INET) {
- ctrap.trap_address = GET_INADDR(pcmd->argval[0].netnum);
+ if (IS_IPV4(&pcmd->argval[0].netnum)) {
+ ctrap.trap_address = NSRCADR(&pcmd->argval[0].netnum);
if (impl_ver == IMPL_XNTPD)
ctrap.v6_flag = 0;
} else {
@@ -2512,7 +2468,7 @@ again:
"***Server doesn't understand IPv6 addresses\n");
return;
}
- ctrap.trap_address6 = GET_INADDR6(pcmd->argval[0].netnum);
+ ctrap.trap_address6 = SOCK_ADDR6(&pcmd->argval[0].netnum);
ctrap.v6_flag = 1;
}
ctrap.local_address = 0;
@@ -2520,19 +2476,18 @@ again:
ctrap.unused = 0;
if (pcmd->nargs > 1) {
- ctrap.trap_port
- = htons((u_short)(pcmd->argval[1].uval & 0xffff));
+ ctrap.trap_port = htons((u_short)pcmd->argval[1].uval);
if (pcmd->nargs > 2) {
- if (pcmd->argval[2].netnum.ss_family !=
- pcmd->argval[0].netnum.ss_family) {
+ if (AF(&pcmd->argval[2].netnum) !=
+ AF(&pcmd->argval[0].netnum)) {
fprintf(stderr,
"***Cannot mix IPv4 and IPv6 addresses\n");
return;
}
- if (pcmd->argval[2].netnum.ss_family == AF_INET)
- ctrap.local_address = GET_INADDR(pcmd->argval[2].netnum);
+ if (IS_IPV4(&pcmd->argval[2].netnum))
+ ctrap.local_address = NSRCADR(&pcmd->argval[2].netnum);
else
- ctrap.local_address6 = GET_INADDR6(pcmd->argval[2].netnum);
+ ctrap.local_address6 = SOCK_ADDR6(&pcmd->argval[2].netnum);
}
}
@@ -2631,9 +2586,8 @@ ctlstats(
int res;
again:
- res = doquery(impl_ver, REQ_GET_CTLSTATS, 0, 0, 0, (char *)NULL,
- &items, &itemsize, (void *)&ic, 0,
- sizeof(struct info_control));
+ res = doquery(impl_ver, REQ_GET_CTLSTATS, 0, 0, 0, NULL, &items,
+ &itemsize, (void *)&ic, 0, sizeof(*ic));
if (res == INFO_ERR_IMPL && impl_ver == IMPL_XNTPD) {
impl_ver = IMPL_XNTPD_OLD;
@@ -2641,44 +2595,44 @@ again:
}
if (res != 0)
- return;
+ return;
if (!check1item(items, fp))
- return;
+ return;
- if (!checkitemsize(itemsize, sizeof(struct info_control)))
- return;
+ if (!checkitemsize(itemsize, sizeof(*ic)))
+ return;
- (void) fprintf(fp, "time since reset: %ld\n",
- (u_long)ntohl(ic->ctltimereset));
- (void) fprintf(fp, "requests received: %ld\n",
- (u_long)ntohl(ic->numctlreq));
- (void) fprintf(fp, "responses sent: %ld\n",
- (u_long)ntohl(ic->numctlresponses));
- (void) fprintf(fp, "fragments sent: %ld\n",
- (u_long)ntohl(ic->numctlfrags));
- (void) fprintf(fp, "async messages sent: %ld\n",
- (u_long)ntohl(ic->numasyncmsgs));
- (void) fprintf(fp, "error msgs sent: %ld\n",
- (u_long)ntohl(ic->numctlerrors));
- (void) fprintf(fp, "total bad pkts: %ld\n",
- (u_long)ntohl(ic->numctlbadpkts));
- (void) fprintf(fp, "packet too short: %ld\n",
- (u_long)ntohl(ic->numctltooshort));
- (void) fprintf(fp, "response on input: %ld\n",
- (u_long)ntohl(ic->numctlinputresp));
- (void) fprintf(fp, "fragment on input: %ld\n",
- (u_long)ntohl(ic->numctlinputfrag));
- (void) fprintf(fp, "error set on input: %ld\n",
- (u_long)ntohl(ic->numctlinputerr));
- (void) fprintf(fp, "bad offset on input: %ld\n",
- (u_long)ntohl(ic->numctlbadoffset));
- (void) fprintf(fp, "bad version packets: %ld\n",
- (u_long)ntohl(ic->numctlbadversion));
- (void) fprintf(fp, "data in pkt too short: %ld\n",
- (u_long)ntohl(ic->numctldatatooshort));
- (void) fprintf(fp, "unknown op codes: %ld\n",
- (u_long)ntohl(ic->numctlbadop));
+ fprintf(fp, "time since reset: %lu\n",
+ (u_long)ntohl(ic->ctltimereset));
+ fprintf(fp, "requests received: %lu\n",
+ (u_long)ntohl(ic->numctlreq));
+ fprintf(fp, "responses sent: %lu\n",
+ (u_long)ntohl(ic->numctlresponses));
+ fprintf(fp, "fragments sent: %lu\n",
+ (u_long)ntohl(ic->numctlfrags));
+ fprintf(fp, "async messages sent: %lu\n",
+ (u_long)ntohl(ic->numasyncmsgs));
+ fprintf(fp, "error msgs sent: %lu\n",
+ (u_long)ntohl(ic->numctlerrors));
+ fprintf(fp, "total bad pkts: %lu\n",
+ (u_long)ntohl(ic->numctlbadpkts));
+ fprintf(fp, "packet too short: %lu\n",
+ (u_long)ntohl(ic->numctltooshort));
+ fprintf(fp, "response on input: %lu\n",
+ (u_long)ntohl(ic->numctlinputresp));
+ fprintf(fp, "fragment on input: %lu\n",
+ (u_long)ntohl(ic->numctlinputfrag));
+ fprintf(fp, "error set on input: %lu\n",
+ (u_long)ntohl(ic->numctlinputerr));
+ fprintf(fp, "bad offset on input: %lu\n",
+ (u_long)ntohl(ic->numctlbadoffset));
+ fprintf(fp, "bad version packets: %lu\n",
+ (u_long)ntohl(ic->numctlbadversion));
+ fprintf(fp, "data in pkt too short: %lu\n",
+ (u_long)ntohl(ic->numctldatatooshort));
+ fprintf(fp, "unknown op codes: %lu\n",
+ (u_long)ntohl(ic->numctlbadop));
}
@@ -2694,6 +2648,7 @@ clockstat(
struct info_clock *cl;
/* 8 is the maximum number of clocks which will fit in a packet */
u_long clist[min(MAXARGS, 8)];
+ int qitemlim;
int qitems;
int items;
int itemsize;
@@ -2701,8 +2656,9 @@ clockstat(
l_fp ts;
struct clktype *clk;
- for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++)
- clist[qitems] = GET_INADDR(pcmd->argval[qitems].netnum);
+ qitemlim = min(pcmd->nargs, COUNTOF(clist));
+ for (qitems = 0; qitems < qitemlim; qitems++)
+ clist[qitems] = NSRCADR(&pcmd->argval[qitems].netnum);
again:
res = doquery(impl_ver, REQ_GET_CLOCKINFO, 0, qitems,
@@ -2715,13 +2671,13 @@ again:
}
if (res != 0)
- return;
+ return;
if (!checkitems(items, fp))
- return;
+ return;
if (!checkitemsize(itemsize, sizeof(struct info_clock)))
- return;
+ return;
while (items-- > 0) {
(void) fprintf(fp, "clock address: %s\n",
@@ -2790,8 +2746,8 @@ fudge(
err = 0;
- memset((char *)&fudgedata, 0, sizeof fudgedata);
- fudgedata.clockadr = GET_INADDR(pcmd->argval[0].netnum);
+ ZERO(fudgedata);
+ fudgedata.clockadr = NSRCADR(&pcmd->argval[0].netnum);
if (STREQ(pcmd->argval[1].string, "time1")) {
fudgedata.which = htonl(FUDGE_TIME1);
@@ -2866,6 +2822,7 @@ clkbug(
/* 8 is the maximum number of clocks which will fit in a packet */
u_long clist[min(MAXARGS, 8)];
u_int32 ltemp;
+ int qitemlim;
int qitems;
int items;
int itemsize;
@@ -2873,8 +2830,9 @@ clkbug(
int needsp;
l_fp ts;
- for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++)
- clist[qitems] = GET_INADDR(pcmd->argval[qitems].netnum);
+ qitemlim = min(pcmd->nargs, COUNTOF(clist));
+ for (qitems = 0; qitems < qitemlim; qitems++)
+ clist[qitems] = NSRCADR(&pcmd->argval[qitems].netnum);
again:
res = doquery(impl_ver, REQ_GET_CLKBUGINFO, 0, qitems,
@@ -2887,13 +2845,13 @@ again:
}
if (res != 0)
- return;
+ return;
if (!checkitems(items, fp))
- return;
+ return;
if (!checkitemsize(itemsize, sizeof(struct info_clkbug)))
- return;
+ return;
while (items-- > 0) {
(void) fprintf(fp, "clock address: %s\n",
@@ -2990,13 +2948,13 @@ again:
tscale = 1e-9;
#endif
(void)fprintf(fp, "pll offset: %g s\n",
- (int32_t)ntohl(ik->offset) * tscale);
+ (int32)ntohl(ik->offset) * tscale);
(void)fprintf(fp, "pll frequency: %s ppm\n",
fptoa((s_fp)ntohl(ik->freq), 3));
(void)fprintf(fp, "maximum error: %g s\n",
- (u_long)ntohl(ik->maxerror) * 1e-6);
+ (u_long)ntohl(ik->maxerror) * tscale);
(void)fprintf(fp, "estimated error: %g s\n",
- (u_long)ntohl(ik->esterror) * 1e-6);
+ (u_long)ntohl(ik->esterror) * tscale);
(void)fprintf(fp, "status: %04x ", status);
#ifdef STA_PLL
if (status & STA_PLL) (void)fprintf(fp, " pll");
@@ -3082,11 +3040,11 @@ again:
(u_long)ntohl(ik->errcnt));
}
-#define IF_LIST_FMT "%2d %c %48s %c %c %12.12s %03x %3d %2d %5d %5d %5d %2d %2d %3d %7d\n"
-#define IF_LIST_FMT_STR "%2s %c %48s %c %c %12.12s %3s %3s %2s %5s %5s %5s %2s %2s %3s %7s\n"
+#define IF_LIST_FMT "%2d %c %48s %c %c %12.12s %03lx %3lu %2lu %5lu %5lu %5lu %2lu %3lu %7lu\n"
+#define IF_LIST_FMT_STR "%2s %c %48s %c %c %12.12s %3s %3s %2s %5s %5s %5s %2s %3s %7s\n"
#define IF_LIST_AFMT_STR " %48s %c\n"
-#define IF_LIST_LABELS "#", 'A', "Address/Mask/Broadcast", 'T', 'E', "IF name", "Flg", "TL", "#M", "recv", "sent", "drop", "S", "IX", "PC", "uptime"
-#define IF_LIST_LINE "=====================================================================================================================\n"
+#define IF_LIST_LABELS "#", 'A', "Address/Mask/Broadcast", 'T', 'E', "IF name", "Flg", "TL", "#M", "recv", "sent", "drop", "S", "PC", "uptime"
+#define IF_LIST_LINE "==================================================================================================================\n"
static void
iflist(
@@ -3097,8 +3055,8 @@ iflist(
int res
)
{
- static char *actions = "?.+-";
- struct sockaddr_storage saddr;
+ static const char *actions = "?.+-";
+ sockaddr_u saddr;
if (res != 0)
return;
@@ -3113,51 +3071,31 @@ iflist(
fprintf(fp, IF_LIST_LINE);
while (items > 0) {
- if (ntohl(ifs->v6_flag)) {
- memcpy((char *)&GET_INADDR6(saddr), (char *)&ifs->unaddr.addr6, sizeof(ifs->unaddr.addr6));
- saddr.ss_family = AF_INET6;
- } else {
- memcpy((char *)&GET_INADDR(saddr), (char *)&ifs->unaddr.addr, sizeof(ifs->unaddr.addr));
- saddr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- saddr.ss_len = SOCKLEN(&saddr);
-#endif
+ SET_ADDR(saddr, ntohl(ifs->v6_flag),
+ ifs->unaddr.addr.s_addr, ifs->unaddr.addr6);
fprintf(fp, IF_LIST_FMT,
ntohl(ifs->ifnum),
actions[(ifs->action >= 1 && ifs->action < 4) ? ifs->action : 0],
stoa((&saddr)), 'A',
ifs->ignore_packets ? 'D' : 'E',
ifs->name,
- ntohl(ifs->flags),
- ntohl(ifs->last_ttl),
- ntohl(ifs->num_mcast),
- ntohl(ifs->received),
- ntohl(ifs->sent),
- ntohl(ifs->notsent),
- ntohl(ifs->scopeid),
- ntohl(ifs->ifindex),
- ntohl(ifs->peercnt),
- ntohl(ifs->uptime));
-
- if (ntohl(ifs->v6_flag)) {
- memcpy((char *)&GET_INADDR6(saddr), (char *)&ifs->unmask.addr6, sizeof(ifs->unmask.addr6));
- saddr.ss_family = AF_INET6;
- } else {
- memcpy((char *)&GET_INADDR(saddr), (char *)&ifs->unmask.addr, sizeof(ifs->unmask.addr));
- saddr.ss_family = AF_INET;
- }
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- saddr.ss_len = SOCKLEN(&saddr);
-#endif
+ (u_long)ntohl(ifs->flags),
+ (u_long)ntohl(ifs->last_ttl),
+ (u_long)ntohl(ifs->num_mcast),
+ (u_long)ntohl(ifs->received),
+ (u_long)ntohl(ifs->sent),
+ (u_long)ntohl(ifs->notsent),
+ (u_long)ntohl(ifs->scopeid),
+ (u_long)ntohl(ifs->peercnt),
+ (u_long)ntohl(ifs->uptime));
+
+ SET_ADDR(saddr, ntohl(ifs->v6_flag),
+ ifs->unmask.addr.s_addr, ifs->unmask.addr6);
fprintf(fp, IF_LIST_AFMT_STR, stoa(&saddr), 'M');
if (!ntohl(ifs->v6_flag) && ntohl(ifs->flags) & (INT_BCASTOPEN)) {
- memcpy((char *)&GET_INADDR(saddr), (char *)&ifs->unbcast.addr, sizeof(ifs->unbcast.addr));
- saddr.ss_family = AF_INET;
-#ifdef HAVE_SA_LEN_IN_STRUCT_SOCKADDR
- saddr.ss_len = SOCKLEN(&saddr);
-#endif
+ SET_ADDR(saddr, ntohl(ifs->v6_flag),
+ ifs->unbcast.addr.s_addr, ifs->unbcast.addr6);
fprintf(fp, IF_LIST_AFMT_STR, stoa(&saddr), 'B');
}
OpenPOWER on IntegriCloud