mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-06 15:51:34 +00:00
sensors-detect: Rework option handling
Rework the way command line options are handled. If we ever need more than this, we should consider moving to some GetOpt perl module.
This commit is contained in:
1 parent
5b6f3f26e0
commit
ec4160f771
2 files changed
+15
-6
No files matched your search
@@ -12,6 +12,7 @@ SVN HEAD
|
||||
Add a PCI ID for new family 15h AMD processors
|
||||
Introduce automatic mode (--auto)
|
||||
Detect incorrect non-interactive runs
|
||||
Rework option handling
|
||||
|
||||
3.3.4 (2013-05-27)
|
||||
sensors.conf.5: Mention "sensors -u" to get the raw feature names
|
||||
|
||||
@@ -6824,14 +6824,22 @@ sub main
|
||||
{
|
||||
my ($input, $superio_features);
|
||||
|
||||
# Handle special command line cases first
|
||||
if (defined $ARGV[0] && $ARGV[0] eq "--stat") {
|
||||
show_i2c_stats();
|
||||
exit 0;
|
||||
# Parse command line options
|
||||
while (defined $ARGV[0]) {
|
||||
if ($ARGV[0] eq "--stat") {
|
||||
$opt{stat} = 1;
|
||||
} elsif ($ARGV[0] eq "--auto") {
|
||||
$opt{auto} = 1;
|
||||
} else {
|
||||
print STDERR "Error: unknown option $ARGV[0]\n";
|
||||
exit 1;
|
||||
}
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq "--auto") {
|
||||
$opt{auto} = 1;
|
||||
if ($opt{stat}) {
|
||||
show_i2c_stats();
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# We won't go very far if not root
|
||||
|
||||
Reference in new issue
Block a user