summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Woodfall <dave@dawoodfall.net>2018-11-19 11:38:16 +0000
committerRobby Workman <rworkman@slackware.com>2018-11-20 01:37:14 -0600
commit2cae1aa0afa8b36f6f572a751126b03e97ceaad7 (patch)
tree63fbff019bf5eec5bd501b8ea796995c91ec4d79
parentd93ee0f36d2e15cc97ce5e52f3fc551a038ca51e (diff)
downloadslackpkg-2cae1aa0afa8b36f6f572a751126b03e97ceaad7.tar.xz
Adjust number of .new lines shown based on terminal size
Signed-off-by: Robby Workman <rworkman@slackware.com>
-rw-r--r--files/post-functions.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/files/post-functions.sh b/files/post-functions.sh
index eb70ea5..593c47b 100644
--- a/files/post-functions.sh
+++ b/files/post-functions.sh
@@ -145,15 +145,19 @@ looknew() {
echo -ne "\n\
Some packages had new configuration files installed ($newcount new files):\n\n"
- if [ $newcount -le 15 ]; then
- echo -e "\n$FILES\n"
+ SIZE=$(stty size)
+ ROWS=${SIZE% *}
+ LISTMAX=$((ROWS-20))
+
+ if [ $newcount -le $LISTMAX ]; then
+ echo -e "$FILES"
else
F=0
for FN in $FILES; do
F=$((F+1))
echo "$FN"
- if [ $F -ge 14 ]; then
+ if [ $F -ge $LISTMAX ]; then
F=0
echo -ne "\nPress SPACE for more, ENTER to skip"
IFS=$'\n' read -rn 1 junk