[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force XFree86 SVN commit: rev 789 - branches/4.3.0/sid/debian



Author: branden
Date: 2003-11-22 01:26:17 -0500 (Sat, 22 Nov 2003)
New Revision: 789

Modified:
   branches/4.3.0/sid/debian/changelog
   branches/4.3.0/sid/debian/shell-lib.sh
Log:
In maintainer scripts, query the terminal to establish a default number of
columns to use for displaying messages to the user.  This is used only as
a fallback in the event the COLUMNS variable is not set.  Change from
using fold to format messages to fmt, so we can get indentation on wrapped
lines, making them easier to read.  Remove unused message_nonl() function.


Modified: branches/4.3.0/sid/debian/changelog
===================================================================
--- branches/4.3.0/sid/debian/changelog	2003-11-22 06:11:14 UTC (rev 788)
+++ branches/4.3.0/sid/debian/changelog	2003-11-22 06:26:17 UTC (rev 789)
@@ -112,8 +112,15 @@
         information from the xlibs-data package (add luit to list of programs
         in xutils's extended description while we're at it).
 
- -- Branden Robinson <branden@debian.org>  Sat, 22 Nov 2003 01:07:17 -0500
+  * In maintainer scripts, query the terminal to establish a default number of
+    columns to use for displaying messages to the user.  This is used only as
+    a fallback in the event the COLUMNS variable is not set.  Change from
+    using fold to format messages to fmt, so we can get indentation on wrapped
+    lines, making them easier to read.  Remove unused message_nonl() function.
+    - debian/shell-lib.sh
 
+ -- Branden Robinson <branden@debian.org>  Sat, 22 Nov 2003 01:24:13 -0500
+
 xfree86 (4.3.0-0pre1v4) experimental; urgency=low
 
   * Add missing symbolic links for libXTrap. [ISHIKAWA Mutsumi]

Modified: branches/4.3.0/sid/debian/shell-lib.sh
===================================================================
--- branches/4.3.0/sid/debian/shell-lib.sh	2003-11-22 06:11:14 UTC (rev 788)
+++ branches/4.3.0/sid/debian/shell-lib.sh	2003-11-22 06:26:17 UTC (rev 789)
@@ -93,18 +93,21 @@
   done
 }
 
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user.  This is used only as a fallback in the
+# event the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while
+# the script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+  DEFCOLUMNS=80
+fi
+
 message () {
   # pretty-print messages of arbitrary length
   reject_nondigits "$COLUMNS"
-  echo "$*" | fold -s -w ${COLUMNS:-80} >&2
+  echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2
 }
 
-message_nonl () {
-  # pretty-print messages of arbitrary length (no trailing newline)
-  reject_nondigits "$COLUMNS"
-  echo -n "$*" | fold -s -w ${COLUMNS:-80} >&2
-}
-
 observe () {
   # syntax: observe message ...
   #



Reply to: