SCCS-vsn: bin/ls/ls.c 5.23
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ls.c 5.22 (Berkeley) %G%";
+static char sccsid[] = "@(#)ls.c 5.23 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
int qflg, Aflg, Cflg, Fflg, Lflg, Rflg, Sflg;
int qflg, Aflg, Cflg, Fflg, Lflg, Rflg, Sflg;
+int termwidth = 80; /* default terminal width */
+
/* flags */
int f_accesstime; /* use time of last access */
int f_group; /* show group ownership of a file */
/* flags */
int f_accesstime; /* use time of last access */
int f_group; /* show group ownership of a file */
if (isatty(1)) {
f_nonprint = 1;
(void)ioctl(1, TIOCGETP, &sgbuf);
if (isatty(1)) {
f_nonprint = 1;
(void)ioctl(1, TIOCGETP, &sgbuf);
- if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col)
- termwidth = (p = getenv("COLUMNS")) ? atoi(p) : 80;
+ if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) {
+ if (p = getenv("COLUMNS"))
+ termwidth = atoi(p);
+ }
else
termwidth = win.ws_col;
} else
else
termwidth = win.ws_col;
} else