mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-31 14:25:39 +00:00
"sensors" no longer needs a default configuration file name. If no
file name is provided on the command line, use the libsensors default. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4986 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -6,6 +6,7 @@ SVN HEAD
|
|||||||
sensord: Reload config on SIGHUP rather than automatically
|
sensord: Reload config on SIGHUP rather than automatically
|
||||||
sensors: Fix file handle leak on library initialization error
|
sensors: Fix file handle leak on library initialization error
|
||||||
Handle the case where voltage measurements aren't available
|
Handle the case where voltage measurements aren't available
|
||||||
|
No default configuration file name
|
||||||
sensors-detect: Fix SMSC LPC47B357/M967 detection
|
sensors-detect: Fix SMSC LPC47B357/M967 detection
|
||||||
Select the right driver for FSC chips
|
Select the right driver for FSC chips
|
||||||
sensors-detect-stat.pl: Handle alternative chip lists
|
sensors-detect-stat.pl: Handle alternative chip lists
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
#define PROGRAM "sensors"
|
#define PROGRAM "sensors"
|
||||||
#define VERSION LM_VERSION
|
#define VERSION LM_VERSION
|
||||||
#define DEFAULT_CONFIG_FILE ETCDIR "/sensors.conf"
|
|
||||||
|
|
||||||
static int do_sets, do_raw, hide_adapter;
|
static int do_sets, do_raw, hide_adapter;
|
||||||
|
|
||||||
@@ -54,9 +53,8 @@ static void print_short_help(void)
|
|||||||
static void print_long_help(void)
|
static void print_long_help(void)
|
||||||
{
|
{
|
||||||
printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM);
|
printf("Usage: %s [OPTION]... [CHIP]...\n", PROGRAM);
|
||||||
printf(" -c, --config-file Specify a config file (default: %s)\n",
|
puts(" -c, --config-file Specify a config file\n"
|
||||||
DEFAULT_CONFIG_FILE);
|
" -h, --help Display this help text\n"
|
||||||
puts(" -h, --help Display this help text\n"
|
|
||||||
" -s, --set Execute `set' statements (root only)\n"
|
" -s, --set Execute `set' statements (root only)\n"
|
||||||
" -f, --fahrenheit Show temperatures in degrees fahrenheit\n"
|
" -f, --fahrenheit Show temperatures in degrees fahrenheit\n"
|
||||||
" -A, --no-adapter Do not show adapter for each chip\n"
|
" -A, --no-adapter Do not show adapter for each chip\n"
|
||||||
@@ -88,15 +86,20 @@ static int read_config_file(const char *config_file_name)
|
|||||||
FILE *config_file;
|
FILE *config_file;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!strcmp(config_file_name, "-"))
|
if (config_file_name) {
|
||||||
config_file = stdin;
|
if (!strcmp(config_file_name, "-"))
|
||||||
else
|
config_file = stdin;
|
||||||
config_file = fopen(config_file_name, "r");
|
else
|
||||||
|
config_file = fopen(config_file_name, "r");
|
||||||
|
|
||||||
if (!config_file) {
|
if (!config_file) {
|
||||||
fprintf(stderr, "Could not open config file\n");
|
fprintf(stderr, "Could not open config file\n");
|
||||||
perror(config_file_name);
|
perror(config_file_name);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Use libsensors default */
|
||||||
|
config_file = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = sensors_init(config_file);
|
err = sensors_init(config_file);
|
||||||
@@ -106,7 +109,7 @@ static int read_config_file(const char *config_file_name)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose(config_file) == EOF)
|
if (config_file && fclose(config_file) == EOF)
|
||||||
perror(config_file_name);
|
perror(config_file_name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -239,7 +242,7 @@ static void print_bus_list(void)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c, res, i, error, do_bus_list;
|
int c, res, i, error, do_bus_list;
|
||||||
const char *config_file_name = DEFAULT_CONFIG_FILE;
|
const char *config_file_name = NULL;
|
||||||
|
|
||||||
struct option long_opts[] = {
|
struct option long_opts[] = {
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
.\" Formatted or processed versions of this manual, if unaccompanied by
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||||
.\" the source, must acknowledge the copyright and authors of this work.
|
.\" the source, must acknowledge the copyright and authors of this work.
|
||||||
.\"
|
.\"
|
||||||
.TH sensors 1 "September 2007" "lm-sensors 3" "Linux User's Manual"
|
.TH sensors 1 "October 2007" "lm-sensors 3" "Linux User's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
sensors \- print sensors information
|
sensors \- print sensors information
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -50,9 +50,9 @@ is used to generate bus statements suitable for the configuration file.
|
|||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.IP "-c config-file"
|
.IP "-c config-file"
|
||||||
Specify a configuration file. If no file is specified, `/etc/sensors.conf'
|
Specify a configuration file. If no file is specified, the libsensors
|
||||||
is used. Use `-c /dev/null' to temporarily disable this default configuration
|
default configuration file is used. Use `-c /dev/null' to temporarily
|
||||||
file.
|
disable this default configuration file.
|
||||||
.IP -h
|
.IP -h
|
||||||
Print a help text and exit.
|
Print a help text and exit.
|
||||||
.IP -s
|
.IP -s
|
||||||
|
Reference in New Issue
Block a user