int force = 0; // force access to a different layout
int lfremap = 0; // remap LF in traces
+int repair = 0; // repair file
/* display the message and exit with the code */
"options :\n"
" -f : force accessing a non-matching layout for 'ring struct'\n"
" -l : replace LF in contents with CR VT\n"
+ " -r : \"repair\" corrupted file (actively search for message boundaries)\n"
"\n"
"", arg0);
}
* stop before the end.
*/
while (ofs + 1 < b_data(&buf)) {
+ if (unlikely(repair && *b_peek(&buf, ofs))) {
+ /* in repair mode we consider that we could have landed
+ * in the middle of a message so we skip all bytes till
+ * the next zero.
+ */
+ ofs++;
+ continue;
+ }
cnt = 1;
len = b_peek_varint(&buf, ofs + cnt, &msg_len);
if (!len)
force = 1;
else if (strcmp(argv[0], "-l") == 0)
lfremap = 1;
+ else if (strcmp(argv[0], "-r") == 0)
+ repair = 1;
else if (strcmp(argv[0], "--") == 0)
break;
else