Modules may be imported into a database, either by reading directly from a file or by passing the module data to be parsed directly, using the import
subcommand. Any errors or warnings that are generated during parsing will be logged to the file channel configured for the database (see Logging Compiler Messages).
% dbcmd import option value ?option value ...?
dbcmd
option value
1
if the data was parsed successfully (i.e., either there were no errors during the parse or any errors that occurred were "recoverable").0
if the data was not parsed successfully (i.e., one or more non-recoverable errors occurred). If any module fails to be parsed successfully, then all imported data is discarded, including the file record its self if the -in
option (see below) was not specified.The SMITHY_MIB_PATH
environment variable can be set to a list of paths (delimited by semicolon on Windows or colon on other platforms) to be searched for the specified file when the import
command is given a relative path that is not found. For example, if set in the environment outside Tcl (csh syntax):
setenv SMITHY_MIB_PATH /usr/share/mibs:$HOME/mibs
With the above setting, given a relative file name like IF-MIB.mib
, the SDK will first attempt to find ./IF-MIB.mib
, then /usr/share/mibs/IF-MIB.mib
, and finally $HOME/mibs/IF-MIB.mib
, choosing the first file match found.
-errors variable
-filename path
-in recordName
@File#
, where #
is an integer suffix that uniquely identifies the file within its database. If this property is unspecified, then a new file record will be created to hold the imported records.-rawdata text
-warnings variable
-yylineno value
% smilib import -filename /path/to/module.mib \ -errors errCount -warnings warnCount 1 % smilib log "$errCount error(s), $warnCount warning(s)" 0 error(s), 0 warning(s)
% smilib import -filename /path/to/module.xml \ -errors errCount -warnings warnCount 1 % smilib log "$errCount error(s), $warnCount warning(s)" 0 error(s), 0 warning(s)
% set channel [open "example.mib" r] % set rawData [read $channel] % close $channel % set file [smilib new -file -filename "example.mib"] % smilib import -rawdata $rawData -in $file 1