home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_300
/
328_02
/
wputs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-17
|
1KB
|
82 lines
/*! wputs
*
*
* put a string to video at the current cursor position
* uses wputstyle to control output.
*
*/
#include "wsys.h"
int wputs(char *s)
{
int count = 0;
unsigned char save_cur;
unsigned char more, inline_attr;
_NORMALIZE(s); /* model-dependent normalization */
#ifdef __LARGE__
if ( s==NULL ) return (0);
#endif /* __LARGE__ */
#ifdef __COMPACT__
if ( s==NULL ) return (0);
#endif /* __COMPACT__ */
if ( wmode == 'T' )
{
save_cur = (w0->winflag) & WFL_CURSOR;
if ( save_cur )
{
wcursor (OFF);
}
}
/* see if we're doing in-line attributes
* use \a for inline attributes if:
* the ALARM flag is off and the ATTR flag is on
*/
#define THREE_FLAGS (WPUTANSI | WPUTATTR | WPUTALARM)
#define TWO_FLAGS (WPUTANSI | WPUTATTR )
inline_attr = ( ( w0-> winputstyle & THREE_FLAGS ) == TWO_FLAGS ) ?
1: 0;
for ( count=0, more = 1 ; (*s) && more ; ++s, ++count )
{
if ( inline_attr && (*s == '\a') && (*(s+1) != 0) )
{
wsetattr ( *(++s) );
}
else
{
more = wputc (*s);
}
}
if (wmode == 'T')
{
if ( save_cur )
{
wcursor (ON);
}
}
return(count);
} /*end of wputs */