[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH, svnmerge] Try "stty -a" to find out console width

From: Kalle Olavi Niemitalo <kon_at_iki.fi>
Date: 2006-01-07 18:22:49 CET

Giovanni Bajo <rasky@develer.com> writes:

> svnmerge automatically formats and word-wraps its help screens to the user
> console width (if it manages to extract it). It has several methods (for
> different operating systems), and this patch adds another fallback: it tries
> calling "stty -a" and parsing its output with a simple regular expression.
> This should work well on some UNIX flavours (including Linux).

As GNU coreutils 5.93 documents that stty -a prints "all current
settings in human-readable form", I wonder whether some
implementation could make the word "columns" depend on the
locale. The specification of "stty" in IEEE Std 1003.1, 2004
Edition does not say anything about setting or retrieving the
size of the console, but it requires at least the "speed",
"ispeed", and "ospeed" words in "stty -a" output to be unaffected
by locale; perhaps this is why GNU coreutils 5.93 leaves
"columns" untranslated.

GNU coreutils also supports "stty size", which outputs only
the rows and columns and may thus be more reliable to parse.
However, I don't know how widely that's supported elsewhere.

  • application/pgp-signature attachment: stored
Received on Sat Jan 7 18:23:30 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.