Belatedly back out rev. 1.20.

This commit is contained in:
Dag-Erling Smørgrav 1999-11-22 08:38:29 +00:00
parent f7597900e9
commit 2d730c265e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53561
2 changed files with 9 additions and 25 deletions

View File

@ -40,14 +40,14 @@
.Nd get or set kernel state
.Sh SYNOPSIS
.Nm sysctl
.Op Fl bdn
.Op Fl bn
.Ar name ...
.Nm sysctl
.Op Fl bn
.Fl w
.Ar name=value ...
.Nm sysctl
.Op Fl bdn
.Op Fl bn
.Fl aAX
.Sh DESCRIPTION
The
@ -85,9 +85,6 @@ set psize=`sysctl -n hw.pagesize`
Force the value of the variable(s) to be output in raw, binary
format. No names are printed and no terminating newlines are output.
This is mostly useful with a single variable.
.It Fl d
Display the description rather than the value of the requested
variable(s).
.It Fl w Ar name=value ...
Set the MIB
.Ar name

View File

@ -58,7 +58,7 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
static int Aflag, aflag, bflag, dflag, nflag, wflag, Xflag;
static int Aflag, aflag, bflag, nflag, wflag, Xflag;
static int oidfmt(int *, int, char *, u_int *);
static void parse(char *);
@ -71,11 +71,11 @@ usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
"usage: sysctl [-bdn] variable ...",
"usage: sysctl [-bn] variable ...",
" sysctl [-bn] -w variable=value ...",
" sysctl [-bdn] -a",
" sysctl [-bdn] -A",
" sysctl [-bdn] -X");
" sysctl [-bn] -a",
" sysctl [-bn] -A",
" sysctl [-bn] -X");
exit(1);
}
@ -86,12 +86,11 @@ main(int argc, char **argv)
setbuf(stdout,0);
setbuf(stderr,0);
while ((ch = getopt(argc, argv, "AabdnwX")) != -1) {
while ((ch = getopt(argc, argv, "AabnwX")) != -1) {
switch (ch) {
case 'A': Aflag = 1; break;
case 'a': aflag = 1; break;
case 'b': bflag = 1; break;
case 'd': dflag = 1; break;
case 'n': nflag = 1; break;
case 'w': wflag = 1; break;
case 'X': Xflag = Aflag = 1; break;
@ -101,7 +100,7 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
if (wflag && (Aflag || aflag || dflag))
if (wflag && (Aflag || aflag))
usage();
if (Aflag || aflag)
exit (sysctl_all(0, 0));
@ -356,18 +355,6 @@ show_var(int *oid, int nlen)
if (i || !j)
err(1, "sysctl name %d %d %d", i, j, errno);
if (dflag) {
qoid[1] = 5;
j = sizeof descr;
i = sysctl(qoid, nlen + 2, descr, &j, 0, 0);
if (i || !j)
err(1, "sysctl name %d %d %d", i, j, errno);
if (!nflag)
printf("%s: ", name);
printf("%s", descr[0] ? descr : "[no description]");
return (0);
}
/* find an estimate of how much we need for this var */
j = 0;
i = sysctl(oid, nlen, 0, &j, 0, 0);