+ /* extract sec, kb, kps from 'rest', if present. This isn't the stone age
+ * anymore, so we'll just do it the easy way (a regex) */
+ bzero(®ex, sizeof(regex));
+ reg_result = regcomp(®ex,
+ "\\[sec ([0-9.]+) kb ([0-9]+) kps [0-9.]+\\]", REG_EXTENDED);
+ if (reg_result != 0) {
+ error("Error compiling regular expression for parsing log lines");
+ /* NOTREACHED */
+ }
+
+ /* an error here just means the line wasn't found -- not fatal. */
+ reg_result = regexec(®ex, rest, sizeof(pmatch)/sizeof(*pmatch), pmatch, 0);
+ if (reg_result == 0) {
+ char *str;
+
+ str = find_regex_substring(rest, pmatch[1]);
+ sec = atof(str);
+ amfree(str);
+
+ str = find_regex_substring(rest, pmatch[2]);
+ kb = OFF_T_ATOI(str);
+ amfree(str);
+ } else {
+ sec = 0;
+ kb = 0;
+ }
+ regfree(®ex);
+