summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mergemaster
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-09 20:36:15 +0000
committerbrian <brian@FreeBSD.org>2000-08-09 20:36:15 +0000
commitf1a6d8fd4d894d4d0fb826739cd0c15fd2996684 (patch)
tree9db06a9125cec674a560a9a8766473a16dbb716b /usr.sbin/mergemaster
parent3073d41f6a634686faba368d99484f70539d7b05 (diff)
downloadFreeBSD-src-f1a6d8fd4d894d4d0fb826739cd0c15fd2996684.zip
FreeBSD-src-f1a6d8fd4d894d4d0fb826739cd0c15fd2996684.tar.gz
Be more careful about selecting a PAGER.
Improve the question asked when the PAGER is invalid. Submitted by: Doug Barton <DougB@gorean.org>
Diffstat (limited to 'usr.sbin/mergemaster')
-rwxr-xr-xusr.sbin/mergemaster/mergemaster.sh21
1 files changed, 14 insertions, 7 deletions
diff --git a/usr.sbin/mergemaster/mergemaster.sh b/usr.sbin/mergemaster/mergemaster.sh
index b12c1f8..844b3ad 100755
--- a/usr.sbin/mergemaster/mergemaster.sh
+++ b/usr.sbin/mergemaster/mergemaster.sh
@@ -252,15 +252,14 @@ echo ''
#
case "${DONT_CHECK_PAGER}" in
'')
- while [ "${PAGER}" != "more" -a -n "${PAGER}" -a ! -x "${PAGER%% *}" ]; do
+ while ! type "${PAGER%% *}" >/dev/null && [ -n "${PAGER}" ]; do
echo " *** Your PAGER environment variable specifies '${PAGER}', but"
- echo " I cannot execute it. In general it is good practice to"
- echo " specify the full path for environment variables like"
- echo " PAGER and EDITOR. Meanwhile, what would you like to do?"
+ echo " due to the limited PATH that I use for security reasons,"
+ echo " I cannot execute it. So, what would you like to do?"
echo ''
echo " Use 'e' to exit mergemaster and fix your PAGER variable"
- if [ -x /usr/local/bin/less ]; then
- echo " Use 'l' to set PAGER to /usr/local/bin/less for this run"
+ if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then
+ echo " Use 'l' to set PAGER to 'less' for this run"
fi
echo " Use 'm' to use plain old 'more' as your PAGER for this run"
echo ''
@@ -272,8 +271,16 @@ case "${DONT_CHECK_PAGER}" in
exit 0
;;
[lL])
- if [ -x /usr/local/bin/less ]; then
+ if [ -x /usr/bin/less ]; then
+ PAGER=/usr/bin/less
+ elif [ -x /usr/local/bin/less ]; then
PAGER=/usr/local/bin/less
+ else
+ echo ''
+ echo " *** Fatal Error:"
+ echo " You asked to use 'less' as your pager, but I can't"
+ echo " find it in /usr/bin or /usr/local/bin"
+ exit 1
fi
;;
[mM]|'')
OpenPOWER on IntegriCloud