diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/netdate.orig/Makefile netstd/netdate/Makefile
*** netstd.orig/netdate.orig/Makefile	Sun Jun 11 14:44:16 1995
--- netstd/netdate/Makefile	Sat Jul 29 12:15:22 1995
***************
*** 1,14 ****
! LDFLAGS += -N
! CFLAGS = $(O) -Wall
  
  all: netdate
  
  netdate: netdate.o
  
  install: netdate
! 	install -s -m 0755 netdate /sbin/netdate
! 	install -m 0644 netdate.8 /usr/man/man8
  
  clean:
! 	rm -f netdate *.o core
  
--- 1,15 ----
! LDFLAGS = -N -s
! CFLAGS = -O2 -fomit-frame-pointer -m486 -Wall
  
  all: netdate
  
  netdate: netdate.o
  
  install: netdate
! 	install -o root -g root -m 0755 netdate ${DEBDIR}/usr/sbin/netdate
! 	install -o root -g root -m 0644 netdate.8 ${DEBDIR}/usr/man/man8
! #	install -o root -g root -m 0644 COPYRIGHT ${DEBDIR}/usr/doc/copyright/netdate
  
  clean:
! 	rm -f netdate *~ *.o core
  
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/netdate.orig/netdate.8 netstd/netdate/netdate.8
*** netstd.orig/netdate.orig/netdate.8	Sat Jul 29 08:58:10 1995
--- netstd/netdate/netdate.8	Sat Jul 29 12:17:24 1995
***************
*** 53,92 ****
  if that host supplies it.
  .SH EXAMPLE
  The most accurate hosts are named first in each example.
! Some such call on \fInetdate\fP should be put at the end of \fB/etc/rc.local\fP,
  so that the time will be set properly on system startup.
! It is also useful to have a shell script, e.g., \fB/etc/timehosts\fP,
  which contains a call on \fInetdate\fP with arguments appropriate
  to the local system, so that it is easy to set the time manually.
! .SH "netdate -l 30 udp dcn\-gateway tcp neighbor"
! \fIDcn\-gateway\fP is a hypothetical host which usually keeps time
  accurate to within milliseconds of Coordinated Universal Time,
  but may occasionally be eight hours off.
  \fINeighbor\fP is a neighbor of the local host which keeps time
  with moderate accuracy.
! The time will be set to that of \fIdcn\-gateway\fP if that and \fIneighbor\fP
  agree to within thirty seconds, else it will not be set at all.
  This is almost good enough for most circumstances, but won't do
  when the local host's time is known to be wrong (e.g., after
  a long downtime or a bad crash) and must be set to something.
  If one of the hosts named is inaccurate or not responding, there is a problem.
! .SH "netdate -l 30 udp dcn\-gateway tcp neighbor neighbor2"
  Only two of the three hosts named must agree on the time.
  The time will still be set (to that of the first neighbor),
! even if \fIdcn\-gateway\fP is far off as long as the two neighbors agree.
  This is probably good enough for most cases.
  One can arbitrarily gerrymander the vote for more insurance
  (and less clarity), as in the following example.
! .SH "netdate\ udp\ dcn\-gateway\ dcn1\ tcp\ bbn\-unix\ localhost\ neighbor"
  Here \fIdcn1\fP and \fIbbn\-unix\fP are more hypothetical very accurate
  timekeepers, at least one of which keeps time independently from
! \fIdcn\-gateway\fP, one hopes.
  It is very likely that the time will be set to that one of those three
  very accurate hosts, as long as at least two of them agree, or at least
  one of them agrees with the neighbor or the local host's time.
  If all the foreign hosts disagree, the time will not be set,
  since \fBlocalhost\fP will be chosen as best.
! .SH "netdate\ \-l\ 3\ localhost\ localhost\ udp\ dcn\-gateway\ dcn1\ tcp\ bbn\-unix"
  This example gives \fBlocalhost\fP two votes and declares it to usually
  have the most accurate time.
  All three foreign hosts must agree within three seconds
--- 53,93 ----
  if that host supplies it.
  .SH EXAMPLE
  The most accurate hosts are named first in each example.
! Some such call on \fInetdate\fP should be put at the end of
! \fB/etc/rc.d/rc.local\fP,
  so that the time will be set properly on system startup.
! It is also useful to have a shell script, e.g., \fB/sbin/timehosts\fP,
  which contains a call on \fInetdate\fP with arguments appropriate
  to the local system, so that it is easy to set the time manually.
! .SH "netdate -l 30 udp dcn\-gate tcp neighbor"
! \fIDcn\-gate\fP is a hypothetical host which usually keeps time
  accurate to within milliseconds of Coordinated Universal Time,
  but may occasionally be eight hours off.
  \fINeighbor\fP is a neighbor of the local host which keeps time
  with moderate accuracy.
! The time will be set to that of \fIdcn\-gate\fP if that and \fIneighbor\fP
  agree to within thirty seconds, else it will not be set at all.
  This is almost good enough for most circumstances, but won't do
  when the local host's time is known to be wrong (e.g., after
  a long downtime or a bad crash) and must be set to something.
  If one of the hosts named is inaccurate or not responding, there is a problem.
! .SH "netdate -l 30 udp dcn\-gate tcp neighbor neighbor2"
  Only two of the three hosts named must agree on the time.
  The time will still be set (to that of the first neighbor),
! even if \fIdcn\-gate\fP is far off as long as the two neighbors agree.
  This is probably good enough for most cases.
  One can arbitrarily gerrymander the vote for more insurance
  (and less clarity), as in the following example.
! .SH "netdate\ udp\ dcn\-gate\ dcn1\ tcp\ bbn\-unix\ localhost\ neighbor"
  Here \fIdcn1\fP and \fIbbn\-unix\fP are more hypothetical very accurate
  timekeepers, at least one of which keeps time independently from
! \fIdcn\-gate\fP, one hopes.
  It is very likely that the time will be set to that one of those three
  very accurate hosts, as long as at least two of them agree, or at least
  one of them agrees with the neighbor or the local host's time.
  If all the foreign hosts disagree, the time will not be set,
  since \fBlocalhost\fP will be chosen as best.
! .SH "netdate\ \-l\ 3\ localhost\ localhost\ udp\ dcn\-gate\ dcn1\ tcp\ bbn\-unix"
  This example gives \fBlocalhost\fP two votes and declares it to usually
  have the most accurate time.
  All three foreign hosts must agree within three seconds
***************
*** 95,103 ****
  Thus the time will be set only if it really needs to be.
  .SH FILES
  .nf
! /etc/inet/services	for the time service port number
! /etc/inet/protocols	for the protocol numbers
! /etc/wtmp	to record time-setting
  .SH SEE ALSO
  ARPANET Request for Comments 868, gettimeofday(2), date(1),
  WWV (USA):
--- 96,104 ----
  Thus the time will be set only if it really needs to be.
  .SH FILES
  .nf
! /etc/services	for the time service port number
! /etc/protocols	for the protocol numbers
! /var/log/wtmp	to record time-setting
  .SH SEE ALSO
  ARPANET Request for Comments 868, gettimeofday(2), date(1),
  WWV (USA):
diff -c -P --recursive --exclude=COPYRIGHT --exclude=COPYING netstd.orig/netdate.orig/netdate.c netstd/netdate/netdate.c
*** netstd.orig/netdate.orig/netdate.c	Sat Jul 29 08:58:44 1995
--- netstd/netdate/netdate.c	Sat Jul 29 12:19:15 1995
***************
*** 42,48 ****
  #include <setjmp.h>
  #include <signal.h>
  #include <utmp.h>
! #define WTMP "/etc/wtmp"
  
  struct utmp wtmp[2] = {
  	{ 0, 0, "|", "", 0, "", "", 0},
--- 42,48 ----
  #include <setjmp.h>
  #include <signal.h>
  #include <utmp.h>
! #define WTMP "/var/log/wtmp"
  
  struct utmp wtmp[2] = {
  	{ 0, 0, "|", "", 0, "", "", 0},
***************
*** 52,58 ****
  char *service = "time";
  char *defaultproto = "udp";
  /* difference between 1900 (RFC868) and 1970 (UNIX) base times */
! #define NETBASE	2208988800
  
  long limit = 5;
  #define MAXHOSTS 20
--- 52,58 ----
  char *service = "time";
  char *defaultproto = "udp";
  /* difference between 1900 (RFC868) and 1970 (UNIX) base times */
! #define NETBASE	2208988800u
  
  long limit = 5;
  #define MAXHOSTS 20
***************
*** 98,104 ****
  	fprintf (stderr,
  "usage: %s [ -l limit ] host ...\n"
  "%s tries to find a group of at least two hosts whose times agree\n"
! "within %d seconds, and sets the time to that of the first host in the group.\n",
  		whoami, whoami, limit);
  	fprintf (stderr,
  "The limit may be set with the -l option.  Setting it to zero (or supplying\n"
--- 98,104 ----
  	fprintf (stderr,
  "usage: %s [ -l limit ] host ...\n"
  "%s tries to find a group of at least two hosts whose times agree\n"
! "within %ld seconds, and sets the time to that of the first host in the group.\n",
  		whoami, whoami, limit);
  	fprintf (stderr,
  "The limit may be set with the -l option.  Setting it to zero (or supplying\n"
***************
*** 155,161 ****
  	if (*argv == NULL)
  		usage();
  	if (debug)
! 		fprintf (stderr, "%s: rdate %d; verbose %d; limit %d.\n", 
  			whoami, rdate, verbose, limit);
  	for (thishost = &timehosts[0]; *argv != NULL; argv++) {
  		if (thishost >= tophost) {
--- 155,161 ----
  	if (*argv == NULL)
  		usage();
  	if (debug)
! 		fprintf (stderr, "%s: rdate %d; verbose %d; limit %ld.\n", 
  			whoami, rdate, verbose, limit);
  	for (thishost = &timehosts[0]; *argv != NULL; argv++) {
  		if (thishost >= tophost) {
***************
*** 189,195 ****
  		exit(1);
  	if ((thishost = mungediffs(thishost)) == NULL) {
  		fprintf (stderr,
! 			"No two hosts agree on the time within %d seconds\n",
  			limit);
  		exit(1);
  	}
--- 189,195 ----
  		exit(1);
  	if ((thishost = mungediffs(thishost)) == NULL) {
  		fprintf (stderr,
! 			"No two hosts agree on the time within %ld seconds\n",
  			limit);
  		exit(1);
  	}
***************
*** 284,290 ****
  			}
  		}
  		if (verbose) {
! 			printf (" %d\n", thishost -> count);
  			(void)fflush(stdout);
  		}
  		if (thishost -> count > goodhost -> count)
--- 284,290 ----
  			}
  		}
  		if (verbose) {
! 			printf (" %ld\n", thishost -> count);
  			(void)fflush(stdout);
  		}
  		if (thishost -> count > goodhost -> count)
***************
*** 312,324 ****
  	&& abs((thishost -> then.tv_sec - now.tv_sec) - thishost -> difference)
  	    > limit) {
  		fprintf (stderr,
! 		"Time from %s has varied more than the limit of %d seconds\n",
  			thishost -> hostname, limit);
  		printit(thishost);
  		exit(1);
  	}
  	if (settimeofday (&thishost -> then, (struct timezone *)0) == -1)
! 		perror ("netdate; settimeofday");
  	else {
  		int wf;
  		if ((wf = open(WTMP, 1)) >= 0) {
--- 312,324 ----
  	&& abs((thishost -> then.tv_sec - now.tv_sec) - thishost -> difference)
  	    > limit) {
  		fprintf (stderr,
! 		"Time from %s has varied more than the limit of %ld seconds\n",
  			thishost -> hostname, limit);
  		printit(thishost);
  		exit(1);
  	}
  	if (settimeofday (&thishost -> then, (struct timezone *)0) == -1)
! 		perror ("netdate: settimeofday");
  	else {
  		int wf;
  		if ((wf = open(WTMP, 1)) >= 0) {
***************
*** 348,359 ****
  		(void)sprintf(newstring, "%s ", thishost -> hostname);
  		tvsub(&diff, &thishost -> then, &now);
  		printdiff(&newstring[strlen(newstring)], &diff);
! 		printf ("%-24s %.19s.%03d", newstring,
  			ctime((unsigned long *)&thishost -> then.tv_sec),
  				thishost -> then.tv_usec / 1000);
  		if (verbose) {
  			tp = localtime((unsigned long *)&thishost -> acked);
! 			printf(" at %02d:%02d:%02d.%03d",
  				tp -> tm_hour, tp -> tm_min, tp -> tm_sec,
  				thishost -> acked.tv_usec / 1000);
  			tvsub(&diff, &thishost -> acked, &thishost -> asked);
--- 348,359 ----
  		(void)sprintf(newstring, "%s ", thishost -> hostname);
  		tvsub(&diff, &thishost -> then, &now);
  		printdiff(&newstring[strlen(newstring)], &diff);
! 		printf ("%-24s %.19s.%03ld", newstring,
  			ctime((unsigned long *)&thishost -> then.tv_sec),
  				thishost -> then.tv_usec / 1000);
  		if (verbose) {
  			tp = localtime((unsigned long *)&thishost -> acked);
! 			printf(" at %02d:%02d:%02d.%03ld",
  				tp -> tm_hour, tp -> tm_min, tp -> tm_sec,
  				thishost -> acked.tv_usec / 1000);
  			tvsub(&diff, &thishost -> acked, &thishost -> asked);
