how can I determine controlling tty if no file descriptor is open onto it? (System V r[23])
Every system needs one
terry at wsccs.UUCP
Sat May 28 15:53:36 AEST 1988
In article <2661 at ttrdc.UUCP> levy at ttrdc.UUCP (Daniel R. Levy) writes:
>I am trying to write a program UNDER SYSTEM V RELEASE 2 AND 3 which
>disassociates itself from the controlling terminal (using setpgrp() after
>redirecting all file descriptors still open onto the terminal, into a file),
>tries to exec() a machine binary or shell script, and if that doesn't work
>sends an error message to the terminal and exits.
>...
>However, I am having a problem with always getting an error message back to
>the terminal from which the command was issued.
Use ttyname() before leaving you program clueless. If you are redirecting
at a shell level, don't; use freopen() after using ttyname(). This will
leave your poor program clueless just as efficiently. Or use getpgrp()
before using setpgrp().
"exec()" a shell script? Try an execl() of 'sh -c script' instead, unless
your exec() is weird.
| Terry Lambert UUCP: ...{ decvax, ihnp4 } ...utah-cs!century!terry |
| @ Century Software OR: ...utah-cs!uplherc!sp7040!obie!wsccs!terry |
| SLC, Utah |
| These opinions are not my companies, but if you find them |
| useful, send a $20.00 donation to Brisbane Australia... |
| 'Admit it! You're just harrasing me because of the quote in my signature!' |
More information about the Comp.unix.wizards
mailing list