Article View: es.comp.os.linux.programacion
Article #11665Re: pseudo-terminales programando
From: Roberto Diaz
Date: Mon, 15 Oct 2001 19:51
Date: Mon, 15 Oct 2001 19:51
71 lines
3456 bytes
3456 bytes
echale un vistazo a: /usr/include/pty.h
o info libc:
Opening a Pseudo-Terminal Pair
------------------------------
These functions, derived from BSD, are available in the separate
`libutil' library, and declared in `pty.h'.
- Function: int openpty (int *AMASTER, int *ASLAVE, char *NAME, struct
termios *TERMP, struct winsize *WINP)
This function allocates and opens a pseudo-terminal pair,
returning the file descriptor for the master in *AMASTER, and the
file descriptor for the slave in *ASLAVE. If the argument NAME is
not a null pointer, the file name of the slave pseudo-terminal
device is stored in `*name'. If TERMP is not a null pointer, the
terminal attributes of the slave are set to the ones specified in
the structure that TERMP points to (*note Terminal Modes::).
Likewise, if the WINP is not a null pointer, the screen size of
the slave is set to the values specified in the structure that
WINP points to.
O ejemplo de uso:
#include <pty.h>
#define PATH_MAX 255
static char linedata[PATH_MAX];
char *line = linedata;
static int ptyslavefd=-1;
int getpty(void) {
int masterfd;
if (openpty(&masterfd, &ptyslavefd, line, NULL, NULL)) {
return -1;
}
return masterfd;
}
una lista de programación C/C++ en sistemas GNU que esta bastante bien es
esta:
http://listas.hispalinux.es/mailman/listinfo/gnu-c
Y además en castellano..
> espero que alguien pueda ayudarme.Estoy programando con pseudo-terminales y no
> consigo que me funcione. He utilizado los programillas que aparecen en el libro
> Advanced Programming in the UNIX Environment para abrir el pty y el tty pero no
> he conseguido comunicar dos procesos a traves de ellos. Bueno si he conseguido
> escribir en el tty y leer lo escrito en el pty pero a la inversa no me ha
> funcionado. Espero que alguien pueda comentarme algo porque por mas que lo
> intentado no me funciona.
> Gracias.
>
---
Roberto Diaz <rdiazmartin@vivaldi.dhis.org>
..For a Brave GNU World..
Concerto Grosso Op. 3/8 A minor
Antonio Vivaldi (so... do you need beautiful words?)
-----
Technical Details
Message-ID:
<Pine.LNX.4.21.0110152144260.315-100000@corelli.local.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!97-mad2-x68.libre.retevision.ES!not-for-mailReferences:
<AfSg7WI0Num+@zipi.fi.upm.es>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f86c8,327e6d678ce09522 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2001-10-15 12:56:23 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!97-mad2-x68.libre.retevision.ES!not-for-mail From: Roberto Diaz <rdiazmartin@vivaldi.dhis.org> Newsgroups: es.comp.os.linux.programacion Subject: Re: pseudo-terminales programando Date: Mon, 15 Oct 2001 21:51:41 +0200 Lines: 73 Message-ID: <Pine.LNX.4.21.0110152144260.315-100000@corelli.local.net> References: <AfSg7WI0Num+@zipi.fi.upm.es> NNTP-Posting-Host: 97-mad2-x68.libre.retevision.es (62.83.167.97) Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: fu-berlin.de 1003175779 24647629 62.83.167.97 (16 [104356]) X-Orig-Path: corelli.local.net!rdiazmartin X-Sender: rdiazmartin@corelli.local.net In-Reply-To: <AfSg7WI0Num+@zipi.fi.upm.es>