summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d82759c)
raw | patch | inline | side by side (parent: d82759c)
author | anthony <anthony> | |
Tue, 6 Jun 2006 03:14:39 +0000 (03:14 +0000) | ||
committer | anthony <anthony> | |
Tue, 6 Jun 2006 03:14:39 +0000 (03:14 +0000) |
2. Changed calls to strcmp to strncmp so that
only definate ranges where being compared.
only definate ranges where being compared.
src/apcups.c | patch | blob | history |
diff --git a/src/apcups.c b/src/apcups.c
index b9a500d00f64769b08d66d77f8e467330daf84d8..7a1cc065b9286d19cf15dae7a4075f83d65e4dd8 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
value = atof (tokptr);
PRINT_VALUE (key, value);
- if (strcmp ("LINEV", key) == 0)
+ if (strncmp ("LINEV", key,5) == 0)
apcups_detail->linev = value;
- else if (strcmp ("BATTV", tokptr) == 0)
+ else if (strncmp ("BATTV", key,5) == 0)
apcups_detail->battv = value;
- else if (strcmp ("ITEMP", tokptr) == 0)
+ else if (strncmp ("ITEMP", key,5) == 0)
apcups_detail->itemp = value;
- else if (strcmp ("LOADPCT", tokptr) == 0)
+ else if (strncmp ("LOADPCT", key,7) == 0)
apcups_detail->loadpct = value;
- else if (strcmp ("BCHARGE", tokptr) == 0)
+ else if (strncmp ("BCHARGE", key,7) == 0)
apcups_detail->bcharge = value;
- else if (strcmp ("OUTPUTV", tokptr) == 0)
+ else if (strncmp ("OUTPUTV", key,7) == 0)
apcups_detail->outputv = value;
- else if (strcmp ("LINEFREQ", tokptr) == 0)
+ else if (strncmp ("LINEFREQ", key,8) == 0)
apcups_detail->linefreq = value;
- else if (strcmp ("TIMELEFT", tokptr) == 0)
+ else if (strncmp ("TIMELEFT", key,8) == 0)
apcups_detail->timeleft = value;
tokptr = strtok (NULL, ":");
net_close(&sockfd);
}
-
return (0);
}