diff options
author | jhb <jhb@FreeBSD.org> | 2000-07-05 07:46:41 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-07-05 07:46:41 +0000 |
commit | b6e74b58eba2989cf8de48058f7f988f58920981 (patch) | |
tree | 4955aea60eabb12fc4fdda981824917be0b92db0 /sbin | |
parent | 0e7721bc5fe1b5e0f7eec9687641784cb231fe85 (diff) | |
download | FreeBSD-src-b6e74b58eba2989cf8de48058f7f988f58920981.zip FreeBSD-src-b6e74b58eba2989cf8de48058f7f988f58920981.tar.gz |
Support for unsigned integer and long sysctl variables. Update the
SYSCTL_LONG macro to be consistent with other integer sysctl variables
and require an initial value instead of assuming 0. Update several
sysctl variables to use the unsigned types.
PR: 15251
Submitted by: Kelly Yancey <kbyanc@posi.net>
Diffstat (limited to 'sbin')
-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 1c49856..8ae3cbd 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -398,9 +398,13 @@ show_var(int *oid, int nlen) case 'I': if (!nflag) printf("%s: ", name); + fmt++; val = ""; while (len >= sizeof(int)) { - printf("%s%d", val, *(int *)p); + if(*fmt == 'U') + printf("%s%u", val, *(unsigned int *)p); + else + printf("%s%d", val, *(int *)p); val = " "; len -= sizeof (int); p += sizeof (int); @@ -410,7 +414,11 @@ show_var(int *oid, int nlen) case 'L': if (!nflag) printf("%s: ", name); - printf("%ld", *(long *)p); + fmt++; + if(*fmt == 'U') + printf("%lu", *(unsigned long *)p); + else + printf("%ld", *(long *)p); return (0); case 'P': |