1
0
Fork 0

Fixed broken wifi

Fixed indentation
Removed trailig white spaces
This commit is contained in:
Vincent Loupmon 2016-03-09 10:19:10 +01:00
parent 16d01e8ded
commit 3b6f51f8eb

View file

@ -264,9 +264,12 @@ wifi_signal()
char path_end[11] = "/operstate"; char path_end[11] = "/operstate";
char path[32]; char path[32];
char status[5]; char status[5];
char needle[sizeof wificard + 1];
FILE *fp; FILE *fp;
/* generate the path name */ /* generate the path name */
memset(path, 0, sizeof path);
strcat(path, path_start); strcat(path, path_start);
strcat(path, wificard); strcat(path, wificard);
strcat(path, path_end); strcat(path, path_end);
@ -295,10 +298,12 @@ wifi_signal()
} }
/* extract the signal strength */ /* extract the signal strength */
strcpy(needle, wificard);
strcat(needle, ":");
fgets(buf, bufsize, fp); fgets(buf, bufsize, fp);
fgets(buf, bufsize, fp); fgets(buf, bufsize, fp);
fgets(buf, bufsize, fp); fgets(buf, bufsize, fp);
if ((datastart = strstr(buf, "wlp3s0:")) != NULL) { if ((datastart = strstr(buf, needle)) != NULL) {
datastart = strstr(buf, ":"); datastart = strstr(buf, ":");
sscanf(datastart + 1, " %*d %d %*d %*d %*d %*d %*d %*d %*d %*d", &strength); sscanf(datastart + 1, " %*d %d %*d %*d %*d %*d %*d %*d %*d %*d", &strength);
} }