Changeset 732
- Timestamp:
- 02/07/00 04:16:03 (13 years ago)
- Location:
- lm-sensors/trunk/prog/sensord
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/prog/sensord/chips.c
r661 r732 90 90 /** LM75 **/ 91 91 92 static c har *lm75_names[] = {92 static const char *lm75_names[] = { 93 93 SENSORS_LM75_PREFIX, NULL 94 94 }; … … 102 102 /** ADM1021 **/ 103 103 104 static c har *adm1021_names[] = {104 static const char *adm1021_names[] = { 105 105 SENSORS_ADM1021_PREFIX, NULL 106 106 }; … … 118 118 /** MAX1617 **/ 119 119 120 static c har *max1617_names[] = {120 static const char *max1617_names[] = { 121 121 SENSORS_MAX1617_PREFIX, SENSORS_MAX1617A_PREFIX, SENSORS_THMC10_PREFIX, SENSORS_LM84_PREFIX, SENSORS_GL523_PREFIX, NULL 122 122 }; … … 132 132 /** ADM9240 **/ 133 133 134 static c har *adm9240_names[] = {134 static const char *adm9240_names[] = { 135 135 SENSORS_ADM9240_PREFIX, SENSORS_DS1780_PREFIX, SENSORS_LM81_PREFIX, NULL 136 136 }; … … 162 162 /** SIS5595 **/ 163 163 164 static c har *sis5595_names[] = {164 static const char *sis5595_names[] = { 165 165 SENSORS_SIS5595_PREFIX, NULL 166 166 }; … … 186 186 /** LM78 **/ 187 187 188 static c har *lm78_names[] = {188 static const char *lm78_names[] = { 189 189 SENSORS_LM78_PREFIX, SENSORS_LM78J_PREFIX, SENSORS_LM79_PREFIX, /*"sis5595",*/ NULL 190 190 }; … … 220 220 /** GL518 **/ 221 221 222 static c har *gl518_names[] = {222 static const char *gl518_names[] = { 223 223 SENSORS_GL518_PREFIX, NULL 224 224 }; … … 251 251 } 252 252 253 static c har *lm80_names[] = {253 static const char *lm80_names[] = { 254 254 SENSORS_LM80_PREFIX, NULL 255 255 }; … … 281 281 /** W83781D **/ 282 282 283 static c har *w83781d_names[] = {283 static const char *w83781d_names[] = { 284 284 SENSORS_W83781D_PREFIX, NULL 285 285 }; … … 328 328 } 329 329 330 static c har *w83782d_names[] = {330 static const char *w83782d_names[] = { 331 331 SENSORS_W83782D_PREFIX, SENSORS_W83627HF_PREFIX, SENSORS_AS99127F_PREFIX, NULL 332 332 }; … … 368 368 /** W83783S **/ 369 369 370 static c har *w83783s_names[] = {370 static const char *w83783s_names[] = { 371 371 SENSORS_W83783S_PREFIX, NULL 372 372 }; … … 413 413 } 414 414 415 static c har *maxilife_names[] = {415 static const char *maxilife_names[] = { 416 416 SENSORS_MAXI_CG_PREFIX, SENSORS_MAXI_CO_PREFIX, SENSORS_MAXI_AS_PREFIX, NULL 417 417 }; -
lm-sensors/trunk/prog/sensord/sensord.c
r703 r732 40 40 #include "sensord.h" 41 41 42 static c har *version = "0.2.0";43 44 static c har *sensorsCfgPaths[] = {42 static const char *version = "0.2.0"; 43 44 static const char *sensorsCfgPaths[] = { 45 45 "/etc", "/usr/lib/sensors", "/usr/local/lib/sensors", "/usr/lib", "/usr/local/lib", NULL 46 46 }; 47 static c har *sensorsCfgFile = "sensors.conf";48 static c har *sensorsLogFile = "/var/log/sensors";47 static const char *sensorsCfgFile = "sensors.conf"; 48 static const char *sensorsLogFile = "/var/log/sensors"; 49 49 static int sleepTime = 5 * 60; 50 50 … … 80 80 81 81 static char * 82 now 82 nowf 83 83 (void) { 84 84 time_t now; … … 129 129 (const sensors_chip_name *chip, ChipDescriptor *descriptor) { 130 130 FeatureDescriptor *features = descriptor->features; 131 int index , subindex;132 int ret = 0; 133 134 for (index = 0; !done && (ret == 0) && features[index].format; ++ index) {135 FeatureDescriptor *feature = features + index ;131 int index0, subindex; 132 int ret = 0; 133 134 for (index0 = 0; !done && (ret == 0) && features[index0].format; ++ index0) { 135 FeatureDescriptor *feature = features + index0; 136 136 char *label = NULL; 137 137 double values[MAX_DATA]; … … 159 159 (const sensors_chip_name *chip) { 160 160 const char *adapter, *algorithm; 161 int index , subindex, chipindex = -1;161 int index0, subindex, chipindex = -1; 162 162 int ret = 0; 163 163 164 164 if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA) 165 fprintf (sensorsLog, "%s: Chip: %s-isa-%04x\n", now (), chip->prefix, chip->addr);165 fprintf (sensorsLog, "%s: Chip: %s-isa-%04x\n", nowf(), chip->prefix, chip->addr); 166 166 else 167 fprintf (sensorsLog, "%s: Chip: %s-i2c-%d-%02x\n", now (), chip->prefix, chip->bus, chip->addr);167 fprintf (sensorsLog, "%s: Chip: %s-i2c-%d-%02x\n", nowf(), chip->prefix, chip->bus, chip->addr); 168 168 adapter = sensors_get_adapter_name (chip->bus); 169 169 if (adapter) 170 fprintf (sensorsLog, "%s: Adapter: %s\n", now (), adapter);170 fprintf (sensorsLog, "%s: Adapter: %s\n", nowf(), adapter); 171 171 algorithm = sensors_get_algorithm_name (chip->bus); 172 172 if (algorithm) 173 fprintf (sensorsLog, "%s: Algorithm: %s\n", now (), algorithm);173 fprintf (sensorsLog, "%s: Algorithm: %s\n", nowf(), algorithm); 174 174 /* assert adapter || algorithm */ 175 175 176 for (index = 0; knownChips[index].names; ++ index)177 for (subindex = 0; knownChips[index ].names[subindex]; ++ subindex)178 if (!strcmp (chip->prefix, knownChips[index ].names[subindex]))179 chipindex = index ;176 for (index0 = 0; knownChips[index0].names; ++ index0) 177 for (subindex = 0; knownChips[index0].names[subindex]; ++ subindex) 178 if (!strcmp (chip->prefix, knownChips[index0].names[subindex])) 179 chipindex = index0; 180 180 181 181 if (chipindex >= 0) … … 191 191 (void) { 192 192 const sensors_chip_name *chip; 193 int index = 0;194 int ret = 0; 195 196 fprintf (sensorsLog, "%s: Sense.\n", now ());193 int index0 = 0; 194 int ret = 0; 195 196 fprintf (sensorsLog, "%s: Sense.\n", nowf()); 197 197 fflush (sensorsLog); 198 198 199 while (!done && (ret == 0) && ((chip = sensors_get_detected_chips (&index )) != NULL)) {199 while (!done && (ret == 0) && ((chip = sensors_get_detected_chips (&index0)) != NULL)) { 200 200 ret = readChip (chip); 201 201 } 202 202 203 fprintf (sensorsLog, "%s: Done.\n", now ());203 fprintf (sensorsLog, "%s: Done.\n", nowf()); 204 204 fflush (sensorsLog); 205 205 … … 213 213 214 214 if (sensorsLog != NULL) { 215 fprintf (sensorsLog, "%s: Rotate.\n", now ());215 fprintf (sensorsLog, "%s: Rotate.\n", nowf()); 216 216 fclose (sensorsLog); 217 217 } … … 220 220 ret = 1; 221 221 } else { 222 fprintf (sensorsLog, "%s: Started.\n", now ());222 fprintf (sensorsLog, "%s: Started.\n", nowf()); 223 223 fflush (sensorsLog); 224 224 } … … 241 241 strcpy (cfgPath, sensorsCfgFile); 242 242 } else { 243 int index ;244 for (index = 0; sensorsCfgPaths[index]; ++ index) {245 sprintf (cfgPath, "%s/%s", sensorsCfgPaths[index ], sensorsCfgFile);243 int index0; 244 for (index0 = 0; sensorsCfgPaths[index0]; ++ index0) { 245 sprintf (cfgPath, "%s/%s", sensorsCfgPaths[index0], sensorsCfgFile); 246 246 if (stat (cfgPath, &stats) == 0) 247 247 break; 248 248 } 249 if (!sensorsCfgPaths[index ]) {249 if (!sensorsCfgPaths[index0]) { 250 250 syslog (LOG_ERR, "Error locating sensors configuration: %s", sensorsCfgFile); 251 251 return 9; … … 299 299 300 300 if (sensorsLog) { 301 fprintf (sensorsLog, "%s: %s.\n", now (), ret ? "Failed" : "Stopped");301 fprintf (sensorsLog, "%s: %s.\n", nowf(), ret ? "Failed" : "Stopped"); 302 302 fclose (sensorsLog); 303 303 }
