-/* $OpenBSD: ls.c,v 1.46 2016/03/28 11:25:35 chl Exp $ */
+/* $OpenBSD: ls.c,v 1.47 2016/08/16 16:09:24 krw Exp $ */
/* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */
/*
FTSENT *cur;
NAMES *np;
off_t maxsize;
- u_long maxlen, maxnlink;
- unsigned long long btotal, maxblock;
+ nlink_t maxnlink;
+ unsigned long long btotal;
+ blkcnt_t maxblock;
ino_t maxinode;
- int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser;
+ int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser, maxlen;
int entries, needstats;
int width;
char *user, *group, buf[21]; /* 64 bits == 20 digits */
if (needstats) {
d.bcfile = bcfile;
d.btotal = btotal;
- (void)snprintf(buf, sizeof(buf), "%llu", maxblock);
+ (void)snprintf(buf, sizeof(buf), "%llu",
+ (unsigned long long)maxblock);
d.s_block = strlen(buf);
d.s_flags = maxflags;
d.s_group = maxgroup;
(void)snprintf(buf, sizeof(buf), "%llu",
(unsigned long long)maxinode);
d.s_inode = strlen(buf);
- (void)snprintf(buf, sizeof(buf), "%lu", maxnlink);
+ (void)snprintf(buf, sizeof(buf), "%lu",
+ (unsigned long)maxnlink);
d.s_nlink = strlen(buf);
if (!f_humanval) {
(void)snprintf(buf, sizeof(buf), "%lld",
-/* $OpenBSD: print.c,v 1.36 2016/08/15 16:57:53 krw Exp $ */
+/* $OpenBSD: print.c,v 1.37 2016/08/16 16:09:24 krw Exp $ */
/* $NetBSD: print.c,v 1.15 1996/12/11 03:25:39 thorpej Exp $ */
/*
#include "ls.h"
#include "extern.h"
-static int printaname(FTSENT *, u_long, u_long);
+static int printaname(FTSENT *, int, int);
static void printlink(FTSENT *);
static void printsize(int, off_t);
static void printtime(time_t);
-static int printtype(u_int);
+static int printtype(mode_t);
static int compute_columns(DISPLAY *, int *);
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT)
* return # of characters printed, no trailing characters.
*/
static int
-printaname(FTSENT *p, u_long inodefield, u_long sizefield)
+printaname(FTSENT *p, int inodefield, int sizefield)
{
struct stat *sp;
int chcnt;
sp = p->fts_statp;
chcnt = 0;
if (f_inode)
- chcnt += printf("%*llu ", (int)inodefield,
+ chcnt += printf("%*llu ", inodefield,
(unsigned long long)sp->st_ino);
if (f_size)
- chcnt += printf("%*lld ", (int)sizefield,
+ chcnt += printf("%*lld ", sizefield,
howmany((long long)sp->st_blocks, blocksize));
chcnt += mbsprint(p->fts_name, 1);
if (f_type || (f_typedir && S_ISDIR(sp->st_mode)))
}
static int
-printtype(u_int mode)
+printtype(mode_t mode)
{
switch (mode & S_IFMT) {
case S_IFDIR: