diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2016-09-01 09:13:50 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2016-09-01 09:13:50 +0000 |
commit | bf33577e7fe8ef7517fda76e0d80d7e453a40963 (patch) | |
tree | 934bae9d45d9999e75b5e8887f267930054d2fcc /sbin/sysctl/sysctl.c | |
parent | 377b9162ebd16c0a567c8c9aa07a294b824889ee (diff) |
Export machdep.cpufeature in hex, to avoid - values which made
yuo@ grumpy.
ok tom guenther yuo
Diffstat (limited to 'sbin/sysctl/sysctl.c')
-rw-r--r-- | sbin/sysctl/sysctl.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index c15aea3006a..321a9ec6fb6 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.218 2016/08/27 01:55:30 guenther Exp $ */ +/* $OpenBSD: sysctl.c,v 1.219 2016/09/01 09:13:49 deraadt Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -178,6 +178,7 @@ int Aflag, aflag, nflag, qflag; #define KMEMSTATS 0x00001000 #define SENSORS 0x00002000 #define SMALLBUF 0x00004000 +#define HEX 0x00008000 /* prototypes */ void debuginit(void); @@ -610,6 +611,10 @@ parse(char *string, int flags) if (mib[1] == CPU_CONSDEV) special |= CHRDEV; #endif +#ifdef CPU_CPUFEATURE + if (mib[1] == CPU_CPUFEATURE) + special |= HEX; +#endif #ifdef CPU_BLK2CHR if (mib[1] == CPU_BLK2CHR) { if (bufp == NULL) @@ -913,13 +918,19 @@ parse(char *string, int flags) if (newsize == 0) { if (!nflag) (void)printf("%s%s", string, equ); - (void)printf("%d\n", *(int *)buf); + if (special & HEX) + (void)printf("0x%x\n", *(int *)buf); + else + (void)printf("%d\n", *(int *)buf); } else { if (!qflag) { if (!nflag) (void)printf("%s: %d -> ", string, *(int *)buf); - (void)printf("%d\n", *(int *)newval); + if (special & HEX) + (void)printf("%d\n", *(int *)newval); + else + (void)printf("0x%x\n", *(int *)newval); } } return; |