Source: nut Version: 2.6.1-1 Severity: normal Tags: patch bestfcom.c:263:17: warning: variable 'time' set but not used [-Wunused-but-set-variable] bestfcom.c:263:8: warning: variable 'date' set but not used [-Wunused-but-set-variable]
I don't use this driver. The code block in line 139 has other time\|date variables usage. I couldn't see where those variables are defined. There is a comment that the author was declined to waste time on their usage. The beginning of the driver states about the derivation process of this driver from other drivers. $ grep -n 'time\|date' nut-2.6.1/drivers/bestfcom.c 5: driver. This driver was written in an attempt to consolidate 139: /* Do we really need to waste time on this? */ 143: sscanf(tmp, "00 Time %8s", time); 146: sscanf(tmp, "10 Date %8s", date); 148: dstate_setinfo("ups.time", "%s", time); 149: dstate_setinfo("ups.date", "%s", date); 195:time^M^M^JFeb 20, 22:13:32^M^J^M^J=>id^M^JUnit ID "ME3.1K12345"^M^J^M^J=> 212: /* Give the UPS some time to chew on what we just sent */ 247:void upsdrv_updateinfo(void) 252: upsdebugx(1, "upsupdate run before ups_ident() read ups config"); 257: int inverter=0, charger=0, vin=0, vout=0, btimeleft=0, linestat=0, 263: char date[9], time[9], tmp[32]; 267: date[0]='\0'; 268: time[0]='\0'; 282: /* Battery voltage. int times 10 */ 294: /* Runtime remaining (UPS reports minutes) */ 295: btimeleft = bcd2i(&fstring[58], 4) * 60; 298: /* Iout. int times 10 */ 333: fatalx(EXIT_FAILURE, "Unknown model in upsdrv_updateinfo()"); 362: upsdebugx(1, "Inverter On, charger: %d battery time left: %d", 363: charger, btimeleft); 369: upsdebugx(1, "Inverter Off, charger: %d battery time left: %d", 370: charger, btimeleft); 395: "Poll: inverter %d charger %d vin %d vout %d vaout %d btimeleft %d", 396: inverter, charger, vin, vout, vaout, btimeleft); 408: dstate_setinfo("battery.runtime", "%d", btimeleft); 433: human to observe the time being totally not a time. */ 435: if (execute("time\r", buf, sizeof(buf)) > 0) { 440: /* old Ferrups prompt for new time so send a blank line */ 650: Model Wt rat Vout VHi FrLo BatVN BatNLo LRuntime Model $ --- nut-2.6.1/drivers/bestfcom.c 2011-05-31 13:36:49.000000000 +0300 +++ nut-2.6.1/drivers/bestfcom.c 2011-07-13 14:08:27.000000000 +0300 @@ -260,13 +260,10 @@ double ampsout=0.0, vbatt=0.0, battpercent=0.0, loadpercent=0.0, upstemp=0.0, acfreq=0.0; - char date[9], time[9], tmp[32]; + char tmp[32]; upsdebugx(3, "f response: %d %s", (int)strlen(fstring), fstring); - date[0]='\0'; - time[0]='\0'; - /* Inverter status. 0=off 1=on */ inverter = bcd2i(&fstring[16], 2); -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org