The following works with no modification at all to vte other than the
vte-0.11.11 modification to the vte-0.11.10 patch I did a couple of
weeks ago:
{
int amaster;
int aslave;
char name[64];
gboolean rc;
int frc;
openpty (&amaster, &aslave, name, NULL, NULL);
fprintf (stderr, "m = %d, s = %d, n = \"%s\"\n", amaster,
aslave, name);
rc = vte_terminal_set_pty(VTE_TERMINAL (terminal), amaster);
fprintf (stderr, "rc = %s\n", (TRUE == rc) ? "TRUE" : "FALSE");
frc = fcntl (amaster, F_GETFL);
fprintf (stderr, "master flags = %08o\n", frc);
frc = fcntl (aslave, F_GETFL);
fprintf (stderr, "slave flags = %08o\n", frc);
#define TSTRING "Does it work?\n"
write (amaster, TSTRING, strlen (TSTRING));
fsync (amaster);
}
returning
m = 4, s = 5, n = "/dev/pts/2"
rc = TRUE
and the test string shows up on the vte. (I haven't tried reading--I'll
just assume it works, haha.)
There are only two impediments to using this from Java:
* Adding vte_terminal_set_pty() to the libvte-java wrappers.
* Giving Java access to openpty().
My original thought was to incorporate the openpty() wrapper into the
vte wrapper patch, but, on second thought, that would be a bit of an
ad-hoc thing. My current thought is to have the openpty() wrapper go
somewhere else in frysk. Would that be possible?