#!/bin/sh
# the next line restarts using tclsh -*- tcl -*- \
exec /opt/local/bin/tclsh8.6 "$0" "$@"
#
# mibgrep --
#
#	This example shows how to walk the SNMP MIB tree. It lists all
#	the MIB nodes that match a pattern, which is specified on the
#	command line.
#
# Copyright (c) 1995-1996 Technical University of Braunschweig.
# Copyright (c) 1996-1997 University of Twente.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: mibgrep 1191 1998-09-17 11:23:46Z schoenw $

package require Tnm 3.0

namespace import Tnm::*

# Check the command line.

if {$argc != 1} {
    puts stderr "usage: [file tail $argv0] expression"
    exit 1
}

# Search for matching object descriptors.

mib walk oid 1.3 {
    set label [mib label $oid]
    if [regexp $argv $label] {
	puts [format {%-32s %-16s %-16s} \
		$oid [mib module $oid] $label]
    }
}
