mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-09-03 07:45:30 +00:00
doc-features now understands command-line given chip prefixes
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@390 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -215,13 +215,13 @@ sub scan_kernel_module
|
|||||||
# $_[0]: Base directory
|
# $_[0]: Base directory
|
||||||
sub scan_all
|
sub scan_all
|
||||||
{
|
{
|
||||||
my ($prefix,@modules) = @_;
|
my ($prefix) = @_;
|
||||||
my ($filename);
|
my ($filename);
|
||||||
scan_chips_h $prefix . "/lib/chips.h";
|
scan_chips_h $prefix . "/lib/chips.h";
|
||||||
scan_chips_c_1 $prefix . "/lib/chips.c";
|
scan_chips_c_1 $prefix . "/lib/chips.c";
|
||||||
scan_chips_c_2 $prefix . "/lib/chips.c";
|
scan_chips_c_2 $prefix . "/lib/chips.c";
|
||||||
foreach $filename (@modules) {
|
foreach $filename (glob ($prefix . "/kernel/chips/*.c")) {
|
||||||
scan_kernel_module "$prefix/kernel/chips/$filename"
|
scan_kernel_module "$filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,40 +265,50 @@ sub initialize
|
|||||||
|
|
||||||
sub help_message
|
sub help_message
|
||||||
{
|
{
|
||||||
print STDERR "Syntax: doc-features PATH MODULES...\n";
|
print STDERR "Syntax: doc-features PATH PREFIXES...\n";
|
||||||
print STDERR "PATH is the path to the base of the lm_sensors tree.\n";
|
print STDERR "PATH is the path to the base of the lm_sensors tree.\n";
|
||||||
print STDERR "MODULES are the modules that need to be examined. If none ".
|
print STDERR "PREFIXES are the chips that have to be output. If none ".
|
||||||
"are specified,\n".
|
"are specified,\n".
|
||||||
"all modules are examined. Modules are looked for in ".
|
"all chips are printed.\n";
|
||||||
"PATH/kernel/chips\n.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# @_: @ARGV
|
# @_: @ARGV
|
||||||
# Returns ($base_dir,@modules)
|
# Returns ($base_dir,@modules)
|
||||||
sub scan_arguments
|
sub scan_arguments
|
||||||
{
|
{
|
||||||
my ($base_dir,@modules);
|
my ($base_dir,@chips);
|
||||||
if (@_ < 1 or @_[0] =~ /^-/) {
|
if (@_ < 1 or @_[0] =~ /^-/) {
|
||||||
help_message;
|
help_message;
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
$base_dir = @_[0];
|
$base_dir = @_[0];
|
||||||
if (@_ == 1) {
|
if (@_ == 1) {
|
||||||
@modules = map { substr $_, length "$base_dir/kernel/chips/" }
|
@chips = ();
|
||||||
glob "$base_dir/kernel/chips/*.c";
|
|
||||||
} else {
|
} else {
|
||||||
splice(@_,0,1);
|
@chips = @_;
|
||||||
@modules = map { $_ !~ /\./ ? $_.".c" : $_ } @_;
|
splice(@chips,0,1);
|
||||||
}
|
}
|
||||||
return ($base_dir,@modules)
|
return ($base_dir,@chips)
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize;
|
sub main {
|
||||||
scan_all scan_arguments @ARGV;
|
my ($el,$base_dir,@prefixes,$prefix);
|
||||||
my $el;
|
initialize;
|
||||||
foreach $el (keys %features) {
|
my ($base_dir,@prefixes) = scan_arguments @_;
|
||||||
if (exists $sysctls{$features{$el}->{features}->[0]->{sysctl}}) {
|
scan_all $base_dir;
|
||||||
output_data $el;
|
if (@prefixes) {
|
||||||
print "\n\n";
|
foreach $prefix (@prefixes) {
|
||||||
|
foreach $el (keys %features) {
|
||||||
|
output_data ($el), print "\n\n"
|
||||||
|
if ($features{$el}->{prefix} eq $prefix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach $el (keys %features) {
|
||||||
|
output_data $el;
|
||||||
|
print "\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main @ARGV;
|
||||||
|
Reference in New Issue
Block a user