Skip to content

Commit ee81b16

Browse files
committed
get rid of consoletype
1 parent 8aa6094 commit ee81b16

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

10lang.csh

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if ($LC_SOURCED == 1) then
1818
endif
1919
endif
2020

21-
set consoletype=`/sbin/consoletype stdout`
21+
set in_console=`tty | grep -vc -e '/dev/tty'`
2222

2323
if ($?CHARSET) then
2424
switch ($CHARSET)
@@ -30,10 +30,8 @@ if ($LC_SOURCED == 1) then
3030
case KOI*:
3131
case LATIN2*:
3232
if ( $?TERM ) then
33-
if ( "$TERM" == "linux" ) then
34-
if ( "$consoletype" == "vt" ) then
33+
if ( "$TERM" == "linux" && in_console == 0 ) then
3534
/bin/echo -n -e '\033(K' >/dev/tty
36-
endif
3735
endif
3836
endif
3937
breaksw
@@ -49,10 +47,8 @@ if ($LC_SOURCED == 1) then
4947
case koi*:
5048
case latin2-ucw*:
5149
if ( $?TERM ) then
52-
if ( "$TERM" == "linux" ) then
53-
if ( "$consoletype" == "vt" ) then
50+
if ( "$TERM" == "linux" && in_console == 0 ) then
5451
/bin/echo -n -e '\033(K' > /dev/tty
55-
endif
5652
endif
5753
endif
5854
breaksw
@@ -63,8 +59,7 @@ if ($LC_SOURCED == 1) then
6359
case *.utf8*:
6460
case *.UTF-8*:
6561
if ( $?TERM ) then
66-
if ( "$TERM" == "linux" ) then
67-
if ( "$consoletype" == "vt" ) then
62+
if ( "$TERM" == "linux" && in_console == 0 ) then
6863
switch ($LANG)
6964
case en_IN*:
7065
breaksw
@@ -89,15 +84,13 @@ if ($LC_SOURCED == 1) then
8984
endif
9085
endif
9186
endif
92-
endif
9387
endif
9488
endif
9589
endif
9690
breaksw
9791
case *:
9892
if ( $?TERM ) then
99-
if ( "$TERM" == "linux" ) then
100-
if ( "$consoletype" == "vt" ) then
93+
if ( "$TERM" == "linux" && in_console == 0 ) then
10194
switch ($LANG)
10295
case en_IN*:
10396
breaksw
@@ -117,12 +110,11 @@ if ($LC_SOURCED == 1) then
117110
/bin/unicode_stop
118111
endif
119112
endif
120-
endif
121113
endif
122114
endif
123115
breaksw
124116
endsw
125-
endif
117+
endif
126118
unsetenv SYSFONTACM
127119
unsetenv SYSFONT
128120
unset consoletype

10lang.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ if [ "$LC_SOURCED" = 1 ]; then
5151

5252
consoletype=$CONSOLETYPE
5353
if [ -z "$consoletype" ]; then
54-
consoletype=$(/sbin/consoletype stdout)
54+
consoletype=$(/usr/bin/tty)
5555
fi
5656

5757
if [ -n "$LANG" ]; then
5858
case $LANG in
5959
*.utf8*|*.UTF-8*)
60-
if [ "$TERM" = "linux" ]; then
61-
if [ "$consoletype" = "vt" ]; then
60+
if [ "$TERM" = "linux" ] && $consoletype | grep --quiet -e '/dev/tty'; then
6261
case $LANG in
6362
ja*) LANG=en_US.UTF-8 ;;
6463
ko*) LANG=en_US.UTF-8 ;;
@@ -70,12 +69,10 @@ if [ "$LC_SOURCED" = 1 ]; then
7069
en_IN*) ;;
7170
*_IN*) LANG=en_US.UTF-8 ;;
7271
esac
73-
fi
7472
fi
7573
;;
7674
*)
77-
if [ "$TERM" = "linux" ]; then
78-
if [ "$consoletype" = "vt" ]; then
75+
if [ "$TERM" = "linux" ] && $consoletype | grep --quiet -e '/dev/tty'; then
7976
case $LANG in
8077
ja*) LANG=en_US ;;
8178
ko*) LANG=en_US ;;
@@ -87,7 +84,6 @@ if [ "$LC_SOURCED" = 1 ]; then
8784
en_IN*) ;;
8885
*_IN*) LANG=en_US ;;
8986
esac
90-
fi
9187
fi
9288
;;
9389
esac

0 commit comments

Comments
 (0)