[comp.unix.xenix] ct for XENIX

martin@zeus.hf.intel.com (Martin Wilde) (11/04/88)

> Where can I find a copy of 'ct' to run under SCO Xenix 386? Not in the
> standard release (unless it is hidden there under some other name).
> Its on our Convergent Tech Sys V Unix system.
> As I under stand it, 'ct' lets the system call a terminal or modem
> and present a getty login in prompt. For call-back security, among
> other things.
> Dave Hughes
> !hplabs!well!dave

FLAMES OFF!!!!!  (I am just passing the stuff by to help him out)

Dave below is a small "ct" program that I wrote once for the same 
purpose.  The program currently works on XENIX 286 R1.0 (SYSIII version)
but it should work with little modifications under sysV.

The program is a quick hack, but does work.  It does need
things like line locking (checking for presence of uucico) and probably
some better signal handling.  

The program essentially closes the terminal off, dials the number and
then hangs a getty on the line.

Do with it whatever you like...

Enjoy!!!
---------------------------- CUT --------------------------------------
#include	<signal.h>

char 	msg1[25] = "dialing..........\n";
char 	msg2[25] = "disconnecting....\n";
char	*usage = "usage: ct acu phone speed";

main(argc,argv)
int argc;
char *argv[];
{
	int pid;
	int status;
	int fd;
	int ret;
	char *phone;
	char *speed;

	argc--;
	if (argc < 3) {
		printf("%s\n",usage);
		exit(-1);
	}

	phone=argv[2];
	speed=argv[3];
	fd = open("/dev/tty",2);
	ret=write(fd,msg1,sizeof(msg1));
	if ((pid = fork() ) ==0) {
		close(0);
			close(1);
			close(2);
			setpgrp();
			open(argv[1],2);
			open(argv[1],2);
			open(argv[1],2);
			if( ( pid = fork() ) == 0 ) {
				execl("/usr/lib/uucp/dial", "dial", argv[1], phone, speed, 0);
				exit(-1);
			}

			wait(&status);	
		
			(void) signal(SIGHUP, SIG_IGN);
			(void) signal(SIGINT, SIG_IGN);
			(void) signal(SIGQUIT, SIG_IGN);
			if ((pid = fork() ) == 0) {
				execl("/etc/getty","getty", "3", (char *)0);
				exit(-1);
			}
			wait(&status);	
	}
	
	wait(&status);
	ret=write(fd,msg2,sizeof(msg2));
}
---------------------------- CUT --------------------------------------

I assume no responsibility for this program, just being helpful

                  _/_          |
 ______  __.  __  /  o ____    |  textronix!reed!littlei!zeus:martin
/ / / <_(_/|_/ (_<__<_/ / <    |