diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 8ae3cbd..ee7ee72 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -415,10 +415,16 @@ show_var(int *oid, int nlen) if (!nflag) printf("%s: ", name); fmt++; - if(*fmt == 'U') - printf("%lu", *(unsigned long *)p); - else - printf("%ld", *(long *)p); + val = ""; + while (len >= sizeof(long)) { + if(*fmt == 'U') + printf("%s%lu", val, *(unsigned long *)p); + else + printf("%s%ld", val, *(long *)p); + val = " "; + len -= sizeof (int); + p += sizeof (int); + } return (0); case 'P': |