[comp.unix.ultrix] Program needs exclusive use of shared line

gordon@prls.UUCP (Gordon Vickers) (04/28/89)

[ REPOST for wider distribution  ( /ca/usa/ ) ]

    How do I get exclusive use of a shared (/etc/ttys) tty line ?

    I am writing a program to be exicuted from crontab that will switch
  my modem to auto-answer at night, and back to originate only in the
  mornings. I am not interested in using a shell script that will edit
  /etc/ttys becouse my goal is to dissable the modem from going off hook
  to answer calls that are intended for me personnally (voice).

    The modem's tty port is a shared (/etc/ttys) line.

    My program will currently do what it is required to do but each time
  the modem sends something back ("OK"), the login-in prompt is getting
  sent to the modem.

    I've tried opening the port with:
      int modem;
      modem = open(dev,O_RDWR | O_BLKANDSET)
   but open returns NULL and I don't understand what that is suppose to
   mean.  Seems like it should mean that "the open completed without error
   but your not getting a file discriptor".

   I did not expect the open to return until my process had set the
   TIOCSINUSE bit (ioctl).

   When I tried looping on the open while it returns NULL, the process
   stays in the loop forever.

   How do I tell the system that I want this port exclusively and I'm willing
   to wait for it ?

   I'm running Ultrix 3.0 on a VAX 11/750. The modem port is port 1 of a
   DMF-32 .

 Thank you,
Gordon Vickers 408/991-5370 (Sunnyvale,Ca); {mips|pyramid|philabs}!prls!gordon
------------------------------------------------------------------------------
Every extinction, whether animal, mineral, or vegetable, hastens our own demise.