A terminal for Lilbug

Andre Klärner kandre at ak-online.be
Wed Sep 18 01:55:01 CEST 2013

Hi Patrick,

On Mon 16.09.2013 21:58:15, Patrick Serru wrote:
> Le lundi 16 septembre 2013, vous avez écrit :
> > On Mon, Sep 16, 2013 at 06:52:16AM -0500, Patrick Serru <patrick at serru.net> wrote:
> >
> > Have you looked at the -pty-fd option? That will both do away with the
> > need to -e something, and it should work with urxvtc, too (but also urxvt
> > of course).
> Thank you for your response. I searched and searched. I found only two
> references in the two pages given by Google. All but one is the content
> of …/share/man/man7/urxvt.7, and the single other one was "Run a program
> under a pty session". What I understoud is that there are a lot of
> missunderstanding possible.
> Let me rephrase the question: I would like to know how to write in C a piece of code that:
> would open a graphical (separate) window running urxvt and then
> would open some bidirectional pipe to be able to
>  - write to the standard input of that just opened urxvt running graphical window and
>  - read from the standard output of that urxvt window.

That is exactly what the -pty-fd option is supposed to do. The
bidirectional pipe is in this case this file descriptor. The manpage has a
nice example in perl that illustrates how to use urxvt for pushing and
reading arbitrary stuff to a terminal window, it is only missing the part
where it thats another binary and connects it to this terminal.

As I needed a small challenge today I tried to grab some pieces of code and
implement this in C. I really have to admit: despite I disliked perl for
many years in cases like this one I really love it. 8 lines of perl versus
44 lines of C are pretty nice.

I attached the small program, you need to compile it using "gcc -lutil urxvt-pty-test.c".
Hopefully it won't burn your house, as this is my probably third program
that actually compiles and runs. If anyone want's to critise it: please do.

Regards, Andre

Andre Klärner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: urxvt-pty-test.c
Type: text/x-csrc
Size: 1097 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/rxvt-unicode/attachments/20130918/f823f8e1/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4043 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/rxvt-unicode/attachments/20130918/f823f8e1/attachment.bin>

More information about the rxvt-unicode mailing list