Sha256: e5144ff5a9d0eb08b01d8242cdf915678a9498a58d942cf1314d550a97aed57b

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

require 'termios'

def dump_termios(tio, banner)
  puts banner
  puts "  ispeed = #{Termios::BAUDS[tio.ispeed]}, ospeed = #{Termios::BAUDS[tio.ospeed]}"
  ["iflag", "oflag", "cflag", "lflag"].each do |x|
    flag = tio.send(x)
    flags = []
    eval("Termios::#{x.upcase}S").each do |f, sym|
      flags << sym.to_s if flag & f != 0
    end
    puts "   #{x} = #{flags.sort.join(' | ')}"
  end
  print "      cc ="
  cc = tio.cc
  cc.each_with_index do |x, idx|
    print " #{Termios::CCINDEX[idx]}=#{x}" if Termios::CCINDEX.include?(idx)
  end
  puts
end

tio = Termios::getattr($stdin)
dump_termios(tio, "STDIN:")
Termios::setattr($stdin, Termios::TCSANOW, tio)
dump_termios(tio, "STDIN:")

puts
puts " pid = #{$$}"
puts "pgrp = #{Termios::getpgrp($stdin)}"

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
arika-ruby-termios-0.9.5 test/test0.rb
arika-ruby-termios-0.9.6 test/test0.rb
ruby-termios-0.9.6 test/test0.rb
termios-0.9.4 test/test0.rb