diff --git a/src/exec_pty.c b/src/exec_pty.c index 106a00f52..2045feb43 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -74,7 +74,6 @@ # define TIOCGWINSZ TIOCGSIZE # define TIOCSWINSZ TIOCSSIZE # define winsize ttysize -# define ws_cols ts_col #endif struct io_buffer { diff --git a/src/sudo.h b/src/sudo.h index 3e1876ac3..ba4513994 100644 --- a/src/sudo.h +++ b/src/sudo.h @@ -189,7 +189,7 @@ extern int tgetpass_flags; int get_pty(int *master, int *slave, char *name, size_t namesz, uid_t uid); /* ttysize.c */ -void get_ttysize(int *linep, int *colp); +void get_ttysize(int *rowp, int *colp); /* sudo.c */ int exec_setup(struct command_details *details, const char *ptyname, int ptyfd); diff --git a/src/ttysize.c b/src/ttysize.c index 4060ab96d..81972d1ff 100644 --- a/src/ttysize.c +++ b/src/ttysize.c @@ -40,27 +40,28 @@ #if !defined(TIOCGWINSZ) && defined(TIOCGSIZE) # define TIOCGWINSZ TIOCGSIZE # define winsize ttysize -# define ws_cols ts_col +# define ws_col ts_cols +# define ws_row ts_lines #endif void -get_ttysize(int *linep, int *colp) +get_ttysize(int *rowp, int *colp) { char *p; #ifdef TIOCGWINSZ struct winsize wsize; if (ioctl(STDERR_FILENO, TIOCGWINSZ, &wsize) == 0 && - wsize.ws_lines != 0 && wsize.ws_cols != 0) { - *linep = wsize.ws_lines; - *colp = wsize.ws_cols; + wsize.ws_row != 0 && wsize.ws_col != 0) { + *rowp = wsize.ws_row; + *colp = wsize.ws_col; return; } #endif /* Fall back on $LINES and $COLUMNS. */ - if ((p = getenv("LINES")) == NULL || (*linep = atoi(p)) <= 0) - *linep = 24; + if ((p = getenv("LINES")) == NULL || (*rowp = atoi(p)) <= 0) + *rowp = 24; if ((p = getenv("COLUMNS")) == NULL || (*colp = atoi(p)) <= 0) *colp = 80; }