version 1.4, 2010/03/04 12:21:36 |
version 1.5, 2013/12/12 22:59:25 |
|
|
#include "sudo.h" |
#include "sudo.h" |
#include "lbuf.h" |
#include "lbuf.h" |
|
|
#if !defined(TIOCGSIZE) && defined(TIOCGWINSZ) |
#if !defined(TIOCGWINSZ) && defined(TIOCGSIZE) |
# define TIOCGSIZE TIOCGWINSZ |
# define TIOCGWINSZ TIOCGSIZE |
# define ttysize winsize |
# define winsize ttysize |
# define ts_cols ws_col |
# define ws_col ts_cols |
#endif |
#endif |
|
|
int |
int |
|
|
char *p; |
char *p; |
int cols; |
int cols; |
#ifdef TIOCGSIZE |
#ifdef TIOCGSIZE |
struct ttysize win; |
struct winsize win; |
|
|
if (ioctl(STDERR_FILENO, TIOCGSIZE, &win) == 0 && win.ts_cols != 0) |
if (ioctl(STDERR_FILENO, TIOCGWINSZ, &win) == 0 && win.ws_col != 0) |
return((int)win.ts_cols); |
return((int)win.ws_col); |
#endif |
#endif |
|
|
/* Fall back on $COLUMNS. */ |
/* Fall back on $COLUMNS. */ |