iucvterm/ts-shell: Introduce pager config to replace env variable

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 <hoeppner@linux.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Hendrik Brueckner
2026-07-03 12:09:33 +02:00
committed by Jan Höppner
parent 10ec3f18fc
commit 2714f1d90e
3 changed files with 16 additions and 14 deletions

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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
# ---------------------------------