Does init have to run a getty?

Ivar Hosteng ivar at acc.uu.no
Fri Jul 28 11:27:13 AEST 1989


> 
>       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 at acc.uu.no
UUCP:			...!{uunet,mcvax,ifi}!acc.uu.no!ivar
'Just what do you think you are doing Dave?'	-HAL9000



More information about the Comp.unix.xenix mailing list