From c59b1d9a2f8e2f78c175d073baea328952c3310a Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sun, 7 Mar 2010 11:47:44 +0100 Subject: [PATCH] Removed the error when the tty size can not be obtained and just ignore it. --- dus.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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); -- 2.20.1