#!/usr/bin/perl # # mib-help < snmpd.mib # # This little program reads the MIB file from stdin and breaks the variable # descriptions into separate files. Each is put into the help directory under # the variable's name. This is for use in conjunction with tools like fsh # that look for help files in the help sub-directory. for (<>) { if (/\s*([A-Za-z0-9_-]+)\s+OBJECT-TYPE/) { ($file = $1) =~ s/-/_/g; if (open(H,">help/$file")) { print STDERR "File: \"help/$file\"\n"; $writing = 1; print H; } else { print STDERR "### Can't write \"help/$file\" [$!]\n"; $writing = 0; } } elsif (/^\s*::=\s*\{/) { print H; close H; $writing = 0; } elsif ($writing) { print H; } }