TIP: Click on subject to list as thread! ANSI
echo: maximus
to: DON GUY
from: GREG MACLELLAN
date: 1997-10-04 20:16:00
subject: Detecting ANSI

 DG> Greetings All!
 DG> This is probably a common question, but I need the answer. :)
 DG> I'd like to have Max auto-detect the ANSI capability of 
 DG> callers before displaying the Logo screen. Can someone 
 DG> please tell me how this is done?
pretty simple:
#include 
int main()
{
  if (ansidet())
  {
    usr.video := 1; // turn ansi on
//  print("Ansi Detected!"); // tell them it was detected, if you want.
  } 
  else 
  {
    usr.video := 0; // ansi not detected
//  print("TTY detected!");
  }
return 0;
}
what i use here is:
/////////////////////////////////////////////////////////////////////////////
//
// File: ansid.mex
//
// Desc: Ansi detect/enable routine
//
/////////////////////////////////////////////////////////////////////////////
#include 
#include 
#include 
int main()
{
    int: scrap;
    char: ans, nonstop;
    nonstop := 1;
    print("\n");
    if((ansi_detect()) and (usr.video = 1))
      {
        usr.video := 1;
        print(COL_DKGRAY "-[" COL_BLUE "A" COL_RED "N" COL_YELLOW "S" COL_BLU
E "i" COL_WHITE " Detected!" COL_DKGRAY "]-\n");
      }
    else
      {
        print("Sorry, ANSI was NOT detected!\n\nThis bbs now requires that yo
u use ansi. If your terminal does not support\nANSI, then try using a termina
l like Terminat or Telix.\n\n");
        ans := input_list("Yn",0,"","Y(es) or N(o)","Do you wish to enable AN
SI?");
        if (ans = 'Y' or ans = 'y') { usr.video := 1; }
        else
        {
          print("\n\nCall back sometime with ANSI, and you will be able to lo
g on");
          display_file("c:\\max\\misc\\hangup.bbs",nonstop);
        }
      }
}
///////////////////////////////////////////////////////////////////////
which doesn't let anyone on unless they have ansi, because i have a lot of 
complicated stuff using goto's that i have absoutely no intention of 
rewriting to support 10 TTY users ;)
Note that sometimes ansi is not detected, tho it is supported. That's where 
it's nice to have a prompt if it's not detected. You could always make a 
modification on the above to do this.
ttyl, greg
--- Maximus/2 3.01
---------------
* Origin: * Chaos BBS * 6i3.389.O8i6 * Kingston, ON! (1:249/174)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.