Browse thread
[Caml-list] calling telnet from a caml program
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Nicolas George <nicolas.george@e...> |
| Subject: | Re: [Caml-list] calling telnet from a caml program |
Le sextidi 16 brumaire, an CCXI, Andrei Errapart a écrit : > If it is possible in C, then it is possible in OCaml, too. Most > probably some termios(3) calls are needed, but not much more. It is More Complicated Than That(tm). On modern Unix, the steps to do that are: - master = open(/dev/ptmx) - grantpt(master) - unlockpt(master) - fork - setsid - slave = open(ptsname(master)) - ioctl(slave, I_PUSH, "ptem") - ioctl(slave, I_PUSH, "ldterm") - ioctl(slave, I_PUSH, "ttcompat") On BSD, this is more painful, since you must find among /dev/pty* someone that can be opened, and change ownership of the corresponding /dev/tty* (so you must be root). The only common step is the fork/setsid. There is nothing impossible, but there are horripilating portability problems here.