2

I've written a script called by tcpserver that heavily utilizes tput and similar commands. These commands need to know how to correctly write to the terminal and rely on the TERM variable to obtain this information. Right now the TERM variable is being inherited from the console tcpserver is launched from and I would like to change this.

My clients are telnet-based terminal programs like netcat and telnet. How can I get these programs to communicate the user's terminal type to the remote server?

Andrew B
  • 32,588
  • 12
  • 93
  • 131
  • It's a real question, but it's an obscure topic and not one that many will be able to really understand as worded. It'd probably be fine with an edit, so long as you aren't over-emphasizing how to implement this at the tcpserver level. – Andrew B Apr 11 '13 at 02:58
  • #Andrew Thanks. I also understood that this is a question more for a StackOverflow (or maybe even SuperUser) becouse the idea was to how to implement rfc 1091 using bash that is server through TcpServer. – LoCoZeNoz ZUE Apr 11 '13 at 10:03
  • Correct. On the other hand, "how do I get netcat and similar programs to report their terminal type to the remote server" is a legit question for here, so that's what I focused on. :) – Andrew B Apr 11 '13 at 15:04
  • I've edited the question to be appropriate for ServerFault. – Andrew B Apr 11 '13 at 15:16

1 Answers1

3

What you are looking for is something known as "terminal-type negotiation", often abbreviated to "termtype". This allows telnet-aware client software to negotiate a terminal type out of band using telnet escapes.

For the client half, telnet will automatically attempt to negotiate the terminal type. netcat on the other hand does not assume the remote server understands telnet escapes by default, and you'll need to run it with the -t option to enable telnet negotiation.

For the server half, I believe that would be up to you to implement and falls outside the scope of ServerFault's subject matter. Reading RFC1091 would be a good start.

Andrew B
  • 32,588
  • 12
  • 93
  • 131