summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-12-28 17:20:41 +0000
committerAaron Griffin <aaron@archlinux.org>2006-12-28 17:20:41 +0000
commitd59585c24f1a78dd66dd27bae9845729e60df24b (patch)
tree72f22a3d2df81ee4832325c74fa721597ab2de23
parent23f0f778ef13291dba4320b3d1f9009a14dc2bb3 (diff)
downloadpacman-d59585c24f1a78dd66dd27bae9845729e60df24b.tar.xz
Column fix when stdout is redirected. Default to 80.
-rw-r--r--src/pacman/util.c6
1 files changed, 6 insertions, 0 deletions
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) {