diff options
author | Ollivier Robert <roberto@FreeBSD.org> | 2008-08-18 14:26:05 +0000 |
---|---|---|
committer | Ollivier Robert <roberto@FreeBSD.org> | 2008-08-18 14:26:05 +0000 |
commit | ff717da2cf625e3d07537a93a4c240692fa55bd6 (patch) | |
tree | 9dcf618e4446ac2b5fca7d0afe7767382664f0d6 /ntpdc | |
parent | cce65f439697627afbccf5a67035a957bb4d784a (diff) |
Notes
Diffstat (limited to 'ntpdc')
-rw-r--r-- | ntpdc/Makefile.am | 47 | ||||
-rw-r--r-- | ntpdc/Makefile.in | 410 | ||||
-rw-r--r-- | ntpdc/layout.std | 22 | ||||
-rwxr-xr-x | ntpdc/nl.pl | 4 | ||||
-rw-r--r-- | ntpdc/nl.pl.in | 4 | ||||
-rw-r--r-- | ntpdc/ntpdc-opts.c | 667 | ||||
-rw-r--r-- | ntpdc/ntpdc-opts.def | 127 | ||||
-rw-r--r-- | ntpdc/ntpdc-opts.h | 222 | ||||
-rw-r--r-- | ntpdc/ntpdc-opts.menu | 1 | ||||
-rw-r--r-- | ntpdc/ntpdc-opts.texi | 275 | ||||
-rw-r--r-- | ntpdc/ntpdc.1 | 158 | ||||
-rw-r--r-- | ntpdc/ntpdc.c | 253 | ||||
-rw-r--r-- | ntpdc/ntpdc.h | 23 | ||||
-rw-r--r-- | ntpdc/ntpdc_ops.c | 476 |
14 files changed, 2314 insertions, 375 deletions
diff --git a/ntpdc/Makefile.am b/ntpdc/Makefile.am index f7a4d2afce5c1..858c523261e07 100644 --- a/ntpdc/Makefile.am +++ b/ntpdc/Makefile.am @@ -1,26 +1,42 @@ -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies -AUTOMAKE_OPTIONS = ../util/ansi2knr +AUTOMAKE_OPTIONS= ../util/ansi2knr + +bindir= ${exec_prefix}/${BINSUBDIR} bin_PROGRAMS= ntpdc EXTRA_PROGRAMS= ntpdc-layout EXTRA_DATA= check-layout -BUILT_SOURCES= maybe-layout -INCLUDES= -I$(top_srcdir)/include +BUILT_SOURCES= @MAKE_CHECK_LAYOUT@ +AM_CPPFLAGS= -I$(top_srcdir)/include $(LIBOPTS_CFLAGS) # LDADD might need RESLIB and ADJLIB -ntpdc_LDADD= version.o ../libntp/libntp.a @READLINE_LIBS@ +ntpdc_LDADD= version.o @READLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a # 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 noinst_HEADERS= ntpdc.h -EXTRA_DIST= nl_in.c nl.pl layout.std 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 + +$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.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 -ntpdc_SOURCES = ntpdc.c ntpdc_ops.c +$(srcdir)/ntpdc-opts.texi $(srcdir)/ntpdc-opts.menu: $(srcdir)/ntpdc-opts.def $(std_def_list) + $(run_ag) -Taginfo.tpl -DLEVEL=section ntpdc-opts.def -maybe-layout: - @case "${PATH_PERL}" in \ - /*) ${MAKE} check-layout ;; \ - esac +ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-opts.c ntpdc-opts.h ntpdc-layout.o: nl.c @@ -35,11 +51,16 @@ $(PROGRAMS): $(LDADD) ../libntp/libntp.a: cd ../libntp && $(MAKE) +$(top_srcdir)/version : + cd $(top_srcdir) && $(MAKE) version + 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 # 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 - $(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c +nl.c: nl_in.c nl.pl Makefile.am + $(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c + +include ../bincheck.mf diff --git a/ntpdc/Makefile.in b/ntpdc/Makefile.in index 8ad0e0565649a..30c96acc8a791 100644 --- a/ntpdc/Makefile.in +++ b/ntpdc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.7 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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. @@ -14,6 +14,11 @@ @SET_MAKE@ +# we traditionally installed software in bindir, while it should have gone +# in sbindir. Now that we offer a choice, look in the "other" installation +# subdir to warn folks if there is another version there. + + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -21,7 +26,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -37,16 +41,66 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -target_triplet = @target@ +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 +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__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = nl.pl +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_ntpdc_OBJECTS = ntpdc$U.$(OBJEXT) ntpdc_ops$U.$(OBJEXT) \ + ntpdc-opts$U.$(OBJEXT) +ntpdc_OBJECTS = $(am_ntpdc_OBJECTS) +am__DEPENDENCIES_1 = +ntpdc_DEPENDENCIES = version.o $(am__DEPENDENCIES_1) \ + ../libntp/libntp.a +ntpdc_layout_SOURCES = ntpdc-layout.c +ntpdc_layout_OBJECTS = ntpdc-layout$U.$(OBJEXT) +ntpdc_layout_DEPENDENCIES = +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(ntpdc_SOURCES) ntpdc-layout.c +DIST_SOURCES = $(ntpdc_SOURCES) ntpdc-layout.c +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ ARLIB_DIR = @ARLIB_DIR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BINSUBDIR = @BINSUBDIR@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -54,10 +108,15 @@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DCFD = @DCFD@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ @@ -65,30 +124,39 @@ EF_LIBS = @EF_LIBS@ EF_PROGS = @EF_PROGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ +INSTALL_LIBOPTS_FALSE = @INSTALL_LIBOPTS_FALSE@ +INSTALL_LIBOPTS_TRUE = @INSTALL_LIBOPTS_TRUE@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCRYPTO = @LCRYPTO@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ +LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@ +LIBOPTS_DIR = @LIBOPTS_DIR@ +LIBOPTS_LDADD = @LIBOPTS_LDADD@ LIBPARSE = @LIBPARSE@ LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MAKE_ADJTIMED = @MAKE_ADJTIMED@ +MAKE_CHECK_LAYOUT = @MAKE_CHECK_LAYOUT@ MAKE_CHECK_Y2K = @MAKE_CHECK_Y2K@ MAKE_LIBNTPSIM = @MAKE_LIBNTPSIM@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_NTPDSIM = @MAKE_NTPDSIM@ MAKE_NTPTIME = @MAKE_NTPTIME@ -MAKE_NTP_KEYGEN = @MAKE_NTP_KEYGEN@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ -MAKE_SNTP = @MAKE_SNTP@ MAKE_TICKADJ = @MAKE_TICKADJ@ MAKE_TIMETRIM = @MAKE_TIMETRIM@ +NEED_LIBOPTS_FALSE = @NEED_LIBOPTS_FALSE@ +NEED_LIBOPTS_TRUE = @NEED_LIBOPTS_TRUE@ OBJEXT = @OBJEXT@ OPENSSL = @OPENSSL@ OPENSSL_INC = @OPENSSL_INC@ @@ -111,15 +179,22 @@ STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -bindir = @bindir@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = ${exec_prefix}/${BINSUBDIR} build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ @@ -139,6 +214,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -146,88 +222,79 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ subdirs = @subdirs@ sysconfdir = @sysconfdir@ -target = @target@ target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ - -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies AUTOMAKE_OPTIONS = ../util/ansi2knr -bin_PROGRAMS = ntpdc -EXTRA_PROGRAMS = ntpdc-layout EXTRA_DATA = check-layout -BUILT_SOURCES = maybe-layout -INCLUDES = -I$(top_srcdir)/include +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) # LDADD might need RESLIB and ADJLIB -ntpdc_LDADD = version.o ../libntp/libntp.a @READLINE_LIBS@ +ntpdc_LDADD = version.o @READLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a # 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 noinst_HEADERS = ntpdc.h -EXTRA_DIST = nl_in.c nl.pl layout.std ETAGS_ARGS = Makefile.am - -ntpdc_SOURCES = ntpdc.c ntpdc_ops.c -subdir = ntpdc -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = nl.pl -EXTRA_PROGRAMS = ntpdc-layout$(EXEEXT) -bin_PROGRAMS = ntpdc$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_ntpdc_OBJECTS = ntpdc$U.$(OBJEXT) ntpdc_ops$U.$(OBJEXT) -ntpdc_OBJECTS = $(am_ntpdc_OBJECTS) -ntpdc_DEPENDENCIES = version.o ../libntp/libntp.a -ntpdc_LDFLAGS = -ntpdc_layout_SOURCES = ntpdc-layout.c -ntpdc_layout_OBJECTS = ntpdc-layout$U.$(OBJEXT) -ntpdc_layout_DEPENDENCIES = -ntpdc_layout_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ntpdc$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntpdc-layout$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntpdc_ops$U.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(ntpdc_SOURCES) ntpdc-layout.c -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \ - Makefile.am nl.pl.in -SOURCES = $(ntpdc_SOURCES) ntpdc-layout.c - +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 + +ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-opts.c ntpdc-opts.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/../bincheck.mf $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ntpdc/Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu ntpdc/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -nl.pl: $(top_builddir)/config.status nl.pl.in + $(AUTOMAKE) --foreign ntpdc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +nl.pl: $(top_builddir)/config.status $(srcdir)/nl.pl.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ + || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done @@ -235,12 +302,16 @@ uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done ntpdc$(EXEEXT): $(ntpdc_OBJECTS) $(ntpdc_DEPENDENCIES) @rm -f ntpdc$(EXEEXT) $(LINK) $(ntpdc_LDFLAGS) $(ntpdc_OBJECTS) $(ntpdc_LDADD) $(LIBS) @@ -249,12 +320,10 @@ ntpdc-layout$(EXEEXT): $(ntpdc_layout_OBJECTS) $(ntpdc_layout_DEPENDENCIES) $(LINK) $(ntpdc_layout_LDFLAGS) $(ntpdc_layout_OBJECTS) $(ntpdc_layout_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c - -ANSI2KNR = ../util/ansi2knr ../util/ansi2knr: cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr @@ -263,46 +332,95 @@ mostlyclean-kr: @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@ .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ 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-layout_.$(OBJEXT) ntpdc_ops_.$(OBJEXT) : \ -$(ANSI2KNR) -uninstall-info-am: +ntpdc_.$(OBJEXT) ntpdc_.lo ntpdc-layout_.$(OBJEXT) ntpdc-layout_.lo \ +ntpdc-opts_.$(OBJEXT) ntpdc-opts_.lo ntpdc_ops_.$(OBJEXT) \ +ntpdc_ops_.lo : $(ANSI2KNR) -ETAGS = etags -ETAGSFLAGS = +mostlyclean-libtool: + -rm -f *.lo -CTAGS = ctags -CTAGSFLAGS = +clean-libtool: + -rm -rf .libs _libs -tags: TAGS +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -312,6 +430,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -323,10 +442,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -349,12 +469,9 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/.. @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -366,7 +483,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -384,10 +501,11 @@ distdir: $(DISTFILES) check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(PROGRAMS) $(HEADERS) - +all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am @@ -400,7 +518,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -409,7 +527,7 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @@ -418,42 +536,45 @@ maintainer-clean-generic: -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile - distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: -install-data-am: +install-data-am: install-man install-exec-am: install-binPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-info: install-info-am -install-man: +install-man: install-man1 installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile - 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-kr \ + mostlyclean-libtool pdf: pdf-am @@ -463,24 +584,34 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-binPROGRAMS install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ + 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-exec \ + install-exec-am install-exec-hook install-info install-info-am \ + install-man install-man1 install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-kr pdf pdf-am ps ps-am tags \ - uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am + mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am uninstall-man \ + uninstall-man1 -maybe-layout: - @case "${PATH_PERL}" in \ - /*) ${MAKE} check-layout ;; \ - esac +$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.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-opts.texi $(srcdir)/ntpdc-opts.menu: $(srcdir)/ntpdc-opts.def $(std_def_list) + $(run_ag) -Taginfo.tpl -DLEVEL=section ntpdc-opts.def ntpdc-layout.o: nl.c @@ -495,14 +626,29 @@ $(PROGRAMS): $(LDADD) ../libntp/libntp.a: cd ../libntp && $(MAKE) +$(top_srcdir)/version : + cd $(top_srcdir) && $(MAKE) version + 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 # 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 - $(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c +nl.c: nl_in.c nl.pl Makefile.am + $(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!"; \ + done + +# # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/ntpdc/layout.std b/ntpdc/layout.std index 0a67b73e6325f..daff63678460e 100644 --- a/ntpdc/layout.std +++ b/ntpdc/layout.std @@ -410,6 +410,28 @@ offsetof(calcnt) = 48 offsetof(errcnt) = 52 offsetof(stbcnt) = 56 +sizeof(struct info_if_stats) = 136 +offsetof(unaddr) = 0 +offsetof(unbcast) = 16 +offsetof(unmask) = 32 +offsetof(v6_flag) = 48 +offsetof(name) = 52 +offsetof(flags) = 84 +offsetof(last_ttl) = 88 +offsetof(num_mcast) = 92 +offsetof(received) = 96 +offsetof(sent) = 100 +offsetof(notsent) = 104 +offsetof(uptime) = 108 +offsetof(scopeid) = 112 +offsetof(ifindex) = 116 +offsetof(ifnum) = 120 +offsetof(peercnt) = 124 +offsetof(family) = 128 +offsetof(ignore_packets) = 130 +offsetof(action) = 131 +offsetof(_filler0) = 132 + sizeof(struct info_dns_assoc) = 32 offsetof(peeraddr) = 0 offsetof(associd) = 4 diff --git a/ntpdc/nl.pl b/ntpdc/nl.pl index 6974fe2996b56..afea8b7553628 100755 --- a/ntpdc/nl.pl +++ b/ntpdc/nl.pl @@ -20,13 +20,13 @@ while (<>) { printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n"; next; } - if (/\s*\w+\s*(\w*)(\[.*\])?\s*;\s*$/) { + 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 (/^};$/) { + if (/^}\s*;\s*$/) { printf " printf(\"\\n\");\n\n"; $found = 0 if $last; next; diff --git a/ntpdc/nl.pl.in b/ntpdc/nl.pl.in index dfa79c26abf2e..813dc1f10df4b 100644 --- a/ntpdc/nl.pl.in +++ b/ntpdc/nl.pl.in @@ -20,13 +20,13 @@ while (<>) { printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n"; next; } - if (/\s*\w+\s*(\w*)(\[.*\])?\s*;\s*$/) { + 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 (/^};$/) { + if (/^}\s*;\s*$/) { printf " printf(\"\\n\");\n\n"; $found = 0 if $last; next; diff --git a/ntpdc/ntpdc-opts.c b/ntpdc/ntpdc-opts.c new file mode 100644 index 0000000000000..d3c2549af8129 --- /dev/null +++ b/ntpdc/ntpdc-opts.c @@ -0,0 +1,667 @@ +/* + * EDIT THIS FILE WITH CAUTION (ntpdc-opts.c) + * + * It has been AutoGen-ed Sunday August 17, 2008 at 05:26:25 AM EDT + * 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. + * + * This source file is copyrighted and licensed under the following terms: + * + * ntpdc copyright 1970-2008 David L. Mills and/or others - all rights reserved + * + * see html/copyright.html + */ + + +#include <limits.h> + +#define OPTION_CODE_COMPILE 1 +#include "ntpdc-opts.h" + +#ifdef __cplusplus +extern "C" { +#endif +tSCC zCopyright[] = + "ntpdc copyright (c) 1970-2008 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; + +/* + * global included definitions + */ +#ifdef __windows + extern int atoi(const char*); +#else +# include <stdlib.h> +#endif + +#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: + */ +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 + * "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 + * "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": + */ +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) + +/* + * 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[] = { + INDEX_OPT_COMMAND, + INDEX_OPT_LISTPEERS, + INDEX_OPT_PEERS, + INDEX_OPT_SHOWPEERS, NO_EQUIVALENT }; +#define INTERACTIVE_FLAGS (OPTST_DISABLED) + +/* + * Debug_Level option description: + */ +#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 */ + +/* + * Set_Debug_Level 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: + */ +tSCC zNumericText[] = + "numeric host addresses"; +tSCC zNumeric_NAME[] = "NUMERIC"; +tSCC zNumeric_Name[] = "numeric"; +#define NUMERIC_FLAGS (OPTST_DISABLED) + +/* + * Help/More_Help/Version option descriptions: + */ +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"; + +/* + * Save/Load_Opts option description: + */ +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) +/* + * 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; +static tOptProc + doUsageOpt; + +/* + * #define map the "normal" callout procs + */ +#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 ] = { + { /* entry idx, value */ 0, VALUE_OPT_IPV4, + /* equiv idx, value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ IPV4_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zIpv4Text, zIpv4_NAME, zIpv4_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 1, VALUE_OPT_IPV6, + /* equiv idx, value */ NOLIMIT, NOLIMIT, + /* equivalenced to */ INDEX_OPT_IPV4, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ IPV6_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zIpv6Text, zIpv6_NAME, zIpv6_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 2, VALUE_OPT_COMMAND, + /* equiv idx, value */ 2, VALUE_OPT_COMMAND, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, NOLIMIT, 0, + /* opt state flags */ COMMAND_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ optionStackArg, + /* desc, NAME, name */ zCommandText, zCommand_NAME, zCommand_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 3, VALUE_OPT_LISTPEERS, + /* equiv idx, value */ 3, VALUE_OPT_LISTPEERS, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ LISTPEERS_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, aListpeersCantList, + /* option proc */ NULL, + /* desc, NAME, name */ zListpeersText, zListpeers_NAME, zListpeers_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 4, VALUE_OPT_PEERS, + /* equiv idx, value */ 4, VALUE_OPT_PEERS, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ PEERS_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, aPeersCantList, + /* option proc */ NULL, + /* desc, NAME, name */ zPeersText, zPeers_NAME, zPeers_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 5, VALUE_OPT_SHOWPEERS, + /* equiv idx, value */ 5, VALUE_OPT_SHOWPEERS, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ SHOWPEERS_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, aShowpeersCantList, + /* option proc */ NULL, + /* desc, NAME, name */ zShowpeersText, zShowpeers_NAME, zShowpeers_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 6, VALUE_OPT_INTERACTIVE, + /* equiv idx, value */ 6, VALUE_OPT_INTERACTIVE, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ INTERACTIVE_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, aInteractiveCantList, + /* option proc */ NULL, + /* desc, NAME, name */ zInteractiveText, zInteractive_NAME, zInteractive_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 7, VALUE_OPT_DEBUG_LEVEL, + /* equiv idx, value */ 7, VALUE_OPT_DEBUG_LEVEL, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, NOLIMIT, 0, + /* opt state flags */ DEBUG_LEVEL_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zDebug_LevelText, zDebug_Level_NAME, zDebug_Level_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL, + /* equiv idx, value */ 8, VALUE_OPT_SET_DEBUG_LEVEL, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, NOLIMIT, 0, + /* opt state flags */ SET_DEBUG_LEVEL_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* 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, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 9, VALUE_OPT_NUMERIC, + /* equiv idx, value */ 9, VALUE_OPT_NUMERIC, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ NUMERIC_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zNumericText, zNumeric_NAME, zNumeric_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, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ VERSION_OPT_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ DOVERPROC, + /* desc, NAME, name */ zVersionText, NULL, zVersion_Name, + /* disablement strs */ NULL, NULL }, + +#undef VERSION_OPT_FLAGS + + + { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ doUsageOpt, + /* desc, NAME, name */ zHelpText, NULL, zHelp_Name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* 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, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* 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, + /* 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, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS, + /* equiv idx value */ NO_EQUIVALENT, 0, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, NOLIMIT, 0, + /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) \ + | OPTST_DISABLE_IMM, 0, + /* 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 } +}; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Define the Ntpdc Option Environment + */ +tSCC zPROGNAME[] = "NTPDC"; +tSCC zUsageTitle[] = +"ntpdc - vendor-specific NTP query program - Ver. 4.2.4p5\n\ +USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"; +tSCC zRcName[] = ".ntprc"; +tSCC* apzHomeList[] = { + "$HOME", + ".", + NULL }; + +tSCC zBugsAddr[] = "http://bugs.ntp.isc.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/share/autogen/optcode.tpl near line 408 */ + +#if defined(ENABLE_NLS) +# define OPTPROC_BASE OPTPROC_TRANSLATE + static tOptionXlateProc translate_option_strings; +#else +# define OPTPROC_BASE OPTPROC_NONE +# define translate_option_strings NULL +#endif /* ENABLE_NLS */ + +tOptions ntpdcOptions = { + OPTIONS_STRUCT_VERSION, + 0, NULL, /* original argc + argv */ + ( OPTPROC_BASE + + OPTPROC_ERRSTOP + + OPTPROC_SHORTOPT + + OPTPROC_LONGOPT + + OPTPROC_NO_REQ_OPT + + OPTPROC_ENVIRON + + OPTPROC_HAS_IMMED ), + 0, NULL, /* current option index, current option */ + NULL, NULL, zPROGNAME, + zRcName, zCopyright, zCopyrightNotice, + zFullVersion, apzHomeList, zUsageTitle, + zExplain, zDetail, optDesc, + zBugsAddr, /* address to send bugs to */ + NULL, NULL, /* extensions/saved state */ + 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 */, + NO_EQUIVALENT /* index of default opt */ + }, + 15 /* full option count */, 10 /* user option count */ +}; + +/* + * 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/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/share/autogen/optcode.tpl near line 514 */ + +#if ENABLE_NLS +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#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 ) +{ + char* pzRes; + 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 ); + } + return pzRes; +} + +static void coerce_it(void** s) { *s = AO_gettext(*s); } +#define COERSION(_f) \ + coerce_it((void*)&(ntpdcOptions._f)) + +/* + * This invokes the translation code (e.g. gettext(3)). + */ +static void +translate_option_strings( void ) +{ + /* + * 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; + + do { + ppz++; + *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++; + } + } + COERSION(pzCopyright); + COERSION(pzCopyNotice); + COERSION(pzFullVersion); + COERSION(pzUsageTitle); + COERSION(pzExplain); + COERSION(pzDetail); +} + +#endif /* ENABLE_NLS */ + +#ifdef __cplusplus +} +#endif +/* ntpdc-opts.c ends here */ diff --git a/ntpdc/ntpdc-opts.def b/ntpdc/ntpdc-opts.def new file mode 100644 index 0000000000000..0b5aefee9bb19 --- /dev/null +++ b/ntpdc/ntpdc-opts.def @@ -0,0 +1,127 @@ +/* -*- Mode: Text -*- */ + +autogen definitions options; + +prog-name = "ntpdc"; +prog-title = "vendor-specific NTP query program"; +argument = '[ host ...]'; + +#include copyright.def +#include homerc.def +#include autogen-version.def + +test-main; + +flag = { + name = ipv4; + value = 4; + equivalence = ipv4; + descrip = "Force IPv4 DNS name resolution"; + doc = <<- _EndOfDoc_ + Force DNS resolution of following host names on the command line + to the IPv4 namespace. + _EndOfDoc_; +}; + +flag = { + name = ipv6; + value = 6; + equivalence = ipv4; + descrip = "Force IPv6 DNS name resolution"; + doc = <<- _EndOfDoc_ + Force DNS resolution of following host names on the command line + to the IPv6 namespace. + _EndOfDoc_; +}; + +flag = { + name = command; + value = c; + arg-type = string; + descrip = "run a command and exit"; + max = NOLIMIT; + arg-name = cmd; + stack-arg; + doc = <<- _EndOfDoc_ + 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). + _EndOfDoc_; +}; + +flag = { + name = listpeers; + value = l; + descrip = "Print a list of the peers"; + flags-cant = command; + doc = <<- _EndOfDoc_ + 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. + _EndOfDoc_; +}; + +flag = { + name = peers; + value = p; + descrip = "Print a list of the peers"; + flags-cant = command; + doc = <<- _EndOfDoc_ + 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. + _EndOfDoc_; +}; + +flag = { + name = showpeers; + value = s; + descrip = "Show a list of the peers"; + flags-cant = command; + doc = <<- _EndOfDoc_ + 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. + _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_; +}; + +#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_; +}; + +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; diff --git a/ntpdc/ntpdc-opts.h b/ntpdc/ntpdc-opts.h new file mode 100644 index 0000000000000..a4bf99fd1e838 --- /dev/null +++ b/ntpdc/ntpdc-opts.h @@ -0,0 +1,222 @@ +/* + * EDIT THIS FILE WITH CAUTION (ntpdc-opts.h) + * + * It has been AutoGen-ed Sunday August 17, 2008 at 05:26:25 AM EDT + * 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. + * + * This source file is copyrighted and licensed under the following terms: + * + * ntpdc copyright 1970-2008 David L. Mills and/or others - all rights reserved + * + * see html/copyright.html + */ +/* + * 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 +#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 +#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: + */ +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 +} teOptIndex; + +#define OPTION_CT 15 +#define NTPDC_VERSION "4.2.4p5" +#define NTPDC_FULL_VERSION "ntpdc - vendor-specific NTP query program - Ver. 4.2.4p5" + +/* + * Interface defines for all options. Replace "n" with the UPPER_CASED + * option name (as in the teOptIndex enumeration above). + * e.g. HAVE_OPT( IPV4 ) + */ +#define DESC(n) (ntpdcOptions.pOptDesc[INDEX_OPT_## n]) +#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) +#define OPT_ARG(n) (DESC(n).optArg.argString) +#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) +#define COUNT_OPT(n) (DESC(n).optOccCt) +#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) +#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) +#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) +#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) +#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) +#define CLEAR_OPT(n) STMTS( \ + DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ + if ( (DESC(n).fOptState & OPTST_INITENABLED) == 0) \ + DESC(n).fOptState |= OPTST_DISABLED; \ + DESC(n).optCookie = NULL ) + +/* + * Make sure there are no #define name conflicts with the option names + */ +#ifndef NO_OPTION_NAME_WARNINGS +# ifdef IPV4 +# warning undefining IPV4 due to option name conflict +# undef IPV4 +# endif +# ifdef IPV6 +# warning undefining IPV6 due to option name conflict +# undef IPV6 +# endif +# ifdef COMMAND +# 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 +# endif +# ifdef SET_DEBUG_LEVEL +# warning undefining SET_DEBUG_LEVEL due to option name conflict +# undef SET_DEBUG_LEVEL +# endif +# ifdef NUMERIC +# warning undefining NUMERIC due to option name conflict +# undef NUMERIC +# 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 NUMERIC +#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 VALUE_OPT_HELP '?' +#define VALUE_OPT_MORE_HELP '!' +#define VALUE_OPT_SAVE_OPTS '>' +#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) ) +/* + * Interface defines not associated with particular options + */ +#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/share/autogen/opthead.tpl near line 360 */ + +/* * * * * * + * + * Declare the ntpdc option descriptor. + */ +#ifdef __cplusplus +extern "C" { +#endif + +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 + +#ifdef __cplusplus +} +#endif +#endif /* AUTOOPTS_NTPDC_OPTS_H_GUARD */ +/* ntpdc-opts.h ends here */ diff --git a/ntpdc/ntpdc-opts.menu b/ntpdc/ntpdc-opts.menu new file mode 100644 index 0000000000000..42ca3b42be826 --- /dev/null +++ b/ntpdc/ntpdc-opts.menu @@ -0,0 +1 @@ +* ntpdc Invocation:: Invoking ntpdc diff --git a/ntpdc/ntpdc-opts.texi b/ntpdc/ntpdc-opts.texi new file mode 100644 index 0000000000000..dbce64c9cfea7 --- /dev/null +++ b/ntpdc/ntpdc-opts.texi @@ -0,0 +1,275 @@ +@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 Sunday August 17, 2008 at 05:26:27 AM EDT +# 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.5p113 +USAGE: ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...] + Flg Arg Option-Name Description + -4 no ipv4 Force IPv4 DNS name resolution + -6 no ipv6 Force IPv6 DNS name resolution + - an alternate for 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 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/ntpdc/ntpdc.1 b/ntpdc/ntpdc.1 new file mode 100644 index 0000000000000..c653b62f94754 --- /dev/null +++ b/ntpdc/ntpdc.1 @@ -0,0 +1,158 @@ +.TH NTPDC 1 2008-08-17 "( 4.2.4p5)" "Programmer's Manual" +.\" EDIT THIS FILE WITH CAUTION (ntpdc.1) +.\" +.\" It has been AutoGen-ed Sunday August 17, 2008 at 05:26:27 AM EDT +.\" 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.isc.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/ntpdc/ntpdc.c b/ntpdc/ntpdc.c index aa4f188a603a7..9126533396aa3 100644 --- a/ntpdc/ntpdc.c +++ b/ntpdc/ntpdc.c @@ -4,6 +4,10 @@ #include <stdio.h> +#include <ctype.h> +#include <signal.h> +#include <setjmp.h> + #include "ntpdc.h" #include "ntp_select.h" #include "ntp_io.h" @@ -13,12 +17,10 @@ #include "isc/net.h" #include "isc/result.h" -#include <ctype.h> -#include <signal.h> -#include <setjmp.h> -#include <netdb.h> +#include "ntpdc-opts.h" #ifdef SYS_WINNT +# include <Mswsock.h> # include <io.h> #else # define closesocket close @@ -30,9 +32,14 @@ #endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */ #ifdef SYS_VXWORKS -/* vxWorks needs mode flag -casey*/ -#define open(name, flags) open(name, flags, 0777) -#define SERVER_PORT_NUM 123 + /* vxWorks needs mode flag -casey*/ +# define open(name, flags) open(name, flags, 0777) +# define SERVER_PORT_NUM 123 +#endif + +/* We use COMMAND as an autogen keyword */ +#ifdef COMMAND +# undef COMMAND #endif /* @@ -47,6 +54,7 @@ static const char * prompt = "ntpdc> "; /* prompt to ask him about */ * Keyid used for authenticated requests. Obtained on the fly. */ static u_long info_auth_keyid; +static int keyid_entered = 0; /* * Type of key md5 @@ -56,6 +64,11 @@ static u_long info_auth_keyid; static int info_auth_keytype = KEY_TYPE_MD5; /* MD5 */ u_long current_time; /* needed by authkeys; not used */ +/* + * for get_systime() + */ +s_char sys_precision; /* local clock precision (log2 s) */ + int ntpdcmain P((int, char **)); /* * Built in command handler declarations @@ -105,10 +118,10 @@ static struct xcmd builtins[] = { { "help", help, { OPT|NTP_STR, NO, NO, NO }, { "command", "", "", "" }, "tell the use and syntax of commands" }, - { "timeout", timeout, { OPT|UINT, NO, NO, NO }, + { "timeout", timeout, { OPT|NTP_UINT, NO, NO, NO }, { "msec", "", "", "" }, "set the primary receive time out" }, - { "delay", my_delay, { OPT|INT, NO, NO, NO }, + { "delay", my_delay, { OPT|NTP_INT, NO, NO, NO }, { "msec", "", "", "" }, "set the delay added to encryption time stamps" }, { "host", host, { OPT|NTP_STR, OPT|NTP_STR, NO, NO }, @@ -129,7 +142,7 @@ static struct xcmd builtins[] = { { "exit", quit, { NO, NO, NO, NO }, { "", "", "", "" }, "exit ntpdc" }, - { "keyid", keyid, { OPT|UINT, NO, NO, NO }, + { "keyid", keyid, { OPT|NTP_UINT, NO, NO, NO }, { "key#", "", "", "" }, "set/show keyid to use for authenticated requests" }, { "keytype", keytype, { OPT|NTP_STR, NO, NO, NO }, @@ -154,9 +167,8 @@ static struct xcmd builtins[] = { #define MAXCMDS 100 /* maximum commands on cmd line */ #define MAXHOSTS 200 /* maximum hosts on cmd line */ #define MAXLINE 512 /* maximum line length */ -#define MAXTOKENS (1+1+MAXARGS+2) /* maximum number of usable tokens */ - /* command + -4|-6 + MAXARGS + */ - /* redirection */ +#define MAXTOKENS (1+1+MAXARGS+MOREARGS+2) /* maximum number of usable tokens */ +#define SCREENWIDTH 78 /* nominal screen width in columns */ /* * Some variables used and manipulated locally @@ -268,11 +280,7 @@ main( #ifdef SYS_VXWORKS void clear_globals(void) { - extern int ntp_optind; - extern char *ntp_optarg; showhostnames = 0; /* show host names by default */ - ntp_optind = 0; - ntp_optarg = 0; havehost = 0; /* set to 1 when host open */ numcmds = 0; numhosts = 0; @@ -288,10 +296,7 @@ ntpdcmain( char *argv[] ) { - int c; - int errflg = 0; extern int ntp_optind; - extern char *ntp_optarg; delay_time.l_ui = 0; delay_time.l_uf = DEFDELAY; @@ -315,6 +320,69 @@ ntpdcmain( } progname = argv[0]; + + { + int optct = optionProcess(&ntpdcOptions, argc, argv); + argc -= optct; + argv += optct; + } + + switch (WHICH_IDX_IPV4) { + case INDEX_OPT_IPV4: + ai_fam_templ = AF_INET; + break; + case INDEX_OPT_IPV6: + ai_fam_templ = AF_INET6; + break; + default: + ai_fam_templ = ai_fam_default; + break; + } + + if (HAVE_OPT(COMMAND)) { + int cmdct = STACKCT_OPT( COMMAND ); + const char** cmds = STACKLST_OPT( COMMAND ); + + while (cmdct-- > 0) { + ADDCMD(*cmds++); + } + } + + debug = DESC(DEBUG_LEVEL).optOccCt; + + if (HAVE_OPT(INTERACTIVE)) { + interactive = 1; + } + + if (HAVE_OPT(NUMERIC)) { + showhostnames = 0; + } + + if (HAVE_OPT(LISTPEERS)) { + ADDCMD("listpeers"); + } + + if (HAVE_OPT(PEERS)) { + ADDCMD("peers"); + } + + if (HAVE_OPT(SHOWPEERS)) { + ADDCMD("dmpeers"); + } + + 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; + } + +#if 0 ai_fam_templ = ai_fam_default; while ((c = ntp_getopt(argc, argv, "46c:dilnps")) != EOF) switch (c) { @@ -349,12 +417,14 @@ ntpdcmain( errflg++; break; } + if (errflg) { (void) fprintf(stderr, "usage: %s [-46dilnps] [-c cmd] host ...\n", progname); exit(2); } + if (ntp_optind == argc) { ADDHOST(DEFHOST); } else { @@ -366,6 +436,7 @@ ntpdcmain( && isatty(fileno(stdin)) && isatty(fileno(stderr))) { interactive = 1; } +#endif #ifndef SYS_WINNT /* Under NT cannot handle SIGINT, WIN32 spawns a handler */ if (interactive) @@ -449,7 +520,11 @@ openhost( hints.ai_flags = AI_NUMERICHOST; a_info = getaddrinfo(hname, service, &hints, &ai); - if (a_info == EAI_NONAME || a_info == EAI_NODATA) { + if (a_info == EAI_NONAME +#ifdef EAI_NODATA + || a_info == EAI_NODATA +#endif + ) { hints.ai_flags = AI_CANONNAME; #ifdef AI_ADDRCONFIG hints.ai_flags |= AI_ADDRCONFIG; @@ -463,6 +538,8 @@ openhost( } if (a_info != 0) { (void) fprintf(stderr, "%s\n", gai_strerror(a_info)); + if (ai != NULL) + freeaddrinfo(ai); return 0; } @@ -502,6 +579,7 @@ openhost( { int optionValue = SO_SYNCHRONOUS_NONALERT; int err; + err = setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&optionValue, sizeof(optionValue)); if (err != NO_ERROR) { (void) fprintf(stderr, "cannot open nonoverlapped sockets\n"); @@ -541,7 +619,7 @@ openhost( ai->ai_addrlen) == -1) #endif /* SYS_VXWORKS */ error("connect", "", ""); - if (a_info) + if (ai != NULL) freeaddrinfo(ai); havehost = 1; req_pkt_size = REQ_LEN_NOMAC; @@ -853,10 +931,10 @@ sendrequest( qpkt.mbz_itemsize = MBZ_ITEMSIZE(qsize); } else { qpkt.err_nitems = ERR_NITEMS(0, 0); - qpkt.mbz_itemsize = MBZ_ITEMSIZE(0); + qpkt.mbz_itemsize = MBZ_ITEMSIZE(qsize); /* allow for optional first item */ } - if (!auth) { + if (!auth || (keyid_entered && info_auth_keyid == 0)) { qpkt.auth_seq = AUTH_SEQ(0, 0); return sendpkt((char *)&qpkt, req_pkt_size); } else { @@ -869,13 +947,17 @@ sendrequest( + MAX_MAC_LEN - sizeof(struct req_pkt_tail)); if (info_auth_keyid == 0) { - maclen = getkeyid("Keyid: "); - if (maclen == 0) { - (void) fprintf(stderr, - "Invalid key identifier\n"); - return 1; + 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; } - info_auth_keyid = maclen; } if (!authistrusted(info_auth_keyid)) { pass = getpass("MD5 Password: "); @@ -1098,7 +1180,7 @@ docmd( const char *cmdline ) { - char *tokens[1+MAXARGS+2]; + char *tokens[1+MAXARGS+MOREARGS+2]; struct parse pcmd; int ntok; int i, ti; @@ -1155,6 +1237,21 @@ docmd( i++; } + /* Any extra args are assumed to be "OPT|NTP_STR". */ + for ( ; i < MAXARGS + MOREARGS;) { + if ((i+ti) >= ntok) + break; + rval = getarg(tokens[i+ti], (int)(OPT|NTP_STR), &pcmd.argval[i]); + if (rval == -1) { + ti++; + continue; + } + if (rval == 0) + return; + pcmd.nargs++; + i++; + } + i += ti; if (i < ntok && *tokens[i] == '>') { char *fname; @@ -1293,6 +1390,9 @@ findcmd( /* * getarg - interpret an argument token * + * string is always set. + * type is set to the decoded type. + * * return: 0 - failure * 1 - success * -1 - skip to next token @@ -1308,11 +1408,15 @@ getarg( char *cp, *np; static const char *digits = "0123456789"; - switch (code & ~OPT) { + memset(argp, 0, sizeof(*argp)); + + argp->string = str; + argp->type = code & ~OPT; + + switch (argp->type) { case NTP_STR: - argp->string = str; break; - case ADD: + case NTP_ADD: if (!strcmp("-6", str)) { ai_fam_templ = AF_INET6; return -1; @@ -1324,8 +1428,8 @@ getarg( return 0; } break; - case INT: - case UINT: + case NTP_INT: + case NTP_UINT: isneg = 0; np = str; if (*np == '-') { @@ -1346,7 +1450,7 @@ getarg( } while (*(++np) != '\0'); if (isneg) { - if ((code & ~OPT) == UINT) { + if ((code & ~OPT) == NTP_UINT) { (void) fprintf(stderr, "***Value %s should be unsigned\n", str); return 0; @@ -1383,7 +1487,6 @@ getnetnum( int af ) { - int err; int sockaddr_len; struct addrinfo hints, *ai = NULL; @@ -1404,7 +1507,7 @@ getnetnum( NI_NUMERICHOST); } return 1; - } else if ((err = getaddrinfo(hname, "ntp", &hints, &ai)) == 0) { + } 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); @@ -1447,57 +1550,56 @@ help( FILE *fp ) { - int i; - int n; struct xcmd *xcp; char *cmd; - const char *cmdsort[100]; - int length[100]; - int maxlength; - int numperline; - static const char *spaces = " "; /* 20 spaces */ + const char *list[100]; + int word, words; + int row, rows; + int col, cols; if (pcmd->nargs == 0) { - n = 0; + words = 0; for (xcp = builtins; xcp->keyword != 0; xcp++) { if (*(xcp->keyword) != '?') - cmdsort[n++] = xcp->keyword; + list[words++] = xcp->keyword; } - for (xcp = opcmds; xcp->keyword != 0; xcp++) - cmdsort[n++] = xcp->keyword; + for (xcp = opcmds; xcp->keyword != 0; xcp++) + list[words++] = xcp->keyword; + qsort( #ifdef QSORT_USES_VOID_P - qsort(cmdsort, (size_t)n, sizeof(char *), helpsort); + (void *) #else - qsort((char *)cmdsort, (size_t)n, sizeof(char *), helpsort); + (char *) #endif - - maxlength = 0; - for (i = 0; i < n; i++) { - length[i] = strlen(cmdsort[i]); - if (length[i] > maxlength) - maxlength = length[i]; + (list), (size_t)(words), sizeof(char *), helpsort); + col = 0; + for (word = 0; word < words; word++) { + int length = strlen(list[word]); + if (col < length) { + col = length; + } } - maxlength++; - numperline = 76 / maxlength; - - (void) fprintf(fp, "Commands available:\n"); - for (i = 0; i < n; i++) { - if ((i % numperline) == (numperline-1) - || i == (n-1)) - (void) fprintf(fp, "%s\n", cmdsort[i]); - else - (void) fprintf(fp, "%s%s", cmdsort[i], - spaces+20-maxlength+length[i]); + + cols = SCREENWIDTH / ++col; + rows = (words + cols - 1) / cols; + + (void) 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"); } } else { cmd = pcmd->argval[0].string; - n = findcmd(cmd, builtins, opcmds, &xcp); - if (n == 0) { + words = findcmd(cmd, builtins, opcmds, &xcp); + if (words == 0) { (void) fprintf(stderr, "Command `%s' is unknown\n", cmd); return; - } else if (n >= 2) { + } else if (words >= 2) { (void) fprintf(stderr, "Command `%s' is ambiguous\n", cmd); return; @@ -1549,7 +1651,7 @@ printusage( opt46 = 0; (void) fprintf(fp, "usage: %s", xcp->keyword); for (i = 0; i < MAXARGS && xcp->arg[i] != NO; i++) { - if (opt46 == 0 && (xcp->arg[i] & ~OPT) == ADD) { + if (opt46 == 0 && (xcp->arg[i] & ~OPT) == NTP_ADD) { (void) fprintf(fp, " [ -4|-6 ]"); opt46 = 1; } @@ -1675,12 +1777,15 @@ keyid( ) { if (pcmd->nargs == 0) { - if (info_auth_keyid == 0) + if (info_auth_keyid == 0 && !keyid_entered) (void) fprintf(fp, "no keyid defined\n"); + else if (info_auth_keyid == 0 && keyid_entered) + (void) fprintf(fp, "no keyid will be sent\n"); else (void) fprintf(fp, "keyid is %lu\n", (u_long)info_auth_keyid); } else { info_auth_keyid = pcmd->argval[0].uval; + keyid_entered = 1; } } diff --git a/ntpdc/ntpdc.h b/ntpdc/ntpdc.h index 589529fb1c1d9..785c31242d74a 100644 --- a/ntpdc/ntpdc.h +++ b/ntpdc/ntpdc.h @@ -11,23 +11,26 @@ * Maximum number of arguments */ #define MAXARGS 4 +#define MOREARGS 10 /* * Flags for forming descriptors. */ -#define OPT 0x80 /* this argument is optional, or'd with type */ +#define OPT 0x80 /* this argument is optional, or'd with type */ -#define NO 0x0 -#define NTP_STR 0x1 /* string argument */ -#define UINT 0x2 /* unsigned integer */ -#define INT 0x3 /* signed integer */ -#define ADD 0x4 /* IP network address */ -#define IP_VERSION 0x5 /* IP version */ +#define NO 0x0 +#define NTP_STR 0x1 /* string argument */ +#define NTP_UINT 0x2 /* unsigned integer */ +#define NTP_INT 0x3 /* signed integer */ +#define NTP_ADD 0x4 /* IP network address */ +#define IP_VERSION 0x5 /* IP version */ /* - * Arguments are returned in a union + * Arguments are returned in a struct - no + * union space saving is attempted. */ -typedef union { +typedef struct { + u_char type; char *string; long ival; u_long uval; @@ -39,7 +42,7 @@ typedef union { */ struct parse { char *keyword; - arg_v argval[MAXARGS]; + arg_v argval[MAXARGS + MOREARGS]; int nargs; }; diff --git a/ntpdc/ntpdc_ops.c b/ntpdc/ntpdc_ops.c index 9fa3bd738aadc..e40016b901cde 100644 --- a/ntpdc/ntpdc_ops.c +++ b/ntpdc/ntpdc_ops.c @@ -18,7 +18,6 @@ #ifdef HAVE_SYS_TIMEX_H # include <sys/timex.h> #endif -#include <netdb.h> #if !defined(__bsdi__) && !defined(apollo) #include <netinet/in.h> #endif @@ -79,6 +78,8 @@ 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 *)); /* * Commands we understand. Ntpdc imports this. @@ -93,10 +94,10 @@ struct xcmd opcmds[] = { { "dmpeers", dmpeers, { OPT|IP_VERSION, NO, NO, NO }, { "-4|-6", "", "", "" }, "display peer summary info the way Dave Mills likes it (IP Version)" }, - { "showpeer", showpeer, { ADD, OPT|ADD, OPT|ADD, OPT|ADD}, + { "showpeer", showpeer, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD}, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "display detailed information for one or more peers" }, - { "pstats", peerstats, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "pstats", peerstats, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "display statistical information for one or more peers" }, { "loopinfo", loopinfo, { OPT|NTP_STR, NO, NO, NO }, @@ -117,19 +118,19 @@ struct xcmd opcmds[] = { { "timerstats", timerstats, { NO, NO, NO, NO }, { "", "", "", "" }, "display event timer subsystem statistics" }, - { "addpeer", addpeer, { ADD, OPT|UINT, OPT|UINT, OPT|NTP_STR }, - { "addr", "keyid", "version", "minpoll|prefer" }, + { "addpeer", addpeer, { NTP_ADD, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR }, + { "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." }, "configure a new peer association" }, - { "addserver", addserver, { ADD, OPT|UINT, OPT|UINT, OPT|NTP_STR }, - { "addr", "keyid", "version", "minpoll|prefer" }, + { "addserver", addserver, { NTP_ADD, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR }, + { "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." }, "configure a new server" }, - { "addrefclock",addrefclock, { ADD, OPT|UINT, OPT|NTP_STR, OPT|NTP_STR }, + { "addrefclock",addrefclock, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_STR, OPT|NTP_STR }, { "addr", "mode", "minpoll|prefer", "minpoll|prefer" }, "configure a new server" }, - { "broadcast", broadcast, { ADD, OPT|UINT, OPT|UINT, OPT|NTP_STR }, + { "broadcast", broadcast, { NTP_ADD, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR }, { "addr", "keyid", "version", "minpoll" }, "configure broadcasting time service" }, - { "unconfig", unconfig, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "unconfig", unconfig, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "unconfigure existing peer assocations" }, { "enable", set, { NTP_STR, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR }, @@ -141,35 +142,35 @@ struct xcmd opcmds[] = { { "reslist", reslist, {OPT|IP_VERSION, NO, NO, NO }, { "-4|-6", "", "", "" }, "display the server's restrict list" }, - { "restrict", new_restrict, { ADD, ADD, NTP_STR, OPT|NTP_STR }, + { "restrict", new_restrict, { NTP_ADD, NTP_ADD, NTP_STR, OPT|NTP_STR }, { "address", "mask", "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod", "..." }, "create restrict entry/add flags to entry" }, - { "unrestrict", unrestrict, { ADD, ADD, NTP_STR, OPT|NTP_STR }, + { "unrestrict", unrestrict, { NTP_ADD, NTP_ADD, NTP_STR, OPT|NTP_STR }, { "address", "mask", "ntpport|ignore|noserve|notrust|noquery|nomodify|nopeer|version|kod", "..." }, "remove flags from a restrict entry" }, - { "delrestrict", delrestrict, { ADD, ADD, OPT|NTP_STR, NO }, + { "delrestrict", delrestrict, { NTP_ADD, NTP_ADD, OPT|NTP_STR, NO }, { "address", "mask", "ntpport", "" }, "delete a restrict entry" }, - { "monlist", monlist, { OPT|INT, NO, NO, NO }, + { "monlist", monlist, { OPT|NTP_INT, NO, NO, NO }, { "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", "...", "...", "..." }, "reset various subsystem statistics counters" }, - { "preset", preset, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "preset", preset, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "peer_address", "peer2_addr", "peer3_addr", "peer4_addr" }, "reset stat counters associated with particular peer(s)" }, { "readkeys", readkeys, { NO, NO, NO, NO }, { "", "", "", "" }, "request a reread of the keys file and re-init of system keys" }, - { "trustedkey", trustkey, { UINT, OPT|UINT, OPT|UINT, OPT|UINT }, + { "trustedkey", trustkey, { NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT }, { "keyid", "keyid", "keyid", "keyid" }, "add one or more key ID's to the trusted list" }, - { "untrustedkey", untrustkey, { UINT, OPT|UINT, OPT|UINT, OPT|UINT }, + { "untrustedkey", untrustkey, { NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT, OPT|NTP_UINT }, { "keyid", "keyid", "keyid", "keyid" }, "remove one or more key ID's from the trusted list" }, { "authinfo", authinfo, { NO, NO, NO, NO }, @@ -178,34 +179,39 @@ struct xcmd opcmds[] = { { "traps", traps, { NO, NO, NO, NO }, { "", "", "", "" }, "display the traps set in the server" }, - { "addtrap", addtrap, { ADD, OPT|UINT, OPT|ADD, NO }, + { "addtrap", addtrap, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_ADD, NO }, { "address", "port", "interface", "" }, "configure a trap in the server" }, - { "clrtrap", clrtrap, { ADD, OPT|UINT, OPT|ADD, NO }, + { "clrtrap", clrtrap, { NTP_ADD, OPT|NTP_UINT, OPT|NTP_ADD, NO }, { "address", "port", "interface", "" }, "remove a trap (configured or otherwise) from the server" }, - { "requestkey", requestkey, { UINT, NO, NO, NO }, + { "requestkey", requestkey, { NTP_UINT, NO, NO, NO }, { "keyid", "", "", "" }, "change the keyid the server uses to authenticate requests" }, - { "controlkey", controlkey, { UINT, NO, NO, NO }, + { "controlkey", controlkey, { NTP_UINT, NO, NO, NO }, { "keyid", "", "", "" }, "change the keyid the server uses to authenticate control messages" }, { "ctlstats", ctlstats, { NO, NO, NO, NO }, { "", "", "", "" }, "display packet count statistics from the control module" }, - { "clockstat", clockstat, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "clockstat", clockstat, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "address", "address", "address", "address" }, "display clock status information" }, - { "fudge", fudge, { ADD, NTP_STR, NTP_STR, NO }, + { "fudge", fudge, { NTP_ADD, NTP_STR, NTP_STR, NO }, { "address", "time1|time2|val1|val2|flags", "value", "" }, "set/change one of a clock's fudge factors" }, - { "clkbug", clkbug, { ADD, OPT|ADD, OPT|ADD, OPT|ADD }, + { "clkbug", clkbug, { NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD, OPT|NTP_ADD }, { "address", "address", "address", "address" }, "display clock debugging information" }, { "kerninfo", kerninfo, { NO, NO, NO, NO }, { "", "", "", "" }, "display the kernel pll/pps variables" }, - + { "ifstats", get_if_stats, { NO, NO, NO, NO }, + { "", "", "", "" }, + "list interface statistics" }, + { "ifreload", do_if_reload, { NO, NO, NO, NO }, + { "", "", "", "" }, + "reload interface configuration" }, { 0, 0, { NO, NO, NO, NO }, { "", "", "", "" }, "" } }; @@ -301,7 +307,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -391,7 +397,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -483,6 +489,52 @@ refid_string( return numtoa(refid); } +static void +print_pflag( + FILE *fp, + u_int32 flags + ) +{ + const char *str; + + 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"); + } +} /* * printpeer - print detail information for a peer */ @@ -493,7 +545,6 @@ printpeer( ) { register int i; - const char *str; l_fp tempts; struct sockaddr_storage srcadr, dstadr; @@ -539,39 +590,7 @@ printpeer( fptoa(NTOHS_FP(pp->estbdelay), 5), pp->ttl); (void) fprintf(fp, "timer %lds, flags", (long)ntohl(pp->timer)); - if (pp->flags == 0) { - (void) fprintf(fp, " none\n"); - } else { - str = ""; - if (pp->flags & INFO_FLAG_SYSPEER) { - (void) fprintf(fp, " system_peer"); - str = ","; - } - if (pp->flags & INFO_FLAG_CONFIG) { - (void) fprintf(fp, "%s config", str); - str = ","; - } - if (pp->flags & INFO_FLAG_REFCLOCK) { - (void) fprintf(fp, "%s refclock", str); - str = ","; - } - if (pp->flags & INFO_FLAG_AUTHENABLE) { - (void) fprintf(fp, "%s auth", str); - str = ","; - } - if (pp->flags & INFO_FLAG_BCLIENT) { - (void) fprintf(fp, "%s bclient", str); - str = ","; - } - if (pp->flags & INFO_FLAG_PREFER) { - (void) fprintf(fp, "%s prefer", str); - str = ","; - } - if (pp->flags & INFO_FLAG_BURST) { - (void) fprintf(fp, "%s burst", str); - } - (void) fprintf(fp, "\n"); - } + print_pflag(fp, pp->flags); NTOHL_FP(&pp->reftime, &tempts); (void) fprintf(fp, "reference time: %s\n", @@ -674,7 +693,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -748,7 +767,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -804,7 +823,9 @@ again: (int)pp->candidate); if (items > 0) (void) fprintf(fp, "\n"); - pp++; + (void) fprintf(fp, "flags: "); + print_pflag(fp, ntohs(pp->flags)); + pp++; } } @@ -846,7 +867,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -865,8 +886,8 @@ again: "offset %s, frequency %s, time_const %ld, watchdog %ld\n", lfptoa(&tempts, 6), lfptoa(&temp2ts, 3), - (u_long)ntohl(il->compliance), - (u_long)ntohl(il->watchdog_timer)); + (long)(int32_t)ntohl((u_long)il->compliance), + (u_long)ntohl((u_long)il->watchdog_timer)); } else { NTOHL_FP(&il->last_offset, &tempts); (void) fprintf(fp, "offset: %s s\n", @@ -875,7 +896,7 @@ again: (void) fprintf(fp, "frequency: %s ppm\n", lfptoa(&tempts, 3)); (void) fprintf(fp, "poll adjust: %ld\n", - (u_long)ntohl(il->compliance)); + (long)(int32_t)ntohl(il->compliance)); (void) fprintf(fp, "watchdog timer: %ld s\n", (u_long)ntohl(il->watchdog_timer)); } @@ -909,7 +930,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -1006,7 +1027,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -1072,7 +1093,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -1134,7 +1155,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -1157,9 +1178,9 @@ again: (u_long)ntohl(mem->demobilizations)); (void) fprintf(fp, "hash table counts: "); - for (i = 0; i < HASH_SIZE; i++) { + for (i = 0; i < NTP_HASH_SIZE; i++) { (void) fprintf(fp, "%4d", (int)mem->hashcount[i]); - if ((i % 8) == 7 && i != (HASH_SIZE-1)) { + if ((i % 8) == 7 && i != (NTP_HASH_SIZE-1)) { (void) fprintf(fp, "\n "); } } @@ -1193,7 +1214,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -1281,78 +1302,108 @@ doconfig( u_long keyid; u_int version; u_char minpoll; + u_char maxpoll; u_int flags; u_char cmode; int res; int sendsize; + int numtyp; again: keyid = 0; - version = NTP_OLDVERSION + 1; + version = 3; flags = 0; res = 0; cmode = 0; minpoll = NTP_MINDPOLL; + maxpoll = NTP_MAXDPOLL; + numtyp = 1; + if (refc) + numtyp = 5; if (impl_ver == IMPL_XNTPD) sendsize = sizeof(struct conf_peer); else sendsize = v4sizeof(struct conf_peer); - items = pcmd->nargs; - - if (refc) { - if (pcmd->nargs > 1) { - cmode = (u_char) pcmd->argval[1].uval; - items = 2; - } - } else { - if (pcmd->nargs > 1) { - keyid = pcmd->argval[1].uval; - if (keyid > 0) { - flags |= CONF_FLAG_AUTHENABLE; - } - if (pcmd->nargs > 2) { - version = (u_int)pcmd->argval[2].uval; - if (version > NTP_VERSION || - version < NTP_OLDVERSION) { - (void)fprintf(fp, - "invalid version number %u\n", - version); - res++; - } - items = 3; - } - } - } - + items = 1; while (pcmd->nargs > items) { if (STREQ(pcmd->argval[items].string, "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"); + else if (STREQ(pcmd->argval[items].string, "iburst")) + flags |= CONF_FLAG_IBURST; + else if (!refc && STREQ(pcmd->argval[items].string, "keyid")) + numtyp = 1; + else if (!refc && STREQ(pcmd->argval[items].string, "version")) + numtyp = 2; + else if (STREQ(pcmd->argval[items].string, "minpoll")) + numtyp = 3; + else if (STREQ(pcmd->argval[items].string, "maxpoll")) + numtyp = 4; else { long val; - if (!atoint(pcmd->argval[items].string, &val)) { - (void) fprintf(fp, - "%s not understood\n", - pcmd->argval[items].string); - res++; - break; - } else { - if (val >= NTP_MINPOLL && val <= NTP_MAXPOLL) { - minpoll = (u_char)val; - } else { - (void) fprintf(fp, - "minpol must be within %d..%d\n", - NTP_MINPOLL, NTP_MAXPOLL); - res++; - break; - } + if (!atoint(pcmd->argval[items].string, &val)) + numtyp = 0; + switch (numtyp) { + case 1: + keyid = val; + numtyp = 2; + break; + + case 2: + version = (u_int) val; + numtyp = 0; + break; + + case 3: + minpoll = (u_char)val; + numtyp = 0; + break; + + case 4: + maxpoll = (u_char)val; + numtyp = 0; + break; + + case 5: + cmode = (u_char)val; + numtyp = 0; + break; + + default: + (void) fprintf(fp, "*** '%s' not understood\n", + pcmd->argval[items].string); + res++; + numtyp = 0; } - } - items++; - } + if (val < 0) { + (void) fprintf(stderr, + "***Value '%s' should be unsigned\n", + pcmd->argval[items].string); + res++; + } + } + 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++; + } + 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++; + } if (res) return; @@ -1376,7 +1427,7 @@ again: cpeer.keyid = keyid; cpeer.version = (u_char) version; cpeer.minpoll = minpoll; - cpeer.maxpoll = NTP_MAXDPOLL; + cpeer.maxpoll = maxpoll; cpeer.flags = (u_char)flags; cpeer.ttl = cmode; @@ -1528,6 +1579,7 @@ doset( } } + sys.flags = htonl(sys.flags); if (res || sys.flags == 0) return; @@ -1554,7 +1606,22 @@ struct resflags { int bit; }; -static struct resflags resflags[] = { +/* XXX: HMS: we apparently don't report set bits we do not recognize. */ + +static struct resflags resflagsV2[] = { + { "ignore", 0x001 }, + { "noserve", 0x002 }, + { "notrust", 0x004 }, + { "noquery", 0x008 }, + { "nomodify", 0x010 }, + { "nopeer", 0x020 }, + { "notrap", 0x040 }, + { "lptrap", 0x080 }, + { "limited", 0x100 }, + { "", 0 } +}; + +static struct resflags resflagsV3[] = { { "ignore", RES_IGNORE }, { "noserve", RES_DONTSERVE }, { "notrust", RES_DONTTRUST }, @@ -1614,7 +1681,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -1677,7 +1744,10 @@ again: rf++; } - rf = &resflags[0]; + rf = (impl_ver == IMPL_XNTPD_OLD) + ? &resflagsV2[0] + : &resflagsV3[0] + ; while (rf->bit != 0) { if (flags & rf->bit) { if (!res) @@ -1795,17 +1865,17 @@ again: if (STREQ(pcmd->argval[res].string, "ntpport")) { cres.mflags |= RESM_NTPONLY; } else { - for (i = 0; resflags[i].bit != 0; i++) { + for (i = 0; resflagsV3[i].bit != 0; i++) { if (STREQ(pcmd->argval[res].string, - resflags[i].str)) + resflagsV3[i].str)) break; } - if (resflags[i].bit != 0) { - cres.flags |= resflags[i].bit; + if (resflagsV3[i].bit != 0) { + cres.flags |= resflagsV3[i].bit; if (req_code == REQ_UNRESTRICT) { (void) fprintf(fp, "Flag %s inappropriate\n", - resflags[i].str); + resflagsV3[i].str); err++; } } else { @@ -1815,6 +1885,8 @@ again: } } } + cres.flags = htons(cres.flags); + cres.mflags = htons(cres.mflags); /* * Make sure mask for default address is zero. Otherwise, @@ -1899,7 +1971,7 @@ again: &items, &itemsize, &struct_star, 0, sizeof(struct info_monitor)); - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -2068,6 +2140,7 @@ reset( rflags.flags |= sreset[i].flag; } } + rflags.flags = htonl(rflags.flags); if (err) { (void) fprintf(fp, "Not done due to errors\n"); @@ -2268,7 +2341,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -2326,7 +2399,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -2567,7 +2640,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) @@ -2627,7 +2700,6 @@ clockstat( int res; l_fp ts; struct clktype *clk; - u_long ltemp; for (qitems = 0; qitems < min(pcmd->nargs, 8); qitems++) clist[qitems] = GET_INADDR(pcmd->argval[qitems].netnum); @@ -2642,7 +2714,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -2685,9 +2757,8 @@ again: lfptoa(&ts, 6)); (void) fprintf(fp, "stratum: %ld\n", (u_long)ntohl(cl->fudgeval1)); - ltemp = ntohl(cl->fudgeval2); (void) fprintf(fp, "reference ID: %s\n", - (char *)<emp); + refid_string(ntohl(cl->fudgeval2), 0)); (void) fprintf(fp, "fudge flags: 0x%x\n", cl->flags); @@ -2815,7 +2886,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!checkitems(items, fp)) @@ -2903,7 +2974,7 @@ again: goto again; } - if (res != 0 && items == 0) + if (res != 0) return; if (!check1item(items, fp)) return; @@ -2919,7 +2990,7 @@ again: tscale = 1e-9; #endif (void)fprintf(fp, "pll offset: %g s\n", - (long)ntohl(ik->offset) * tscale); + (int32_t)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", @@ -3010,3 +3081,124 @@ again: (void)fprintf(fp, "calibration errors: %ld\n", (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_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" + +static void +iflist( + FILE *fp, + struct info_if_stats *ifs, + int items, + int itemsize, + int res + ) +{ + static char *actions = "?.+-"; + struct sockaddr_storage saddr; + + if (res != 0) + return; + + if (!checkitems(items, fp)) + return; + + if (!checkitemsize(itemsize, sizeof(struct info_if_stats))) + return; + + fprintf(fp, IF_LIST_FMT_STR, IF_LIST_LABELS); + 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 + 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 + 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 + fprintf(fp, IF_LIST_AFMT_STR, stoa(&saddr), 'B'); + + } + + ifs++; + items--; + } +} + +/*ARGSUSED*/ +static void +get_if_stats( + struct parse *pcmd, + FILE *fp + ) +{ + struct info_if_stats *ifs; + int items; + int itemsize; + int res; + + res = doquery(impl_ver, REQ_IF_STATS, 1, 0, 0, (char *)NULL, &items, + &itemsize, (void *)&ifs, 0, + sizeof(struct info_if_stats)); + iflist(fp, ifs, items, itemsize, res); +} + +/*ARGSUSED*/ +static void +do_if_reload( + struct parse *pcmd, + FILE *fp + ) +{ + struct info_if_stats *ifs; + int items; + int itemsize; + int res; + + res = doquery(impl_ver, REQ_IF_RELOAD, 1, 0, 0, (char *)NULL, &items, + &itemsize, (void *)&ifs, 0, + sizeof(struct info_if_stats)); + iflist(fp, ifs, items, itemsize, res); +} |