daandemeyer / rpms / systemd

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