diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-04-13 01:59:20 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-04-13 01:59:20 +0000 |
commit | 32019ae92c1a2dc7fd47715eb293859dddbc3c14 (patch) | |
tree | de1b4af192aba6e5176517d52d1e95001dac8395 | |
parent | e1b0e990bce86d1a964c330a65172fa0112fd128 (diff) |
Print the sets list in 3 columns. Some pathological case handling for
extremely siteXX-stupidlonghostname.tgz files worked out with krw
The shell script output is now substantially shorter than it was before
and blind people will appreciate this in our next release.
-rw-r--r-- | distrib/miniroot/install.sub | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 1fb551aac24..d678e9d0e89 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.451 2009/04/13 01:48:05 deraadt Exp $ +# $OpenBSD: install.sub,v 1.452 2009/04/13 01:59:19 deraadt Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2007 Todd Miller, Theo de Raadt, Ken Westerback @@ -480,7 +480,8 @@ addhostent() { # # Set $resp to list of selected sets. select_sets() { - local _avail=$1 _selected=$2 _next _f _action + local _avail=$1 _selected=$2 _next _f _action _col _p + typeset -L16 _l # 16 characters per column cat <<__EOT @@ -491,15 +492,33 @@ __EOT while :; do _action= _next= - echo + _col=0 for _f in $_avail; do if isin $_f $_selected; then - echo " [X] $_f" + _p="[X] $_f" else - echo " [ ] $_f" + _p="[ ] $_f" : ${_next:=$_f} fi + if (( _col == 0 )); then + echo -n ' ' + fi + if (( ${#_p} > 16 )); then + print -n "$_p" # XXX site* is last entry + _col=2 # trigger a new line + else + _l="$_p" + print -n "$_l" + fi + let _col=_col+1 + if (( _col == 3 )); then + echo # end of a column + _col=0 + fi done + if (( _col % 3 )); then + echo # complete a partial column + fi : ${_next:=done} ask "Set name? (or 'done')" "$_next" |