From a0e4728a5e8e366c83e8229cefc63ba92151a86d Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 16:21:08 +0100 Subject: Cosmetic stuff (when to newline, intending, ..). --- lib/snmp/src/agent/snmp_standard_mib.erl | 15 +++++++++++---- lib/snmp/src/agent/snmpa.erl | 14 +++++++++++--- lib/snmp/src/agent/snmpa_mib_lib.erl | 8 +------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lib/snmp/src/agent/snmp_standard_mib.erl b/lib/snmp/src/agent/snmp_standard_mib.erl index 7292d5b98e..b6834d278c 100644 --- a/lib/snmp/src/agent/snmp_standard_mib.erl +++ b/lib/snmp/src/agent/snmp_standard_mib.erl @@ -446,7 +446,9 @@ gen_counter(get, Counter) -> %% This is the instrumentation function for sysUpTime. %%----------------------------------------------------------------- sysUpTime(print) -> - sys_up_time(print). + sys_up_time(print); +sysUpTime(get) -> + sys_up_time(get). sys_up_time() -> snmpa:sys_up_time(). @@ -464,7 +466,10 @@ sys_up_time(get) -> %%----------------------------------------------------------------- snmpEnableAuthenTraps(print) -> - snmp_enable_authen_traps(print). + snmp_enable_authen_traps(print); +snmpEnableAuthenTraps(get) -> + snmp_enable_authen_traps(get). + snmp_enable_authen_traps(print) -> VarAndValue = [{snmpEnableAuthenTraps, snmp_enable_authen_traps(get)}], @@ -484,10 +489,12 @@ snmp_enable_authen_traps(set, NewVal) -> %%----------------------------------------------------------------- -%% This is the instrumentation function for sysObjectId +%% This is the instrumentation function for sysObjectID %%----------------------------------------------------------------- sysObjectID(print) -> - sys_object_id(print). + sys_object_id(print); +sysObjectID(get) -> + sys_object_id(get). sys_object_id(print) -> VarAndValue = [{sysObjectID, sys_object_id(get)}], diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 8ca057892c..3c214874fe 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -378,6 +378,7 @@ print_mib_info([{Mod, Tables, Variables} | MibsInfo]) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), print_mib_variables2(Mod, Variables), print_mib_tables2(Mod, Tables), + io:format("~n", []), print_mib_info(MibsInfo). @@ -394,9 +395,12 @@ print_mib_tables([{Mod, Tabs}|MibTabs]) print_mib_tables([_|MibTabs]) -> print_mib_tables(MibTabs). +print_mib_tables(_Mod, [] = _Tables) -> + ok; print_mib_tables(Mod, Tables) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), - print_mib_tables2(Mod, Tables). + print_mib_tables2(Mod, Tables), + io:format("~n", []). print_mib_tables2(Mod, Tables) -> [(catch Mod:Table(print)) || Table <- Tables]. @@ -415,12 +419,16 @@ print_mib_variables([{Mod, Vars}|MibVars]) print_mib_variables([_|MibVars]) -> print_mib_variables(MibVars). +print_mib_variables(_Mod, [] = _Vars) -> + ok; print_mib_variables(Mod, Vars) -> io:format("~n** ~s ** ~n~n", [make_pretty_mib(Mod)]), - print_mib_variables2(Mod, Vars). + print_mib_variables2(Mod, Vars), + io:format("~n", []). print_mib_variables2(Mod, Variables) -> - [(catch Mod:Variable(print)) || Variable <- Variables]. + Vars = [{Var, (catch Mod:Var(get))} || Var <- Variables], + snmpa_mib_lib:print_variables(Vars). make_pretty_mib(snmp_view_based_acm_mib) -> diff --git a/lib/snmp/src/agent/snmpa_mib_lib.erl b/lib/snmp/src/agent/snmpa_mib_lib.erl index 700bdd1a6e..cb96ff8056 100644 --- a/lib/snmp/src/agent/snmpa_mib_lib.erl +++ b/lib/snmp/src/agent/snmpa_mib_lib.erl @@ -129,11 +129,6 @@ print_tables(Tables) when is_list(Tables) -> end, Tables), ok. -%% print_table(Table, DB, FOI, PrintRow) -> -%% TableInfo = get_table(DB(Table), FOI(Table)), -%% print_table(Table, TableInfo, PrintRow), -%% ok. - print_table(Table, DB, FOI, PrintRow) -> TableInfo = get_table(DB, FOI), print_table(Table, TableInfo, PrintRow). @@ -149,8 +144,7 @@ do_print_table({ok, TableInfo}, PrintRow) when is_function(PrintRow, 2) -> lists:foreach(fun({RowIdx, Row}) -> io:format(" ~w => ~n~s~n", [RowIdx, PrintRow(" ", Row)]) - end, TableInfo), - io:format("~n", []); + end, TableInfo); do_print_table({error, {invalid_rowindex, BadRowIndex, []}}, _PrintRow) -> io:format("Error: Bad rowindex ~w~n", [BadRowIndex]); do_print_table({error, {invalid_rowindex, BadRowIndex, TableInfo}}, PrintRow) -> -- cgit v1.2.3