[telnet] The CF Telnet Server and Colour Codes

Black Hole

May contain traces of nut
When I use iTelnet on the iPad to access the CF Telnet server, I sometimes get code strings starting "[" embedded in the responses, for example in the listing that follows an "ls" command. Various codes precede the items in the ls list (eg "[0;0m", "[1;32m", "[1;34m") and all are terminated by "[0m".

I believe these to be colour codes that would be interpreted by a VT241 or the like, and in the case of the ls command would display the different types of file listed in different colours according to the type of entry: subdirectories, system files, whatever.

Can I turn them off? Is there a configuration option that could tell the Telnet server it is dealing with a monochrome VT100 instead of the colour VT241, for example?
 
You're right, they're VT terminal codes - colour ones on the case of ls.
The default behaviour of ls in busybox is to always show colour, regardless of the terminal type.

You can create an alias to stop it:

Code:
humax# alias ls='ls --color=no'

and even make that permanent by putting it in a file under /mod/etc/profile/. I have something like that as I can't stand coloured directory listings.

Code:
humax# cat /mod/etc/profile/alias
alias ls='ls --color=no -CFh'

(The -F makes it indicate the directory entry type by adding a trailing character such as / for a directory)

It is possible to change your terminal type by putting it in the /mod/etc/termtype file but it doesn't help you in this instance.

Code:
humax# cat /mod/etc/termtype
xterm

You could buy iSSH for the ipad and have a decent client : )
 
The default behaviour of ls in busybox is to always show colour, regardless of the terminal type.
Isn't it compile-time configurable ?

Code:
adsb@vaio:~/Downloads/busybox-1.20.2$ grep COLOR .config
# CONFIG_FEATURE_LS_COLOR is not set
# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
 
So it is! I should have said "The way that Humax have configured busybox...." : )
 
I took a look at iSSH, but for £7 (I know it's not a lot really) it does far more than I need. The alias suggestion sorts out iTelnet nicely (for now), although I would be interested in a better Telnet client (that is only a Telnet client).
 
Back
Top