X-Git-Url: https://git.saurik.com/apple/system_cmds.git/blobdiff_plain/1a7e3f61d38d679bba59130891c2031b5a0092b6..HEAD:/sysctl.tproj/sysctl.c diff --git a/sysctl.tproj/sysctl.c b/sysctl.tproj/sysctl.c index 7e69787..ca86999 100644 --- a/sysctl.tproj/sysctl.c +++ b/sysctl.tproj/sysctl.c @@ -38,7 +38,7 @@ __unused static const char copyright[] = #if 0 static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = +__unused static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ @@ -60,6 +60,8 @@ static const char rcsid[] = #include #include #include +#ifdef __APPLE__ +#endif #include #include #include @@ -513,7 +515,7 @@ static int S_xswusage(int l2, void *p) { struct xsw_usage *xsu = (struct xsw_usage *)p; - + if (l2 != sizeof(*xsu)) { warnx("S_xswusage %d != %ld", l2, sizeof(*xsu)); return (1); @@ -680,6 +682,9 @@ oidfmt(int *oid, int len, char *fmt, u_int *kind) } } else if (buf[sizeof(u_int)] == 'L') { *kind = (*kind & ~CTLTYPE) | CTLTYPE_LONG; + if (buf[sizeof(u_int)+1] == 'U') { + *kind = (*kind & ~CTLTYPE) | CTLTYPE_ULONG; + } } break; case CTLTYPE_QUAD: @@ -693,7 +698,7 @@ oidfmt(int *oid, int len, char *fmt, u_int *kind) } } #endif - + return (0); } @@ -745,6 +750,14 @@ show_var(int *oid, int nlen) bzero(name, BUFSIZ); qoid[0] = 0; memcpy(qoid + 2, oid, nlen * sizeof(int)); + fmt = (char *)buf; + oidfmt(oid, nlen, fmt, &kind); + +#ifdef __APPLE__ + if (!show_masked && (kind & CTLFLAG_MASKED)) { + return (1); + } +#endif #ifdef __APPLE__ // Support for CTL_USER @@ -812,20 +825,11 @@ show_var(int *oid, int nlen) return (0); } val[len] = '\0'; - fmt = (char *)buf; - oidfmt(oid, nlen, fmt, &kind); p = val; ctltype = (kind & CTLTYPE); sign = ctl_sign[ctltype]; intlen = ctl_size[ctltype]; -#ifdef __APPLE__ - if (!show_masked && (kind & CTLFLAG_MASKED)) { - free(oval); - return (1); - } -#endif - switch (ctltype) { case CTLTYPE_STRING: if (!nflag) @@ -951,6 +955,9 @@ sysctl_all_user(int *oid, int len) static int sysctl_all(int *oid, int len) { +#ifdef __APPLE__ +#endif + int name1[22], name2[22]; int i, j; size_t l1, l2;