MAJOR=4
MINOR=34
DEVNAME=tty34
     ˆËÊÏ739ÉÁÌ ã    ‹      ½–]oÚ0…ïû+¼\ìŽ8q€02QBº¦	™Øù($±!”_¿Pè`SY‹TqÇ9¯}ÎùÃødukÃQ¯ÃNôînÚÍ�rÞk5­¡µû�—Âº-É".C˜¦©œj2K<8ìC_„ó<ä"	!A$óÊØö™WÀð)&Ù"sj6#B×€¹ ²¥à¡è¥	9ä4"n0§2¡!“}.;ŒÅÙ„9<ÇùüE�aìøbÎ©Èjã„9³mk•9–HGÜM›�{'Æ”‘§­Aõòf²9ŸQàé³§m31áƒž^T‘‹%ÓBðÄ©H0pXÄátŽ£™ì®ð\T¤ŸÍZ÷W¦ƒÂßV›~BÝŠôµV±¯»K2mRâ×5�LS•Ì6æ„Œn@ÉIñ`'›ÓZ;�E¹“±Xt�Â,âqT‡ÍyŒ³¬…,�Ÿ«vòìü£Wí×í¡Õìï��íw—øµ’ÙÃ	�°‚„:‚%Oûø;/Ÿ£)�¯_^Á>\x¾�L ràUåD–Ñ,bit%þ*:*¢Õu\o|ïoXW Ô]»v7}¬Dm9¼Å%­[�ŒóòshÉ<»ä8ü?i‘‚Š9UÍ!(År!À	¡ZÒ/‹Åº[µnukäéŒOþäqÀô8~uü\n£­ä!,¨éCõ€åÌ’w`Q5€´2RObÉË¨uQ,=Ñ[¯ºIèéc¯ˆžiLîœî/¦wa±Ím¿L­nzÀrfÉ[X”R Bå:‰E“‹—Å2Hîb}\ÒëûY¨lîíF8î&ßò3ñðÍCºhØ¬–®²]û–3K>‹zi,KäK-¯ hKÛ­®úëoû¤=ÄÚÍšm%}to“æèh�Yò‹©_þ³·¼ó¨‚ûCÜ€Ï÷	î.<¿�ýYES	    6   ˆl–ßi~”ªC]Šq@‚ãm\mµ1hß�þY,„YÆ‹!�nBùÑ„€|_ÐÂÍ >Ü    #!/usr/bin/env escript
%% -*- erlang -*-
%%
%% %CopyrightBegin%
%% 
%% Copyright Ericsson AB 2008-2022. All Rights Reserved.
%% 
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%%     http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%% 
%% %CopyrightEnd%
%%
%% SNMP MIB compiler frontend
%% 

-mode(compile).

-include_lib("kernel/include/file.hrl").
-include_lib("snmp/include/snmp_types.hrl").


-record(state, 
        {
	 version = "5.13.3", 
         mfv, 
         file, % .mib or .bin depending on which are compiled
         outdir = "./",
         db = volatile,
	 include_dirs = ["./"],
         include_lib_dirs = [],
	 deprecated         = false,
	 group_check        = true,
	 description        = false,
	 reference          = false,
	 imports            = false,
	 module_identity    = false,
	 module_compliance  = false, 
	 agent_capabilities = false,
	 module,
	 no_defaults        = false,
	 relaxed_row_name_assign_check = false,
	 %% The default verbosity (silence) will be filled in 
	 %% during argument processing.
	 verbosity, 
	 warnings           = false,
	 warnings_as_errors = false
        }).


%% ------------------------------------------------------------------------
%% Valid arguments: 
%% --o Dir [defaults to "./"]
%% --i Dir [defaults to "./"]
%% --il Dir
%% --sgc
%% --db DB [defaults to volatile]
%% --dep
%% --desc
%% --ref
%% --imp
%% --mi
%% --mc
%% --ac
%% --mod Mod
%% --nd
%% --rrnac
%% --version
%% --verbosity V
%% --warnings | --W
%% --Werror | --wae | --warnings_as_errors
main(Args) when is_list(Args) ->
    case (catch process_args(Args)) of
	ok ->
	    usage();
        {ok, State} when is_record(State, state) ->
	    compile(State);
        {ok, Str} when is_list(Str) ->
            io:format("~s~n~n", [Str]),
            halt(1);
        {error, ReasonStr} ->
            usage(ReasonStr)
    end;
main(_) ->
    usage().

compile(State) ->
    %% io:format("snmpc: ~p~n", [State]),
    case mk_file(State) of
	{mib, File} ->
	    Options = mk_mib_options(State),
	    case mib2bin(File, Options) of
		{ok, _BinFileName} ->
		    ok;
		{error, Reason} ->
		    io:format("ERROR: Failed compiling mib: "
			      "~n   ~p~n", [Reason]),
		    halt(1)
	    end;
	{bin, File} ->
	    Options = mk_hrl_options(State),
	    case bin2hrl(File, Options) of
		ok ->
		    ok;
		{error, Reason} ->
		    io:format("ERROR: Failed generating hrl from mib: "
			      "~n   ~p~n", [Reason]),
		    halt(1)
	    end
    end.

mib2bin(MibFileName, Options) ->
    snmpc:compile(MibFileName, Options).

bin2hrl(BinFileName, {OutDir, Verbosity}) ->
    MibName = filename:basename(BinFileName), 
    BinFile = BinFileName ++ ".bin",
    HrlFile = filename:join(OutDir, MibName) ++ ".hrl",
    put(verbosity, Verbosity),
    snmp