#!/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,v 1.5 1998/09/17 11:23:46 schoenw Exp $

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]
    }
}
