Hello all;

I am in the process of completing an extension to snmptranslate that will
allow it to dump reports in mib2schema format. For those of you unfamiliar
with this format it is used by some SNMP programs as a sort of compiled
version of MIBS. The input would be a collection of MIB files and the output
would look something like this:

"sysInfoMaxBuffers"             "1.3.6.1.4.1.437.1.1.3.1.8"
"sysInfoUtilDisplay"            "1.3.6.1.4.1.437.1.1.3.1.9"
"sysInfoAddrCapacity"           "1.3.6.1.4.1.437.1.1.3.1.10"
"sysInfoRestrictedStaticAddrCapacity"           "1.3.6.1.4.1.437.1.1.3.1.11"
"sysInfoPOSTResult"             "1.3.6.1.4.1.437.1.1.3.1.12"
"sysInfoPortFailedPOSTMap"              "1.3.6.1.4.1.437.1.1.3.1.13"
"sysInfoPortLinkDisplayMap"             "1.3.6.1.4.1.437.1.1.3.1.14"
"sysInfoPortDisabledDisplayMap"         "1.3.6.1.4.1.437.1.1.3.1.15"
"sysInfoBroadcastStormLastTime"         "1.3.6.1.4.1.437.1.1.3.1.16"


The value on the left is the most specific subid of the oid in question. The
value on the right is the numerical representation of the OID without a
leading or trailing period. Quotation marks are required around all values.

I have successfully modified snmptranslate to output reports in the format
above with one caveat; the right value has a leading period which I wish to
remove. My code changes currently reference print_parent_oid which is
unfortunately a recursive loop that precludes my ability to easily modify
the format of the value.

static void
print_parent_oid(FILE * f, struct tree *tp)
{
��� if (tp) {
������� if (tp->parent) {
����������� print_parent_oid(f, tp->parent);
�������� /*RECURSE*/}
������� fprintf(f, ".%lu", tp->subid);
��� }
}

This routine gives me what I need except for that pesky leading period!

My question to all is this: is there another variable that I could reference
that contains the final value of the print_parent_oid routine or must I
perform some string storage and hackery to temporarily store the result of
this routine into something I can more easily manipulate? I�ve hunted
through most of the relevant code and don�t see any variables that full this
need.

Thanks in advance for any suggestions you might have! 



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to