Some Programs, like passwd(1) or, as in our (wu-wien.ac.at) case, kas, the kerberos authentication system, require that they are run from a controlling terminal. They try to open /dev/tty for writing and will refuse to work if this is impossible.
The solution is quit simple: acquire a controlling terminal beforehand using openpty(3) or forkpty(3). On AIX the semantics is a little bit different, it uses /dev/ptc as a svr4 - style "cloning" device.
In Stevens book "Advanced Programming in the UNIX Environment" there is an example Program in Chapter 19, "Pseudo Terminals". This program does not work on AIX, because
-) it uses the SVR4 /dev/ptmx instead of /dev/ptc (AIX).
-) it tries to push "ptem" "ldterm" "ttcompat" STREAMS modules onto the tty stream in the slave program. This does not seem to be necessary/possible anymore. I commented these lines out.
patch the Directory using this patch:aix4_pty.patch. (It was created under FreeBSD with diff -urN)
In the directory where you see the directory "apue", issue
patch -p0 < aix4_pty.patch
$ cd lib.svr4/ $ make svr4 $ cd ../pty/ $ make pty
0 8 1 5 * pty -i myscript