]>
git.ipfire.org Git - thirdparty/systemd.git/blob - man/journal-iterate-unique.c
1 /* SPDX-License-Identifier: MIT-0 */
5 #include <systemd/sd-journal.h>
7 int main(int argc
, char *argv
[]) {
13 r
= sd_journal_open(&j
, SD_JOURNAL_LOCAL_ONLY
);
15 fprintf(stderr
, "Failed to open journal: %s\n", strerror(-r
));
18 r
= sd_journal_query_unique(j
, "_SYSTEMD_UNIT");
20 fprintf(stderr
, "Failed to query journal: %s\n", strerror(-r
));
23 SD_JOURNAL_FOREACH_UNIQUE(j
, d
, l
)
24 printf("%.*s\n", (int) l
, (const char*) d
);