129 |
|
/* Horrible big enough, but it should be easily big enough */ |
130 |
|
char line[8096]; |
131 |
|
regex_t regex; |
132 |
< |
regmatch_t line_match[4]; |
132 |
> |
regmatch_t line_match[9]; |
133 |
|
#endif |
134 |
|
#ifdef ALLBSD |
135 |
|
struct ifaddrs *net, *net_ptr; |
230 |
|
fgets(line, sizeof(line), f); |
231 |
|
|
232 |
|
|
233 |
< |
if((regcomp(®ex, "^[[:space:]]*([^:]+):[[:space:]]*([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+([[:digit:]]+)[[:space:]]+[[:digit:]]+[[:space:]]+[[:digit:]]+[[:space:]]+([[:digit:]]+)", REG_EXTENDED))!=0){ |
233 |
> |
if((regcomp(®ex, "^ *([^:]+): *([0-9]+) +([0-9]+) +([0-9]+) +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +([0-9]+) +([0-9]+) +([0-9]+) +[0-9]+ +[0-9]+ +([0-9]+)", REG_EXTENDED))!=0){ |
234 |
|
return NULL; |
235 |
|
} |
236 |
|
|
237 |
|
interfaces=0; |
238 |
|
|
239 |
|
while((fgets(line, sizeof(line), f)) != NULL){ |
240 |
< |
if((regexec(®ex, line, 4, line_match, 0))!=0){ |
240 |
> |
if((regexec(®ex, line, 9, line_match, 0))!=0){ |
241 |
|
continue; |
242 |
|
} |
243 |
|
network_stats=network_stat_malloc((interfaces+1), &sizeof_network_stats, network_stats); |