summaryrefslogtreecommitdiffstats
path: root/bin/ls/print.c
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2000-01-05 16:00:19 +0000
committerespie <espie@openbsd.org>2000-01-05 16:00:19 +0000
commit78803e9c1b66a26491a1ca009e1099ccd02c06db (patch)
tree87e8d66d809f714a636ca3ae4770134d11374316 /bin/ls/print.c
parentFactor column width computation out. (diff)
downloadwireguard-openbsd-78803e9c1b66a26491a1ca009e1099ccd02c06db.tar.xz
wireguard-openbsd-78803e9c1b66a26491a1ca009e1099ccd02c06db.zip
Perform colwidth computation sooner, as there's no need for random
access if we end up doing one column output.
Diffstat (limited to 'bin/ls/print.c')
-rw-r--r--bin/ls/print.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/ls/print.c b/bin/ls/print.c
index 37596ae48cc..ad9472eb8f6 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.12 2000/01/05 15:58:27 espie Exp $ */
+/* $OpenBSD: print.c,v 1.13 2000/01/05 16:00:19 espie Exp $ */
/* $NetBSD: print.c,v 1.15 1996/12/11 03:25:39 thorpej Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
#else
-static char rcsid[] = "$OpenBSD: print.c,v 1.12 2000/01/05 15:58:27 espie Exp $";
+static char rcsid[] = "$OpenBSD: print.c,v 1.13 2000/01/05 16:00:19 espie Exp $";
#endif
#endif /* not lint */
@@ -174,6 +174,9 @@ printcol(dp)
int base, chcnt, col, colwidth, num;
int numcols, numrows, row;
+ if ( (colwidth = compute_columns(dp, &numcols)) == 0)
+ return;
+
/*
* Have to do random access in the linked list -- build a table
* of pointers.
@@ -194,9 +197,6 @@ printcol(dp)
if (p->fts_number != NO_PRINT)
array[num++] = p;
- if ( (colwidth = compute_columns(dp, &numcols)) == 0)
- return;
-
numrows = num / numcols;
if (num % numcols)
++numrows;