From: maer@nmr.lpc.ethz.ch (Matthias Ernst)
Newsgroups: comp.protocols.time.ntp
Subject: Patch and Configfiles for xntp3
Date: 18 Aug 92 12:37:40 GMT
Distribution: inet
Organization: The Internet

Hi Dave,

I have a patch for the newest version (16 August 1992) of xntp3.
There is a problem with the formatting of the output in ntpq if
you run a command with multiple hosts on the commandline like
"ntpq -p ...". If the names are aliases and the full hostname is
longer the format gets mixed up. The patch fixes this problem by
doing a hostnamelookup before determining the length of the name.

I have also updated/created a Config/README file for the RS6000 
and for Silicon Graphics SGI machines. You will find the files 
Config.rs6000, Config.sgi and README.sgi attached to this mail.
The Config file for the SGI works at least for IRIX 4.0.1, but 
I have not tested the special features like local clock support.
For the SGI no change of the source code was required.

Please include this in the general distribution.

Thanks

Matthias

--------------------------------------------------------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  Config.sgi README.sgi Config.rs6000 patchfile
# Wrapped by maer@curie on Tue Aug 18 14:33:15 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Config.sgi' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Config.sgi'\"
else
echo shar: Extracting \"'Config.sgi'\" \(6809 characters\)
sed "s/^X//" >'Config.sgi' <<'END_OF_FILE'
X# Edit this file to reflect information specific to your installation.
X# Then run 'make makefiles' to propagate the information to all the makefiles,
X
X#
X# Definitions for the library:
X#
X# You must define one of -DXNTP_BIG_ENDIAN, -DXNTP_LITTLE_ENDIAN
X#       or -DXNTP_AUTO_ENDIAN depending on which way your machine's
X#       bytes go for the benefit of the DES routine.  Most things
X#       sold by DEC, the NS32x32 and the 80386 deserve a
X#       -DXNTP_LITTLE_ENDIAN.  Most of the rest of the world does
X#       it the other way.  If in doubt, pick one, compile
X#       everything and run authstuff/authcert < authstuff/certdata.
X#       If everything fails, do it the other way.
X#
X#       Under BSD, you may define -DXNTP_NETINET_ENDIAN to use
X#       netinet/in.h to determine which of -DXNTP_BIG_ENDIAN and
X#       XNTP_LITTLE_ENDIAN should be used.
X#
XLIBDEFS= -DXNTP_AUTO_ENDIAN
X
X#
X# Library loading:
X#
X# If you don't want your library ranlib'ed, chose the second line
X#
X#RANLIB=		ranlib
XRANLIB=	ls # ar does the work of ranlib under System V
X
X#
X# Definitions for programs:
X# 
X# If your compiler doesn't understand the declaration `signed char',
X#       add -DNO_SIGNED_CHAR_DECL.  Your `char' data type had better be
X#	signed.  If you don't know what the compiler knows, try it
X#	without the flag.  If you get a syntax error on line 13 of
X#	ntp.h, add it.  Note that `signed char' is an ANSIism.  Most
X#	older, pcc-derived compilers will need this flag.
X#
X# If your library already has 's_char' defined, add -DS_CHAR_DEFINED.
X#
X# For SunOS 3.x, add -DSUN_3_3_STINKS (otherwise it will complain
X#	about broadaddr and will hang if you run without a -d flag
X#	on the command line.  I actually can't believe the latter
X#	bug.  If it hangs on your system with the flag defined, peruse
X#	xntpd/ntp_io.c for some rude comments about SunOS 3.5 and try it
X#	the other way).  This flag affects xntpd only.
X#
X# For Ultrix 2.0, add -DULT_2_0_SUCKS.  This OS has the same hanging
X#	bug as SunOS 3.5 (is this an original 4.2 bug?) and in addition
X#	has some strangeness concerning signal masks.  Ultrix 2.3 doesn't
X#	have these problems.  If you're running something in between
X#	you're on your own.  This flag affects xntpd only.
X#
X# For SunOS 4.x, add -DDOSYNCTODR_SUCKS to include the code in ntp_util.c
X#	that sets the battery clock at the same time that it updates
X#	the driftfile. It does this by revving up the niceness, then
X#	sets the time of day to the current time of day. Ordinarily,
X#	you would need this only on non-networked machines.
X#
X# There are three ways to pry loose the kernel variables tick and tickadj
X#	needed by ntp_unixclock.c.  One reads kmem and and is enabled
X#	with -DREADKMEM.  One uses Sun's libkvm and is enabled with
X#	-DUSELIBKVM. The last one uses builtin defaults and is enabled
X#	with -DNOKMEM. Therefore, one of -DUSELIBKVM, -DREADKMEM or
X#	-DNOKMEM must be defined. Suns and recent BSD should use
X#	-DUSELIBKVM; others should use -DREADKMEM. If -DUSELIBKVM, use
X#	the DAEMONLIBS below to get the kernel routines.
X#
X# If your gethostbyname() routine isn't based on the DNS resolver (and,
X#	in particular, h_errno doesn't exist) add a -DNODNS.  There
X#	doesn't seem to be a good way to detect this automatically which
X#	works in all cases.  This flag affects xntpres only.
X#
X# The flag -DDEBUG includes some debugging code.
X#
X# The flag -DREFCLOCK causes the basic reference clock support to be
X#	compiled into the daemon.  If you set this you will also want
X#	to configure the particular clock drivers you want in the
X#	CLOCKDEFS= line below.  This flag affects xntpd only.
X#
X# There is an occurance of a call to rindex() in the daemon.  You may
X#	have to include a -Drindex=strrchr to get this to load right.
X#
X# To change the location of the configuration file, use a
X#	-DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar.
X#
X# Under HP-UX, you must use either -Dhpux70 or -Dhpux80 as,
X#	well as -DNOKMEM
X#
X# If your library doesn't include the vsprintf() routine, define
X#	NEED_VSPRINTF.
X#
X# Define -DPPS to include support for a 1-pps signal. Define -DPPSDEV
X#	to include a device driver for it. The latter requires a
X#	serial port and either a line discipline or STREAMS module.
X#	The PPS signal may also be generated via a reference clock
X#	module like DCF77. In that case a special define is required for
X#	the reference clock module (only one source of PPS signal should
X#	be used)
X#
X# Define -D_BSD_SIGNALS for SGI IRIX 4.1 and NOKMEM
X#
XDEFS= -DREFCLOCK -DNOKMEM -DDEBUG -D_BSD_SIGNALS
X
X#
X#  Authentication types supported.  Choose from DES and MD5.  If you
X#  have a 680x0 type CPU and GNU-C, also choose -DFASTMD5
X#
XAUTHDEFS=-DDES -DMD5
X
X#
X# Clock support definitions (these only make sense if -DREFCLOCK used):
X#
X# Define -DLOCAL_CLOCK to include local pseudo-clock support
X#
X# Define -DPST to include support for the PST 1020 WWV/H receiver.
X#
X# Define -DWWVB to include support for the Spectracom 8170 WWVB receiver.
X#
X# Define -DCHU to include support for a driver to receive the CHU
X#	timecode.  Note that to compile in CHU support you must
X#	previously have installed the CHU serial line discipline in
X#	the kernel of the machine you are doing the compile on.
X#
X# Define -DDCF to include support for the DCF77 receiver. This code
X#	requires a special STREAMS module found in the kernel directory.
X# Define -DDCFPPS for PPS support via the DCF77 receiver
X#	(see also: -DPPS)
X#
X# Define -DGOES to support a Kinemetrics TrueTime 468-DC GOES receiver.
X#
XCLOCKDEFS= -DLOCAL_CLOCK
X
X#
X# For MIPS 4.3BSD or RISCos 4.0, include a -lmld to get the nlist() routine.
X#	If USELIBKVM is defined above, include a -lkvm to get the kernel
X#	routines.
X#
XDAEMONLIBS= -lmld
X#DAEMONLIBS= -lkvm
X#DAEMONLIBS=
X
X#
X# Name resolver library.  Included when loading xntpres, which calls
X# gethostbyname().  Define this if you would rather use a different
X# version of the routine than the one in libc.a
X#
X#RESLIB= -lresolv
XRESLIB=
X
X#
X# Option flags for the C compiler.  A -g if you are uncomfortable
X#
XCOPTS= -cckr -O
X
X#
X# C compiler to use.  gcc will work, but avoid the -fstrength-reduce option
X# if the version is 1.35 or earlier (using this option caused incorrect
X# code to be generated in the DES key permutation code, and perhaps
X# elsewhere).
X#
XCOMPILER= cc
X
X#
X# Directory into which binaries should be installed
X#
XBINDIR=	/usr/local
X
X#
X# Special library for adjtime emulation. Used under HP-UX
X# (remember to run make in the adjtime directory)
X#
X#ADJLIB= ../adjtime/libadjtime.a
XADJLIB=
X
X#
X# BSD emulation library. In theory, this fixes signal semantics under
X# HP-UX, but it doesn't work with 8.0 on a 9000s340, so there is now
X# a work-around in the code (compiled when hpux80 is defined). In other
X# words, use this for HP-UX prior to 8.0.
X#
X#COMPAT= -lBSD
XCOMPAT=
X
END_OF_FILE
if test 6809 -ne `wc -c <'Config.sgi'`; then
    echo shar: \"'Config.sgi'\" unpacked with wrong size!
fi
# end of 'Config.sgi'
fi
if test -f 'README.sgi' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README.sgi'\"
else
echo shar: Extracting \"'README.sgi'\" \(540 characters\)
sed "s/^X//" >'README.sgi' <<'END_OF_FILE'
XThe config file for the SGI works for IRIX Release 4.0.1. It uses the BSD
Xcompatibility mode (-D_BSD_SIGNALS) for signal handling and the hardwired
Xvalues for tick and tickadj (-DNOKMEM). I tested ntpq xntpdc and xntpd but
Xnone of the special features. Local clock support is untested.
XSet DAEMONLIBS to -lmld  in order to make nlist work.
XNo changes in the source code were required.
XOne problem is that make clean doesn't work. Make complains about no match
Xand aborts.
X
XMatthias Ernst, ETH-Zuerich, Switzerland  -  maer@nmr.lpc.ethz.ch
X
END_OF_FILE
if test 540 -ne `wc -c <'README.sgi'`; then
    echo shar: \"'README.sgi'\" unpacked with wrong size!
fi
# end of 'README.sgi'
fi
if test -f 'Config.rs6000' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Config.rs6000'\"
else
echo shar: Extracting \"'Config.rs6000'\" \(6768 characters\)
sed "s/^X//" >'Config.rs6000' <<'END_OF_FILE'
X# Edit this file to reflect information specific to your installation.
X# Then run 'make makefiles' to propagate the information to all the makefiles,
X
X#
X# Definitions for the library:
X#
X# You must define one of -DXNTP_BIG_ENDIAN, -DXNTP_LITTLE_ENDIAN
X#       or -DXNTP_AUTO_ENDIAN depending on which way your machine's
X#       bytes go for the benefit of the DES routine.  Most things
X#       sold by DEC, the NS32x32 and the 80386 deserve a
X#       -DXNTP_LITTLE_ENDIAN.  Most of the rest of the world does
X#       it the other way.  If in doubt, pick one, compile
X#       everything and run authstuff/authcert < authstuff/certdata.
X#       If everything fails, do it the other way.
X#
X#       Under BSD, you may define -DXNTP_NETINET_ENDIAN to use
X#       netinet/in.h to determine which of -DXNTP_BIG_ENDIAN and
X#       XNTP_LITTLE_ENDIAN should be used.
X#
XLIBDEFS= -DXNTP_AUTO_ENDIAN -DRS6000
X
X#
X# Library loading:
X#
X# If you don't want your library ranlib'ed, chose the second line
X#
X#RANLIB=		ranlib
XRANLIB=	: # ar does the work of ranlib under System V
X
X#
X# Definitions for programs:
X# 
X# If your compiler doesn't understand the declaration `signed char',
X#       add -DNO_SIGNED_CHAR_DECL.  Your `char' data type had better be
X#	signed.  If you don't know what the compiler knows, try it
X#	without the flag.  If you get a syntax error on line 13 of
X#	ntp.h, add it.  Note that `signed char' is an ANSIism.  Most
X#	older, pcc-derived compilers will need this flag.
X#
X# If your library already has 's_char' defined, add -DS_CHAR_DEFINED.
X#
X# For SunOS 3.x, add -DSUN_3_3_STINKS (otherwise it will complain
X#	about broadaddr and will hang if you run without a -d flag
X#	on the command line.  I actually can't believe the latter
X#	bug.  If it hangs on your system with the flag defined, peruse
X#	xntpd/ntp_io.c for some rude comments about SunOS 3.5 and try it
X#	the other way).  This flag affects xntpd only.
X#
X# For Ultrix 2.0, add -DULT_2_0_SUCKS.  This OS has the same hanging
X#	bug as SunOS 3.5 (is this an original 4.2 bug?) and in addition
X#	has some strangeness concerning signal masks.  Ultrix 2.3 doesn't
X#	have these problems.  If you're running something in between
X#	you're on your own.  This flag affects xntpd only.
X#
X# For SunOS 4.x, add -DDOSYNCTODR_SUCKS to include the code in ntp_util.c
X#	that sets the battery clock at the same time that it updates
X#	the driftfile. It does this by revving up the niceness, then
X#	sets the time of day to the current time of day. Ordinarily,
X#	you would need this only on non-networked machines.
X#
X# There are three ways to pry loose the kernel variables tick and tickadj
X#	needed by ntp_unixclock.c.  One reads kmem and and is enabled
X#	with -DREADKMEM.  One uses Sun's libkvm and is enabled with
X#	-DUSELIBKVM. The last one uses builtin defaults and is enabled
X#	with -DNOKMEM. Therefore, one of -DUSELIBKVM, -DREADKMEM or
X#	-DNOKMEM must be defined. Suns and recent BSD should use
X#	-DUSELIBKVM; others should use -DREADKMEM. If -DUSELIBKVM, use
X#	the DAEMONLIBS below to get the kernel routines.
X#
X# If your gethostbyname() routine isn't based on the DNS resolver (and,
X#	in particular, h_errno doesn't exist) add a -DNODNS.  There
X#	doesn't seem to be a good way to detect this automatically which
X#	works in all cases.  This flag affects xntpres only.
X#
X# The flag -DDEBUG includes some debugging code.
X#
X# The flag -DREFCLOCK causes the basic reference clock support to be
X#	compiled into the daemon.  If you set this you will also want
X#	to configure the particular clock drivers you want in the
X#	CLOCKDEFS= line below.  This flag affects xntpd only.
X#
X# There is an occurance of a call to rindex() in the daemon.  You may
X#	have to include a -Drindex=strrchr to get this to load right.
X#
X# To change the location of the configuration file, use a
X#	-DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar.
X#
X# Under HP-UX, you must use either -Dhpux70 or -Dhpux80 as,
X#	well as -DNOKMEM
X#
X# If your library doesn't include the vsprintf() routine, define
X#	NEED_VSPRINTF.
X#
X# Define -DPPS to include support for a 1-pps signal. Define -DPPSDEV
X#	to include a device driver for it. The latter requires a
X#	serial port and either a line discipline or STREAMS module.
X#	The PPS signal may also be generated via a reference clock
X#	module like DCF77. In that case a special define is required for
X#	the reference clock module (only one source of PPS signal should
X#	be used)
X#
XDEFS= -DREFCLOCK -DNOKMEM -DRS6000 -DBIGTIMESTEP -DDEBUG
X
X#
X#  Authentication types supported.  Choose from DES and MD5.  If you
X#  have a 680x0 type CPU and GNU-C, also choose -DFASTMD5
X#
XAUTHDEFS=-DDES -DMD5
X
X#
X# Clock support definitions (these only make sense if -DREFCLOCK used):
X#
X# Define -DLOCAL_CLOCK to include local pseudo-clock support
X#
X# Define -DPST to include support for the PST 1020 WWV/H receiver.
X#
X# Define -DWWVB to include support for the Spectracom 8170 WWVB receiver.
X#
X# Define -DCHU to include support for a driver to receive the CHU
X#	timecode.  Note that to compile in CHU support you must
X#	previously have installed the CHU serial line discipline in
X#	the kernel of the machine you are doing the compile on.
X#
X# Define -DDCF to include support for the DCF77 receiver. This code
X#	requires a special STREAMS module found in the kernel directory.
X# Define -DDCFPPS for PPS support via the DCF77 receiver
X#	(see also: -DPPS)
X#
X# Define -DGOES to support a Kinemetrics TrueTime 468-DC GOES receiver.
X#
XCLOCKDEFS= -DLOCAL_CLOCK
X
X#
X# For MIPS 4.3BSD or RISCos 4.0, include a -lmld to get the nlist() routine.
X#	If USELIBKVM is defined above, include a -lkvm to get the kernel
X#	routines.
X#
X#DAEMONLIBS= -lmld
X#DAEMONLIBS= -lkvm
XDAEMONLIBS=
X
X#
X# Name resolver library.  Included when loading xntpres, which calls
X# gethostbyname().  Define this if you would rather use a different
X# version of the routine than the one in libc.a
X#
X#RESLIB= -lresolv
XRESLIB=
X
X#
X# Option flags for the C compiler.  A -g if you are uncomfortable
X#
XCOPTS= -O
X
X#
X# C compiler to use.  gcc will work, but avoid the -fstrength-reduce option
X# if the version is 1.35 or earlier (using this option caused incorrect
X# code to be generated in the DES key permutation code, and perhaps
X# elsewhere).
X#
XCOMPILER= bsdcc
X
X#
X# Directory into which binaries should be installed
X#
XBINDIR=	/usr/local
X
X#
X# Special library for adjtime emulation. Used under HP-UX
X# (remember to run make in the adjtime directory)
X#
X#ADJLIB= ../adjtime/libadjtime.a
XADJLIB=
X
X#
X# BSD emulation library. In theory, this fixes signal semantics under
X# HP-UX, but it doesn't work with 8.0 on a 9000s340, so there is now
X# a work-around in the code (compiled when hpux80 is defined). In other
X# words, use this for HP-UX prior to 8.0.
X#
X#COMPAT= -lBSD
XCOMPAT=
X
END_OF_FILE
if test 6768 -ne `wc -c <'Config.rs6000'`; then
    echo shar: \"'Config.rs6000'\" unpacked with wrong size!
fi
# end of 'Config.rs6000'
fi
if test -f 'patchfile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patchfile'\"
else
echo shar: Extracting \"'patchfile'\" \(1142 characters\)
sed "s/^X//" >'patchfile' <<'END_OF_FILE'
X*** ntpq/ntpq_ops.c	Tue Aug 18 14:23:09 1992
X--- ntpq/ntpq_ops.c.orig	Tue Aug 18 14:06:22 1992
X***************
X*** 127,133 ****
X   * Variable list data space
X   */
X  #define	MAXLIST		64	/* maximum number of variables in list */
X- #define	LENHOSTNAME	256	/* host name is 256 characters long */
X  /*
X   * Old CTL_PST defines for version 2.
X   */
X--- 127,132 ----
X***************
X*** 1465,1483 ****
X  	FILE *fp;
X  {
X  	register int i;
X- 	extern int getnetnum();
X- 	char fullname[LENHOSTNAME];
X- 	u_long netnum;
X  
X- 
X  	if (!dogetassoc(fp))
X  		return;
X  
X  	for (i = 0; i < numhosts; ++i)
X! 	{ if(getnetnum(chosts[i],&netnum,fullname))
X! 		if (strlen(fullname) > maxhostlen)
X! 			maxhostlen = strlen(fullname);
X! 	}
X  	if (numhosts > 1)
X  		(void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host");
X  	(void) fprintf(fp,
X--- 1464,1476 ----
X  	FILE *fp;
X  {
X  	register int i;
X  
X  	if (!dogetassoc(fp))
X  		return;
X  
X  	for (i = 0; i < numhosts; ++i)
X! 		if (strlen(chosts[i]) > maxhostlen)
X! 			maxhostlen = strlen(chosts[i]);
X  	if (numhosts > 1)
X  		(void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host");
X  	(void) fprintf(fp,
END_OF_FILE
if test 1142 -ne `wc -c <'patchfile'`; then
    echo shar: \"'patchfile'\" unpacked with wrong size!
fi
# end of 'patchfile'
fi
echo shar: End of shell archive.
exit 0

+-----------------------------------------------------------------------------+
| Matthias Ernst                          Domain: maer@nmr.lpc.ethz.ch        |
| Institut fuer physikalische Chemie      Bitnet: maer@czheth5a.bitnet        |
| Eidgenoessische Technische Hochschule   UUCP:   ...!mcsun!chx400!ethz!maer  |
| ETH-Zentrum                             Phone:  +41/1/256-4374              |
| CH-8092 Zuerich                         Fax:    +41/1/252-3402              |
+-----------------------------------------------------------------------------+

Newsgroups: comp.protocols.time.ntp