From 40ea7af4ba28cbd4a1677b9fc04f5bea3718dd9a Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 30 Mar 2019 13:27:21 -0400 Subject: [PATCH] coreutils: Remove old recipes. --- sys-apps/coreutils/coreutils-8.22.recipe | 271 -- sys-apps/coreutils/coreutils-8.23.recipe | 271 -- .../patches/coreutils-8.22.gcc2.patchset | 3032 ---------------- .../coreutils/patches/coreutils-8.22.patchset | 256 -- .../patches/coreutils-8.23.gcc2.patchset | 3202 ----------------- .../coreutils/patches/coreutils-8.23.patchset | 182 - .../patches/import-Haiku-changes.patch | 453 --- 7 files changed, 7667 deletions(-) delete mode 100644 sys-apps/coreutils/coreutils-8.22.recipe delete mode 100644 sys-apps/coreutils/coreutils-8.23.recipe delete mode 100644 sys-apps/coreutils/patches/coreutils-8.22.gcc2.patchset delete mode 100644 sys-apps/coreutils/patches/coreutils-8.22.patchset delete mode 100644 sys-apps/coreutils/patches/coreutils-8.23.gcc2.patchset delete mode 100644 sys-apps/coreutils/patches/coreutils-8.23.patchset delete mode 100644 sys-apps/coreutils/patches/import-Haiku-changes.patch diff --git a/sys-apps/coreutils/coreutils-8.22.recipe b/sys-apps/coreutils/coreutils-8.22.recipe deleted file mode 100644 index 03f50373b..000000000 --- a/sys-apps/coreutils/coreutils-8.22.recipe +++ /dev/null @@ -1,271 +0,0 @@ -SUMMARY="Standard GNU core utilities" -DESCRIPTION=" -Most of these programs have significant advantages over their Unix \ -counterparts, such as greater speed, additional options, and fewer \ -arbitrary limits. - -The programs that can be built with this package are: - - [ arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp \ -csplit cut date dd df dir dircolors dirname du echo env expand expr \ -factor false fmt fold groups head hostid hostname id install join kill \ -link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup \ -nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink \ -realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum \ -shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test \ -timeout touch tr true truncate tsort tty uname unexpand uniq unlink \ -uptime users vdir wc who whoami yes -" -HOMEPAGE="http://www.gnu.org/software/coreutils" -COPYRIGHT="1994-2013 Free Software Foundation, Inc." -LICENSE="GNU GPL v3" -REVISION="2" -SOURCE_URI="http://ftp.gnu.org/gnu/coreutils/coreutils-$portVersion.tar.xz" -CHECKSUM_SHA256="5b3e94998152c017e6c75d56b9b994188eb71bf46d4038a642cb9141f6ff1212" -PATCHES=" - coreutils-$portVersion.patchset - import-Haiku-changes.patch - " -if [ $effectiveTargetArchitecture = x86_gcc2 ]; then - PATCHES+=" - coreutils-$portVersion.gcc2.patchset - " -fi - -ARCHITECTURES="x86_gcc2 x86 x86_64 arm" - -PROVIDES=" - coreutils = $portVersion compat >= 8 - cmd:[ = $portVersion compat >= 8 - cmd:base64 = $portVersion compat >= 8 - cmd:basename = $portVersion compat >= 8 - cmd:cat = $portVersion compat >= 8 - cmd:chcon = $portVersion compat >= 8 - cmd:chgrp = $portVersion compat >= 8 - cmd:chmod = $portVersion compat >= 8 - cmd:chown = $portVersion compat >= 8 - cmd:chroot = $portVersion compat >= 8 - cmd:cksum = $portVersion compat >= 8 - cmd:comm = $portVersion compat >= 8 - cmd:cp = $portVersion compat >= 8 - cmd:csplit = $portVersion compat >= 8 - cmd:cut = $portVersion compat >= 8 - cmd:date = $portVersion compat >= 8 - cmd:dd = $portVersion compat >= 8 - cmd:dir = $portVersion compat >= 8 - cmd:dircolors = $portVersion compat >= 8 - cmd:dirname = $portVersion compat >= 8 - cmd:du = $portVersion compat >= 8 - cmd:echo = $portVersion compat >= 8 - cmd:env = $portVersion compat >= 8 - cmd:expand = $portVersion compat >= 8 - cmd:expr = $portVersion compat >= 8 - cmd:factor = $portVersion compat >= 8 - cmd:false = $portVersion compat >= 8 - cmd:fmt = $portVersion compat >= 8 - cmd:fold = $portVersion compat >= 8 - cmd:groups = $portVersion compat >= 8 - cmd:head = $portVersion compat >= 8 - cmd:hostname = $portVersion compat >= 8 - cmd:id = $portVersion compat >= 8 - cmd:install = $portVersion compat >= 8 - cmd:join = $portVersion compat >= 8 - cmd:kill = $portVersion compat >= 8 - cmd:link = $portVersion compat >= 8 - cmd:ln = $portVersion compat >= 8 - cmd:logname = $portVersion compat >= 8 - cmd:ls = $portVersion compat >= 8 - cmd:md5sum = $portVersion compat >= 8 - cmd:mkdir = $portVersion compat >= 8 - cmd:mkfifo = $portVersion compat >= 8 - cmd:mknod = $portVersion compat >= 8 - cmd:mktemp = $portVersion compat >= 8 - cmd:mv = $portVersion compat >= 8 - cmd:nl = $portVersion compat >= 8 - cmd:nohup = $portVersion compat >= 8 - cmd:nproc = $portVersion compat >= 8 - cmd:numfmt = $portVersion compat >= 8 - cmd:od = $portVersion compat >= 8 - cmd:paste = $portVersion compat >= 8 - cmd:pathchk = $portVersion compat >= 8 - cmd:pr = $portVersion compat >= 8 - cmd:printenv = $portVersion compat >= 8 - cmd:printf = $portVersion compat >= 8 - cmd:ptx = $portVersion compat >= 8 - cmd:pwd = $portVersion compat >= 8 - cmd:readlink = $portVersion compat >= 8 - cmd:realpath = $portVersion compat >= 8 - cmd:rm = $portVersion compat >= 8 - cmd:rmdir = $portVersion compat >= 8 - cmd:runcon = $portVersion compat >= 8 - cmd:seq = $portVersion compat >= 8 - cmd:sha1sum = $portVersion compat >= 8 - cmd:sha224sum = $portVersion compat >= 8 - cmd:sha256sum = $portVersion compat >= 8 - cmd:sha384sum = $portVersion compat >= 8 - cmd:sha512sum = $portVersion compat >= 8 - cmd:shred = $portVersion compat >= 8 - cmd:shuf = $portVersion compat >= 8 - cmd:sleep = $portVersion compat >= 8 - cmd:sort = $portVersion compat >= 8 - cmd:split = $portVersion compat >= 8 - cmd:stat = $portVersion compat >= 8 - cmd:stdbuf = $portVersion compat >= 8 - cmd:stty = $portVersion compat >= 8 - cmd:sum = $portVersion compat >= 8 - cmd:sync = $portVersion compat >= 8 - cmd:tac = $portVersion compat >= 8 - cmd:tail = $portVersion compat >= 8 - cmd:tee = $portVersion compat >= 8 - cmd:test = $portVersion compat >= 8 - cmd:timeout = $portVersion compat >= 8 - cmd:touch = $portVersion compat >= 8 - cmd:tr = $portVersion compat >= 8 - cmd:true = $portVersion compat >= 8 - cmd:truncate = $portVersion compat >= 8 - cmd:tsort = $portVersion compat >= 8 - cmd:tty = $portVersion compat >= 8 - cmd:uname = $portVersion compat >= 8 - cmd:unexpand = $portVersion compat >= 8 - cmd:uniq = $portVersion compat >= 8 - cmd:unlink = $portVersion compat >= 8 - cmd:vdir = $portVersion compat >= 8 - cmd:wc = $portVersion compat >= 8 - cmd:whoami = $portVersion compat >= 8 - cmd:yes = $portVersion compat >= 8 - " -REQUIRES=" - haiku - " - -BUILD_PREREQUIRES=" - haiku_devel - cmd:awk - cmd:gcc - cmd:grep - cmd:help2man - cmd:ld - cmd:make - cmd:makeinfo - cmd:sed - " - -defineDebugInfoPackage coreutils \ - $binDir/[ \ - $binDir/base64 \ - $binDir/basename \ - $binDir/cat \ - $binDir/chcon \ - $binDir/chgrp \ - $binDir/chmod \ - $binDir/chown \ - $binDir/chroot \ - $binDir/cksum \ - $binDir/comm \ - $binDir/cp \ - $binDir/csplit \ - $binDir/cut \ - $binDir/date \ - $binDir/dd \ - $binDir/dir \ - $binDir/dircolors \ - $binDir/dirname \ - $binDir/du \ - $binDir/echo \ - $binDir/env \ - $binDir/expand \ - $binDir/expr \ - $binDir/factor \ - $binDir/false \ - $binDir/fmt \ - $binDir/fold \ - $binDir/groups \ - $binDir/head \ - $binDir/hostname \ - $binDir/id \ - $binDir/install \ - $binDir/join \ - $binDir/kill \ - $binDir/link \ - $binDir/ln \ - $binDir/logname \ - $binDir/ls \ - $binDir/md5sum \ - $binDir/mkdir \ - $binDir/mkfifo \ - $binDir/mknod \ - $binDir/mktemp \ - $binDir/mv \ - $binDir/nl \ - $binDir/nohup \ - $binDir/nproc \ - $binDir/numfmt \ - $binDir/od \ - $binDir/paste \ - $binDir/pathchk \ - $binDir/pr \ - $binDir/printenv \ - $binDir/printf \ - $binDir/ptx \ - $binDir/pwd \ - $binDir/readlink \ - $binDir/realpath \ - $binDir/rm \ - $binDir/rmdir \ - $binDir/runcon \ - $binDir/seq \ - $binDir/sha1sum \ - $binDir/sha224sum \ - $binDir/sha256sum \ - $binDir/sha384sum \ - $binDir/sha512sum \ - $binDir/shred \ - $binDir/shuf \ - $binDir/sleep \ - $binDir/sort \ - $binDir/split \ - $binDir/stat \ - $binDir/stdbuf \ - $binDir/stty \ - $binDir/sum \ - $binDir/sync \ - $binDir/tac \ - $binDir/tail \ - $binDir/tee \ - $binDir/test \ - $binDir/timeout \ - $binDir/touch \ - $binDir/tr \ - $binDir/true \ - $binDir/truncate \ - $binDir/tsort \ - $binDir/tty \ - $binDir/uname \ - $binDir/unexpand \ - $binDir/uniq \ - $binDir/unlink \ - $binDir/vdir \ - $binDir/wc \ - $binDir/whoami \ - $binDir/yes - -PATCH() -{ - sed -i -e 's|O_NOCACHE|DD_NOCACHE|g' src/dd.c -} - -BUILD() -{ - FORCE_UNSAFE_CONFIGURE=1 runConfigure ./configure \ - --without-included-regex \ - --disable-rpath --with-gnu-ld \ - --enable-no-install-program=df,uptime \ - --enable-install-program=hostname - touch doc/*.info - make $jobArgs -} - -INSTALL() -{ - make install -} diff --git a/sys-apps/coreutils/coreutils-8.23.recipe b/sys-apps/coreutils/coreutils-8.23.recipe deleted file mode 100644 index 6fb52bc5d..000000000 --- a/sys-apps/coreutils/coreutils-8.23.recipe +++ /dev/null @@ -1,271 +0,0 @@ -SUMMARY="Standard GNU core utilities" -DESCRIPTION=" -Most of these programs have significant advantages over their Unix \ -counterparts, such as greater speed, additional options, and fewer \ -arbitrary limits. - -The programs that can be built with this package are: - - [ arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp \ -csplit cut date dd df dir dircolors dirname du echo env expand expr \ -factor false fmt fold groups head hostid hostname id install join kill \ -link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup \ -nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink \ -realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum \ -shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test \ -timeout touch tr true truncate tsort tty uname unexpand uniq unlink \ -uptime users vdir wc who whoami yes -" -HOMEPAGE="http://www.gnu.org/software/coreutils" -COPYRIGHT="1994-2013 Free Software Foundation, Inc." -LICENSE="GNU GPL v3" -REVISION="1" -SOURCE_URI="http://ftp.gnu.org/gnu/coreutils/coreutils-$portVersion.tar.xz" -CHECKSUM_SHA256="ec43ca5bcfc62242accb46b7f121f6b684ee21ecd7d075059bf650ff9e37b82d" -PATCHES=" - coreutils-$portVersion.patchset - import-Haiku-changes.patch - " -if [ $effectiveTargetArchitecture = x86_gcc2 ]; then - PATCHES+=" - coreutils-$portVersion.gcc2.patchset - " -fi - -ARCHITECTURES="x86_gcc2 x86 x86_64 arm" - -PROVIDES=" - coreutils = $portVersion compat >= 8 - cmd:[ = $portVersion compat >= 8 - cmd:base64 = $portVersion compat >= 8 - cmd:basename = $portVersion compat >= 8 - cmd:cat = $portVersion compat >= 8 - cmd:chcon = $portVersion compat >= 8 - cmd:chgrp = $portVersion compat >= 8 - cmd:chmod = $portVersion compat >= 8 - cmd:chown = $portVersion compat >= 8 - cmd:chroot = $portVersion compat >= 8 - cmd:cksum = $portVersion compat >= 8 - cmd:comm = $portVersion compat >= 8 - cmd:cp = $portVersion compat >= 8 - cmd:csplit = $portVersion compat >= 8 - cmd:cut = $portVersion compat >= 8 - cmd:date = $portVersion compat >= 8 - cmd:dd = $portVersion compat >= 8 - cmd:dir = $portVersion compat >= 8 - cmd:dircolors = $portVersion compat >= 8 - cmd:dirname = $portVersion compat >= 8 - cmd:du = $portVersion compat >= 8 - cmd:echo = $portVersion compat >= 8 - cmd:env = $portVersion compat >= 8 - cmd:expand = $portVersion compat >= 8 - cmd:expr = $portVersion compat >= 8 - cmd:factor = $portVersion compat >= 8 - cmd:false = $portVersion compat >= 8 - cmd:fmt = $portVersion compat >= 8 - cmd:fold = $portVersion compat >= 8 - cmd:groups = $portVersion compat >= 8 - cmd:head = $portVersion compat >= 8 - cmd:hostname = $portVersion compat >= 8 - cmd:id = $portVersion compat >= 8 - cmd:install = $portVersion compat >= 8 - cmd:join = $portVersion compat >= 8 - cmd:kill = $portVersion compat >= 8 - cmd:link = $portVersion compat >= 8 - cmd:ln = $portVersion compat >= 8 - cmd:logname = $portVersion compat >= 8 - cmd:ls = $portVersion compat >= 8 - cmd:md5sum = $portVersion compat >= 8 - cmd:mkdir = $portVersion compat >= 8 - cmd:mkfifo = $portVersion compat >= 8 - cmd:mknod = $portVersion compat >= 8 - cmd:mktemp = $portVersion compat >= 8 - cmd:mv = $portVersion compat >= 8 - cmd:nl = $portVersion compat >= 8 - cmd:nohup = $portVersion compat >= 8 - cmd:nproc = $portVersion compat >= 8 - cmd:numfmt = $portVersion compat >= 8 - cmd:od = $portVersion compat >= 8 - cmd:paste = $portVersion compat >= 8 - cmd:pathchk = $portVersion compat >= 8 - cmd:pr = $portVersion compat >= 8 - cmd:printenv = $portVersion compat >= 8 - cmd:printf = $portVersion compat >= 8 - cmd:ptx = $portVersion compat >= 8 - cmd:pwd = $portVersion compat >= 8 - cmd:readlink = $portVersion compat >= 8 - cmd:realpath = $portVersion compat >= 8 - cmd:rm = $portVersion compat >= 8 - cmd:rmdir = $portVersion compat >= 8 - cmd:runcon = $portVersion compat >= 8 - cmd:seq = $portVersion compat >= 8 - cmd:sha1sum = $portVersion compat >= 8 - cmd:sha224sum = $portVersion compat >= 8 - cmd:sha256sum = $portVersion compat >= 8 - cmd:sha384sum = $portVersion compat >= 8 - cmd:sha512sum = $portVersion compat >= 8 - cmd:shred = $portVersion compat >= 8 - cmd:shuf = $portVersion compat >= 8 - cmd:sleep = $portVersion compat >= 8 - cmd:sort = $portVersion compat >= 8 - cmd:split = $portVersion compat >= 8 - cmd:stat = $portVersion compat >= 8 - cmd:stdbuf = $portVersion compat >= 8 - cmd:stty = $portVersion compat >= 8 - cmd:sum = $portVersion compat >= 8 - cmd:sync = $portVersion compat >= 8 - cmd:tac = $portVersion compat >= 8 - cmd:tail = $portVersion compat >= 8 - cmd:tee = $portVersion compat >= 8 - cmd:test = $portVersion compat >= 8 - cmd:timeout = $portVersion compat >= 8 - cmd:touch = $portVersion compat >= 8 - cmd:tr = $portVersion compat >= 8 - cmd:true = $portVersion compat >= 8 - cmd:truncate = $portVersion compat >= 8 - cmd:tsort = $portVersion compat >= 8 - cmd:tty = $portVersion compat >= 8 - cmd:uname = $portVersion compat >= 8 - cmd:unexpand = $portVersion compat >= 8 - cmd:uniq = $portVersion compat >= 8 - cmd:unlink = $portVersion compat >= 8 - cmd:vdir = $portVersion compat >= 8 - cmd:wc = $portVersion compat >= 8 - cmd:whoami = $portVersion compat >= 8 - cmd:yes = $portVersion compat >= 8 - " -REQUIRES=" - haiku - " - -BUILD_PREREQUIRES=" - haiku_devel - cmd:awk - cmd:gcc - cmd:grep - cmd:help2man - cmd:ld - cmd:make - cmd:makeinfo - cmd:sed - " - -defineDebugInfoPackage coreutils \ - $binDir/[ \ - $binDir/base64 \ - $binDir/basename \ - $binDir/cat \ - $binDir/chcon \ - $binDir/chgrp \ - $binDir/chmod \ - $binDir/chown \ - $binDir/chroot \ - $binDir/cksum \ - $binDir/comm \ - $binDir/cp \ - $binDir/csplit \ - $binDir/cut \ - $binDir/date \ - $binDir/dd \ - $binDir/dir \ - $binDir/dircolors \ - $binDir/dirname \ - $binDir/du \ - $binDir/echo \ - $binDir/env \ - $binDir/expand \ - $binDir/expr \ - $binDir/factor \ - $binDir/false \ - $binDir/fmt \ - $binDir/fold \ - $binDir/groups \ - $binDir/head \ - $binDir/hostname \ - $binDir/id \ - $binDir/install \ - $binDir/join \ - $binDir/kill \ - $binDir/link \ - $binDir/ln \ - $binDir/logname \ - $binDir/ls \ - $binDir/md5sum \ - $binDir/mkdir \ - $binDir/mkfifo \ - $binDir/mknod \ - $binDir/mktemp \ - $binDir/mv \ - $binDir/nl \ - $binDir/nohup \ - $binDir/nproc \ - $binDir/numfmt \ - $binDir/od \ - $binDir/paste \ - $binDir/pathchk \ - $binDir/pr \ - $binDir/printenv \ - $binDir/printf \ - $binDir/ptx \ - $binDir/pwd \ - $binDir/readlink \ - $binDir/realpath \ - $binDir/rm \ - $binDir/rmdir \ - $binDir/runcon \ - $binDir/seq \ - $binDir/sha1sum \ - $binDir/sha224sum \ - $binDir/sha256sum \ - $binDir/sha384sum \ - $binDir/sha512sum \ - $binDir/shred \ - $binDir/shuf \ - $binDir/sleep \ - $binDir/sort \ - $binDir/split \ - $binDir/stat \ - $binDir/stdbuf \ - $binDir/stty \ - $binDir/sum \ - $binDir/sync \ - $binDir/tac \ - $binDir/tail \ - $binDir/tee \ - $binDir/test \ - $binDir/timeout \ - $binDir/touch \ - $binDir/tr \ - $binDir/true \ - $binDir/truncate \ - $binDir/tsort \ - $binDir/tty \ - $binDir/uname \ - $binDir/unexpand \ - $binDir/uniq \ - $binDir/unlink \ - $binDir/vdir \ - $binDir/wc \ - $binDir/whoami \ - $binDir/yes - -PATCH() -{ - sed -i -e 's|O_NOCACHE|DD_NOCACHE|g' src/dd.c -} - -BUILD() -{ - FORCE_UNSAFE_CONFIGURE=1 runConfigure ./configure \ - --without-included-regex \ - --disable-rpath --with-gnu-ld \ - --enable-no-install-program=df,uptime \ - --enable-install-program=hostname - touch doc/*.info - make $jobArgs -} - -INSTALL() -{ - make install -} diff --git a/sys-apps/coreutils/patches/coreutils-8.22.gcc2.patchset b/sys-apps/coreutils/patches/coreutils-8.22.gcc2.patchset deleted file mode 100644 index 37e407701..000000000 --- a/sys-apps/coreutils/patches/coreutils-8.22.gcc2.patchset +++ /dev/null @@ -1,3032 +0,0 @@ -From ed40f7e0aa7652d5bf77c52047739a84b7acad8b Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Sun, 18 May 2014 21:41:14 +0000 -Subject: gcc2 patch c89 - - -diff --git a/lib/fts.c b/lib/fts.c -index 74968b3..6134365 100644 ---- a/lib/fts.c -+++ b/lib/fts.c -@@ -1293,6 +1293,7 @@ fts_build (register FTS *sp, int type) - int dir_fd; - FTSENT *cur = sp->fts_cur; - bool continue_readdir = !!cur->fts_dirp; -+ size_t max_entries; - - /* When cur->fts_dirp is non-NULL, that means we should - continue calling readdir on that existing DIR* pointer -@@ -1354,7 +1355,7 @@ fts_build (register FTS *sp, int type) - function. But when no such function is specified, we can read - entries in batches that are large enough to help us with inode- - sorting, yet not so large that we risk exhausting memory. */ -- size_t max_entries = (sp->fts_compar == NULL -+ max_entries = (sp->fts_compar == NULL - ? FTS_MAX_READDIR_ENTRIES : SIZE_MAX); - - /* -diff --git a/lib/randperm.c b/lib/randperm.c -index ffa8faa..31c8c06 100644 ---- a/lib/randperm.c -+++ b/lib/randperm.c -@@ -114,8 +114,11 @@ sparse_new (size_t size_hint) - static void - sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j) - { -- struct sparse_ent_ *v1 = hash_delete (sv, &(struct sparse_ent_) {i,0}); -- struct sparse_ent_ *v2 = hash_delete (sv, &(struct sparse_ent_) {j,0}); -+ struct sparse_ent_ ent1 = {i,0}; -+ struct sparse_ent_ ent2 = {j,0}; -+ size_t t; -+ struct sparse_ent_ *v1 = hash_delete (sv, &ent1); -+ struct sparse_ent_ *v2 = hash_delete (sv, &ent2); - - /* FIXME: reduce the frequency of these mallocs. */ - if (!v1) -@@ -129,7 +132,7 @@ sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j) - v2->index = v2->val = j; - } - -- size_t t = v1->val; -+ t = v1->val; - v1->val = v2->val; - v2->val = t; - if (!hash_insert (sv, v1)) -diff --git a/lib/utimecmp.c b/lib/utimecmp.c -index dc622ad..895e500 100644 ---- a/lib/utimecmp.c -+++ b/lib/utimecmp.c -@@ -131,14 +131,13 @@ utimecmp (char const *dst_name, - - time_t might be unsigned. */ - -- verify (TYPE_IS_INTEGER (time_t)); -- verify (TYPE_TWOS_COMPLEMENT (int)); -- - /* Destination and source time stamps. */ - time_t dst_s = dst_stat->st_mtime; - time_t src_s = src_stat->st_mtime; - int dst_ns = get_stat_mtime_ns (dst_stat); - int src_ns = get_stat_mtime_ns (src_stat); -+ verify (TYPE_IS_INTEGER (time_t)); -+ verify (TYPE_TWOS_COMPLEMENT (int)); - - if (options & UTIMECMP_TRUNCATE_SOURCE) - { -diff --git a/lib/verify.h b/lib/verify.h -index bf40b02..4b34514 100644 ---- a/lib/verify.h -+++ b/lib/verify.h -@@ -248,7 +248,8 @@ template - /* Verify requirement R at compile-time, as a declaration without a - trailing ';'. */ - --#define verify(R) _GL_VERIFY (R, "verify (" #R ")") -+//#define verify(R) _GL_VERIFY (R, "verify (" #R ")") -+#define verify(R) - - #ifndef __has_builtin - # define __has_builtin(x) 0 -diff --git a/src/chown-core.c b/src/chown-core.c -index a5a2b47..a8c4b07 100644 ---- a/src/chown-core.c -+++ b/src/chown-core.c -@@ -219,6 +219,7 @@ restricted_chown (int cwd_fd, char const *file, - struct stat st; - int open_flags = O_NONBLOCK | O_NOCTTY; - int fd; -+ int saved_errno; - - if (required_uid == (uid_t) -1 && required_gid == (gid_t) -1) - return RC_do_ordinary_chown; -@@ -256,7 +257,7 @@ restricted_chown (int cwd_fd, char const *file, - } - } - -- int saved_errno = errno; -+ saved_errno = errno; - close (fd); - errno = saved_errno; - return status; -diff --git a/src/chroot.c b/src/chroot.c -index 89fd392..ca4aeff 100644 ---- a/src/chroot.c -+++ b/src/chroot.c -@@ -161,6 +161,7 @@ main (int argc, char **argv) - int c; - char const *userspec = NULL; - char const *groups = NULL; -+ bool fail; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -221,7 +222,7 @@ main (int argc, char **argv) - argv += optind + 1; - } - -- bool fail = false; -+ fail = false; - - /* Attempt to set all three: supplementary groups, group ID, user ID. - Diagnose any failures. If any have failed, exit before execvp. */ -diff --git a/src/copy.c b/src/copy.c -index 0f044d0..d1cc7a0 100644 ---- a/src/copy.c -+++ b/src/copy.c -@@ -293,13 +293,15 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, - /* Keep track of the output position. - We may need this at the end, for a final ftruncate. */ - off_t dest_pos = 0; -- -+ bool wrote_hole_at_eof = true; -+ - extent_scan_init (src_fd, &scan); - - *require_normal_copy = false; -- bool wrote_hole_at_eof = true; - do - { -+ unsigned int i; -+ bool empty_extent = false; - bool ok = extent_scan_read (&scan); - if (! ok) - { -@@ -317,8 +319,6 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, - return false; - } - -- unsigned int i; -- bool empty_extent = false; - for (i = 0; i < scan.ei_count || empty_extent; i++) - { - off_t ext_start; -@@ -589,6 +589,7 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, - char *namep; - struct cp_options non_command_line_options = *x; - bool ok = true; -+ bool new_first_dir_created = false; - - name_space = savedir (src_name_in); - if (name_space == NULL) -@@ -604,7 +605,6 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, - if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS) - non_command_line_options.dereference = DEREF_NEVER; - -- bool new_first_dir_created = false; - namep = name_space; - while (*namep != '\0') - { -@@ -991,7 +991,7 @@ copy_reg (char const *src_name, char const *dst_name, - if (*new_dst) - { - open_with_O_CREAT:; -- -+{ - int open_flags = O_WRONLY | O_CREAT | O_BINARY; - dest_desc = open (dst_name, open_flags | O_EXCL, - dst_mode & ~omitted_permissions); -@@ -1035,6 +1035,7 @@ copy_reg (char const *src_name, char const *dst_name, - && *dst_name && dst_name[strlen (dst_name) - 1] == '/') - dest_errno = ENOTDIR; - } -+ } - else - { - omitted_permissions = 0; -@@ -1097,12 +1098,14 @@ copy_reg (char const *src_name, char const *dst_name, - size_t buf_alignment = lcm (getpagesize (), sizeof (word)); - size_t buf_alignment_slop = sizeof (word) + buf_alignment - 1; - size_t buf_size = io_blksize (sb); -+ bool make_holes = false; -+ bool sparse_src = false; -+ off_t n_read; -+ bool wrote_hole_at_eof; - - fdadvise (source_desc, 0, 0, FADVISE_SEQUENTIAL); - - /* Deal with sparse files. */ -- bool make_holes = false; -- bool sparse_src = false; - - if (S_ISREG (sb.st_mode)) - { -@@ -1169,8 +1172,6 @@ copy_reg (char const *src_name, char const *dst_name, - } - } - -- off_t n_read; -- bool wrote_hole_at_eof; - if ( ! sparse_copy (source_desc, dest_desc, buf, buf_size, - make_holes, src_name, dst_name, - UINTMAX_MAX, &n_read, -@@ -1667,10 +1668,11 @@ create_hard_link (char const *src_name, char const *dst_name, - { - /* We want to guarantee that symlinks are not followed, unless requested. */ - int flags = 0; -+ bool link_failed; - if (dereference) - flags = AT_SYMLINK_FOLLOW; - -- bool link_failed = (linkat (AT_FDCWD, src_name, AT_FDCWD, dst_name, flags) -+ link_failed = (linkat (AT_FDCWD, src_name, AT_FDCWD, dst_name, flags) - != 0); - - /* If the link failed because of an existing destination, -@@ -1746,6 +1748,7 @@ copy_internal (char const *src_name, char const *dst_name, - bool copied_as_regular = false; - bool dest_is_symlink = false; - bool have_dst_lstat = false; -+ bool dereference; - - if (x->move_mode && rename_succeeded) - *rename_succeeded = false; -@@ -1784,7 +1787,7 @@ copy_internal (char const *src_name, char const *dst_name, - record_file (x->src_info, src_name, &src_sb); - } - -- bool dereference = should_dereference (x, command_line_arg); -+ dereference = should_dereference (x, command_line_arg); - - if (!new_dst) - { -@@ -2793,6 +2796,7 @@ copy (char const *src_name, char const *dst_name, - bool nonexistent_dst, const struct cp_options *options, - bool *copy_into_self, bool *rename_succeeded) - { -+ bool first_dir_created_per_command_line_arg = false; - assert (valid_options (options)); - - /* Record the file names: they're used in case of error, when copying -@@ -2805,7 +2809,6 @@ copy (char const *src_name, char const *dst_name, - top_level_src_name = src_name; - top_level_dst_name = dst_name; - -- bool first_dir_created_per_command_line_arg = false; - return copy_internal (src_name, dst_name, nonexistent_dst, 0, NULL, - options, true, - &first_dir_created_per_command_line_arg, -diff --git a/src/cp.c b/src/cp.c -index 9038d4e..f76a22b 100644 ---- a/src/cp.c -+++ b/src/cp.c -@@ -823,6 +823,7 @@ cp_option_init (struct cp_options *x) - static void - decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) - { -+ char *arg_writable, *s; - enum File_attribute - { - PRESERVE_MODE, -@@ -847,8 +848,8 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) - }; - ARGMATCH_VERIFY (preserve_args, preserve_vals); - -- char *arg_writable = xstrdup (arg); -- char *s = arg_writable; -+ arg_writable = xstrdup (arg); -+ s = arg_writable; - do - { - /* find next comma */ -diff --git a/src/csplit.c b/src/csplit.c -index 5bfca09..581c790 100644 ---- a/src/csplit.c -+++ b/src/csplit.c -@@ -1225,8 +1225,9 @@ static size_t - get_format_flags (char const *format, int *flags_ptr) - { - int flags = 0; -+ size_t count; - -- for (size_t count = 0; ; count++) -+ for (count = 0; ; count++) - { - switch (format[count]) - { -@@ -1300,15 +1301,17 @@ static size_t - max_out (char *format) - { - bool percent = false; -+ char *f; -+ int maxlen; - -- for (char *f = format; *f; f++) -+ for (f = format; *f; f++) - if (*f == '%' && *++f != '%') - { -+ int flags; - if (percent) - error (EXIT_FAILURE, 0, - _("too many %% conversion specifications in suffix")); - percent = true; -- int flags; - f += get_format_flags (f, &flags); - while (ISDIGIT (*f)) - f++; -@@ -1322,7 +1325,7 @@ max_out (char *format) - error (EXIT_FAILURE, 0, - _("missing %% conversion specification in suffix")); - -- int maxlen = snprintf (NULL, 0, format, UINT_MAX); -+ maxlen = snprintf (NULL, 0, format, UINT_MAX); - if (! (0 <= maxlen && maxlen <= SIZE_MAX)) - xalloc_die (); - return maxlen; -@@ -1333,6 +1336,8 @@ main (int argc, char **argv) - { - int optc; - unsigned long int val; -+ size_t prefix_len; -+ size_t max_digit_string_len; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1402,8 +1407,8 @@ main (int argc, char **argv) - usage (EXIT_FAILURE); - } - -- size_t prefix_len = strlen (prefix); -- size_t max_digit_string_len -+ prefix_len = strlen (prefix); -+ max_digit_string_len - = (suffix - ? max_out (suffix) - : MAX (INT_STRLEN_BOUND (unsigned int), digits)); -diff --git a/src/cut.c b/src/cut.c -index 19ef1d9..00d4b51 100644 ---- a/src/cut.c -+++ b/src/cut.c -@@ -399,7 +399,8 @@ set_fields (const char *fieldstr) - /* Merge range pairs (e.g. `2-5,3-4' becomes `2-5'). */ - for (i = 0; i < n_rp; ++i) - { -- for (size_t j = i + 1; j < n_rp; ++j) -+ size_t j; -+ for (j = i + 1; j < n_rp; ++j) - { - if (rp[j].lo <= rp[i].hi) - { -@@ -534,6 +535,7 @@ cut_fields (FILE *stream) - - while (1) - { -+ int prev_c; - if (field_idx == 1 && buffer_first_field) - { - ssize_t len; -@@ -585,7 +587,7 @@ cut_fields (FILE *stream) - next_item (&field_idx); - } - -- int prev_c = c; -+ prev_c = c; - - if (print_kth (field_idx)) - { -diff --git a/src/dd.c b/src/dd.c -index 59d6cd1..db91ab4 100644 ---- a/src/dd.c -+++ b/src/dd.c -@@ -662,10 +662,11 @@ human_size (size_t n) - static void - alloc_ibuf (void) - { -+ char *real_buf; - if (ibuf) - return; - -- char *real_buf = malloc (input_blocksize + INPUT_BLOCK_SLOP); -+ real_buf = malloc (input_blocksize + INPUT_BLOCK_SLOP); - if (!real_buf) - error (EXIT_FAILURE, 0, - _("memory exhausted by input buffer of size %zu bytes (%s)"), -@@ -735,6 +736,7 @@ print_stats (void) - | human_space_before_unit | human_SI | human_B); - double delta_s; - char const *bytes_per_second; -+ xtime_t now; - - if (status_flags & STATUS_NONE) - return; -@@ -764,7 +766,7 @@ print_stats (void) - w_bytes, - human_readable (w_bytes, hbuf, human_opts, 1, 1)); - -- xtime_t now = gethrxtime (); -+ now = gethrxtime (); - if (start_time < now) - { - double XTIME_PRECISIONe0 = XTIME_PRECISION; -@@ -954,6 +956,7 @@ static bool - invalidate_cache (int fd, off_t len) - { - int adv_ret = -1; -+ off_t pending; - - /* Minimize syscalls. */ - off_t clen = cache_round (fd, len); -@@ -961,7 +964,7 @@ invalidate_cache (int fd, off_t len) - return true; /* Don't advise this time. */ - if (!len && !clen && max_records) - return true; /* Nothing pending. */ -- off_t pending = len ? cache_round (fd, 0) : 0; -+ pending = len ? cache_round (fd, 0) : 0; - - if (fd == STDIN_FILENO) - { -@@ -1637,6 +1640,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, - } - else - { -+ char *buf; - int lseek_errno = errno; - - /* The seek request may have failed above if it was too big -@@ -1671,7 +1675,6 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, - } - /* else file_size && offset > OFF_T_MAX or file ! seekable */ - -- char *buf; - if (fdesc == STDIN_FILENO) - { - alloc_ibuf (); -@@ -2018,8 +2021,9 @@ dd_copy (void) - - if (conversions_mask & C_NOERROR) - { -+ size_t bad_portion; - print_stats (); -- size_t bad_portion = input_blocksize - partread; -+ bad_portion = input_blocksize - partread; - - /* We already know this data is not cached, - but call this so that correct offsets are maintained. */ -diff --git a/src/df.c b/src/df.c -index 969670e..2417782 100644 ---- a/src/df.c -+++ b/src/df.c -@@ -308,6 +308,8 @@ print_table (void) - for (col = 0; col < ncolumns; col++) - { - char *cell = table[row][col]; -+ int flags; -+ size_t width; - - /* Note the SOURCE_FIELD used to be displayed on it's own line - if (!posix_format && mbswidth (cell) > 20), but that -@@ -316,11 +318,11 @@ print_table (void) - if (col != 0) - putchar (' '); - -- int flags = 0; -+ flags = 0; - if (col == ncolumns - 1) /* The last one. */ - flags = MBA_NO_RIGHT_PAD; - -- size_t width = columns[col]->width; -+ width = columns[col]->width; - cell = ambsalign (cell, &width, columns[col]->align, flags); - /* When ambsalign fails, output unaligned data. */ - fputs (cell ? cell : table[row][col], stdout); -@@ -365,6 +367,8 @@ decode_output_arg (char const *arg) - do - { - /* find next comma */ -+ display_field_t field; -+ unsigned int i; - char *comma = strchr (s, ','); - - /* If we found a comma, put a NUL in its place and advance. */ -@@ -372,8 +376,8 @@ decode_output_arg (char const *arg) - *comma++ = 0; - - /* process S. */ -- display_field_t field = -1; -- for (unsigned int i = 0; i < ARRAY_CARDINALITY (field_data); i++) -+ field = -1; -+ for (i = 0; i < ARRAY_CARDINALITY (field_data); i++) - { - if (STREQ (field_data[i].arg, s)) - { -@@ -525,6 +529,7 @@ get_header (void) - uintmax_t q1024 = output_block_size; - bool divisible_by_1000; - bool divisible_by_1024; -+ char *num; - - do - { -@@ -540,7 +545,7 @@ get_header (void) - if (! (opts & human_base_1024)) - opts |= human_B; - -- char *num = human_readable (output_block_size, buf, opts, 1, 1); -+ num = human_readable (output_block_size, buf, opts, 1, 1); - - /* Reset the header back to the default in OUTPUT_MODE. */ - header = _("blocks"); -@@ -676,12 +681,13 @@ filter_mount_list (void) - mount_list = NULL; - while (devlist_head) - { -+ struct devlist *devlist; - /* Add the mount entry. */ - me = devlist_head->me; - me->me_next = mount_list; - mount_list = me; - /* Free devlist entry and advance. */ -- struct devlist *devlist = devlist_head->next; -+ devlist = devlist_head->next; - free (devlist_head); - devlist_head = devlist; - } -@@ -847,6 +853,12 @@ get_dev (char const *disk, char const *mount_point, char const* file, - const struct fs_usage *force_fsu, - bool process_all) - { -+ struct fs_usage fsu; -+ char *dev_name; -+ char *resolved_dev; -+ struct field_values_t block_values; -+ struct field_values_t inode_values; -+ size_t col; - if (me_remote && show_local_fs) - return; - -@@ -863,7 +875,6 @@ get_dev (char const *disk, char const *mount_point, char const* file, - if (!stat_file) - stat_file = mount_point ? mount_point : disk; - -- struct fs_usage fsu; - if (force_fsu) - fsu = *force_fsu; - else if (get_fs_usage (stat_file, disk, &fsu)) -@@ -887,9 +898,8 @@ get_dev (char const *disk, char const *mount_point, char const* file, - if (! file) - file = "-"; /* unspecified */ - -- char *dev_name = xstrdup (disk); -- char *resolved_dev; -- -+ dev_name = xstrdup (disk); -+ - /* On some systems, dev_name is a long-named symlink like - /dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7196a2edb66 pointing to a - much shorter and more useful name like /dev/sda1. It may also look -@@ -907,15 +917,12 @@ get_dev (char const *disk, char const *mount_point, char const* file, - if (! fstype) - fstype = "-"; /* unknown */ - -- struct field_values_t block_values; -- struct field_values_t inode_values; - get_field_values (&block_values, &inode_values, &fsu); - - /* Add to grand total unless processing grand total line. */ - if (print_grand_total && ! force_fsu) - add_to_grand_total (&block_values, &inode_values); - -- size_t col; - for (col = 0; col < ncolumns; col++) - { - char buf[LONGEST_HUMAN_READABLE + 2]; -@@ -1057,12 +1064,13 @@ get_disk (char const *disk) - struct mount_entry const *me; - struct mount_entry const *best_match = NULL; - char const *file = disk; -+ size_t best_match_len; - - char *resolved = canonicalize_file_name (disk); - if (resolved && resolved[0] == '/') - disk = resolved; - -- size_t best_match_len = SIZE_MAX; -+ best_match_len = SIZE_MAX; - for (me = mount_list; me; me = me->me_next) - { - if (STREQ (disk, me->me_devname)) -@@ -1305,6 +1313,8 @@ int - main (int argc, char **argv) - { - struct stat *stats IF_LINT ( = 0); -+ bool posix_format; -+ const char *msg_mut_excl; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1326,9 +1336,9 @@ main (int argc, char **argv) - grand_fsu.fsu_blocksize = 1; - - /* If true, use the POSIX output format. */ -- bool posix_format = false; -+ posix_format = false; - -- const char *msg_mut_excl = _("options %s and %s are mutually exclusive"); -+ msg_mut_excl = _("options %s and %s are mutually exclusive"); - - while (true) - { -@@ -1528,6 +1538,7 @@ main (int argc, char **argv) - or when either of -a, -l, -t or -x is used with file name - arguments. Otherwise, merely give a warning and proceed. */ - int status = 0; -+ const char *warning; - if ( ! (optind < argc) - || (show_all_fs - || show_local_fs -@@ -1536,7 +1547,7 @@ main (int argc, char **argv) - { - status = EXIT_FAILURE; - } -- const char *warning = (status == 0 ? _("Warning: ") : ""); -+ warning = (status == 0 ? _("Warning: ") : ""); - error (status, errno, "%s%s", warning, - _("cannot read table of mounted file systems")); - } -diff --git a/src/du.c b/src/du.c -index a265b10..9a44966 100644 ---- a/src/du.c -+++ b/src/du.c -@@ -461,8 +461,9 @@ process_file (FTS *fts, FTSENT *ent) - - if (info == FTS_NSOK) - { -+ FTSENT const *e; - fts_set (fts, ent, FTS_AGAIN); -- FTSENT const *e = fts_read (fts); -+ e = fts_read (fts); - assert (e == ent); - info = ent->fts_info; - } -@@ -494,8 +495,9 @@ process_file (FTS *fts, FTSENT *ent) - visit to the same directory. */ - if (info == FTS_D) - { -+ FTSENT const *e; - fts_set (fts, ent, FTS_SKIP); -- FTSENT const *e = fts_read (fts); -+ e = fts_read (fts); - assert (e == ent); - } - -@@ -707,6 +709,8 @@ main (int argc, char **argv) - - /* If true, display only a total for each argument. */ - bool opt_summarize_only = false; -+ struct argv_iterator *ai; -+ static char *temp_argv[] = { NULL, NULL }; - - cwd_only[0] = bad_cast ("."); - cwd_only[1] = NULL; -@@ -979,7 +983,6 @@ main (int argc, char **argv) - } - } - -- struct argv_iterator *ai; - if (files_from) - { - /* When using --files0-from=F, you may not specify any files -@@ -1034,8 +1037,7 @@ main (int argc, char **argv) - bit_flags |= FTS_TIGHT_CYCLE_CHECK; - - bit_flags |= symlink_deref_bits; -- static char *temp_argv[] = { NULL, NULL }; -- -+ - while (true) - { - bool skip_file = false; -diff --git a/src/env.c b/src/env.c -index c31d165..ca9f4be 100644 ---- a/src/env.c -+++ b/src/env.c -@@ -80,6 +80,7 @@ main (int argc, char **argv) - int optc; - bool ignore_environment = false; - bool opt_nul_terminate_output = false; -+ char *eq; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -126,7 +127,6 @@ main (int argc, char **argv) - if (optind < argc && STREQ (argv[optind], "-")) - ++optind; - -- char *eq; - while (optind < argc && (eq = strchr (argv[optind], '='))) - { - if (putenv (argv[optind])) -diff --git a/src/expr.c b/src/expr.c -index 9d21ca8..bb1d58c 100644 ---- a/src/expr.c -+++ b/src/expr.c -@@ -115,8 +115,8 @@ mpz_tdiv_r (mpz_t r, mpz_t a0, mpz_t b0) - static char * - mpz_get_str (char const *str, int base, mpz_t z) - { -- (void) str; (void) base; - char buf[INT_BUFSIZE_BOUND (intmax_t)]; -+ (void) str; (void) base; - return xstrdup (imaxtostr (z[0], buf)); - } - static int -@@ -137,8 +137,8 @@ mpz_get_ui (mpz_t z) - static int - mpz_out_str (FILE *stream, int base, mpz_t z) - { -- (void) base; - char buf[INT_BUFSIZE_BOUND (intmax_t)]; -+ (void) base; - return fputs (imaxtostr (z[0], buf), stream) != EOF; - } - #endif -@@ -291,6 +291,7 @@ int - main (int argc, char **argv) - { - VALUE *v; -+ unsigned int u_argc; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -306,7 +307,7 @@ main (int argc, char **argv) - - /* The above handles --help and --version. - Since there is no other invocation of getopt, handle '--' here. */ -- unsigned int u_argc = argc; -+ u_argc = argc; - if (1 < u_argc && STREQ (argv[1], "--")) - { - --u_argc; -diff --git a/src/factor.c b/src/factor.c -index 257a7ed..bd07cf6 100644 ---- a/src/factor.c -+++ b/src/factor.c -@@ -281,12 +281,13 @@ static void factor (uintmax_t, uintmax_t, struct factors *); - # define udiv_qrnnd(q, r, n1, n0, d) \ - do { \ - uintmax_t __d1, __d0, __q, __r1, __r0; \ -+ unsigned int __i; \ - \ - assert ((n1) < (d)); \ - __d1 = (d); __d0 = 0; \ - __r1 = (n1); __r0 = (n0); \ - __q = 0; \ -- for (unsigned int __i = W_TYPE_SIZE; __i > 0; __i--) \ -+ for (__i = W_TYPE_SIZE; __i > 0; __i--) \ - { \ - rsh2 (__d1, __d0, __d1, __d0, 1); \ - __q <<= 1; \ -@@ -404,6 +405,7 @@ static uintmax_t - mod2 (uintmax_t *r1, uintmax_t a1, uintmax_t a0, uintmax_t d1, uintmax_t d0) - { - int cntd, cnta; -+ int cnt, i; - - assert (d1 != 0); - -@@ -415,9 +417,9 @@ mod2 (uintmax_t *r1, uintmax_t a1, uintmax_t a0, uintmax_t d1, uintmax_t d0) - - count_leading_zeros (cntd, d1); - count_leading_zeros (cnta, a1); -- int cnt = cntd - cnta; -+ cnt = cntd - cnta; - lsh2 (d1, d0, d1, d0, cnt); -- for (int i = 0; i < cnt; i++) -+ for (i = 0; i < cnt; i++) - { - if (ge2 (a1, a0, d1, d0)) - sub_ddmmss (a1, a0, a1, a0, d1, d0); -@@ -522,7 +524,8 @@ factor_insert_multiplicity (struct factors *factors, - - if (i < 0 || p[i] != prime) - { -- for (int j = nfactors - 1; j > i; j--) -+ int j; -+ for (j = nfactors - 1; j > i; j--) - { - p[j + 1] = p[j]; - e[j + 1] = e[j]; -@@ -711,19 +714,20 @@ static bool flag_prove_primality = true; - /* Number of Miller-Rabin tests to run when not proving primality. */ - #define MR_REPS 25 - --#ifdef __GNUC__ --# define LIKELY(cond) __builtin_expect ((cond), 1) --# define UNLIKELY(cond) __builtin_expect ((cond), 0) --#else -+//#ifdef __GNUC__ -+//# define LIKELY(cond) __builtin_expect ((cond), 1) -+//# define UNLIKELY(cond) __builtin_expect ((cond), 0) -+//#else - # define LIKELY(cond) (cond) - # define UNLIKELY(cond) (cond) --#endif -+//#endif - - static void - factor_insert_refind (struct factors *factors, uintmax_t p, unsigned int i, - unsigned int off) - { -- for (unsigned int j = 0; j < off; j++) -+ unsigned int j; -+ for (j = 0; j < off; j++) - p += primes_diff[i + j]; - factor_insert (factors, p); - } -@@ -765,6 +769,8 @@ static uintmax_t - factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0, - struct factors *factors) - { -+ uintmax_t p = 3; -+ unsigned int i; - if (t0 % 2 == 0) - { - unsigned int cnt; -@@ -785,8 +791,6 @@ factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0, - factor_insert_multiplicity (factors, 2, cnt); - } - -- uintmax_t p = 3; -- unsigned int i; - for (i = 0; t1 > 0 && i < PRIMES_PTAB_ENTRIES; i++) - { - for (;;) -@@ -848,6 +852,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) - { - mpz_t q; - unsigned long int p; -+ unsigned int i; - - devmsg ("[trial division] "); - -@@ -862,7 +867,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) - } - - p = 3; -- for (unsigned int i = 1; i <= PRIMES_PTAB_ENTRIES;) -+ for (i = 1; i <= PRIMES_PTAB_ENTRIES;) - { - if (! mpz_divisible_ui_p (t, p)) - { -@@ -1132,11 +1137,12 @@ millerrabin (uintmax_t n, uintmax_t ni, uintmax_t b, uintmax_t q, - uintmax_t y = powm (b, q, n, ni, one); - - uintmax_t nm1 = n - one; /* -1, but in redc representation. */ -+ unsigned int i; - - if (y == one || y == nm1) - return true; - -- for (unsigned int i = 1; i < k; i++) -+ for (i = 1; i < k; i++) - { - y = mulredc (y, y, n, ni); - -@@ -1153,6 +1159,7 @@ millerrabin2 (const uintmax_t *np, uintmax_t ni, const uintmax_t *bp, - const uintmax_t *qp, unsigned int k, const uintmax_t *one) - { - uintmax_t y1, y0, nm1_1, nm1_0, r1m; -+ unsigned int i; - - y0 = powm2 (&r1m, bp, qp, np, ni, one); - y1 = r1m; -@@ -1165,7 +1172,7 @@ millerrabin2 (const uintmax_t *np, uintmax_t ni, const uintmax_t *bp, - if (y0 == nm1_0 && y1 == nm1_1) - return true; - -- for (unsigned int i = 1; i < k; i++) -+ for (i = 1; i < k; i++) - { - y0 = mulredc2 (&r1m, y1, y0, y1, y0, np[1], np[0], ni); - y1 = r1m; -@@ -1183,12 +1190,13 @@ static bool - mp_millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, mpz_ptr y, - mpz_srcptr q, unsigned long int k) - { -+ unsigned long int i; - mpz_powm (y, x, q, n); - - if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0) - return true; - -- for (unsigned long int i = 1; i < k; i++) -+ for (i = 1; i < k; i++) - { - mpz_powm_ui (y, y, 2, n); - if (mpz_cmp (y, nm1) == 0) -@@ -1209,6 +1217,8 @@ prime_p (uintmax_t n) - bool is_prime; - uintmax_t a_prim, one, ni; - struct factors factors; -+ uintmax_t q, a; -+ unsigned int r; - - if (n <= 1) - return false; -@@ -1218,11 +1228,11 @@ prime_p (uintmax_t n) - return true; - - /* Precomputation for Miller-Rabin. */ -- uintmax_t q = n - 1; -+ q = n - 1; - for (k = 0; (q & 1) == 0; k++) - q >>= 1; - -- uintmax_t a = 2; -+ a = 2; - binv (ni, n); /* ni <- 1/n mod B */ - redcify (one, 1, n); - addmod (a_prim, one, one, n); /* i.e., redcify a = 2 */ -@@ -1239,12 +1249,13 @@ prime_p (uintmax_t n) - - /* Loop until Lucas proves our number prime, or Miller-Rabin proves our - number composite. */ -- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) -+ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) - { - if (flag_prove_primality) - { -+ unsigned int i; - is_prime = true; -- for (unsigned int i = 0; i < factors.nfactors && is_prime; i++) -+ for (i = 0; i < factors.nfactors && is_prime; i++) - { - is_prime - = powm (a_prim, (n - 1) / factors.p[i], n, ni, one) != one; -@@ -1294,6 +1305,8 @@ prime2_p (uintmax_t n1, uintmax_t n0) - uintmax_t ni; - unsigned int k; - struct factors factors; -+ unsigned int r; -+ uintmax_t a; - - if (n1 == 0) - return prime_p (n0); -@@ -1314,7 +1327,7 @@ prime2_p (uintmax_t n1, uintmax_t n0) - rsh2 (q[1], q[0], nm1[1], nm1[0], k); - } - -- uintmax_t a = 2; -+ a = 2; - binv (ni, n0); - redcify2 (one[1], one[0], 1, n1, n0); - addmod2 (a_prim[1], a_prim[0], one[1], one[0], one[1], one[0], n1, n0); -@@ -1334,13 +1347,14 @@ prime2_p (uintmax_t n1, uintmax_t n0) - - /* Loop until Lucas proves our number prime, or Miller-Rabin proves our - number composite. */ -- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) -+ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) - { - bool is_prime; - uintmax_t e[2], y[2]; - - if (flag_prove_primality) - { -+ unsigned int i; - is_prime = true; - if (factors.plarge[1]) - { -@@ -1351,7 +1365,7 @@ prime2_p (uintmax_t n1, uintmax_t n0) - y[0] = powm2 (&y[1], a_prim, e, na, ni, one); - is_prime = (y[0] != one[0] || y[1] != one[1]); - } -- for (unsigned int i = 0; i < factors.nfactors && is_prime; i++) -+ for (i = 0; i < factors.nfactors && is_prime; i++) - { - /* FIXME: We always have the factor 2. Do we really need to - handle it here? We have done the same powering as part -@@ -1391,6 +1405,8 @@ mp_prime_p (mpz_t n) - bool is_prime; - mpz_t q, a, nm1, tmp; - struct mp_factors factors; -+ unsigned long int k; -+ unsigned int r; - - if (mpz_cmp_ui (n, 1) <= 0) - return false; -@@ -1405,7 +1421,7 @@ mp_prime_p (mpz_t n) - mpz_sub_ui (nm1, n, 1); - - /* Find q and k, where q is odd and n = 1 + 2**k * q. */ -- unsigned long int k = mpz_scan1 (nm1, 0); -+ k = mpz_scan1 (nm1, 0); - mpz_tdiv_q_2exp (q, nm1, k); - - mpz_set_ui (a, 2); -@@ -1426,12 +1442,13 @@ mp_prime_p (mpz_t n) - - /* Loop until Lucas proves our number prime, or Miller-Rabin proves our - number composite. */ -- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) -+ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) - { - if (flag_prove_primality) - { -+ unsigned long int i; - is_prime = true; -- for (unsigned long int i = 0; i < factors.nfactors && is_prime; i++) -+ for (i = 0; i < factors.nfactors && is_prime; i++) - { - mpz_divexact (tmp, nm1, factors.p[i]); - mpz_powm (tmp, a, tmp, n); -@@ -1490,6 +1507,7 @@ factor_using_pollard_rho (uintmax_t n, unsigned long int a, - - for (;;) - { -+ unsigned long int i; - do - { - x = mulredc (x, x, n, ni); -@@ -1510,7 +1528,7 @@ factor_using_pollard_rho (uintmax_t n, unsigned long int a, - z = x; - k = l; - l = 2 * l; -- for (unsigned long int i = 0; i < k; i++) -+ for (i = 0; i < k; i++) - { - x = mulredc (x, x, n, ni); - addmod (x, x, a, n); -@@ -1568,6 +1586,7 @@ factor_using_pollard_rho2 (uintmax_t n1, uintmax_t n0, unsigned long int a, - - for (;;) - { -+ unsigned long int i; - do - { - x0 = mulredc2 (&r1m, x1, x0, x1, x0, n1, n0, ni); -@@ -1591,7 +1610,7 @@ factor_using_pollard_rho2 (uintmax_t n1, uintmax_t n0, unsigned long int a, - z1 = x1; z0 = x0; - k = l; - l = 2 * l; -- for (unsigned long int i = 0; i < k; i++) -+ for (i = 0; i < k; i++) - { - x0 = mulredc2 (&r1m, x1, x0, x1, x0, n1, n0, ni); - x1 = r1m; -@@ -1669,6 +1688,8 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, - { - mpz_t x, z, y, P; - mpz_t t, t2; -+ unsigned long long int k = 1; -+ unsigned long long int l = 1; - - devmsg ("[pollard-rho (%lu)] ", a); - -@@ -1678,13 +1699,11 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, - mpz_init_set_si (z, 2); - mpz_init_set_ui (P, 1); - -- unsigned long long int k = 1; -- unsigned long long int l = 1; -- - while (mpz_cmp_ui (n, 1) != 0) - { - for (;;) - { -+ unsigned long long int i; - do - { - mpz_mul (t, x, x); -@@ -1708,7 +1727,7 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, - mpz_set (z, x); - k = l; - l = 2 * l; -- for (unsigned long long int i = 0; i < k; i++) -+ for (i = 0; i < k; i++) - { - mpz_mul (t, x, x); - mpz_mod (x, t, n); -@@ -1975,13 +1994,14 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - }; - - const unsigned int *m; -+ uintmax_t sqrt_n; - - struct { uintmax_t Q; uintmax_t P; } queue[QUEUE_SIZE]; - - if (n1 >= ((uintmax_t) 1 << (W_TYPE_SIZE - 2))) - return false; - -- uintmax_t sqrt_n = isqrt2 (n1, n0); -+ sqrt_n = isqrt2 (n1, n0); - - if (n0 == sqrt_n * sqrt_n) - { -@@ -1997,6 +2017,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - else - { - struct factors f; -+ unsigned int i; - - f.nfactors = 0; - if (!factor_using_squfof (0, sqrt_n, &f)) -@@ -2005,7 +2026,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - factor_using_pollard_rho (sqrt_n, 1, &f); - } - /* Duplicate the new factors */ -- for (unsigned int i = 0; i < f.nfactors; i++) -+ for (i = 0; i < f.nfactors; i++) - factor_insert_multiplicity (factors, f.p[i], 2*f.e[i]); - } - return true; -@@ -2108,7 +2129,9 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - uintmax_t r = is_square (Q); - if (r) - { -- for (unsigned int j = 0; j < qpos; j++) -+ unsigned int j; -+ uintmax_t hi, lo; -+ for (j = 0; j < qpos; j++) - { - if (queue[j].Q == r) - { -@@ -2143,7 +2166,6 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - for the case D = 2N. */ - /* Compute Q = (D - P*P) / Q1, but we need double - precision. */ -- uintmax_t hi, lo; - umul_ppmm (hi, lo, P, P); - sub_ddmmss (hi, lo, Dh, Dl, hi, lo); - udiv_qrnnd (Q, rem, hi, lo, Q1); -@@ -2269,6 +2291,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char *s) - uintmax_t hi = 0, lo = 0; - - strtol_error err = LONGINT_INVALID; -+ const char *p; - - /* Skip initial spaces and '+'. */ - for (;;) -@@ -2286,7 +2309,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char *s) - } - - /* Initial scan for invalid digits. */ -- const char *p = s; -+ p = s; - for (;;) - { - unsigned int c = *p++; -@@ -2362,14 +2385,15 @@ static void - print_factors_single (uintmax_t t1, uintmax_t t0) - { - struct factors factors; -+ unsigned int j, k; - - print_uintmaxes (t1, t0); - putchar (':'); - - factor (t1, t0, &factors); - -- for (unsigned int j = 0; j < factors.nfactors; j++) -- for (unsigned int k = 0; k < factors.e[j]; k++) -+ for (j = 0; j < factors.nfactors; j++) -+ for (k = 0; k < factors.e[j]; k++) - { - char buf[INT_BUFSIZE_BOUND (uintmax_t)]; - putchar (' '); -@@ -2393,6 +2417,7 @@ static bool - print_factors (const char *input) - { - uintmax_t t1, t0; -+ unsigned int j, k; - - /* Try converting the number to one or two words. If it fails, use GMP or - print an error message. The 2nd condition checks that the most -@@ -2430,8 +2455,8 @@ print_factors (const char *input) - gmp_printf ("%Zd:", t); - mp_factor (t, &factors); - -- for (unsigned int j = 0; j < factors.nfactors; j++) -- for (unsigned int k = 0; k < factors.e[j]; k++) -+ for (j = 0; j < factors.nfactors; j++) -+ for (k = 0; k < factors.e[j]; k++) - gmp_printf (" %Zd", factors.p[j]); - - mp_factor_clear (&factors); -@@ -2492,6 +2517,8 @@ do_stdin (void) - int - main (int argc, char **argv) - { -+ int c; -+ bool ok; - initialize_main (&argc, &argv); - set_program_name (argv[0]); - setlocale (LC_ALL, ""); -@@ -2502,7 +2529,6 @@ main (int argc, char **argv) - - alg = ALG_POLLARD_RHO; /* Default to Pollard rho */ - -- int c; - while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1) - { - switch (c) -@@ -2533,13 +2559,13 @@ main (int argc, char **argv) - memset (q_freq, 0, sizeof (q_freq)); - #endif - -- bool ok; - if (argc <= optind) - ok = do_stdin (); - else - { -+ int i; - ok = true; -- for (int i = optind; i < argc; i++) -+ for (i = optind; i < argc; i++) - if (! print_factors (argv[i])) - ok = false; - } -@@ -2548,8 +2574,9 @@ main (int argc, char **argv) - if (alg == ALG_SQUFOF && q_freq[0] > 0) - { - double acc_f; -+ unsigned int i; - printf ("q freq. cum. freq.(total: %d)\n", q_freq[0]); -- for (unsigned int i = 1, acc_f = 0.0; i <= Q_FREQ_SIZE; i++) -+ for (i = 1, acc_f = 0.0; i <= Q_FREQ_SIZE; i++) - { - double f = (double) q_freq[i] / q_freq[0]; - acc_f += f; -diff --git a/src/getlimits.c b/src/getlimits.c -index 9914025..870889c 100644 ---- a/src/getlimits.c -+++ b/src/getlimits.c -@@ -88,11 +88,12 @@ decimal_absval_add_one (char *buf) - bool negative = (buf[1] == '-'); - char *absnum = buf + 1 + negative; - char *p = absnum + strlen (absnum); -+ char *result; - absnum[-1] = '0'; - while (*--p == '9') - *p = '0'; - ++*p; -- char *result = MIN (absnum, p); -+ result = MIN (absnum, p); - if (negative) - *--result = '-'; - return result; -diff --git a/src/group-list.c b/src/group-list.c -index d54b057..33097d3 100644 ---- a/src/group-list.c -+++ b/src/group-list.c -@@ -105,6 +105,7 @@ print_group (gid_t gid, bool use_name) - { - struct group *grp = NULL; - bool ok = true; -+ char *s; - - if (use_name) - { -@@ -117,7 +118,7 @@ print_group (gid_t gid, bool use_name) - } - } - -- char *s = grp ? grp->gr_name : gidtostr (gid); -+ s = grp ? grp->gr_name : gidtostr (gid); - fputs (s, stdout); - return ok; - } -diff --git a/src/id.c b/src/id.c -index 884fd16..59e8242 100644 ---- a/src/id.c -+++ b/src/id.c -@@ -117,6 +117,7 @@ main (int argc, char **argv) - bool smack_enabled = is_smack_enabled (); - bool opt_zero = false; - char *pw_name = NULL; -+ size_t n_ids; - - /* If true, output the list of all group IDs. -G */ - bool just_group_list = false; -@@ -126,6 +127,7 @@ main (int argc, char **argv) - bool use_real = false; - /* If true, output only the user ID(s). -u */ - bool just_user = false; -+ bool default_format; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -183,7 +185,7 @@ main (int argc, char **argv) - } - } - -- size_t n_ids = argc - optind; -+ n_ids = argc - optind; - if (1 < n_ids) - { - error (0, 0, _("extra operand %s"), quote (argv[optind + 1])); -@@ -197,7 +199,7 @@ main (int argc, char **argv) - if (just_user + just_group + just_group_list + just_context > 1) - error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice")); - -- bool default_format = (just_user + just_group + just_group_list -+ default_format = (just_user + just_group + just_group_list - + just_context == 0); - - if (default_format && (use_real || use_name)) -@@ -345,6 +347,7 @@ static void - print_user (uid_t uid) - { - struct passwd *pwd = NULL; -+ char *s; - - if (use_name) - { -@@ -357,7 +360,7 @@ print_user (uid_t uid) - } - } - -- char *s = pwd ? pwd->pw_name : uidtostr (uid); -+ s = pwd ? pwd->pw_name : uidtostr (uid); - fputs (s, stdout); - } - -diff --git a/src/install.c b/src/install.c -index 7076655..f1a2edd 100644 ---- a/src/install.c -+++ b/src/install.c -@@ -197,8 +197,9 @@ need_copy (const char *src_name, const char *dest_name, - - if (owner_id == (uid_t) -1) - { -+ uid_t ruid; - errno = 0; -- uid_t ruid = getuid (); -+ ruid = getuid (); - if ((ruid == (uid_t) -1 && errno) || dest_sb.st_uid != ruid) - return true; - } -@@ -207,8 +208,9 @@ need_copy (const char *src_name, const char *dest_name, - - if (group_id == (uid_t) -1) - { -+ gid_t rgid; - errno = 0; -- gid_t rgid = getgid (); -+ rgid = getgid (); - if ((rgid == (uid_t) -1 && errno) || dest_sb.st_gid != rgid) - return true; - } -diff --git a/src/join.c b/src/join.c -index 1da618d..cb370ca 100644 ---- a/src/join.c -+++ b/src/join.c -@@ -655,6 +655,8 @@ join (FILE *fp1, FILE *fp2) - struct seq seq1, seq2; - int diff; - bool eof1, eof2; -+ struct line *line = NULL; -+ bool checktail = false; - - fadvise (fp1, FADVISE_SEQUENTIAL); - fadvise (fp2, FADVISE_SEQUENTIAL); -@@ -763,9 +765,7 @@ join (FILE *fp1, FILE *fp2) - tail ends of both inputs to verify that they are in order. We - skip the rest of the tail once we have issued a warning for that - file, unless we actually need to print the unpairable lines. */ -- struct line *line = NULL; -- bool checktail = false; -- -+ - if (check_input_order != CHECK_ORDER_DISABLED - && !(issued_disorder_warning[0] && issued_disorder_warning[1])) - checktail = true; -@@ -838,9 +838,10 @@ string_to_join_field (char const *str) - { - size_t result; - unsigned long int val; -+ strtol_error s_err; - verify (SIZE_MAX <= ULONG_MAX); - -- strtol_error s_err = xstrtoul (str, NULL, 10, &val, ""); -+ s_err = xstrtoul (str, NULL, 10, &val, ""); - if (s_err == LONGINT_OVERFLOW || (s_err == LONGINT_OK && SIZE_MAX < val)) - val = SIZE_MAX; - else if (s_err != LONGINT_OK || val == 0) -diff --git a/src/ls.c b/src/ls.c -index e7d1d93..6d60b4b 100644 ---- a/src/ls.c -+++ b/src/ls.c -@@ -1048,13 +1048,14 @@ static size_t - abmon_init (void) - { - #ifdef HAVE_NL_LANGINFO -- required_mon_width = MAX_MON_WIDTH; - size_t curr_max_width; -+ required_mon_width = MAX_MON_WIDTH; - do - { -+ int i; - curr_max_width = required_mon_width; - required_mon_width = 0; -- for (int i = 0; i < 12; i++) -+ for (i = 0; i < 12; i++) - { - size_t width = curr_max_width; - -@@ -2053,6 +2054,7 @@ decode_switches (int argc, char **argv) - sizeof (*time_style_types)); - if (res < 0) - { -+ char const *const *p; - /* This whole block used to be a simple use of XARGMATCH. - but that didn't print the "posix-"-prefixed variants or - the "+"-prefixed format string option upon failure. */ -@@ -2064,7 +2066,7 @@ decode_switches (int argc, char **argv) - only because all four existing time_style_types values - are distinct. */ - fputs (_("Valid arguments are:\n"), stderr); -- char const *const *p = time_style_args; -+ p = time_style_args; - while (*p) - fprintf (stderr, " - [posix-]%s\n", *p++); - fputs (_(" - +FORMAT (e.g., +%H:%M) for a 'date'-style" -@@ -2334,6 +2336,7 @@ parse_ls_color (void) - int ind_no; /* Indicator number */ - char label[3]; /* Indicator label */ - struct color_ext_type *ext; /* Extension we are working on */ -+ enum parse_state state; - - if ((p = getenv ("LS_COLORS")) == NULL || *p == '\0') - return; -@@ -2347,7 +2350,7 @@ parse_ls_color (void) - advance. */ - buf = color_buf = xstrdup (p); - -- enum parse_state state = PS_START; -+ state = PS_START; - while (true) - { - switch (state) -@@ -2812,13 +2815,14 @@ getfilecon_cache (char const *file, struct fileinfo *f, bool deref) - /* st_dev of the most recently processed device for which we've - found that [l]getfilecon fails indicating lack of support. */ - static dev_t unsupported_device; -+ int r; - - if (f->stat.st_dev == unsupported_device) - { - errno = ENOTSUP; - return -1; - } -- int r = 0; -+ r = 0; - #ifdef HAVE_SMACK - if (is_smack_enabled ()) - r = smack_new_label_from_path (file, "security.SMACK64", deref, -@@ -2842,6 +2846,7 @@ file_has_acl_cache (char const *file, struct fileinfo *f) - /* st_dev of the most recently processed device for which we've - found that file_has_acl fails indicating lack of support. */ - static dev_t unsupported_device; -+ int n; - - if (f->stat.st_dev == unsupported_device) - { -@@ -2852,7 +2857,7 @@ file_has_acl_cache (char const *file, struct fileinfo *f) - /* Zero errno so that we can distinguish between two 0-returning cases: - "has-ACL-support, but only a default ACL" and "no ACL support". */ - errno = 0; -- int n = file_has_acl (file, &f->stat); -+ n = file_has_acl (file, &f->stat); - if (n <= 0 && errno_unsupported (errno)) - unsupported_device = f->stat.st_dev; - return n; -@@ -2867,6 +2872,7 @@ has_capability_cache (char const *file, struct fileinfo *f) - /* st_dev of the most recently processed device for which we've - found that has_capability fails indicating lack of support. */ - static dev_t unsupported_device; -+ bool b; - - if (f->stat.st_dev == unsupported_device) - { -@@ -2874,7 +2880,7 @@ has_capability_cache (char const *file, struct fileinfo *f) - return 0; - } - -- bool b = has_capability (file); -+ b = has_capability (file); - if ( !b && errno_unsupported (errno)) - unsupported_device = f->stat.st_dev; - return b; -@@ -3064,9 +3070,10 @@ gobble_file (char const *name, enum filetype type, ino_t inode, - && (format == long_format || check_symlink_color)) - { - struct stat linkstats; -+ char *linkname; - - get_link_name (absolute_name, f, command_line_arg); -- char *linkname = make_link_name (absolute_name, f->linkname); -+ linkname = make_link_name (absolute_name, f->linkname); - - /* Avoid following symbolic links when possible, ie, when - they won't be traced and when no indicator is needed. */ -@@ -3220,6 +3227,8 @@ get_link_name (char const *filename, struct fileinfo *f, bool command_line_arg) - static char * - make_link_name (char const *name, char const *linkname) - { -+ char *p; -+ size_t prefix_len; - if (!linkname) - return NULL; - -@@ -3228,11 +3237,11 @@ make_link_name (char const *name, char const *linkname) - - /* The link is to a relative name. Prepend any leading directory - in 'name' to the link name. */ -- size_t prefix_len = dir_len (name); -+ prefix_len = dir_len (name); - if (prefix_len == 0) - return xstrdup (linkname); - -- char *p = xmalloc (prefix_len + 1 + strlen (linkname) + 1); -+ p = xmalloc (prefix_len + 1 + strlen (linkname) + 1); - - /* PREFIX_LEN usually specifies a string not ending in slash. - In that case, extend it by one, since the next byte *is* a slash. -@@ -3634,6 +3643,7 @@ align_nstrftime (char *buf, size_t size, char const *fmt, struct tm const *tm, - the replacement is not done. A malloc here slows ls down by 2% */ - char rpl_fmt[sizeof (abmon[0]) + 100]; - const char *pb; -+ size_t ret; - if (required_mon_width && (pb = strstr (fmt, "%b"))) - { - if (strlen (fmt) < (sizeof (rpl_fmt) - sizeof (abmon[0]) + 2)) -@@ -3646,7 +3656,7 @@ align_nstrftime (char *buf, size_t size, char const *fmt, struct tm const *tm, - strcpy (pfmt, pb + 2); - } - } -- size_t ret = nstrftime (buf, size, nfmt, tm, __utc, __ns); -+ ret = nstrftime (buf, size, nfmt, tm, __utc, __ns); - return ret; - } - -@@ -3797,6 +3807,7 @@ print_long_format (const struct fileinfo *f) - char *p; - struct timespec when_timespec; - struct tm *when_local; -+ size_t w; - - /* Compute the mode string, except remove the trailing space if no - file in this directory has an ACL or SELinux security context. */ -@@ -3984,7 +3995,7 @@ print_long_format (const struct fileinfo *f) - } - - DIRED_FPUTS (buf, stdout, p - buf); -- size_t w = print_name_with_quoting (f, false, &dired_obstack, p - buf); -+ w = print_name_with_quoting (f, false, &dired_obstack, p - buf); - - if (f->filetype == symbolic_link) - { -@@ -4172,6 +4183,7 @@ print_name_with_quoting (const struct fileinfo *f, - struct obstack *stack, - size_t start_col) - { -+ size_t width; - const char* name = symlink_target ? f->linkname : f->name; - - bool used_color_this_time -@@ -4182,7 +4194,7 @@ print_name_with_quoting (const struct fileinfo *f, - if (stack) - PUSH_CURRENT_DIRED_POS (stack); - -- size_t width = quote_name (stdout, name, filename_quoting_options, NULL); -+ width = quote_name (stdout, name, filename_quoting_options, NULL); - dired_pos += width; - - if (stack) -@@ -4219,6 +4231,7 @@ prep_non_filename_text (void) - static size_t - print_file_name_and_frills (const struct fileinfo *f, size_t start_col) - { -+ size_t width; - char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))]; - - set_normal_color (); -@@ -4236,7 +4249,7 @@ print_file_name_and_frills (const struct fileinfo *f, size_t start_col) - if (print_scontext) - printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext); - -- size_t width = print_name_with_quoting (f, false, NULL, start_col); -+ width = print_name_with_quoting (f, false, NULL, start_col); - - if (indicator_style != none) - width += print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype); -diff --git a/src/md5sum.c b/src/md5sum.c -index ee2bbb7..b4ad49f 100644 ---- a/src/md5sum.c -+++ b/src/md5sum.c -@@ -230,8 +230,9 @@ static char * - filename_unescape (char *s, size_t s_len) - { - char *dst = s; -+ size_t i; - -- for (size_t i = 0; i < s_len; i++) -+ for (i = 0; i < s_len; i++) - { - switch (s[i]) - { -@@ -835,6 +836,7 @@ main (int argc, char **argv) - containing '\\' characters, we decided to not simplify the - output in this case. */ - bool needs_escape = strchr (file, '\\') || strchr (file, '\n'); -+ size_t i; - - if (prefix_tag) - { -@@ -847,7 +849,6 @@ main (int argc, char **argv) - fputs (") = ", stdout); - } - -- size_t i; - - /* Output a leading backslash if the file name contains - a newline or backslash. */ -diff --git a/src/mkdir.c b/src/mkdir.c -index adc2930..79e4602 100644 ---- a/src/mkdir.c -+++ b/src/mkdir.c -@@ -117,17 +117,19 @@ static int - make_ancestor (char const *dir, char const *component, void *options) - { - struct mkdir_options const *o = options; -- -+ mode_t user_wx = S_IWUSR | S_IXUSR; -+ bool self_denying_umask; -+ int r; -+ - if (o->set_security_context && defaultcon (dir, S_IFDIR) < 0 - && ! ignorable_ctx_err (errno)) - error (0, errno, _("failed to set default creation context for %s"), - quote (dir)); - -- mode_t user_wx = S_IWUSR | S_IXUSR; -- bool self_denying_umask = (o->umask_value & user_wx) != 0; -+ self_denying_umask = (o->umask_value & user_wx) != 0; - if (self_denying_umask) - umask (o->umask_value & ~user_wx); -- int r = mkdir (component, S_IRWXUGO); -+ r = mkdir (component, S_IRWXUGO); - if (self_denying_umask) - { - int mkdir_errno = errno; -@@ -148,6 +150,7 @@ process_dir (char *dir, struct savewd *wd, void *options) - { - struct mkdir_options const *o = options; - bool set_defaultcon = false; -+ int ret; - - /* If possible set context before DIR created. */ - if (o->set_security_context) -@@ -169,7 +172,7 @@ process_dir (char *dir, struct savewd *wd, void *options) - quote (dir)); - } - -- int ret = (make_dir_parents (dir, wd, o->make_ancestor_function, options, -+ ret = (make_dir_parents (dir, wd, o->make_ancestor_function, options, - o->mode, announce_mkdir, - o->mode_bits, (uid_t) -1, (gid_t) -1, true) - ? EXIT_SUCCESS -diff --git a/src/nproc.c b/src/nproc.c -index 5bd6610..cc980e2 100644 ---- a/src/nproc.c -+++ b/src/nproc.c -@@ -76,6 +76,7 @@ int - main (int argc, char **argv) - { - unsigned long nproc, ignore = 0; -+ enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE; - initialize_main (&argc, &argv); - set_program_name (argv[0]); - setlocale (LC_ALL, ""); -@@ -84,8 +85,7 @@ main (int argc, char **argv) - - atexit (close_stdout); - -- enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE; -- -+ - while (1) - { - int c = getopt_long (argc, argv, "", longopts, NULL); -diff --git a/src/numfmt.c b/src/numfmt.c -index 339c79f..fc67ade 100644 ---- a/src/numfmt.c -+++ b/src/numfmt.c -@@ -538,9 +538,11 @@ simple_strtod_float (const char *input_str, - char *ptr2; - long double val_frac = 0; - bool neg_frac; -+ size_t exponent; -+ enum simple_strtod_error e2; - - (*endptr) += decimal_point_length; -- enum simple_strtod_error e2 = -+ e2 = - simple_strtod_int (*endptr, &ptr2, &val_frac, &neg_frac); - if (e2 != SSE_OK && e2 != SSE_OK_PRECISION_LOSS) - return e2; -@@ -550,7 +552,7 @@ simple_strtod_float (const char *input_str, - return SSE_INVALID_NUMBER; - - /* number of digits in the fractions. */ -- size_t exponent = ptr2 - *endptr; -+ exponent = ptr2 - *endptr; - - val_frac = ((long double) val_frac) / powerld (10, exponent); - -@@ -597,12 +599,14 @@ simple_strtod_human (const char *input_str, - int power = 0; - /* 'scale_auto' is checked below. */ - int scale_base = default_scale_base (allowed_scaling); -+ enum simple_strtod_error e; -+ long double multiplier; - - devmsg ("simple_strtod_human:\n input string: %s\n " - "locale decimal-point: %s\n", - quote_n (0, input_str), quote_n (1, decimal_point)); - -- enum simple_strtod_error e = -+ e = - simple_strtod_float (input_str, endptr, value, precision); - if (e != SSE_OK && e != SSE_OK_PRECISION_LOSS) - return e; -@@ -648,7 +652,7 @@ simple_strtod_human (const char *input_str, - return SSE_MISSING_I_SUFFIX; - } - -- long double multiplier = powerld (scale_base, power); -+ multiplier = powerld (scale_base, power); - - devmsg (" suffix power=%d^%d = %Lf\n", scale_base, power, multiplier); - -@@ -705,10 +709,15 @@ double_to_human (long double val, int precision, - char *buf, size_t buf_size, - enum scale_type scale, int group, enum round_type round) - { -+ double scale_base; -+ unsigned int power; -+ int ten_or_less = 0; -+ int show_decimal_point; - devmsg ("double_to_human:\n"); - - if (scale == scale_none) - { -+ int i; - val *= powerld (10, precision); - val = simple_round (val, round); - val /= powerld (10, precision); -@@ -717,7 +726,7 @@ double_to_human (long double val, int precision, - " no scaling, returning (grouped) value: %'.*Lf\n" : - " no scaling, returning value: %.*Lf\n", precision, val); - -- int i = snprintf (buf, buf_size, (group) ? "%'.*Lf" : "%.*Lf", -+ i = snprintf (buf, buf_size, (group) ? "%'.*Lf" : "%.*Lf", - precision, val); - if (i < 0 || i >= (int) buf_size) - error (EXIT_FAILURE, 0, -@@ -726,15 +735,14 @@ double_to_human (long double val, int precision, - } - - /* Scaling requested by user. */ -- double scale_base = default_scale_base (scale); -+ scale_base = default_scale_base (scale); - - /* Normalize val to scale. */ -- unsigned int power = 0; -+ power = 0; - val = expld (val, scale_base, &power); - devmsg (" scaled value to %Lf * %0.f ^ %d\n", val, scale_base, power); - - /* Perform rounding. */ -- int ten_or_less = 0; - if (absld (val) < 10) - { - /* for values less than 10, we allow one decimal-point digit, -@@ -756,7 +764,7 @@ double_to_human (long double val, int precision, - - /* should "7.0" be printed as "7" ? - if removing the ".0" is preferred, enable the fourth condition. */ -- int show_decimal_point = (val != 0) && (absld (val) < 10) && (power > 0); -+ show_decimal_point = (val != 0) && (absld (val) < 10) && (power > 0); - /* && (absld (val) > simple_round_floor (val))) */ - - devmsg (" after rounding, value=%Lf * %0.f ^ %d\n", val, scale_base, power); -@@ -1146,6 +1154,10 @@ print_padded_number (void) - static int - process_suffixed_number (char *text, long double *result, size_t *precision) - { -+ char *p; -+ long double val = 0; -+ enum simple_strtod_error e; -+ const unsigned int skip_count; - if (suffix && strlen (text) > strlen (suffix)) - { - char *possible_suffix = text + strlen (text) - strlen (suffix); -@@ -1161,10 +1173,10 @@ process_suffixed_number (char *text, long double *result, size_t *precision) - } - - /* Skip white space - always. */ -- char *p = text; -+ p = text; - while (*p && isblank (*p)) - ++p; -- const unsigned int skip_count = text - p; -+ skip_count = text - p; - - /* setup auto-padding. */ - if (auto_padding) -@@ -1181,8 +1193,7 @@ process_suffixed_number (char *text, long double *result, size_t *precision) - devmsg ("setting Auto-Padding to %ld characters\n", padding_width); - } - -- long double val = 0; -- enum simple_strtod_error e = parse_human_number (p, &val, precision); -+ e = parse_human_number (p, &val, precision); - if (e == SSE_OK_PRECISION_LOSS && debug) - error (0, 0, _("large input value %s: possible precision loss"), - quote (p)); -@@ -1339,6 +1350,7 @@ int - main (int argc, char **argv) - { - int valid_numbers = 1; -+ int exit_status; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1527,7 +1539,7 @@ main (int argc, char **argv) - if (debug && !valid_numbers) - error (0, 0, _("failed to convert some of the input numbers")); - -- int exit_status = EXIT_SUCCESS; -+ exit_status = EXIT_SUCCESS; - if (!valid_numbers && _invalid != inval_warn && _invalid != inval_ignore) - exit_status = EXIT_CONVERSION_WARNINGS; - -diff --git a/src/realpath.c b/src/realpath.c -index 233b98f..d76ef52 100644 ---- a/src/realpath.c -+++ b/src/realpath.c -@@ -101,8 +101,9 @@ realpath_canon (const char *fname, int can_mode) - char *can_fname = canonicalize_filename_mode (fname, can_mode); - if (logical && can_fname) /* canonicalize again to resolve symlinks. */ - { -+ char *can_fname2; - can_mode &= ~CAN_NOLINKS; -- char *can_fname2 = canonicalize_filename_mode (can_fname, can_mode); -+ can_fname2 = canonicalize_filename_mode (can_fname, can_mode); - free (can_fname); - return can_fname2; - } -@@ -176,6 +177,7 @@ main (int argc, char **argv) - int can_mode = CAN_ALL_BUT_LAST; - const char *relative_to = NULL; - const char *relative_base = NULL; -+ bool need_dir; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -240,7 +242,7 @@ main (int argc, char **argv) - if (relative_base && !relative_to) - relative_to = relative_base; - -- bool need_dir = (can_mode & CAN_MODE_MASK) == CAN_EXISTING; -+ need_dir = (can_mode & CAN_MODE_MASK) == CAN_EXISTING; - if (relative_to) - { - can_relative_to = realpath_canon (relative_to, can_mode); -diff --git a/src/relpath.c b/src/relpath.c -index 5a93afe..1042b90 100644 ---- a/src/relpath.c -+++ b/src/relpath.c -@@ -88,14 +88,16 @@ bool - relpath (const char *can_fname, const char *can_reldir, char *buf, size_t len) - { - bool buf_err = false; -+ const char *relto_suffix; -+ const char *fname_suffix; - - /* Skip the prefix common to --relative-to and path. */ - int common_index = path_common_prefix (can_reldir, can_fname); - if (!common_index) - return false; - -- const char *relto_suffix = can_reldir + common_index; -- const char *fname_suffix = can_fname + common_index; -+ relto_suffix = can_reldir + common_index; -+ fname_suffix = can_fname + common_index; - - /* Skip over extraneous '/'. */ - if (*relto_suffix == '/') -diff --git a/src/remove.c b/src/remove.c -index 3d386cf..eefbcbb 100644 ---- a/src/remove.c -+++ b/src/remove.c -@@ -180,17 +180,20 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - int fd_cwd = fts->fts_cwd_fd; - char const *full_name = ent->fts_path; - char const *filename = ent->fts_accpath; -+ struct stat st; -+ struct stat *sbuf; -+ int dirent_type; -+ int write_protected = 0; -+ bool is_empty = false; -+ int wp_errno = 0; - if (is_empty_p) - *is_empty_p = T_UNKNOWN; - -- struct stat st; -- struct stat *sbuf = &st; -+ sbuf = &st; - cache_stat_init (sbuf); - -- int dirent_type = is_dir ? DT_DIR : DT_UNKNOWN; -- int write_protected = 0; -- -- bool is_empty = false; -+ dirent_type = is_dir ? DT_DIR : DT_UNKNOWN; -+ - if (is_empty_p) - { - is_empty = is_empty_dir (fd_cwd, filename); -@@ -206,7 +209,6 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - if (x->interactive == RMI_NEVER) - return RM_OK; - -- int wp_errno = 0; - if (!x->ignore_missing_files - && ((x->interactive == RMI_ALWAYS) || x->stdin_tty) - && dirent_type != DT_LNK) -@@ -217,6 +219,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - - if (write_protected || x->interactive == RMI_ALWAYS) - { -+ char const *quoted_name; - if (0 <= write_protected && dirent_type == DT_UNKNOWN) - { - if (cache_fstatat (fd_cwd, filename, sbuf, AT_SYMLINK_NOFOLLOW) == 0) -@@ -256,7 +259,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - break; - } - -- char const *quoted_name = quote (full_name); -+ quoted_name = quote (full_name); - - if (write_protected < 0) - { -@@ -492,6 +495,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) - case FTS_NSOK: /* e.g., dangling symlink */ - case FTS_DEFAULT: /* none of the above */ - { -+ bool is_dir; -+ enum RM_status s; - /* With --one-file-system, do not attempt to remove a mount point. - fts' FTS_XDEV ensures that we don't process any entries under - the mount point. */ -@@ -506,8 +511,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) - return RM_ERROR; - } - -- bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR; -- enum RM_status s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL); -+ is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR; -+ s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL); - if (s != RM_OK) - return s; - return excise (fts, ent, x, is_dir); -@@ -548,15 +553,17 @@ rm (char *const *file, struct rm_options const *x) - int bit_flags = (FTS_CWDFD - | FTS_NOSTAT - | FTS_PHYSICAL); -+ FTS *fts; - - if (x->one_file_system) - bit_flags |= FTS_XDEV; - -- FTS *fts = xfts_open (file, bit_flags, NULL); -+ fts = xfts_open (file, bit_flags, NULL); - - while (1) - { - FTSENT *ent; -+ enum RM_status s; - - ent = fts_read (fts); - if (ent == NULL) -@@ -569,7 +576,7 @@ rm (char *const *file, struct rm_options const *x) - break; - } - -- enum RM_status s = rm_fts (fts, ent, x); -+ s = rm_fts (fts, ent, x); - - assert (VALID_STATUS (s)); - UPDATE_STATUS (rm_status, s); -diff --git a/src/rm.c b/src/rm.c -index 7a51eef..27cef70 100644 ---- a/src/rm.c -+++ b/src/rm.c -@@ -209,6 +209,9 @@ main (int argc, char **argv) - struct rm_options x; - bool prompt_once = false; - int c; -+ size_t n_files; -+ char **file; -+ enum RM_status status; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -332,8 +335,8 @@ main (int argc, char **argv) - quote ("/")); - } - -- size_t n_files = argc - optind; -- char **file = argv + optind; -+ n_files = argc - optind; -+ file = argv + optind; - - if (prompt_once && (x.recursive || 3 < n_files)) - { -@@ -350,7 +353,7 @@ main (int argc, char **argv) - exit (EXIT_SUCCESS); - } - -- enum RM_status status = rm (file, &x); -+ status = rm (file, &x); - assert (VALID_STATUS (status)); - exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS); - } -diff --git a/src/seq.c b/src/seq.c -index 35dfc8b..0cf99bb 100644 ---- a/src/seq.c -+++ b/src/seq.c -@@ -153,6 +153,7 @@ scan_arg (const char *arg) - if (! arg[strcspn (arg, "xX")] && isfinite (ret.value)) - { - char const *decimal_point = strchr (arg, '.'); -+ char const *e; - if (! decimal_point) - ret.precision = 0; - else -@@ -165,7 +166,7 @@ scan_arg (const char *arg) - : (decimal_point == arg /* .# -> 0.# */ - || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */ - } -- char const *e = strchr (arg, 'e'); -+ e = strchr (arg, 'e'); - if (! e) - e = strchr (arg, 'E'); - if (e) -@@ -330,6 +331,7 @@ get_default_format (operand first, operand step, operand last) - { - if (equal_width) - { -+ size_t width; - /* increase first_width by any increased precision in step */ - size_t first_width = first.width + (prec - first.precision); - /* adjust last_width to use precision from first/step */ -@@ -340,7 +342,7 @@ get_default_format (operand first, operand step, operand last) - last_width++; /* include space for '.' */ - if (first.precision == 0 && prec) - first_width++; /* include space for '.' */ -- size_t width = MAX (first_width, last_width); -+ width = MAX (first_width, last_width); - if (width <= INT_MAX) - { - int w = width; -@@ -411,20 +413,23 @@ trim_leading_zeros (char const *s) - static bool - seq_fast (char const *a, char const *b) - { -+ size_t p_len, q_len, n; -+ char *p0, *p, *q0, *q; -+ bool ok; - /* Skip past any leading 0's. Without this, our naive cmp - function would declare 000 to be larger than 99. */ - a = trim_leading_zeros (a); - b = trim_leading_zeros (b); - -- size_t p_len = strlen (a); -- size_t q_len = strlen (b); -- size_t n = MAX (p_len, q_len); -- char *p0 = xmalloc (n + 1); -- char *p = memcpy (p0 + n - p_len, a, p_len + 1); -- char *q0 = xmalloc (n + 1); -- char *q = memcpy (q0 + n - q_len, b, q_len + 1); -+ p_len = strlen (a); -+ q_len = strlen (b); -+ n = MAX (p_len, q_len); -+ p0 = xmalloc (n + 1); -+ p = memcpy (p0 + n - p_len, a, p_len + 1); -+ q0 = xmalloc (n + 1); -+ q = memcpy (q0 + n - q_len, b, q_len + 1); - -- bool ok = cmp (p, p_len, q, q_len) <= 0; -+ ok = cmp (p, p_len, q, q_len) <= 0; - if (ok) - { - /* Buffer at least this many numbers per fwrite call. -@@ -485,6 +490,7 @@ main (int argc, char **argv) - - /* The printf(3) format used for output. */ - char const *format_str = NULL; -+ unsigned int n_args; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -536,7 +542,7 @@ main (int argc, char **argv) - } - } - -- unsigned int n_args = argc - optind; -+ n_args = argc - optind; - if (n_args < 1) - { - error (0, 0, _("missing operand")); -diff --git a/src/shred.c b/src/shred.c -index 6f5b4da..701de0e 100644 ---- a/src/shred.c -+++ b/src/shred.c -@@ -251,11 +251,12 @@ to be recovered later.\n\ - static bool - periodic_pattern (int type) - { -+ unsigned char r[3]; -+ unsigned int bits; - if (type <= 0) - return false; - -- unsigned char r[3]; -- unsigned int bits = type & 0xfff; -+ bits = type & 0xfff; - - bits |= bits << 12; - r[0] = (bits >> 4) & 255; -@@ -400,33 +401,38 @@ dopass (int fd, char const *qname, off_t *sizep, int type, - size_t lim; /* Amount of data to try writing */ - size_t soff; /* Offset into buffer for next write */ - ssize_t ssize; /* Return value from write */ -+ size_t page_size; -+ size_t output_size; -+ void *fill_pattern_mem; -+ unsigned char *pbuf; -+ -+ char pass_string[PASS_NAME_SIZE]; /* Name of current pass */ -+ bool write_error = false; -+ bool other_error = false; -+ bool tried_without_directio = false; -+ -+ /* Printable previous offset into the file */ -+ char previous_offset_buf[LONGEST_HUMAN_READABLE + 1]; -+ char const *previous_human_offset IF_LINT ( = 0); - - /* Do nothing for --size=0 or regular empty files with --exact. */ - if (size == 0) - return 0; - - /* Fill pattern buffer. Aligning it to a page so we can do direct I/O. */ -- size_t page_size = getpagesize (); -+ page_size = getpagesize (); - #define PERIODIC_OUTPUT_SIZE (60 * 1024) - #define NONPERIODIC_OUTPUT_SIZE (64 * 1024) - verify (PERIODIC_OUTPUT_SIZE % 3 == 0); -- size_t output_size = periodic_pattern (type) -+ output_size = periodic_pattern (type) - ? PERIODIC_OUTPUT_SIZE : NONPERIODIC_OUTPUT_SIZE; - #define PAGE_ALIGN_SLOP (page_size - 1) /* So directio works */ - #define FILLPATTERN_SIZE (((output_size + 2) / 3) * 3) /* Multiple of 3 */ - #define PATTERNBUF_SIZE (PAGE_ALIGN_SLOP + FILLPATTERN_SIZE) -- void *fill_pattern_mem = xmalloc (PATTERNBUF_SIZE); -- unsigned char *pbuf = ptr_align (fill_pattern_mem, page_size); -- -- char pass_string[PASS_NAME_SIZE]; /* Name of current pass */ -- bool write_error = false; -- bool other_error = false; -- bool tried_without_directio = false; -- -- /* Printable previous offset into the file */ -- char previous_offset_buf[LONGEST_HUMAN_READABLE + 1]; -- char const *previous_human_offset IF_LINT ( = 0); -+ fill_pattern_mem = xmalloc (PATTERNBUF_SIZE); -+ pbuf = ptr_align (fill_pattern_mem, page_size); - -+ - if (lseek (fd, 0, SEEK_SET) == -1) - { - error (0, errno, _("%s: cannot rewind"), qname); -@@ -457,6 +463,7 @@ dopass (int fd, char const *qname, off_t *sizep, int type, - offset = 0; - while (true) - { -+ bool done; - /* How much to write this time? */ - lim = output_size; - if (0 <= size && size - offset < output_size) -@@ -536,7 +543,7 @@ dopass (int fd, char const *qname, off_t *sizep, int type, - - offset += soff; - -- bool done = offset == size; -+ done = offset == size; - - /* Time to print progress? */ - if (n && ((done && *previous_human_offset) -diff --git a/src/shuf.c b/src/shuf.c -index 456140f..e1bbe5d 100644 ---- a/src/shuf.c -+++ b/src/shuf.c -@@ -150,6 +150,7 @@ static off_t - input_size (void) - { - off_t file_size; -+ off_t input_offset; - - struct stat stat_buf; - if (fstat (STDIN_FILENO, &stat_buf) != 0) -@@ -159,7 +160,7 @@ input_size (void) - else - return OFF_T_MAX; - -- off_t input_offset = lseek (STDIN_FILENO, 0, SEEK_CUR); -+ input_offset = lseek (STDIN_FILENO, 0, SEEK_CUR); - if (input_offset < 0) - return OFF_T_MAX; - -diff --git a/src/sort.c b/src/sort.c -index 573d6cb..392da25 100644 ---- a/src/sort.c -+++ b/src/sort.c -@@ -764,9 +764,10 @@ static bool - delete_proc (pid_t pid) - { - struct tempnode test; -+ struct tempnode *node; - - test.pid = pid; -- struct tempnode *node = hash_delete (proctab, &test); -+ node = hash_delete (proctab, &test); - if (! node) - return false; - node->state = REAPED; -@@ -1162,6 +1163,7 @@ open_temp (struct tempnode *temp) - { - int tempfd, pipefds[2]; - FILE *fp = NULL; -+ pid_t child; - - if (temp->state == UNREAPED) - wait_proc (temp->pid); -@@ -1170,7 +1172,7 @@ open_temp (struct tempnode *temp) - if (tempfd < 0) - return NULL; - -- pid_t child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS); -+ child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS); - - switch (child) - { -@@ -1446,6 +1448,7 @@ specify_nthreads (int oi, char c, char const *s) - static size_t - default_sort_size (void) - { -+ double avail, total, mem; - /* Let SIZE be MEM, but no more than the maximum object size, - total memory, or system resource limits. Don't bother to check - for values like RLIM_INFINITY since in practice they are not much -@@ -1472,9 +1475,9 @@ default_sort_size (void) - - /* Let MEM be available memory or 1/8 of total memory, whichever - is greater. */ -- double avail = physmem_available (); -- double total = physmem_total (); -- double mem = MAX (avail, total / 8); -+ avail = physmem_available (); -+ total = physmem_total (); -+ mem = MAX (avail, total / 8); - - /* Leave a 1/4 margin for physical memory. */ - if (total * 0.75 < size) -@@ -1931,12 +1934,13 @@ find_unit_order (char const *number) - static int - human_numcompare (char const *a, char const *b) - { -+ int diff; - while (blanks[to_uchar (*a)]) - a++; - while (blanks[to_uchar (*b)]) - b++; - -- int diff = find_unit_order (a) - find_unit_order (b); -+ diff = find_unit_order (a) - find_unit_order (b); - return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep)); - } - -@@ -1963,10 +1967,10 @@ static int - nan_compare (char const *sa, char const *sb) - { - long_double a; -+ long_double b; - memset (&a, 0, sizeof a); - a = strtold (sa, NULL); - -- long_double b; - memset (&b, 0, sizeof b); - b = strtold (sb, NULL); - -@@ -2068,9 +2072,9 @@ random_md5_state_init (char const *random_source) - static size_t - xstrxfrm (char *restrict dest, char const *restrict src, size_t destsize) - { -- errno = 0; - size_t translated_size = strxfrm (dest, src, destsize); -- -+ errno = 0; -+ - if (errno) - { - error (0, errno, _("string transformation failed")); -@@ -2103,6 +2107,7 @@ compare_random (char *restrict texta, size_t lena, - void *allocated = NULL; - uint32_t dig[2][MD5_DIGEST_SIZE / sizeof (uint32_t)]; - struct md5_ctx s[2]; -+ int diff; - s[0] = s[1] = random_md5_state; - - if (hard_LC_COLLATE) -@@ -2128,6 +2133,8 @@ compare_random (char *restrict texta, size_t lena, - twice on typical implementations. Don't worry about - size_t overflow, as the guess need not be correct. */ - size_t guess_bufsize = 3 * (lena + lenb) + 2; -+ size_t sizea, sizeb; -+ bool a_fits; - if (bufsize < guess_bufsize) - { - bufsize = MAX (guess_bufsize, bufsize * 3 / 2); -@@ -2140,10 +2147,10 @@ compare_random (char *restrict texta, size_t lena, - } - } - -- size_t sizea = -+ sizea = - (texta < lima ? xstrxfrm (buf, texta, bufsize) + 1 : 0); -- bool a_fits = sizea <= bufsize; -- size_t sizeb = -+ a_fits = sizea <= bufsize; -+ sizeb = - (textb < limb - ? (xstrxfrm ((a_fits ? buf + sizea : NULL), textb, - (a_fits ? bufsize - sizea : 0)) -@@ -2196,7 +2203,7 @@ compare_random (char *restrict texta, size_t lena, - /* Compute and compare the checksums. */ - md5_process_bytes (texta, lena, &s[0]); md5_finish_ctx (&s[0], dig[0]); - md5_process_bytes (textb, lenb, &s[1]); md5_finish_ctx (&s[1], dig[1]); -- int diff = memcmp (dig[0], dig[1], sizeof dig[0]); -+ diff = memcmp (dig[0], dig[1], sizeof dig[0]); - - /* Fall back on the tiebreaker if the checksums collide. */ - if (! diff) -@@ -2267,6 +2274,7 @@ debug_key (struct line const *line, struct keyfield const *key) - char *text = line->text; - char *beg = text; - char *lim = text + line->length - 1; -+ size_t offset, width; - - if (key) - { -@@ -2278,12 +2286,13 @@ debug_key (struct line const *line, struct keyfield const *key) - if (key->skipsblanks || key->month || key_numeric (key)) - { - char saved = *lim; -+ char *tighter_lim; - *lim = '\0'; - - while (blanks[to_uchar (*beg)]) - beg++; - -- char *tighter_lim = beg; -+ tighter_lim = beg; - - if (lim < beg) - tighter_lim = lim; -@@ -2319,8 +2328,8 @@ debug_key (struct line const *line, struct keyfield const *key) - } - } - -- size_t offset = debug_width (text, beg); -- size_t width = debug_width (beg, lim); -+ offset = debug_width (text, beg); -+ width = debug_width (beg, lim); - mark_key (offset, width); - } - -@@ -2394,6 +2403,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) - - for (key = keylist; key; key = key->next, keynum++) - { -+ bool implicit_skip, maybe_space_aligned, line_offset; - if (key->obsolete_used) - { - size_t sword = key->sword; -@@ -2428,10 +2438,10 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) - error (0, 0, _("key %lu has zero width and will be ignored"), keynum); - - /* Warn about significant leading blanks. */ -- bool implicit_skip = key_numeric (key) || key->month; -- bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) -+ implicit_skip = key_numeric (key) || key->month; -+ maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) - && !(key->schar || key->echar); -- bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ -+ line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ - if (!gkey_only && tab == TAB_DEFAULT && !line_offset - && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) - || (!key->skipsblanks && key->schar) -@@ -2475,10 +2485,10 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) - || (ugkey.reverse && (stable || unique) && keylist)) - { - bool ugkey_reverse = ugkey.reverse; -+ char opts[sizeof short_options]; - if (!(stable || unique)) - ugkey.reverse = false; - /* The following is too big, but guaranteed to be "big enough". */ -- char opts[sizeof short_options]; - key_to_opts (&ugkey, opts); - error (0, 0, - ngettext ("option '-%s' is ignored", -@@ -2509,6 +2519,7 @@ keycompare (struct line const *a, struct line const *b) - - while (true) - { -+ size_t lena, lenb; - char const *translate = key->translate; - bool const *ignore = key->ignore; - -@@ -2517,8 +2528,8 @@ keycompare (struct line const *a, struct line const *b) - limb = MAX (textb, limb); - - /* Find the lengths. */ -- size_t lena = lima - texta; -- size_t lenb = limb - textb; -+ lena = lima - texta; -+ lenb = limb - textb; - - if (hard_LC_COLLATE || key_numeric (key) - || key->month || key->random || key->version) -@@ -3187,6 +3198,8 @@ sequential_sort (struct line *restrict lines, size_t nlines, - size_t nhi = nlines - nlo; - struct line *lo = lines; - struct line *hi = lines - nlo; -+ struct line *dest; -+ struct line const *sorted_lo; - - sequential_sort (hi, nhi, temp - (to_temp ? nlo : 0), to_temp); - if (1 < nlo) -@@ -3194,8 +3207,6 @@ sequential_sort (struct line *restrict lines, size_t nlines, - else if (!to_temp) - temp[-1] = lo[-1]; - -- struct line *dest; -- struct line const *sorted_lo; - if (to_temp) - { - dest = temp; -@@ -3822,6 +3833,8 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles, - while (true) - { - /* Merge directly into the output file if possible. */ -+ FILE *tfp; -+ struct tempnode *temp; - FILE **fps; - size_t nopened = open_input_files (files, nfiles, &fps); - -@@ -3844,8 +3857,6 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles, - file with our spare file descriptor. Retry if that failed - (e.g., some other process could open a file between the time - we closed and tried to create). */ -- FILE *tfp; -- struct tempnode *temp; - do - { - nopened--; -@@ -3874,10 +3885,10 @@ sort (char *const *files, size_t nfiles, char const *output_file, - size_t nthreads) - { - struct buffer buf; -- IF_LINT (buf.buf = NULL); - size_t ntemps = 0; - bool output_file_created = false; -- -+ IF_LINT (buf.buf = NULL); -+ - buf.alloc = 0; - - while (nfiles) -@@ -3942,10 +3953,12 @@ sort (char *const *files, size_t nfiles, char const *output_file, - if (1 < buf.nlines) - { - struct merge_node_queue queue; -+ struct merge_node *merge_tree; -+ struct merge_node *root; - queue_init (&queue, nthreads); -- struct merge_node *merge_tree = -+ merge_tree = - merge_tree_init (nthreads, buf.nlines, line); -- struct merge_node *root = merge_tree + 1; -+ root = merge_tree + 1; - - sortlines (line, nthreads, buf.nlines, root, - &queue, tfp, temp_output); -@@ -4722,6 +4735,7 @@ main (int argc, char **argv) - } - else - { -+ size_t nthreads_max; - if (!nthreads) - { - unsigned long int np = num_processors (NPROC_CURRENT_OVERRIDABLE); -@@ -4729,7 +4743,7 @@ main (int argc, char **argv) - } - - /* Avoid integer overflow later. */ -- size_t nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node)); -+ nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node)); - nthreads = MIN (nthreads, nthreads_max); - - sort (files, nfiles, outfile, nthreads); -diff --git a/src/split.c b/src/split.c -index f740652..e86668f 100644 ---- a/src/split.c -+++ b/src/split.c -@@ -309,14 +309,15 @@ new_name: - - if (numeric_suffix_start) - { -- assert (! widen); -- -+ size_t *sufindex_end; -+ - /* Update the output file name. */ - size_t i = strlen (numeric_suffix_start); -+ assert (! widen); - memcpy (outfile_mid + suffix_length - i, numeric_suffix_start, i); - - /* Update the suffix index. */ -- size_t *sufindex_end = sufindex + suffix_length; -+ sufindex_end = sufindex + suffix_length; - while (i-- != 0) - *--sufindex_end = numeric_suffix_start[i] - '0'; - } -@@ -362,13 +363,14 @@ create (const char *name) - { - if (!filter_command) - { -+ int fd; -+ struct stat out_stat_buf; - if (verbose) - fprintf (stdout, _("creating file %s\n"), quote (name)); - -- int fd = open (name, O_WRONLY | O_CREAT | O_BINARY, MODE_RW_UGO); -+ fd = open (name, O_WRONLY | O_CREAT | O_BINARY, MODE_RW_UGO); - if (fd < 0) - return fd; -- struct stat out_stat_buf; - if (fstat (fd, &out_stat_buf) != 0) - error (EXIT_FAILURE, errno, _("failed to stat %s"), quote (name)); - if (SAME_INODE (in_stat_buf, out_stat_buf)) -@@ -445,9 +447,9 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name) - error (EXIT_FAILURE, errno, "%s", name); - if (fd >= 0) - { -+ int j; - if (fp == NULL && close (fd) < 0) - error (EXIT_FAILURE, errno, "%s", name); -- int j; - for (j = 0; j < n_open_pipes; ++j) - { - if (open_pipes[j] == fd) -@@ -633,11 +635,13 @@ line_bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize) - - do - { -+ size_t n_left; -+ char *sob; - n_read = full_read (STDIN_FILENO, buf, bufsize); - if (n_read < bufsize && errno) - error (EXIT_FAILURE, errno, "%s", infile); -- size_t n_left = n_read; -- char *sob = buf; -+ n_left = n_read; -+ sob = buf; - while (n_left) - { - size_t split_rest = 0; -@@ -670,8 +674,8 @@ line_bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize) - /* Output to eol if present. */ - if (eol) - { -- split_line = true; - size_t n_write = eol - sob + 1; -+ split_line = true; - cwrite (n_out == 0, sob, n_write); - n_out += n_write; - n_left -= n_write; -@@ -739,8 +743,6 @@ static void - lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, - off_t file_size) - { -- assert (n && k <= n && n <= file_size); -- - const off_t chunk_size = file_size / n; - uintmax_t chunk_no = 1; - off_t chunk_end = chunk_size - 1; -@@ -748,6 +750,8 @@ lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, - bool new_file_flag = true; - bool chunk_truncated = false; - -+ assert (n && k <= n && n <= file_size); -+ - if (k > 1) - { - /* Start reading 1 byte before kth chunk of file. */ -@@ -1136,6 +1140,8 @@ main (int argc, char **argv) - int c; - int digits_optind = 0; - off_t file_size IF_LINT (= 0); -+ void *b; -+ char *buf; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1434,8 +1440,8 @@ main (int argc, char **argv) - file_size = MAX (file_size, n_units); - } - -- void *b = xmalloc (in_blk_size + 1 + page_size - 1); -- char *buf = ptr_align (b, page_size); -+ b = xmalloc (in_blk_size + 1 + page_size - 1); -+ buf = ptr_align (b, page_size); - - /* When filtering, closure of one pipe must not terminate the process, - as there may still be other streams expecting input from us. */ -diff --git a/src/stat.c b/src/stat.c -index ba491f4..c3e66f8 100644 ---- a/src/stat.c -+++ b/src/stat.c -@@ -604,6 +604,10 @@ out_epoch_sec (char *pformat, size_t prefix_len, - int width = 0; - int precision = 0; - bool frac_left_adjust = false; -+ int divisor = 1; -+ int frac_sec; -+ int int_len; -+ int i; - - if (dot) - { -@@ -625,6 +629,7 @@ out_epoch_sec (char *pformat, size_t prefix_len, - /* If a nontrivial width is given, subtract the width of the - decimal point and PRECISION digits that will be output - later. */ -+ long int lwidth; - char *p = dot; - *dot = '\0'; - -@@ -632,13 +637,14 @@ out_epoch_sec (char *pformat, size_t prefix_len, - --p; - while (ISDIGIT (p[-1])); - -- long int lwidth = strtol (p, NULL, 10); -+ lwidth = strtol (p, NULL, 10); - width = (lwidth <= INT_MAX ? lwidth : INT_MAX); - if (1 < width) - { -+ int w_d; - p += (*p == '0'); - sec_prefix_len = p - pformat; -- int w_d = (decimal_point_len < width -+ w_d = (decimal_point_len < width - ? width - decimal_point_len - : 0); - if (1 < w_d) -@@ -647,7 +653,8 @@ out_epoch_sec (char *pformat, size_t prefix_len, - if (1 < w) - { - char *dst = pformat; -- for (char const *src = dst; src < p; src++) -+ char const *src; -+ for (src = dst; src < p; src++) - { - if (*src == '-') - frac_left_adjust = true; -@@ -663,11 +670,9 @@ out_epoch_sec (char *pformat, size_t prefix_len, - } - } - -- int divisor = 1; -- for (int i = precision; i < 9; i++) -+ for (i = precision; i < 9; i++) - divisor *= 10; -- int frac_sec = arg.tv_nsec / divisor; -- int int_len; -+ frac_sec = arg.tv_nsec / divisor; - - if (TYPE_SIGNED (time_t)) - { -@@ -819,6 +824,7 @@ find_bind_mount (char const * name) - { - char const * bind_mount = NULL; - -+ struct mount_entry *me; - static struct mount_entry *mount_list; - static bool tried_mount_list = false; - if (!tried_mount_list) /* attempt/warn once per process. */ -@@ -828,7 +834,6 @@ find_bind_mount (char const * name) - tried_mount_list = true; - } - -- struct mount_entry *me; - for (me = mount_list; me; me = me->me_next) - { - if (me->me_dummy && me->me_devname[0] == '/' -@@ -903,9 +908,9 @@ print_mount_point: - static inline struct timespec - neg_to_zero (struct timespec ts) - { -+ struct timespec z = {0, 0}; - if (0 <= ts.tv_nsec) - return ts; -- struct timespec z = {0, 0}; - return z; - } - -@@ -1114,11 +1119,12 @@ print_it (char const *format, char const *filename, - { - size_t len = strspn (b + 1, printf_flags); - char const *fmt_char = b + len + 1; -+ unsigned int fmt_code; - fmt_char += strspn (fmt_char, digits); - if (*fmt_char == '.') - fmt_char += 1 + strspn (fmt_char + 1, digits); - len = fmt_char - (b + 1); -- unsigned int fmt_code = *fmt_char; -+ fmt_code = *fmt_char; - memcpy (dest, b, len + 1); - - b = fmt_char; -@@ -1206,6 +1212,7 @@ static bool ATTRIBUTE_WARN_UNUSED_RESULT - do_statfs (char const *filename, char const *format) - { - STRUCT_STATVFS statfsbuf; -+ bool fail; - - if (STREQ (filename, "-")) - { -@@ -1221,7 +1228,7 @@ do_statfs (char const *filename, char const *format) - return false; - } - -- bool fail = print_it (format, filename, print_statfs, &statfsbuf); -+ fail = print_it (format, filename, print_statfs, &statfsbuf); - return ! fail; - } - -@@ -1231,6 +1238,7 @@ do_stat (char const *filename, char const *format, - char const *format2) - { - struct stat statbuf; -+ bool fail; - - if (STREQ (filename, "-")) - { -@@ -1254,7 +1262,7 @@ do_stat (char const *filename, char const *format, - if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode)) - format = format2; - -- bool fail = print_it (format, filename, print_stat, &statbuf); -+ fail = print_it (format, filename, print_stat, &statbuf); - return ! fail; - } - -@@ -1455,14 +1463,14 @@ main (int argc, char *argv[]) - char *format = NULL; - char *format2; - bool ok = true; -- -+ struct lconv const *locale = localeconv (); -+ - initialize_main (&argc, &argv); - set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - -- struct lconv const *locale = localeconv (); - decimal_point = (locale->decimal_point[0] ? locale->decimal_point : "."); - decimal_point_len = strlen (decimal_point); - -diff --git a/src/system.h b/src/system.h -index 6b242a8..0715a96 100644 ---- a/src/system.h -+++ b/src/system.h -@@ -502,6 +502,7 @@ is_nul (void const *buf, size_t bufsize) - void const *vp; - char const *cbuf = buf; - word const *wp = buf; -+ char const *cp; - - /* Find first nonzero *word*, or the word with the sentinel. */ - while (*wp++ == 0) -@@ -509,7 +510,7 @@ is_nul (void const *buf, size_t bufsize) - - /* Find the first nonzero *byte*, or the sentinel. */ - vp = wp - 1; -- char const *cp = vp; -+ cp = vp; - while (*cp++ == 0) - continue; - -@@ -567,10 +568,11 @@ Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).\n\ - static inline void - emit_ancillary_info (void) - { -+ const char *lc_messages; - printf (_("\n%s online help: <%s>\n"), PACKAGE_NAME, PACKAGE_URL); - /* Don't output this redundant message for English locales. - Note we still output for 'C' so that it gets included in the man page. */ -- const char *lc_messages = setlocale (LC_MESSAGES, NULL); -+ lc_messages = setlocale (LC_MESSAGES, NULL); - if (lc_messages && STRNCMP_LIT (lc_messages, "en_")) - { - /* TRANSLATORS: Replace LANG_CODE in this URL with your language code -diff --git a/src/tac.c b/src/tac.c -index 5bf40a7..7e9cbef 100644 ---- a/src/tac.c -+++ b/src/tac.c -@@ -426,6 +426,7 @@ temp_stream (FILE **fp, char **file_name) - static FILE *tmp_fp; - if (tempfile == NULL) - { -+ int fd; - char const *t = getenv ("TMPDIR"); - char const *tempdir = t ? t : DEFAULT_TMPDIR; - tempfile = mfile_name_concat (tempdir, "tacXXXXXX", NULL); -@@ -444,7 +445,7 @@ temp_stream (FILE **fp, char **file_name) - FIXME: clean up upon fatal signal. Don't block them, in case - $TMPFILE is a remote file system. */ - -- int fd = mkstemp (tempfile); -+ fd = mkstemp (tempfile); - if (fd < 0) - { - error (0, errno, _("failed to create temporary file in %s"), -@@ -536,10 +537,11 @@ tac_nonseekable (int input_fd, const char *file) - { - FILE *tmp_stream; - char *tmp_file; -+ bool ok; - if (!copy_to_temp (&tmp_stream, &tmp_file, input_fd, file)) - return false; - -- bool ok = tac_seekable (fileno (tmp_stream), tmp_file); -+ ok = tac_seekable (fileno (tmp_stream), tmp_file); - return ok; - } - -diff --git a/src/tail.c b/src/tail.c -index dc4e10d..87b2d66 100644 ---- a/src/tail.c -+++ b/src/tail.c -@@ -844,6 +844,8 @@ start_lines (const char *pretty_filename, int fd, uintmax_t n_lines, - { - char buffer[BUFSIZ]; - size_t bytes_read = safe_read (fd, buffer, BUFSIZ); -+ char *buffer_end; -+ char *p; - if (bytes_read == 0) /* EOF */ - return -1; - if (bytes_read == SAFE_READ_ERROR) /* error */ -@@ -852,11 +854,11 @@ start_lines (const char *pretty_filename, int fd, uintmax_t n_lines, - return 1; - } - -- char *buffer_end = buffer + bytes_read; -+ buffer_end = buffer + bytes_read; - - *read_pos += bytes_read; - -- char *p = buffer; -+ p = buffer; - while ((p = memchr (p, '\n', buffer_end - p))) - { - ++p; -diff --git a/src/test.c b/src/test.c -index 2038209..45a1842 100644 ---- a/src/test.c -+++ b/src/test.c -@@ -420,23 +420,27 @@ unary_operator (void) - - case 'O': /* File is owned by you? */ - { -+ uid_t euid; -+ uid_t NO_UID; - unary_advance (); - if (stat (argv[pos - 1], &stat_buf) != 0) - return false; - errno = 0; -- uid_t euid = geteuid (); -- uid_t NO_UID = -1; -+ euid = geteuid (); -+ NO_UID = -1; - return ! (euid == NO_UID && errno) && euid == stat_buf.st_uid; - } - - case 'G': /* File is owned by your group? */ - { -+ gid_t egid; -+ gid_t NO_GID; - unary_advance (); - if (stat (argv[pos - 1], &stat_buf) != 0) - return false; - errno = 0; -- gid_t egid = getegid (); -- gid_t NO_GID = -1; -+ egid = getegid (); -+ NO_GID = -1; - return ! (egid == NO_GID && errno) && egid == stat_buf.st_gid; - } - -diff --git a/src/timeout.c b/src/timeout.c -index c8749d0..95f6e46 100644 ---- a/src/timeout.c -+++ b/src/timeout.c -@@ -133,6 +133,7 @@ settimeout (double duration, bool warn) - resolution provided by alarm(). */ - - #if HAVE_TIMER_SETTIME -+{ - struct timespec ts = dtotimespec (duration); - struct itimerspec its = { {0, 0}, ts }; - timer_t timerid; -@@ -149,8 +150,10 @@ settimeout (double duration, bool warn) - } - else if (warn && errno != ENOSYS) - error (0, errno, _("warning: timer_create")); -+} - #endif - -+{ - unsigned int timeint; - if (UINT_MAX <= duration) - timeint = UINT_MAX; -@@ -161,6 +164,7 @@ settimeout (double duration, bool warn) - } - alarm (timeint); - } -+} - - /* send SIG avoiding the current process. */ - -diff --git a/src/wc.c b/src/wc.c -index 93decd7..619f44c 100644 ---- a/src/wc.c -+++ b/src/wc.c -@@ -597,6 +597,9 @@ main (int argc, char **argv) - char *files_from = NULL; - struct fstatus *fstatus; - struct Tokens tok; -+ bool read_tokens = false; -+ struct argv_iterator *ai; -+ int i; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -653,10 +656,9 @@ main (int argc, char **argv) - || print_linelength)) - print_lines = print_words = print_bytes = true; - -- bool read_tokens = false; -- struct argv_iterator *ai; - if (files_from) - { -+ struct stat st; - FILE *stream; - - /* When using --files0-from=F, you may not specify any files -@@ -681,7 +683,6 @@ main (int argc, char **argv) - - /* Read the file list into RAM if we can detect its size and that - size is reasonable. Otherwise, we'll read a name at a time. */ -- struct stat st; - if (fstat (fileno (stream), &st) == 0 - && S_ISREG (st.st_mode) - && st.st_size <= MIN (10 * 1024 * 1024, physmem_available () / 2)) -@@ -716,7 +717,6 @@ main (int argc, char **argv) - fstatus = get_input_fstatus (nfiles, files); - number_width = compute_number_width (nfiles, fstatus); - -- int i; - ok = true; - for (i = 0; /* */; i++) - { --- -1.8.3.4 - diff --git a/sys-apps/coreutils/patches/coreutils-8.22.patchset b/sys-apps/coreutils/patches/coreutils-8.22.patchset deleted file mode 100644 index 49268ba54..000000000 --- a/sys-apps/coreutils/patches/coreutils-8.22.patchset +++ /dev/null @@ -1,256 +0,0 @@ -From b5e90c4656599710617ca6a24c750ef9f1c93b5f Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 16:20:12 +0000 -Subject: avoid warning on gcc 4.6+ - - -diff --git a/lib/fadvise.c b/lib/fadvise.c -index 8d3af99..f9e0f27 100644 ---- a/lib/fadvise.c -+++ b/lib/fadvise.c -@@ -14,6 +14,10 @@ - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNU_C__ -+# pragma GCC diagnostic ignored "-Wsuggest-attribute=const" -+#endif -+ - #include - #include "fadvise.h" - --- -1.8.3.4 - - -From 23a01facb7fd62c93e3df82a4302dca3aaee4944 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:18:52 +0000 -Subject: define __USE_GNU for wempcpy - - -diff --git a/lib/fnmatch.c b/lib/fnmatch.c -index 6a09e1a..a26b0ca 100644 ---- a/lib/fnmatch.c -+++ b/lib/fnmatch.c -@@ -21,6 +21,9 @@ - #ifndef _GNU_SOURCE - # define _GNU_SOURCE 1 - #endif -+#ifndef __USE_GNU -+# define __USE_GNU 1 -+#endif - - #if ! defined __builtin_expect && __GNUC__ < 3 - # define __builtin_expect(expr, expected) (expr) --- -1.8.3.4 - - -From a277df80f2d5dba4b4519a97ea9042fb56c9feb5 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:22:10 +0000 -Subject: force declaration of rpl_inet_ntop - - -diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h -index ba89e97..3be3941 100644 ---- a/lib/arpa_inet.in.h -+++ b/lib/arpa_inet.in.h -@@ -72,7 +72,7 @@ - - For more details, see the POSIX:2001 specification - . */ --# if @REPLACE_INET_NTOP@ -+# if 1 - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef inet_ntop - # define inet_ntop rpl_inet_ntop --- -1.8.3.4 - - -From e0b54fa2760209c59364a131cd7aced2f9958790 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:32:36 +0000 -Subject: Haiku defines mknod in unistd.h - - -diff --git a/lib/mknod.c b/lib/mknod.c -index 71e9d34..1dc218c 100644 ---- a/lib/mknod.c -+++ b/lib/mknod.c -@@ -18,6 +18,7 @@ - - #include - -+#include - #include - - #include --- -1.8.3.4 - - -From 45cd156446cd8ac305462f48b2e871fdddc39b93 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:35:25 +0000 -Subject: protect the label, not used on Haiku - - -diff --git a/lib/mountlist.c b/lib/mountlist.c -index b839cd1..c095a25 100644 ---- a/lib/mountlist.c -+++ b/lib/mountlist.c -@@ -953,7 +953,7 @@ read_file_system_list (bool need_fs_type) - *mtail = NULL; - return mount_list; - -- -+#ifndef __HAIKU__ - free_then_fail: - { - int saved_errno = errno; -@@ -969,6 +969,7 @@ read_file_system_list (bool need_fs_type) - errno = saved_errno; - return NULL; - } -+#endif - } - - /* Free a mount entry as returned from read_file_system_list (). */ --- -1.8.3.4 - - -From 0dcf7067f72fdb61b8ce4705dae4a6e82ac7542f Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:38:39 +0000 -Subject: protect a bool not used on Haiku - - -diff --git a/lib/rename.c b/lib/rename.c -index 3e463ea..8dff5d5 100644 ---- a/lib/rename.c -+++ b/lib/rename.c -@@ -285,7 +285,9 @@ rpl_rename (char const *src, char const *dst) - char *dst_temp = (char *) dst; - bool src_slash; - bool dst_slash; -+#if RENAME_DEST_EXISTS_BUG - bool dst_exists; -+#endif - int ret_val = -1; - int rename_errno = ENOTDIR; - struct stat src_st; -@@ -340,7 +342,9 @@ rpl_rename (char const *src, char const *dst) - { - if (errno != ENOENT || (!S_ISDIR (src_st.st_mode) && dst_slash)) - return -1; -+#if RENAME_DEST_EXISTS_BUG - dst_exists = false; -+#endif - } - else - { -@@ -353,7 +357,9 @@ rpl_rename (char const *src, char const *dst) - if (SAME_INODE (src_st, dst_st)) - return 0; - # endif /* RENAME_HARD_LINK_BUG */ -+#if RENAME_DEST_EXISTS_BUG - dst_exists = true; -+#endif - } - - # if (RENAME_TRAILING_SLASH_SOURCE_BUG || RENAME_DEST_EXISTS_BUG \ --- -1.8.3.4 - - -From c75141b2cf4726e9f83a2d415c3b1585360552cc Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 15 May 2014 15:40:32 +0000 -Subject: strchrnul needs __USE_GNU on Haiku - - -diff --git a/lib/regex.h b/lib/regex.h -index 854c6ed..86f16b8 100644 ---- a/lib/regex.h -+++ b/lib/regex.h -@@ -31,8 +31,10 @@ extern "C" { - /* Define __USE_GNU to declare GNU extensions that violate the - POSIX name space rules. */ - #ifdef _GNU_SOURCE -+#ifndef __USE_GNU - # define __USE_GNU 1 - #endif -+#endif - - #ifdef _REGEX_LARGE_OFFSETS - -diff --git a/lib/string.in.h b/lib/string.in.h -index d7a6c9c..729338d 100644 ---- a/lib/string.in.h -+++ b/lib/string.in.h -@@ -23,6 +23,9 @@ - @PRAGMA_COLUMNS@ - - /* The include_next requires a split double-inclusion guard. */ -+#ifndef __USE_GNU -+#define __USE_GNU -+#endif - #@INCLUDE_NEXT@ @NEXT_STRING_H@ - - #ifndef _@GUARD_PREFIX@_STRING_H --- -1.8.3.4 - - -From ab49c9e1edac815682126be26afd0b70d1e30f87 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 15 May 2014 20:13:58 +0000 -Subject: don't build hostid, uptime, nice, users, who, dd - - -diff --git a/Makefile.in b/Makefile.in -index dab25d0..3be1664 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -611,16 +611,15 @@ src_libver_a_LIBADD = - nodist_src_libver_a_OBJECTS = src/version.$(OBJEXT) - src_libver_a_OBJECTS = $(nodist_src_libver_a_OBJECTS) - am__EXEEXT_1 = src/arch$(EXEEXT) src/hostname$(EXEEXT) --am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) src/hostid$(EXEEXT) \ -- src/libstdbuf.so$(EXEEXT) src/nice$(EXEEXT) src/pinky$(EXEEXT) \ -- src/stdbuf$(EXEEXT) src/stty$(EXEEXT) src/uptime$(EXEEXT) \ -- src/users$(EXEEXT) src/who$(EXEEXT) -+am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) \ -+ src/libstdbuf.so$(EXEEXT) \ -+ src/stdbuf$(EXEEXT) src/stty$(EXEEXT) - am__EXEEXT_3 = src/[$(EXEEXT) src/base64$(EXEEXT) \ - src/basename$(EXEEXT) src/cat$(EXEEXT) src/chcon$(EXEEXT) \ - src/chgrp$(EXEEXT) src/chmod$(EXEEXT) src/chown$(EXEEXT) \ - src/cksum$(EXEEXT) src/comm$(EXEEXT) src/cp$(EXEEXT) \ - src/csplit$(EXEEXT) src/cut$(EXEEXT) src/date$(EXEEXT) \ -- src/dd$(EXEEXT) src/dir$(EXEEXT) src/dircolors$(EXEEXT) \ -+ src/dir$(EXEEXT) src/dircolors$(EXEEXT) \ - src/dirname$(EXEEXT) src/du$(EXEEXT) src/echo$(EXEEXT) \ - src/env$(EXEEXT) src/expand$(EXEEXT) src/expr$(EXEEXT) \ - src/factor$(EXEEXT) src/false$(EXEEXT) src/fmt$(EXEEXT) \ -@@ -3247,12 +3246,12 @@ WARN_ON_USE_H = lib/warn-on-use.h - # FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am - AM_CFLAGS = $(WERROR_CFLAGS) - no_install__progs = src/arch src/hostname --build_if_possible__progs = src/chroot src/df src/hostid \ -+build_if_possible__progs = src/chroot src/df \ - src/libstdbuf.so src/nice src/pinky src/stdbuf src/stty \ - src/uptime src/users src/who - default__progs = src/[ src/base64 src/basename src/cat src/chcon \ - src/chgrp src/chmod src/chown src/cksum src/comm src/cp \ -- src/csplit src/cut src/date src/dd src/dir src/dircolors \ -+ src/csplit src/cut src/date src/dir src/dircolors \ - src/dirname src/du src/echo src/env src/expand src/expr \ - src/factor src/false src/fmt src/fold src/ginstall src/groups \ - src/head src/id src/join src/kill src/link src/ln src/logname \ --- -1.8.3.4 diff --git a/sys-apps/coreutils/patches/coreutils-8.23.gcc2.patchset b/sys-apps/coreutils/patches/coreutils-8.23.gcc2.patchset deleted file mode 100644 index 30a320a92..000000000 --- a/sys-apps/coreutils/patches/coreutils-8.23.gcc2.patchset +++ /dev/null @@ -1,3202 +0,0 @@ -From 2821b057d6fba506fb00a530cfa5c57f6f57fe8f Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 2 Apr 2015 16:37:05 +0000 -Subject: [PATCH] gcc2 c89 patch - ---- - lib/fts.c | 3 +- - lib/randperm.c | 9 +++-- - lib/utimecmp.c | 5 +-- - lib/verify.h | 3 +- - src/chown-core.c | 3 +- - src/chroot.c | 10 +++-- - src/copy.c | 29 +++++++------- - src/cp.c | 5 ++- - src/csplit.c | 17 +++++--- - src/cut.c | 6 ++- - src/dd.c | 14 ++++--- - src/df.c | 45 +++++++++++++-------- - src/du.c | 12 +++--- - src/env.c | 2 +- - src/expr.c | 7 ++-- - src/factor.c | 117 ++++++++++++++++++++++++++++++++++--------------------- - src/getlimits.c | 3 +- - src/group-list.c | 3 +- - src/head.c | 9 +++-- - src/id.c | 12 ++++-- - src/install.c | 6 ++- - src/join.c | 9 +++-- - src/ls.c | 43 +++++++++++++------- - src/md5sum.c | 5 ++- - src/mkdir.c | 13 ++++--- - src/nproc.c | 4 +- - src/numfmt.c | 40 ++++++++++++------- - src/od.c | 2 +- - src/realpath.c | 6 ++- - src/relpath.c | 6 ++- - src/remove.c | 31 +++++++++------ - src/rm.c | 9 +++-- - src/seq.c | 28 +++++++------ - src/shred.c | 40 +++++++++++-------- - src/shuf.c | 3 +- - src/sort.c | 73 ++++++++++++++++++++-------------- - src/split.c | 32 ++++++++------- - src/stat.c | 38 +++++++++++------- - src/system.h | 6 ++- - src/tac.c | 6 ++- - src/tail.c | 6 ++- - src/test.c | 12 ++++-- - src/timeout.c | 4 ++ - src/wc.c | 8 ++-- - 44 files changed, 458 insertions(+), 286 deletions(-) - -diff --git a/lib/fts.c b/lib/fts.c -index 500e92c..e2180c7 100644 ---- a/lib/fts.c -+++ b/lib/fts.c -@@ -1293,6 +1293,7 @@ fts_build (register FTS *sp, int type) - int dir_fd; - FTSENT *cur = sp->fts_cur; - bool continue_readdir = !!cur->fts_dirp; -+ size_t max_entries; - - /* When cur->fts_dirp is non-NULL, that means we should - continue calling readdir on that existing DIR* pointer -@@ -1354,7 +1355,7 @@ fts_build (register FTS *sp, int type) - function. But when no such function is specified, we can read - entries in batches that are large enough to help us with inode- - sorting, yet not so large that we risk exhausting memory. */ -- size_t max_entries = (sp->fts_compar == NULL -+ max_entries = (sp->fts_compar == NULL - ? FTS_MAX_READDIR_ENTRIES : SIZE_MAX); - - /* -diff --git a/lib/randperm.c b/lib/randperm.c -index 1be1351..f21e4b0 100644 ---- a/lib/randperm.c -+++ b/lib/randperm.c -@@ -114,8 +114,11 @@ sparse_new (size_t size_hint) - static void - sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j) - { -- struct sparse_ent_ *v1 = hash_delete (sv, &(struct sparse_ent_) {i,0}); -- struct sparse_ent_ *v2 = hash_delete (sv, &(struct sparse_ent_) {j,0}); -+ struct sparse_ent_ ent1 = {i,0}; -+ struct sparse_ent_ ent2 = {j,0}; -+ size_t t; -+ struct sparse_ent_ *v1 = hash_delete (sv, &ent1); -+ struct sparse_ent_ *v2 = hash_delete (sv, &ent2); - - /* FIXME: reduce the frequency of these mallocs. */ - if (!v1) -@@ -129,7 +132,7 @@ sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j) - v2->index = v2->val = j; - } - -- size_t t = v1->val; -+ t = v1->val; - v1->val = v2->val; - v2->val = t; - if (!hash_insert (sv, v1)) -diff --git a/lib/utimecmp.c b/lib/utimecmp.c -index 49ea5f8..15db6b5 100644 ---- a/lib/utimecmp.c -+++ b/lib/utimecmp.c -@@ -131,14 +131,13 @@ utimecmp (char const *dst_name, - - time_t might be unsigned. */ - -- verify (TYPE_IS_INTEGER (time_t)); -- verify (TYPE_TWOS_COMPLEMENT (int)); -- - /* Destination and source time stamps. */ - time_t dst_s = dst_stat->st_mtime; - time_t src_s = src_stat->st_mtime; - int dst_ns = get_stat_mtime_ns (dst_stat); - int src_ns = get_stat_mtime_ns (src_stat); -+ verify (TYPE_IS_INTEGER (time_t)); -+ verify (TYPE_TWOS_COMPLEMENT (int)); - - if (options & UTIMECMP_TRUNCATE_SOURCE) - { -diff --git a/lib/verify.h b/lib/verify.h -index a25e514..8425730 100644 ---- a/lib/verify.h -+++ b/lib/verify.h -@@ -248,7 +248,8 @@ template - /* Verify requirement R at compile-time, as a declaration without a - trailing ';'. */ - --#define verify(R) _GL_VERIFY (R, "verify (" #R ")") -+//#define verify(R) _GL_VERIFY (R, "verify (" #R ")") -+#define verify(R) - - #ifndef __has_builtin - # define __has_builtin(x) 0 -diff --git a/src/chown-core.c b/src/chown-core.c -index cdcd53a..cd0c984 100644 ---- a/src/chown-core.c -+++ b/src/chown-core.c -@@ -219,6 +219,7 @@ restricted_chown (int cwd_fd, char const *file, - struct stat st; - int open_flags = O_NONBLOCK | O_NOCTTY; - int fd; -+ int saved_errno; - - if (required_uid == (uid_t) -1 && required_gid == (gid_t) -1) - return RC_do_ordinary_chown; -@@ -256,7 +257,7 @@ restricted_chown (int cwd_fd, char const *file, - } - } - -- int saved_errno = errno; -+ saved_errno = errno; - close (fd); - errno = saved_errno; - return status; -diff --git a/src/chroot.c b/src/chroot.c -index fff0b53..10256e8 100644 ---- a/src/chroot.c -+++ b/src/chroot.c -@@ -164,11 +164,11 @@ static bool - is_root (const char* dir) - { - struct dev_ino root_ino; -+ struct stat arg_st; - if (! get_root_dev_ino (&root_ino)) - error (EXIT_CANCELED, errno, _("failed to get attributes of %s"), - quote ("/")); - -- struct stat arg_st; - if (stat (dir, &arg_st) == -1) - error (EXIT_CANCELED, errno, _("failed to get attributes of %s"), - quote (dir)); -@@ -223,6 +223,8 @@ main (int argc, char **argv) - uid_t uid = -1; - gid_t gid = -1; - GETGROUPS_T *out_gids = NULL; -+ GETGROUPS_T *gids; -+ GETGROUPS_T *in_gids = NULL; - size_t n_gids = 0; - - initialize_main (&argc, &argv); -@@ -240,11 +242,12 @@ main (int argc, char **argv) - { - case USERSPEC: - { -+ size_t userlen; - userspec = optarg; - /* Treat 'user:' just like 'user' - as we lookup the primary group by default - (and support doing so for UIDs as well as names. */ -- size_t userlen = strlen (userspec); -+ userlen = strlen (userspec); - if (userlen && userspec[userlen - 1] == ':') - userspec[userlen - 1] = '\0'; - break; -@@ -359,8 +362,7 @@ main (int argc, char **argv) - } - } - -- GETGROUPS_T *gids = out_gids; -- GETGROUPS_T *in_gids = NULL; -+ gids = out_gids; - if (groups && *groups) - { - if (parse_additional_groups (groups, &in_gids, &n_gids, !n_gids) != 0) -diff --git a/src/copy.c b/src/copy.c -index 26d5bdd..f78d62a 100644 ---- a/src/copy.c -+++ b/src/copy.c -@@ -301,13 +301,15 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, - /* Keep track of the output position. - We may need this at the end, for a final ftruncate. */ - off_t dest_pos = 0; -- -+ bool wrote_hole_at_eof = true; -+ - extent_scan_init (src_fd, &scan); - - *require_normal_copy = false; -- bool wrote_hole_at_eof = true; - do - { -+ unsigned int i; -+ bool empty_extent = false; - bool ok = extent_scan_read (&scan); - if (! ok) - { -@@ -325,8 +327,6 @@ extent_copy (int src_fd, int dest_fd, char *buf, size_t buf_size, - return false; - } - -- unsigned int i; -- bool empty_extent = false; - for (i = 0; i < scan.ei_count || empty_extent; i++) - { - off_t ext_start; -@@ -597,6 +597,7 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, - char *namep; - struct cp_options non_command_line_options = *x; - bool ok = true; -+ bool new_first_dir_created = false; - - name_space = savedir (src_name_in, SAVEDIR_SORT_FASTREAD); - if (name_space == NULL) -@@ -612,7 +613,6 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, - if (x->dereference == DEREF_COMMAND_LINE_ARGUMENTS) - non_command_line_options.dereference = DEREF_NEVER; - -- bool new_first_dir_created = false; - namep = name_space; - while (*namep != '\0') - { -@@ -999,7 +999,7 @@ copy_reg (char const *src_name, char const *dst_name, - if (*new_dst) - { - open_with_O_CREAT:; -- -+{ - int open_flags = O_WRONLY | O_CREAT | O_BINARY; - dest_desc = open (dst_name, open_flags | O_EXCL, - dst_mode & ~omitted_permissions); -@@ -1043,6 +1043,7 @@ copy_reg (char const *src_name, char const *dst_name, - && *dst_name && dst_name[strlen (dst_name) - 1] == '/') - dest_errno = ENOTDIR; - } -+ } - else - { - omitted_permissions = 0; -@@ -1105,12 +1106,14 @@ copy_reg (char const *src_name, char const *dst_name, - size_t buf_alignment = lcm (getpagesize (), sizeof (word)); - size_t buf_alignment_slop = sizeof (word) + buf_alignment - 1; - size_t buf_size = io_blksize (sb); -+ bool make_holes = false; -+ bool sparse_src = false; -+ off_t n_read; -+ bool wrote_hole_at_eof; - - fdadvise (source_desc, 0, 0, FADVISE_SEQUENTIAL); - - /* Deal with sparse files. */ -- bool make_holes = false; -- bool sparse_src = false; - - if (S_ISREG (sb.st_mode)) - { -@@ -1177,8 +1180,6 @@ copy_reg (char const *src_name, char const *dst_name, - } - } - -- off_t n_read; -- bool wrote_hole_at_eof; - if ( ! sparse_copy (source_desc, dest_desc, buf, buf_size, - make_holes, src_name, dst_name, - UINTMAX_MAX, &n_read, -@@ -1680,10 +1681,11 @@ create_hard_link (char const *src_name, char const *dst_name, - { - /* We want to guarantee that symlinks are not followed, unless requested. */ - int flags = 0; -+ bool link_failed; - if (dereference) - flags = AT_SYMLINK_FOLLOW; - -- bool link_failed = (linkat (AT_FDCWD, src_name, AT_FDCWD, dst_name, flags) -+ link_failed = (linkat (AT_FDCWD, src_name, AT_FDCWD, dst_name, flags) - != 0); - - /* If the link failed because of an existing destination, -@@ -1758,6 +1760,7 @@ copy_internal (char const *src_name, char const *dst_name, - bool copied_as_regular = false; - bool dest_is_symlink = false; - bool have_dst_lstat = false; -+ bool dereference; - - if (x->move_mode && rename_succeeded) - *rename_succeeded = false; -@@ -1796,7 +1799,7 @@ copy_internal (char const *src_name, char const *dst_name, - record_file (x->src_info, src_name, &src_sb); - } - -- bool dereference = should_dereference (x, command_line_arg); -+ dereference = should_dereference (x, command_line_arg); - - if (!new_dst) - { -@@ -2814,6 +2817,7 @@ copy (char const *src_name, char const *dst_name, - bool nonexistent_dst, const struct cp_options *options, - bool *copy_into_self, bool *rename_succeeded) - { -+ bool first_dir_created_per_command_line_arg = false; - assert (valid_options (options)); - - /* Record the file names: they're used in case of error, when copying -@@ -2826,7 +2830,6 @@ copy (char const *src_name, char const *dst_name, - top_level_src_name = src_name; - top_level_dst_name = dst_name; - -- bool first_dir_created_per_command_line_arg = false; - return copy_internal (src_name, dst_name, nonexistent_dst, NULL, NULL, - options, true, - &first_dir_created_per_command_line_arg, -diff --git a/src/cp.c b/src/cp.c -index 99cafa7..5f506a4 100644 ---- a/src/cp.c -+++ b/src/cp.c -@@ -825,6 +825,7 @@ cp_option_init (struct cp_options *x) - static void - decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) - { -+ char *arg_writable, *s; - enum File_attribute - { - PRESERVE_MODE, -@@ -849,8 +850,8 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) - }; - ARGMATCH_VERIFY (preserve_args, preserve_vals); - -- char *arg_writable = xstrdup (arg); -- char *s = arg_writable; -+ arg_writable = xstrdup (arg); -+ s = arg_writable; - do - { - /* find next comma */ -diff --git a/src/csplit.c b/src/csplit.c -index a30f09b..3b1b20a 100644 ---- a/src/csplit.c -+++ b/src/csplit.c -@@ -1225,8 +1225,9 @@ static size_t - get_format_flags (char const *format, int *flags_ptr) - { - int flags = 0; -+ size_t count; - -- for (size_t count = 0; ; count++) -+ for (count = 0; ; count++) - { - switch (format[count]) - { -@@ -1300,15 +1301,17 @@ static size_t - max_out (char *format) - { - bool percent = false; -+ char *f; -+ int maxlen; - -- for (char *f = format; *f; f++) -+ for (f = format; *f; f++) - if (*f == '%' && *++f != '%') - { -+ int flags; - if (percent) - error (EXIT_FAILURE, 0, - _("too many %% conversion specifications in suffix")); - percent = true; -- int flags; - f += get_format_flags (f, &flags); - while (ISDIGIT (*f)) - f++; -@@ -1322,7 +1325,7 @@ max_out (char *format) - error (EXIT_FAILURE, 0, - _("missing %% conversion specification in suffix")); - -- int maxlen = snprintf (NULL, 0, format, UINT_MAX); -+ maxlen = snprintf (NULL, 0, format, UINT_MAX); - if (! (0 <= maxlen && maxlen <= SIZE_MAX)) - xalloc_die (); - return maxlen; -@@ -1333,6 +1336,8 @@ main (int argc, char **argv) - { - int optc; - unsigned long int val; -+ size_t prefix_len; -+ size_t max_digit_string_len; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1402,8 +1407,8 @@ main (int argc, char **argv) - usage (EXIT_FAILURE); - } - -- size_t prefix_len = strlen (prefix); -- size_t max_digit_string_len -+ prefix_len = strlen (prefix); -+ max_digit_string_len - = (suffix - ? max_out (suffix) - : MAX (INT_STRLEN_BOUND (unsigned int), digits)); -diff --git a/src/cut.c b/src/cut.c -index 312551f..15a24ea 100644 ---- a/src/cut.c -+++ b/src/cut.c -@@ -399,7 +399,8 @@ set_fields (const char *fieldstr) - /* Merge range pairs (e.g. `2-5,3-4' becomes `2-5'). */ - for (i = 0; i < n_rp; ++i) - { -- for (size_t j = i + 1; j < n_rp; ++j) -+ size_t j; -+ for (j = i + 1; j < n_rp; ++j) - { - if (rp[j].lo <= rp[i].hi) - { -@@ -534,6 +535,7 @@ cut_fields (FILE *stream) - - while (1) - { -+ int prev_c; - if (field_idx == 1 && buffer_first_field) - { - ssize_t len; -@@ -595,7 +597,7 @@ cut_fields (FILE *stream) - next_item (&field_idx); - } - -- int prev_c = c; -+ prev_c = c; - - if (print_kth (field_idx)) - { -diff --git a/src/dd.c b/src/dd.c -index 1e387f3..4b5f392 100644 ---- a/src/dd.c -+++ b/src/dd.c -@@ -667,10 +667,11 @@ human_size (size_t n) - static void - alloc_ibuf (void) - { -+ char *real_buf; - if (ibuf) - return; - -- char *real_buf = malloc (input_blocksize + INPUT_BLOCK_SLOP); -+ real_buf = malloc (input_blocksize + INPUT_BLOCK_SLOP); - if (!real_buf) - error (EXIT_FAILURE, 0, - _("memory exhausted by input buffer of size %zu bytes (%s)"), -@@ -740,6 +741,7 @@ print_stats (void) - | human_space_before_unit | human_SI | human_B); - double delta_s; - char const *bytes_per_second; -+ xtime_t now; - - if (status_flags & STATUS_NONE) - return; -@@ -769,7 +771,7 @@ print_stats (void) - w_bytes, - human_readable (w_bytes, hbuf, human_opts, 1, 1)); - -- xtime_t now = gethrxtime (); -+ now = gethrxtime (); - if (start_time < now) - { - double XTIME_PRECISIONe0 = XTIME_PRECISION; -@@ -959,6 +961,7 @@ static bool - invalidate_cache (int fd, off_t len) - { - int adv_ret = -1; -+ off_t pending; - - /* Minimize syscalls. */ - off_t clen = cache_round (fd, len); -@@ -966,7 +969,7 @@ invalidate_cache (int fd, off_t len) - return true; /* Don't advise this time. */ - if (!len && !clen && max_records) - return true; /* Nothing pending. */ -- off_t pending = len ? cache_round (fd, 0) : 0; -+ pending = len ? cache_round (fd, 0) : 0; - - if (fd == STDIN_FILENO) - { -@@ -1642,6 +1645,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, - } - else - { -+ char *buf; - int lseek_errno = errno; - - /* The seek request may have failed above if it was too big -@@ -1676,7 +1680,6 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, - } - /* else file_size && offset > OFF_T_MAX or file ! seekable */ - -- char *buf; - if (fdesc == STDIN_FILENO) - { - alloc_ibuf (); -@@ -2023,8 +2026,9 @@ dd_copy (void) - - if (conversions_mask & C_NOERROR) - { -+ size_t bad_portion; - print_stats (); -- size_t bad_portion = input_blocksize - partread; -+ bad_portion = input_blocksize - partread; - - /* We already know this data is not cached, - but call this so that correct offsets are maintained. */ -diff --git a/src/df.c b/src/df.c -index 3ef5d33..e6dab99 100644 ---- a/src/df.c -+++ b/src/df.c -@@ -309,6 +309,8 @@ print_table (void) - for (col = 0; col < ncolumns; col++) - { - char *cell = table[row][col]; -+ int flags; -+ size_t width; - - /* Note the SOURCE_FIELD used to be displayed on it's own line - if (!posix_format && mbswidth (cell) > 20), but that -@@ -317,11 +319,11 @@ print_table (void) - if (col != 0) - putchar (' '); - -- int flags = 0; -+ flags = 0; - if (col == ncolumns - 1) /* The last one. */ - flags = MBA_NO_RIGHT_PAD; - -- size_t width = columns[col]->width; -+ width = columns[col]->width; - cell = ambsalign (cell, &width, columns[col]->align, flags); - /* When ambsalign fails, output unaligned data. */ - fputs (cell ? cell : table[row][col], stdout); -@@ -366,6 +368,8 @@ decode_output_arg (char const *arg) - do - { - /* find next comma */ -+ display_field_t field; -+ unsigned int i; - char *comma = strchr (s, ','); - - /* If we found a comma, put a NUL in its place and advance. */ -@@ -373,8 +377,8 @@ decode_output_arg (char const *arg) - *comma++ = 0; - - /* process S. */ -- display_field_t field = INVALID_FIELD; -- for (unsigned int i = 0; i < ARRAY_CARDINALITY (field_data); i++) -+ field = INVALID_FIELD; -+ for (i = 0; i < ARRAY_CARDINALITY (field_data); i++) - { - if (STREQ (field_data[i].arg, s)) - { -@@ -526,6 +530,7 @@ get_header (void) - uintmax_t q1024 = output_block_size; - bool divisible_by_1000; - bool divisible_by_1024; -+ char *num; - - do - { -@@ -541,7 +546,7 @@ get_header (void) - if (! (opts & human_base_1024)) - opts |= human_B; - -- char *num = human_readable (output_block_size, buf, opts, 1, 1); -+ num = human_readable (output_block_size, buf, opts, 1, 1); - - /* Reset the header back to the default in OUTPUT_MODE. */ - header = _("blocks"); -@@ -685,12 +690,13 @@ filter_mount_list (bool devices_only) - mount_list = NULL; - while (device_list) - { -+ struct devlist *devlist; - /* Add the mount entry. */ - me = device_list->me; - me->me_next = mount_list; - mount_list = me; - /* Free devlist entry and advance. */ -- struct devlist *devlist = device_list->next; -+ devlist = device_list->next; - free (device_list); - device_list = devlist; - } -@@ -875,6 +881,12 @@ get_dev (char const *disk, char const *mount_point, char const* file, - const struct fs_usage *force_fsu, - bool process_all) - { -+ struct fs_usage fsu; -+ char *dev_name; -+ char *resolved_dev; -+ struct field_values_t block_values; -+ struct field_values_t inode_values; -+ size_t col; - if (me_remote && show_local_fs) - return; - -@@ -896,7 +908,6 @@ get_dev (char const *disk, char const *mount_point, char const* file, - if (!stat_file) - stat_file = mount_point ? mount_point : disk; - -- struct fs_usage fsu; - if (force_fsu) - fsu = *force_fsu; - else if (get_fs_usage (stat_file, disk, &fsu)) -@@ -951,9 +962,8 @@ get_dev (char const *disk, char const *mount_point, char const* file, - if (! file) - file = "-"; /* unspecified */ - -- char *dev_name = xstrdup (disk); -- char *resolved_dev; -- -+ dev_name = xstrdup (disk); -+ - /* On some systems, dev_name is a long-named symlink like - /dev/disk/by-uuid/828fc648-9f30-43d8-a0b1-f7196a2edb66 pointing to a - much shorter and more useful name like /dev/sda1. It may also look -@@ -971,15 +981,12 @@ get_dev (char const *disk, char const *mount_point, char const* file, - if (! fstype) - fstype = "-"; /* unknown */ - -- struct field_values_t block_values; -- struct field_values_t inode_values; - get_field_values (&block_values, &inode_values, &fsu); - - /* Add to grand total unless processing grand total line. */ - if (print_grand_total && ! force_fsu) - add_to_grand_total (&block_values, &inode_values); - -- size_t col; - for (col = 0; col < ncolumns; col++) - { - char buf[LONGEST_HUMAN_READABLE + 2]; -@@ -1151,12 +1158,13 @@ get_disk (char const *disk) - bool best_match_accessible = false; - bool eclipsed_device = false; - char const *file = disk; -+ size_t best_match_len; - - char *resolved = canonicalize_file_name (disk); - if (resolved && IS_ABSOLUTE_FILE_NAME (resolved)) - disk = resolved; - -- size_t best_match_len = SIZE_MAX; -+ best_match_len = SIZE_MAX; - for (me = mount_list; me; me = me->me_next) - { - /* TODO: Should cache canon_dev in the mount_entry struct. */ -@@ -1434,6 +1442,8 @@ int - main (int argc, char **argv) - { - struct stat *stats IF_LINT ( = 0); -+ bool posix_format; -+ const char *msg_mut_excl; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1455,9 +1465,9 @@ main (int argc, char **argv) - grand_fsu.fsu_blocksize = 1; - - /* If true, use the POSIX output format. */ -- bool posix_format = false; -+ posix_format = false; - -- const char *msg_mut_excl = _("options %s and %s are mutually exclusive"); -+ msg_mut_excl = _("options %s and %s are mutually exclusive"); - - while (true) - { -@@ -1657,6 +1667,7 @@ main (int argc, char **argv) - or when either of -a, -l, -t or -x is used with file name - arguments. Otherwise, merely give a warning and proceed. */ - int status = 0; -+ const char *warning; - if ( ! (optind < argc) - || (show_all_fs - || show_local_fs -@@ -1665,7 +1676,7 @@ main (int argc, char **argv) - { - status = EXIT_FAILURE; - } -- const char *warning = (status == 0 ? _("Warning: ") : ""); -+ warning = (status == 0 ? _("Warning: ") : ""); - error (status, errno, "%s%s", warning, - _("cannot read table of mounted file systems")); - } -diff --git a/src/du.c b/src/du.c -index 0966326..532c64b 100644 ---- a/src/du.c -+++ b/src/du.c -@@ -461,8 +461,9 @@ process_file (FTS *fts, FTSENT *ent) - - if (info == FTS_NSOK) - { -+ FTSENT const *e; - fts_set (fts, ent, FTS_AGAIN); -- FTSENT const *e = fts_read (fts); -+ e = fts_read (fts); - assert (e == ent); - info = ent->fts_info; - } -@@ -494,8 +495,9 @@ process_file (FTS *fts, FTSENT *ent) - visit to the same directory. */ - if (info == FTS_D) - { -+ FTSENT const *e; - fts_set (fts, ent, FTS_SKIP); -- FTSENT const *e = fts_read (fts); -+ e = fts_read (fts); - assert (e == ent); - } - -@@ -703,6 +705,8 @@ main (int argc, char **argv) - - /* If true, display only a total for each argument. */ - bool opt_summarize_only = false; -+ struct argv_iterator *ai; -+ static char *temp_argv[] = { NULL, NULL }; - - cwd_only[0] = bad_cast ("."); - cwd_only[1] = NULL; -@@ -975,7 +979,6 @@ main (int argc, char **argv) - } - } - -- struct argv_iterator *ai; - if (files_from) - { - /* When using --files0-from=F, you may not specify any files -@@ -1030,8 +1033,7 @@ main (int argc, char **argv) - bit_flags |= FTS_TIGHT_CYCLE_CHECK; - - bit_flags |= symlink_deref_bits; -- static char *temp_argv[] = { NULL, NULL }; -- -+ - while (true) - { - bool skip_file = false; -diff --git a/src/env.c b/src/env.c -index 2b37d98..7bd924d 100644 ---- a/src/env.c -+++ b/src/env.c -@@ -80,6 +80,7 @@ main (int argc, char **argv) - int optc; - bool ignore_environment = false; - bool opt_nul_terminate_output = false; -+ char *eq; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -126,7 +127,6 @@ main (int argc, char **argv) - if (optind < argc && STREQ (argv[optind], "-")) - ++optind; - -- char *eq; - while (optind < argc && (eq = strchr (argv[optind], '='))) - { - if (putenv (argv[optind])) -diff --git a/src/expr.c b/src/expr.c -index a97663a..efcdd0a 100644 ---- a/src/expr.c -+++ b/src/expr.c -@@ -115,8 +115,8 @@ mpz_tdiv_r (mpz_t r, mpz_t a0, mpz_t b0) - static char * - mpz_get_str (char const *str, int base, mpz_t z) - { -- (void) str; (void) base; - char buf[INT_BUFSIZE_BOUND (intmax_t)]; -+ (void) str; (void) base; - return xstrdup (imaxtostr (z[0], buf)); - } - static int -@@ -137,8 +137,8 @@ mpz_get_ui (mpz_t z) - static int - mpz_out_str (FILE *stream, int base, mpz_t z) - { -- (void) base; - char buf[INT_BUFSIZE_BOUND (intmax_t)]; -+ (void) base; - return fputs (imaxtostr (z[0], buf), stream) != EOF; - } - #endif -@@ -291,6 +291,7 @@ int - main (int argc, char **argv) - { - VALUE *v; -+ unsigned int u_argc; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -306,7 +307,7 @@ main (int argc, char **argv) - - /* The above handles --help and --version. - Since there is no other invocation of getopt, handle '--' here. */ -- unsigned int u_argc = argc; -+ u_argc = argc; - if (1 < u_argc && STREQ (argv[1], "--")) - { - --u_argc; -diff --git a/src/factor.c b/src/factor.c -index 63924d5..d7072fb 100644 ---- a/src/factor.c -+++ b/src/factor.c -@@ -281,12 +281,13 @@ static void factor (uintmax_t, uintmax_t, struct factors *); - # define udiv_qrnnd(q, r, n1, n0, d) \ - do { \ - uintmax_t __d1, __d0, __q, __r1, __r0; \ -+ unsigned int __i; \ - \ - assert ((n1) < (d)); \ - __d1 = (d); __d0 = 0; \ - __r1 = (n1); __r0 = (n0); \ - __q = 0; \ -- for (unsigned int __i = W_TYPE_SIZE; __i > 0; __i--) \ -+ for (__i = W_TYPE_SIZE; __i > 0; __i--) \ - { \ - rsh2 (__d1, __d0, __d1, __d0, 1); \ - __q <<= 1; \ -@@ -404,6 +405,7 @@ static uintmax_t - mod2 (uintmax_t *r1, uintmax_t a1, uintmax_t a0, uintmax_t d1, uintmax_t d0) - { - int cntd, cnta; -+ int cnt, i; - - assert (d1 != 0); - -@@ -415,9 +417,9 @@ mod2 (uintmax_t *r1, uintmax_t a1, uintmax_t a0, uintmax_t d1, uintmax_t d0) - - count_leading_zeros (cntd, d1); - count_leading_zeros (cnta, a1); -- int cnt = cntd - cnta; -+ cnt = cntd - cnta; - lsh2 (d1, d0, d1, d0, cnt); -- for (int i = 0; i < cnt; i++) -+ for (i = 0; i < cnt; i++) - { - if (ge2 (a1, a0, d1, d0)) - sub_ddmmss (a1, a0, a1, a0, d1, d0); -@@ -522,7 +524,8 @@ factor_insert_multiplicity (struct factors *factors, - - if (i < 0 || p[i] != prime) - { -- for (int j = nfactors - 1; j > i; j--) -+ int j; -+ for (j = nfactors - 1; j > i; j--) - { - p[j + 1] = p[j]; - e[j + 1] = e[j]; -@@ -695,19 +698,20 @@ static bool flag_prove_primality = true; - /* Number of Miller-Rabin tests to run when not proving primality. */ - #define MR_REPS 25 - --#ifdef __GNUC__ --# define LIKELY(cond) __builtin_expect ((cond), 1) --# define UNLIKELY(cond) __builtin_expect ((cond), 0) --#else -+//#ifdef __GNUC__ -+//# define LIKELY(cond) __builtin_expect ((cond), 1) -+//# define UNLIKELY(cond) __builtin_expect ((cond), 0) -+//#else - # define LIKELY(cond) (cond) - # define UNLIKELY(cond) (cond) --#endif -+//#endif - - static void - factor_insert_refind (struct factors *factors, uintmax_t p, unsigned int i, - unsigned int off) - { -- for (unsigned int j = 0; j < off; j++) -+ unsigned int j; -+ for (j = 0; j < off; j++) - p += primes_diff[i + j]; - factor_insert (factors, p); - } -@@ -749,6 +753,8 @@ static uintmax_t - factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0, - struct factors *factors) - { -+ uintmax_t p = 3; -+ unsigned int i; - if (t0 % 2 == 0) - { - unsigned int cnt; -@@ -769,8 +775,6 @@ factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0, - factor_insert_multiplicity (factors, 2, cnt); - } - -- uintmax_t p = 3; -- unsigned int i; - for (i = 0; t1 > 0 && i < PRIMES_PTAB_ENTRIES; i++) - { - for (;;) -@@ -832,6 +836,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) - { - mpz_t q; - unsigned long int p; -+ unsigned int i; - - devmsg ("[trial division] "); - -@@ -846,7 +851,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) - } - - p = 3; -- for (unsigned int i = 1; i <= PRIMES_PTAB_ENTRIES;) -+ for (i = 1; i <= PRIMES_PTAB_ENTRIES;) - { - if (! mpz_divisible_ui_p (t, p)) - { -@@ -1116,11 +1121,12 @@ millerrabin (uintmax_t n, uintmax_t ni, uintmax_t b, uintmax_t q, - uintmax_t y = powm (b, q, n, ni, one); - - uintmax_t nm1 = n - one; /* -1, but in redc representation. */ -+ unsigned int i; - - if (y == one || y == nm1) - return true; - -- for (unsigned int i = 1; i < k; i++) -+ for (i = 1; i < k; i++) - { - y = mulredc (y, y, n, ni); - -@@ -1137,6 +1143,7 @@ millerrabin2 (const uintmax_t *np, uintmax_t ni, const uintmax_t *bp, - const uintmax_t *qp, unsigned int k, const uintmax_t *one) - { - uintmax_t y1, y0, nm1_1, nm1_0, r1m; -+ unsigned int i; - - y0 = powm2 (&r1m, bp, qp, np, ni, one); - y1 = r1m; -@@ -1149,7 +1156,7 @@ millerrabin2 (const uintmax_t *np, uintmax_t ni, const uintmax_t *bp, - if (y0 == nm1_0 && y1 == nm1_1) - return true; - -- for (unsigned int i = 1; i < k; i++) -+ for (i = 1; i < k; i++) - { - y0 = mulredc2 (&r1m, y1, y0, y1, y0, np[1], np[0], ni); - y1 = r1m; -@@ -1167,12 +1174,13 @@ static bool - mp_millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, mpz_ptr y, - mpz_srcptr q, unsigned long int k) - { -+ unsigned long int i; - mpz_powm (y, x, q, n); - - if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0) - return true; - -- for (unsigned long int i = 1; i < k; i++) -+ for (i = 1; i < k; i++) - { - mpz_powm_ui (y, y, 2, n); - if (mpz_cmp (y, nm1) == 0) -@@ -1193,6 +1201,8 @@ prime_p (uintmax_t n) - bool is_prime; - uintmax_t a_prim, one, ni; - struct factors factors; -+ uintmax_t q, a; -+ unsigned int r; - - if (n <= 1) - return false; -@@ -1202,11 +1212,11 @@ prime_p (uintmax_t n) - return true; - - /* Precomputation for Miller-Rabin. */ -- uintmax_t q = n - 1; -+ q = n - 1; - for (k = 0; (q & 1) == 0; k++) - q >>= 1; - -- uintmax_t a = 2; -+ a = 2; - binv (ni, n); /* ni <- 1/n mod B */ - redcify (one, 1, n); - addmod (a_prim, one, one, n); /* i.e., redcify a = 2 */ -@@ -1223,12 +1233,13 @@ prime_p (uintmax_t n) - - /* Loop until Lucas proves our number prime, or Miller-Rabin proves our - number composite. */ -- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) -+ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) - { - if (flag_prove_primality) - { -+ unsigned int i; - is_prime = true; -- for (unsigned int i = 0; i < factors.nfactors && is_prime; i++) -+ for (i = 0; i < factors.nfactors && is_prime; i++) - { - is_prime - = powm (a_prim, (n - 1) / factors.p[i], n, ni, one) != one; -@@ -1278,6 +1289,8 @@ prime2_p (uintmax_t n1, uintmax_t n0) - uintmax_t ni; - unsigned int k; - struct factors factors; -+ unsigned int r; -+ uintmax_t a; - - if (n1 == 0) - return prime_p (n0); -@@ -1298,7 +1311,7 @@ prime2_p (uintmax_t n1, uintmax_t n0) - rsh2 (q[1], q[0], nm1[1], nm1[0], k); - } - -- uintmax_t a = 2; -+ a = 2; - binv (ni, n0); - redcify2 (one[1], one[0], 1, n1, n0); - addmod2 (a_prim[1], a_prim[0], one[1], one[0], one[1], one[0], n1, n0); -@@ -1318,13 +1331,14 @@ prime2_p (uintmax_t n1, uintmax_t n0) - - /* Loop until Lucas proves our number prime, or Miller-Rabin proves our - number composite. */ -- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) -+ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) - { - bool is_prime; - uintmax_t e[2], y[2]; - - if (flag_prove_primality) - { -+ unsigned int i; - is_prime = true; - if (factors.plarge[1]) - { -@@ -1335,7 +1349,7 @@ prime2_p (uintmax_t n1, uintmax_t n0) - y[0] = powm2 (&y[1], a_prim, e, na, ni, one); - is_prime = (y[0] != one[0] || y[1] != one[1]); - } -- for (unsigned int i = 0; i < factors.nfactors && is_prime; i++) -+ for (i = 0; i < factors.nfactors && is_prime; i++) - { - /* FIXME: We always have the factor 2. Do we really need to - handle it here? We have done the same powering as part -@@ -1375,6 +1389,8 @@ mp_prime_p (mpz_t n) - bool is_prime; - mpz_t q, a, nm1, tmp; - struct mp_factors factors; -+ unsigned long int k; -+ unsigned int r; - - if (mpz_cmp_ui (n, 1) <= 0) - return false; -@@ -1389,7 +1405,7 @@ mp_prime_p (mpz_t n) - mpz_sub_ui (nm1, n, 1); - - /* Find q and k, where q is odd and n = 1 + 2**k * q. */ -- unsigned long int k = mpz_scan1 (nm1, 0); -+ k = mpz_scan1 (nm1, 0); - mpz_tdiv_q_2exp (q, nm1, k); - - mpz_set_ui (a, 2); -@@ -1410,12 +1426,13 @@ mp_prime_p (mpz_t n) - - /* Loop until Lucas proves our number prime, or Miller-Rabin proves our - number composite. */ -- for (unsigned int r = 0; r < PRIMES_PTAB_ENTRIES; r++) -+ for (r = 0; r < PRIMES_PTAB_ENTRIES; r++) - { - if (flag_prove_primality) - { -+ unsigned long int i; - is_prime = true; -- for (unsigned long int i = 0; i < factors.nfactors && is_prime; i++) -+ for (i = 0; i < factors.nfactors && is_prime; i++) - { - mpz_divexact (tmp, nm1, factors.p[i]); - mpz_powm (tmp, a, tmp, n); -@@ -1474,6 +1491,7 @@ factor_using_pollard_rho (uintmax_t n, unsigned long int a, - - for (;;) - { -+ unsigned long int i; - do - { - x = mulredc (x, x, n, ni); -@@ -1494,7 +1512,7 @@ factor_using_pollard_rho (uintmax_t n, unsigned long int a, - z = x; - k = l; - l = 2 * l; -- for (unsigned long int i = 0; i < k; i++) -+ for (i = 0; i < k; i++) - { - x = mulredc (x, x, n, ni); - addmod (x, x, a, n); -@@ -1552,6 +1570,7 @@ factor_using_pollard_rho2 (uintmax_t n1, uintmax_t n0, unsigned long int a, - - for (;;) - { -+ unsigned long int i; - do - { - x0 = mulredc2 (&r1m, x1, x0, x1, x0, n1, n0, ni); -@@ -1575,7 +1594,7 @@ factor_using_pollard_rho2 (uintmax_t n1, uintmax_t n0, unsigned long int a, - z1 = x1; z0 = x0; - k = l; - l = 2 * l; -- for (unsigned long int i = 0; i < k; i++) -+ for (i = 0; i < k; i++) - { - x0 = mulredc2 (&r1m, x1, x0, x1, x0, n1, n0, ni); - x1 = r1m; -@@ -1653,6 +1672,8 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, - { - mpz_t x, z, y, P; - mpz_t t, t2; -+ unsigned long long int k = 1; -+ unsigned long long int l = 1; - - devmsg ("[pollard-rho (%lu)] ", a); - -@@ -1662,13 +1683,11 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, - mpz_init_set_si (z, 2); - mpz_init_set_ui (P, 1); - -- unsigned long long int k = 1; -- unsigned long long int l = 1; -- - while (mpz_cmp_ui (n, 1) != 0) - { - for (;;) - { -+ unsigned long long int i; - do - { - mpz_mul (t, x, x); -@@ -1692,7 +1711,7 @@ mp_factor_using_pollard_rho (mpz_t n, unsigned long int a, - mpz_set (z, x); - k = l; - l = 2 * l; -- for (unsigned long long int i = 0; i < k; i++) -+ for (i = 0; i < k; i++) - { - mpz_mul (t, x, x); - mpz_mod (x, t, n); -@@ -1959,13 +1978,14 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - }; - - const unsigned int *m; -+ uintmax_t sqrt_n; - - struct { uintmax_t Q; uintmax_t P; } queue[QUEUE_SIZE]; - - if (n1 >= ((uintmax_t) 1 << (W_TYPE_SIZE - 2))) - return false; - -- uintmax_t sqrt_n = isqrt2 (n1, n0); -+ sqrt_n = isqrt2 (n1, n0); - - if (n0 == sqrt_n * sqrt_n) - { -@@ -1981,6 +2001,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - else - { - struct factors f; -+ unsigned int i; - - f.nfactors = 0; - if (!factor_using_squfof (0, sqrt_n, &f)) -@@ -1989,7 +2010,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - factor_using_pollard_rho (sqrt_n, 1, &f); - } - /* Duplicate the new factors */ -- for (unsigned int i = 0; i < f.nfactors; i++) -+ for (i = 0; i < f.nfactors; i++) - factor_insert_multiplicity (factors, f.p[i], 2*f.e[i]); - } - return true; -@@ -2092,7 +2113,9 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - uintmax_t r = is_square (Q); - if (r) - { -- for (unsigned int j = 0; j < qpos; j++) -+ unsigned int j; -+ uintmax_t hi, lo; -+ for (j = 0; j < qpos; j++) - { - if (queue[j].Q == r) - { -@@ -2127,7 +2150,6 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) - for the case D = 2N. */ - /* Compute Q = (D - P*P) / Q1, but we need double - precision. */ -- uintmax_t hi, lo; - umul_ppmm (hi, lo, P, P); - sub_ddmmss (hi, lo, Dh, Dl, hi, lo); - udiv_qrnnd (Q, rem, hi, lo, Q1); -@@ -2253,6 +2275,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char *s) - uintmax_t hi = 0, lo = 0; - - strtol_error err = LONGINT_INVALID; -+ const char *p; - - /* Skip initial spaces and '+'. */ - for (;;) -@@ -2270,7 +2293,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, const char *s) - } - - /* Initial scan for invalid digits. */ -- const char *p = s; -+ p = s; - for (;;) - { - unsigned int c = *p++; -@@ -2346,14 +2369,15 @@ static void - print_factors_single (uintmax_t t1, uintmax_t t0) - { - struct factors factors; -+ unsigned int j, k; - - print_uintmaxes (t1, t0); - putchar (':'); - - factor (t1, t0, &factors); - -- for (unsigned int j = 0; j < factors.nfactors; j++) -- for (unsigned int k = 0; k < factors.e[j]; k++) -+ for (j = 0; j < factors.nfactors; j++) -+ for (k = 0; k < factors.e[j]; k++) - { - char buf[INT_BUFSIZE_BOUND (uintmax_t)]; - putchar (' '); -@@ -2377,6 +2401,7 @@ static bool - print_factors (const char *input) - { - uintmax_t t1, t0; -+ unsigned int j, k; - - /* Try converting the number to one or two words. If it fails, use GMP or - print an error message. The 2nd condition checks that the most -@@ -2414,8 +2439,8 @@ print_factors (const char *input) - gmp_printf ("%Zd:", t); - mp_factor (t, &factors); - -- for (unsigned int j = 0; j < factors.nfactors; j++) -- for (unsigned int k = 0; k < factors.e[j]; k++) -+ for (j = 0; j < factors.nfactors; j++) -+ for (k = 0; k < factors.e[j]; k++) - gmp_printf (" %Zd", factors.p[j]); - - mp_factor_clear (&factors); -@@ -2476,6 +2501,8 @@ do_stdin (void) - int - main (int argc, char **argv) - { -+ int c; -+ bool ok; - initialize_main (&argc, &argv); - set_program_name (argv[0]); - setlocale (LC_ALL, ""); -@@ -2486,7 +2513,6 @@ main (int argc, char **argv) - - alg = ALG_POLLARD_RHO; /* Default to Pollard rho */ - -- int c; - while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1) - { - switch (c) -@@ -2517,13 +2543,13 @@ main (int argc, char **argv) - memset (q_freq, 0, sizeof (q_freq)); - #endif - -- bool ok; - if (argc <= optind) - ok = do_stdin (); - else - { -+ int i; - ok = true; -- for (int i = optind; i < argc; i++) -+ for (i = optind; i < argc; i++) - if (! print_factors (argv[i])) - ok = false; - } -@@ -2532,8 +2558,9 @@ main (int argc, char **argv) - if (alg == ALG_SQUFOF && q_freq[0] > 0) - { - double acc_f; -+ unsigned int i; - printf ("q freq. cum. freq.(total: %d)\n", q_freq[0]); -- for (unsigned int i = 1, acc_f = 0.0; i <= Q_FREQ_SIZE; i++) -+ for (i = 1, acc_f = 0.0; i <= Q_FREQ_SIZE; i++) - { - double f = (double) q_freq[i] / q_freq[0]; - acc_f += f; -diff --git a/src/getlimits.c b/src/getlimits.c -index 597efd8..f30ebca 100644 ---- a/src/getlimits.c -+++ b/src/getlimits.c -@@ -88,11 +88,12 @@ decimal_absval_add_one (char *buf) - bool negative = (buf[1] == '-'); - char *absnum = buf + 1 + negative; - char *p = absnum + strlen (absnum); -+ char *result; - absnum[-1] = '0'; - while (*--p == '9') - *p = '0'; - ++*p; -- char *result = MIN (absnum, p); -+ result = MIN (absnum, p); - if (negative) - *--result = '-'; - return result; -diff --git a/src/group-list.c b/src/group-list.c -index 823384f..a51cea0 100644 ---- a/src/group-list.c -+++ b/src/group-list.c -@@ -105,6 +105,7 @@ print_group (gid_t gid, bool use_name) - { - struct group *grp = NULL; - bool ok = true; -+ char *s; - - if (use_name) - { -@@ -117,7 +118,7 @@ print_group (gid_t gid, bool use_name) - } - } - -- char *s = grp ? grp->gr_name : gidtostr (gid); -+ s = grp ? grp->gr_name : gidtostr (gid); - fputs (s, stdout); - return ok; - } -diff --git a/src/head.c b/src/head.c -index 65bd52a..aff7285 100644 ---- a/src/head.c -+++ b/src/head.c -@@ -443,6 +443,7 @@ elide_tail_bytes_file (const char *filename, int fd, uintmax_t n_elide, - return elide_tail_bytes_pipe (filename, fd, n_elide); - else - { -+ enum Copy_fd_status err; - /* Be careful here. The current position may actually be - beyond the end of the file. */ - off_t diff = size - current_pos; -@@ -451,7 +452,7 @@ elide_tail_bytes_file (const char *filename, int fd, uintmax_t n_elide, - if (bytes_remaining <= n_elide) - return true; - -- enum Copy_fd_status err = copy_fd (fd, bytes_remaining - n_elide); -+ err = copy_fd (fd, bytes_remaining - n_elide); - if (err == COPY_FD_OK) - return true; - -@@ -610,6 +611,9 @@ elide_tail_lines_seekable (const char *pretty_filename, int fd, - uintmax_t n_lines, - off_t start_pos, off_t size) - { -+ /* n_lines == 0 case needs special treatment. */ -+ const bool all_lines = !n_lines; -+ - char buffer[BUFSIZ]; - size_t bytes_read; - off_t pos = size; -@@ -631,9 +635,6 @@ elide_tail_lines_seekable (const char *pretty_filename, int fd, - return false; - } - -- /* n_lines == 0 case needs special treatment. */ -- const bool all_lines = !n_lines; -- - /* Count the incomplete line on files that don't end with a newline. */ - if (n_lines && bytes_read && buffer[bytes_read - 1] != '\n') - --n_lines; -diff --git a/src/id.c b/src/id.c -index ccd1e87..ae20a9c 100644 ---- a/src/id.c -+++ b/src/id.c -@@ -117,6 +117,7 @@ main (int argc, char **argv) - bool smack_enabled = is_smack_enabled (); - bool opt_zero = false; - char *pw_name = NULL; -+ size_t n_ids; - - /* If true, output the list of all group IDs. -G */ - bool just_group_list = false; -@@ -126,6 +127,7 @@ main (int argc, char **argv) - bool use_real = false; - /* If true, output only the user ID(s). -u */ - bool just_user = false; -+ bool default_format; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -183,7 +185,7 @@ main (int argc, char **argv) - } - } - -- size_t n_ids = argc - optind; -+ n_ids = argc - optind; - if (1 < n_ids) - { - error (0, 0, _("extra operand %s"), quote (argv[optind + 1])); -@@ -197,7 +199,7 @@ main (int argc, char **argv) - if (just_user + just_group + just_group_list + just_context > 1) - error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice")); - -- bool default_format = (just_user + just_group + just_group_list -+ default_format = (just_user + just_group + just_group_list - + just_context == 0); - - if (default_format && (use_real || use_name)) -@@ -345,6 +347,7 @@ static void - print_user (uid_t uid) - { - struct passwd *pwd = NULL; -+ char *s; - - if (use_name) - { -@@ -357,7 +360,7 @@ print_user (uid_t uid) - } - } - -- char *s = pwd ? pwd->pw_name : uidtostr (uid); -+ s = pwd ? pwd->pw_name : uidtostr (uid); - fputs (s, stdout); - } - -@@ -396,6 +399,7 @@ print_full_info (const char *username) - } - - { -+ int n_groups; - gid_t *groups; - int i; - -@@ -405,7 +409,7 @@ print_full_info (const char *username) - else - primary_group = egid; - -- int n_groups = xgetgroups (username, primary_group, &groups); -+ n_groups = xgetgroups (username, primary_group, &groups); - if (n_groups < 0) - { - if (username) -diff --git a/src/install.c b/src/install.c -index c342422..c8f9917 100644 ---- a/src/install.c -+++ b/src/install.c -@@ -197,8 +197,9 @@ need_copy (const char *src_name, const char *dest_name, - - if (owner_id == (uid_t) -1) - { -+ uid_t ruid; - errno = 0; -- uid_t ruid = getuid (); -+ ruid = getuid (); - if ((ruid == (uid_t) -1 && errno) || dest_sb.st_uid != ruid) - return true; - } -@@ -207,8 +208,9 @@ need_copy (const char *src_name, const char *dest_name, - - if (group_id == (uid_t) -1) - { -+ gid_t rgid; - errno = 0; -- gid_t rgid = getgid (); -+ rgid = getgid (); - if ((rgid == (uid_t) -1 && errno) || dest_sb.st_gid != rgid) - return true; - } -diff --git a/src/join.c b/src/join.c -index 5c26e78..d3afd4c 100644 ---- a/src/join.c -+++ b/src/join.c -@@ -655,6 +655,8 @@ join (FILE *fp1, FILE *fp2) - struct seq seq1, seq2; - int diff; - bool eof1, eof2; -+ struct line *line = NULL; -+ bool checktail = false; - - fadvise (fp1, FADVISE_SEQUENTIAL); - fadvise (fp2, FADVISE_SEQUENTIAL); -@@ -763,9 +765,7 @@ join (FILE *fp1, FILE *fp2) - tail ends of both inputs to verify that they are in order. We - skip the rest of the tail once we have issued a warning for that - file, unless we actually need to print the unpairable lines. */ -- struct line *line = NULL; -- bool checktail = false; -- -+ - if (check_input_order != CHECK_ORDER_DISABLED - && !(issued_disorder_warning[0] && issued_disorder_warning[1])) - checktail = true; -@@ -838,9 +838,10 @@ string_to_join_field (char const *str) - { - size_t result; - unsigned long int val; -+ strtol_error s_err; - verify (SIZE_MAX <= ULONG_MAX); - -- strtol_error s_err = xstrtoul (str, NULL, 10, &val, ""); -+ s_err = xstrtoul (str, NULL, 10, &val, ""); - if (s_err == LONGINT_OVERFLOW || (s_err == LONGINT_OK && SIZE_MAX < val)) - val = SIZE_MAX; - else if (s_err != LONGINT_OK || val == 0) -diff --git a/src/ls.c b/src/ls.c -index cd5996e..2b9ada8 100644 ---- a/src/ls.c -+++ b/src/ls.c -@@ -1049,13 +1049,14 @@ static size_t - abmon_init (void) - { - #ifdef HAVE_NL_LANGINFO -- required_mon_width = MAX_MON_WIDTH; - size_t curr_max_width; -+ required_mon_width = MAX_MON_WIDTH; - do - { -+ int i; - curr_max_width = required_mon_width; - required_mon_width = 0; -- for (int i = 0; i < 12; i++) -+ for (i = 0; i < 12; i++) - { - size_t width = curr_max_width; - -@@ -2054,6 +2055,7 @@ decode_switches (int argc, char **argv) - sizeof (*time_style_types)); - if (res < 0) - { -+ char const *const *p; - /* This whole block used to be a simple use of XARGMATCH. - but that didn't print the "posix-"-prefixed variants or - the "+"-prefixed format string option upon failure. */ -@@ -2065,7 +2067,7 @@ decode_switches (int argc, char **argv) - only because all four existing time_style_types values - are distinct. */ - fputs (_("Valid arguments are:\n"), stderr); -- char const *const *p = time_style_args; -+ p = time_style_args; - while (*p) - fprintf (stderr, " - [posix-]%s\n", *p++); - fputs (_(" - +FORMAT (e.g., +%H:%M) for a 'date'-style" -@@ -2334,10 +2336,10 @@ static bool - known_term_type (void) - { - char const *term = getenv ("TERM"); -+ char const *line = G_line; - if (! term || ! *term) - return false; - -- char const *line = G_line; - while (line - G_line < sizeof (G_line)) - { - if (STRNCMP_LIT (line, "TERM ") == 0) -@@ -2359,6 +2361,7 @@ parse_ls_color (void) - int ind_no; /* Indicator number */ - char label[3]; /* Indicator label */ - struct color_ext_type *ext; /* Extension we are working on */ -+ enum parse_state state; - - if ((p = getenv ("LS_COLORS")) == NULL || *p == '\0') - { -@@ -2381,7 +2384,7 @@ parse_ls_color (void) - advance. */ - buf = color_buf = xstrdup (p); - -- enum parse_state state = PS_START; -+ state = PS_START; - while (true) - { - switch (state) -@@ -2846,13 +2849,14 @@ getfilecon_cache (char const *file, struct fileinfo *f, bool deref) - /* st_dev of the most recently processed device for which we've - found that [l]getfilecon fails indicating lack of support. */ - static dev_t unsupported_device; -+ int r; - - if (f->stat.st_dev == unsupported_device) - { - errno = ENOTSUP; - return -1; - } -- int r = 0; -+ r = 0; - #ifdef HAVE_SMACK - if (is_smack_enabled ()) - r = smack_new_label_from_path (file, "security.SMACK64", deref, -@@ -2876,6 +2880,7 @@ file_has_acl_cache (char const *file, struct fileinfo *f) - /* st_dev of the most recently processed device for which we've - found that file_has_acl fails indicating lack of support. */ - static dev_t unsupported_device; -+ int n; - - if (f->stat.st_dev == unsupported_device) - { -@@ -2886,7 +2891,7 @@ file_has_acl_cache (char const *file, struct fileinfo *f) - /* Zero errno so that we can distinguish between two 0-returning cases: - "has-ACL-support, but only a default ACL" and "no ACL support". */ - errno = 0; -- int n = file_has_acl (file, &f->stat); -+ n = file_has_acl (file, &f->stat); - if (n <= 0 && errno_unsupported (errno)) - unsupported_device = f->stat.st_dev; - return n; -@@ -2901,6 +2906,7 @@ has_capability_cache (char const *file, struct fileinfo *f) - /* st_dev of the most recently processed device for which we've - found that has_capability fails indicating lack of support. */ - static dev_t unsupported_device; -+ bool b; - - if (f->stat.st_dev == unsupported_device) - { -@@ -2908,7 +2914,7 @@ has_capability_cache (char const *file, struct fileinfo *f) - return 0; - } - -- bool b = has_capability (file); -+ b = has_capability (file); - if ( !b && errno_unsupported (errno)) - unsupported_device = f->stat.st_dev; - return b; -@@ -3098,9 +3104,10 @@ gobble_file (char const *name, enum filetype type, ino_t inode, - && (format == long_format || check_symlink_color)) - { - struct stat linkstats; -+ char *linkname; - - get_link_name (absolute_name, f, command_line_arg); -- char *linkname = make_link_name (absolute_name, f->linkname); -+ linkname = make_link_name (absolute_name, f->linkname); - - /* Avoid following symbolic links when possible, ie, when - they won't be traced and when no indicator is needed. */ -@@ -3254,6 +3261,8 @@ get_link_name (char const *filename, struct fileinfo *f, bool command_line_arg) - static char * - make_link_name (char const *name, char const *linkname) - { -+ char *p; -+ size_t prefix_len; - if (!linkname) - return NULL; - -@@ -3262,11 +3271,11 @@ make_link_name (char const *name, char const *linkname) - - /* The link is to a relative name. Prepend any leading directory - in 'name' to the link name. */ -- size_t prefix_len = dir_len (name); -+ prefix_len = dir_len (name); - if (prefix_len == 0) - return xstrdup (linkname); - -- char *p = xmalloc (prefix_len + 1 + strlen (linkname) + 1); -+ p = xmalloc (prefix_len + 1 + strlen (linkname) + 1); - - /* PREFIX_LEN usually specifies a string not ending in slash. - In that case, extend it by one, since the next byte *is* a slash. -@@ -3668,6 +3677,7 @@ align_nstrftime (char *buf, size_t size, char const *fmt, struct tm const *tm, - the replacement is not done. A malloc here slows ls down by 2% */ - char rpl_fmt[sizeof (abmon[0]) + 100]; - const char *pb; -+ size_t ret; - if (required_mon_width && (pb = strstr (fmt, "%b"))) - { - if (strlen (fmt) < (sizeof (rpl_fmt) - sizeof (abmon[0]) + 2)) -@@ -3680,7 +3690,7 @@ align_nstrftime (char *buf, size_t size, char const *fmt, struct tm const *tm, - strcpy (pfmt, pb + 2); - } - } -- size_t ret = nstrftime (buf, size, nfmt, tm, __utc, __ns); -+ ret = nstrftime (buf, size, nfmt, tm, __utc, __ns); - return ret; - } - -@@ -3831,6 +3841,7 @@ print_long_format (const struct fileinfo *f) - char *p; - struct timespec when_timespec; - struct tm *when_local; -+ size_t w; - - /* Compute the mode string, except remove the trailing space if no - file in this directory has an ACL or security context. */ -@@ -4018,7 +4029,7 @@ print_long_format (const struct fileinfo *f) - } - - DIRED_FPUTS (buf, stdout, p - buf); -- size_t w = print_name_with_quoting (f, false, &dired_obstack, p - buf); -+ w = print_name_with_quoting (f, false, &dired_obstack, p - buf); - - if (f->filetype == symbolic_link) - { -@@ -4206,6 +4217,7 @@ print_name_with_quoting (const struct fileinfo *f, - struct obstack *stack, - size_t start_col) - { -+ size_t width; - const char* name = symlink_target ? f->linkname : f->name; - - bool used_color_this_time -@@ -4216,7 +4228,7 @@ print_name_with_quoting (const struct fileinfo *f, - if (stack) - PUSH_CURRENT_DIRED_POS (stack); - -- size_t width = quote_name (stdout, name, filename_quoting_options, NULL); -+ width = quote_name (stdout, name, filename_quoting_options, NULL); - dired_pos += width; - - if (stack) -@@ -4253,6 +4265,7 @@ prep_non_filename_text (void) - static size_t - print_file_name_and_frills (const struct fileinfo *f, size_t start_col) - { -+ size_t width; - char buf[MAX (LONGEST_HUMAN_READABLE + 1, INT_BUFSIZE_BOUND (uintmax_t))]; - - set_normal_color (); -@@ -4270,7 +4283,7 @@ print_file_name_and_frills (const struct fileinfo *f, size_t start_col) - if (print_scontext) - printf ("%*s ", format == with_commas ? 0 : scontext_width, f->scontext); - -- size_t width = print_name_with_quoting (f, false, NULL, start_col); -+ width = print_name_with_quoting (f, false, NULL, start_col); - - if (indicator_style != none) - width += print_type_indicator (f->stat_ok, f->stat.st_mode, f->filetype); -diff --git a/src/md5sum.c b/src/md5sum.c -index cc6dd49..679ed13 100644 ---- a/src/md5sum.c -+++ b/src/md5sum.c -@@ -230,8 +230,9 @@ static char * - filename_unescape (char *s, size_t s_len) - { - char *dst = s; -+ size_t i; - -- for (size_t i = 0; i < s_len; i++) -+ for (i = 0; i < s_len; i++) - { - switch (s[i]) - { -@@ -835,6 +836,7 @@ main (int argc, char **argv) - containing '\\' characters, we decided to not simplify the - output in this case. */ - bool needs_escape = strchr (file, '\\') || strchr (file, '\n'); -+ size_t i; - - if (prefix_tag) - { -@@ -847,7 +849,6 @@ main (int argc, char **argv) - fputs (") = ", stdout); - } - -- size_t i; - - /* Output a leading backslash if the file name contains - a newline or backslash. */ -diff --git a/src/mkdir.c b/src/mkdir.c -index eb9693c..16cde70 100644 ---- a/src/mkdir.c -+++ b/src/mkdir.c -@@ -121,17 +121,19 @@ static int - make_ancestor (char const *dir, char const *component, void *options) - { - struct mkdir_options const *o = options; -- -+ mode_t user_wx = S_IWUSR | S_IXUSR; -+ bool self_denying_umask; -+ int r; -+ - if (o->set_security_context && defaultcon (dir, S_IFDIR) < 0 - && ! ignorable_ctx_err (errno)) - error (0, errno, _("failed to set default creation context for %s"), - quote (dir)); - -- mode_t user_wx = S_IWUSR | S_IXUSR; -- bool self_denying_umask = (o->umask_value & user_wx) != 0; -+ self_denying_umask = (o->umask_value & user_wx) != 0; - if (self_denying_umask) - umask (o->umask_value & ~user_wx); -- int r = mkdir (component, S_IRWXUGO); -+ r = mkdir (component, S_IRWXUGO); - if (self_denying_umask) - { - int mkdir_errno = errno; -@@ -152,6 +154,7 @@ process_dir (char *dir, struct savewd *wd, void *options) - { - struct mkdir_options const *o = options; - bool set_defaultcon = false; -+ int ret; - - /* If possible set context before DIR created. */ - if (o->set_security_context) -@@ -173,7 +176,7 @@ process_dir (char *dir, struct savewd *wd, void *options) - quote (dir)); - } - -- int ret = (make_dir_parents (dir, wd, o->make_ancestor_function, options, -+ ret = (make_dir_parents (dir, wd, o->make_ancestor_function, options, - o->mode, announce_mkdir, - o->mode_bits, (uid_t) -1, (gid_t) -1, true) - ? EXIT_SUCCESS -diff --git a/src/nproc.c b/src/nproc.c -index 9bfc8b3..8e178d2 100644 ---- a/src/nproc.c -+++ b/src/nproc.c -@@ -76,6 +76,7 @@ int - main (int argc, char **argv) - { - unsigned long nproc, ignore = 0; -+ enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE; - initialize_main (&argc, &argv); - set_program_name (argv[0]); - setlocale (LC_ALL, ""); -@@ -84,8 +85,7 @@ main (int argc, char **argv) - - atexit (close_stdout); - -- enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE; -- -+ - while (1) - { - int c = getopt_long (argc, argv, "", longopts, NULL); -diff --git a/src/numfmt.c b/src/numfmt.c -index 206866a..5e60422 100644 ---- a/src/numfmt.c -+++ b/src/numfmt.c -@@ -520,9 +520,11 @@ simple_strtod_float (const char *input_str, - char *ptr2; - long double val_frac = 0; - bool neg_frac; -+ size_t exponent; -+ enum simple_strtod_error e2; - - (*endptr) += decimal_point_length; -- enum simple_strtod_error e2 = -+ e2 = - simple_strtod_int (*endptr, &ptr2, &val_frac, &neg_frac); - if (e2 != SSE_OK && e2 != SSE_OK_PRECISION_LOSS) - return e2; -@@ -532,7 +534,7 @@ simple_strtod_float (const char *input_str, - return SSE_INVALID_NUMBER; - - /* number of digits in the fractions. */ -- size_t exponent = ptr2 - *endptr; -+ exponent = ptr2 - *endptr; - - val_frac = ((long double) val_frac) / powerld (10, exponent); - -@@ -579,12 +581,14 @@ simple_strtod_human (const char *input_str, - int power = 0; - /* 'scale_auto' is checked below. */ - int scale_base = default_scale_base (allowed_scaling); -+ enum simple_strtod_error e; -+ long double multiplier; - - devmsg ("simple_strtod_human:\n input string: %s\n " - "locale decimal-point: %s\n", - quote_n (0, input_str), quote_n (1, decimal_point)); - -- enum simple_strtod_error e = -+ e = - simple_strtod_float (input_str, endptr, value, precision); - if (e != SSE_OK && e != SSE_OK_PRECISION_LOSS) - return e; -@@ -630,7 +634,7 @@ simple_strtod_human (const char *input_str, - return SSE_MISSING_I_SUFFIX; - } - -- long double multiplier = powerld (scale_base, power); -+ multiplier = powerld (scale_base, power); - - devmsg (" suffix power=%d^%d = %Lf\n", scale_base, power, multiplier); - -@@ -687,13 +691,18 @@ double_to_human (long double val, int precision, - char *buf, size_t buf_size, - enum scale_type scale, int group, enum round_type round) - { -+ double scale_base; -+ int ten_or_less = 0; -+ int show_decimal_point; -+ unsigned int power = 0; -+ char *pfmt; - int num_size; - char fmt[64]; - verify (sizeof (fmt) > (INT_BUFSIZE_BOUND (zero_padding_width) - + INT_BUFSIZE_BOUND (precision) - + 10 /* for %.Lf etc. */)); - -- char *pfmt = fmt; -+ pfmt = fmt; - *pfmt++ = '%'; - - if (group) -@@ -724,15 +733,14 @@ double_to_human (long double val, int precision, - } - - /* Scaling requested by user. */ -- double scale_base = default_scale_base (scale); -+ scale_base = default_scale_base (scale); - - /* Normalize val to scale. */ -- unsigned int power = 0; -+ power = 0; - val = expld (val, scale_base, &power); - devmsg (" scaled value to %Lf * %0.f ^ %d\n", val, scale_base, power); - - /* Perform rounding. */ -- int ten_or_less = 0; - if (absld (val) < 10) - { - /* for values less than 10, we allow one decimal-point digit, -@@ -754,7 +762,7 @@ double_to_human (long double val, int precision, - - /* should "7.0" be printed as "7" ? - if removing the ".0" is preferred, enable the fourth condition. */ -- int show_decimal_point = (val != 0) && (absld (val) < 10) && (power > 0); -+ show_decimal_point = (val != 0) && (absld (val) < 10) && (power > 0); - /* && (absld (val) > simple_round_floor (val))) */ - - devmsg (" after rounding, value=%Lf * %0.f ^ %d\n", val, scale_base, power); -@@ -1155,6 +1163,10 @@ print_padded_number (void) - static int - process_suffixed_number (char *text, long double *result, size_t *precision) - { -+ char *p; -+ long double val = 0; -+ enum simple_strtod_error e; -+ const unsigned int skip_count; - if (suffix && strlen (text) > strlen (suffix)) - { - char *possible_suffix = text + strlen (text) - strlen (suffix); -@@ -1170,10 +1182,10 @@ process_suffixed_number (char *text, long double *result, size_t *precision) - } - - /* Skip white space - always. */ -- char *p = text; -+ p = text; - while (*p && isblank (to_uchar (*p))) - ++p; -- const unsigned int skip_count = text - p; -+ skip_count = text - p; - - /* setup auto-padding. */ - if (auto_padding) -@@ -1190,8 +1202,7 @@ process_suffixed_number (char *text, long double *result, size_t *precision) - devmsg ("setting Auto-Padding to %ld characters\n", padding_width); - } - -- long double val = 0; -- enum simple_strtod_error e = parse_human_number (p, &val, precision); -+ e = parse_human_number (p, &val, precision); - if (e == SSE_OK_PRECISION_LOSS && debug) - error (0, 0, _("large input value %s: possible precision loss"), - quote (p)); -@@ -1348,6 +1359,7 @@ int - main (int argc, char **argv) - { - int valid_numbers = 1; -+ int exit_status; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1534,7 +1546,7 @@ main (int argc, char **argv) - if (debug && !valid_numbers) - error (0, 0, _("failed to convert some of the input numbers")); - -- int exit_status = EXIT_SUCCESS; -+ exit_status = EXIT_SUCCESS; - if (!valid_numbers && _invalid != inval_warn && _invalid != inval_ignore) - exit_status = EXIT_CONVERSION_WARNINGS; - -diff --git a/src/od.c b/src/od.c -index 7bc0e2a..264c508 100644 ---- a/src/od.c -+++ b/src/od.c -@@ -448,7 +448,7 @@ N (size_t fields, size_t blank, void const *block, \ - else \ - x = *p; \ - p++; \ -- ACTION; \ -+ { ACTION; } \ - pad_remaining = next_pad; \ - } \ - } -diff --git a/src/realpath.c b/src/realpath.c -index 0c55327..e75dabd 100644 ---- a/src/realpath.c -+++ b/src/realpath.c -@@ -101,8 +101,9 @@ realpath_canon (const char *fname, int can_mode) - char *can_fname = canonicalize_filename_mode (fname, can_mode); - if (logical && can_fname) /* canonicalize again to resolve symlinks. */ - { -+ char *can_fname2; - can_mode &= ~CAN_NOLINKS; -- char *can_fname2 = canonicalize_filename_mode (can_fname, can_mode); -+ can_fname2 = canonicalize_filename_mode (can_fname, can_mode); - free (can_fname); - return can_fname2; - } -@@ -176,6 +177,7 @@ main (int argc, char **argv) - int can_mode = CAN_ALL_BUT_LAST; - const char *relative_to = NULL; - const char *relative_base = NULL; -+ bool need_dir; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -240,7 +242,7 @@ main (int argc, char **argv) - if (relative_base && !relative_to) - relative_to = relative_base; - -- bool need_dir = (can_mode & CAN_MODE_MASK) == CAN_EXISTING; -+ need_dir = (can_mode & CAN_MODE_MASK) == CAN_EXISTING; - if (relative_to) - { - can_relative_to = realpath_canon (relative_to, can_mode); -diff --git a/src/relpath.c b/src/relpath.c -index 29472e5..f4b0ea2 100644 ---- a/src/relpath.c -+++ b/src/relpath.c -@@ -88,14 +88,16 @@ bool - relpath (const char *can_fname, const char *can_reldir, char *buf, size_t len) - { - bool buf_err = false; -+ const char *relto_suffix; -+ const char *fname_suffix; - - /* Skip the prefix common to --relative-to and path. */ - int common_index = path_common_prefix (can_reldir, can_fname); - if (!common_index) - return false; - -- const char *relto_suffix = can_reldir + common_index; -- const char *fname_suffix = can_fname + common_index; -+ relto_suffix = can_reldir + common_index; -+ fname_suffix = can_fname + common_index; - - /* Skip over extraneous '/'. */ - if (*relto_suffix == '/') -diff --git a/src/remove.c b/src/remove.c -index 4cc4a08..d02fa5f 100644 ---- a/src/remove.c -+++ b/src/remove.c -@@ -180,17 +180,20 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - int fd_cwd = fts->fts_cwd_fd; - char const *full_name = ent->fts_path; - char const *filename = ent->fts_accpath; -+ struct stat st; -+ struct stat *sbuf; -+ int dirent_type; -+ int write_protected = 0; -+ bool is_empty = false; -+ int wp_errno = 0; - if (is_empty_p) - *is_empty_p = T_UNKNOWN; - -- struct stat st; -- struct stat *sbuf = &st; -+ sbuf = &st; - cache_stat_init (sbuf); - -- int dirent_type = is_dir ? DT_DIR : DT_UNKNOWN; -- int write_protected = 0; -- -- bool is_empty = false; -+ dirent_type = is_dir ? DT_DIR : DT_UNKNOWN; -+ - if (is_empty_p) - { - is_empty = is_empty_dir (fd_cwd, filename); -@@ -206,7 +209,6 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - if (x->interactive == RMI_NEVER) - return RM_OK; - -- int wp_errno = 0; - if (!x->ignore_missing_files - && ((x->interactive == RMI_ALWAYS) || x->stdin_tty) - && dirent_type != DT_LNK) -@@ -217,6 +219,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - - if (write_protected || x->interactive == RMI_ALWAYS) - { -+ char const *quoted_name; - if (0 <= write_protected && dirent_type == DT_UNKNOWN) - { - if (cache_fstatat (fd_cwd, filename, sbuf, AT_SYMLINK_NOFOLLOW) == 0) -@@ -256,7 +259,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - break; - } - -- char const *quoted_name = quote (full_name); -+ quoted_name = quote (full_name); - - if (write_protected < 0) - { -@@ -493,6 +496,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) - case FTS_NSOK: /* e.g., dangling symlink */ - case FTS_DEFAULT: /* none of the above */ - { -+ bool is_dir; -+ enum RM_status s; - /* With --one-file-system, do not attempt to remove a mount point. - fts' FTS_XDEV ensures that we don't process any entries under - the mount point. */ -@@ -507,8 +512,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) - return RM_ERROR; - } - -- bool is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR; -- enum RM_status s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL); -+ is_dir = ent->fts_info == FTS_DP || ent->fts_info == FTS_DNR; -+ s = prompt (fts, ent, is_dir, x, PA_REMOVE_DIR, NULL); - if (s != RM_OK) - return s; - return excise (fts, ent, x, is_dir); -@@ -549,15 +554,17 @@ rm (char *const *file, struct rm_options const *x) - int bit_flags = (FTS_CWDFD - | FTS_NOSTAT - | FTS_PHYSICAL); -+ FTS *fts; - - if (x->one_file_system) - bit_flags |= FTS_XDEV; - -- FTS *fts = xfts_open (file, bit_flags, NULL); -+ fts = xfts_open (file, bit_flags, NULL); - - while (1) - { - FTSENT *ent; -+ enum RM_status s; - - ent = fts_read (fts); - if (ent == NULL) -@@ -570,7 +577,7 @@ rm (char *const *file, struct rm_options const *x) - break; - } - -- enum RM_status s = rm_fts (fts, ent, x); -+ s = rm_fts (fts, ent, x); - - assert (VALID_STATUS (s)); - UPDATE_STATUS (rm_status, s); -diff --git a/src/rm.c b/src/rm.c -index 5baea15..cd4021f 100644 ---- a/src/rm.c -+++ b/src/rm.c -@@ -209,6 +209,9 @@ main (int argc, char **argv) - struct rm_options x; - bool prompt_once = false; - int c; -+ size_t n_files; -+ char **file; -+ enum RM_status status; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -332,8 +335,8 @@ main (int argc, char **argv) - quote ("/")); - } - -- size_t n_files = argc - optind; -- char **file = argv + optind; -+ n_files = argc - optind; -+ file = argv + optind; - - if (prompt_once && (x.recursive || 3 < n_files)) - { -@@ -350,7 +353,7 @@ main (int argc, char **argv) - exit (EXIT_SUCCESS); - } - -- enum RM_status status = rm (file, &x); -+ status = rm (file, &x); - assert (VALID_STATUS (status)); - exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS); - } -diff --git a/src/seq.c b/src/seq.c -index 1124358..ac2edb9 100644 ---- a/src/seq.c -+++ b/src/seq.c -@@ -153,6 +153,7 @@ scan_arg (const char *arg) - if (! arg[strcspn (arg, "xX")] && isfinite (ret.value)) - { - char const *decimal_point = strchr (arg, '.'); -+ char const *e; - if (! decimal_point) - ret.precision = 0; - else -@@ -165,7 +166,7 @@ scan_arg (const char *arg) - : (decimal_point == arg /* .# -> 0.# */ - || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */ - } -- char const *e = strchr (arg, 'e'); -+ e = strchr (arg, 'e'); - if (! e) - e = strchr (arg, 'E'); - if (e) -@@ -330,6 +331,7 @@ get_default_format (operand first, operand step, operand last) - { - if (equal_width) - { -+ size_t width; - /* increase first_width by any increased precision in step */ - size_t first_width = first.width + (prec - first.precision); - /* adjust last_width to use precision from first/step */ -@@ -340,7 +342,7 @@ get_default_format (operand first, operand step, operand last) - last_width++; /* include space for '.' */ - if (first.precision == 0 && prec) - first_width++; /* include space for '.' */ -- size_t width = MAX (first_width, last_width); -+ width = MAX (first_width, last_width); - if (width <= INT_MAX) - { - int w = width; -@@ -411,20 +413,23 @@ trim_leading_zeros (char const *s) - static bool - seq_fast (char const *a, char const *b) - { -+ size_t p_len, q_len, n; -+ char *p0, *p, *q0, *q; -+ bool ok; - /* Skip past any leading 0's. Without this, our naive cmp - function would declare 000 to be larger than 99. */ - a = trim_leading_zeros (a); - b = trim_leading_zeros (b); - -- size_t p_len = strlen (a); -- size_t q_len = strlen (b); -- size_t n = MAX (p_len, q_len); -- char *p0 = xmalloc (n + 1); -- char *p = memcpy (p0 + n - p_len, a, p_len + 1); -- char *q0 = xmalloc (n + 1); -- char *q = memcpy (q0 + n - q_len, b, q_len + 1); -+ p_len = strlen (a); -+ q_len = strlen (b); -+ n = MAX (p_len, q_len); -+ p0 = xmalloc (n + 1); -+ p = memcpy (p0 + n - p_len, a, p_len + 1); -+ q0 = xmalloc (n + 1); -+ q = memcpy (q0 + n - q_len, b, q_len + 1); - -- bool ok = cmp (p, p_len, q, q_len) <= 0; -+ ok = cmp (p, p_len, q, q_len) <= 0; - if (ok) - { - /* Buffer at least this many numbers per fwrite call. -@@ -485,6 +490,7 @@ main (int argc, char **argv) - - /* The printf(3) format used for output. */ - char const *format_str = NULL; -+ unsigned int n_args; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -536,7 +542,7 @@ main (int argc, char **argv) - } - } - -- unsigned int n_args = argc - optind; -+ n_args = argc - optind; - if (n_args < 1) - { - error (0, 0, _("missing operand")); -diff --git a/src/shred.c b/src/shred.c -index bd88e38..04be383 100644 ---- a/src/shred.c -+++ b/src/shred.c -@@ -254,11 +254,12 @@ to be recovered later.\n\ - static bool - periodic_pattern (int type) - { -+ unsigned char r[3]; -+ unsigned int bits; - if (type <= 0) - return false; - -- unsigned char r[3]; -- unsigned int bits = type & 0xfff; -+ bits = type & 0xfff; - - bits |= bits << 12; - r[0] = (bits >> 4) & 255; -@@ -386,6 +387,7 @@ direct_mode (int fd, bool enable) - static bool - dorewind (int fd, struct stat const *st) - { -+ off_t offset; - if (S_ISCHR (st->st_mode)) - { - #ifdef __linux__ -@@ -399,7 +401,7 @@ dorewind (int fd, struct stat const *st) - return true; - #endif - } -- off_t offset = lseek (fd, 0, SEEK_SET); -+ offset = lseek (fd, 0, SEEK_SET); - if (0 < offset) - errno = EINVAL; - return offset == 0; -@@ -427,32 +429,37 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep, - size_t lim; /* Amount of data to try writing */ - size_t soff; /* Offset into buffer for next write */ - ssize_t ssize; /* Return value from write */ -+ size_t output_size; -+ void *fill_pattern_mem; -+ unsigned char *pbuf; -+ -+ char pass_string[PASS_NAME_SIZE]; /* Name of current pass */ -+ bool write_error = false; -+ bool other_error = false; -+ -+ /* Printable previous offset into the file */ -+ char previous_offset_buf[LONGEST_HUMAN_READABLE + 1]; -+ char const *previous_human_offset IF_LINT ( = 0); -+ -+ bool try_without_directio; - - /* Fill pattern buffer. Aligning it to a page so we can do direct I/O. */ - size_t page_size = getpagesize (); - #define PERIODIC_OUTPUT_SIZE (60 * 1024) - #define NONPERIODIC_OUTPUT_SIZE (64 * 1024) - verify (PERIODIC_OUTPUT_SIZE % 3 == 0); -- size_t output_size = periodic_pattern (type) -+ output_size = periodic_pattern (type) - ? PERIODIC_OUTPUT_SIZE : NONPERIODIC_OUTPUT_SIZE; - #define PAGE_ALIGN_SLOP (page_size - 1) /* So directio works */ - #define FILLPATTERN_SIZE (((output_size + 2) / 3) * 3) /* Multiple of 3 */ - #define PATTERNBUF_SIZE (PAGE_ALIGN_SLOP + FILLPATTERN_SIZE) -- void *fill_pattern_mem = xmalloc (PATTERNBUF_SIZE); -- unsigned char *pbuf = ptr_align (fill_pattern_mem, page_size); -- -- char pass_string[PASS_NAME_SIZE]; /* Name of current pass */ -- bool write_error = false; -- bool other_error = false; -- -- /* Printable previous offset into the file */ -- char previous_offset_buf[LONGEST_HUMAN_READABLE + 1]; -- char const *previous_human_offset IF_LINT ( = 0); -+ fill_pattern_mem = xmalloc (PATTERNBUF_SIZE); -+ pbuf = ptr_align (fill_pattern_mem, page_size); - - /* As a performance tweak, avoid direct I/O for small sizes, - as it's just a performance rather then security consideration, - and direct I/O can often be unsupported for small non aligned sizes. */ -- bool try_without_directio = 0 < size && size < output_size; -+ try_without_directio = 0 < size && size < output_size; - if (! try_without_directio) - direct_mode (fd, true); - -@@ -486,6 +493,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep, - offset = 0; - while (true) - { -+ bool done; - /* How much to write this time? */ - lim = output_size; - if (0 <= size && size - offset < output_size) -@@ -565,7 +573,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep, - - offset += soff; - -- bool done = offset == size; -+ done = offset == size; - - /* Time to print progress? */ - if (n && ((done && *previous_human_offset) -diff --git a/src/shuf.c b/src/shuf.c -index 2505be6..c57ccb9 100644 ---- a/src/shuf.c -+++ b/src/shuf.c -@@ -152,6 +152,7 @@ static off_t - input_size (void) - { - off_t file_size; -+ off_t input_offset; - - struct stat stat_buf; - if (fstat (STDIN_FILENO, &stat_buf) != 0) -@@ -161,7 +162,7 @@ input_size (void) - else - return OFF_T_MAX; - -- off_t input_offset = lseek (STDIN_FILENO, 0, SEEK_CUR); -+ input_offset = lseek (STDIN_FILENO, 0, SEEK_CUR); - if (input_offset < 0) - return OFF_T_MAX; - -diff --git a/src/sort.c b/src/sort.c -index c249319..009f60b 100644 ---- a/src/sort.c -+++ b/src/sort.c -@@ -764,9 +764,10 @@ static bool - delete_proc (pid_t pid) - { - struct tempnode test; -+ struct tempnode *node; - - test.pid = pid; -- struct tempnode *node = hash_delete (proctab, &test); -+ node = hash_delete (proctab, &test); - if (! node) - return false; - node->state = REAPED; -@@ -1162,6 +1163,7 @@ open_temp (struct tempnode *temp) - { - int tempfd, pipefds[2]; - FILE *fp = NULL; -+ pid_t child; - - if (temp->state == UNREAPED) - wait_proc (temp->pid); -@@ -1170,7 +1172,7 @@ open_temp (struct tempnode *temp) - if (tempfd < 0) - return NULL; - -- pid_t child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS); -+ child = pipe_fork (pipefds, MAX_FORK_TRIES_DECOMPRESS); - - switch (child) - { -@@ -1446,6 +1448,7 @@ specify_nthreads (int oi, char c, char const *s) - static size_t - default_sort_size (void) - { -+ double avail, total, mem; - /* Let SIZE be MEM, but no more than the maximum object size, - total memory, or system resource limits. Don't bother to check - for values like RLIM_INFINITY since in practice they are not much -@@ -1472,9 +1475,9 @@ default_sort_size (void) - - /* Let MEM be available memory or 1/8 of total memory, whichever - is greater. */ -- double avail = physmem_available (); -- double total = physmem_total (); -- double mem = MAX (avail, total / 8); -+ avail = physmem_available (); -+ total = physmem_total (); -+ mem = MAX (avail, total / 8); - - /* Leave a 1/4 margin for physical memory. */ - if (total * 0.75 < size) -@@ -1931,12 +1934,13 @@ find_unit_order (char const *number) - static int - human_numcompare (char const *a, char const *b) - { -+ int diff; - while (blanks[to_uchar (*a)]) - a++; - while (blanks[to_uchar (*b)]) - b++; - -- int diff = find_unit_order (a) - find_unit_order (b); -+ diff = find_unit_order (a) - find_unit_order (b); - return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep)); - } - -@@ -1963,10 +1967,10 @@ static int - nan_compare (char const *sa, char const *sb) - { - long_double a; -+ long_double b; - memset (&a, 0, sizeof a); - a = strtold (sa, NULL); - -- long_double b; - memset (&b, 0, sizeof b); - b = strtold (sb, NULL); - -@@ -2068,9 +2072,9 @@ random_md5_state_init (char const *random_source) - static size_t - xstrxfrm (char *restrict dest, char const *restrict src, size_t destsize) - { -- errno = 0; - size_t translated_size = strxfrm (dest, src, destsize); -- -+ errno = 0; -+ - if (errno) - { - error (0, errno, _("string transformation failed")); -@@ -2103,6 +2107,7 @@ compare_random (char *restrict texta, size_t lena, - void *allocated = NULL; - uint32_t dig[2][MD5_DIGEST_SIZE / sizeof (uint32_t)]; - struct md5_ctx s[2]; -+ int diff; - s[0] = s[1] = random_md5_state; - - if (hard_LC_COLLATE) -@@ -2128,6 +2133,8 @@ compare_random (char *restrict texta, size_t lena, - twice on typical implementations. Don't worry about - size_t overflow, as the guess need not be correct. */ - size_t guess_bufsize = 3 * (lena + lenb) + 2; -+ size_t sizea, sizeb; -+ bool a_fits; - if (bufsize < guess_bufsize) - { - bufsize = MAX (guess_bufsize, bufsize * 3 / 2); -@@ -2140,10 +2147,10 @@ compare_random (char *restrict texta, size_t lena, - } - } - -- size_t sizea = -+ sizea = - (texta < lima ? xstrxfrm (buf, texta, bufsize) + 1 : 0); -- bool a_fits = sizea <= bufsize; -- size_t sizeb = -+ a_fits = sizea <= bufsize; -+ sizeb = - (textb < limb - ? (xstrxfrm ((a_fits ? buf + sizea : NULL), textb, - (a_fits ? bufsize - sizea : 0)) -@@ -2196,7 +2203,7 @@ compare_random (char *restrict texta, size_t lena, - /* Compute and compare the checksums. */ - md5_process_bytes (texta, lena, &s[0]); md5_finish_ctx (&s[0], dig[0]); - md5_process_bytes (textb, lenb, &s[1]); md5_finish_ctx (&s[1], dig[1]); -- int diff = memcmp (dig[0], dig[1], sizeof dig[0]); -+ diff = memcmp (dig[0], dig[1], sizeof dig[0]); - - /* Fall back on the tiebreaker if the checksums collide. */ - if (! diff) -@@ -2267,6 +2274,7 @@ debug_key (struct line const *line, struct keyfield const *key) - char *text = line->text; - char *beg = text; - char *lim = text + line->length - 1; -+ size_t offset, width; - - if (key) - { -@@ -2278,12 +2286,13 @@ debug_key (struct line const *line, struct keyfield const *key) - if (key->skipsblanks || key->month || key_numeric (key)) - { - char saved = *lim; -+ char *tighter_lim; - *lim = '\0'; - - while (blanks[to_uchar (*beg)]) - beg++; - -- char *tighter_lim = beg; -+ tighter_lim = beg; - - if (lim < beg) - tighter_lim = lim; -@@ -2319,8 +2328,8 @@ debug_key (struct line const *line, struct keyfield const *key) - } - } - -- size_t offset = debug_width (text, beg); -- size_t width = debug_width (beg, lim); -+ offset = debug_width (text, beg); -+ width = debug_width (beg, lim); - mark_key (offset, width); - } - -@@ -2394,6 +2403,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) - - for (key = keylist; key; key = key->next, keynum++) - { -+ bool implicit_skip, maybe_space_aligned, line_offset; - if (key->obsolete_used) - { - size_t sword = key->sword; -@@ -2428,10 +2438,10 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) - error (0, 0, _("key %lu has zero width and will be ignored"), keynum); - - /* Warn about significant leading blanks. */ -- bool implicit_skip = key_numeric (key) || key->month; -- bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) -+ implicit_skip = key_numeric (key) || key->month; -+ maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key) - && !(key->schar || key->echar); -- bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ -+ line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */ - if (!gkey_only && tab == TAB_DEFAULT && !line_offset - && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned)) - || (!key->skipsblanks && key->schar) -@@ -2475,10 +2485,10 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) - || (ugkey.reverse && (stable || unique) && keylist)) - { - bool ugkey_reverse = ugkey.reverse; -+ char opts[sizeof short_options]; - if (!(stable || unique)) - ugkey.reverse = false; - /* The following is too big, but guaranteed to be "big enough". */ -- char opts[sizeof short_options]; - key_to_opts (&ugkey, opts); - error (0, 0, - ngettext ("option '-%s' is ignored", -@@ -2509,6 +2519,7 @@ keycompare (struct line const *a, struct line const *b) - - while (true) - { -+ size_t lena, lenb; - char const *translate = key->translate; - bool const *ignore = key->ignore; - -@@ -2517,8 +2528,8 @@ keycompare (struct line const *a, struct line const *b) - limb = MAX (textb, limb); - - /* Find the lengths. */ -- size_t lena = lima - texta; -- size_t lenb = limb - textb; -+ lena = lima - texta; -+ lenb = limb - textb; - - if (hard_LC_COLLATE || key_numeric (key) - || key->month || key->random || key->version) -@@ -3187,6 +3198,8 @@ sequential_sort (struct line *restrict lines, size_t nlines, - size_t nhi = nlines - nlo; - struct line *lo = lines; - struct line *hi = lines - nlo; -+ struct line *dest; -+ struct line const *sorted_lo; - - sequential_sort (hi, nhi, temp - (to_temp ? nlo : 0), to_temp); - if (1 < nlo) -@@ -3194,8 +3207,6 @@ sequential_sort (struct line *restrict lines, size_t nlines, - else if (!to_temp) - temp[-1] = lo[-1]; - -- struct line *dest; -- struct line const *sorted_lo; - if (to_temp) - { - dest = temp; -@@ -3829,6 +3840,8 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles, - while (true) - { - /* Merge directly into the output file if possible. */ -+ FILE *tfp; -+ struct tempnode *temp; - FILE **fps; - size_t nopened = open_input_files (files, nfiles, &fps); - -@@ -3851,8 +3864,6 @@ merge (struct sortfile *files, size_t ntemps, size_t nfiles, - file with our spare file descriptor. Retry if that failed - (e.g., some other process could open a file between the time - we closed and tried to create). */ -- FILE *tfp; -- struct tempnode *temp; - do - { - nopened--; -@@ -3881,10 +3892,10 @@ sort (char *const *files, size_t nfiles, char const *output_file, - size_t nthreads) - { - struct buffer buf; -- IF_LINT (buf.buf = NULL); - size_t ntemps = 0; - bool output_file_created = false; -- -+ IF_LINT (buf.buf = NULL); -+ - buf.alloc = 0; - - while (nfiles) -@@ -3949,8 +3960,9 @@ sort (char *const *files, size_t nfiles, char const *output_file, - if (1 < buf.nlines) - { - struct merge_node_queue queue; -+ struct merge_node *merge_tree; - queue_init (&queue, nthreads); -- struct merge_node *merge_tree = -+ merge_tree = - merge_tree_init (nthreads, buf.nlines, line); - - sortlines (line, nthreads, buf.nlines, merge_tree + 1, -@@ -4730,6 +4742,7 @@ main (int argc, char **argv) - } - else - { -+ size_t nthreads_max; - if (!nthreads) - { - unsigned long int np = num_processors (NPROC_CURRENT_OVERRIDABLE); -@@ -4737,7 +4750,7 @@ main (int argc, char **argv) - } - - /* Avoid integer overflow later. */ -- size_t nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node)); -+ nthreads_max = SIZE_MAX / (2 * sizeof (struct merge_node)); - nthreads = MIN (nthreads, nthreads_max); - - sort (files, nfiles, outfile, nthreads); -diff --git a/src/split.c b/src/split.c -index dacacaa..9afa08a 100644 ---- a/src/split.c -+++ b/src/split.c -@@ -308,14 +308,15 @@ new_name: - - if (numeric_suffix_start) - { -- assert (! widen); -- -+ size_t *sufindex_end; -+ - /* Update the output file name. */ - size_t i = strlen (numeric_suffix_start); -+ assert (! widen); - memcpy (outfile_mid + suffix_length - i, numeric_suffix_start, i); - - /* Update the suffix index. */ -- size_t *sufindex_end = sufindex + suffix_length; -+ sufindex_end = sufindex + suffix_length; - while (i-- != 0) - *--sufindex_end = numeric_suffix_start[i] - '0'; - } -@@ -361,13 +362,14 @@ create (const char *name) - { - if (!filter_command) - { -+ int fd; -+ struct stat out_stat_buf; - if (verbose) - fprintf (stdout, _("creating file %s\n"), quote (name)); - -- int fd = open (name, O_WRONLY | O_CREAT | O_BINARY, MODE_RW_UGO); -+ fd = open (name, O_WRONLY | O_CREAT | O_BINARY, MODE_RW_UGO); - if (fd < 0) - return fd; -- struct stat out_stat_buf; - if (fstat (fd, &out_stat_buf) != 0) - error (EXIT_FAILURE, errno, _("failed to stat %s"), quote (name)); - if (SAME_INODE (in_stat_buf, out_stat_buf)) -@@ -444,9 +446,9 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name) - error (EXIT_FAILURE, errno, "%s", name); - if (fd >= 0) - { -+ int j; - if (fp == NULL && close (fd) < 0) - error (EXIT_FAILURE, errno, "%s", name); -- int j; - for (j = 0; j < n_open_pipes; ++j) - { - if (open_pipes[j] == fd) -@@ -632,11 +634,13 @@ line_bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize) - - do - { -+ size_t n_left; -+ char *sob; - n_read = safe_read (STDIN_FILENO, buf, bufsize); - if (n_read == SAFE_READ_ERROR) - error (EXIT_FAILURE, errno, "%s", infile); -- size_t n_left = n_read; -- char *sob = buf; -+ n_left = n_read; -+ sob = buf; - while (n_left) - { - size_t split_rest = 0; -@@ -669,8 +673,8 @@ line_bytes_split (uintmax_t n_bytes, char *buf, size_t bufsize) - /* Output to eol if present. */ - if (eol) - { -- split_line = true; - size_t n_write = eol - sob + 1; -+ split_line = true; - cwrite (n_out == 0, sob, n_write); - n_out += n_write; - n_left -= n_write; -@@ -738,8 +742,6 @@ static void - lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, - off_t file_size) - { -- assert (n && k <= n && n <= file_size); -- - const off_t chunk_size = file_size / n; - uintmax_t chunk_no = 1; - off_t chunk_end = chunk_size - 1; -@@ -747,6 +749,8 @@ lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, - bool new_file_flag = true; - bool chunk_truncated = false; - -+ assert (n && k <= n && n <= file_size); -+ - if (k > 1) - { - /* Start reading 1 byte before kth chunk of file. */ -@@ -1133,6 +1137,8 @@ main (int argc, char **argv) - int c; - int digits_optind = 0; - off_t file_size IF_LINT (= 0); -+ void *b; -+ char *buf; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -1431,8 +1437,8 @@ main (int argc, char **argv) - file_size = MAX (file_size, n_units); - } - -- void *b = xmalloc (in_blk_size + 1 + page_size - 1); -- char *buf = ptr_align (b, page_size); -+ b = xmalloc (in_blk_size + 1 + page_size - 1); -+ buf = ptr_align (b, page_size); - - /* When filtering, closure of one pipe must not terminate the process, - as there may still be other streams expecting input from us. */ -diff --git a/src/stat.c b/src/stat.c -index b65dbe5..ca759d9 100644 ---- a/src/stat.c -+++ b/src/stat.c -@@ -619,6 +619,10 @@ out_epoch_sec (char *pformat, size_t prefix_len, - int width = 0; - int precision = 0; - bool frac_left_adjust = false; -+ int divisor = 1; -+ int frac_sec; -+ int int_len; -+ int i; - - if (dot) - { -@@ -640,6 +644,7 @@ out_epoch_sec (char *pformat, size_t prefix_len, - /* If a nontrivial width is given, subtract the width of the - decimal point and PRECISION digits that will be output - later. */ -+ long int lwidth; - char *p = dot; - *dot = '\0'; - -@@ -647,13 +652,14 @@ out_epoch_sec (char *pformat, size_t prefix_len, - --p; - while (ISDIGIT (p[-1])); - -- long int lwidth = strtol (p, NULL, 10); -+ lwidth = strtol (p, NULL, 10); - width = (lwidth <= INT_MAX ? lwidth : INT_MAX); - if (1 < width) - { -+ int w_d; - p += (*p == '0'); - sec_prefix_len = p - pformat; -- int w_d = (decimal_point_len < width -+ w_d = (decimal_point_len < width - ? width - decimal_point_len - : 0); - if (1 < w_d) -@@ -662,7 +668,8 @@ out_epoch_sec (char *pformat, size_t prefix_len, - if (1 < w) - { - char *dst = pformat; -- for (char const *src = dst; src < p; src++) -+ char const *src; -+ for (src = dst; src < p; src++) - { - if (*src == '-') - frac_left_adjust = true; -@@ -678,11 +685,9 @@ out_epoch_sec (char *pformat, size_t prefix_len, - } - } - -- int divisor = 1; -- for (int i = precision; i < 9; i++) -+ for (i = precision; i < 9; i++) - divisor *= 10; -- int frac_sec = arg.tv_nsec / divisor; -- int int_len; -+ frac_sec = arg.tv_nsec / divisor; - - if (TYPE_SIGNED (time_t)) - { -@@ -833,7 +838,9 @@ static char const * ATTRIBUTE_WARN_UNUSED_RESULT - find_bind_mount (char const * name) - { - char const * bind_mount = NULL; -+ struct stat name_stats; - -+ struct mount_entry *me; - static struct mount_entry *mount_list; - static bool tried_mount_list = false; - if (!tried_mount_list) /* attempt/warn once per process. */ -@@ -843,11 +850,9 @@ find_bind_mount (char const * name) - tried_mount_list = true; - } - -- struct stat name_stats; - if (stat (name, &name_stats) != 0) - return NULL; - -- struct mount_entry *me; - for (me = mount_list; me; me = me->me_next) - { - if (me->me_dummy && me->me_devname[0] == '/' -@@ -952,9 +957,9 @@ get_birthtime (int fd, char const *filename, struct stat const *st) - static inline struct timespec - neg_to_zero (struct timespec ts) - { -+ struct timespec z = {0, 0}; - if (0 <= ts.tv_nsec) - return ts; -- struct timespec z = {0, 0}; - return z; - } - -@@ -1163,11 +1168,12 @@ print_it (char const *format, int fd, char const *filename, - { - size_t len = strspn (b + 1, printf_flags); - char const *fmt_char = b + len + 1; -+ unsigned int fmt_code; - fmt_char += strspn (fmt_char, digits); - if (*fmt_char == '.') - fmt_char += 1 + strspn (fmt_char + 1, digits); - len = fmt_char - (b + 1); -- unsigned int fmt_code = *fmt_char; -+ fmt_code = *fmt_char; - memcpy (dest, b, len + 1); - - b = fmt_char; -@@ -1256,6 +1262,7 @@ static bool ATTRIBUTE_WARN_UNUSED_RESULT - do_statfs (char const *filename, char const *format) - { - STRUCT_STATVFS statfsbuf; -+ bool fail; - - if (STREQ (filename, "-")) - { -@@ -1271,7 +1278,7 @@ do_statfs (char const *filename, char const *format) - return false; - } - -- bool fail = print_it (format, -1, filename, print_statfs, &statfsbuf); -+ fail = print_it (format, -1, filename, print_statfs, &statfsbuf); - return ! fail; - } - -@@ -1282,6 +1289,7 @@ do_stat (char const *filename, char const *format, - { - int fd = STREQ (filename, "-") ? 0 : -1; - struct stat statbuf; -+ bool fail; - - if (0 <= fd) - { -@@ -1305,7 +1313,7 @@ do_stat (char const *filename, char const *format, - if (S_ISBLK (statbuf.st_mode) || S_ISCHR (statbuf.st_mode)) - format = format2; - -- bool fail = print_it (format, fd, filename, print_stat, &statbuf); -+ fail = print_it (format, fd, filename, print_stat, &statbuf); - return ! fail; - } - -@@ -1506,14 +1514,14 @@ main (int argc, char *argv[]) - char *format = NULL; - char *format2; - bool ok = true; -- -+ struct lconv const *locale = localeconv (); -+ - initialize_main (&argc, &argv); - set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - -- struct lconv const *locale = localeconv (); - decimal_point = (locale->decimal_point[0] ? locale->decimal_point : "."); - decimal_point_len = strlen (decimal_point); - -diff --git a/src/system.h b/src/system.h -index 162446c..d2863fc 100644 ---- a/src/system.h -+++ b/src/system.h -@@ -502,6 +502,7 @@ is_nul (void const *buf, size_t bufsize) - void const *vp; - char const *cbuf = buf; - word const *wp = buf; -+ char const *cp; - - /* Find first nonzero *word*, or the word with the sentinel. */ - while (*wp++ == 0) -@@ -509,7 +510,7 @@ is_nul (void const *buf, size_t bufsize) - - /* Find the first nonzero *byte*, or the sentinel. */ - vp = wp - 1; -- char const *cp = vp; -+ cp = vp; - while (*cp++ == 0) - continue; - -@@ -567,10 +568,11 @@ Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).\n\ - static inline void - emit_ancillary_info (void) - { -+ const char *lc_messages; - printf (_("\n%s online help: <%s>\n"), PACKAGE_NAME, PACKAGE_URL); - /* Don't output this redundant message for English locales. - Note we still output for 'C' so that it gets included in the man page. */ -- const char *lc_messages = setlocale (LC_MESSAGES, NULL); -+ lc_messages = setlocale (LC_MESSAGES, NULL); - if (lc_messages && STRNCMP_LIT (lc_messages, "en_")) - { - /* TRANSLATORS: Replace LANG_CODE in this URL with your language code -diff --git a/src/tac.c b/src/tac.c -index c76afc7..66f9b70 100644 ---- a/src/tac.c -+++ b/src/tac.c -@@ -426,6 +426,7 @@ temp_stream (FILE **fp, char **file_name) - static FILE *tmp_fp; - if (tempfile == NULL) - { -+ int fd; - char const *t = getenv ("TMPDIR"); - char const *tempdir = t ? t : DEFAULT_TMPDIR; - tempfile = mfile_name_concat (tempdir, "tacXXXXXX", NULL); -@@ -444,7 +445,7 @@ temp_stream (FILE **fp, char **file_name) - FIXME: clean up upon fatal signal. Don't block them, in case - $TMPFILE is a remote file system. */ - -- int fd = mkstemp (tempfile); -+ fd = mkstemp (tempfile); - if (fd < 0) - { - error (0, errno, _("failed to create temporary file in %s"), -@@ -536,10 +537,11 @@ tac_nonseekable (int input_fd, const char *file) - { - FILE *tmp_stream; - char *tmp_file; -+ bool ok; - if (!copy_to_temp (&tmp_stream, &tmp_file, input_fd, file)) - return false; - -- bool ok = tac_seekable (fileno (tmp_stream), tmp_file); -+ ok = tac_seekable (fileno (tmp_stream), tmp_file); - return ok; - } - -diff --git a/src/tail.c b/src/tail.c -index 5ff738d..4fca792 100644 ---- a/src/tail.c -+++ b/src/tail.c -@@ -851,6 +851,8 @@ start_lines (const char *pretty_filename, int fd, uintmax_t n_lines, - { - char buffer[BUFSIZ]; - size_t bytes_read = safe_read (fd, buffer, BUFSIZ); -+ char *buffer_end; -+ char *p; - if (bytes_read == 0) /* EOF */ - return -1; - if (bytes_read == SAFE_READ_ERROR) /* error */ -@@ -859,11 +861,11 @@ start_lines (const char *pretty_filename, int fd, uintmax_t n_lines, - return 1; - } - -- char *buffer_end = buffer + bytes_read; -+ buffer_end = buffer + bytes_read; - - *read_pos += bytes_read; - -- char *p = buffer; -+ p = buffer; - while ((p = memchr (p, '\n', buffer_end - p))) - { - ++p; -diff --git a/src/test.c b/src/test.c -index 7596879..52a99e1 100644 ---- a/src/test.c -+++ b/src/test.c -@@ -420,23 +420,27 @@ unary_operator (void) - - case 'O': /* File is owned by you? */ - { -+ uid_t euid; -+ uid_t NO_UID; - unary_advance (); - if (stat (argv[pos - 1], &stat_buf) != 0) - return false; - errno = 0; -- uid_t euid = geteuid (); -- uid_t NO_UID = -1; -+ euid = geteuid (); -+ NO_UID = -1; - return ! (euid == NO_UID && errno) && euid == stat_buf.st_uid; - } - - case 'G': /* File is owned by your group? */ - { -+ gid_t egid; -+ gid_t NO_GID; - unary_advance (); - if (stat (argv[pos - 1], &stat_buf) != 0) - return false; - errno = 0; -- gid_t egid = getegid (); -- gid_t NO_GID = -1; -+ egid = getegid (); -+ NO_GID = -1; - return ! (egid == NO_GID && errno) && egid == stat_buf.st_gid; - } - -diff --git a/src/timeout.c b/src/timeout.c -index 68baa23..963a8e0 100644 ---- a/src/timeout.c -+++ b/src/timeout.c -@@ -133,6 +133,7 @@ settimeout (double duration, bool warn) - resolution provided by alarm(). */ - - #if HAVE_TIMER_SETTIME -+{ - struct timespec ts = dtotimespec (duration); - struct itimerspec its = { {0, 0}, ts }; - timer_t timerid; -@@ -149,8 +150,10 @@ settimeout (double duration, bool warn) - } - else if (warn && errno != ENOSYS) - error (0, errno, _("warning: timer_create")); -+} - #endif - -+{ - unsigned int timeint; - if (UINT_MAX <= duration) - timeint = UINT_MAX; -@@ -161,6 +164,7 @@ settimeout (double duration, bool warn) - } - alarm (timeint); - } -+} - - /* send SIG avoiding the current process. */ - -diff --git a/src/wc.c b/src/wc.c -index 4909d9f..8e716bd 100644 ---- a/src/wc.c -+++ b/src/wc.c -@@ -597,6 +597,9 @@ main (int argc, char **argv) - char *files_from = NULL; - struct fstatus *fstatus; - struct Tokens tok; -+ bool read_tokens = false; -+ struct argv_iterator *ai; -+ int i; - - initialize_main (&argc, &argv); - set_program_name (argv[0]); -@@ -653,10 +656,9 @@ main (int argc, char **argv) - || print_linelength)) - print_lines = print_words = print_bytes = true; - -- bool read_tokens = false; -- struct argv_iterator *ai; - if (files_from) - { -+ struct stat st; - FILE *stream; - - /* When using --files0-from=F, you may not specify any files -@@ -681,7 +683,6 @@ main (int argc, char **argv) - - /* Read the file list into RAM if we can detect its size and that - size is reasonable. Otherwise, we'll read a name at a time. */ -- struct stat st; - if (fstat (fileno (stream), &st) == 0 - && S_ISREG (st.st_mode) - && st.st_size <= MIN (10 * 1024 * 1024, physmem_available () / 2)) -@@ -716,7 +717,6 @@ main (int argc, char **argv) - fstatus = get_input_fstatus (nfiles, files); - number_width = compute_number_width (nfiles, fstatus); - -- int i; - ok = true; - for (i = 0; /* */; i++) - { --- -2.2.2 - diff --git a/sys-apps/coreutils/patches/coreutils-8.23.patchset b/sys-apps/coreutils/patches/coreutils-8.23.patchset deleted file mode 100644 index 9f0189206..000000000 --- a/sys-apps/coreutils/patches/coreutils-8.23.patchset +++ /dev/null @@ -1,182 +0,0 @@ -From 90f65fb0a317f6c00b1d239a2208fadc44176f2f Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:18:52 +0000 -Subject: define __USE_GNU for wempcpy - - -diff --git a/lib/fnmatch.c b/lib/fnmatch.c -index 4246d82..1e30fdc 100644 ---- a/lib/fnmatch.c -+++ b/lib/fnmatch.c -@@ -21,6 +21,9 @@ - #ifndef _GNU_SOURCE - # define _GNU_SOURCE 1 - #endif -+#ifndef __USE_GNU -+# define __USE_GNU 1 -+#endif - - #if ! defined __builtin_expect && __GNUC__ < 3 - # define __builtin_expect(expr, expected) (expr) --- -1.8.3.4 - - -From 21c5406c9a6b2711e4a8b49c6ace954899a48cc8 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:22:10 +0000 -Subject: force declaration of rpl_inet_ntop - - -diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h -index b8c2e18..30c4756 100644 ---- a/lib/arpa_inet.in.h -+++ b/lib/arpa_inet.in.h -@@ -72,7 +72,7 @@ - - For more details, see the POSIX:2001 specification - . */ --# if @REPLACE_INET_NTOP@ -+# if 1 - # if !(defined __cplusplus && defined GNULIB_NAMESPACE) - # undef inet_ntop - # define inet_ntop rpl_inet_ntop --- -1.8.3.4 - - -From 9f4cb757ba81534fe7822bbc9517001456a85aa9 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:32:36 +0000 -Subject: Haiku defines mknod in unistd.h - - -diff --git a/lib/mknod.c b/lib/mknod.c -index c738e59..4d816fd 100644 ---- a/lib/mknod.c -+++ b/lib/mknod.c -@@ -18,6 +18,7 @@ - - #include - -+#include - #include - - #include --- -1.8.3.4 - - -From 20e9b53ba7b53dd6a658a42fa6c1c74c62c08596 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Tue, 13 May 2014 17:35:25 +0000 -Subject: protect the label, not used on Haiku - - -diff --git a/lib/mountlist.c b/lib/mountlist.c -index b3be011..8711915 100644 ---- a/lib/mountlist.c -+++ b/lib/mountlist.c -@@ -954,7 +954,7 @@ read_file_system_list (bool need_fs_type) - *mtail = NULL; - return mount_list; - -- -+#ifndef __HAIKU__ - free_then_fail: - { - int saved_errno = errno; -@@ -970,6 +970,7 @@ read_file_system_list (bool need_fs_type) - errno = saved_errno; - return NULL; - } -+#endif - } - - /* Free a mount entry as returned from read_file_system_list (). */ --- -1.8.3.4 - - -From d0dfbd6e63a6f45521e29dcbb7fecd7cc6cde8cb Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 15 May 2014 15:40:32 +0000 -Subject: strchrnul needs __USE_GNU on Haiku - - -diff --git a/lib/regex.h b/lib/regex.h -index 70f2126..d7fbf88 100644 ---- a/lib/regex.h -+++ b/lib/regex.h -@@ -31,8 +31,10 @@ extern "C" { - /* Define __USE_GNU to declare GNU extensions that violate the - POSIX name space rules. */ - #ifdef _GNU_SOURCE -+#ifndef __USE_GNU - # define __USE_GNU 1 - #endif -+#endif - - #ifdef _REGEX_LARGE_OFFSETS - -diff --git a/lib/string.in.h b/lib/string.in.h -index 9062142..ab445d1 100644 ---- a/lib/string.in.h -+++ b/lib/string.in.h -@@ -23,6 +23,9 @@ - @PRAGMA_COLUMNS@ - - /* The include_next requires a split double-inclusion guard. */ -+#ifndef __USE_GNU -+#define __USE_GNU -+#endif - #@INCLUDE_NEXT@ @NEXT_STRING_H@ - - #ifndef _@GUARD_PREFIX@_STRING_H --- -1.8.3.4 - - -From 746465bd39c160537daf2bfce500702d53e22675 Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 15 May 2014 20:13:58 +0000 -Subject: don't build hostid, uptime, nice, users, who, dd - - -diff --git a/Makefile.in b/Makefile.in -index 140a428..f3f5596 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -1495,16 +1495,15 @@ nodist_src_libver_a_OBJECTS = src/version.$(OBJEXT) - src_libver_a_OBJECTS = $(nodist_src_libver_a_OBJECTS) - am__EXEEXT_1 = src/arch$(EXEEXT) src/coreutils$(EXEEXT) \ - src/hostname$(EXEEXT) --am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) src/hostid$(EXEEXT) \ -- src/libstdbuf.so$(EXEEXT) src/nice$(EXEEXT) src/pinky$(EXEEXT) \ -- src/stdbuf$(EXEEXT) src/stty$(EXEEXT) src/uptime$(EXEEXT) \ -- src/users$(EXEEXT) src/who$(EXEEXT) -+am__EXEEXT_2 = src/chroot$(EXEEXT) src/df$(EXEEXT) \ -+ src/libstdbuf.so$(EXEEXT) \ -+ src/stdbuf$(EXEEXT) src/stty$(EXEEXT) - am__EXEEXT_3 = src/[$(EXEEXT) src/base64$(EXEEXT) \ - src/basename$(EXEEXT) src/cat$(EXEEXT) src/chcon$(EXEEXT) \ - src/chgrp$(EXEEXT) src/chmod$(EXEEXT) src/chown$(EXEEXT) \ - src/cksum$(EXEEXT) src/comm$(EXEEXT) src/cp$(EXEEXT) \ - src/csplit$(EXEEXT) src/cut$(EXEEXT) src/date$(EXEEXT) \ -- src/dd$(EXEEXT) src/dir$(EXEEXT) src/dircolors$(EXEEXT) \ -+ src/dir$(EXEEXT) src/dircolors$(EXEEXT) \ - src/dirname$(EXEEXT) src/du$(EXEEXT) src/echo$(EXEEXT) \ - src/env$(EXEEXT) src/expand$(EXEEXT) src/expr$(EXEEXT) \ - src/factor$(EXEEXT) src/false$(EXEEXT) src/fmt$(EXEEXT) \ -@@ -4320,7 +4319,7 @@ WARN_ON_USE_H = lib/warn-on-use.h - # FIXME: once lib/ and gnulib-tests/ are also converted, hoist to Makefile.am - AM_CFLAGS = $(WERROR_CFLAGS) - no_install__progs = src/arch src/coreutils src/hostname --build_if_possible__progs = src/chroot src/df src/hostid \ -+build_if_possible__progs = src/chroot src/df \ - src/libstdbuf.so src/nice src/pinky src/stdbuf src/stty \ - src/uptime src/users src/who - default__progs = src/[ src/base64 src/basename src/cat src/chcon \ --- -1.8.3.4 - diff --git a/sys-apps/coreutils/patches/import-Haiku-changes.patch b/sys-apps/coreutils/patches/import-Haiku-changes.patch deleted file mode 100644 index 967b0f403..000000000 --- a/sys-apps/coreutils/patches/import-Haiku-changes.patch +++ /dev/null @@ -1,453 +0,0 @@ -From 4890307abb587558e159f2397236a27f83ba6bde Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Fri, 6 Feb 2015 20:24:12 +0000 -Subject: [PATCH] import Haiku changes, fix warnings. - ---- - INSTALL | 4 +- - lib/localcharset.c | 9 ++++- - src/copy.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - src/copy.h | 3 ++ - src/cp.c | 8 ++++ - src/dircolors.h | 2 +- - src/dircolors.hin | 2 +- - src/ls.c | 13 ++++++- - src/mv.c | 1 + - src/remove.c | 2 +- - src/uname.c | 28 ++++++++++++++ - 11 files changed, 176 insertions(+), 7 deletions(-) - -diff --git a/INSTALL b/INSTALL -index 2099840..3db7f81 100644 ---- a/INSTALL -+++ b/INSTALL -@@ -247,10 +247,10 @@ directory contains several dysfunctional programs; working variants of - these programs are available in `/usr/bin'. So, if you need `/usr/ucb' - in your `PATH', put it _after_ `/usr/bin'. - -- On Haiku, software installed for all users goes in `/boot/common', -+ On Haiku, software installed for all users goes in `/boot/system', - not `/usr/local'. It is recommended to use the following options: - -- ./configure --prefix=/boot/common -+ ./configure --prefix=/boot/system - - Specifying the System Type - ========================== -diff --git a/lib/localcharset.c b/lib/localcharset.c -index a225a2e..644f151 100644 ---- a/lib/localcharset.c -+++ b/lib/localcharset.c -@@ -127,7 +127,7 @@ get_charset_aliases (void) - cp = charset_aliases; - if (cp == NULL) - { --#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__) -+#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined __HAIKU__) - const char *dir; - const char *base = "charset.alias"; - char *file_name; -@@ -341,6 +341,13 @@ get_charset_aliases (void) - "CP54936" "\0" "GB18030" "\0" - "CP65001" "\0" "UTF-8" "\0"; - # endif -+ -+# if defined __HAIKU__ -+ /* To avoid the troubles of installing a separate file in the same -+ directory as the DLL and of retrieving the DLL's directory at -+ runtime, simply inline the aliases here. */ -+ cp = "UTF-8" "\0"; -+# endif - #endif - - charset_aliases = cp; -diff --git a/src/copy.c b/src/copy.c -index 0f044d0..9284540 100644 ---- a/src/copy.c -+++ b/src/copy.c -@@ -18,6 +18,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -63,6 +64,10 @@ - #include "yesno.h" - #include "selinux.h" - -+#if (defined(__BEOS__) || defined(__HAIKU__)) -+# include -+#endif -+ - #if USE_XATTR - # include - # include -@@ -465,6 +470,92 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors) - return false; - } - -+ -+static int -+copy_attributes(int fromFd, int toFd) -+{ -+ struct dirent *dirent; -+ char buffer[65536]; -+ -+ DIR *attributes = fs_fopen_attr_dir(fromFd); -+ if (attributes == NULL) -+ return errno == B_UNSUPPORTED ? 0 : -1; -+ -+ while ((dirent = fs_read_attr_dir(attributes)) != NULL) { -+ struct stat stat; -+ off_t pos = 0; -+ int attrFromFD = fs_fopen_attr(fromFd, dirent->d_name, 0, O_RDONLY); -+ int attrToFD; -+ -+ if (attrFromFD < 0) -+ continue; -+ -+ if (fstat(attrFromFD, &stat) != 0) { -+ close(attrFromFD); -+ continue; -+ } -+ -+ attrToFD = fs_fopen_attr(toFd, dirent->d_name, stat.st_type, -+ O_WRONLY | O_TRUNC | O_CREAT); -+ if (attrToFD < 0) { -+ close(attrFromFD); -+ continue; -+ } -+ -+ while (true) { -+ ssize_t bytesRead, bytesWritten; -+ -+ bytesRead = read_pos(attrFromFD, pos, buffer, sizeof(buffer)); -+ if (bytesRead < 0) { -+ fprintf(stderr, "error reading attribute '%s'", dirent->d_name); -+ break; -+ } -+ -+ bytesWritten = write_pos(attrToFD, pos, buffer, bytesRead); -+ if (bytesWritten != bytesRead) { -+ fprintf(stderr, "error writing attribute '%s'", dirent->d_name); -+ break; -+ } -+ -+ pos += bytesWritten; -+ stat.st_size -= bytesWritten; -+ -+ if (stat.st_size <= 0) -+ break; -+ } -+ close(attrToFD); -+ close(attrFromFD); -+ } -+ -+ fs_close_attr_dir(attributes); -+ return 0; -+} -+ -+ -+static int -+copy_attributes_by_name(const char *from, const char *to, int resolveLinks) -+{ -+ int fromFd, toFd, result; -+ -+ fromFd = open(from, O_RDONLY | (resolveLinks ? 0 : O_NOTRAVERSE)); -+ if (fromFd < 0) -+ return -1; -+ -+ toFd = open(to, O_RDONLY | (resolveLinks ? 0 : O_NOTRAVERSE)); -+ if (toFd < 0) { -+ close(fromFd); -+ return -1; -+ } -+ -+ result = copy_attributes(fromFd, toFd); -+ -+ close(fromFd); -+ close(toFd); -+ -+ return result; -+} -+ -+ - static bool - errno_unsupported (int err) - { -@@ -598,6 +689,10 @@ copy_dir (char const *src_name_in, char const *dst_name_in, bool new_dst, - error (0, errno, _("cannot access %s"), quote (src_name_in)); - return false; - } -+ -+ if (x->ignore_attributes == 0 -+ && copy_attributes_by_name(src_name_in, dst_name_in, true) != 0) -+ fprintf(stderr, "%s: could not copy attributes\n", src_name_in); - - /* For cp's -H option, dereference command line arguments, but do not - dereference symlinks that are found via recursive traversal. */ -@@ -1266,6 +1361,11 @@ preserve_metadata: - return_val = false; - } - } -+ -+ if (x->ignore_attributes == 0 -+ && copy_attributes(source_desc, dest_desc) != 0) -+ fprintf(stderr, "%s: could not copy attributes\n", src_name); -+ - - close_src_and_dst_desc: - if (close (dest_desc) < 0) -@@ -2198,6 +2298,12 @@ copy_internal (char const *src_name, char const *dst_name, - dereference)) - goto un_backup; - -+ if (x->ignore_attributes == 0 -+ && copy_attributes_by_name (earlier_file, dst_name, -+ false) != 0) -+ error (0, errno, "cannot copy attributes from %s\n", -+ earlier_file); -+ - return true; - } - } -@@ -2589,6 +2695,11 @@ copy_internal (char const *src_name, char const *dst_name, - preserving owner/group is a potential security problem. */ - } - } -+ -+ if (x->ignore_attributes == 0 -+ && copy_attributes_by_name(src_name, dst_name, false) != 0) -+ fprintf(stderr, "%s: could not copy attributes\n", src_name); -+ - } - else - { -diff --git a/src/copy.h b/src/copy.h -index 4918d14..f0e309d 100644 ---- a/src/copy.h -+++ b/src/copy.h -@@ -184,6 +184,9 @@ struct cp_options - must be false. */ - bool require_preserve; - -+ /* If nonzero, attributes will be ignored when copying. */ -+ int ignore_attributes; -+ - /* If true, attempt to preserve the SELinux security context, too. - Set this only if the kernel is SELinux enabled. */ - bool preserve_security_context; -diff --git a/src/cp.c b/src/cp.c -index 9038d4e..693f41e 100644 ---- a/src/cp.c -+++ b/src/cp.c -@@ -73,6 +73,7 @@ struct dir_attr - enum - { - ATTRIBUTES_ONLY_OPTION = CHAR_MAX + 1, -+ IGNORE_ATTRIBUTES, - COPY_CONTENTS_OPTION, - NO_PRESERVE_ATTRIBUTES_OPTION, - PARENTS_OPTION, -@@ -121,6 +122,7 @@ static struct option const long_opts[] = - {"copy-contents", no_argument, NULL, COPY_CONTENTS_OPTION}, - {"dereference", no_argument, NULL, 'L'}, - {"force", no_argument, NULL, 'f'}, -+ {"ignore-attributes", no_argument, NULL, IGNORE_ATTRIBUTES}, - {"interactive", no_argument, NULL, 'i'}, - {"link", no_argument, NULL, 'l'}, - {"no-clobber", no_argument, NULL, 'n'}, -@@ -179,6 +181,7 @@ Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n\ - -f, --force if an existing destination file cannot be\n\ - opened, remove it and try again (this option\n\ - is ignored when the -n option is also used)\n\ -+ --ignore-attributes do not copy attributes\n\ - -i, --interactive prompt before overwrite (overrides a previous -n\ - \n\ - option)\n\ -@@ -797,6 +800,7 @@ cp_option_init (struct cp_options *x) - x->data_copy_required = true; - x->require_preserve = false; - x->recursive = false; -+ x->ignore_attributes = false; - x->sparse_mode = SPARSE_AUTO; - x->symbolic_link = false; - x->set_mode = false; -@@ -1002,6 +1006,10 @@ main (int argc, char **argv) - x.dereference = DEREF_COMMAND_LINE_ARGUMENTS; - break; - -+ case IGNORE_ATTRIBUTES: -+ x.ignore_attributes = true; -+ break; -+ - case 'i': - x.interactive = I_ASK_USER; - break; -diff --git a/src/dircolors.h b/src/dircolors.h -index d7e7c58..7107020 100644 ---- a/src/dircolors.h -+++ b/src/dircolors.h -@@ -87,7 +87,7 @@ static char const G_line[] = - 'S','E','T','G','I','D',' ','3','0',';','4','3',' ','#',' ','f','i','l','e',' ','t','h','a','t',' ','i','s',' ','s','e','t','g','i','d',' ','(','g','+','s',')',0, - 'C','A','P','A','B','I','L','I','T','Y',' ','3','0',';','4','1',' ','#',' ','f','i','l','e',' ','w','i','t','h',' ','c','a','p','a','b','i','l','i','t','y',0, - 'S','T','I','C','K','Y','_','O','T','H','E','R','_','W','R','I','T','A','B','L','E',' ','3','0',';','4','2',' ','#',' ','d','i','r',' ','t','h','a','t',' ','i','s',' ','s','t','i','c','k','y',' ','a','n','d',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',' ','(','+','t',',','o','+','w',')',0, -- 'O','T','H','E','R','_','W','R','I','T','A','B','L','E',' ','3','4',';','4','2',' ','#',' ','d','i','r',' ','t','h','a','t',' ','i','s',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',' ','(','o','+','w',')',' ','a','n','d',' ','n','o','t',' ','s','t','i','c','k','y',0, -+ 'O','T','H','E','R','_','W','R','I','T','A','B','L','E',' ','3','4',';','4','3',' ','#',' ','d','i','r',' ','t','h','a','t',' ','i','s',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',' ','(','o','+','w',')',' ','a','n','d',' ','n','o','t',' ','s','t','i','c','k','y',0, - 'S','T','I','C','K','Y',' ','3','7',';','4','4',' ','#',' ','d','i','r',' ','w','i','t','h',' ','t','h','e',' ','s','t','i','c','k','y',' ','b','i','t',' ','s','e','t',' ','(','+','t',')',' ','a','n','d',' ','n','o','t',' ','o','t','h','e','r','-','w','r','i','t','a','b','l','e',0, - '#',' ','T','h','i','s',' ','i','s',' ','f','o','r',' ','f','i','l','e','s',' ','w','i','t','h',' ','e','x','e','c','u','t','e',' ','p','e','r','m','i','s','s','i','o','n',':',0, - 'E','X','E','C',' ','0','1',';','3','2',0, -diff --git a/src/dircolors.hin b/src/dircolors.hin -index 0005cd0..03d6931 100644 ---- a/src/dircolors.hin -+++ b/src/dircolors.hin -@@ -89,7 +89,7 @@ SETUID 37;41 # file that is setuid (u+s) - SETGID 30;43 # file that is setgid (g+s) - CAPABILITY 30;41 # file with capability - STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) --OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky -+OTHER_WRITABLE 34;43 # dir that is other-writable (o+w) and not sticky - STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable - - # This is for files with execute permission: -diff --git a/src/ls.c b/src/ls.c -index e7d1d93..c2db14f 100644 ---- a/src/ls.c -+++ b/src/ls.c -@@ -676,6 +676,11 @@ static struct ignore_pattern *hide_patterns; - want to mess up the terminal if control chars get sent to it, and some - quoting methods pass through control chars as-is. */ - static bool qmark_funny_chars; -+#if defined(__HAIKU__) /* Default to show UTF8 chars in Haiku terminal. */ -+#define QMARK_FUNNY_CHARS_TTY 0 -+#else -+#define QMARK_FUNNY_CHARS_TTY 1 -+#endif - - /* Quoting options for file and dir name output. */ - -@@ -1524,7 +1529,7 @@ decode_switches (int argc, char **argv) - bool sort_type_specified = false; - bool kibibytes_specified = false; - -- qmark_funny_chars = false; -+ qmark_funny_chars = QMARK_FUNNY_CHARS_TTY; - - /* initialize all switches to default settings */ - -@@ -1548,7 +1553,9 @@ decode_switches (int argc, char **argv) - { - format = many_per_line; - /* See description of qmark_funny_chars, above. */ -+#ifndef __HAIKU__ - qmark_funny_chars = true; -+#endif - } - else - { -@@ -2098,11 +2105,13 @@ decode_switches (int argc, char **argv) - } - } - -+#ifdef HAVE_NL_LANGINFO - /* Note we leave %5b etc. alone so user widths/flags are honored. */ - if (strstr (long_time_format[0], "%b") - || strstr (long_time_format[1], "%b")) - if (!abmon_init ()) - error (0, 0, _("error initializing month strings")); -+#endif - } - - return optind; -@@ -3891,6 +3900,7 @@ print_long_format (const struct fileinfo *f) - p = buf; - } - -+#if !defined(__HAIKU__) - if (f->stat_ok - && (S_ISCHR (f->stat.st_mode) || S_ISBLK (f->stat.st_mode))) - { -@@ -3907,6 +3917,7 @@ print_long_format (const struct fileinfo *f) - p += file_size_width + 1; - } - else -+#endif - { - char hbuf[LONGEST_HUMAN_READABLE + 1]; - char const *size = -diff --git a/src/mv.c b/src/mv.c -index b69b355..5a35254 100644 ---- a/src/mv.c -+++ b/src/mv.c -@@ -125,6 +125,7 @@ cp_option_init (struct cp_options *x) - x->reduce_diagnostics = false; - x->data_copy_required = true; - x->require_preserve = false; /* FIXME: maybe make this an option */ -+ x->ignore_attributes = false; - x->require_preserve_context = false; - x->preserve_xattr = true; - x->require_preserve_xattr = false; -diff --git a/src/remove.c b/src/remove.c -index 3d386cf..6d22b31 100644 ---- a/src/remove.c -+++ b/src/remove.c -@@ -215,7 +215,7 @@ prompt (FTS const *fts, FTSENT const *ent, bool is_dir, - wp_errno = errno; - } - -- if (write_protected || x->interactive == RMI_ALWAYS) -+ if (write_protected || errno || x->interactive == RMI_ALWAYS) - { - if (0 <= write_protected && dirent_type == DT_UNKNOWN) - { -diff --git a/src/uname.c b/src/uname.c -index cfcd0a3..1aad4b6 100644 ---- a/src/uname.c -+++ b/src/uname.c -@@ -49,6 +49,10 @@ - # include - #endif - -+#ifdef __HAIKU__ -+# include -+#endif -+ - #include "system.h" - #include "error.h" - #include "quote.h" -@@ -337,6 +341,30 @@ main (int argc, char **argv) - # endif - } - #endif -+ -+#ifdef __HAIKU__ -+ { -+ cpu_topology_node_info root; -+ uint32 count = 1; -+ status_t error = get_cpu_topology_info(&root, &count); -+ if (error != B_OK || count < 1) -+ element = "unknown"; -+ else { -+ switch (root.data.root.platform) { -+ case B_CPU_x86: -+ element = "x86"; -+ break; -+ case B_CPU_x86_64: -+ element = "x86_64"; -+ break; -+ default: -+ element = "other"; -+ break; -+ } -+ } -+ } -+#endif -+ - if (! (toprint == UINT_MAX && element == unknown)) - print_element (element); - } --- -1.8.3.4 -