mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/pty/extconf.rb: check util.h for OpenBSD.
* ext/pty/pty.c: include util.h if available. fix variable name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
67d18f7ff7
commit
8ae0a40d02
3 changed files with 26 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Wed Dec 17 19:37:30 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/pty/extconf.rb: check util.h for OpenBSD.
|
||||||
|
|
||||||
|
* ext/pty/pty.c: include util.h if available. fix variable name.
|
||||||
|
|
||||||
Wed Dec 17 19:23:28 2008 Keiju Ishitsuka <keiju@ruby-lang.org>
|
Wed Dec 17 19:23:28 2008 Keiju Ishitsuka <keiju@ruby-lang.org>
|
||||||
|
|
||||||
* lib/matrix.rb: shut up warning. [ruby-dev:37481] [Bug #899]
|
* lib/matrix.rb: shut up warning. [ruby-dev:37481] [Bug #899]
|
||||||
|
|
|
@ -4,6 +4,7 @@ if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
|
||||||
have_header("sys/stropts.h")
|
have_header("sys/stropts.h")
|
||||||
have_func("setresuid")
|
have_func("setresuid")
|
||||||
have_header("libutil.h")
|
have_header("libutil.h")
|
||||||
|
have_header("util.h") # OpenBSD openpty
|
||||||
have_header("pty.h")
|
have_header("pty.h")
|
||||||
have_library("util", "openpty")
|
have_library("util", "openpty")
|
||||||
if have_func("posix_openpt") or
|
if have_func("posix_openpt") or
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
#ifdef HAVE_LIBUTIL_H
|
#ifdef HAVE_LIBUTIL_H
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_UTIL_H
|
||||||
|
#include <util.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_PTY_H
|
#ifdef HAVE_PTY_H
|
||||||
#include <pty.h>
|
#include <pty.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -330,7 +333,7 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
|
||||||
if (!fail) return -1;
|
if (!fail) return -1;
|
||||||
rb_raise(rb_eRuntimeError, "openpty() failed");
|
rb_raise(rb_eRuntimeError, "openpty() failed");
|
||||||
}
|
}
|
||||||
if (no_mesg(slavedevice, nomesg) == -1) {
|
if (no_mesg(SlaveName, nomesg) == -1) {
|
||||||
if (!fail) return -1;
|
if (!fail) return -1;
|
||||||
rb_raise(rb_eRuntimeError, "can't chmod slave pty");
|
rb_raise(rb_eRuntimeError, "can't chmod slave pty");
|
||||||
}
|
}
|
||||||
|
@ -448,6 +451,21 @@ pty_close_pty(VALUE assoc)
|
||||||
* master_io and slave_file is closed when return if they are not closed.
|
* master_io and slave_file is closed when return if they are not closed.
|
||||||
*
|
*
|
||||||
* The filename of the slave is slave_file.path.
|
* The filename of the slave is slave_file.path.
|
||||||
|
*
|
||||||
|
* # make cut's stdout line buffered.
|
||||||
|
* # if IO.pipe is used instead of PTY.open,
|
||||||
|
* # this deadlocks because cut's stdout will be fully buffered.
|
||||||
|
* m, s = PTY.open
|
||||||
|
* system("stty raw", :in=>s) # disable newline conversion.
|
||||||
|
* r, w = IO.pipe
|
||||||
|
* pid = spawn("cut -c 3-8", :in=>r, :out=>s)
|
||||||
|
* r.close
|
||||||
|
* s.close
|
||||||
|
* w.puts "foo bar baz" #=> "o bar \n"
|
||||||
|
* p m.gets
|
||||||
|
* w.puts "hoge fuga moge" #=> "ge fug\n"
|
||||||
|
* p m.gets
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
pty_open(VALUE klass)
|
pty_open(VALUE klass)
|
||||||
|
|
Loading…
Add table
Reference in a new issue