Skip to content

Commit

Permalink
bin/ls: sync with NetBSD-8
Browse files Browse the repository at this point in the history
NetBSD PR 50997 David Binderman: fix format strings.

closes Stichting-MINIX-Research-Foundation#271

Change-Id: I27934ac0328b3f774f2adeada3ca6e0d62637821
  • Loading branch information
sevan authored and sambuc committed Nov 13, 2018
1 parent 92435d6 commit e8ccbb3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/ls/ls.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: ls.c,v 1.74 2014/04/02 10:55:47 wiz Exp $ */
/* $NetBSD: ls.c,v 1.76 2017/02/06 21:06:04 rin Exp $ */

/*
* Copyright (c) 1989, 1993, 1994
Expand Down Expand Up @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
__RCSID("$NetBSD: ls.c,v 1.74 2014/04/02 10:55:47 wiz Exp $");
__RCSID("$NetBSD: ls.c,v 1.76 2017/02/06 21:06:04 rin Exp $");
#endif
#endif /* not lint */

Expand Down Expand Up @@ -91,7 +91,7 @@ int f_columnacross; /* columnated format, sorted across */
int f_flags; /* show flags associated with a file */
int f_grouponly; /* long listing without owner */
int f_humanize; /* humanize the size field */
int f_commas; /* separate size field with comma */
int f_commas; /* separate size field with comma */
int f_inode; /* print inode */
int f_listdir; /* list actual directory, not contents */
int f_listdot; /* list files beginning with . */
Expand Down Expand Up @@ -631,7 +631,7 @@ display(FTSENT *p, FTSENT *list)
if (f_humanize) {
d.s_block = 4; /* min buf length for humanize_number */
} else {
(void)snprintf(buf, sizeof(buf), "%llu",
(void)snprintf(buf, sizeof(buf), "%lld",
(long long)howmany(maxblock, blocksize));
d.s_block = strlen(buf);
if (f_commas) /* allow for commas before every third digit */
Expand All @@ -647,17 +647,17 @@ display(FTSENT *p, FTSENT *list)
if (f_humanize) {
d.s_size = 4; /* min buf length for humanize_number */
} else {
(void)snprintf(buf, sizeof(buf), "%llu",
(void)snprintf(buf, sizeof(buf), "%lld",
(long long)maxsize);
d.s_size = strlen(buf);
if (f_commas) /* allow for commas before every third digit */
d.s_size += (d.s_size - 1) / 3;
}
d.s_user = maxuser;
if (bcfile) {
(void)snprintf(buf, sizeof(buf), "%u", maxmajor);
(void)snprintf(buf, sizeof(buf), "%d", maxmajor);
d.s_major = strlen(buf);
(void)snprintf(buf, sizeof(buf), "%u", maxminor);
(void)snprintf(buf, sizeof(buf), "%d", maxminor);
d.s_minor = strlen(buf);
if (d.s_major + d.s_minor + 2 > d.s_size)
d.s_size = d.s_major + d.s_minor + 2;
Expand Down

0 comments on commit e8ccbb3

Please sign in to comment.