FreeBSD/contrib/ntp/ntpdate/ntpdate.c
/* XXX ELIMINATE printserver similar in ntptrace.c, ntpdate.c */
/*
 * printserver - print detail information for a server
 */
XXX ELIMINATE printserver similar in ntptrace.c, ntpdate.c
printserver - print detail information for a server
XXX ELIMINATE printserver similar in ntptrace . c ntpdate . c printserver - print detail information for a server
static void
printserver(
	register struct server *pp,
	FILE *fp
	)
{
	register int i;
	char junk[5];
	const char *str;
	if (!debug) {
		(void) fprintf(fp, "server %s, stratum %d, offset %s, delay %s\n",
				   stoa(&pp->srcadr), pp->stratum,
				   lfptoa(&pp->offset, 6), fptoa((s_fp)pp->delay, 5));
		return;
	}
	(void) fprintf(fp, "server %s, port %d\n",
			   stoa(&pp->srcadr), ntohs(((struct sockaddr_in*)&(pp->srcadr))->sin_port));
	(void) fprintf(fp, "stratum %d, precision %d, leap %c%c, trust %03o\n",
			   pp->stratum, pp->precision,
			   pp->leap & 0x2 ? '1' : '0',
			   pp->leap & 0x1 ? '1' : '0',
			   pp->trust);
	if (pp->stratum == 1) {
		junk[4] = 0;
		memmove(junk, (char *)&pp->refid, 4);
		str = junk;
	} else {
		str = stoa(&pp->srcadr);
	}
	(void) fprintf(fp,
			   "refid [%s], delay %s, dispersion %s\n",
			   str, fptoa((s_fp)pp->delay, 5),
			   ufptoa(pp->dispersion, 5));
	(void) fprintf(fp, "transmitted %d, in filter %d\n",
			   pp->xmtcnt, pp->filter_nextpt);
	(void) fprintf(fp, "reference time:    %s\n",
			   prettydate(&pp->reftime));
	(void) fprintf(fp, "originate timestamp: %s\n",
			   prettydate(&pp->org));
	(void) fprintf(fp, "transmit timestamp:  %s\n",
			   prettydate(&pp->xmt));
	(void) fprintf(fp, "filter delay: ");
	for (i = 0; i < NTP_SHIFT; i++) {
		(void) fprintf(fp, " %-8.8s", fptoa(pp->filter_delay[i], 5));
		if (i == (NTP_SHIFT>>1)-1)
			(void) fprintf(fp, "\n        ");
	}
	(void) fprintf(fp, "\n");
	(void) fprintf(fp, "filter offset:");
	for (i = 0; i < PEER_SHIFT; i++) {
		(void) fprintf(fp, " %-8.8s", lfptoa(&pp->filter_offset[i], 6));
		if (i == (PEER_SHIFT>>1)-1)
			(void) fprintf(fp, "\n        ");
	}
	(void) fprintf(fp, "\n");
	(void) fprintf(fp, "delay %s, dispersion %s\n",
			   fptoa((s_fp)pp->delay, 5), ufptoa(pp->dispersion, 5));
	(void) fprintf(fp, "offset %s\n\n",
			   lfptoa(&pp->offset, 6));
}
static void printserver ( register struct server * pp , FILE * fp ) { register int i ; char junk [ 5 ] ; const char * str ; if ( ! debug ) { ( void ) fprintf ( fp , " \n " , stoa ( & pp -> srcadr ) , pp -> stratum , lfptoa ( & pp -> offset , 6 ) , fptoa ( ( s_fp ) pp -> delay , 5 ) ) ; return ; } ( void ) fprintf ( fp , " \n " , stoa ( & pp -> srcadr ) , ntohs ( ( ( struct sockaddr_in * ) & ( pp -> srcadr ) ) -> sin_port ) ) ; ( void ) fprintf ( fp , " \n " , pp -> stratum , pp -> precision , pp -> leap & 0x2 ? ' ' : ' ' , pp -> leap & 0x1 ? ' ' : ' ' , pp -> trust ) ; if ( pp -> stratum == 1 ) { junk [ 4 ] = 0 ; memmove ( junk , ( char * ) & pp -> refid , 4 ) ; str = junk ; } else { str = stoa ( & pp -> srcadr ) ; } ( void ) fprintf ( fp , " \n " , str , fptoa ( ( s_fp ) pp -> delay , 5 ) , ufptoa ( pp -> dispersion , 5 ) ) ; ( void ) fprintf ( fp , " \n " , pp -> xmtcnt , pp -> filter_nextpt ) ; ( void ) fprintf ( fp , " \n " , prettydate ( & pp -> reftime ) ) ; ( void ) fprintf ( fp , " \n " , prettydate ( & pp -> org ) ) ; ( void ) fprintf ( fp , " \n " , prettydate ( & pp -> xmt ) ) ; ( void ) fprintf ( fp , " " ) ; for ( i = 0 ; i < NTP_SHIFT ; i ++ ) { ( void ) fprintf ( fp , " " , fptoa ( pp -> filter_delay [ i ] , 5 ) ) ; if ( i == ( NTP_SHIFT >> 1 ) - 1 ) ( void ) fprintf ( fp , " \n " ) ; } ( void ) fprintf ( fp , " \n " ) ; ( void ) fprintf ( fp , " " ) ; for ( i = 0 ; i < PEER_SHIFT ; i ++ ) { ( void ) fprintf ( fp , " " , lfptoa ( & pp -> filter_offset [ i ] , 6 ) ) ; if ( i == ( PEER_SHIFT >> 1 ) - 1 ) ( void ) fprintf ( fp , " \n " ) ; } ( void ) fprintf ( fp , " \n " ) ; ( void ) fprintf ( fp , " \n " , fptoa ( ( s_fp ) pp -> delay , 5 ) , ufptoa ( pp -> dispersion , 5 ) ) ; ( void ) fprintf ( fp , " \n \n " , lfptoa ( & pp -> offset , 6 ) ) ; }
XXX ELIMINATE printserver similar in ntptrace.c, ntpdate.c
 printserver - print detail information for a server
XXX ELIMINATE printserver similar in ntptrace . c ntpdate . c printserver - print detail information for a server