mdisk: Delete unnecessary use of `strip_diskname` and use it elsewhere
[sunny256-utils.git] / bigsh
blob85bdd7024c4df3ca44c43d6ea628c065bed52753
1 #!/bin/sh
3 #==============================================================================
4 # bigsh
5 # File ID: b834114a-fa6f-11dd-bf5e-000475e441b9
7 # Fyrer opp en stor xterm i X
9 # Det ender som oftest i
11 # --small:
12 # xterm -u8 -fn -misc-fixed-medium-r-semicondensed-*-*-120-*-*-c-*-iso10646-1 \
13 # -fb -misc-fixed-medium-r-semicondensed-*-*-120-*-*-c-*-iso10646-1 -bg black \
14 # -fg white -bc -geometry 211x67+0+0
16 # --big:
17 # xterm -u8 -fn -Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO10646-1 \
18 # -bg black -fg white -bc -geometry 140x48+0-8
20 # Author: Øyvind A. Holm <sunny@sunbase.org>
21 # License: GNU General Public License version 2 or later.
22 #==============================================================================
24 progname=bigsh
25 VERSION=0.2.4
27 opt_all=0
28 opt_big=0
29 opt_gdb=0
30 opt_help=0
31 opt_quiet=0
32 opt_small=1
33 opt_title=''
34 opt_verbose=0
35 while test -n "$1"; do
36 case "$1" in
37 -a|--all) opt_all=1; shift ;;
38 -b|--big) opt_big=1; opt_small=0; shift ;;
39 -g|--gdb) opt_gdb=1; shift ;;
40 -h|--help) opt_help=1; shift ;;
41 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
42 -s|--small) opt_small=1; opt_big=0; shift ;;
43 -T|--title) opt_title="$2"; shift 2 ;;
44 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
45 --version) echo $progname $VERSION; exit 0 ;;
46 --) shift; break ;;
48 if printf '%s\n' "$1" | grep -q ^-; then
49 echo "$progname: $1: Unknown option" >&2
50 exit 1
51 else
52 break
54 break ;;
55 esac
56 done
57 opt_verbose=$(($opt_verbose - $opt_quiet))
59 if test "$opt_help" = "1"; then
60 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
61 cat <<END
63 Usage: $progname [options] [COMMAND]
65 Create xterm windows and execute optional COMMAND in it.
67 Options:
69 -a, --all
70 Create all windows.
71 -b, --big
72 Use big fonts.
73 -g, --gdb
74 Create window for gdb(1).
75 -h, --help
76 Show this help.
77 -q, --quiet
78 Be more quiet. Can be repeated to increase silence.
79 -s, --small
80 Use small fonts. This is the default.
81 -T TITLE, --title TITLE
82 Use TITLE as xterm title.
83 -v, --verbose
84 Increase level of verbosity. Can be repeated.
85 --version
86 Print version information.
88 END
89 exit 0
92 if [ "$opt_big" = "1" ]; then
93 font="-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1"
94 else
95 font="-misc-fixed-medium-r-semicondensed-*-*-120-*-*-c-*-iso10646-1"
98 winc=''
99 wintitle="$opt_title"
100 [ -z "$wintitle" ] && wintitle=$(hostname)
102 start_xterm() {
103 local geom=$1
104 shift
106 if [ "$opt_big" = "1" ]; then
107 sess -d $progname.$wintitle -t c_$progname -- xterm \
108 -u8 \
109 -fn $font \
110 -bg black \
111 -fg white \
112 -bc \
113 -T "$wintitle" \
114 -geometry $geom "$@" &
115 else
116 sess -d $progname.$wintitle -t c_$progname -- xterm \
117 -u8 \
118 -fn $font \
119 -bg black \
120 -fg white \
121 -bc \
122 -T "$wintitle" \
123 -geometry $geom "$@" &
125 winc="$winc $wintitle"
128 if [ -e /carmbb.mrk ]; then
129 if [ "$opt_small" = "1" ]; then
130 start_xterm 131x40+0+0 "$@"
131 else
132 start_xterm 87x29+0+0 "$@"
134 elif [ -e /bellmann ]; then
135 start_xterm 180x56+0+0 "$@"
136 elif [ -e /hpelite1 ]; then
137 if [ "$opt_gdb" = "1" -o "$opt_all" = "1" ]; then
138 [ -z "$opt_title" ] && wintitle=gdb
139 if [ "$opt_big" = "1" ]; then
140 start_xterm 39x39+1002+0 "$@"
141 else
142 start_xterm 59x54+1002+0 "$@"
145 if [ "$opt_all" = "1" ]; then
146 wintitle=sunbase
147 if [ "$opt_big" = "1" ]; then
148 start_xterm 110x39+0+0 "$@"
149 else
150 start_xterm 165x54+0+0 "$@"
153 if [ "$opt_all" = "1" -o -z "$winc" ]; then
154 [ -z "$opt_title" ] && wintitle=hpelite1
155 if [ "$opt_big" = "1" ]; then
156 start_xterm 110x39+0+0 "$@"
157 else
158 start_xterm 165x54+0+0 "$@"
161 elif [ -e /hpelite2 ]; then
162 font="-gnu-unifont-*-*-*-*-*-*-*-*-*-*-*-*"
163 if [ "$opt_gdb" = "1" -o "$opt_all" = "1" ]; then
164 [ -z "$opt_title" ] && wintitle=gdb
165 start_xterm 62x63-0+0 "$@"
167 if [ "$opt_all" = "1" ]; then
168 wintitle=sunbase
169 start_xterm 175x63+0+0 "$@"
171 if [ "$opt_all" = "1" -o -z "$winc" ]; then
172 [ -z "$opt_title" ] && wintitle=s
173 start_xterm 175x63+0+0 "$@"
175 if [ "$opt_all" = "1" -o -z "$winc" ]; then
176 [ -z "$opt_title" ] && wintitle=hpelite2
177 start_xterm 175x63+0+0 "$@"
179 if [ "$opt_all" = "1" -o -z "$winc" ]; then
180 [ -z "$opt_title" ] && wintitle=s10
181 start_xterm 175x63+0+0 "$@"
183 elif [ -e /sunbase ]; then
184 if [ "$opt_gdb" = "1" -o "$opt_all" = "1" ]; then
185 [ -z "$opt_title" ] && wintitle=gdb
186 if [ "$opt_big" = "1" ]; then
187 start_xterm 29x36+996+0 "$@"
188 else
189 start_xterm 43x50+996+0 "$@"
192 if [ "$opt_all" = "1" ]; then
193 wintitle=sunbase
194 if [ "$opt_big" = "1" ]; then
195 start_xterm 110x36+0+0 "$@"
196 else
197 start_xterm 165x50+0+0 "$@"
200 if [ "$opt_all" = "1" -o -z "$winc" ]; then
201 [ -z "$opt_title" ] && wintitle=xterm
202 if [ "$opt_big" = "1" ]; then
203 start_xterm 110x36+0+0 "$@"
204 else
205 start_xterm 165x50+0+0 "$@"
208 elif [ -e /dundre.mrk ]; then
209 if [ "$opt_small" = "1" ]; then
210 start_xterm 211x55+0+0 "$@"
211 else
212 start_xterm 87x29+0+0 "$@"
214 else
215 start_xterm 165x25+0+0 "$@"
218 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :