[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Move terminal port procedures into chicken
From: |
Evan Hanson |
Subject: |
Re: [Chicken-hackers] [PATCH] Move terminal port procedures into chicken.port |
Date: |
Mon, 12 Feb 2018 09:34:48 +1300 |
Hi Peter,
> +#define C_C_fileno(p) C_fix(fileno(C_port_file(p)))
> +
> +#if !defined(__ANDROID__) && defined(TIOCGWINSZ)
> +static int get_tty_size(int p, int *rows, int *cols)
> +{
> + struct winsize tty_size;
> + int r;
> +
> + memset(&tty_size, 0, sizeof tty_size);
> +
> + r = ioctl(p, TIOCGWINSZ, &tty_size);
Don't we still need to include termios.h somewhere, for TIOCGWINSZ?
> + if (r == 0) {
> + *rows = tty_size.ws_row;
> + *cols = tty_size.ws_col;
> + }
> + return r;
> +}
> +#else
> +static int get_tty_size(int p, int *rows, int *cols)
> +{
> + *rows = *cols = 0;
> + return -1;
> +}
> +#endif
I think we should return ENOSYS here, too, rather than having
`terminal-size' return zeros. The function is effectively not
implemented on Windows, so let's indicate that with an exception.
Evan