summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorroot <root>2005-02-17 15:19:03 +0000
committerroot <root>2005-02-17 15:19:03 +0000
commite92b4a498418f31384803a66c5fbc885fbea9806 (patch)
tree2d4124d544c5ce421b8effb40c26ddfb9f4a20f4 /doc
parent0e07f831003ba4e0ee6810b33d43c161a3269b19 (diff)
*** empty log message ***
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/pty-fd22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/pty-fd b/doc/pty-fd
new file mode 100755
index 0000000..03661b8
--- /dev/null
+++ b/doc/pty-fd
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+# sample script to illustrate the -pty-fd option
+
+use IO::Pty;
+use Fcntl;
+
+my $pty = new IO::Pty;
+fcntl $pty, F_SETFD, 0; # clear close-on-exec
+
+system "rxvt -pty-fd " . (fileno $pty) . "&";
+close $pty;
+
+# now communicate with rxvt
+my $slave = $pty->slave;
+
+print $slave "hi! please enter something and press return (ctrl-d to exit):\n";
+
+while (<$slave>) {
+ print $slave "you entered: $_";
+}
+