int main(int argc, char **argv) {
int c;
struct file_with_size *root;
+ struct winsize win;
root = 0;
}
}
- if(isatty(STDOUT_FILENO)) {
- struct winsize win;
- if(ioctl (STDOUT_FILENO, TIOCGWINSZ, (char *) &win)) {
- fprintf(stderr, "Can not get the tty size: %s\n", strerror(errno));
- exit (EXIT_FAILURE);
- }
+ if(isatty(STDOUT_FILENO) &&
+ !ioctl (STDOUT_FILENO, TIOCGWINSZ, (char *) &win)) {
print_sorted(root, win.ws_col, win.ws_row - 2);
} else {
print_sorted(root, -1, -1);