vt100.c

tmi2_fluffos_v2/lib/adm/simul_efun/vt100.c · 1.3 KB

From the archive tmi2_fluffos_v2.zip

Download the archive   « Back to the archive contents

/*
 * Written by Wayfarer@Portals
 * special functions for generating vt100 character sequences
 *
 * Adjusted by Watcher to make it more termcapish and to use ansi.h
 *
 * WARNING: Do not edit this file with ed!  It will lose its magical 
 * powers and be reduced to messages that look like " [7m" because ed
 * tends to strip out escape characters!
 */

#include <ansi.h>

string inverse (string str)
{
   if (this_player()->query_env("vt100")) {
	return (REV + str + NOR);
   } else return str;
}


string blink (string str)
{
   if (this_player()->query_env("vt100")) {
	return (BLINK + str + NOR);
   } else return str;
}

string bold (string str)
{
   if (this_player()->query_env("vt100")) {
	return (BOLD + str + NOR);
   } else return str; 
}

string underscore (string str)
{
   if (this_player()->query_env("vt100")) {
	return (U + str + NOR);
   } else return str;
}
string clear_screen ()
{
   if (this_player()->query_env("vt100")) {
	return (CLR);
   }
   else return "";
}

string clear_line ()
{
   if (this_player()->query_env("vt100")) {
	return (CSI + "2K");
   }
   else return "";
}

string up_line ()
{
   if (this_player()->query_env("vt100")) {
      return (CSI + "A"); 
   }
   else return "";
}

string erase_line ()
{
  if (this_player()->query_env("vt100")) {
	return (clear_line() + CSI + "79D");
  }
  else return "\n";
}

Site Stats

Snippets: 1791
Codebases: 571