2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-02 07:15:39 +00:00

> People send us a lot of 'sensors' output and without the algo/adap

> info it would be a lot harder to diagnose things, or we would have to
> ask them to use -V, so I'd rather not take that info out by default.
> If you want to submit a -A patch (including a man page update) I'll
> apply it.
> thanks
> mds

Here is my patch.

Some additional notes:

This patch also fixes a bug with the --unknown command line switch,
which was waiting for an argument it doesn't actually need.

I suggest a change for the manual page, from "Linux Programmer's Manual"
to "Linux User's Manual" (My patch doesn't change this... This is only a
suggestion.)

As usual, I am open to any suggestion, comment...
Thanks.

--
Jean "Khali" Delvare
http://www.ensicaen.ismra.fr/~delvare/


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1400 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker
2002-06-22 03:32:55 +00:00
parent 7ff02877fc
commit 114dafae84
2 changed files with 15 additions and 7 deletions

View File

@@ -52,7 +52,7 @@ static const char *sprintf_chip_name(sensors_chip_name name);
#define CHIPS_MAX 20
sensors_chip_name chips[CHIPS_MAX];
int chips_count=0;
int do_sets, do_unknown, fahrenheit;
int do_sets, do_unknown, fahrenheit, hide_adapter;
void print_short_help(void)
{
@@ -65,7 +65,8 @@ void print_long_help(void)
printf(" -c, --config-file Specify a config file\n");
printf(" -h, --help Display this help text\n");
printf(" -s, --set Execute `set' statements too (root only)\n");
printf(" -f, --fahrenheit Show temperatures in degrees fahrenheit\n" );
printf(" -f, --fahrenheit Show temperatures in degrees fahrenheit\n");
printf(" -A, --no-adapter Do not show adapter and algorithm for each chip\n");
printf(" -u, --unknown Treat chips as unknown ones (testing only)\n");
printf(" -v, --version Display the program version\n");
printf("\n");
@@ -147,15 +148,17 @@ int main (int argc, char *argv[])
{ "set", no_argument, NULL, 's' },
{ "version", no_argument, NULL, 'v'},
{ "fahrenheit", no_argument, NULL, 'f' },
{ "no-adapter", no_argument, NULL, 'A' },
{ "config-file", required_argument, NULL, 'c' },
{ "unknown", required_argument, NULL, 'u' },
{ "unknown", no_argument, NULL, 'u' },
{ 0,0,0,0 }
};
do_unknown = 0;
do_sets = 0;
hide_adapter = 0;
while (1) {
c = getopt_long(argc,argv,"hvufsc:",long_opts,NULL);
c = getopt_long(argc,argv,"hsvfAcu:",long_opts,NULL);
if (c == EOF)
break;
switch(c) {
@@ -178,6 +181,9 @@ int main (int argc, char *argv[])
case 'f':
fahrenheit = 1;
break;
case 'A':
hide_adapter = 1;
break;
case 'u':
do_unknown = 1;
break;
@@ -279,10 +285,10 @@ void do_a_print(sensors_chip_name name)
printf("%s\n",sprintf_chip_name(name));
adap = sensors_get_adapter_name(name.bus);
if (adap)
if (adap && !hide_adapter)
printf("Adapter: %s\n",adap);
algo = sensors_get_algorithm_name(name.bus);
if (algo)
if (algo && !hide_adapter)
printf("Algorithm: %s\n",algo);
if (!algo || !adap)
printf(" ERROR: Can't get adapter or algorithm?!?\n");