From 58620c2052e07490beb44a4bd1a8fbb5ebc028ac Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 14:17:30 +0100 Subject: Various cosmetic (print) fixes. Wrong module names used for the utility module in the test_config dir. --- lib/snmp/src/agent/snmp_community_mib.erl | 4 +++- lib/snmp/src/agent/snmpa.erl | 7 +++++-- lib/snmp/src/agent/snmpa_mib_lib.erl | 9 ++++++--- lib/snmp/test/test_config/Makefile | 2 -- lib/snmp/test/test_config/modules.mk | 2 +- lib/snmp/test/test_config/snmp_test_config.erl | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/snmp/src/agent/snmp_community_mib.erl b/lib/snmp/src/agent/snmp_community_mib.erl index 8f0f4cad73..5644a43345 100644 --- a/lib/snmp/src/agent/snmp_community_mib.erl +++ b/lib/snmp/src/agent/snmp_community_mib.erl @@ -336,6 +336,8 @@ get_target_addr_ext_mms(TDomain, TAddress, Key) -> get_target_addr_ext_mms(TDomain, TAddress, NextKey) end end. + + %%----------------------------------------------------------------- %% Instrumentation Functions %%----------------------------------------------------------------- @@ -347,7 +349,7 @@ snmpCommunityTable(print) -> PrintRow = fun(Prefix, Row) -> lists:flatten( - io_lib:format("~sIndex: ~p" + io_lib:format("~sIndex: ~p" "~n~sName: ~p" "~n~sSecurityName: ~p" "~n~sContextEngineID: ~p" diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 8ad2a83de4..c09435c03b 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -326,6 +326,9 @@ print_mib_info() -> MibsInfo = mibs_info(), print_mib_info(MibsInfo). +print_mib_info([]) -> + io:format("~n", []), + ok; print_mib_info([{Mod, Tables, Variables} | MibsInfo]) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), print_mib_variables2(Mod, Variables), @@ -379,9 +382,9 @@ make_pretty_mib(snmp_view_based_acm_mib) -> "SNMP-VIEW-BASED-ACM-MIB"; make_pretty_mib(snmp_target_mib) -> "SNMP-TARGET-MIB"; -make_pretty_mib(snmp_target_mib) -> +make_pretty_mib(snmp_community_mib) -> "SNMP-COMMUNITY-MIB"; -make_pretty_mib(snmp_target_mib) -> +make_pretty_mib(snmp_notification_mib) -> "SNMP-NOTIFICATION-MIB"; make_pretty_mib(snmp_target_mib) -> "SNMP-USER-BASED-SM-MIB"; diff --git a/lib/snmp/src/agent/snmpa_mib_lib.erl b/lib/snmp/src/agent/snmpa_mib_lib.erl index 22057b4547..700bdd1a6e 100644 --- a/lib/snmp/src/agent/snmpa_mib_lib.erl +++ b/lib/snmp/src/agent/snmpa_mib_lib.erl @@ -90,9 +90,9 @@ print_variables(Variables) when is_list(Variables) -> ok. print_variable(Variable, {value, Val}, Prefix) when is_atom(Variable) -> - io:format("~w~s => ~p~n", [Variable, Prefix, Val]); + io:format("~w~s=> ~p~n", [Variable, Prefix, Val]); print_variable(Variable, Error, Prefix) when is_atom(Variable) -> - io:format("~w~s => ERROR: ~p~n", [Variable, Prefix, Error]). + io:format("~w~s=> [e] ~p~n", [Variable, Prefix, Error]). print_variables_prefixify(Variables) -> MaxVarLength = print_variables_maxlength(Variables), @@ -139,10 +139,13 @@ print_table(Table, DB, FOI, PrintRow) -> print_table(Table, TableInfo, PrintRow). print_table(Table, TableInfo, PrintRow) when is_function(PrintRow, 2) -> - io:format("~w => ~n", [Table]), + io:format("~w =>", [Table]), do_print_table(TableInfo, PrintRow). +do_print_table({ok, [] = _TableInfo}, _PrintRow) -> + io:format(" -~n", []); do_print_table({ok, TableInfo}, PrintRow) when is_function(PrintRow, 2) -> + io:format("~n", []), lists:foreach(fun({RowIdx, Row}) -> io:format(" ~w => ~n~s~n", [RowIdx, PrintRow(" ", Row)]) diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 446e7d8adf..c02bb5c601 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -32,8 +32,6 @@ VSN = $(SNMP_VSN) # ---------------------------------------------------- # Configured variables # ---------------------------------------------------- -# PERL = @PERL@ -PERL = perl # ---------------------------------------------------- diff --git a/lib/snmp/test/test_config/modules.mk b/lib/snmp/test/test_config/modules.mk index 956bb54af3..ee8b68d4eb 100644 --- a/lib/snmp/test/test_config/modules.mk +++ b/lib/snmp/test/test_config/modules.mk @@ -37,4 +37,4 @@ MANAGER_CONFIG_FILES = \ manager/usm.conf MODULES = \ - test_config + snmp_test_config diff --git a/lib/snmp/test/test_config/snmp_test_config.erl b/lib/snmp/test/test_config/snmp_test_config.erl index 8d2005d061..550a276c4c 100644 --- a/lib/snmp/test/test_config/snmp_test_config.erl +++ b/lib/snmp/test/test_config/snmp_test_config.erl @@ -17,7 +17,7 @@ %% %CopyrightEnd% %% --module(test_config). +-module(snmp_test_config). -export([ip_address/0, ip_address2/0]). -- cgit v1.2.3