diff options
author | obrien <obrien@FreeBSD.org> | 2006-08-12 23:33:10 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2006-08-12 23:33:10 +0000 |
commit | f6dcb4683584c820e63f041684eb1b3e8cd8ca5a (patch) | |
tree | 5d2fedc03004f918772ddd0e58221b3e8df6b30f /sbin/sysctl | |
parent | b58bbb1e9036a12694ff93ee15a0929462aac893 (diff) | |
download | FreeBSD-src-f6dcb4683584c820e63f041684eb1b3e8cd8ca5a.zip FreeBSD-src-f6dcb4683584c820e63f041684eb1b3e8cd8ca5a.tar.gz |
Add an extension to the UINT & ULONG types. The XINT & XLONG types behave
the same, except sysctl(8) will print out the values in hex.
Diffstat (limited to 'sbin/sysctl')
-rw-r--r-- | sbin/sysctl/sysctl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 09569c5..d171ec9 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -578,7 +578,11 @@ show_var(int *oid, int nlen) while (len >= sizeof(int)) { fputs(val, stdout); if (*fmt == 'U') - printf(hflag ? "%'u" : "%u", *(unsigned int *)p); + printf(hflag ? "%'u" : "%u", + *(unsigned int *)p); + else if (*fmt == 'X') + printf(hflag ? "%'#010x" : "%#010x", + *(unsigned int *)p); else if (*fmt == 'K') { if (*(long *)p < 0) printf("%ld", *(long *)p); @@ -601,7 +605,11 @@ show_var(int *oid, int nlen) while (len >= sizeof(long)) { fputs(val, stdout); if (*fmt == 'U') - printf(hflag ? "%'lu" : "%lu", *(unsigned long *)p); + printf(hflag ? "%'lu" : "%lu", + *(unsigned long *)p); + else if (*fmt == 'X') + printf(hflag ? "%'#018lx" : "%#018lx", + *(unsigned long *)p); else if (*fmt == 'K') { if (*(long *)p < 0) printf("%ld", *(long *)p); |