tty?()
public
Returns true if ios is associated with a terminal device (tty),
false otherwise.
File.new("testfile").isatty
File.new("/dev/tty").isatty
Show source
/*
* call-seq:
* ios.isatty => true or false
* ios.tty? => true or false
*
* Returns <code>true</code> if <em>ios</em> is associated with a
* terminal device (tty), <code>false</code> otherwise.
*
* File.new("testfile").isatty
* File.new("/dev/tty").isatty
*/
static VALUE
rb_io_isatty(io)
VALUE io;
{
rb_io_t *fptr;
GetOpenFile(io, fptr);
if (isatty(fileno(fptr->f)) == 0)
return Qfalse;
return Qtrue;
}