diff options
Diffstat (limited to 'contrib/ntp/libntp')
29 files changed, 1011 insertions, 468 deletions
diff --git a/contrib/ntp/libntp/Makefile.am b/contrib/ntp/libntp/Makefile.am index c984c89..654981b 100644 --- a/contrib/ntp/libntp/Makefile.am +++ b/contrib/ntp/libntp/Makefile.am @@ -13,9 +13,11 @@ libntp_a_SOURCES = a_md5encrypt.c adjtime.c atoint.c atolfp.c atouint.c \ tstotv.c tvtoa.c tvtots.c uglydate.c uinttoa.c utvtoa.c ymd2yd.c \ mfp_mul.c binio.c ieee754io.c gpstolfp.c recvbuff.c iosignal.c \ icom.c audio.c +EXTRA_libntp_a_SOURCES = adjtimex.c log.c mktime.c random.c snprintf.c \ + strdup.c strerror.c libntp_a_LIBADD = @LIBOBJS@ libntp_a_DEPENDENCIES = @LIBOBJS@ -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref ETAGS_ARGS = Makefile.am noinst_HEADERS = lib_strbuf.h log.h @@ -23,7 +25,7 @@ noinst_HEADERS = lib_strbuf.h log.h ../include/des.h: touch ../include/des.h -EXTRA_DIST = README $(HEADERS) adjtimex.c log.c strerror.c mktime.c +EXTRA_DIST = README #mktime_.c: mktime.c $(ANSI2KNR) # $(ANSI2KNR) $< mktime_.c diff --git a/contrib/ntp/libntp/Makefile.in b/contrib/ntp/libntp/Makefile.in index c89e8f9..d88ab32 100644 --- a/contrib/ntp/libntp/Makefile.in +++ b/contrib/ntp/libntp/Makefile.in @@ -1,6 +1,7 @@ -# Makefile.in generated automatically by automake 1.4a from Makefile.am +# Makefile.in generated automatically by automake 1.4e from Makefile.am. -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# 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. @@ -31,8 +32,6 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -48,7 +47,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_FLAG = +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : @@ -57,24 +56,30 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ + +@SET_MAKE@ AMDEP = @AMDEP@ AMTAR = @AMTAR@ +AUTOKEY = @AUTOKEY@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CHUTEST = @CHUTEST@ CLKTEST = @CLKTEST@ CPP = @CPP@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ DCFD = @DCFD@ DEPDIR = @DEPDIR@ +EF_LIBS = @EF_LIBS@ +EF_PROGS = @EF_PROGS@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_STRIP_PROGRAM_ENV = @INSTALL_STRIP_PROGRAM_ENV@ LDFLAGS = @LDFLAGS@ LIBPARSE = @LIBPARSE@ LIBRSAREF = @LIBRSAREF@ @@ -86,16 +91,27 @@ MAKE_LIBPARSE = @MAKE_LIBPARSE@ MAKE_LIBPARSE_KERNEL = @MAKE_LIBPARSE_KERNEL@ MAKE_LIBRSAREF = @MAKE_LIBRSAREF@ MAKE_NTPTIME = @MAKE_NTPTIME@ +MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@ MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@ MAKE_TICKADJ = @MAKE_TICKADJ@ +MAKE_TIMETRIM = @MAKE_TIMETRIM@ +OPENSSL = @OPENSSL@ +OPENSSL_INC = @OPENSSL_INC@ +OPENSSL_LIB = @OPENSSL_LIB@ PACKAGE = @PACKAGE@ +PATH_PERL = @PATH_PERL@ PATH_SH = @PATH_SH@ PROPDELAY = @PROPDELAY@ RANLIB = @RANLIB@ +RSADIR = @RSADIR@ +RSAOBJS = @RSAOBJS@ RSAREF = @RSAREF@ +RSASRCS = @RSASRCS@ +STRIP = @STRIP@ TESTDCF = @TESTDCF@ U = @U@ VERSION = @VERSION@ +_am_include = @_am_include@ install_sh = @install_sh@ #AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies @@ -116,128 +132,137 @@ libntp_a_SOURCES = a_md5encrypt.c adjtime.c atoint.c atolfp.c atouint.c \ mfp_mul.c binio.c ieee754io.c gpstolfp.c recvbuff.c iosignal.c \ icom.c audio.c +EXTRA_libntp_a_SOURCES = adjtimex.c log.c mktime.c random.c snprintf.c \ + strdup.c strerror.c + libntp_a_LIBADD = @LIBOBJS@ libntp_a_DEPENDENCIES = @LIBOBJS@ -INCLUDES = -I$(top_srcdir)/include +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/librsaref ETAGS_ARGS = Makefile.am noinst_HEADERS = lib_strbuf.h log.h -EXTRA_DIST = README $(HEADERS) adjtimex.c log.c strerror.c mktime.c +EXTRA_DIST = README +EXEEXT = +OBJEXT = o subdir = libntp mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ ANSI2KNR = ../util/ansi2knr libntp_a_AR = $(AR) cru -am_libntp_a_OBJECTS = a_md5encrypt$U.o adjtime$U.o atoint$U.o \ -atolfp$U.o atouint$U.o authencrypt$U.o authkeys$U.o authparity$U.o \ -authreadkeys$U.o authusekey$U.o buftvtots$U.o caljulian$U.o \ -calleapwhen$U.o caltontp$U.o calyearstart$U.o clocktime$U.o \ -clocktypes$U.o decodenetnum$U.o dofptoa$U.o dolfptoa$U.o emalloc$U.o \ -findconfig$U.o fptoa$U.o fptoms$U.o getopt$U.o hextoint$U.o \ -hextolfp$U.o humandate$U.o inttoa$U.o lib_strbuf$U.o machines$U.o \ -md5c$U.o memmove$U.o mfptoa$U.o mfptoms$U.o modetoa$U.o mstolfp$U.o \ -msutotsf$U.o msyslog$U.o netof$U.o numtoa$U.o numtohost$U.o \ -octtoint$U.o prettydate$U.o ranny$U.o refnumtoa$U.o statestr$U.o \ -syssignal$U.o systime$U.o tsftomsu$U.o tstotv$U.o tvtoa$U.o tvtots$U.o \ -uglydate$U.o uinttoa$U.o utvtoa$U.o ymd2yd$U.o mfp_mul$U.o binio$U.o \ -ieee754io$U.o gpstolfp$U.o recvbuff$U.o iosignal$U.o icom$U.o audio$U.o -libntp_a_OBJECTS = $(am_libntp_a_OBJECTS) +am_libntp_a_OBJECTS = a_md5encrypt$U.$(OBJEXT) adjtime$U.$(OBJEXT) \ +atoint$U.$(OBJEXT) atolfp$U.$(OBJEXT) atouint$U.$(OBJEXT) \ +authencrypt$U.$(OBJEXT) authkeys$U.$(OBJEXT) authparity$U.$(OBJEXT) \ +authreadkeys$U.$(OBJEXT) authusekey$U.$(OBJEXT) buftvtots$U.$(OBJEXT) \ +caljulian$U.$(OBJEXT) calleapwhen$U.$(OBJEXT) caltontp$U.$(OBJEXT) \ +calyearstart$U.$(OBJEXT) clocktime$U.$(OBJEXT) clocktypes$U.$(OBJEXT) \ +decodenetnum$U.$(OBJEXT) dofptoa$U.$(OBJEXT) dolfptoa$U.$(OBJEXT) \ +emalloc$U.$(OBJEXT) findconfig$U.$(OBJEXT) fptoa$U.$(OBJEXT) \ +fptoms$U.$(OBJEXT) getopt$U.$(OBJEXT) hextoint$U.$(OBJEXT) \ +hextolfp$U.$(OBJEXT) humandate$U.$(OBJEXT) inttoa$U.$(OBJEXT) \ +lib_strbuf$U.$(OBJEXT) machines$U.$(OBJEXT) md5c$U.$(OBJEXT) \ +memmove$U.$(OBJEXT) mfptoa$U.$(OBJEXT) mfptoms$U.$(OBJEXT) \ +modetoa$U.$(OBJEXT) mstolfp$U.$(OBJEXT) msutotsf$U.$(OBJEXT) \ +msyslog$U.$(OBJEXT) netof$U.$(OBJEXT) numtoa$U.$(OBJEXT) \ +numtohost$U.$(OBJEXT) octtoint$U.$(OBJEXT) prettydate$U.$(OBJEXT) \ +ranny$U.$(OBJEXT) refnumtoa$U.$(OBJEXT) statestr$U.$(OBJEXT) \ +syssignal$U.$(OBJEXT) systime$U.$(OBJEXT) tsftomsu$U.$(OBJEXT) \ +tstotv$U.$(OBJEXT) tvtoa$U.$(OBJEXT) tvtots$U.$(OBJEXT) \ +uglydate$U.$(OBJEXT) uinttoa$U.$(OBJEXT) utvtoa$U.$(OBJEXT) \ +ymd2yd$U.$(OBJEXT) mfp_mul$U.$(OBJEXT) binio$U.$(OBJEXT) \ +ieee754io$U.$(OBJEXT) gpstolfp$U.$(OBJEXT) recvbuff$U.$(OBJEXT) \ +iosignal$U.$(OBJEXT) icom$U.$(OBJEXT) audio$U.$(OBJEXT) +libntp_a_OBJECTS = $(am_libntp_a_OBJECTS) AR = ar COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libntp_a_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in mktime.c \ -strerror.c - +DIST_SOURCES = $(libntp_a_SOURCES) $(EXTRA_libntp_a_SOURCES) +HEADERS = $(noinst_HEADERS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -GZIP_ENV = --best depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/a_md5encrypt$U.Po $(DEPDIR)/adjtime$U.Po \ -$(DEPDIR)/atoint$U.Po $(DEPDIR)/atolfp$U.Po $(DEPDIR)/atouint$U.Po \ -$(DEPDIR)/audio$U.Po $(DEPDIR)/authencrypt$U.Po $(DEPDIR)/authkeys$U.Po \ -$(DEPDIR)/authparity$U.Po $(DEPDIR)/authreadkeys$U.Po \ -$(DEPDIR)/authusekey$U.Po $(DEPDIR)/binio$U.Po $(DEPDIR)/buftvtots$U.Po \ -$(DEPDIR)/caljulian$U.Po $(DEPDIR)/calleapwhen$U.Po \ -$(DEPDIR)/caltontp$U.Po $(DEPDIR)/calyearstart$U.Po \ -$(DEPDIR)/clocktime$U.Po $(DEPDIR)/clocktypes$U.Po \ -$(DEPDIR)/decodenetnum$U.Po $(DEPDIR)/dofptoa$U.Po \ -$(DEPDIR)/dolfptoa$U.Po $(DEPDIR)/emalloc$U.Po \ -$(DEPDIR)/findconfig$U.Po $(DEPDIR)/fptoa$U.Po $(DEPDIR)/fptoms$U.Po \ -$(DEPDIR)/getopt$U.Po $(DEPDIR)/gpstolfp$U.Po $(DEPDIR)/hextoint$U.Po \ -$(DEPDIR)/hextolfp$U.Po $(DEPDIR)/humandate$U.Po $(DEPDIR)/icom$U.Po \ -$(DEPDIR)/ieee754io$U.Po $(DEPDIR)/inttoa$U.Po $(DEPDIR)/iosignal$U.Po \ -$(DEPDIR)/lib_strbuf$U.Po $(DEPDIR)/machines$U.Po $(DEPDIR)/md5c$U.Po \ -$(DEPDIR)/memmove$U.Po $(DEPDIR)/mfp_mul$U.Po $(DEPDIR)/mfptoa$U.Po \ -$(DEPDIR)/mfptoms$U.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modetoa$U.Po \ -$(DEPDIR)/mstolfp$U.Po $(DEPDIR)/msutotsf$U.Po $(DEPDIR)/msyslog$U.Po \ -$(DEPDIR)/netof$U.Po $(DEPDIR)/numtoa$U.Po $(DEPDIR)/numtohost$U.Po \ -$(DEPDIR)/octtoint$U.Po $(DEPDIR)/prettydate$U.Po $(DEPDIR)/ranny$U.Po \ -$(DEPDIR)/recvbuff$U.Po $(DEPDIR)/refnumtoa$U.Po \ -$(DEPDIR)/statestr$U.Po $(DEPDIR)/strerror.Po $(DEPDIR)/syssignal$U.Po \ -$(DEPDIR)/systime$U.Po $(DEPDIR)/tsftomsu$U.Po $(DEPDIR)/tstotv$U.Po \ -$(DEPDIR)/tvtoa$U.Po $(DEPDIR)/tvtots$U.Po $(DEPDIR)/uglydate$U.Po \ -$(DEPDIR)/uinttoa$U.Po $(DEPDIR)/utvtoa$U.Po $(DEPDIR)/ymd2yd$U.Po -SOURCES = $(libntp_a_SOURCES) +@AMDEP@DEP_FILES = $(DEPDIR)/*.Po $(DEPDIR)/a_md5encrypt$U.Po \ +@AMDEP@ $(DEPDIR)/adjtime$U.Po $(DEPDIR)/adjtimex$U.Po \ +@AMDEP@ $(DEPDIR)/atoint$U.Po $(DEPDIR)/atolfp$U.Po \ +@AMDEP@ $(DEPDIR)/atouint$U.Po $(DEPDIR)/audio$U.Po \ +@AMDEP@ $(DEPDIR)/authencrypt$U.Po $(DEPDIR)/authkeys$U.Po \ +@AMDEP@ $(DEPDIR)/authparity$U.Po $(DEPDIR)/authreadkeys$U.Po \ +@AMDEP@ $(DEPDIR)/authusekey$U.Po $(DEPDIR)/binio$U.Po \ +@AMDEP@ $(DEPDIR)/buftvtots$U.Po $(DEPDIR)/caljulian$U.Po \ +@AMDEP@ $(DEPDIR)/calleapwhen$U.Po $(DEPDIR)/caltontp$U.Po \ +@AMDEP@ $(DEPDIR)/calyearstart$U.Po $(DEPDIR)/clocktime$U.Po \ +@AMDEP@ $(DEPDIR)/clocktypes$U.Po $(DEPDIR)/decodenetnum$U.Po \ +@AMDEP@ $(DEPDIR)/dofptoa$U.Po $(DEPDIR)/dolfptoa$U.Po \ +@AMDEP@ $(DEPDIR)/emalloc$U.Po $(DEPDIR)/findconfig$U.Po \ +@AMDEP@ $(DEPDIR)/fptoa$U.Po $(DEPDIR)/fptoms$U.Po $(DEPDIR)/getopt$U.Po \ +@AMDEP@ $(DEPDIR)/gpstolfp$U.Po $(DEPDIR)/hextoint$U.Po \ +@AMDEP@ $(DEPDIR)/hextolfp$U.Po $(DEPDIR)/humandate$U.Po \ +@AMDEP@ $(DEPDIR)/icom$U.Po $(DEPDIR)/ieee754io$U.Po \ +@AMDEP@ $(DEPDIR)/inttoa$U.Po $(DEPDIR)/iosignal$U.Po \ +@AMDEP@ $(DEPDIR)/lib_strbuf$U.Po $(DEPDIR)/log$U.Po \ +@AMDEP@ $(DEPDIR)/machines$U.Po $(DEPDIR)/md5c$U.Po \ +@AMDEP@ $(DEPDIR)/memmove$U.Po $(DEPDIR)/mfp_mul$U.Po \ +@AMDEP@ $(DEPDIR)/mfptoa$U.Po $(DEPDIR)/mfptoms$U.Po \ +@AMDEP@ $(DEPDIR)/mktime$U.Po $(DEPDIR)/mktime.Po $(DEPDIR)/modetoa$U.Po \ +@AMDEP@ $(DEPDIR)/mstolfp$U.Po $(DEPDIR)/msutotsf$U.Po \ +@AMDEP@ $(DEPDIR)/msyslog$U.Po $(DEPDIR)/netof$U.Po \ +@AMDEP@ $(DEPDIR)/numtoa$U.Po $(DEPDIR)/numtohost$U.Po \ +@AMDEP@ $(DEPDIR)/octtoint$U.Po $(DEPDIR)/prettydate$U.Po \ +@AMDEP@ $(DEPDIR)/random$U.Po $(DEPDIR)/ranny$U.Po \ +@AMDEP@ $(DEPDIR)/recvbuff$U.Po $(DEPDIR)/refnumtoa$U.Po \ +@AMDEP@ $(DEPDIR)/snprintf$U.Po $(DEPDIR)/snprintf.Po \ +@AMDEP@ $(DEPDIR)/statestr$U.Po $(DEPDIR)/strdup$U.Po \ +@AMDEP@ $(DEPDIR)/strdup.Po $(DEPDIR)/strerror$U.Po \ +@AMDEP@ $(DEPDIR)/strerror.Po $(DEPDIR)/syssignal$U.Po \ +@AMDEP@ $(DEPDIR)/systime$U.Po $(DEPDIR)/tsftomsu$U.Po \ +@AMDEP@ $(DEPDIR)/tstotv$U.Po $(DEPDIR)/tvtoa$U.Po $(DEPDIR)/tvtots$U.Po \ +@AMDEP@ $(DEPDIR)/uglydate$U.Po $(DEPDIR)/uinttoa$U.Po \ +@AMDEP@ $(DEPDIR)/utvtoa$U.Po $(DEPDIR)/ymd2yd$U.Po +DIST_COMMON = README $(noinst_HEADERS) Makefile.am Makefile.in mktime.c \ +snprintf.c strdup.c strerror.c + +SOURCES = $(libntp_a_SOURCES) $(EXTRA_libntp_a_SOURCES) OBJECTS = $(am_libntp_a_OBJECTS) -all: all-redirect -.SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu libntp/Makefile +all: all-am -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libntp/Makefile -mostlyclean-noinstLIBRARIES: +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -distclean-noinstLIBRARIES: - -maintainer-clean-noinstLIBRARIES: - mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c - -maintainer-clean-compile: -../util/ansi2knr: ../util/ansi2knr.o +../util/ansi2knr: ../util/ansi2knr.$(OBJEXT) cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr -../util/ansi2knr.o: - cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.o +../util/ansi2knr.$(OBJEXT): + cd ../util && $(MAKE) $(AM_MAKEFLAGS) ansi2knr.$(OBJEXT) mostlyclean-kr: -rm -f *_.c -clean-kr: - -distclean-kr: - -maintainer-clean-kr: - libntp.a: $(libntp_a_OBJECTS) $(libntp_a_DEPENDENCIES) -rm -f libntp.a $(libntp_a_AR) libntp.a $(libntp_a_OBJECTS) $(libntp_a_LIBADD) @@ -246,6 +271,8 @@ a_md5encrypt_.c: a_md5encrypt.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/a_md5encrypt.c; then echo $(srcdir)/a_md5encrypt.c; else echo a_md5encrypt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > a_md5encrypt_.c adjtime_.c: adjtime.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/adjtime.c; then echo $(srcdir)/adjtime.c; else echo adjtime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > adjtime_.c +adjtimex_.c: adjtimex.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/adjtimex.c; then echo $(srcdir)/adjtimex.c; else echo adjtimex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > adjtimex_.c atoint_.c: atoint.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/atoint.c; then echo $(srcdir)/atoint.c; else echo atoint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > atoint_.c atolfp_.c: atolfp.c $(ANSI2KNR) @@ -314,6 +341,8 @@ iosignal_.c: iosignal.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iosignal.c; then echo $(srcdir)/iosignal.c; else echo iosignal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > iosignal_.c lib_strbuf_.c: lib_strbuf.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lib_strbuf.c; then echo $(srcdir)/lib_strbuf.c; else echo lib_strbuf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lib_strbuf_.c +log_.c: log.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/log.c; then echo $(srcdir)/log.c; else echo log.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > log_.c machines_.c: machines.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/machines.c; then echo $(srcdir)/machines.c; else echo machines.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > machines_.c md5c_.c: md5c.c $(ANSI2KNR) @@ -346,14 +375,20 @@ octtoint_.c: octtoint.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/octtoint.c; then echo $(srcdir)/octtoint.c; else echo octtoint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > octtoint_.c prettydate_.c: prettydate.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/prettydate.c; then echo $(srcdir)/prettydate.c; else echo prettydate.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > prettydate_.c +random_.c: random.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > random_.c ranny_.c: ranny.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ranny.c; then echo $(srcdir)/ranny.c; else echo ranny.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ranny_.c recvbuff_.c: recvbuff.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/recvbuff.c; then echo $(srcdir)/recvbuff.c; else echo recvbuff.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > recvbuff_.c refnumtoa_.c: refnumtoa.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refnumtoa.c; then echo $(srcdir)/refnumtoa.c; else echo refnumtoa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > refnumtoa_.c +snprintf_.c: snprintf.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/snprintf.c; then echo $(srcdir)/snprintf.c; else echo snprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > snprintf_.c statestr_.c: statestr.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/statestr.c; then echo $(srcdir)/statestr.c; else echo statestr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > statestr_.c +strdup_.c: strdup.c $(ANSI2KNR) + $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strdup_.c strerror_.c: strerror.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strerror.c; then echo $(srcdir)/strerror.c; else echo strerror.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strerror_.c syssignal_.c: syssignal.c $(ANSI2KNR) @@ -376,18 +411,30 @@ utvtoa_.c: utvtoa.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/utvtoa.c; then echo $(srcdir)/utvtoa.c; else echo utvtoa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > utvtoa_.c ymd2yd_.c: ymd2yd.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ymd2yd.c; then echo $(srcdir)/ymd2yd.c; else echo ymd2yd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ymd2yd_.c -a_md5encrypt_.o adjtime_.o atoint_.o atolfp_.o atouint_.o audio_.o \ -authencrypt_.o authkeys_.o authparity_.o authreadkeys_.o authusekey_.o \ -binio_.o buftvtots_.o caljulian_.o calleapwhen_.o caltontp_.o \ -calyearstart_.o clocktime_.o clocktypes_.o decodenetnum_.o dofptoa_.o \ -dolfptoa_.o emalloc_.o findconfig_.o fptoa_.o fptoms_.o getopt_.o \ -gpstolfp_.o hextoint_.o hextolfp_.o humandate_.o icom_.o ieee754io_.o \ -inttoa_.o iosignal_.o lib_strbuf_.o machines_.o md5c_.o memmove_.o \ -mfp_mul_.o mfptoa_.o mfptoms_.o mktime_.o modetoa_.o mstolfp_.o \ -msutotsf_.o msyslog_.o netof_.o numtoa_.o numtohost_.o octtoint_.o \ -prettydate_.o ranny_.o recvbuff_.o refnumtoa_.o statestr_.o strerror_.o \ -syssignal_.o systime_.o tsftomsu_.o tstotv_.o tvtoa_.o tvtots_.o \ -uglydate_.o uinttoa_.o utvtoa_.o ymd2yd_.o : $(ANSI2KNR) +a_md5encrypt_.$(OBJEXT) adjtime_.$(OBJEXT) adjtimex_.$(OBJEXT) \ +atoint_.$(OBJEXT) atolfp_.$(OBJEXT) atouint_.$(OBJEXT) audio_.$(OBJEXT) \ +authencrypt_.$(OBJEXT) authkeys_.$(OBJEXT) authparity_.$(OBJEXT) \ +authreadkeys_.$(OBJEXT) authusekey_.$(OBJEXT) binio_.$(OBJEXT) \ +buftvtots_.$(OBJEXT) caljulian_.$(OBJEXT) calleapwhen_.$(OBJEXT) \ +caltontp_.$(OBJEXT) calyearstart_.$(OBJEXT) clocktime_.$(OBJEXT) \ +clocktypes_.$(OBJEXT) decodenetnum_.$(OBJEXT) dofptoa_.$(OBJEXT) \ +dolfptoa_.$(OBJEXT) emalloc_.$(OBJEXT) findconfig_.$(OBJEXT) \ +fptoa_.$(OBJEXT) fptoms_.$(OBJEXT) getopt_.$(OBJEXT) \ +gpstolfp_.$(OBJEXT) hextoint_.$(OBJEXT) hextolfp_.$(OBJEXT) \ +humandate_.$(OBJEXT) icom_.$(OBJEXT) ieee754io_.$(OBJEXT) \ +inttoa_.$(OBJEXT) iosignal_.$(OBJEXT) lib_strbuf_.$(OBJEXT) \ +log_.$(OBJEXT) machines_.$(OBJEXT) md5c_.$(OBJEXT) memmove_.$(OBJEXT) \ +mfp_mul_.$(OBJEXT) mfptoa_.$(OBJEXT) mfptoms_.$(OBJEXT) \ +mktime_.$(OBJEXT) modetoa_.$(OBJEXT) mstolfp_.$(OBJEXT) \ +msutotsf_.$(OBJEXT) msyslog_.$(OBJEXT) netof_.$(OBJEXT) \ +numtoa_.$(OBJEXT) numtohost_.$(OBJEXT) octtoint_.$(OBJEXT) \ +prettydate_.$(OBJEXT) random_.$(OBJEXT) ranny_.$(OBJEXT) \ +recvbuff_.$(OBJEXT) refnumtoa_.$(OBJEXT) snprintf_.$(OBJEXT) \ +statestr_.$(OBJEXT) strdup_.$(OBJEXT) strerror_.$(OBJEXT) \ +syssignal_.$(OBJEXT) systime_.$(OBJEXT) tsftomsu_.$(OBJEXT) \ +tstotv_.$(OBJEXT) tvtoa_.$(OBJEXT) tvtots_.$(OBJEXT) \ +uglydate_.$(OBJEXT) uinttoa_.$(OBJEXT) utvtoa_.$(OBJEXT) \ +ymd2yd_.$(OBJEXT) : $(ANSI2KNR) tags: TAGS @@ -398,9 +445,9 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -413,139 +460,146 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $$here distclean-tags: -rm -f TAGS ID -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir); \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -@AMDEP@include $(DEPDIR)/a_md5encrypt$U.Po -@AMDEP@include $(DEPDIR)/adjtime$U.Po -@AMDEP@include $(DEPDIR)/atoint$U.Po -@AMDEP@include $(DEPDIR)/atolfp$U.Po -@AMDEP@include $(DEPDIR)/atouint$U.Po -@AMDEP@include $(DEPDIR)/audio$U.Po -@AMDEP@include $(DEPDIR)/authencrypt$U.Po -@AMDEP@include $(DEPDIR)/authkeys$U.Po -@AMDEP@include $(DEPDIR)/authparity$U.Po -@AMDEP@include $(DEPDIR)/authreadkeys$U.Po -@AMDEP@include $(DEPDIR)/authusekey$U.Po -@AMDEP@include $(DEPDIR)/binio$U.Po -@AMDEP@include $(DEPDIR)/buftvtots$U.Po -@AMDEP@include $(DEPDIR)/caljulian$U.Po -@AMDEP@include $(DEPDIR)/calleapwhen$U.Po -@AMDEP@include $(DEPDIR)/caltontp$U.Po -@AMDEP@include $(DEPDIR)/calyearstart$U.Po -@AMDEP@include $(DEPDIR)/clocktime$U.Po -@AMDEP@include $(DEPDIR)/clocktypes$U.Po -@AMDEP@include $(DEPDIR)/decodenetnum$U.Po -@AMDEP@include $(DEPDIR)/dofptoa$U.Po -@AMDEP@include $(DEPDIR)/dolfptoa$U.Po -@AMDEP@include $(DEPDIR)/emalloc$U.Po -@AMDEP@include $(DEPDIR)/findconfig$U.Po -@AMDEP@include $(DEPDIR)/fptoa$U.Po -@AMDEP@include $(DEPDIR)/fptoms$U.Po -@AMDEP@include $(DEPDIR)/getopt$U.Po -@AMDEP@include $(DEPDIR)/gpstolfp$U.Po -@AMDEP@include $(DEPDIR)/hextoint$U.Po -@AMDEP@include $(DEPDIR)/hextolfp$U.Po -@AMDEP@include $(DEPDIR)/humandate$U.Po -@AMDEP@include $(DEPDIR)/icom$U.Po -@AMDEP@include $(DEPDIR)/ieee754io$U.Po -@AMDEP@include $(DEPDIR)/inttoa$U.Po -@AMDEP@include $(DEPDIR)/iosignal$U.Po -@AMDEP@include $(DEPDIR)/lib_strbuf$U.Po -@AMDEP@include $(DEPDIR)/machines$U.Po -@AMDEP@include $(DEPDIR)/md5c$U.Po -@AMDEP@include $(DEPDIR)/memmove$U.Po -@AMDEP@include $(DEPDIR)/mfp_mul$U.Po -@AMDEP@include $(DEPDIR)/mfptoa$U.Po -@AMDEP@include $(DEPDIR)/mfptoms$U.Po -@AMDEP@include $(DEPDIR)/mktime.Po -@AMDEP@include $(DEPDIR)/modetoa$U.Po -@AMDEP@include $(DEPDIR)/mstolfp$U.Po -@AMDEP@include $(DEPDIR)/msutotsf$U.Po -@AMDEP@include $(DEPDIR)/msyslog$U.Po -@AMDEP@include $(DEPDIR)/netof$U.Po -@AMDEP@include $(DEPDIR)/numtoa$U.Po -@AMDEP@include $(DEPDIR)/numtohost$U.Po -@AMDEP@include $(DEPDIR)/octtoint$U.Po -@AMDEP@include $(DEPDIR)/prettydate$U.Po -@AMDEP@include $(DEPDIR)/ranny$U.Po -@AMDEP@include $(DEPDIR)/recvbuff$U.Po -@AMDEP@include $(DEPDIR)/refnumtoa$U.Po -@AMDEP@include $(DEPDIR)/statestr$U.Po -@AMDEP@include $(DEPDIR)/strerror.Po -@AMDEP@include $(DEPDIR)/syssignal$U.Po -@AMDEP@include $(DEPDIR)/systime$U.Po -@AMDEP@include $(DEPDIR)/tsftomsu$U.Po -@AMDEP@include $(DEPDIR)/tstotv$U.Po -@AMDEP@include $(DEPDIR)/tvtoa$U.Po -@AMDEP@include $(DEPDIR)/tvtots$U.Po -@AMDEP@include $(DEPDIR)/uglydate$U.Po -@AMDEP@include $(DEPDIR)/uinttoa$U.Po -@AMDEP@include $(DEPDIR)/utvtoa$U.Po -@AMDEP@include $(DEPDIR)/ymd2yd$U.Po - -mostlyclean-depend: - -clean-depend: +@AMDEP@@_am_include@ $(DEPDIR)/*.Po +@AMDEP@@_am_include@ $(DEPDIR)/a_md5encrypt$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/adjtime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/adjtimex$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/atoint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/atolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/atouint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/audio$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authencrypt$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authkeys$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authparity$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authreadkeys$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/authusekey$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/binio$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/buftvtots$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/caljulian$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/calleapwhen$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/caltontp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/calyearstart$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clocktime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/clocktypes$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/decodenetnum$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/dofptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/dolfptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/emalloc$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/findconfig$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/fptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/fptoms$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/getopt$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/gpstolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/hextoint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/hextolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/humandate$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/icom$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ieee754io$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/inttoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/iosignal$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/lib_strbuf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/log$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/machines$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/md5c$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/memmove$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mfp_mul$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mfptoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mfptoms$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mktime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mktime.Po +@AMDEP@@_am_include@ $(DEPDIR)/modetoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/mstolfp$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/msutotsf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/msyslog$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/netof$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/numtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/numtohost$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/octtoint$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/prettydate$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/random$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ranny$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/recvbuff$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/refnumtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/snprintf$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/snprintf.Po +@AMDEP@@_am_include@ $(DEPDIR)/statestr$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/strdup$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/strdup.Po +@AMDEP@@_am_include@ $(DEPDIR)/strerror$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/strerror.Po +@AMDEP@@_am_include@ $(DEPDIR)/syssignal$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/systime$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tsftomsu$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tstotv$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tvtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/tvtots$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/uglydate$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/uinttoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/utvtoa$U.Po +@AMDEP@@_am_include@ $(DEPDIR)/ymd2yd$U.Po distclean-depend: -rm -rf $(DEPDIR) -maintainer-clean-depend: - @AMDEP@CCDEPMODE = @CCDEPMODE@ .c.o: @AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c -o $@ $< + $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -info-am: -info: info-am -dvi-am: -dvi: dvi-am +.c.obj: +@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c -o $@ `cygpath -w $<` + + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(LIBRARIES) $(HEADERS) -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile $(LIBRARIES) $(HEADERS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install -installdirs: +installcheck: installcheck-am + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_PROGRAM_ENV='$(INSTALL_STRIP_PROGRAM_ENV)' install mostlyclean-generic: @@ -556,45 +610,53 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." -rm -f Makefile.in -mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic +clean: clean-am -mostlyclean: mostlyclean-am +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am -clean-am: clean-noinstLIBRARIES clean-compile clean-kr clean-tags \ - clean-depend clean-generic mostlyclean-am +distclean: distclean-am -clean: clean-am +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags -distclean-am: distclean-noinstLIBRARIES distclean-compile distclean-kr \ - distclean-tags distclean-depend distclean-generic \ - clean-am +dvi: -distclean: distclean-am +dvi-am: -maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +info: + +info-am: + +install-data-am: + +install-exec-am: + +install-info: + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ -clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr tags mostlyclean-tags distclean-tags clean-tags \ -maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ -clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ -check-am installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all install-strip installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +.PHONY: all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-kr tags uninstall uninstall-am ../include/des.h: diff --git a/contrib/ntp/libntp/a_md5encrypt.c b/contrib/ntp/libntp/a_md5encrypt.c index 76f9c4f..b7f2322 100644 --- a/contrib/ntp/libntp/a_md5encrypt.c +++ b/contrib/ntp/libntp/a_md5encrypt.c @@ -14,18 +14,15 @@ #include <config.h> #endif -#ifdef MD5 #include <stdio.h> #include "ntp_types.h" -#include "ntp_fp.h" #include "ntp_string.h" #include "global.h" #include "md5.h" #include "ntp_stdlib.h" #define BLOCK_OCTETS 16 /* message digest size */ -#define NTP_MAXKEY 65535 /* max identifier from ntp.h */ /* @@ -85,48 +82,3 @@ MD5authdecrypt( return (!memcmp((char *)digest, (char *)pkt + length + 4, BLOCK_OCTETS)); } - - -/* - * session_key - generate session key from supplied plaintext. - * - * Returns hashed session key for validation. - */ -u_long -session_key( - u_int32 srcadr, /* source address */ - u_int32 dstadr, /* destination address */ - u_long keyno, /* key identifier */ - u_long lifetime /* key lifetime */ - ) -{ - MD5_CTX ctx; - u_int32 header[3]; - u_long keyid; - u_char digest[BLOCK_OCTETS]; - - /* - * Generate the session key and retrieve the hash for later. If - * the lifetime is greater than zero, call the key trusted. - */ - header[0] = htonl(srcadr); - header[1] = htonl(dstadr); - header[2] = htonl(keyno); - MD5Init(&ctx); - MD5Update(&ctx, (u_char *)header, sizeof(header)); - MD5Final(digest, &ctx); - memcpy(&keyid, digest, 4); - if (lifetime != 0) { - MD5auth_setkey(keyno, digest, BLOCK_OCTETS); - authtrust(keyno, (int)lifetime); - } -#ifdef DEBUG - if (debug > 1) - printf( - "session_key: from %s to %s keyid %08lx hash %08lx life %ld\n", - numtoa(htonl(srcadr)), numtoa(htonl(dstadr)), keyno, - keyid, lifetime); -#endif - return (keyid); -} -#endif /* MD5 */ diff --git a/contrib/ntp/libntp/audio.c b/contrib/ntp/libntp/audio.c index 3228bba..1fedb3e 100644 --- a/contrib/ntp/libntp/audio.c +++ b/contrib/ntp/libntp/audio.c @@ -5,16 +5,26 @@ #include <config.h> #endif +#if defined(HAVE_SYS_AUDIOIO_H) || defined(HAVE_SUN_AUDIOIO_H) + #include "audio.h" -#include <unistd.h> +#include "ntp_stdlib.h" +#include "ntp_syslog.h" +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif #include <stdio.h> +#include "ntp_string.h" #ifdef HAVE_SYS_AUDIOIO_H #include <sys/audioio.h> #endif /* HAVE_SYS_AUDIOIO_H */ + #ifdef HAVE_SUN_AUDIOIO_H +#include <sys/ioccom.h> #include <sun/audioio.h> #endif /* HAVE_SUN_AUDIOIO_H */ + #ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> #endif /* HAVE_SYS_IOCTL_H */ @@ -26,9 +36,9 @@ */ #ifdef HAVE_SYS_AUDIOIO_H static struct audio_device device; /* audio device ident */ +#endif /* HAVE_SYS_AUDIOIO_H */ static struct audio_info info; /* audio device info */ static int ctl_fd; /* audio control file descriptor */ -#endif /* HAVE_SYS_AUDIOIO_H */ /* @@ -43,29 +53,26 @@ static int ctl_fd; /* audio control file descriptor */ * default. */ int -audio_init(void) +audio_init( + char *dname /* device name */ + ) { int fd; -#ifdef HAVE_SYS_AUDIOIO_H int rval; -#endif /* HAVE_SYS_AUDIOIO_H */ /* - * Open audio device + * Open audio device. Do not complain if not there. */ - fd = open("/dev/audio", O_RDWR | O_NONBLOCK, 0777); - if (fd < 0) { - perror("audio:"); + fd = open(dname, O_RDWR | O_NONBLOCK, 0777); + if (fd < 0) return (fd); - } -#ifdef HAVE_SYS_AUDIOIO_H /* - * Open audio control device + * Open audio control device. */ ctl_fd = open("/dev/audioctl", O_RDWR); if (ctl_fd < 0) { - perror("audioctl:"); + msyslog(LOG_ERR, "audio: invalid control device\n"); close(fd); return(ctl_fd); } @@ -76,11 +83,11 @@ audio_init(void) rval = audio_gain((AUDIO_MAX_GAIN - AUDIO_MIN_GAIN) / 2, AUDIO_MICROPHONE); if (rval < 0) { + msyslog(LOG_ERR, "audio: invalid control device parameters\n"); close(ctl_fd); close(fd); return(rval); } -#endif /* HAVE_SYS_AUDIOIO_H */ return (fd); } @@ -94,25 +101,21 @@ audio_gain( int port /* port */ ) { -#ifdef HAVE_SYS_AUDIOIO_H int rval; -#endif /* HAVE_SYS_AUDIOIO_H */ -#ifdef HAVE_SYS_AUDIOIO_H AUDIO_INITINFO(&info); +#ifdef HAVE_SYS_AUDIOIO_H info.record.buffer_size = AUDIO_BUFSIZ; +#endif /* HAVE_SYS_AUDIOIO_H */ info.record.gain = gain; info.record.port = port; info.record.error = 0; rval = ioctl(ctl_fd, (int)AUDIO_SETINFO, &info); if (rval < 0) { - perror("audio:"); + msyslog(LOG_ERR, "audio_gain: %m"); return (rval); } return (info.record.error); -#else - return (0); -#endif /* HAVE_SYS_AUDIOIO_H */ } @@ -129,26 +132,19 @@ audio_show(void) ioctl(ctl_fd, (int)AUDIO_GETDEV, &device); printf("audio: name %s, version %s, config %s\n", device.name, device.version, device.config); +#endif /* HAVE_SYS_AUDIOIO_H */ ioctl(ctl_fd, (int)AUDIO_GETINFO, &info); printf( - "audio: samples %d, channels %d, precision %d, encoding %d\n", + "audio: samples %d, channels %d, precision %d, encoding %d, gain %d, port %d\n", info.record.sample_rate, info.record.channels, - info.record.precision, info.record.encoding); - printf("audio: gain %d, port %d, buffer %d\n", - info.record.gain, info.record.port, - info.record.buffer_size); - printf("audio: gain %d, port %d\n", + info.record.precision, info.record.encoding, info.record.gain, info.record.port); printf( "audio: samples %d, eof %d, pause %d, error %d, waiting %d, balance %d\n", info.record.samples, info.record.eof, info.record.pause, info.record.error, info.record.waiting, info.record.balance); - printf("audio: monitor %d, muted %d\n", - info.monitor_gain, info.output_muted); -#endif /* HAVE_SYS_AUDIOIO_H */ -#ifdef __NetBSD__ - printf("audio: monitor %d, blocksize %d, hiwat %d, lowat %d, mode %d\n", - info.monitor_gain, info.blocksize, info.hiwat, info.lowat, info.mode); -#endif /* __NetBSD__ */ } +#else +int audio_bs; +#endif /* HAVE_SYS_AUDIOIO_H HAVE_SUN_AUDIOIO_H */ diff --git a/contrib/ntp/libntp/authencrypt.c b/contrib/ntp/libntp/authencrypt.c index 22f910c..075afe0 100644 --- a/contrib/ntp/libntp/authencrypt.c +++ b/contrib/ntp/libntp/authencrypt.c @@ -67,7 +67,7 @@ int DESauthdecrypt( u_char *key, /* key pointer */ u_int32 *pkt, /* packet pointer */ - int length, /* packet length */ + int length, /* packet length */ int size /* size of MAC field */ ) { diff --git a/contrib/ntp/libntp/authkeys.c b/contrib/ntp/libntp/authkeys.c index 578688b..f35d91c 100644 --- a/contrib/ntp/libntp/authkeys.c +++ b/contrib/ntp/libntp/authkeys.c @@ -26,16 +26,12 @@ struct savekey { #ifdef DES u_int32 DES_key[2]; /* DES key */ #endif -#ifdef MD5 u_char MD5_key[32]; /* MD5 key */ -#endif } k; - u_long keyid; /* key identifier */ + keyid_t keyid; /* key identifier */ u_short flags; /* flags that wave */ u_long lifetime; /* remaining lifetime */ -#ifdef MD5 int keylen; /* key length */ -#endif }; #define KEY_TRUSTED 0x001 /* this key is trusted */ @@ -73,7 +69,7 @@ int authnumfreekeys; /* * The key cache. We cache the last key we looked at here. */ -u_long cache_keyid; /* key identifier */ +keyid_t cache_keyid; /* key identifier */ u_char *cache_key; /* key pointer */ u_int cache_keylen; /* key length */ u_short cache_flags; /* flags that wave */ @@ -97,7 +93,7 @@ init_auth(void) */ struct savekey * auth_findkey( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -118,7 +114,7 @@ auth_findkey( */ int auth_havekey( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -142,7 +138,7 @@ auth_havekey( */ int authhavekey( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -167,13 +163,11 @@ authhavekey( } cache_keyid = sk->keyid; cache_flags = sk->flags; -#ifdef MD5 if (sk->flags & KEY_MD5) { cache_key = sk->k.MD5_key; cache_keylen = sk->keylen; return (1); } -#endif #ifdef DES if (sk->flags & KEY_DES) { cache_key = (u_char *)sk->k.DES_key; @@ -211,15 +205,15 @@ auth_moremem(void) */ void authtrust( - u_long keyno, - int trust + keyid_t keyno, + u_long trust ) { struct savekey *sk; #ifdef DEBUG - if (debug > 1) - printf("authtrust: keyid %08lx life %d\n", (u_long)keyno, trust); + if (debug > 2) + printf("authtrust: keyid %08x life %lu\n", keyno, trust); #endif sk = key_hash[KEYHASH(keyno)]; while (sk != 0) { @@ -288,7 +282,7 @@ authtrust( */ int authistrusted( - u_long keyno + keyid_t keyno ) { struct savekey *sk; @@ -321,7 +315,7 @@ authistrusted( */ void DESauth_setkey( - u_long keyno, + keyid_t keyno, const u_int32 *key ) { @@ -368,10 +362,9 @@ DESauth_setkey( } #endif -#ifdef MD5 void MD5auth_setkey( - u_long keyno, + keyid_t keyno, const u_char *key, const int len ) @@ -425,7 +418,6 @@ MD5auth_setkey( authnumkeys++; return; } -#endif /* * auth_delkeys - delete all known keys, in preparation for rereading @@ -451,9 +443,7 @@ auth_delkeys(void) if (sk->flags & KEY_TRUSTED) { memset(&sk->k, 0, sizeof(sk->k)); sk->lifetime = 0; -#ifdef MD5 sk->keylen = 0; -#endif sk = sk->next; } else { *skp = sk->next; @@ -503,7 +493,7 @@ auth_agekeys(void) */ int authencrypt( - u_long keyno, + keyid_t keyno, u_int32 *pkt, int length ) @@ -515,7 +505,7 @@ authencrypt( * consists of a single word with value zero. */ authencryptions++; - pkt[length / 4] = (u_long)htonl(keyno); + pkt[length / 4] = htonl(keyno); if (keyno == 0) { return (4); } @@ -527,10 +517,9 @@ authencrypt( return (DESauthencrypt(cache_key, pkt, length)); #endif -#ifdef MD5 if (cache_flags & KEY_MD5) return (MD5authencrypt(cache_key, pkt, length)); -#endif + return (0); } @@ -541,7 +530,7 @@ authencrypt( */ int authdecrypt( - u_long keyno, + keyid_t keyno, u_int32 *pkt, int length, int size @@ -555,7 +544,7 @@ authdecrypt( */ authdecryptions++; if (keyno == 0) - return (1); + return (0); if (!authhavekey(keyno) || size < 4) return (0); @@ -565,10 +554,8 @@ authdecrypt( return (DESauthdecrypt(cache_key, pkt, length, size)); #endif -#ifdef MD5 if (cache_flags & KEY_MD5) return (MD5authdecrypt(cache_key, pkt, length, size)); -#endif return (0); } diff --git a/contrib/ntp/libntp/authparity.c b/contrib/ntp/libntp/authparity.c index 32fde58..ea5eac0 100644 --- a/contrib/ntp/libntp/authparity.c +++ b/contrib/ntp/libntp/authparity.c @@ -1,6 +1,12 @@ /* * auth_parity - set parity on a key/check for odd parity */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#ifdef DES #include "ntp_stdlib.h" int @@ -55,3 +61,6 @@ DESauth_parity( */ return (parity_err == 0); } +#else +int authparity_bs; +#endif /* DES */ diff --git a/contrib/ntp/libntp/authreadkeys.c b/contrib/ntp/libntp/authreadkeys.c index 18ac0dd..ce5cefb 100644 --- a/contrib/ntp/libntp/authreadkeys.c +++ b/contrib/ntp/libntp/authreadkeys.c @@ -6,8 +6,8 @@ #include "ntp_fp.h" #include "ntp.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #ifdef DES /* @@ -22,12 +22,10 @@ #define KEY_TYPE_ASCII 3 #endif -#ifdef MD5 /* * Arbitrary long string of ASCII characters. */ #define KEY_TYPE_MD5 4 -#endif /* Forwards */ static char *nexttok P((char **)); @@ -155,11 +153,9 @@ authreadkeys( case 'a': keytype = KEY_TYPE_ASCII; break; #endif -#ifdef MD5 case 'M': case 'm': keytype = KEY_TYPE_MD5; break; -#endif default: msyslog(LOG_ERR, "invalid key type for key number %ld, entry ignored", @@ -188,7 +184,6 @@ authreadkeys( keyno); break; #endif -#ifdef MD5 case KEY_TYPE_MD5: if (!authusekey(keyno, keytype, (u_char *)token)) @@ -196,7 +191,6 @@ authreadkeys( "format/parity error for MD5 key %ld, not used", keyno); break; -#endif } } } diff --git a/contrib/ntp/libntp/authusekey.c b/contrib/ntp/libntp/authusekey.c index a399a48..18b8ba0 100644 --- a/contrib/ntp/libntp/authusekey.c +++ b/contrib/ntp/libntp/authusekey.c @@ -24,13 +24,11 @@ #endif -#ifdef MD5 #define KEY_TYPE_MD5 4 -#endif int authusekey( - u_long keyno, + keyid_t keyno, int keytype, const u_char *str ) @@ -119,11 +117,9 @@ authusekey( break; #endif -#ifdef MD5 case KEY_TYPE_MD5: MD5auth_setkey(keyno, str, (int)strlen((const char *)str)); break; -#endif default: /* Oh, well */ diff --git a/contrib/ntp/libntp/buftvtots.c b/contrib/ntp/libntp/buftvtots.c index 96338bc..1944233 100644 --- a/contrib/ntp/libntp/buftvtots.c +++ b/contrib/ntp/libntp/buftvtots.c @@ -19,6 +19,7 @@ buftvtots( register const u_char *bp; register u_long sec; register u_long usec; + struct timeval tv; #ifdef WORDS_BIGENDIAN bp = (const u_char *)bufp; @@ -31,13 +32,33 @@ buftvtots( sec <<= 8; sec += (u_long)*bp++ & 0xff; + if (sizeof(tv.tv_sec) == 8) { + sec += (u_long)*bp++ & 0xff; + sec <<= 8; + sec += (u_long)*bp++ & 0xff; + sec <<= 8; + sec += (u_long)*bp++ & 0xff; + sec <<= 8; + sec += (u_long)*bp++ & 0xff; + } + usec = (u_long)*bp++ & 0xff; usec <<= 8; usec += (u_long)*bp++ & 0xff; usec <<= 8; usec += (u_long)*bp++ & 0xff; usec <<= 8; - usec += (u_long)*bp & 0xff; + usec += (u_long)*bp++ & 0xff; + + if (sizeof(tv.tv_usec) == 8) { + usec += (u_long)*bp++ & 0xff; + usec <<= 8; + usec += (u_long)*bp++ & 0xff; + usec <<= 8; + usec += (u_long)*bp++ & 0xff; + usec <<= 8; + usec += (u_long)*bp & 0xff; + } #else bp = (const u_char *)bufp + 7; @@ -49,13 +70,33 @@ buftvtots( usec <<= 8; usec += (u_long)*bp-- & 0xff; + if (sizeof(tv.tv_usec) == 8) { + usec += (u_long)*bp-- & 0xff; + usec <<= 8; + usec += (u_long)*bp-- & 0xff; + usec <<= 8; + usec += (u_long)*bp-- & 0xff; + usec <<= 8; + usec += (u_long)*bp-- & 0xff; + } + sec = (u_long)*bp-- & 0xff; sec <<= 8; sec += (u_long)*bp-- & 0xff; sec <<= 8; sec += (u_long)*bp-- & 0xff; sec <<= 8; - sec += (u_long)*bp & 0xff; + sec += (u_long)*bp-- & 0xff; + + if (sizeof (tv.tv_sec) == 8) { + sec += (u_long)*bp-- & 0xff; + sec <<= 8; + sec += (u_long)*bp-- & 0xff; + sec <<= 8; + sec += (u_long)*bp-- & 0xff; + sec <<= 8; + sec += (u_long)*bp & 0xff; + } #endif ts->l_ui = sec + (u_long)JAN_1970; if (usec > 999999) diff --git a/contrib/ntp/libntp/clocktypes.c b/contrib/ntp/libntp/clocktypes.c index 520dce4..cdfe356 100644 --- a/contrib/ntp/libntp/clocktypes.c +++ b/contrib/ntp/libntp/clocktypes.c @@ -86,6 +86,10 @@ struct clktype clktypes[] = { "WWV_AUDIO"}, { REFCLK_FG, "Forum Graphic GPS Dating Station (37)", "GPS_FG"}, + { REFCLK_HOPF_SERIAL, "hopf Elektronic serial line receiver (38)", + "HOPF_S"}, + { REFCLK_HOPF_PCI, "hopf Elektronic PCI receiver (39)", + "HOPF_P"}, { -1, "", "" } }; diff --git a/contrib/ntp/libntp/emalloc.c b/contrib/ntp/libntp/emalloc.c index 0918c9c..2fe4c38 100644 --- a/contrib/ntp/libntp/emalloc.c +++ b/contrib/ntp/libntp/emalloc.c @@ -3,8 +3,8 @@ */ #include "ntp_types.h" #include "ntp_malloc.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #if defined SYS_WINNT && defined DEBUG #include <crtdbg.h> @@ -22,7 +22,7 @@ debug_emalloc( char *mem; if ((mem = (char *)_malloc_dbg(size, _NORMAL_BLOCK, filename, line)) == 0) { - msyslog(LOG_ERR, "No more memory!"); + msyslog(LOG_ERR, "Exiting: No more memory!"); exit(1); } return mem; @@ -38,7 +38,7 @@ emalloc( char *mem; if ((mem = (char *)malloc(size)) == 0) { - msyslog(LOG_ERR, "No more memory!"); + msyslog(LOG_ERR, "Exiting: No more memory!"); exit(1); } return mem; diff --git a/contrib/ntp/libntp/gpstolfp.c b/contrib/ntp/libntp/gpstolfp.c index cf7b80c..c424784 100644 --- a/contrib/ntp/libntp/gpstolfp.c +++ b/contrib/ntp/libntp/gpstolfp.c @@ -7,7 +7,7 @@ */ #include "ntp_fp.h" -#define GPSORIGIN (unsigned)(2524953600L) /* NTP origin - GPS origin in seconds */ +#define GPSORIGIN ULONG_CONST(2524953600) /* NTP origin - GPS origin in seconds */ #define SECSPERWEEK (unsigned)(604800) /* seconds per week - GPS tells us about weeks */ #define GPSWRAP 990 /* assume week count less than this in the previous epoch */ diff --git a/contrib/ntp/libntp/humandate.c b/contrib/ntp/libntp/humandate.c index f663c9e..7995633 100644 --- a/contrib/ntp/libntp/humandate.c +++ b/contrib/ntp/libntp/humandate.c @@ -2,16 +2,11 @@ * humandate - convert an NTP (or the current) time to something readable */ #include <stdio.h> -#include "time.h" #include "ntp_fp.h" -#include "ntp_unixtime.h" /* includes <sys/time.h> */ +#include "ntp_unixtime.h" /* includes <sys/time.h> and <time.h> */ #include "lib_strbuf.h" #include "ntp_stdlib.h" -#ifdef TIME_WITH_SYS_TIME -#include <time.h> -#endif - static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" diff --git a/contrib/ntp/libntp/icom.c b/contrib/ntp/libntp/icom.c index 4d6efc5..3b9a9a5 100644 --- a/contrib/ntp/libntp/icom.c +++ b/contrib/ntp/libntp/icom.c @@ -8,17 +8,11 @@ #include "icom.h" #include <unistd.h> #include <stdio.h> - -#ifdef HAVE_TERMIOS_H -# include <termios.h> -#endif /* HAVE_TERMIOS_H */ -#ifdef HAVE_SYS_TERMIOS_H -# include <sys/termios.h> -#endif /* HAVE_SYS_TERMIOS_H */ - #include <fcntl.h> #include <errno.h> +#include "ntp_tty.h" + /* * Scraps */ @@ -142,7 +136,7 @@ icom_init( int speed, /* line speed */ int trace /* trace flags */ ) { - struct termios ttyb; + TTY ttyb; int fd; flags = trace; diff --git a/contrib/ntp/libntp/iosignal.c b/contrib/ntp/libntp/iosignal.c index c8ec949..3c78d48 100644 --- a/contrib/ntp/libntp/iosignal.c +++ b/contrib/ntp/libntp/iosignal.c @@ -3,40 +3,27 @@ * was shamelessly stolen from ntpd. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include "ntp_machine.h" +#include "ntpd.h" +#include "ntp_io.h" +#include "ntp_if.h" +#include "ntp_stdlib.h" +#include "iosignal.h" #include <stdio.h> #include <signal.h> -#include <sys/types.h> #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif /* HAVE_SYS_PARAM_H */ -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif -#ifdef HAVE_NETINET_IN_H -# include <netinet/in.h> -#endif #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif -#ifdef HAVE_SYS_SOCKIO_H /* UXPV: SIOC* #defines (Frank Vance <fvance@waii.com>) */ -# include <sys/sockio.h> -#endif + #include <arpa/inet.h> #if _BSDI_VERSION >= 199510 # include <ifaddrs.h> #endif -/* 98/06/01 */ -#include "ntp_machine.h" /* 98/06/01 */ -#include "ntpd.h" -#include "ntp_io.h" -#include "ntp_if.h" -#include "ntp_stdlib.h" -#include "iosignal.h" #if defined(HAVE_SIGNALED_IO) static int sigio_block_count = 0; diff --git a/contrib/ntp/libntp/lib_strbuf.c b/contrib/ntp/libntp/lib_strbuf.c index 690f1ad..315070f 100644 --- a/contrib/ntp/libntp/lib_strbuf.c +++ b/contrib/ntp/libntp/lib_strbuf.c @@ -2,6 +2,7 @@ * lib_strbuf - library string storage */ +#include "ntp_stdlib.h" #include "lib_strbuf.h" /* diff --git a/contrib/ntp/libntp/machines.c b/contrib/ntp/libntp/machines.c index bbcfd54..a3dcf2f 100644 --- a/contrib/ntp/libntp/machines.c +++ b/contrib/ntp/libntp/machines.c @@ -13,10 +13,6 @@ #include "ntp_stdlib.h" #include "ntp_unixtime.h" -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif - #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -195,7 +191,7 @@ getpass(const char * prompt) fprintf(stderr, "%s", prompt); fflush(stderr); #endif - for (i=0; i<sizeof(password)-1 && ((c=_getch())!='\n'); i++) { + for (i=0; i<sizeof(password)-1 && ((c=_getch())!='\n' && c!='\r'); i++) { password[i] = (char) c; } password[i] = '\0'; diff --git a/contrib/ntp/libntp/mktime.c b/contrib/ntp/libntp/mktime.c index c752690..b9cd42e 100644 --- a/contrib/ntp/libntp/mktime.c +++ b/contrib/ntp/libntp/mktime.c @@ -60,9 +60,7 @@ * by hand. Sorry about that. */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include "ntp_machine.h" #ifndef DSTMINUTES #define DSTMINUTES 60 @@ -84,12 +82,6 @@ #define TM_YEAR_BASE 1900 #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#include <time.h> - extern time_t time(); static int mon_lengths[2][MONSPERYEAR] = { diff --git a/contrib/ntp/libntp/msyslog.c b/contrib/ntp/libntp/msyslog.c index dfb1627..9864881 100644 --- a/contrib/ntp/libntp/msyslog.c +++ b/contrib/ntp/libntp/msyslog.c @@ -20,8 +20,8 @@ #include "ntp_types.h" #include "ntp_string.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #ifdef SYS_WINNT # include "..\ports\winnt\libntp\log.h" @@ -60,16 +60,12 @@ void msyslog(int level, const char *fmt, ...) #endif va_list ap; char buf[1025], nfmt[256]; -#if !defined(VMS) +#if defined(SYS_WINNT) char xerr[50]; #endif register int c; register char *n, *prog; register const char *f; -#ifdef CHAR_SYS_ERRLIST - extern int sys_nerr; - extern char *sys_errlist[]; -#endif int olderrno; char *err; @@ -96,12 +92,7 @@ void msyslog(int level, const char *fmt, ...) continue; } err = 0; -#if !defined(VMS) && !defined(SYS_WINNT) && !defined (SYS_VXWORKS) - if ((unsigned)olderrno > sys_nerr) - sprintf((char *)(err = xerr), "error %d", olderrno); - else - err = (char*)sys_errlist[olderrno]; -#elif defined(VMS) || defined (SYS_VXWORKS) +#if !defined(SYS_WINNT) err = strerror(olderrno); #else /* SYS_WINNT */ err = xerr; @@ -114,7 +105,7 @@ void msyslog(int level, const char *fmt, ...) sizeof(xerr), NULL); -#endif /* VMS && SYS_WINNT */ +#endif /* SYS_WINNT */ if ((n + strlen(err)) < &nfmt[254]) { strcpy(n, err); n += strlen(err); diff --git a/contrib/ntp/libntp/prettydate.c b/contrib/ntp/libntp/prettydate.c index 291c17c..9710c84 100644 --- a/contrib/ntp/libntp/prettydate.c +++ b/contrib/ntp/libntp/prettydate.c @@ -8,10 +8,6 @@ #include "lib_strbuf.h" #include "ntp_stdlib.h" -#ifndef TM_IN_SYS_TIME -#include <time.h> -#endif - static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" diff --git a/contrib/ntp/libntp/random.c b/contrib/ntp/libntp/random.c new file mode 100644 index 0000000..7136857 --- /dev/null +++ b/contrib/ntp/libntp/random.c @@ -0,0 +1,482 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; +#endif /* LIBC_SCCS and not lint */ + +#include "config.h" +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#include <stdio.h> + +#include <ntp_types.h> + +/* + * random.c: + * + * An improved random number generation package. In addition to the standard + * rand()/srand() like interface, this package also has a special state info + * interface. The initstate() routine is called with a seed, an array of + * bytes, and a count of how many bytes are being passed in; this array is + * then initialized to contain information for random number generation with + * that much state information. Good sizes for the amount of state + * information are 32, 64, 128, and 256 bytes. The state can be switched by + * calling the setstate() routine with the same array as was initiallized + * with initstate(). By default, the package runs with 128 bytes of state + * information and generates far better random numbers than a linear + * congruential generator. If the amount of state information is less than + * 32 bytes, a simple linear congruential R.N.G. is used. + * + * Internally, the state information is treated as an array of longs; the + * zeroeth element of the array is the type of R.N.G. being used (small + * integer); the remainder of the array is the state information for the + * R.N.G. Thus, 32 bytes of state information will give 7 longs worth of + * state information, which will allow a degree seven polynomial. (Note: + * the zeroeth word of state information also has some other information + * stored in it -- see setstate() for details). + * + * The random number generation technique is a linear feedback shift register + * approach, employing trinomials (since there are fewer terms to sum up that + * way). In this approach, the least significant bit of all the numbers in + * the state table will act as a linear feedback shift register, and will + * have period 2^deg - 1 (where deg is the degree of the polynomial being + * used, assuming that the polynomial is irreducible and primitive). The + * higher order bits will have longer periods, since their values are also + * influenced by pseudo-random carries out of the lower bits. The total + * period of the generator is approximately deg*(2**deg - 1); thus doubling + * the amount of state information has a vast influence on the period of the + * generator. Note: the deg*(2**deg - 1) is an approximation only good for + * large deg, when the period of the shift register is the dominant factor. + * With deg equal to seven, the period is actually much longer than the + * 7*(2**7 - 1) predicted by this formula. + * + * Modified 28 December 1994 by Jacob S. Rosenberg. + * The following changes have been made: + * All references to the type u_int have been changed to unsigned long. + * All references to type int have been changed to type long. Other + * cleanups have been made as well. A warning for both initstate and + * setstate has been inserted to the effect that on Sparc platforms + * the 'arg_state' variable must be forced to begin on word boundaries. + * This can be easily done by casting a long integer array to char *. + * The overall logic has been left STRICTLY alone. This software was + * tested on both a VAX and Sun SpacsStation with exactly the same + * results. The new version and the original give IDENTICAL results. + * The new version is somewhat faster than the original. As the + * documentation says: "By default, the package runs with 128 bytes of + * state information and generates far better random numbers than a linear + * congruential generator. If the amount of state information is less than + * 32 bytes, a simple linear congruential R.N.G. is used." For a buffer of + * 128 bytes, this new version runs about 19 percent faster and for a 16 + * byte buffer it is about 5 percent faster. + */ + +/* + * For each of the currently supported random number generators, we have a + * break value on the amount of state information (you need at least this + * many bytes of state info to support this random number generator), a degree + * for the polynomial (actually a trinomial) that the R.N.G. is based on, and + * the separation between the two lower order coefficients of the trinomial. + */ +#define TYPE_0 0 /* linear congruential */ +#define BREAK_0 8 +#define DEG_0 0 +#define SEP_0 0 + +#define TYPE_1 1 /* x**7 + x**3 + 1 */ +#define BREAK_1 32 +#define DEG_1 7 +#define SEP_1 3 + +#define TYPE_2 2 /* x**15 + x + 1 */ +#define BREAK_2 64 +#define DEG_2 15 +#define SEP_2 1 + +#define TYPE_3 3 /* x**31 + x**3 + 1 */ +#define BREAK_3 128 +#define DEG_3 31 +#define SEP_3 3 + +#define TYPE_4 4 /* x**63 + x + 1 */ +#define BREAK_4 256 +#define DEG_4 63 +#define SEP_4 1 + +/* + * Array versions of the above information to make code run faster -- + * relies on fact that TYPE_i == i. + */ +#define MAX_TYPES 5 /* max number of types above */ + +static long degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }; +static long seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; + +/* + * Initially, everything is set up as if from: + * + * initstate(1, randtbl, 128); + * + * Note that this initialization takes advantage of the fact that srandom() + * advances the front and rear pointers 10*rand_deg times, and hence the + * rear pointer which starts at 0 will also end up at zero; thus the zeroeth + * element of the state information, which contains info about the current + * position of the rear pointer is just + * + * MAX_TYPES * (rptr - state) + TYPE_3 == TYPE_3. + */ + +static long randtbl[DEG_3 + 1] = { + TYPE_3, +#ifdef USE_WEAK_SEEDING +/* Historic implementation compatibility */ +/* The random sequences do not vary much with the seed */ + 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5, + 0xf103bc02, 0x48f340fb, 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd, + 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88, + 0xe369735d, 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc, + 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e, 0x8999220b, + 0x27fb47b9, +#else /* !USE_WEAK_SEEDING */ + 0x991539b1, 0x16a5bce3, 0x6774a4cd, 0x3e01511e, 0x4e508aaa, 0x61048c05, + 0xf5500617, 0x846b7115, 0x6a19892c, 0x896a97af, 0xdb48f936, 0x14898454, + 0x37ffd106, 0xb58bff9c, 0x59e17104, 0xcf918a49, 0x09378c83, 0x52c7a471, + 0x8d293ea9, 0x1f4fc301, 0xc3db71be, 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1, + 0x19edc328, 0x87bf4bdd, 0xc9b240e5, 0xe9ee4b1b, 0x4382aee7, 0x535b6b41, + 0xf3bec5da +#endif /* !USE_WEAK_SEEDING */ +}; + +/* + * fptr and rptr are two pointers into the state info, a front and a rear + * pointer. These two pointers are always rand_sep places aparts, as they + * cycle cyclically through the state information. (Yes, this does mean we + * could get away with just one pointer, but the code for random() is more + * efficient this way). The pointers are left positioned as they would be + * from the call + * + * initstate(1, randtbl, 128); + * + * (The position of the rear pointer, rptr, is really 0 (as explained above + * in the initialization of randtbl) because the state table pointer is set + * to point to randtbl[1] (as explained below). + */ +static long *fptr = &randtbl[SEP_3 + 1]; +static long *rptr = &randtbl[1]; + +/* + * The following things are the pointer to the state information table, the + * type of the current generator, the degree of the current polynomial being + * used, and the separation between the two pointers. Note that for efficiency + * of random(), we remember the first location of the state information, not + * the zeroeth. Hence it is valid to access state[-1], which is used to + * store the type of the R.N.G. Also, we remember the last location, since + * this is more efficient than indexing every time to find the address of + * the last element to see if the front and rear pointers have wrapped. + */ +static long *state = &randtbl[1]; +static long rand_type = TYPE_3; +static long rand_deg = DEG_3; +static long rand_sep = SEP_3; +static long *end_ptr = &randtbl[DEG_3 + 1]; + +static inline long good_rand P((long)); +long random P((void)); + +static inline long +good_rand ( + register long x + ) +{ +#ifdef USE_WEAK_SEEDING +/* + * Historic implementation compatibility. + * The random sequences do not vary much with the seed, + * even with overflowing. + */ + return (1103515245 * x + 12345); +#else /* !USE_WEAK_SEEDING */ +/* + * Compute x = (7^5 * x) mod (2^31 - 1) + * wihout overflowing 31 bits: + * (2^31 - 1) = 127773 * (7^5) + 2836 + * From "Random number generators: good ones are hard to find", + * Park and Miller, Communications of the ACM, vol. 31, no. 10, + * October 1988, p. 1195. + */ + register long hi, lo; + + hi = x / 127773; + lo = x % 127773; + x = 16807 * lo - 2836 * hi; + if (x <= 0) + x += 0x7fffffff; + return (x); +#endif /* !USE_WEAK_SEEDING */ +} + +/* + * srandom: + * + * Initialize the random number generator based on the given seed. If the + * type is the trivial no-state-information type, just remember the seed. + * Otherwise, initializes state[] based on the given "seed" via a linear + * congruential generator. Then, the pointers are set to known locations + * that are exactly rand_sep places apart. Lastly, it cycles the state + * information a given number of times to get rid of any initial dependencies + * introduced by the L.C.R.N.G. Note that the initialization of randtbl[] + * for default usage relies on values produced by this routine. + */ +void +srandom( + unsigned long x + ) +{ + register long i; + + if (rand_type == TYPE_0) + state[0] = x; + else { + state[0] = x; + for (i = 1; i < rand_deg; i++) + state[i] = good_rand(state[i - 1]); + fptr = &state[rand_sep]; + rptr = &state[0]; + for (i = 0; i < 10 * rand_deg; i++) + (void)random(); + } +} + +/* + * srandomdev: + * + * Many programs choose the seed value in a totally predictable manner. + * This often causes problems. We seed the generator using the much more + * secure urandom(4) interface. Note that this particular seeding + * procedure can generate states which are impossible to reproduce by + * calling srandom() with any value, since the succeeding terms in the + * state buffer are no longer derived from the LC algorithm applied to + * a fixed seed. + */ +void +srandomdev( void ) +{ + struct timeval tv; + unsigned long junk; /* Purposely used uninitialized */ + + gettimeofday(&tv, NULL); + srandom(getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk); + return; +} + +/* + * initstate: + * + * Initialize the state information in the given array of n bytes for future + * random number generation. Based on the number of bytes we are given, and + * the break values for the different R.N.G.'s, we choose the best (largest) + * one we can and set things up for it. srandom() is then called to + * initialize the state information. + * + * Note that on return from srandom(), we set state[-1] to be the type + * multiplexed with the current value of the rear pointer; this is so + * successive calls to initstate() won't lose this information and will be + * able to restart with setstate(). + * + * Note: the first thing we do is save the current state, if any, just like + * setstate() so that it doesn't matter when initstate is called. + * + * Returns a pointer to the old state. + * + * Note: The Sparc platform requires that arg_state begin on a long + * word boundary; otherwise a bus error will occur. Even so, lint will + * complain about mis-alignment, but you should disregard these messages. + */ +char * +initstate( + unsigned long seed, /* seed for R.N.G. */ + char *arg_state, /* pointer to state array */ + long n /* # bytes of state info */ + ) +{ + register char *ostate = (char *)(&state[-1]); + register long *long_arg_state = (long *) arg_state; + + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = MAX_TYPES * (rptr - state) + rand_type; + if (n < BREAK_0) { + (void)fprintf(stderr, + "random: not enough state (%ld bytes); ignored.\n", n); + return(0); + } + if (n < BREAK_1) { + rand_type = TYPE_0; + rand_deg = DEG_0; + rand_sep = SEP_0; + } else if (n < BREAK_2) { + rand_type = TYPE_1; + rand_deg = DEG_1; + rand_sep = SEP_1; + } else if (n < BREAK_3) { + rand_type = TYPE_2; + rand_deg = DEG_2; + rand_sep = SEP_2; + } else if (n < BREAK_4) { + rand_type = TYPE_3; + rand_deg = DEG_3; + rand_sep = SEP_3; + } else { + rand_type = TYPE_4; + rand_deg = DEG_4; + rand_sep = SEP_4; + } + state = (long *) (long_arg_state + 1); /* first location */ + end_ptr = &state[rand_deg]; /* must set end_ptr before srandom */ + srandom(seed); + if (rand_type == TYPE_0) + long_arg_state[0] = rand_type; + else + long_arg_state[0] = MAX_TYPES * (rptr - state) + rand_type; + return(ostate); +} + +/* + * setstate: + * + * Restore the state from the given state array. + * + * Note: it is important that we also remember the locations of the pointers + * in the current state information, and restore the locations of the pointers + * from the old state information. This is done by multiplexing the pointer + * location into the zeroeth word of the state information. + * + * Note that due to the order in which things are done, it is OK to call + * setstate() with the same state as the current state. + * + * Returns a pointer to the old state information. + * + * Note: The Sparc platform requires that arg_state begin on a long + * word boundary; otherwise a bus error will occur. Even so, lint will + * complain about mis-alignment, but you should disregard these messages. + */ +char * +setstate( + char *arg_state /* pointer to state array */ + ) +{ + register long *new_state = (long *) arg_state; + register long type = new_state[0] % MAX_TYPES; + register long rear = new_state[0] / MAX_TYPES; + char *ostate = (char *)(&state[-1]); + + if (rand_type == TYPE_0) + state[-1] = rand_type; + else + state[-1] = MAX_TYPES * (rptr - state) + rand_type; + switch(type) { + case TYPE_0: + case TYPE_1: + case TYPE_2: + case TYPE_3: + case TYPE_4: + rand_type = type; + rand_deg = degrees[type]; + rand_sep = seps[type]; + break; + default: + (void)fprintf(stderr, + "random: state info corrupted; not changed.\n"); + } + state = (long *) (new_state + 1); + if (rand_type != TYPE_0) { + rptr = &state[rear]; + fptr = &state[(rear + rand_sep) % rand_deg]; + } + end_ptr = &state[rand_deg]; /* set end_ptr too */ + return(ostate); +} + +/* + * random: + * + * If we are using the trivial TYPE_0 R.N.G., just do the old linear + * congruential bit. Otherwise, we do our fancy trinomial stuff, which is + * the same in all the other cases due to all the global variables that have + * been set up. The basic operation is to add the number at the rear pointer + * into the one at the front pointer. Then both pointers are advanced to + * the next location cyclically in the table. The value returned is the sum + * generated, reduced to 31 bits by throwing away the "least random" low bit. + * + * Note: the code takes advantage of the fact that both the front and + * rear pointers can't wrap on the same call by not testing the rear + * pointer if the front one has wrapped. + * + * Returns a 31-bit random number. + */ +long +random( void ) +{ + register long i; + register long *f, *r; + + if (rand_type == TYPE_0) { + i = state[0]; + state[0] = i = (good_rand(i)) & 0x7fffffff; + } else { + /* + * Use local variables rather than static variables for speed. + */ + f = fptr; r = rptr; + *f += *r; + i = (*f >> 1) & 0x7fffffff; /* chucking least random bit */ + if (++f >= end_ptr) { + f = state; + ++r; + } + else if (++r >= end_ptr) { + r = state; + } + + fptr = f; rptr = r; + } + return(i); +} diff --git a/contrib/ntp/libntp/recvbuff.c b/contrib/ntp/libntp/recvbuff.c index 96d212d..35c7e23 100644 --- a/contrib/ntp/libntp/recvbuff.c +++ b/contrib/ntp/libntp/recvbuff.c @@ -5,8 +5,8 @@ #include <stdio.h> #include "ntp_machine.h" #include "ntp_fp.h" -#include "ntp_stdlib.h" #include "ntp_syslog.h" +#include "ntp_stdlib.h" #include "ntp_io.h" #include "recvbuff.h" #include "iosignal.h" diff --git a/contrib/ntp/libntp/snprintf.c b/contrib/ntp/libntp/snprintf.c new file mode 100644 index 0000000..d65f6a9 --- /dev/null +++ b/contrib/ntp/libntp/snprintf.c @@ -0,0 +1,55 @@ +#include <config.h> + +#include <sys/types.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stdio.h> + +#ifdef __STDC__ +int snprintf(char *str, size_t n, const char *fmt, ...) +#else +int snprintf(str, n, fmt, va_alist) + char *str; + size_t n; + const char *fmt; + va_dcl +#endif +{ + va_list ap; + int rval; +#ifdef VSPRINTF_CHARSTAR + char *rp; +#endif +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif +#ifdef VSPRINTF_CHARSTAR + rp = vsprintf(str, fmt, ap); + va_end(ap); + return (strlen(rp)); +#else + rval = vsprintf(str, fmt, ap); + va_end(ap); + return (rval); +#endif +} + +int +vsnprintf(str, n, fmt, ap) + char *str; + size_t n; + const char *fmt; + va_list ap; +{ +#ifdef VSPRINTF_CHARSTAR + return (strlen(vsprintf(str, fmt, ap))); +#else + return (vsprintf(str, fmt, ap)); +#endif +} diff --git a/contrib/ntp/libntp/strdup.c b/contrib/ntp/libntp/strdup.c new file mode 100644 index 0000000..08ffc2f --- /dev/null +++ b/contrib/ntp/libntp/strdup.c @@ -0,0 +1,20 @@ + +#define NULL 0 + +char * +strdup( + const char *s + ) +{ + char *cp; + + if (s) { + cp = (char *) malloc((unsigned) (strlen(s)+1)); + if (cp) { + (void) strcpy(cp, s); + } + } else { + cp = (char *) NULL; + } + return(cp); +} diff --git a/contrib/ntp/libntp/systime.c b/contrib/ntp/libntp/systime.c index 2ef6ef9..e14a4d8 100644 --- a/contrib/ntp/libntp/systime.c +++ b/contrib/ntp/libntp/systime.c @@ -2,13 +2,13 @@ * systime -- routines to fiddle a UNIX clock. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include "ntp_proto.h" /* for MAX_FREQ */ +#include "ntp_machine.h" +#include "ntp_fp.h" +#include "ntp_syslog.h" +#include "ntp_unixtime.h" +#include "ntp_stdlib.h" -#include <stdio.h> -#include <sys/types.h> -#include <sys/time.h> #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif @@ -19,16 +19,8 @@ # include <utmpx.h> #endif /* HAVE_UTMPX_H */ -#include "ntp_machine.h" -#include "ntp_fp.h" -#include "ntp_syslog.h" -#include "ntp_unixtime.h" -#include "ntp_stdlib.h" - int systime_10ms_ticks = 0; /* adj sysclock in 10ms increments */ -#define MAXFREQ 500e-6 - /* * These routines (init_systime, get_systime, step_systime, adj_systime) * implement an interface between the (more or less) system independent @@ -36,7 +28,6 @@ int systime_10ms_ticks = 0; /* adj sysclock in 10ms increments */ * clock. */ double sys_residual = 0; /* residual from previous adjustment */ -double sys_maxfreq = MAXFREQ; /* max frequency correction */ /* @@ -140,8 +131,8 @@ adj_systime( } } else #endif - if (dtemp > sys_maxfreq) - dtemp = sys_maxfreq; + if (dtemp > NTP_MAXFREQ) + dtemp = NTP_MAXFREQ; dtemp = dtemp * 1e6 + .5; @@ -159,7 +150,8 @@ adj_systime( /* casey - we need a posix type thang here */ if (adjtime(&adjtv, &oadjtv) < 0) { - msyslog(LOG_ERR, "Can't adjust time: %m"); + msyslog(LOG_ERR, "Can't adjust time (%ld sec, %ld usec): %m", + (long)adjtv.tv_sec, (long)adjtv.tv_usec); return 0; } else { diff --git a/contrib/ntp/libntp/tvtoa.c b/contrib/ntp/libntp/tvtoa.c index 6bc72ac..19d4a94 100644 --- a/contrib/ntp/libntp/tvtoa.c +++ b/contrib/ntp/libntp/tvtoa.c @@ -1,16 +1,17 @@ /* * tvtoa - return an asciized representation of a struct timeval */ -#include <stdio.h> -#include <sys/time.h> #include "lib_strbuf.h" + #if defined(VMS) -#include "ntp_fp.h" +# include "ntp_fp.h" #endif /* VMS */ #include "ntp_stdlib.h" #include "ntp_unixtime.h" +#include <stdio.h> + char * tvtoa( const struct timeval *tv diff --git a/contrib/ntp/libntp/uglydate.c b/contrib/ntp/libntp/uglydate.c index fcd3d9f..676a5fd 100644 --- a/contrib/ntp/libntp/uglydate.c +++ b/contrib/ntp/libntp/uglydate.c @@ -8,9 +8,7 @@ #include "ntp_unixtime.h" #include "lib_strbuf.h" #include "ntp_stdlib.h" -#ifndef TM_IN_SYS_TIME -#include <time.h> -#endif + char * uglydate( diff --git a/contrib/ntp/libntp/utvtoa.c b/contrib/ntp/libntp/utvtoa.c index 79d14ef..a441c49 100644 --- a/contrib/ntp/libntp/utvtoa.c +++ b/contrib/ntp/libntp/utvtoa.c @@ -2,11 +2,11 @@ * utvtoa - return an asciized representation of an unsigned struct timeval */ #include <stdio.h> -#include <sys/time.h> #include "lib_strbuf.h" + #if defined(VMS) -#include "ntp_fp.h" +# include "ntp_fp.h" #endif #include "ntp_stdlib.h" #include "ntp_unixtime.h" |