diff options
author | wollman <wollman@FreeBSD.org> | 1994-04-21 01:32:32 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1994-04-21 01:32:32 +0000 |
commit | 626ad815dc68f63750bef31813d6674bc71e957b (patch) | |
tree | e6118904954fc216401d8283456aeac5e7592395 /usr.sbin/xntpd/ntpq | |
parent | 77b27d49908102e93566da2c2257e619c2b292dc (diff) | |
download | FreeBSD-src-626ad815dc68f63750bef31813d6674bc71e957b.zip FreeBSD-src-626ad815dc68f63750bef31813d6674bc71e957b.tar.gz |
Merged xntp3.3q from vendor branch.
Diffstat (limited to 'usr.sbin/xntpd/ntpq')
-rw-r--r-- | usr.sbin/xntpd/ntpq/ntpq.c | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/usr.sbin/xntpd/ntpq/ntpq.c b/usr.sbin/xntpd/ntpq/ntpq.c index b956cc9..73c2a35 100644 --- a/usr.sbin/xntpd/ntpq/ntpq.c +++ b/usr.sbin/xntpd/ntpq/ntpq.c @@ -75,6 +75,7 @@ int jump = 0; #define OC 12 /* integer, print in octal */ #define MD 13 /* mode */ #define AR 14 /* array of times */ +#define TST 15 /* test flags */ #define EOV 255 /* end of table */ @@ -145,7 +146,7 @@ struct ctl_var peer_var[] = { { CP_RECEIVED, UI, "received" }, /* 31 */ { CP_SENT, UI, "sent" }, /* 32 */ { CP_FILTERROR, AR, "filterror" }, /* 33 */ - { CP_FLASH, ST, "flash"}, /* 34 */ + { CP_FLASH, TST, "flash"}, /* 34 */ { CP_DISP, AR, "disp" }, /* 35 */ /* * These are duplicate entires so that we can @@ -189,6 +190,20 @@ struct codestring { }; /* + * flasher bits + */ +static char *tstflagnames[] = { + "DUPLICATE PKT", + "BOGUS PKT", + "PROTO UNSYNC", + "PEER BOUNDS", + "BAD AUTH", + "PEER CLOCK UNSYNC", + "BAD STRATUM", + "ROOT BOUNDS" +}; + +/* * Leap values */ struct codestring leap_codes[] = { @@ -2836,7 +2851,45 @@ outputarr(fp, name, narr, lfp) output(fp, name, buf); } - +static char * +tstflags(val) + U_LONG val; +{ + register char *cb, *s; + register int i; + register char *sep; + + sep = ""; + i = 0; + s = cb = &circ_buf[nextcb][0]; + if (++nextcb >= NUMCB) + nextcb = 0; + + sprintf(cb, "0x%x", val); + cb += strlen(cb); + if (val <= ((1<<8)-1)) { + if (!val) { + strcat(cb, "<OK>"); + cb += strlen(cb); + } else { + *cb++ = '<'; + while (val) { + if (val & 0x1) { + sprintf(cb, "%s%s", sep, tstflagnames[i]); + sep = ";"; + cb += strlen(cb); + } + i++; + val >>= 1; + } + *cb++ = '>'; + } + } else { + *cb++ = '?'; + } + *cb = '\0'; + return s; +} /* * cookedprint - output variables in cooked mode @@ -2994,6 +3047,13 @@ cookedprint(datatype, length, data, status, fp) outputarr(fp, name, narr, lfparr); break; + case TST: + if (!decodeuint(value, &uval)) + output_raw = '?'; + else + output(fp, name, tstflags(uval)); + break; + default: (void) fprintf(stderr, "Internal error in cookedprint, %s=%s, fmt %d\n", |