#include "pager.h"
#include "logs-show.h"
#include "strv.h"
+#include "journal-internal.h"
static OutputMode arg_output = OUTPUT_SHORT;
static bool arg_follow = false;
static int arg_lines = -1;
static bool arg_no_tail = false;
static bool arg_new_id128 = false;
+static bool arg_print_header = false;
static bool arg_quiet = false;
static bool arg_local = false;
static bool arg_this_boot = false;
" -l --local Only local entries\n"
" -b --this-boot Show data only from current boot\n"
" -D --directory=PATH Show journal files from directory\n"
+ " --header Show journal header information\n"
" --new-id128 Generate a new 128 Bit id\n",
program_invocation_short_name);
ARG_VERSION = 0x100,
ARG_NO_PAGER,
ARG_NO_TAIL,
- ARG_NEW_ID128
+ ARG_NEW_ID128,
+ ARG_HEADER
};
static const struct option options[] = {
{ "local", no_argument, NULL, 'l' },
{ "this-boot", no_argument, NULL, 'b' },
{ "directory", required_argument, NULL, 'D' },
+ { "header", no_argument, NULL, ARG_HEADER },
{ NULL, 0, NULL, 0 }
};
arg_directory = optarg;
break;
+ case ARG_HEADER:
+ arg_print_header = true;
+ break;
+
case '?':
return -EINVAL;
STRV_FOREACH(i, args) {
- if (path_is_absolute(*i)) {
+ if (streq(*i, "+"))
+ r = sd_journal_add_disjunction(j);
+ else if (path_is_absolute(*i)) {
char *p;
const char *path;
struct stat st;
return -ENOMEM;
}
- r = sd_journal_add_match(j, t, strlen(t));
+ r = sd_journal_add_match(j, t, 0);
free(t);
} else {
free(p);
free(p);
} else
- r = sd_journal_add_match(j, *i, strlen(*i));
+ r = sd_journal_add_match(j, *i, 0);
if (r < 0) {
- log_error("Failed to add match: %s", strerror(-r));
+ log_error("Failed to add match '%s': %s", *i, strerror(-r));
return r;
}
}
goto finish;
}
+ if (arg_print_header) {
+ journal_print_header(j);
+ r = 0;
+ goto finish;
+ }
+
r = add_this_boot(j);
if (r < 0)
goto finish;