From 2714f1d90e2f33269862ab585a212be65344c8ef Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Fri, 3 Jul 2026 12:09:33 +0200 Subject: [PATCH] iucvterm/ts-shell: Introduce pager config to replace env variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not obtain the pager program through the PAGER environment variable. Instead, introduce a configuration setting to specify the pager program as part of the ts-shell configuration. Reviewed-by: Jan Höppner Signed-off-by: Hendrik Brueckner Signed-off-by: Jan Höppner --- iucvterm/bin/ts-shell.in | 5 +++-- iucvterm/doc/ts-shell.1 | 19 +++++++------------ iucvterm/etc/ts-shell.conf.in | 6 ++++++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/iucvterm/bin/ts-shell.in b/iucvterm/bin/ts-shell.in index 0aa0b5c9..cadca941 100755 --- a/iucvterm/bin/ts-shell.in +++ b/iucvterm/bin/ts-shell.in @@ -21,7 +21,6 @@ use POSIX; $ENV{'PERL_RL'} = " o=0"; # use best avail. readline $ENV{'PATH'} = "/bin:/sbin:/usr/bin:/usr/sbin"; $ENV{'LESSSECURE'} = 1; # let less run in "secure" mode -$ENV{'PAGER'} = $ENV{'PAGER'} || "/usr/bin/less"; my $ts_shell = fileparse($0, qr/\.[^.]+/); $SIG{__WARN__} = sub { print STDERR "$ts_shell: $_[0]"; }; $SIG{__DIE__} = sub { print STDERR "$ts_shell: $_[0]"; exit 255; }; @@ -36,6 +35,7 @@ my %config = ( 'auditdir' => "@var_path@/log/ts-shell", 'iucvconn' => "@iucvconn_path@/iucvconn", 'prompt' => getpwuid($>) . '@'."$ts_shell> ", + 'pager' => "/usr/bin/less", # runtime options 'rl' => undef, # terminal readline (rl) 'user' => getpwuid($>), # user name @@ -190,6 +190,7 @@ sub updateConfiguration(\%$) $cfg->{authfile} = $value if $option =~ /^ts-authorization$/; $cfg->{auditdir} = $value if $option =~ /^transcript-directory$/; $cfg->{auditfile} = $value if $option =~ /^transcript-systems$/; + $cfg->{pager} = $value if $option =~ /^pager$/; } # loadAuthorization() - Load system authorizations from file @@ -545,7 +546,7 @@ sub pager($) { my $eval = shift(); - unless (open(PAGER, "|$ENV{'PAGER'}")) { + unless (open(PAGER, '|-', "$config{'pager'}")) { eval &$eval; return; } diff --git a/iucvterm/doc/ts-shell.1 b/iucvterm/doc/ts-shell.1 index 07783d07..ddf88614 100644 --- a/iucvterm/doc/ts-shell.1 +++ b/iucvterm/doc/ts-shell.1 @@ -1,9 +1,8 @@ +.\" SPDX-License-Identifier: MIT +.\" .\" ts-shell.1 .\" -.\" -.\" Copyright IBM Corp. 2008, 2017 -.\" s390-tools is free software; you can redistribute it and/or modify -.\" it under the terms of the MIT license. See LICENSE for details. +.\" Copyright IBM Corp. .\" ---------------------------------------------------------------------- .TH "ts-shell" "1" "March 2009" "s390-tools" "Terminal Server over IUCV" . @@ -269,6 +268,10 @@ session transcripts are saved. See section "Configure terminal session transcripts" for details. . +.TP +.BR pager " = " \fI/usr/bin/less\fP +Specifies the path to a pager program to paginate output of ts-shell commands. +. .RE . . @@ -542,14 +545,6 @@ Directory for saving terminal session transcripts. . .SH "ENVIRONMENT" .TP -.B PAGER -The \fBPAGER\fP environment variable designates a program used as pager for the -\fBlist\fP command of the terminal server shell. -If \fBPAGER\fP is not set or empty, -.BR less (1) -is used. -. -.TP .B LESSSECURE \fBts-shell\fP sets this variable to run .BR less (1) diff --git a/iucvterm/etc/ts-shell.conf.in b/iucvterm/etc/ts-shell.conf.in index 442a37af..d0a99dcc 100644 --- a/iucvterm/etc/ts-shell.conf.in +++ b/iucvterm/etc/ts-shell.conf.in @@ -2,6 +2,12 @@ # # See ts-shell(1) manual page for file format syntax. +# Generic settings +# ---------------- + +# pager +# binary to paginate output (default: less) +#pager = /usr/bin/less # System and authorization settings # ---------------------------------