home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
RDQWKSRC.ZIP
/
ANSI.C
next >
Wrap
C/C++ Source or Header
|
1991-01-15
|
5KB
|
205 lines
/*
╔══════════════════════════════════════════════════════════════════════════╗
║ ║
║ Test routines to read, in Qmail Format - R.Cougnenc 90 - ║
║ ║
║ Public Domain ║
║ ║
╟──────────────────────────────────────────────────────────────────────────╢
║ ║
║ These modules correspond to different tests at reading in ║
║ Qmail Format. They were never planned to be released as a ║
║ package. ║
║ ║
║ Source code is not beautified or optimised as they are work ║
║ files and are distributed as is. ║
║ ║
║ The program, even at it's rustic stage is fully fonctional, ║
║ as I use it regularly... ║
║ ║
║ Feel free to use any or all of these modules, if you can sort ║
║ it out! :-) ║
║ ║
╚══════════════════════════════════════════════════════════════════════════╝
*/
/*
--------- Ansi screen control functions -------------
These elementary control sequences are implemented on most
basic ansi terminals.
R.Cougnenc 88 - Public Domain -
*/
extern int ansi ; /* Will just return on ansi=0 */
#define ESC 27
void cls() /* Clear screen & home cursor */
{
if( ansi )
printf("%c[2J%c[H",ESC,ESC);
}
void deleol() /* del to end of line */
{
if( ansi )
printf("%c[K",ESC);
}
void clear() /* Reset Attributes */
{
if( ansi )
printf("%c[0m",ESC );
}
void high() /* HigLitht (or BoldFace ) */
{
if( ansi )
printf("%c[1m",ESC);
}
void blink() /* blink mode */
{
if( ansi )
printf("%c[5m",ESC);
}
void reverse() /* Revers video mode */
{
if( ansi )
printf("%c[7m",ESC);
}
/*------------- Foreground colors ---------------------*/
void black()
{
if( ansi )
printf("%c[30m",ESC);
}
void red()
{
if( ansi )
printf("%c[31m",ESC);
}
void green()
{
if( ansi )
printf("%c[32m",ESC);
}
void yellow()
{
if( ansi )
printf("%c[33m",ESC);
}
void blue()
{
if( ansi )
printf("%c[34m",ESC);
}
void magenta()
{
if( ansi )
printf("%c[35m",ESC);
}
void cyan()
{
if( ansi )
printf("%c[36m",ESC);
}
void white()
{
if( ansi )
printf("%c[37m",ESC);
}
/*------------- BackGround colors ---------------------*/
void bblack()
{
if( ansi )
printf("%c[40m",ESC);
}
void bred()
{
if( ansi )
printf("%c[41m",ESC);
}
void bgreen()
{
if( ansi )
printf("%c[42m",ESC);
}
void byellow()
{
if( ansi )
printf("%c[43m",ESC);
}
void bblue()
{
if( ansi )
printf("%c[44m",ESC);
}
void bmagenta()
{
if( ansi )
printf("%c[45m",ESC);
}
void bcyan()
{
if( ansi )
printf("%c[46m",ESC);
}
void bwhite()
{
if( ansi )
printf("%c[47m",ESC);
}
/*----------- Cursor position ---------------------------*/
void locate( x , y )
int x, y;
{
if(ansi)
printf("%c[%d;%dH",ESC,y,x);
}
void up(nb) /* Cursor Up default 1 */
int nb;
{
if ( ansi )
{
if( ! nb ) nb = 1 ;
printf("%c[%dA",ESC,nb);
}
}
void dn(nb) /* Cursor down default 1 */
int nb;
{
if ( ansi )
{
if( ! nb ) nb = 1 ;
printf("%c[%dB",ESC,nb);
}
}
void right(nb) /* Cursor right default 1 */
int nb;
{
if ( ansi )
{
if( ! nb ) nb = 1 ;
printf("%c[%dC",ESC,nb);
}
}
void left(nb) /* Cursor left default 1 */
int nb;
{
if ( ansi )
{
if( ! nb ) nb = 1 ;
printf("%c[%dD",ESC,nb);
}
}
/*-----------------------------------------------------------------------*/