caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nicolas George <nicolas.george@ens.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] calling telnet from a caml program
Date: Wed, 6 Nov 2002 18:39:14 +0100	[thread overview]
Message-ID: <20021106173914.GA2260@clipper.ens.fr> (raw)
In-Reply-To: <Pine.LNX.4.44.0211061910030.1661-100000@no.spam.ee>

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

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.

[-- Attachment #2: Type: application/pgp-signature, Size: 185 bytes --]

  reply	other threads:[~2002-11-06 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06 16:11 Alan Schmitt
2002-11-06 16:26 ` Andrei Errapart
2002-11-06 16:34   ` Alan Schmitt
2002-11-06 17:20     ` Andrei Errapart
2002-11-06 17:39       ` Nicolas George [this message]
2002-11-06 19:51         ` David Brown
2002-11-06 20:56       ` Gerd Stolpmann
2002-11-06 21:07 ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021106173914.GA2260@clipper.ens.fr \
    --to=nicolas.george@ens.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).