| | 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 | # |
| | 266 | sub 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) |
| | 278 | sub 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 | } |