You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

90 lines
4.3 KiB

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