📄 x-mibcomp5.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> The MIB Compiler User's Guide </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a></a><a href="x-mibcomp.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-mibcomp4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-mibcomp6.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="83643">A.5 Running <b class="command">mibcomp</b> </a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="83644"> </a><b class="command">mibcomp</b> generates an output file based on a MIB description file whose name you must specify on the <b class="command">mibcomp</b> command line. The output file contains the C code that declares the MIB tree to the target agent. If you do not specify a name for the output file, <b class="command">mibcomp</b> uses the name <b class="file">OUTPUT</b>. You can specify options on the command line to modify <b class="command">mibcomp</b>'s default behavior.</p><dd><p class="Body"><a name="83645"> </a>The general form of an <b class="command">mibcomp </b>command is:</p><dl class="margin"><dd><pre class="Code2"><b><a name="83646">mibcomp [ -ansi ] [ -array ] [ -check ] [ -exclude <i class="textVariable">module-name</i>.<i class="textVariable">object-name</i> ] [ -inst_oid_len <i class="textVariable">length</i> ] [ -inst_str_len <i class="textVariable">length</i> ] [ -k_and_r ] [ -l <i class="textVariable">MIB-search-path</i> ]</a></b><dd> <b><a name="83647"> [ -leaf ] [ -loadtree ] [ -lowmem ] [ -man ] [ -man.h ] [ -mib.c ] [ -nametree ] [ -nowarn ] [ -numbers ] [ -o <i class="textVariable">outfile</i> ] [ -partial ] [ -partialm <i class="textVariable">module-name</i> ] [ -quiet ] [ -readtree ] [ -skel ] [ -skel.h ] [ -start <i class="textVariable">module-name.object-name</i> ] [ -statistics ] [ -stub ] [ @<i class="textVariable">automated-response-file</i>] <i class="textVariable">file1</i> [ <i class="textVariable">file2</i>... ]</a></b></pre></dl><dd><p class="Body"><a name="83648"> </a>Square brackets indicate optional arguments. The only argument that <b class="command">mibcomp</b> absolutely requires is the name of an input file. You can specify multiple input files on the command line. If a MIB depends on objects or textual conventions defined in another MIB, be sure to list the other MIB first on the command line.</p><dd><p class="Body"><a name="83649"> </a>The options <b class="command">-array</b>, <b class="command">-check</b>, <b class="command">-leaf</b>, <b class="command">-loadtree</b>, <b class="command">-man</b>, <b class="command">-man.h</b>, <b class="command">-mib.c</b>, <b class="command">-numbers</b>, <b class="command">-partial</b>, <b class="command">-partialm</b>, <b class="command">-readtree</b>, <b class="command">-skel</b>, <b class="command">-skel.h</b>, and <b class="command">-stub</b> specify output modes, and are described in detail in <a href="x-mibcompOut.html#83419"><i class="title">B. mibcomp Output Formats</i></a>. No more than one output format option can be selected for a particular run of <b class="command">mibcomp</b>. If you do not select any of these options, <b class="command">mibcomp</b> uses <b class="command">-mib.c</b> as its default output mode.</p></dl></dl><dl class="margin"><dd><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><a name="83653"><br></a><img border="0" alt="*" src="icons/note.gif"> </td><td><div class="Note"><hr><b class="symbol_UC">NOTE: </b> The <b class="command">-ansi</b> and <b class="command">-k_and_r</b> options are mutually exclusive. For use with VxWorks, only the <b class="command">-ansi</b> option should be used.<hr></div></td></tr></table><dl class="margin"><dd><p class="Body"><a name="84607"> </a>Most of <b class="command">mibcomp</b>'s command line options do not take effect until after <b class="command">mibcomp</b> has finished processing the command line; however, the options <b class="command">-lowmem</b>, <b class="command">-nowarn</b>, and <b class="command">-quiet</b> options are processed immediately when <b class="command">mibcomp</b> encounters them on the command line, as are the names of input files. This means that the order of these options and of input-file names on the command line matters: if you want to suppress warnings that <b class="command">mibcomp</b> generates when it reads a particular file, you must specify <b class="command">-nowarn</b> before the filename. Similarly, <b class="command">-lowmem</b> is only useful if you specify it before any filenames.</p><dd><p class="Body"><a name="83655"> </a>You can specify that <b class="command">mibcomp</b> should read arguments from a file (an <i class="emphasis">automated response file</i>). Many MS-DOS programs support automated response files in order to circumvent MS-DOS' 128-character command-line limit. To instruct <b class="command">mibcomp</b> to read commands from a file, use a "<b class="symbol_lc">@</b>" character immediately followed by the filename. For instance:</p><dl class="margin"><dd><pre class="Code2"><b><a name="83656">mibcomp @cmds.arf</a></b></pre></dl><dd><p class="Body"><a name="83657"> </a>You can use automated response files and other command-line arguments at the same time. <b class="command">mibcomp</b> supports automated response files on all systems, not just MS-DOS.</p><dd><p class="Body"><a name="83658"> </a>Commands in an automated response file may be written one to a line, or may be separated by spaces on one or more lines. Lines may be up to 512 characters long. <b class="command">mibcomp</b> treats the sequences "<b class="symbol_lc">;</b>", "<b class="symbol_lc">--</b>", and "<b class="symbol_lc">#</b>" as comment characters; you may use them to embed comments in your automated response files. For instance:</p><dl class="margin"><dd><pre class="Code2"><b><a name="83659">; This is an automated response file. rfc1213.mib -o mib_ii.c</a></b></pre></dl><dd><p class="Body"><a name="83660"> </a>You may customize options to <b class="command">mibcomp</b> by setting the environment variable MIBCOMP. UNIX and MS-DOS systems both support environment variables. Set the MIBCOMP variable to a list of arguments you want to give to <b class="command">mibcomp</b>. <b class="command">mibcomp </b>executes these arguments before it processes its command line. The most common options generally used with the MIBCOMP environment variable are: <b class="command">-l</b>, <b class="command">-lowmem</b>, <b class="command">-quiet</b>, and <b class="command">-statistics</b>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="83661">A.5.1 Argument Overview</a></i></h4></font><dl class="margin"><dl class="margin"><dd><div class="Item"><a name="85036"> </a><b class="command">-autoexclude <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="85038"> </a>The <b class="command">-autoexclude</b> option caused the output routines to skip unused nodes. </><br></dl></dl></dl><dd><div class="Item"><a name="85037"> </a><b class="command">-ansi</b> </div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84674"> </a>The <b class="command">-ansi</b> option causes any C code generated by this run of <b class="command">mibcomp</b> to use ANSI C function prototyping. This is the default. This option and the <b class="command">-k_and_r</b> option are mutually exclusive.</><br></dl></dl></dl><dd><div class="Item"><a name="84675"> </a><b class="command">-array</b> </div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84679"> </a>This output mode is discussed in <a href="x-mibcompOut.html#83428"><i class="title">-array</i></a>.</><br></dl></dl></dl><dd><div class="Item"><a name="84680"> </a><b class="command">-check</b> </div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84612"> </a>The <b class="command">-check</b> option causes <b class="command">mibcomp</b> not to generate an output file. Instead, <b class="command">mibcomp</b> exits immediately after it has finished reading the input files and performing its consistency checks on them.</><br></dl></dl></dl><dd><div class="Item"><a name="83668"> </a><b class="command">-exclude </b><i class="textVariable">module-name</i>.<i class="textVariable">object-name <br></i></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="85050"> </a>The <b class="command">-exclude</b> option causes <b class="command">mibcomp</b> to remove objects from compiled MIBs. This option is equivalent to an <b class="symbol_UC">EXCLUDE</b> keyword with the same argument. Please see section <a href="x-mibcomp4.html#83627"><i class="title">The EXCLUDE Keyword</i></a> for more information.</><br></dl></dl></dl><dd><div class="Item"><a name="85054"> </a><b class="command">-forceinclude <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="85055"> </a>The <b class="command">-forceinclude</b> option has the same effect as a <b class="command">forceinclude</b> operator in the MIB or MIB control files. </><br></dl></dl></dl><dd><div class="Item"><a name="85056"> </a><b class="command">-inst_oid_len </b><i class="textVariable">length <br></i></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84653"> </a>This argument is only meaningful in conjunction with the <b class="symbol_lc">-man</b> argument. It sets the number of object identifier components that <b class="command">mibcomp</b> reserves for variables which have an instance identifier that is an <b class="symbol_UC">OBJECT IDENTIFIER</b>. <b class="command">mibcomp</b> defaults to reserving space for 23 components if you don't specify this argument.</><br></dl></dl></dl><dd><div class="Item"><a name="83673"> </a><b class="command">-inst_str_len </b><i class="textVariable">length <br></i></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84655"> </a>This argument is only meaningful in conjunction with the <b class="command">-man</b> argument. It sets the number of octets (bytes) that <b class="command">mibcomp</b> reserves for variables which have an instance identifier that is an <b class="symbol_UC">OCTET STRING</b> with no size constraint. <b class="command">mibcomp</b> defaults to reserving space for 65 bytes if you don't specify this argument.</><br></dl></dl></dl><dd><div class="Item"><a name="83677"> </a><b class="command">-k_and_r</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84614"> </a>The <b class="command">-k_and_r</b><sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup> option causes any C code generated by this run of <b class="command">mibcomp</b> to use the "traditional" (non-ANSI) format for function declarations and definitions. This option and the <b class="command">-ansi</b> option are mutually exclusive; <b class="command">-ansi</b> is the default.</><br></dl></dl></dl><dd><div class="Item"><a name="83678"> </a><b class="command">-l </b><i class="textVariable">MIB-search-path <br></i></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84657"> </a>The WindNet SNMPv1/v2c target agent supports search paths for input files. The <b class="symbol_lc">-l</b> option adds one directory to the search path. You can specify more than one <b class="symbol_lc">-l</b> option; <b class="command">mibcomp</b> remembers a list of directories to search. </><br><dd><div class="Indent3"><a name="84649"> </a>You may want to have one copy of standard MIB files that are shared by all your engineers, rather than having separate copies for each project. You would then use <b class="command">-l</b> to specify the directory where the standard MIBs reside. You may want to set the <b class="command">-l</b> options in your MIBCOMP environment variable, rather than wiring pathnames into Makefiles that use <b class="command">mibcomp</b>.</><br></dl></dl></dl><dd><div class="Item"><a name="83685"> </a><b class="command">-leaf</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84616"> </a><b class="command"><a href="x-mibcompOut.html#83441"></b><i class="title">-leaf</i><b class="command"></a></b></><br></dl></dl></dl><dd><div class="Item"><a name="83689"> </a><b class="command">-loadtree</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84618"> </a><a href="x-mibcompOut.html#83448"><i class="title">-loadtree</i></a></><br></dl></dl></dl><dd><div class="Item"><a name="83690"> </a><b class="command">-lowmem</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84620"> </a>The <b class="command">-lowmem</b> option causes <b class="command">mibcomp</b> to immediately forget an <b class="symbol_UC">DESCRIPTION</b> or <b class="symbol_UC">REFERENCE</b> strings it sees when processing the <b class="symbol_UC">OBJECT-TYPE</b> or <b class="symbol_UC">NOTIFICATION-TYPE</b> macros. This saves memory and can help when you are running out of memory while compiling a large MIB. Since some of <b class="command">mibcomp</b>'s output modes use the <b class="symbol_UC">DESCRIPTION</b> clause to generate C comments in the output file, using <b class="command">-lowmem</b> results in a slightly less interesting (but also slightly smaller) output file.</><br></dl></dl></dl><dd><div class="Item"><a name="83694"> </a><b class="command">-man</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84622"> </a><a href="x-mibcompOut.html#83460"><i class="title">-man</i></a></><br></dl></dl></dl><dd><div class="Item"><a name="83698"> </a><b class="command">-man.h</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="84624"> </a><a href="x-mibcompOut.html#84031"><i class="title">-man.h</i></a></><br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -