Просмотр исходного кода

check if we are outputing to a tty

Wichert Akkerman лет назад: 26
Родитель
Сommit
55eb5c0faa
2 измененных файлов с 7 добавлено и 0 удалено
  1. 5 0
      ChangeLog
  2. 2 0
      main/enquiry.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Wed Aug 30 14:24:53 CEST 2000 Wichert Akkerman <wakkerma@debian.org>
+
+  * main/enquiry.c: modify listformatstring() to check if output is
+    being sent to a tty. If not and no COLUMNS is set use a width of 80
+
 Mon Aug 21 12:58:15 CEST 2000 Wichert Akkerman <wakkerma@debian.org>
 
   * lib/lock.c, main/filesdb.c, main/archives.c, main/configure.c,

+ 2 - 0
main/enquiry.c

@@ -73,6 +73,8 @@ static const char* listformatstring() {
 
   if ((columns=getenv("COLUMNS")) && ((res=atoi(columns))>0))
     ws.ws_col=res;
+  else if (!isatty(fd))
+    ws.ws_col=80;
   else {
     if ((fd=open("/dev/tty",O_RDONLY))!=-1) {
       if (ioctl(fd, TIOCGWINSZ, &ws)==-1)