[comp.unix.xenix] Does init have to run a getty?

dave@mobile.UUCP (David C. Rein) (07/27/89)

      A couple of days ago, a program came across the net to allow for
	one line to be used for voice and data.  A ring, hang up, then call
    will throw a getty on the port.  Now, my question is, how do I get
    init to put anyting but a getty on the port??  I looked in the inittab
	file, but it looks like the program name isn't even looked at.
	  So, I'm left pondering the question of, how do I make init throw
	something else on the port besides a getty??
	Thanks in advance for any help!
                                                               Dave Rein
UUCP: ..!kodak!gizzmo!lazlo!\      \/   "It just goes to show what you can do 
            mobile!dave            /\         if you're a total psychotic"
Domain: dcr0801@ultb.isc.rit.edu  /  \           -- Woody Allen

ivar@acc.uu.no (Ivar Hosteng) (07/28/89)

> 
>       A couple of days ago, a program came across the net to allow for
> 	one line to be used for voice and data.  A ring, hang up, then call
>     will throw a getty on the port.  Now, my question is, how do I get
>     init to put anyting but a getty on the port??  I looked in the inittab
> 	file, but it looks like the program name isn't even looked at.
> 	  So, I'm left pondering the question of, how do I make init throw
> 	something else on the port besides a getty??
> 	Thanks in advance for any help!
>
>

SCO have hardcoded init to start /etc/getty so the only thing you
can do is to write a c program that checks witch tty it is supposed
to start and if it is the one you want to use, exec your program instead
of getty. To do this you must make a program that checks argv[1] for
the ttyname and starts your program if its the right port, or starts
/etc/oldgetty (or whatever you reanme it to bee) if it is the wrong
line. You just have to make shure to pass along the argv
parameters to the old getty program so it knows what speed to start
the port with. Here is a sample program that does what you want:

/* fakegetty.c */
#include <string.h>

main(argc,argv)
  int argc;
  char **argv;
{

  if strcmp(argv[1],"tty??") execv("/yourprog",argv);
  /* If we can't find the program, just start getty instead */
  execv("etc/oldgetty",argv);
  exit(1);		/* Here we are in big trouble, so exit	*/
}

I hope this is what you want, it worked fine here. When I first got Xenix I
had problems with my modem (The modem waited 3 secs before it dropped
the carrier after logoff) so that i had to make getty wait 4 seconds
befor reopening the serial tty. I replaced the if statment with a sleep(4)
and everything worked fine.

Regards



-- 
Ivar E. Hosteng,	Advanced Computer Consultans, Oslo, Norway
Internet:		ivar@acc.uu.no
UUCP:			...!{uunet,mcvax,ifi}!acc.uu.no!ivar
'Just what do you think you are doing Dave?'	-HAL9000

richard@neabbs.UUCP (RICHARD RONTELTAP) (07/28/89)

[ Init run getty ]
 
If you have Xenix 2.2.3 Inittab isn't implemented completely. The
trick is to make your own program 'getty' which starts up the old (and
renamed) getty if needed.
 
I use this to get auto-baudrate detect with Hayes modems.
 
Richard
...!hp4nl!neabbs!richard