summaryrefslogtreecommitdiff
path: root/bin/ls
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-04-02 07:31:07 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-04-02 07:31:07 +0000
commit42b06cf7f77eba05ed1882d71487488c8635829a (patch)
treebb7ade1b1fa9023a28f4aed76ede415f630e0b42 /bin/ls
parentf81092ed91ab510fe4d7469624b8b1f46739994e (diff)
Unbreak alignment of fields when using -lh.
ok deraadt@
Diffstat (limited to 'bin/ls')
-rw-r--r--bin/ls/ls.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 51098067b1d..397cf106fa1 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ls.c,v 1.21 2003/08/06 19:09:09 tedu Exp $ */
+/* $OpenBSD: ls.c,v 1.22 2004/04/02 07:31:06 otto Exp $ */
/* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */
/*
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
-static char rcsid[] = "$OpenBSD: ls.c,v 1.21 2003/08/06 19:09:09 tedu Exp $";
+static char rcsid[] = "$OpenBSD: ls.c,v 1.22 2004/04/02 07:31:06 otto Exp $";
#endif
#endif /* not lint */
@@ -61,6 +61,7 @@ static char rcsid[] = "$OpenBSD: ls.c,v 1.21 2003/08/06 19:09:09 tedu Exp $";
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <util.h>
#include "ls.h"
#include "extern.h"
@@ -539,8 +540,11 @@ display(FTSENT *p, FTSENT *list)
d.s_inode = strlen(buf);
(void)snprintf(buf, sizeof(buf), "%lu", maxnlink);
d.s_nlink = strlen(buf);
- (void)snprintf(buf, sizeof(buf), "%qu", maxsize);
- d.s_size = strlen(buf);
+ if (!f_humanval) {
+ (void)snprintf(buf, sizeof(buf), "%qu", maxsize);
+ d.s_size = strlen(buf);
+ } else
+ d.s_size = FMT_SCALED_STRSIZE-2; /* no - or '\0' */
d.s_user = maxuser;
}