diff options
Diffstat (limited to 'contrib/ntp/ntpq/ntpq_ops.c')
-rw-r--r-- | contrib/ntp/ntpq/ntpq_ops.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/contrib/ntp/ntpq/ntpq_ops.c b/contrib/ntp/ntpq/ntpq_ops.c index d43d228..8827a84 100644 --- a/contrib/ntp/ntpq/ntpq_ops.c +++ b/contrib/ntp/ntpq/ntpq_ops.c @@ -1319,7 +1319,7 @@ doprintpeers( l_fp rec; l_fp ts; u_char havevar[MAXHAVE]; - u_long poll; + u_long poll_sec; char type = '?'; char refid_string[10]; char whenbuf[8], pollbuf[8]; @@ -1442,7 +1442,7 @@ doprintpeers( /* * Got everything, format the line */ - poll = 1<<max(min3(ppoll, hpoll, NTP_MAXPOLL), NTP_MINPOLL); + poll_sec = 1<<max(min3(ppoll, hpoll, NTP_MAXPOLL), NTP_MINPOLL); if (pktversion > NTP_OLDVERSION) c = flash3[CTL_PEER_STATVAL(rstatus) & 0x7]; else @@ -1453,7 +1453,7 @@ doprintpeers( "%c%-15.15s %-15.15s %2ld %c %4.4s %4.4s %3lo %7.7s %8.7s %7.7s\n", c, nntohost(srcadr), dstadr_refid, stratum, type, prettyinterval(whenbuf, when(&ts, &rec, &reftime)), - prettyinterval(pollbuf, (int)poll), reach, + prettyinterval(pollbuf, (int)poll_sec), reach, lfptoms(&estdelay, 3), lfptoms(&estoffset, 3), havevar[HAVE_JITTER] ? lfptoms(&estjitter, 3) : lfptoms(&estdisp, 3)); @@ -1535,13 +1535,15 @@ dopeers( if (!dogetassoc(fp)) return; - for (i = 0; i < numhosts; ++i) - { if(getnetnum(chosts[i],&netnum,fullname)) - if ((int)strlen(fullname) > maxhostlen) - maxhostlen = strlen(fullname); - } - if (numhosts > 1) + maxhostlen = 0; + if (numhosts > 1) { + for (i = 0; i < numhosts; ++i) + { if(getnetnum(chosts[i],&netnum,fullname)) + if ((int)strlen(fullname) > maxhostlen) + maxhostlen = strlen(fullname); + } (void) fprintf(fp, "%-*.*s ", maxhostlen, maxhostlen, "host"); + } (void) fprintf(fp, " remote refid st t when poll reach delay offset jitter\n"); if (numhosts > 1) |