From: anthony Date: Tue, 6 Jun 2006 03:14:39 +0000 (+0000) Subject: 1. Was erroneously using tokptr vice key. X-Git-Tag: svn-trunk~15^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f1bfea1ac72c1247356bc892a74620052b4bfab7;p=collectd.git 1. Was erroneously using tokptr vice key. 2. Changed calls to strcmp to strncmp so that only definate ranges where being compared. --- diff --git a/src/apcups.c b/src/apcups.c index b9a500d0..7a1cc065 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -416,21 +416,21 @@ static int apc_query_server (char *host, int port, 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, ":"); @@ -446,7 +446,6 @@ static int apc_query_server (char *host, int port, net_close(&sockfd); } - return (0); }