Show
Ignore:
Timestamp:
04/14/99 22:05:16 (16 years ago)
Author:
frodo
Message:

New program doc-insmod.pl to automatically document the insmod

parameters of a module.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/doc/doc-features.pl

    r385 r389  
    11#!/usr/bin/perl 
     2 
     3# 
     4#    doc-features.pl - Generate module/library documentation 
     5#    Copyright (c) 1999  Frodo Looijaard <frodol@dds.nl> 
     6# 
     7#    This program is free software; you can redistribute it and/or modify 
     8#    it under the terms of the GNU General Public License as published by 
     9#    the Free Software Foundation; either version 2 of the License, or 
     10#    (at your option) any later version. 
     11# 
     12#    This program is distributed in the hope that it will be useful, 
     13#    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     14#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     15#    GNU General Public License for more details. 
     16# 
     17#    You should have received a copy of the GNU General Public License 
     18#    along with this program; if not, write to the Free Software 
     19#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
     20# 
    221 
    322use strict; 
     
    197216sub scan_all 
    198217{ 
    199   my ($prefix) = @_; 
     218  my ($prefix,@modules) = @_; 
    200219  my ($filename); 
    201220  scan_chips_h $prefix . "/lib/chips.h"; 
    202221  scan_chips_c_1 $prefix . "/lib/chips.c"; 
    203222  scan_chips_c_2 $prefix . "/lib/chips.c"; 
    204   foreach $filename (glob ($prefix ."/kernel/chips/*.c")) {  
    205     scan_kernel_module $filename  
     223  foreach $filename (@modules) {  
     224    scan_kernel_module "$prefix/kernel/chips/$filename" 
    206225  } 
    207226} 
     
    245264} 
    246265 
     266sub help_message 
     267{ 
     268  print STDERR "Syntax: doc-features PATH MODULES...\n"; 
     269  print STDERR "PATH is the path to the base of the lm_sensors tree.\n"; 
     270  print STDERR "MODULES are the modules that need to be examined. If none ". 
     271               "are specified,\n". 
     272               "all modules are examined. Modules are looked for in ". 
     273               "PATH/kernel/chips\n."; 
     274} 
     275 
     276# @_: @ARGV 
     277# Returns ($base_dir,@modules) 
     278sub scan_arguments  
     279{ 
     280  my ($base_dir,@modules); 
     281  if (@_ < 1 or @_[0] =~ /^-/) { 
     282    help_message; 
     283    exit 0; 
     284  } 
     285  $base_dir = @_[0]; 
     286  if (@_ == 1) { 
     287    @modules = map { substr $_, length "$base_dir/kernel/chips/" } 
     288                   glob "$base_dir/kernel/chips/*.c"; 
     289  } else { 
     290    splice(@_,0,1); 
     291    @modules = map { $_ !~ /\./ ? $_.".c" : $_ } @_;  
     292  } 
     293  return ($base_dir,@modules) 
     294} 
    247295 
    248296initialize; 
    249 scan_all "../.."; 
     297scan_all scan_arguments @ARGV; 
    250298my $el; 
    251299foreach $el (keys %features) { 
    252   output_data $el; 
    253   print "\n\n"; 
    254 } 
     300  if (exists $sysctls{$features{$el}->{features}->[0]->{sysctl}}) { 
     301    output_data $el; 
     302    print "\n\n"; 
     303  } 
     304}