summaryrefslogtreecommitdiff
path: root/src/journal/journalctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-28 20:17:24 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-28 23:45:59 -0400
commit844ec79b3c2f246114ea316ebe1f36044bdb688e (patch)
tree6e937c3738ee75fdd2c22e5f9bec72d789d6e13b /src/journal/journalctl.c
parent18cd5fe99f70a55a2d6f2303d6ee0624942695b1 (diff)
catalog: open up catalog internals
In order to write tests for the catalog functions, they are made non-static and start taking a 'database' parameter, which is the name of a file with the preprocessed catalog entries. This makes it possible to make test-catalog part of the normal test suite, since it now only operates on files in /tmp. Some more tests are added.
Diffstat (limited to 'src/journal/journalctl.c')
-rw-r--r--src/journal/journalctl.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 0a82a1cf15..03daafe9db 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1020,20 +1020,26 @@ int main(int argc, char *argv[]) {
goto finish;
}
- 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;
- }
+ if (arg_action == ACTION_UPDATE_CATALOG ||
+ arg_action == ACTION_LIST_CATALOG ||
+ arg_action == ACTION_DUMP_CATALOG) {
+
+ if (arg_action == ACTION_UPDATE_CATALOG) {
+ r = catalog_update(CATALOG_DATABASE, NULL, catalog_file_dirs);
+ if (r < 0)
+ log_error("Failed to list catalog: %s", strerror(-r));
+ } else {
+ bool oneline = arg_action == ACTION_LIST_CATALOG;
+
+ if (optind < argc)
+ r = catalog_list_items(stdout, CATALOG_DATABASE,
+ oneline, argv + optind);
+ else
+ r = catalog_list(stdout, CATALOG_DATABASE, oneline);
+ if (r < 0)
+ log_error("Failed to list catalog: %s", strerror(-r));
+ }
- if (arg_action == ACTION_UPDATE_CATALOG) {
- r = catalog_update();
goto finish;
}