Skip to content

Commit 83e463e

Browse files
committed
lkrg-logctl: Support and report continuation lines
1 parent 7e37eb1 commit 83e463e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

logger/logctl.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ static int process_log(const char *pathname)
3232
while (fgets(buf, sizeof(buf), f)) {
3333
unsigned long long tr, ts, tsu, seq, teu;
3434
unsigned int sev;
35+
char type;
3536
int msgofs = 0;
36-
int n = sscanf(buf, "%llu,%llu,%llu,%u,%llu,%llu,-;%n", &tr, &ts, &tsu, &sev, &seq, &teu, &msgofs);
37-
if (n < 6 || !msgofs) {
37+
int n = sscanf(buf, "%llu,%llu,%llu,%u,%llu,%llu,%c;%n", &tr, &ts, &tsu, &sev, &seq, &teu, &type, &msgofs);
38+
if (n < 7 || !msgofs || (type != '-' && type != 'c')) {
3839
if (!(retval & 2)) {
3940
fputs("Warning: Skipping misformatted line(s)\n", stderr);
4041
retval |= 2;
@@ -56,7 +57,7 @@ static int process_log(const char *pathname)
5657
}
5758

5859
char ste[21];
59-
printf("%s %s", format_time(ste, sizeof(ste), te), msg);
60+
printf("%s %c %s", format_time(ste, sizeof(ste), te), type, msg);
6061
}
6162

6263
if (ferror(f)) {

0 commit comments

Comments
 (0)