journalctl.c | journalctl.c | |||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
static OutputMode arg_output = OUTPUT_SHORT; | static OutputMode arg_output = OUTPUT_SHORT; | |||
static bool arg_follow = false; | static bool arg_follow = false; | |||
static bool arg_show_all = false; | static bool arg_show_all = false; | |||
static bool arg_no_pager = false; | static bool arg_no_pager = false; | |||
static int arg_lines = -1; | static int arg_lines = -1; | |||
static bool arg_no_tail = false; | static bool arg_no_tail = false; | |||
static bool arg_quiet = false; | static bool arg_quiet = false; | |||
static bool arg_merge = false; | static bool arg_merge = false; | |||
static bool arg_this_boot = false; | static bool arg_this_boot = false; | |||
static const char *arg_cursor = NULL; | ||||
static const char *arg_directory = NULL; | static const char *arg_directory = NULL; | |||
static int arg_priorities = 0xFF; | static int arg_priorities = 0xFF; | |||
static const char *arg_verify_key = NULL; | static const char *arg_verify_key = NULL; | |||
#ifdef HAVE_GCRYPT | #ifdef HAVE_GCRYPT | |||
static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC; | static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC; | |||
#endif | #endif | |||
static enum { | static enum { | |||
ACTION_SHOW, | ACTION_SHOW, | |||
ACTION_NEW_ID128, | ACTION_NEW_ID128, | |||
skipping to change at line 90 | skipping to change at line 91 | |||
} arg_action = ACTION_SHOW; | } arg_action = ACTION_SHOW; | |||
static int help(void) { | static int help(void) { | |||
printf("%s [OPTIONS...] [MATCH]\n\n" | printf("%s [OPTIONS...] [MATCH]\n\n" | |||
"Send control commands to or query the journal.\n\n" | "Send control commands to or query the journal.\n\n" | |||
" -h --help Show this help\n" | " -h --help Show this help\n" | |||
" --version Show package version\n" | " --version Show package version\n" | |||
" --no-pager Do not pipe output into a pager\n" | " --no-pager Do not pipe output into a pager\n" | |||
" -a --all Show all fields, including long an d unprintable\n" | " -a --all Show all fields, including long an d unprintable\n" | |||
" -c --cursor=CURSOR Jump to the specified cursor\n" | ||||
" -f --follow Follow journal\n" | " -f --follow Follow journal\n" | |||
" -n --lines[=INTEGER] Number of journal entries to show\ n" | " -n --lines[=INTEGER] Number of journal entries to show\ n" | |||
" --no-tail Show all lines, even in follow mod e\n" | " --no-tail Show all lines, even in follow mod e\n" | |||
" -o --output=STRING Change journal output mode (short, short-monotonic,\n" | " -o --output=STRING Change journal output mode (short, short-monotonic,\n" | |||
" verbose, export, json, json-pretty , cat)\n" | " verbose, export, json, json-pretty , cat)\n" | |||
" -q --quiet Don't show privilege warning\n" | " -q --quiet Don't show privilege warning\n" | |||
" -m --merge Show entries from all available jo urnals\n" | " -m --merge Show entries from all available jo urnals\n" | |||
" -b --this-boot Show data only from current boot\n " | " -b --this-boot Show data only from current boot\n " | |||
" -D --directory=PATH Show journal files from directory\ n" | " -D --directory=PATH Show journal files from directory\ n" | |||
" -p --priority=RANGE Show only messages within the spec ified priority range\n\n" | " -p --priority=RANGE Show only messages within the spec ified priority range\n\n" | |||
skipping to change at line 151 | skipping to change at line 153 | |||
{ "merge", no_argument, NULL, 'm' }, | { "merge", no_argument, NULL, 'm' }, | |||
{ "this-boot", no_argument, NULL, 'b' }, | { "this-boot", no_argument, NULL, 'b' }, | |||
{ "directory", required_argument, NULL, 'D' }, | { "directory", required_argument, NULL, 'D' }, | |||
{ "header", no_argument, NULL, ARG_HEADER }, | { "header", no_argument, NULL, ARG_HEADER }, | |||
{ "priority", no_argument, NULL, 'p' }, | { "priority", no_argument, NULL, 'p' }, | |||
{ "setup-keys", no_argument, NULL, ARG_SETUP_KEYS }, | { "setup-keys", no_argument, NULL, ARG_SETUP_KEYS }, | |||
{ "interval", required_argument, NULL, ARG_INTERVAL }, | { "interval", required_argument, NULL, ARG_INTERVAL }, | |||
{ "verify", no_argument, NULL, ARG_VERIFY }, | { "verify", no_argument, NULL, ARG_VERIFY }, | |||
{ "verify-key", required_argument, NULL, ARG_VERIFY_KEY }, | { "verify-key", required_argument, NULL, ARG_VERIFY_KEY }, | |||
{ "disk-usage", no_argument, NULL, ARG_DISK_USAGE }, | { "disk-usage", no_argument, NULL, ARG_DISK_USAGE }, | |||
{ "cursor", no_argument, NULL, 'c' }, | ||||
{ NULL, 0, NULL, 0 } | { NULL, 0, NULL, 0 } | |||
}; | }; | |||
int c, r; | int c, r; | |||
assert(argc >= 0); | assert(argc >= 0); | |||
assert(argv); | assert(argv); | |||
while ((c = getopt_long(argc, argv, "hfo:an::qmbD:p:", options, NUL L)) >= 0) { | while ((c = getopt_long(argc, argv, "hfo:an::qmbD:p:c:", options, N ULL)) >= 0) { | |||
switch (c) { | switch (c) { | |||
case 'h': | case 'h': | |||
help(); | help(); | |||
return 0; | return 0; | |||
case ARG_VERSION: | case ARG_VERSION: | |||
puts(PACKAGE_STRING); | puts(PACKAGE_STRING); | |||
puts(DISTRIBUTION); | puts(DISTRIBUTION); | |||
skipping to change at line 231 | skipping to change at line 234 | |||
break; | break; | |||
case 'b': | case 'b': | |||
arg_this_boot = true; | arg_this_boot = true; | |||
break; | break; | |||
case 'D': | case 'D': | |||
arg_directory = optarg; | arg_directory = optarg; | |||
break; | break; | |||
case 'c': | ||||
arg_cursor = optarg; | ||||
break; | ||||
case ARG_HEADER: | case ARG_HEADER: | |||
arg_action = ACTION_PRINT_HEADER; | arg_action = ACTION_PRINT_HEADER; | |||
break; | break; | |||
case ARG_VERIFY: | case ARG_VERIFY: | |||
arg_action = ACTION_VERIFY; | arg_action = ACTION_VERIFY; | |||
break; | break; | |||
case ARG_DISK_USAGE: | case ARG_DISK_USAGE: | |||
arg_action = ACTION_DISK_USAGE; | arg_action = ACTION_DISK_USAGE; | |||
skipping to change at line 725 | skipping to change at line 732 | |||
} | } | |||
} | } | |||
} | } | |||
return r; | return r; | |||
} | } | |||
int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { | |||
int r; | int r; | |||
sd_journal *j = NULL; | sd_journal *j = NULL; | |||
unsigned line = 0; | ||||
bool need_seek = false; | bool need_seek = false; | |||
sd_id128_t previous_boot_id; | sd_id128_t previous_boot_id; | |||
bool previous_boot_id_valid = false; | bool previous_boot_id_valid = false; | |||
bool have_pager; | bool have_pager; | |||
log_parse_environment(); | log_parse_environment(); | |||
log_open(); | log_open(); | |||
r = parse_argv(argc, argv); | r = parse_argv(argc, argv); | |||
if (r <= 0) | if (r <= 0) | |||
skipping to change at line 831 | skipping to change at line 837 | |||
if (r > 0) { | if (r > 0) { | |||
if (arg_follow) | if (arg_follow) | |||
printf("Logs begin at %s.\n", format_timest amp(start_buf, sizeof(start_buf), start)); | printf("Logs begin at %s.\n", format_timest amp(start_buf, sizeof(start_buf), start)); | |||
else | else | |||
printf("Logs begin at %s, end at %s.\n", | printf("Logs begin at %s, end at %s.\n", | |||
format_timestamp(start_buf, sizeof(s tart_buf), start), | format_timestamp(start_buf, sizeof(s tart_buf), start), | |||
format_timestamp(end_buf, sizeof(end _buf), end)); | format_timestamp(end_buf, sizeof(end _buf), end)); | |||
} | } | |||
} | } | |||
if (arg_lines >= 0) { | if (arg_cursor) { | |||
r = sd_journal_seek_cursor(j, arg_cursor); | ||||
if (r < 0) { | ||||
log_error("Failed to seek to cursor: %s", strerror( | ||||
-r)); | ||||
goto finish; | ||||
} | ||||
r = sd_journal_next(j); | ||||
} else if (arg_lines >= 0) { | ||||
r = sd_journal_seek_tail(j); | r = sd_journal_seek_tail(j); | |||
if (r < 0) { | if (r < 0) { | |||
log_error("Failed to seek to tail: %s", strerror(-r )); | log_error("Failed to seek to tail: %s", strerror(-r )); | |||
goto finish; | goto finish; | |||
} | } | |||
r = sd_journal_previous_skip(j, arg_lines); | r = sd_journal_previous_skip(j, arg_lines); | |||
} else { | } else { | |||
r = sd_journal_seek_head(j); | r = sd_journal_seek_head(j); | |||
if (r < 0) { | if (r < 0) { | |||
log_error("Failed to seek to head: %s", strerror(-r )); | log_error("Failed to seek to head: %s", strerror(-r )); | |||
goto finish; | goto finish; | |||
} | } | |||
r = sd_journal_next(j); | r = sd_journal_next(j); | |||
} | } | |||
skipping to change at line 889 | skipping to change at line 905 | |||
if (r >= 0) { | if (r >= 0) { | |||
if (previous_boot_id_valid && | if (previous_boot_id_valid && | |||
!sd_id128_equal(boot_id, previo us_boot_id)) | !sd_id128_equal(boot_id, previo us_boot_id)) | |||
printf(ANSI_HIGHLIGHT_ON "- ---- Reboot -----" ANSI_HIGHLIGHT_OFF "\n"); | printf(ANSI_HIGHLIGHT_ON "- ---- Reboot -----" ANSI_HIGHLIGHT_OFF "\n"); | |||
previous_boot_id = boot_id; | previous_boot_id = boot_id; | |||
previous_boot_id_valid = true; | previous_boot_id_valid = true; | |||
} | } | |||
} | } | |||
line ++; | r = output_journal(stdout, j, arg_output, 0, flags) | |||
; | ||||
r = output_journal(j, arg_output, line, 0, flags); | ||||
if (r < 0) | if (r < 0) | |||
goto finish; | goto finish; | |||
need_seek = true; | need_seek = true; | |||
} | } | |||
if (!arg_follow) | if (!arg_follow) | |||
break; | break; | |||
r = sd_journal_wait(j, (uint64_t) -1); | r = sd_journal_wait(j, (uint64_t) -1); | |||
End of changes. 9 change blocks. | ||||
6 lines changed or deleted | 22 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |