Hi, I'm back again ! ;)
Still talking about socket programming ...
I have a a file called menu and it has the following lines:
---------cut here----------------
-----------------------------------------
\e[4mW E L C O M E \e[m
\e[1m BBS @ DEI\e[m (Bulletin Board System)
-----------------------------------------
--------cut here ----------------
This file is sent through client descriptor without problems, I think!
My "problem" is:
When I get a connetion to my server on a tty console(not in X) I get
the text is selected as with bold characters! ;)
If I get a connection but on X on a rxvt session i see all the text
with escape codes ! :(
Both sessions(on console as well rxvt) have TERM variable as vt100 !
If I run a xterm session output it will look really as I want (with bold
and underline) - on that TERM=xterm-debian!
How can I protect users from this situation - if they don't support
"bold", "underline", etc don't let them see escape codes ?
I tried to detect ENVIRONMENT variable on remote machine like:
------ cut here ---------
buffer[0] = IAC ;
buffer[1] = DO ;
buffer[2] = TELOPT_TTYPE ;
write(client_fd, buffer, 3);
/* Sub negotiation */
buffer[0] = IAC ;
buffer[1] = SB ; /* Begin subnegotiation */
buffer[2] = TELOPT_TTYPE ;
buffer[3] = TELQUAL_SEND ;
buffer[4] = IAC ;
buffer[5] = SE ; /* End subnegotiation */
write(client_fd, buffer, 6);
leu=read(client_fd, buffer, 48);
buffer[leu]='\0' ;
--------cut here-----------------
But I get on buffer's variable, 6 strange characters !
It should return a string, I think!
I already saw RFC 1091 and someones but I still don't know how to do
or even if this is the solution !
What should I do ? Never use Escape Codes ? It's safer !?
Thanks.
Best regards,
Nuno Carvalho
������������������������������
Nuno Emanuel F. Carvalho
Dep. Informatics Engineering
University of Coimbra
PGP key available at finger
������������������������������