From: Francois Fleuret Date: Sun, 7 Mar 2010 10:47:44 +0000 (+0100) Subject: Removed the error when the tty size can not be obtained and just ignore it. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=c59b1d9a2f8e2f78c175d073baea328952c3310a;p=dus.git Removed the error when the tty size can not be obtained and just ignore it. --- diff --git a/dus.c b/dus.c index 736b136..6e39dca 100644 --- a/dus.c +++ b/dus.c @@ -347,6 +347,7 @@ void print_help(FILE *out) { int main(int argc, char **argv) { int c; struct file_with_size *root; + struct winsize win; root = 0; @@ -420,12 +421,8 @@ int main(int argc, char **argv) { } } - 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);