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
);
16 fprintf(stderr
, "Failed to open journal: %m\n");
19 r
= sd_journal_query_unique(j
, "_SYSTEMD_UNIT");
22 fprintf(stderr
, "Failed to query journal: %m\n");
25 SD_JOURNAL_FOREACH_UNIQUE(j
, d
, l
)
26 printf("%.*s\n", (int) l
, (const char*) d
);