summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-01-04 12:41:56 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-01-04 12:41:56 +0000
commit41968d33a5b4c1c616b4e3d7c064fac67ad2ea1e (patch)
treec7fee51709f938f817b3931ab52317b6661f1649 /usr.sbin
parentefcce6e22456896ff127ba3a382fa4bcfdce5948 (diff)
add the -n flag to dump numeric OIDs instead of symbolic names
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/snmpctl/snmpctl.811
-rw-r--r--usr.sbin/snmpctl/snmpctl.c21
2 files changed, 27 insertions, 5 deletions
diff --git a/usr.sbin/snmpctl/snmpctl.8 b/usr.sbin/snmpctl/snmpctl.8
index 2823cd5f123..a6917f00b11 100644
--- a/usr.sbin/snmpctl/snmpctl.8
+++ b/usr.sbin/snmpctl/snmpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: snmpctl.8,v 1.2 2007/12/28 17:22:32 reyk Exp $
+.\" $OpenBSD: snmpctl.8,v 1.3 2008/01/04 12:41:55 reyk Exp $
.\"
.\" Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: December 28 2007 $
+.Dd $Mdocdate: January 4 2008 $
.Dt SNMPCTL 8
.Os
.Sh NAME
@@ -22,6 +22,7 @@
.Nd control the SNMP daemon
.Sh SYNOPSIS
.Nm
+.Op Fl n
.Ar command
.Op Ar arguments ...
.Sh DESCRIPTION
@@ -31,6 +32,12 @@ program controls the
.Xr snmpd 8
daemon.
.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl n
+Show numeric OID values instead of their symbolic names.
+.El
+.Pp
The following commands are available:
.Bl -tag -width Ds
.It Cm monitor
diff --git a/usr.sbin/snmpctl/snmpctl.c b/usr.sbin/snmpctl/snmpctl.c
index 126871a52fa..492ce279656 100644
--- a/usr.sbin/snmpctl/snmpctl.c
+++ b/usr.sbin/snmpctl/snmpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpctl.c,v 1.4 2007/12/28 17:22:32 reyk Exp $ */
+/* $OpenBSD: snmpctl.c,v 1.5 2008/01/04 12:41:55 reyk Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net>
@@ -73,7 +73,7 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s <command> [arg [...]]\n", __progname);
+ fprintf(stderr, "usage: %s [-n] <command> [arg [...]]\n", __progname);
exit(1);
}
@@ -93,14 +93,29 @@ main(int argc, char *argv[])
int ctl_sock;
int done = 0;
int n;
+ int ch;
if ((env = calloc(1, sizeof(struct snmpd *))) == NULL)
err(1, "calloc");
gettimeofday(&env->sc_starttime, NULL);
+
+ while ((ch = getopt(argc, argv, "n")) != -1) {
+ switch (ch) {
+ case 'n':
+ env->sc_flags |= SNMPD_F_NONAMES;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
smi_init();
/* parse options */
- if ((res = parse(argc - 1, argv + 1)) == NULL)
+ if ((res = parse(argc, argv)) == NULL)
exit(1);
switch (res->action) {