Changeset 945

Show
Ignore:
Timestamp:
12/14/00 02:20:52 (12 years ago)
Author:
mds
Message:

(mds) print message if no sensors are found rather than just silently returning.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/CHANGES

    r943 r945  
    3737  Program sensors: Add ds1621, mtp008 support; add -f (Fahrenheit) option; 
    3838                   add adm1025 temp2; report temp limits correctly as 
    39                    min/max or limit/hysteresis 
     39                   min/max or limit/hysteresis; print message if no 
     40                   sensors are found. 
    4041  Program sensors-detect: Add ds1621, mtp008 detection; 
    4142                          add ServerWorks detection (no driver yet) 
  • lm-sensors/trunk/prog/sensors/main.c

    r935 r945  
    4646static void do_a_print(sensors_chip_name name); 
    4747static void do_a_set(sensors_chip_name name); 
    48 static void do_the_real_work(void); 
     48static int do_the_real_work(void); 
    4949static const char *sprintf_chip_name(sensors_chip_name name); 
    5050 
     
    207207  } 
    208208 
    209   do_the_real_work(); 
    210   exit(0); 
    211 } 
    212  
    213 void do_the_real_work(void) 
     209  if(do_the_real_work()) { 
     210    exit(0); 
     211  } else { 
     212    if(chips[0].prefix == SENSORS_CHIP_NAME_PREFIX_ANY) 
     213            fprintf(stderr,"No sensors found!\n"); 
     214    else 
     215            fprintf(stderr,"Specified sensor(s) not found!\n"); 
     216    exit(1); 
     217  } 
     218} 
     219 
     220/* returns number of chips found */ 
     221int do_the_real_work(void) 
    214222{ 
    215223  const sensors_chip_name *chip; 
    216224  int chip_nr,i; 
     225  int cnt = 0; 
    217226 
    218227  for (chip_nr = 0; (chip = sensors_get_detected_chips(&chip_nr));) 
     
    224233          do_a_print(*chip); 
    225234        i = chips_count; 
     235        cnt++; 
    226236      } 
     237   return(cnt); 
    227238} 
    228239