Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!husc6!rutgers!dayton!ems!quest!sheldon
From: sheldon@quest.UUCP (Scott S. Bertilson)
Newsgroups: comp.sys.att
Subject: Re: RS232 Configuration on AT&T 7300
Message-ID: <1027@quest.UUCP>
Date: Wed, 22-Jul-87 06:22:55 EDT
Article-I.D.: quest.1027
Posted: Wed Jul 22 06:22:55 1987
Date-Received: Sat, 25-Jul-87 10:45:02 EDT
References: <718@aplvax.UUCP> <286@intvax.UUCP>
Reply-To: sheldon@quest.UUCP (Scott S. Bertilson)
Distribution: na
Organization: Quest Research Inc., Burnsville, MN
Lines: 56

Here's a little program that a friend (Gene Olson) wrote to solve the
problem of opening a line when there is no carrier.  Works on all
SysV machines as far as I know.  (Including the UNIXpc.)
An easy way to stick the file in the openable state is to:
	clocal tty000 sleep 10000 &
You can then do "stty" and whatever else strikes your fancy.

#include 
#include 
#include 
#include 

main(argc,argv)
int argc ;
char **argv ;
{
	char device[50] ;

	struct termio tio ;

	if (argc < 3) {
		fprintf(stderr,"Usage: %s tty command [ param ... ]\n", *argv) ;
		exit(1) ;
		}

	strcpy(device,"/dev/") ;
	strcat(device,argv[1]) ;

	fclose(stdin) ;
	fclose(stdout) ;

	if (open(device,O_RDWR|O_NDELAY) != 0) {
		fprintf(stderr,"Cannot open: %s\n",device) ;
		exit(1) ;
		}

	dup(0) ;
	fprintf(stderr,"File now open\n") ;

	if (ioctl(0,TCGETA,&tio) < 0) {
		fprintf(stderr,"Ioctl TCGETA failed\n") ;
		exit(1) ;
		}

	tio.c_cflag |= CLOCAL ;

	if (ioctl(0,TCSETA,&tio) < 0) {
		fprintf(stderr,"Ioctl TCSETA failed\n") ;
		exit(1) ;
		}

	execvp(argv[2],&argv[2]) ;
	}
-- 

Scott S. Bertilson   ...ihnp4!quest!sheldon or scott@uc.msc.umn.edu