From nobody Mon Feb 12 18:53:37 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TYYWj5Bt2z5BMZ1; Mon, 12 Feb 2024 18:53:37 +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 4TYYWj4Flyz4mTn; Mon, 12 Feb 2024 18:53:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707764017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yPtcyehJKKJIsc3vsv9MC0c62+SOSuRCRYUFv/T48qI=; b=X5hlxQwzW5y83IJlqIo5QJRrzskcVCYE+V0NKNScXUdzOVaMXJVUgxPiXs7bu58J+4O3WM ytgwCZdE6rJaPoXRYPHN0t9IObilgb1yVuyn3ur3hAE3B8Vd6g2AkBUm8ft50McD36ZAIr OABzLjRn1GeayEsI6pN3NFveFS3jZhPz14EJfBa2ZSUo1ZK4n+hMXLhZCL52yu4fkQGWjc DyxZdTTlGGOloiwYMwaVB9Z3ovv9MiahANLBV1/CwVCM9bTR5A24g8zm1hB26AUzwhPAY+ +12kBlpr0/1vr4JSo7hRxSW8ozc1fFrwcZux//YUdmI4C1FEbpAWlNCv6vixIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707764017; a=rsa-sha256; cv=none; b=LlLv0/pvJnEeE0XfSBeuY4Iz/tQ8snCPzj2Y4rc5qBgAX00GPqiOm0OUAgxRNKARtmKOpl YI9R3+jvqPvNEXNfxVNnlrzliuVxsKm82qO2Y2sJh6kygvYyQzSKObHapAEXskaTFbtm8c UZ4TTYBEamjrwGYH2TbT6HQb6o+ELYpUAD7ZWFfBeTwQyHELIjOhaNzaRG2n6RTn8hP0Pl vpZB3Wpo8bDeLvzvrx7vrdyUlE7P4ap1yv14kNKjfhxBVU55OYmEuuJYN349Hg8YeBW1jQ IxWTTIj6Hb9gnkCpRncDcauzrpIvRyHtMHRmPR/mRj9yJcRbt2vjKtMaGjB0Hw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707764017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yPtcyehJKKJIsc3vsv9MC0c62+SOSuRCRYUFv/T48qI=; b=yxoYZhApczYByBbOohmLWaf7XQukscSEEFuHooL0pekHAktvK+0JaRMh+JSm0fvtPjf0ML +N4/uNPNhpFLIXO7KTbvZD5SfPa2p153fwXl7LloZ8581z67rfzN0MlbOExoOhyt0mma/f +Z7KqddoLGaBdg8Zbbvb7cGN8UBz4IJTDWiHiWYFmClQ5QD6EAsm2IBnN29d4fHR08O521 BtJWm/8xPan2fzXx/Yx7rXsn3DJ1xwz1akvC5SJOan9U33+Hh+LlOSKgn2X5J3rRUImeYY XTHscYDAFhpUkIkOC+JGrzP79rWhLn7E9dPGDRPqiTXGkIy8eKsRSe5SqaFPRA== 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 4TYYWj31k6zjKD; Mon, 12 Feb 2024 18:53:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41CIrbLs030409; Mon, 12 Feb 2024 18:53:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41CIrbWV030406; Mon, 12 Feb 2024 18:53:37 GMT (envelope-from git) Date: Mon, 12 Feb 2024 18:53:37 GMT Message-Id: <202402121853.41CIrbWV030406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7a3210f2ac09 - main - reboot: convert flags to bools List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a3210f2ac09c36f46314a98942a29765e99d848 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7a3210f2ac09c36f46314a98942a29765e99d848 commit 7a3210f2ac09c36f46314a98942a29765e99d848 Author: Warner Losh AuthorDate: 2024-02-12 18:44:52 +0000 Commit: Warner Losh CommitDate: 2024-02-12 18:44:52 +0000 reboot: convert flags to bools Convert all the command line flags to bools, since that's how we use them. Sort the includes while adding stdbool.h. Sponsored by: Netflix Reviewed by: kevans, kib, emaste Differential Revision: https://reviews.freebsd.org/D43801 --- sbin/reboot/reboot.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index 90c67caf9d07..7dcebef69b85 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -35,38 +35,40 @@ #include #include -#include #include #include #include #include -#include +#include +#include #include #include #include +#include #include #include static void usage(void) __dead2; static uint64_t get_pageins(void); -static int dohalt; +static bool dohalt; int main(int argc, char *argv[]) { struct utmpx utx; const struct passwd *pw; - int ch, howto, i, fd, lflag, nflag, qflag, sverrno, Nflag; + int ch, howto, i, fd, sverrno; + bool lflag, nflag, qflag, Nflag; uint64_t pageins; const char *user, *kernel = NULL; if (strstr(getprogname(), "halt") != NULL) { - dohalt = 1; + dohalt = true; howto = RB_HALT; } else howto = 0; - lflag = nflag = qflag = Nflag = 0; + lflag = nflag = qflag = Nflag = false; while ((ch = getopt(argc, argv, "cdk:lNnpqr")) != -1) switch(ch) { case 'c': @@ -79,21 +81,21 @@ main(int argc, char *argv[]) kernel = optarg; break; case 'l': - lflag = 1; + lflag = true; break; case 'n': - nflag = 1; + nflag = true; howto |= RB_NOSYNC; break; case 'N': - nflag = 1; - Nflag = 1; + nflag = true; + Nflag = true; break; case 'p': howto |= RB_POWEROFF; break; case 'q': - qflag = 1; + qflag = true; break; case 'r': howto |= RB_REROOT;