#!/bin/sh
# the next line restarts using tclsh -*- tcl -*- \
exec tclsh "$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 924 1997-12-29 09:12:03Z 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 {
    set label [mib label $oid]
    if [regexp $argv $label] {
	puts [format {%-32s %-16s %-16s (%s)} \
		$oid [mib module $oid] $label [file tail [mib file $oid]]]
    }
}
