1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include <stdio.h>
7 #include <sys/types.h>
8 
9 #include "sd-journal.h"
10 
11 #include "macro.h"
12 #include "output-mode.h"
13 #include "time-util.h"
14 #include "util.h"
15 
16 int show_journal_entry(
17                 FILE *f,
18                 sd_journal *j,
19                 OutputMode mode,
20                 unsigned n_columns,
21                 OutputFlags flags,
22                 char **output_fields,
23                 const size_t highlight[2],
24                 bool *ellipsized);
25 int show_journal(
26                 FILE *f,
27                 sd_journal *j,
28                 OutputMode mode,
29                 unsigned n_columns,
30                 usec_t not_before,
31                 unsigned how_many,
32                 OutputFlags flags,
33                 bool *ellipsized);
34 
35 int add_match_this_boot(sd_journal *j, const char *machine);
36 
37 int add_matches_for_unit(
38                 sd_journal *j,
39                 const char *unit);
40 
41 int add_matches_for_user_unit(
42                 sd_journal *j,
43                 const char *unit,
44                 uid_t uid);
45 
46 int show_journal_by_unit(
47                 FILE *f,
48                 const char *unit,
49                 const char *namespace,
50                 OutputMode mode,
51                 unsigned n_columns,
52                 usec_t not_before,
53                 unsigned how_many,
54                 uid_t uid,
55                 OutputFlags flags,
56                 int journal_open_flags,
57                 bool system_unit,
58                 bool *ellipsized);
59 
60 void json_escape(
61                 FILE *f,
62                 const char* p,
63                 size_t l,
64                 OutputFlags flags);
65