From owner-dev-commits-src-branches@freebsd.org Fri Jan 15 14:27:02 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25EDE4E731D; Fri, 15 Jan 2021 14:27:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DHNmP51pTz51LL; Fri, 15 Jan 2021 14:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 518301DB79; Fri, 15 Jan 2021 14:27:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10FER02E013772; Fri, 15 Jan 2021 14:27:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10FER076013771; Fri, 15 Jan 2021 14:27:00 GMT (envelope-from git) Date: Fri, 15 Jan 2021 14:27:00 GMT Message-Id: <202101151427.10FER076013771@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: c586a84d56f3 - stable/12 - cmp: use C99 bool for flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c586a84d56f37eee73d880172ec7f2a8152e58ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2021 14:27:02 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c586a84d56f37eee73d880172ec7f2a8152e58ab commit c586a84d56f37eee73d880172ec7f2a8152e58ab Author: Ed Maste AuthorDate: 2021-01-11 00:02:55 +0000 Commit: Ed Maste CommitDate: 2021-01-15 14:25:36 +0000 cmp: use C99 bool for flags Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28072 (cherry picked from commit 1f7661742de650bcb6b9124ee3da7e94c8650c4b) --- usr.bin/cmp/cmp.c | 27 ++++++++++++++------------- usr.bin/cmp/extern.h | 2 +- usr.bin/cmp/link.c | 1 + usr.bin/cmp/misc.c | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index e1f9fb6823ef..c762f1346abf 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -int lflag, sflag, xflag, zflag; +bool lflag, sflag, xflag, zflag; static const struct option long_opts[] = { @@ -77,7 +77,8 @@ main(int argc, char *argv[]) { struct stat sb1, sb2; off_t skip1, skip2; - int ch, fd1, fd2, oflag, special; + int ch, fd1, fd2, oflag; + bool special; const char *file1, *file2; oflag = O_RDONLY; @@ -87,18 +88,18 @@ main(int argc, char *argv[]) oflag |= O_NOFOLLOW; break; case 'l': /* print all differences */ - lflag = 1; + lflag = true; break; case 's': /* silent run */ - sflag = 1; - zflag = 1; + sflag = true; + zflag = true; break; case 'x': /* hex output */ - lflag = 1; - xflag = 1; + lflag = true; + xflag = true; break; case 'z': /* compare size first */ - zflag = 1; + zflag = true; break; case '?': default: @@ -120,9 +121,9 @@ main(int argc, char *argv[]) err(ERR_EXIT, "unable to limit rights on stderr"); /* Backward compatibility -- handle "-" meaning stdin. */ - special = 0; + special = false; if (strcmp(file1 = argv[0], "-") == 0) { - special = 1; + special = true; fd1 = STDIN_FILENO; file1 = "stdin"; } else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) { @@ -135,7 +136,7 @@ main(int argc, char *argv[]) if (special) errx(ERR_EXIT, "standard input may only be specified once"); - special = 1; + special = true; fd2 = STDIN_FILENO; file2 = "stdin"; } else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { @@ -174,7 +175,7 @@ main(int argc, char *argv[]) exit(ERR_EXIT); } if (!S_ISREG(sb1.st_mode)) - special = 1; + special = true; else { if (fstat(fd2, &sb2)) { if (!sflag) @@ -183,7 +184,7 @@ main(int argc, char *argv[]) exit(ERR_EXIT); } if (!S_ISREG(sb2.st_mode)) - special = 1; + special = true; } } diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h index 84507b1929dc..82c5ea42b175 100644 --- a/usr.bin/cmp/extern.h +++ b/usr.bin/cmp/extern.h @@ -44,4 +44,4 @@ void c_special(int, const char *, off_t, int, const char *, off_t); void diffmsg(const char *, const char *, off_t, off_t); void eofmsg(const char *); -extern int lflag, sflag, xflag, zflag; +extern bool lflag, sflag, xflag, zflag; diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c index 3aecf4f10738..9193147e830e 100644 --- a/usr.bin/cmp/link.c +++ b/usr.bin/cmp/link.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c index a99ab4facb73..1e84f0d7a527 100644 --- a/usr.bin/cmp/misc.c +++ b/usr.bin/cmp/misc.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include