Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ls Fix bug with previous change- always initialise d.s_b...
details: https://anonhg.NetBSD.org/src/rev/2687bc393193
branches: trunk
changeset: 556735:2687bc393193
user: simonb <simonb%NetBSD.org@localhost>
date: Fri Dec 26 10:51:25 2003 +0000
description:
Fix bug with previous change- always initialise d.s_block. Now "ls -1sh"
works.
XXX: ls -sh now always uses 4 chars for the size column width even if it
needs less than that.
diffstat:
bin/ls/ls.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r 7ff6c3612f5e -r 2687bc393193 bin/ls/ls.c
--- a/bin/ls/ls.c Fri Dec 26 10:47:32 2003 +0000
+++ b/bin/ls/ls.c Fri Dec 26 10:51:25 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ls.c,v 1.54 2003/12/26 10:47:32 simonb Exp $ */
+/* $NetBSD: ls.c,v 1.55 2003/12/26 10:51:25 simonb Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
-__RCSID("$NetBSD: ls.c,v 1.54 2003/12/26 10:47:32 simonb Exp $");
+__RCSID("$NetBSD: ls.c,v 1.55 2003/12/26 10:51:25 simonb Exp $");
#endif
#endif /* not lint */
@@ -584,7 +584,9 @@
if (needstats) {
d.btotal = btotal;
d.stotal = stotal;
- if (!f_humanize) {
+ if (f_humanize) {
+ d.s_block = 4; /* min buf length for humanize_number */
+ } else {
(void)snprintf(buf, sizeof(buf), "%llu",
(long long)howmany(maxblock, blocksize));
d.s_block = strlen(buf);
Home |
Main Index |
Thread Index |
Old Index