/usr/bin/adlint_sma is in adlint 3.2.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | #!/usr/bin/ruby1.9.1
#
# Single module analyzer.
#
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
# Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
# License:: GPLv3+: GNU General Public License version 3 or later
#
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
#--
# ___ ____ __ ___ _________
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
# / __ |/ /_/ / /___/ / /| / / /
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
#
# This file is part of AdLint.
#
# AdLint is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# AdLint is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# AdLint. If not, see <http://www.gnu.org/licenses/>.
#
#++
$LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
require "adlint"
$stdout.set_encoding(Encoding.default_external)
$stderr.set_encoding(Encoding.default_external)
version = "AdLint single module analyzer #{AdLint::VERSION}"
usage = <<EOS
Usage: adlint_sma [options] source-file...
Options:
-t FILE, --traits FILE Use FILE as traits file (mandatory)
-o DIR, --output-dir DIR Output result files to DIR
-p NUM, --strip NUM Use source file names from which stripped NUM
leading components as the base name of output
files
-v, --verbose Increase verbosity but suppress message output
--version Display version information
--copyright Display copyright information
--prefix Display prefix directory of AdLint
-h, --help Display this message
EOS
require "getoptlong"
getopt = GetoptLong.new(
["--traits", "-t", GetoptLong::REQUIRED_ARGUMENT],
["--output-dir", "-o", GetoptLong::REQUIRED_ARGUMENT],
["--strip", "-p", GetoptLong::REQUIRED_ARGUMENT],
["--verbose", "-v", GetoptLong::NO_ARGUMENT],
["--version", GetoptLong::NO_ARGUMENT],
["--copyright", GetoptLong::NO_ARGUMENT],
["--prefix", GetoptLong::NO_ARGUMENT],
["--help", "-h", GetoptLong::NO_ARGUMENT]
)
begin
traits_fpath = nil
output_dpath = nil
strip_num = 0
verbose = false
getopt.each_option do |opt_name, opt_val|
case opt_name
when "--traits"
traits_fpath = Pathname.new(opt_val)
when "--output-dir"
output_dpath = Pathname.new(opt_val)
when "--strip"
strip_num = opt_val.to_i
when "--verbose"
verbose = true
when "--version"
puts version, AdLint::AUTHOR
exit 0
when "--copyright"
puts AdLint::COPYRIGHT
exit 0
when "--prefix"
puts AdLint::Config[:prefix]
exit 0
when "--help"
puts usage
exit 0
end
end
rescue
$stderr.puts usage
exit 1
end
input_fpaths = ARGV.map { |str| Pathname.new(str) }
if input_fpaths.empty?
$stderr.puts "#{File.basename(__FILE__)}: no input files"
$stderr.puts usage
exit 1
end
unless traits_fpath
$stderr.puts "#{File.basename(__FILE__)}: no traits file"
$stderr.puts usage
exit 1
end
begin
adlint = AdLint::AdLint.new(traits_fpath, output_dpath, verbose)
failed = false
input_fpaths.each do |fpath|
adlint.run_sma!(fpath, strip_num) or failed = true
end
exit 4 if failed
rescue => ex
$stderr.puts ex.message, ex.backtrace
$stderr.puts
exit 2
end
exit 0
|