
#include	"sysdef.h"

#include	"scterm.h"
#define	then
#define	then

static int bits[] = { 0,01,02,04,010,020,040,0100,0200 } ;

ledon(led_number)
register int led_number ;
{
	extern int ledstatus,termtype ;

	if ( termtype == _vt100 && led_number <=4 )
	  then	{
		ledstatus |= bits[led_number] ;
		ledsend(led_number) ;
		}
}

ledoff(led_number)
register int led_number ;
{
	extern int ledstatus,termtype ;
	register int i ;
	
	if ( termtype == _vt100 && led_number <=4 )
	  then	{
	    if ( led_number == 0 )
	      then {
		ledstatus = 0 ;
		ledsend( 0 ) ;
		   }
	      else {
		if ( (ledstatus & bits[led_number]) != 0 )
		  then	{
			ledstatus &= ~bits[led_number] ;
			ledsend(0) ;
			for (i=1; i<=4; i++)
			  if ( (ledstatus & bits[i]) !=0 )
			    then ledsend(i) ;
			}
		   }

		}
}



ledsend(led_number)
int led_number;
{
	char s[10] ;
	register char *cp ;

	cp = s ;
	*cp++ = 033 ;
	*cp++ = '[' ;
	*cp++ = led_number + '0' ;
	*cp++ = 'q' ;
	*cp   = 0 ;
	putbin(s,0);
}
