]>
git.ipfire.org Git - thirdparty/systemd.git/blob - man/journal-iterate-wait.c
3 #include <systemd/sd-journal.h>
5 int main(int argc
, char *argv
[]) {
8 r
= sd_journal_open(&j
, SD_JOURNAL_LOCAL_ONLY
);
10 fprintf(stderr
, "Failed to open journal: %s\n", strerror(-r
));
16 r
= sd_journal_next(j
);
18 fprintf(stderr
, "Failed to iterate to next entry: %s\n", strerror(-r
));
22 /* Reached the end, let's wait for changes, and try again */
23 r
= sd_journal_wait(j
, (uint64_t) -1);
25 fprintf(stderr
, "Failed to wait for changes: %s\n", strerror(-r
));
30 r
= sd_journal_get_data(j
, "MESSAGE", &d
, &l
);
32 fprintf(stderr
, "Failed to read message field: %s\n", strerror(-r
));
35 printf("%.*s\n", (int) l
, (const char*) d
);