Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jan 2025 12:35:56 GMT
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ef3914a56110 - stable/14 - leave(1): Replace magic exit codes with standard macros
Message-ID:  <202501291235.50TCZulQ051287@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by oshogbo:

URL: https://cgit.FreeBSD.org/src/commit/?id=ef3914a561102b9ad8330ea88bfa8c32b79a5582

commit ef3914a561102b9ad8330ea88bfa8c32b79a5582
Author:     Faraz Vahedi <kfv@kfv.io>
AuthorDate: 2024-10-27 16:33:05 +0000
Commit:     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: 2025-01-29 09:51:18 +0000

    leave(1): Replace magic exit codes with standard macros
    
    Signed-off-by: Faraz Vahedi <kfv@kfv.io>
    Reviewed by:    oshogbo
    MFC after:      1 week
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1499
    
    (cherry picked from commit f7a6cf3a020600b77795729d1c01780dae8e6d2e)
---
 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 ccea5d93d460..78bc17be2501 100644
--- a/usr.bin/leave/leave.c
+++ b/usr.bin/leave/leave.c
@@ -41,8 +41,8 @@ static char sccsid[] = "@(#)leave.c	8.1 (Berkeley) 6/6/93";
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-#include <err.h>
 #include <ctype.h>
+#include <err.h>
 #include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -84,7 +84,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
@@ -135,7 +135,7 @@ main(int argc, char **argv)
 		secs -= now % 60;	/* truncate (now + secs) to min */
 	}
 	doalarm(secs);
-	exit(0);
+	exit(EXIT_SUCCESS);
 }
 
 void
@@ -151,7 +151,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)
@@ -166,7 +166,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;
 	}
 
@@ -175,24 +175,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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501291235.50TCZulQ051287>