ryantimwilson / rpms / systemd

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