[less] Avoid some unnecessary stat calls and commands in lesspipe.sh
Vojtěch Vítek
vvitek at fedoraproject.org
Tue Nov 22 17:19:17 UTC 2011
commit 0758dba0e60d23eed301c32cdff9af728c6cc644
Author: Vojtech Vitek (V-Teq) <vvitek at redhat.com>
Date: Tue Nov 22 18:17:36 2011 +0100
Avoid some unnecessary stat calls and commands in lesspipe.sh
Patch by Ville Skyttä (#741440)
less.spec | 2 ++
lesspipe.sh | 12 +++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/less.spec b/less.spec
index 3996bea..f31f225 100644
--- a/less.spec
+++ b/less.spec
@@ -68,6 +68,8 @@ ls -la $RPM_BUILD_ROOT/etc/profile.d
rm -rf $RPM_BUILD_ROOT
%changelog
+- Avoid some unnecessary stat calls and commands in lesspipe.sh,
+ patch by Ville Skyttä (#741440)
- Use `groff' instead of `man -s' for rendering manpages to prevent
options incompatibility between man and man-db packages (#718498)
- Add groff to Requires
diff --git a/lesspipe.sh b/lesspipe.sh
index dcfc5db..e03d667 100755
--- a/lesspipe.sh
+++ b/lesspipe.sh
@@ -59,15 +59,17 @@ case "$1" in
exit 1
fi ;;
*)
- if [ -x /usr/bin/file -a -x /usr/bin/iconv -a -x /usr/bin/cut ]; then
+ if [ -x /usr/bin/file ] && [ -x /usr/bin/iconv ] && [ -x /usr/bin/cut ]; then
case `file -b "$1"` in
*UTF-16*) conv='UTF-16' ;;
*UTF-32*) conv='UTF-32' ;;
esac
- env=`echo $LANG | cut -d. -f2`
- if [ -n "$conv" -a -n "$env" -a "$conv" != "$env" ]; then
- iconv -f $conv -t $env "$1"
- exit $?
+ if [ -n "$conv" ]; then
+ env=`echo $LANG | cut -d. -f2`
+ if [ -n "$env" -a "$conv" != "$env" ]; then
+ iconv -f $conv -t $env "$1"
+ exit $?
+ fi
fi
fi
exit 1
More information about the scm-commits
mailing list