From d59585c24f1a78dd66dd27bae9845729e60df24b Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 28 Dec 2006 17:20:41 +0000 Subject: Column fix when stdout is redirected. Default to 80. --- src/pacman/util.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/pacman/util.c') diff --git a/src/pacman/util.c b/src/pacman/util.c index c6841e16..6d395bb1 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -54,6 +54,12 @@ extern int neednl; /* gets the current screen column width */ int getcols() { + if(!isatty(1)) { + /* We will default to 80 columns if we're not a tty + * this seems a fairly standard file width. + */ + return 80; + } #ifdef TIOCGSIZE struct ttysize win; if(ioctl(1, TIOCGSIZE, &win) == 0) { -- cgit v1.2.3-24-g4f1b