summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-19 20:54:04 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-19 21:50:43 -0400
commit54b7254c1fa629937f92fd6fa34bdf127b696a00 (patch)
treee86537d15eb74b4a6ecc5bd2cfc0dd5aeaf17489 /src/journal/journalctl.c
parentab3a162c0194fd92884798488eeafdcc5c4d7d57 (diff)
journalct: beef up entry listing
The ability to dump catalog entries in full and by id is added.
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 8aef923bea..975c44fa9b 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -90,6 +90,7 @@ static enum {
ACTION_VERIFY,
ACTION_DISK_USAGE,
ACTION_LIST_CATALOG,
+ ACTION_DUMP_CATALOG,
ACTION_UPDATE_CATALOG
} arg_action = ACTION_SHOW;
@@ -131,6 +132,7 @@ static int help(void) {
" --disk-usage Show total disk usage\n"
" -F --field=FIELD List all values a certain field takes\n"
" --list-catalog Show message IDs of all entries in the message catalog\n"
+ " --dump-catalog Show entries in the message catalog\n"
" --update-catalog Update the message catalog database\n"
#ifdef HAVE_GCRYPT
" --setup-keys Generate new FSS key pair\n"
@@ -159,6 +161,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_UNTIL,
ARG_USER_UNIT,
ARG_LIST_CATALOG,
+ ARG_DUMP_CATALOG,
ARG_UPDATE_CATALOG
};
@@ -193,6 +196,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "field", required_argument, NULL, 'F' },
{ "catalog", no_argument, NULL, 'x' },
{ "list-catalog", no_argument, NULL, ARG_LIST_CATALOG },
+ { "dump-catalog", no_argument, NULL, ARG_DUMP_CATALOG },
{ "update-catalog",no_argument, NULL, ARG_UPDATE_CATALOG },
{ "reverse", no_argument, NULL, 'r' },
{ NULL, 0, NULL, 0 }
@@ -445,6 +449,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_action = ACTION_LIST_CATALOG;
break;
+ case ARG_DUMP_CATALOG:
+ arg_action = ACTION_DUMP_CATALOG;
+ break;
+
case ARG_UPDATE_CATALOG:
arg_action = ACTION_UPDATE_CATALOG;
break;
@@ -918,8 +926,13 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (arg_action == ACTION_LIST_CATALOG) {
- r = catalog_list(stdout);
+ if (arg_action == ACTION_LIST_CATALOG ||
+ arg_action == ACTION_DUMP_CATALOG) {
+ bool oneline = arg_action == ACTION_LIST_CATALOG;
+ if (optind < argc)
+ r = catalog_list_items(stdout, oneline, argv + optind);
+ else
+ r = catalog_list(stdout, oneline);
if (r < 0)
log_error("Failed to list catalog: %s", strerror(-r));
goto finish;