teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0386-journalctl-introduce-short-options-for-since-and-unt.patch

1abbee
From f6cf4e14409d25868caccc3606a928a610465405 Mon Sep 17 00:00:00 2001
1abbee
From: Jan Synacek <jsynacek@redhat.com>
1abbee
Date: Tue, 13 Oct 2015 10:50:49 +0200
1abbee
Subject: [PATCH] journalctl: introduce short options for --since and --until
1abbee
1abbee
Fixes #1514.
1abbee
1abbee
Cherry-picked from: 66f529249a6b3c3391e732cba44482a498153e16
1abbee
Related: #1318994
1abbee
---
1abbee
 man/journalctl.xml       |  2 ++
1abbee
 src/journal/journalctl.c | 16 +++++++---------
1abbee
 2 files changed, 9 insertions(+), 9 deletions(-)
1abbee
1abbee
diff --git a/man/journalctl.xml b/man/journalctl.xml
c62b8e
index 0981fba729..dedcf19250 100644
1abbee
--- a/man/journalctl.xml
1abbee
+++ b/man/journalctl.xml
1abbee
@@ -528,7 +528,9 @@
1abbee
       </varlistentry>
1abbee
 
1abbee
       <varlistentry>
1abbee
+        <term><option>-S</option></term>
1abbee
         <term><option>--since=</option></term>
1abbee
+        <term><option>-U</option></term>
1abbee
         <term><option>--until=</option></term>
1abbee
 
1abbee
         <listitem><para>Start showing entries on or newer than the
1abbee
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
c62b8e
index e84dd4c9d3..ba9ae05f72 100644
1abbee
--- a/src/journal/journalctl.c
1abbee
+++ b/src/journal/journalctl.c
1abbee
@@ -274,8 +274,8 @@ static void help(void) {
1abbee
                "     --system              Show the system journal\n"
1abbee
                "     --user                Show the user journal for the current user\n"
1abbee
                "  -M --machine=CONTAINER   Operate on local container\n"
1abbee
-               "     --since=DATE          Show entries not older than the specified date\n"
1abbee
-               "     --until=DATE          Show entries not newer than the specified date\n"
1abbee
+               "  -S --since=DATE          Show entries not older than the specified date\n"
1abbee
+               "  -U --until=DATE          Show entries not newer than the specified date\n"
1abbee
                "  -c --cursor=CURSOR       Show entries starting at the specified cursor\n"
1abbee
                "     --after-cursor=CURSOR Show entries after the specified cursor\n"
1abbee
                "     --show-cursor         Print the cursor after all the entries\n"
1abbee
@@ -347,8 +347,6 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                 ARG_VERIFY,
1abbee
                 ARG_VERIFY_KEY,
1abbee
                 ARG_DISK_USAGE,
1abbee
-                ARG_SINCE,
1abbee
-                ARG_UNTIL,
1abbee
                 ARG_AFTER_CURSOR,
1abbee
                 ARG_SHOW_CURSOR,
1abbee
                 ARG_USER_UNIT,
1abbee
@@ -398,8 +396,8 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                 { "cursor",         required_argument, NULL, 'c'                },
1abbee
                 { "after-cursor",   required_argument, NULL, ARG_AFTER_CURSOR   },
1abbee
                 { "show-cursor",    no_argument,       NULL, ARG_SHOW_CURSOR    },
1abbee
-                { "since",          required_argument, NULL, ARG_SINCE          },
1abbee
-                { "until",          required_argument, NULL, ARG_UNTIL          },
1abbee
+                { "since",          required_argument, NULL, 'S'                },
1abbee
+                { "until",          required_argument, NULL, 'U'                },
1abbee
                 { "unit",           required_argument, NULL, 'u'                },
1abbee
                 { "user-unit",      required_argument, NULL, ARG_USER_UNIT      },
1abbee
                 { "field",          required_argument, NULL, 'F'                },
1abbee
@@ -421,7 +419,7 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
         assert(argc >= 0);
1abbee
         assert(argv);
1abbee
 
1abbee
-        while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:c:t:u:F:xrM:", options, NULL)) >= 0)
1abbee
+        while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:c:S:U:t:u:F:xrM:", options, NULL)) >= 0)
1abbee
 
1abbee
                 switch (c) {
1abbee
 
1abbee
@@ -711,7 +709,7 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                         break;
1abbee
                 }
1abbee
 
1abbee
-                case ARG_SINCE:
1abbee
+                case 'S':
1abbee
                         r = parse_timestamp(optarg, &arg_since);
1abbee
                         if (r < 0) {
1abbee
                                 log_error("Failed to parse timestamp: %s", optarg);
1abbee
@@ -720,7 +718,7 @@ static int parse_argv(int argc, char *argv[]) {
1abbee
                         arg_since_set = true;
1abbee
                         break;
1abbee
 
1abbee
-                case ARG_UNTIL:
1abbee
+                case 'U':
1abbee
                         r = parse_timestamp(optarg, &arg_until);
1abbee
                         if (r < 0) {
1abbee
                                 log_error("Failed to parse timestamp: %s", optarg);