1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vlib: use new filename format

This commit is contained in:
lutherwenxu
2020-04-12 01:51:32 +08:00
committed by GitHub
parent e64db44bb5
commit dc4db87be3
45 changed files with 0 additions and 26 deletions

27
vlib/term/term_nix.c.v Normal file
View File

@ -0,0 +1,27 @@
module term
import os
#include <sys/ioctl.h>
#include <termios.h> // TIOCGWINSZ
pub struct C.winsize {
pub:
ws_row u16
ws_col u16
ws_xpixel u16
ws_ypixel u16
}
fn C.ioctl(fd int, request u64, arg voidptr) int
// get_terminal_size returns a number of colums and rows of terminal window.
pub fn get_terminal_size() (int,int) {
if is_atty(1) <= 0 || os.getenv('TERM') == 'dumb' {
return default_columns_size, default_rows_size
}
w := C.winsize{}
C.ioctl(1, C.TIOCGWINSZ, &w)
return int(w.ws_col),int(w.ws_row)
}