[systemd-devel] [PATCH] journalctl: Allow to disable line cap with --pager-end

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Aug 30 09:54:25 PDT 2014


On Sat, Aug 30, 2014 at 03:26:05PM +0200, Jan Janssen wrote:
> --lines=0 hardly makes sense with --pager-end, so give it some
> new meaning.
I'm don't think this overloading is a good idea. --lines=0 is meaningful
with -f, and it is possible that we'll implement -f in a pager when
pagers get support for such things. What about using something like 'all',
as in -nall ?

Zbyszek

> ---
>  man/journalctl.xml       |  6 +++---
>  src/journal/journalctl.c | 12 ++++++++----
>  2 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/man/journalctl.xml b/man/journalctl.xml
> index d4e0316..5c8d78c 100644
> --- a/man/journalctl.xml
> +++ b/man/journalctl.xml
> @@ -189,9 +189,9 @@
>                                  that the pager will not buffer logs of
>                                  unbounded size. This may be overridden
>                                  with an explicit <option>-n</option>
> -                                with some other numeric value on the
> -                                command line. Note that this option is
> -                                only supported for the
> +                                with some other numeric value while
> +                                <option>-n0</option> will disable this cap.
> +                                Note that this option is only supported for the
>                                  <citerefentry project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>
>                                  pager.</para></listitem>
>                          </varlistentry>
> diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
> index 0aec5fb..49a6c23 100644
> --- a/src/journal/journalctl.c
> +++ b/src/journal/journalctl.c
> @@ -326,10 +326,6 @@ static int parse_argv(int argc, char *argv[]) {
>  
>                  case 'e':
>                          arg_pager_end = true;
> -
> -                        if (arg_lines < 0)
> -                                arg_lines = 1000;
> -
>                          break;
>  
>                  case 'f':
> @@ -642,6 +638,14 @@ static int parse_argv(int argc, char *argv[]) {
>                          assert_not_reached("Unhandled option");
>                  }
>  
> +
> +        if (arg_pager_end) {
> +                if (arg_lines < 0)
> +                        arg_lines = 1000;
> +                else if (arg_lines == 0)
> +                        arg_lines = -1;
> +        }
> +
>          if (arg_follow && !arg_no_tail && arg_lines < 0)
>                  arg_lines = 10;
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 


More information about the systemd-devel mailing list