aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-11-25 20:26:04 +0100
committerMicael Karlberg <[email protected]>2011-11-25 20:26:04 +0100
commit18fa98a8089ef47d119c8ca3c6fe3c68e6af31c6 (patch)
treeba201fa5664b3b710259825b9ebd9385ed49afd4 /lib
parent1655bd7f6c68b9b8788f69dca1b1f67a05a0745e (diff)
downloadotp-18fa98a8089ef47d119c8ca3c6fe3c68e6af31c6.tar.gz
otp-18fa98a8089ef47d119c8ca3c6fe3c68e6af31c6.tar.bz2
otp-18fa98a8089ef47d119c8ca3c6fe3c68e6af31c6.zip
[compiler] Improved version info printout from the
MIB compiler frontend escript. OTP-9618
Diffstat (limited to 'lib')
-rw-r--r--lib/snmp/doc/src/notes.xml11
-rw-r--r--lib/snmp/src/compile/depend.mk2
-rw-r--r--lib/snmp/src/compile/snmpc.src18
3 files changed, 23 insertions, 8 deletions
diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml
index b47007202e..9e685174b7 100644
--- a/lib/snmp/doc/src/notes.xml
+++ b/lib/snmp/doc/src/notes.xml
@@ -39,19 +39,18 @@
<section>
<title>Improvements and new features</title>
+<!--
<p>-</p>
+-->
-<!--
<list type="bulleted">
<item>
- <p>Bad note store GC timer deactivation.
- Wrong field in the state record was set (timeout instead active). </p>
- <p>Stefan Grundmann</p>
- <p>Own Id: OTP-9690</p>
+ <p>[compiler] Improved version info printout from the
+ <seealso marker="snmpc(command)#">MIB compiler frontend escript</seealso>. </p>
+ <p>Own Id: OTP-9618</p>
</item>
</list>
--->
</section>
diff --git a/lib/snmp/src/compile/depend.mk b/lib/snmp/src/compile/depend.mk
index f7084f8bcd..3ee8dc4bec 100644
--- a/lib/snmp/src/compile/depend.mk
+++ b/lib/snmp/src/compile/depend.mk
@@ -44,6 +44,6 @@ $(EBIN)/snmpc_mib_gram.$(EMULATOR): \
../../include/snmp_types.hrl \
snmpc_mib_gram.erl
-$(BIN)/snmpc: snmpc.src
+$(BIN)/snmpc: snmpc.src ../../vsn.mk
$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@
chmod 755 $@
diff --git a/lib/snmp/src/compile/snmpc.src b/lib/snmp/src/compile/snmpc.src
index f993335b89..7edd2111a5 100644
--- a/lib/snmp/src/compile/snmpc.src
+++ b/lib/snmp/src/compile/snmpc.src
@@ -221,7 +221,10 @@ process_args([], #state{verbosity = Verbosity0, file = MIB} = State) ->
process_args(["--help"|_Args], _State) ->
ok;
process_args(["--version"|_Args], #state{version = Version, mfv = MFV} = _State) ->
- {ok, lists:flatten(io_lib:format("snmpc ~s (~s)", [Version, MFV]))};
+ OtpVersion = otp_release(),
+ {ok, lists:flatten(
+ io_lib:format("snmpc ~s [Mib format version ~s] (OTP ~s)",
+ [Version, MFV, OtpVersion]))};
process_args(["--verbosity", Verbosity0|Args], #state{verbosity = V} = State)
when (V =:= undefined) ->
Verbosity = list_to_atom(Verbosity0),
@@ -398,3 +401,16 @@ usage() ->
e(Reason) ->
throw({error, Reason}).
+otp_release() ->
+ system_info(otp_release, string).
+
+
+system_info(Tag, Type) ->
+ case (catch erlang:system_info(Tag)) of
+ {'EXIT', _} ->
+ "-";
+ Info when is_list(Info) andalso (Type =:= string) ->
+ Info;
+ Info ->
+ lists:flatten(io_lib:format("~w", [Info]))
+ end.