Skip to content
Snippets Groups Projects
Commit dfaea22a authored by Johannes Rudolph's avatar Johannes Rudolph
Browse files

finish function

parent 90cd9e0c
No related branches found
No related tags found
1 merge request!5Skip Mesh BSSID
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <regex.h> #include <regex.h>
/* The following is the size of a buffer to contain any error messages /* The following is the size of a buffer to contain any error messages
encountered when the regular expression is compiled. */ encountered when the regular expression is compiled. */
...@@ -132,19 +132,32 @@ int * getMeshBssid (){ ...@@ -132,19 +132,32 @@ int * getMeshBssid (){
fclose(f); fclose(f);
string[fsize] = 0; string[fsize] = 0;
printf("%s",string);
compile_regex(& r, regex_text); compile_regex(& r, regex_text);
result = match_regex(& r, string); result = match_regex(& r, string);
regfree (& r); regfree (& r);
printf("\n%s\n",result); char * str = strdup(result);
char* tok;
tok = strtok(str, ":");
int number = (int)strtol(tok, NULL, 16);
bssid[0] = number;
for(int i = 1 ; i < 6 ; i++){
tok = strtok(NULL, ":");
int number = (int)strtol(tok, NULL, 16);
bssid[i] = number;
}
return bssid; return bssid;
} }
int main (int argc, const char * argv[]) int main (int argc, const char * argv[])
{ {
getMeshBssid(); int* bssid = getMeshBssid();
for(int i = 0; i < 6; i++){
printf("%02x\n", bssid[i]);
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment