extract getWinsize() to support more platforms