(*r != '\t') && (*r != ' ') && (*r != ',')) {
if(s == buffer + buffer_size) {
fprintf(stderr, "Buffer overflow in next_word.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
*s++ = *r++;
}
if(write(fan_fd, buffer, strlen(buffer)) < 0) {
fprintf(stderr, "Error in setting the fan level (%s).\n",
strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if(file_thermal) {
fprintf(stderr, "Thermal files already defined.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
char *s;
if(temperature_thresholds) {
fprintf(stderr, "Temperature thresholds already defined.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
nb_temperature_thresholds = 1;
if(s == 0) {
fprintf(stderr, "Missing parameter in %s:%d\n",
configuration_file, line_number);
- exit(1);
+ exit(EXIT_FAILURE);
}
define_thermal_files(s);
}
else if(strcmp(token, "fan_file") == 0) {
if(file_fan) {
fprintf(stderr, "Fan file already defined.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
if(s == 0) {
fprintf(stderr, "Missing parameter in %s:%d\n",
configuration_file, line_number);
- exit(1);
+ exit(EXIT_FAILURE);
}
file_fan = strdup(s);
}
if(s == 0) {
fprintf(stderr, "Missing parameter in %s:%d\n",
configuration_file, line_number);
- exit(1);
+ exit(EXIT_FAILURE);
}
define_temperature_thresholds(s);
}
else if(token[0] && token[0] != '#') {
fprintf(stderr, "Unknown keyword '%s' in %s:%d.\n",
token, configuration_file, line_number);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
i++;
if(i == argc) {
fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]);
- exit(1);
+ exit(EXIT_FAILURE);
}
free(configuration_file);
i++;
if(i == argc) {
fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]);
- exit(1);
+ exit(EXIT_FAILURE);
}
define_thermal_files(argv[i]);
i++;
i++;
if(i == argc) {
fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]);
- exit(1);
+ exit(EXIT_FAILURE);
}
if(file_fan) {
fprintf(stderr, "Fan file already defined.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
file_fan = strdup(argv[i]);
if(i == argc) {
fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]);
- exit(1);
+ exit(EXIT_FAILURE);
}
define_temperature_thresholds(argv[i]);
else {
fprintf(stderr, "Unknown argument %s.\n", argv[i]);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if(!file) {
fprintf(stderr, "Can not open `%s' for reading.\n", configuration_file);
- exit(1);
+ exit(EXIT_FAILURE);
}
start = 0;
buffer_size);
fprintf(stderr, raw_line);
fprintf(stderr, "\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* If we got a line, we replace the carriage return by a \0 to
if(nb_temperature_thresholds == 0) {
fprintf(stderr, "No temperature threshold was provided.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
if(nb_file_thermal == 0) {
fprintf(stderr, "No thermal file was provided.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
if(file_fan == 0){
fprintf(stderr, "No fan file was provided.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
for(i = 0; i < nb_file_thermal; i++) {
if(file_thermal_fd[i] < 0) {
fprintf(stderr, "Can not open %s for reading (%s).\n",
file_thermal[i], strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if(file_fan_fd < 0) {
fprintf(stderr, "Can not open %s for writing (%s).\n",
file_fan, strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
/******************************************************************/
fprintf(stderr, "Error while reading %s (too large).\n",
file_thermal[i]);
}
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if(temperature < 0) {
fprintf(stderr, "Could not read a meaningful temperature.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
nb_rounds_since_last_change++;
/* We set it every time, even when there is no change, to handle
when the level has been modified somewhere else (for instance
- when combing back from suspend). */
+ when coming back from suspend). */
set_fan_level(file_fan_fd, new_level, nb_temperature_thresholds - 1);