[net.sources] blast

fgd@cit-vax (Test Account -- Arpa(MON)) (12/31/84)

	This program, though short, turns out useful every now and then.
You may want to add echoing on the remote terminal.  Also,  apologies to
non-BSD people.  I havent yet tried it under Amdahl's UTS....

					-- mike

--------------------------------------------------------------------------
/* Blast into a users terminal.  Great fun, and sometimes useful. */

/* December 1984 */
/* Pasadena CA -- Mike Newton, Caltech 256-80, Pasadena, CA 91125 */

/* newton@cit-vax.ARPA */
/* newton%cit-vax.CSNET */
/* {ucbvax,allegra}!cithep!cit-vax!newton.UUCP */

/* Designed to be run on BSD4.2 systems.  Many work on 4.1 as well */

/* Anyone have any jobs for system andministrators in Hawaii? 
   I am about to graduate and want to go back! */

#include<sgtty.h>
#include<stdio.h>
#include<sys/file.h>

int errno;

main(argc,argv)
int argc;
char *argv[];
{	
	errno = 0;
	if (argc != 2) fprintf(stderr,"blast: need tty number (only).\n");
	else blast(open(argv[1],O_RDWR,0666));
}

blast(fd)
register FILE *fd;
{
	char c;


	if (errno) return;

	ioctl(fd,TIOCNXCL,0);		/* turn off exclusive use */

	while ( (c=getchar()) != EOF) ioctl(fd,TIOCSTI,&c);
}
--------------------------------------------------------------------------