X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fcat.c;h=02b75642a33ab9fb3de3e30c20fea8607db73909;hp=cdd46bcf5b7b41e3733faa2a17a83fc648ae3b6c;hb=30caf8f3afd29da8507c0edbcead7935604c9f3e;hpb=5430f7f2bc7330f3088b894166bf3524a067e3d8 diff --git a/src/journal/cat.c b/src/journal/cat.c index cdd46bcf5..02b75642a 100644 --- a/src/journal/cat.c +++ b/src/journal/cat.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include @@ -63,7 +63,7 @@ static int parse_argv(int argc, char *argv[]) { { "identifier", required_argument, NULL, 't' }, { "priority", required_argument, NULL, 'p' }, { "level-prefix", required_argument, NULL, ARG_LEVEL_PREFIX }, - { NULL, 0, NULL, 0 } + {} }; int c; @@ -76,12 +76,10 @@ static int parse_argv(int argc, char *argv[]) { switch (c) { case 'h': - help(); - return 0; + return help(); case ARG_VERSION: puts(PACKAGE_STRING); - puts(DISTRIBUTION); puts(SYSTEMD_FEATURES); return 0; @@ -91,10 +89,8 @@ static int parse_argv(int argc, char *argv[]) { arg_identifier = NULL; else { arg_identifier = strdup(optarg); - if (!arg_identifier) { - log_error("Out of memory."); - return -ENOMEM; - } + if (!arg_identifier) + return log_oom(); } break; @@ -118,9 +114,11 @@ static int parse_argv(int argc, char *argv[]) { break; } - default: - log_error("Unknown option code %c", c); + case '?': return -EINVAL; + + default: + assert_not_reached("Unhandled option"); } }