File: uterm

package info (click to toggle)
mined 2000.10-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,904 kB
  • ctags: 2,258
  • sloc: ansic: 130,722; sh: 1,725; makefile: 260; perl: 169; sed: 152; cpp: 28
file content (43 lines) | stat: -rwxr-xr-x 1,435 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh

# invoke xterm in UTF-8 mode

# configure font to be used with an X resource entry 
# (typically in $HOME/.Xdefaults),
# e.g. one of:
#! 10x20 is a nice big font for use with Unicode terminal
#UXTerm*font:	10x20
#! 9x18 is a little bit spindly but needed for double-width Han range
#UXTerm*font:	9x18

# retrieve X font resource for class UXTerm and use it if available;
# this should actually be achieved with -class UXTerm instead, 
# but due to an xterm bug, -e is ignored when -class is used, 
# so uterm wouldn't work with umined;
# fixed with xterm 162
xtermversion=`xterm -version | sed -e 's,.*(\([0-9]*\)).*,\1,' -e t -e d`
if [ 0$xtermversion -ge 162 ]
then	uresources="-class UXTerm"
else	# work-around for buggy xterm that ignores -e when -class is present
	# also for xterm that understands neither -version nor -class 
	# (e.g. SunOS /usr/openwin/bin/xterm)
	uresources=`
		xrdb -query |
		sed -e ': start' -e '/\\$/ b cont' -e b -e ': cont' -e N -e 'b start' |
		sed -e "s,^UXTerm\(.*\),-xrm 'XTerm\1'," -e t -e d
	`
fi


# modify locale environment to inform about UTF-8 mode:
case "$LC_ALL" in
?*)	LC_ALL=`echo $LC_ALL | sed -e "s,\..*,,"`.UTF-8;;
*)	LC_CTYPE=`echo $LC_CTYPE | sed -e "s,\..*,,"`.UTF-8
	export LC_CTYPE;;
esac

# set application-specific environment variables:
LESSCHARSET=utf-8	# used by older less version to select UTF-8 display
export LESSCHARSET

eval exec xterm -u8 $uresources "$@"