- buf[fread(buf, 1, sizeof(buf), f)] = '\0';
- if (ferror(f))
- die("Error reading log file");
- if (strncmp(contents, buf, sizeof(buf)) != 0)
- die("Wrong contents in log file");
+ for (size_t i = 0; !is_end(exps[i]); i++) {
+ size_t len = strlen(exps[i].message);
+ char *buf = (char *)malloc(len + 2);
+ if (fgets(buf, len + 1, f) == NULL)
+ die("Error reading log file");
+ if (ferror(f))
+ die("Error reading log file");
+ if (strncmp(exps[i].message, buf, len + 1) != 0)
+ die("Wrong contents in log file");
+ free(buf);
+ }