More portable termsize detection

No longer depends on cgo, which broke cross compilation and
platforms that are not supported by cgo