Module Name: src
Committed By: jschauma
Date: Wed Nov 6 16:40:58 UTC 2024
Modified Files:
src/bin/ls: print.c
Log Message:
In multi-column output, print the 'total' line even if we ended up
using only a single column (e.g., COLUMNS is small or the filenames
are long).
To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/bin/ls/print.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/ls/print.c
diff -u src/bin/ls/print.c:1.57 src/bin/ls/print.c:1.58
--- src/bin/ls/print.c:1.57 Sun May 17 23:34:11 2020
+++ src/bin/ls/print.c Wed Nov 6 16:40:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.57 2020/05/17 23:34:11 christos Exp $ */
+/* $NetBSD: print.c,v 1.58 2024/11/06 16:40:58 jschauma Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
#else
-__RCSID("$NetBSD: print.c,v 1.57 2020/05/17 23:34:11 christos Exp $");
+__RCSID("$NetBSD: print.c,v 1.58 2024/11/06 16:40:58 jschauma Exp $");
#endif
#endif /* not lint */
@@ -231,6 +231,8 @@ printcol(DISPLAY *dp)
colwidth += 1;
+ printtotal(dp); /* "total: %u\n" */
+
if (termwidth < 2 * colwidth) {
printscol(dp);
return;
@@ -262,8 +264,6 @@ printcol(DISPLAY *dp)
if (num % numcols)
++numrows;
- printtotal(dp); /* "total: %u\n" */
-
for (row = 0; row < numrows; ++row) {
for (base = row, chcnt = col = 0; col < numcols; ++col) {
chcnt = printaname(array[base], dp->s_inode,
@@ -298,6 +298,8 @@ printacol(DISPLAY *dp)
colwidth += 1;
+ printtotal(dp); /* "total: %u\n" */
+
if (termwidth < 2 * colwidth) {
printscol(dp);
return;
@@ -306,8 +308,6 @@ printacol(DISPLAY *dp)
numcols = termwidth / colwidth;
colwidth = termwidth / numcols; /* spread out if possible */
- printtotal(dp); /* "total: %u\n" */
-
chcnt = col = 0;
for (p = dp->list; p; p = p->fts_link) {
if (IS_NOPRINT(p))