On Tue, 22 Dec 1998, Glynn Clements wrote:

> This is the wrong thing to do. The `\e[4m' sequence corresponds to
> `enter underline mode' for an ANSI terminal. On other types of
> terminal it may do something completely different. The same applies to
> `\e[1m' (bold).
  
  You're rigth, again ! ;)

> The terminal type option should be sent by the client to the server.
> If you are going to implement the telnet protocol yourself, you need
> to:
> 
> 1. Watch for the terminal sending `WILL TERMINAL-TYPE'.
> 2. Reply with `DO TERMINAL-TYPE'.
> 3. Send `SB TERMINAL-TYPE SEND'.
> 4. Watch for `SB TERMINAL-TYPE IS ...'.
> 5. Store the terminal type which the terminal sends.

 I still had no success with that! ;( If you could send me this source
code part it would be great for me! 

 I made the following program and it works as I want! When terminal don't
support it just shows as normal characters.

 Meanwhile, this is sent to sdout ! How can I send this to a socket
descriptor!? To do that should I read the buffer variable till '$'
character !? It seems "$<2>" it's supplied by tputs to provide a certain
delay! If I'm rigth could I just send with write() function to the client
descriptor all characters till '$' character and I'll have always the
results I want !?

 At the line with setupterm should I replace vt100 with terminal's 
remote machine, rigth !?


--------- cut here ---------------
#include <stdio.h>

#include <curses.h>
#include <term.h>

void main()
{
  char *buffer ;
  
/*  initscr();  */

  setupterm("vt100", 1, (int*)0 );  

  if(buffer=tigetstr("bold"))  /* [1m$<2> */
  {

    tputs(buffer, 1, putchar); 
    printf("\n Just Bold.");
    if(buffer=tigetstr("smul"))  /*  [4m$<2>  */   
    {
     tputs(buffer, 1, putchar); 
     printf("\nUnderline and Bold\n");
    }
  }
  else
    printf("\n Doesn't support bold");

/*  endwin();  */
}
----- cut here ----------

 Thanks for the help.

 Best regards,
  Nuno Carvalho

P.S. Could it be incompatibilities when porting to freeBSD ? Could it need
to be compiled with -ltermcap instead of lcurses !?

������������������������������
   Nuno Emanuel F. Carvalho
 Dep. Informatics Engineering
    University of Coimbra

  PGP key available at finger
������������������������������

Reply via email to