From nobody Wed Nov 27 14:10:13 2024 X-Original-To: dev-commits-src-all@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 4Xz1YK70Nfz5fG0D; Wed, 27 Nov 2024 14:10:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xz1YK4ZZtz4VDP; Wed, 27 Nov 2024 14:10:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732716613; 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=ggNXEoiRETTZ8BeAgSRllix5zvOTdy4eWppu8wVqtSo=; b=GbgrjVjYjupoLjUrvEtfrtJbHbanZ40dPVwxBkG93tpplfQyNiMGn17VSKl1fxgB39P9gm uCo7nLcL9OqDTn8bo5YcdOI0kK+0eVu3fHWh4/7HoqkyprDifN52DGnA5LxGtSDFdrEydS h/9SbyoLVdO9ejaXU7PWPAt/tiawcpsyclpVi+fhR20HXgAhiclJxkC5Mz+qP+CiyX9wHa YwC8zuOCiIJWmRVV7AtOGsKfM6KUyg0QW50kO6TGcTRlJJ88Uf1h1tqtaMUax9/nMv6CFI BQ0BssjBUr/sH8ZLNFGX5P8nD+KaLVSzIJhtsV7F1gxByoKFomZ4f/au/IgGlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732716613; 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=ggNXEoiRETTZ8BeAgSRllix5zvOTdy4eWppu8wVqtSo=; b=Na74QM0turVEuREdlaL+uZRgMVKSziU/hLBdziaMzeyxCa55CZmhtWC1FQTU/iJj88jr6j o11r2HmdsVYNTNHC+FDF09GZ6/8gpKJWU+Z+MngGLwkK8TOnX0nLwZTXdGIC4+jpBaMnfv yUyMmPESK9RGnYi42Ji9/ms9uUQxfPTPFImKlRbvVtok8I4VjsOkORD7uS8dqgFzgZS75s zQTLdurXIhBspay9Qi8fN1WTZO4GoHu58ZUz1BARhznqfi6zUF8UYacVRQchhSXuw7bnpV CDAK4D54HmHoKECvAT1VG0DxWxtflcHHI2cDx2fZzTCB1I1j+OFoh1xvT70c+Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732716613; a=rsa-sha256; cv=none; b=GQ1aSgj25k+CGvXph5ChozzdMtCTz2ReCX9CmVtP5rbuL/YboUJMVwLqaPD91L8ixjbnuS lQI2DFWORa7ptDSIT2uEeV7WM8PU/bj5yqnjJ6pe8bikrixn2C77xgjoy6122iIkol+elK zyPoXGYh6iBTavBA0KLInU7JaYizHfFRa9GKUGAKYz++xMYGo7+8/mNubFt1Uy9s6/vt7p I+SIX40K0z+3eft3EB2ZYNQ9ZeeyYh/+rmpuKQHfES08N/B87+pt3g/TtPcKi4naSeAUQw mSjCutbtZVGos6+Ih1cjyKy0GJ1HtT69+YjsawXXn5uwScbl4W9xnPVw4s6MYA== 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 4Xz1YK49fPz1BPC; Wed, 27 Nov 2024 14:10:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AREADjb003209; Wed, 27 Nov 2024 14:10:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AREADbA003200; Wed, 27 Nov 2024 14:10:13 GMT (envelope-from git) Date: Wed, 27 Nov 2024 14:10:13 GMT Message-Id: <202411271410.4AREADbA003200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: f7a6cf3a0206 - main - leave(1): Replace magic exit codes with standard macros List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7a6cf3a020600b77795729d1c01780dae8e6d2e Auto-Submitted: auto-generated The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=f7a6cf3a020600b77795729d1c01780dae8e6d2e commit f7a6cf3a020600b77795729d1c01780dae8e6d2e Author: Faraz Vahedi AuthorDate: 2024-10-27 16:33:05 +0000 Commit: Mariusz Zaborski CommitDate: 2024-11-27 14:10:29 +0000 leave(1): Replace magic exit codes with standard macros Signed-off-by: Faraz Vahedi Reviewed by: oshogbo MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1499 --- usr.bin/leave/leave.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c index c83eb02a0b8e..d4db4349d4de 100644 --- a/usr.bin/leave/leave.c +++ b/usr.bin/leave/leave.c @@ -29,8 +29,8 @@ * SUCH DAMAGE. */ -#include #include +#include #include #include #include @@ -66,7 +66,7 @@ main(int argc, char **argv) (void)write(STDOUT_FILENO, MSG1, sizeof(MSG1) - 1); cp = fgets(buf, sizeof(buf), stdin); if (cp == NULL || *cp == '\n') - exit(0); + exit(EXIT_SUCCESS); } else if (argc > 2) usage(); else @@ -117,7 +117,7 @@ main(int argc, char **argv) secs -= now % 60; /* truncate (now + secs) to min */ } doalarm(secs); - exit(0); + exit(EXIT_SUCCESS); } void @@ -133,7 +133,7 @@ doalarm(u_int secs) daytime += secs; strftime(tb, sizeof(tb), "%+", localtime(&daytime)); printf("Alarm set for %s. (pid %d)\n", tb, pid); - exit(0); + exit(EXIT_SUCCESS); } sleep((u_int)2); /* let parent print set message */ if (secs >= 2) @@ -148,7 +148,7 @@ doalarm(u_int secs) if (secs >= FIVEMIN) { sleep(secs - FIVEMIN); if (write(STDOUT_FILENO, MSG2, sizeof(MSG2) - 1) != sizeof(MSG2) - 1) - exit(0); + exit(EXIT_SUCCESS); secs = FIVEMIN; } @@ -157,24 +157,24 @@ doalarm(u_int secs) if (secs >= ONEMIN) { sleep(secs - ONEMIN); if (write(STDOUT_FILENO, MSG3, sizeof(MSG3) - 1) != sizeof(MSG3) - 1) - exit(0); + exit(EXIT_SUCCESS); } #define MSG4 "\07\07Time to leave!\n" for (bother = 10; bother--;) { sleep((u_int)ONEMIN); if (write(STDOUT_FILENO, MSG4, sizeof(MSG4) - 1) != sizeof(MSG4) - 1) - exit(0); + exit(EXIT_SUCCESS); } #define MSG5 "\07\07That was the last time I'll tell you. Bye.\n" (void)write(STDOUT_FILENO, MSG5, sizeof(MSG5) - 1); - exit(0); + exit(EXIT_SUCCESS); } static void usage(void) { fprintf(stderr, "usage: leave [[+]hhmm]\n"); - exit(1); + exit(EXIT_FAILURE); }