- /* skip the first and second line */
- if (fgets(buf, sizeof(buf), fp) == NULL ||
- fgets(buf, sizeof(buf), fp) == NULL)
- goto endline;
-
- while (fgets(buf, sizeof(buf), fp)) {
- unsigned int status = 0;
- int link = 0;
- int noise = 0;
- /* No need to read */
- /*
- unsigned long nwid, crypt, frag, retry, misc, missed;
- */
-
- p_ifname = buf;
- while (*p_ifname == ' ') p_ifname++;
- p_entry = strchr(p_ifname, ':');
- if (p_entry == NULL)
- goto endline;
- *p_entry++ = '\0';
-
- if (g_strcmp0(p_ifname, WIFI_IFNAME) != 0)
- continue;
-
- /* read wireless status */
- char *saveptr;
- p_entry = strtok_r(p_entry, " .", &saveptr);
-
- /* status "%x" */
- if (p_entry != NULL)
- status = (int)strtol(p_entry, NULL, 16);
-
- p_entry = strtok_r(NULL, " .", &saveptr);
-
- /* Quality link "%d" */
- if (p_entry != NULL)
- link = (int)strtol(p_entry, NULL, 10);
-
- p_entry = strtok_r(NULL, " .", &saveptr);
-
- /* Quality level "%d" */
- if (p_entry != NULL)
- rssi_dbm = (int)strtol(p_entry, NULL, 10);
-
- p_entry = strtok_r(NULL, " .", &saveptr);
-
- /* Quality noise "%d" */
- if (p_entry != NULL)
- noise = (int)strtol(p_entry, NULL, 10);
-
- DBG("status(%x) link(%d) rssi_dbm(%d) noise(%d)",
- status, link, rssi_dbm, noise);
-
- /* No need to read */
- /*
- p_entry = strtok(NULL, " ."); // Discarded nwid "%lu"
- sscanf(p_entry, "%lu", &nwid);
- p_entry = strtok(NULL, " ."); // Discarded crypt "%lu"
- sscanf(p_entry, "%lu", &crypt);
- p_entry = strtok(NULL, " ."); // Discarded frag "%lu"
- sscanf(p_entry, "%lu", &frag);
- p_entry = strtok(NULL, " ."); // Discarded retry "%lu"
- sscanf(p_entry, "%lu", &retry);
- p_entry = strtok(NULL, " ."); // Discarded misc "%lu"
- sscanf(p_entry, "%lu", &misc);
- p_entry = strtok(NULL, " ."); // Discarded missed "%lu"
- sscanf(p_entry, "%lu", &missed);
- */