diff options
Diffstat (limited to 'xtopen')
-rwxr-xr-x | xtopen | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -14,16 +14,20 @@ abbr() { if [ $# -eq 0 ]; then xmessage -buttons sorry:0 -default sorry -nearmouse \ - "usage: $0 [-k] [-K] cmd ..." + "usage: $0 [-i] [-k] [-K] [-u] cmd ..." exit 1 fi +i= k= K= -while getopts kK o; do +u= +while getopts ikKu o; do case $o in + i) i=1 ;; K) K=1 ;; k) k=1 ;; + u) u=1 ;; ?) xmessage -buttons sorry:0 -default sorry -nearmouse \ error: "unknown flag $1" exit 1 ;; @@ -37,8 +41,14 @@ if ! which "$1" >/dev/null; then exit 1 fi +prefix= + +[ ! -z "$i" ] && prefix=$prefix\ iso8859-1 +[ ! -z "$u" ] && prefix=$prefix\ utf8 + case "$k,$K" in -1,*) exec xterm -title "$* (`abbr "$PWD"`)" -e with-shell "$@" ;; -*,1) exec xterm -title "$* (`abbr "$PWD"`)" -e with-shell-on-error "$@" ;; -*,*) exec xterm -title "$* (`abbr "$PWD"`)" -e "$@" ;; +1,*) prefix=$prefix\ with-shell ;; +*,1) prefix=$prefix\ with-shell-on-error ;; esac + +exec xterm -title "$* (`abbr "$PWD"`)" -e $prefix "$@" |