lobase

Linux port of OpenBSDs userland.
Log | Files | Refs | README

commit 70bd1aeb9486a320cab9eb788f1a793ef778c778
parent aca73fa44eb103e1384d898d1ca720ebc1ec1048
Author: Duncaen <mail@duncano.de>
Date:   Wed, 24 May 2017 03:02:58 +0200

bin/ls: update to OPENBSD_6_1

Diffstat:
bin/ls/ls.c | 19+++++++++++--------
bin/ls/print.c | 36++++++++++++++++++------------------
2 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/bin/ls/ls.c b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.46 2016/03/28 11:25:35 chl Exp $ */ +/* $OpenBSD: ls.c,v 1.48 2016/08/16 16:13:32 krw Exp $ */ /* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */ /* @@ -47,9 +47,9 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <util.h> #include <limits.h> #include <locale.h> +#include <util.h> #include "ls.h" #include "extern.h" @@ -428,10 +428,11 @@ display(FTSENT *p, FTSENT *list) 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 */ @@ -539,7 +540,7 @@ display(FTSENT *p, FTSENT *list) #if 0 if (f_flags) { np->flags = &np->data[ulen + 1 + glen + 1]; - (void)strlcpy(np->flags, flags, flen + 1); + (void)strlcpy(np->flags, flags, flen + 1); if (*flags != '-') free(flags); } @@ -559,14 +560,16 @@ display(FTSENT *p, FTSENT *list) 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", diff --git a/bin/ls/print.c b/bin/ls/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.35 2015/12/01 18:36:13 schwarze 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 $ */ /* @@ -35,7 +35,6 @@ #include <sys/types.h> #include <sys/stat.h> -#include <sys/param.h> #include <err.h> #include <errno.h> @@ -47,17 +46,17 @@ #include <string.h> #include <time.h> #include <unistd.h> -#include <util.h> #include <limits.h> +#include <util.h> #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(size_t, off_t); +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) @@ -99,8 +98,8 @@ printlong(DISPLAY *dp) (void)printf("%*llu ", dp->s_inode, (unsigned long long)sp->st_ino); if (f_size) - (void)printf("%*qd ", - dp->s_block, howmany(sp->st_blocks, blocksize)); + (void)printf("%*lld ", dp->s_block, + howmany((long long)sp->st_blocks, blocksize)); (void)strmode(sp->st_mode, buf); np = p->fts_pointer; (void)printf("%s %*u ", buf, dp->s_nlink, sp->st_nlink); @@ -115,8 +114,9 @@ printlong(DISPLAY *dp) (void)printf("%3d, %3d ", major(sp->st_rdev), minor(sp->st_rdev)); else if (dp->bcfile) - (void)printf("%*s%*qd ", - 8 - dp->s_size, "", dp->s_size, sp->st_size); + (void)printf("%*s%*lld ", + 8 - dp->s_size, "", dp->s_size, + (long long)sp->st_size); else printsize(dp->s_size, sp->st_size); if (f_accesstime) @@ -221,7 +221,7 @@ printcol(DISPLAY *dp) * 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; @@ -229,11 +229,11 @@ printaname(FTSENT *p, u_long inodefield, u_long sizefield) 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("%*qd ", - (int)sizefield, howmany(sp->st_blocks, blocksize)); + 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))) chcnt += printtype(sp->st_mode); @@ -325,7 +325,7 @@ printstream(DISPLAY *dp) } static int -printtype(u_int mode) +printtype(mode_t mode) { switch (mode & S_IFMT) { case S_IFDIR: @@ -369,13 +369,13 @@ printlink(FTSENT *p) } static void -printsize(size_t width, off_t bytes) +printsize(int width, off_t bytes) { char ret[FMT_SCALED_STRSIZE]; if ((f_humanval) && (fmt_scaled(bytes, ret) != -1)) { - (void)printf("%*s ", (u_int)width, ret); + (void)printf("%*s ", width, ret); return; } - (void)printf("%*qd ", (u_int)width, bytes); + (void)printf("%*lld ", width, (long long)bytes); }