From 1c324569538099af34419e6818fbfde4779efd33 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 6 Jan 2017 16:59:33 +0000 Subject: Use type-independent formats for printing nlink_t and ino_t. Extracted from: ino64 work by gleb, mckusick Discussed with: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week --- usr.sbin/fmtree/compare.c | 5 +++-- usr.sbin/fmtree/create.c | 3 ++- usr.sbin/fmtree/specspec.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/fmtree/compare.c b/usr.sbin/fmtree/compare.c index fdd37679c6ea..36d3f79d7090 100644 --- a/usr.sbin/fmtree/compare.c +++ b/usr.sbin/fmtree/compare.c @@ -165,8 +165,9 @@ typeerr: LABEL; if (s->flags & F_NLINK && s->type != F_DIR && s->st_nlink != p->fts_statp->st_nlink) { LABEL; - (void)printf("%slink_count expected %u found %u\n", - tab, s->st_nlink, p->fts_statp->st_nlink); + (void)printf("%slink_count expected %ju found %ju\n", + tab, (uintmax_t)s->st_nlink, + (uintmax_t)p->fts_statp->st_nlink); tab = "\t"; } if (s->flags & F_SIZE && s->st_size != p->fts_statp->st_size && diff --git a/usr.sbin/fmtree/create.c b/usr.sbin/fmtree/create.c index 8be9b02173ea..204f40abc15c 100644 --- a/usr.sbin/fmtree/create.c +++ b/usr.sbin/fmtree/create.c @@ -207,7 +207,8 @@ statf(int indent, FTSENT *p) if (keys & F_MODE && (p->fts_statp->st_mode & MBITS) != mode) output(indent, &offset, "mode=%#o", p->fts_statp->st_mode & MBITS); if (keys & F_NLINK && p->fts_statp->st_nlink != 1) - output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink); + output(indent, &offset, "nlink=%ju", + (uintmax_t)p->fts_statp->st_nlink); if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode)) output(indent, &offset, "size=%jd", (intmax_t)p->fts_statp->st_size); diff --git a/usr.sbin/fmtree/specspec.c b/usr.sbin/fmtree/specspec.c index f85882e0deef..ac70c2831a69 100644 --- a/usr.sbin/fmtree/specspec.c +++ b/usr.sbin/fmtree/specspec.c @@ -64,7 +64,7 @@ shownode(NODE *n, int f, char const *path) if (f & F_MODE) printf(" mode=%o", n->st_mode); if (f & F_NLINK) - printf(" nlink=%d", n->st_nlink); + printf(" nlink=%ju", (uintmax_t)n->st_nlink); if (f & F_SIZE) printf(" size=%jd", (intmax_t)n->st_size); if (f & F_UID) -- cgit v1.2.3