diff options
author | kate.ward <kate.ward@forestent.com> | 2008-11-14 18:23:03 +0000 |
---|---|---|
committer | kate.ward <kate.ward@forestent.com> | 2008-11-14 18:23:03 +0000 |
commit | 709c13485a388e5dcc86eae54edb0e984187e98f (patch) | |
tree | 3f3f9939f08cc1e47f3addb69a00ccce641dc65b /source/1.0/src/shflags | |
parent | 9b0568f60b52d8fe14e65eb54b5635a9f541d5ba (diff) | |
download | shflags-709c13485a388e5dcc86eae54edb0e984187e98f.tar.gz |
added tput code, but it doesn't work really :-(
Diffstat (limited to 'source/1.0/src/shflags')
-rw-r--r-- | source/1.0/src/shflags | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/1.0/src/shflags b/source/1.0/src/shflags index 33a282a..055a93d 100644 --- a/source/1.0/src/shflags +++ b/source/1.0/src/shflags @@ -448,12 +448,14 @@ _flags_itemInList() # integer: width in columns of the current screen. _flags_screenColumns() { - _flags_size_=`stty size 2>/dev/null` - if [ $? -eq ${FLAGS_TRUE} ]; then + if _flags_size_=`stty size 2>/dev/null`; then + # stty size worked :-) _flags_cols_=`expr "${_flags_size_}" : '[0-9]* \([0-9]*\)'` + elif _flags_cols_=`tput cols 2>/dev/null`; then + # TODO(kward): this doesn't actaully work... tput is executed within a + # sub-shell which causes the screen width to be lost. + : # tput worked :-) else - # TODO(kward): support 'tput cols' as well, if possible. be warned that it - # doesn't work when put inside backticks (i.e. a sub-shell). _flags_cols_=80 fi echo ${_flags_cols_} |