Changeset 2252
- Timestamp:
- 01/31/04 11:17:15 (9 years ago)
- Location:
- lm-sensors/trunk/prog/sensors
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/prog/sensors/chips.c
r2251 r2252 35 35 36 36 extern int fahrenheit; 37 extern char degstr[5]; 37 38 38 39 char *spacestr(int n) … … 63 64 int minmax, int curprec, int limitprec) 64 65 { 65 char degv[5];66 67 66 if (fahrenheit) { 68 sprintf(degv, "%cF", 176);69 67 n_cur = deg_ctof(n_cur); 70 68 n_over = deg_ctof(n_over); 71 69 n_hyst = deg_ctof(n_hyst); 72 } else {73 sprintf(degv, "%cC", 176);74 70 } 75 71 … … 77 73 if(minmax == MINMAX) 78 74 printf("%+6.*f%s (low = %+5.*f%s, high = %+5.*f%s) ", 79 curprec, n_cur, degv,80 limitprec, n_hyst, deg v,81 limitprec, n_over, deg v);75 curprec, n_cur, degstr, 76 limitprec, n_hyst, degstr, 77 limitprec, n_over, degstr); 82 78 else if(minmax == MAXONLY) 83 79 printf("%+6.*f%s (high = %+5.*f%s) ", 84 curprec, n_cur, deg v,85 limitprec, n_over, deg v);80 curprec, n_cur, degstr, 81 limitprec, n_over, degstr); 86 82 else if(minmax == CRIT) 87 83 printf("%+6.*f%s (high = %+5.*f%s, crit = %+5.*f%s) ", 88 curprec, n_cur, deg v,89 limitprec, n_over, deg v,90 limitprec, n_hyst, deg v);84 curprec, n_cur, degstr, 85 limitprec, n_over, degstr, 86 limitprec, n_hyst, degstr); 91 87 else if(minmax == HYST) 92 88 printf("%+6.*f%s (high = %+5.*f%s, hyst = %+5.*f%s) ", 93 curprec, n_cur, deg v,94 limitprec, n_over, deg v,95 limitprec, n_hyst, deg v);89 curprec, n_cur, degstr, 90 limitprec, n_over, degstr, 91 limitprec, n_hyst, degstr); 96 92 else if(minmax == SINGLE) 97 93 printf("%+6.*f%s", 98 curprec, n_cur, deg v);94 curprec, n_cur, degstr); 99 95 else if(minmax == HYSTONLY) 100 96 printf( "%+6.*f%s (hyst = %+5.*f%s) ", 101 curprec, n_cur, deg v,102 limitprec, n_over, deg v);97 curprec, n_cur, degstr, 98 limitprec, n_over, degstr); 103 99 else 104 100 printf("Unknown temperature mode!"); … … 1409 1405 !sensors_get_feature(*name,SENSORS_LM80_TEMP_OS_MAX,&max2)) { 1410 1406 if (valid) { 1411 print_label(label,10);1412 1413 if ( fahrenheit )1414 {1415 printf("%+3.2f°C (hot:limit = %+3.0f°F, hysteresis = %+3.0f°F) %s\n",1416 deg_ctof(cur),deg_ctof(max),deg_ctof(min), alarms&LM80_ALARM_TEMP_HOT?"ALARM":"");1417 printf(" (os: limit = %+3.0f°F, hysteresis = %+3.0f°F) %s\n",1418 deg_ctof(max2),deg_ctof(min2), alarms&LM80_ALARM_TEMP_HOT?"ALARM":""); 1419 }1420 else1421 {1422 printf("%+3.2f °C (hot:limit = %+3.0f°C, hysteresis = %+3.0f°C) %s\n",1423 cur,max,min, alarms&LM80_ALARM_TEMP_HOT?"ALARM":"");1424 printf(" (os: limit = %+3.0f°C, hysteresis = %+3.0f°C) %s\n",1425 max2,min2, alarms&LM80_ALARM_TEMP_HOT?"ALARM":"");1426 }1407 if (fahrenheit) { 1408 cur = deg_ctof(cur); 1409 max = deg_ctof(max); 1410 min = deg_ctof(min); 1411 max2 = deg_ctof(max2); 1412 min2 = deg_ctof(min2); 1413 } 1414 1415 print_label(label,10); 1416 printf("%+6.2f%s (hot: limit = %+3.0f%s, hyst = %+3.0f%s) %s\n", 1417 cur, degstr, max, degstr, min, degstr, 1418 alarms&LM80_ALARM_TEMP_HOT?"ALARM":""); 1419 print_label("",10); 1420 printf(" (os: limit = %+3.0f%s, hyst = %+3.0f%s) %s\n", 1421 max2, degstr, min2, degstr, 1422 alarms&LM80_ALARM_TEMP_HOT?"ALARM":""); 1427 1423 } 1428 1424 } else … … 4020 4016 static void lm92_print_temp (float n_cur,float n_high,float n_low,float n_crit,float n_hyst) 4021 4017 { 4022 char suffix[5];4023 4024 4018 if (fahrenheit) { 4025 sprintf (suffix,"%cF",176);4026 4019 n_cur = deg_ctof (n_cur); 4027 4020 n_high = deg_ctof (n_high); … … 4029 4022 n_crit = deg_ctof (n_crit); 4030 4023 n_hyst = deg_ctof (n_hyst); 4031 } else sprintf (suffix,"%cC",176);4024 } 4032 4025 4033 4026 printf ("%+6.4f%s (high = %+6.4f%s, low = %+6.4f%s, crit = %+6.4f%s, hyst = %+6.4f%s)", 4034 n_cur, suffix,4035 n_high, suffix,4036 n_low, suffix,4037 n_crit, suffix,4038 n_hyst, suffix);4027 n_cur, degstr, 4028 n_high, degstr, 4029 n_low, degstr, 4030 n_crit, degstr, 4031 n_hyst, degstr); 4039 4032 } 4040 4033 -
lm-sensors/trunk/prog/sensors/main.c
r2243 r2252 54 54 int chips_count=0; 55 55 int do_sets, do_unknown, fahrenheit, show_algorithm, hide_adapter, hide_unknown; 56 57 char degstr[5]; /* store the correct string to print degrees */ 56 58 57 59 void print_short_help(void) … … 245 247 246 248 close_config_file(); 249 250 /* build the degrees string */ 251 sprintf(degstr, "%c", 176); 252 if (fahrenheit) { 253 strcat(degstr, "F"); 254 } else { 255 strcat(degstr, "C"); 256 } 247 257 248 258 if(do_the_real_work(&error)) {
