[systemd-commits] man/journalctl.xml src/cgls src/delta src/journal src/locale src/login src/shared src/systemctl src/timedate

Lennart Poettering lennart at kemper.freedesktop.org
Thu Mar 7 12:18:09 PST 2013


 man/journalctl.xml         |   14 ++++++++++++++
 src/cgls/cgls.c            |    2 +-
 src/delta/delta.c          |    2 +-
 src/journal/coredumpctl.c  |    2 +-
 src/journal/journalctl.c   |   11 +++++++++--
 src/locale/localectl.c     |    2 +-
 src/login/loginctl.c       |    2 +-
 src/shared/pager.c         |    7 +++++--
 src/shared/pager.h         |    2 +-
 src/systemctl/systemctl.c  |    2 +-
 src/timedate/timedatectl.c |    2 +-
 11 files changed, 36 insertions(+), 12 deletions(-)

New commits:
commit 1b12a7b5896f94bdf33b3a6661ebabd761ea6adc
Author: Harald Hoyer <harald at redhat.com>
Date:   Thu Mar 7 20:44:35 2013 +0100

    pager: introduce "jump to end" option
    
    $ journalctl -be
    
    is what you want :)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=867841

diff --git a/man/journalctl.xml b/man/journalctl.xml
index e2740e4..201f66a 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -163,6 +163,20 @@
                         </varlistentry>
 
                         <varlistentry>
+                                <term><option>-e</option></term>
+                                <term><option>--pager-end</option></term>
+
+                                <listitem><para>Immediately jump to
+                                the end of the journal inside the
+                                implied pager tool. Very useful in
+                                combination with the
+                                <option>-b</option> option. Note that
+                                this is only supported for the
+                                <citerefentry><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+                                pager.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><option>-n</option></term>
                                 <term><option>--lines=</option></term>
 
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index a05f979..e649b75 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) {
         }
 
         if (!arg_no_pager) {
-                r = pager_open();
+                r = pager_open(false);
                 if (r > 0) {
                         if (arg_full == -1)
                                 arg_full = true;
diff --git a/src/delta/delta.c b/src/delta/delta.c
index 16b1002..aec3dc8 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -454,7 +454,7 @@ int main(int argc, char *argv[]) {
                 arg_flags |= SHOW_OVERRIDDEN;
 
         if (!arg_no_pager)
-                pager_open();
+                pager_open(false);
 
         if (optind < argc) {
                 int i;
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index b6e5581..8bfab00 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -560,7 +560,7 @@ int main(int argc, char *argv[]) {
 
         case ACTION_LIST:
                 if (!arg_no_pager)
-                        pager_open();
+                        pager_open(false);
 
                 r = dump_list(j);
                 break;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index c90fecd..5fb2db3 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -56,6 +56,7 @@
 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
 
 static OutputMode arg_output = OUTPUT_SHORT;
+static bool arg_pager_end = false;
 static bool arg_follow = false;
 static bool arg_full = false;
 static bool arg_all = false;
@@ -103,6 +104,7 @@ static int help(void) {
                "  -u --unit=UNIT         Show data only from the specified unit\n"
                "     --user-unit=UNIT    Show data only from the specified user session unit\n"
                "  -p --priority=RANGE    Show only messages within the specified priority range\n"
+               "  -e --pager-end         Immediately jump to end of the journal in the pager\n"
                "  -f --follow            Follow journal\n"
                "  -n --lines[=INTEGER]   Number of journal entries to show\n"
                "     --no-tail           Show all lines, even in follow mode\n"
@@ -163,6 +165,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "help",         no_argument,       NULL, 'h'              },
                 { "version" ,     no_argument,       NULL, ARG_VERSION      },
                 { "no-pager",     no_argument,       NULL, ARG_NO_PAGER     },
+                { "pager-end",    no_argument,       NULL, 'e'              },
                 { "follow",       no_argument,       NULL, 'f'              },
                 { "output",       required_argument, NULL, 'o'              },
                 { "all",          no_argument,       NULL, 'a'              },
@@ -199,7 +202,7 @@ static int parse_argv(int argc, char *argv[]) {
         assert(argc >= 0);
         assert(argv);
 
-        while ((c = getopt_long(argc, argv, "hfo:an::qmbD:p:c:u:F:xr", options, NULL)) >= 0) {
+        while ((c = getopt_long(argc, argv, "hefo:an::qmbD:p:c:u:F:xr", options, NULL)) >= 0) {
 
                 switch (c) {
 
@@ -216,6 +219,10 @@ static int parse_argv(int argc, char *argv[]) {
                         arg_no_pager = true;
                         break;
 
+                case 'e':
+                        arg_pager_end = true;
+                        break;
+
                 case 'f':
                         arg_follow = true;
                         break;
@@ -1075,7 +1082,7 @@ int main(int argc, char *argv[]) {
         }
 
         if (!arg_no_pager && !arg_follow)
-                pager_open();
+                pager_open(arg_pager_end);
 
         if (!arg_quiet) {
                 usec_t start, end;
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index ce31e1f..9f996db 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -53,7 +53,7 @@ static void pager_open_if_enabled(void) {
         if (arg_no_pager)
                 return;
 
-        pager_open();
+        pager_open(false);
 }
 
 static void polkit_agent_open_if_enabled(void) {
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 473c77b..fe27003 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -58,7 +58,7 @@ static void pager_open_if_enabled(void) {
         if (arg_no_pager)
                 return;
 
-        pager_open();
+        pager_open(false);
 }
 
 static void polkit_agent_open_if_enabled(void) {
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 5165d2b..4ffb530 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -44,7 +44,7 @@ _noreturn_ static void pager_fallback(void) {
         _exit(EXIT_SUCCESS);
 }
 
-int pager_open(void) {
+int pager_open(bool jump_to_end) {
         int fd[2];
         const char *pager;
         pid_t parent_pid;
@@ -85,7 +85,10 @@ int pager_open(void) {
                 dup2(fd[0], STDIN_FILENO);
                 close_pipe(fd);
 
-                setenv("LESS", "FRSXK", 0);
+                if (jump_to_end)
+                        setenv("LESS", "FRSXK+G", 0);
+                else
+                        setenv("LESS", "FRSXK", 0);
 
                 /* Make sure the pager goes away when the parent dies */
                 if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)
diff --git a/src/shared/pager.h b/src/shared/pager.h
index 5e7b5ab..325ca98 100644
--- a/src/shared/pager.h
+++ b/src/shared/pager.h
@@ -23,6 +23,6 @@
 
 #include <stdbool.h>
 
-int pager_open(void);
+int pager_open(bool jump_to_end);
 void pager_close(void);
 bool pager_have(void);
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 72e9c55..4a55c56 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -136,7 +136,7 @@ static void pager_open_if_enabled(void) {
         if (arg_no_pager)
                 return;
 
-        pager_open();
+        pager_open(false);
 }
 
 static void ask_password_agent_open_if_enabled(void) {
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index f5b5f0c..ef2ea08 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -51,7 +51,7 @@ static void pager_open_if_enabled(void) {
         if (arg_no_pager)
                 return;
 
-        pager_open();
+        pager_open(false);
 }
 
 static void polkit_agent_open_if_enabled(void) {



More information about the systemd-commits mailing list