git: f7a6cf3a0206 - main - leave(1): Replace magic exit codes with standard macros

From: Mariusz Zaborski <oshogbo_at_FreeBSD.org>
Date: Wed, 27 Nov 2024 14:10:13 UTC
The branch main has been updated by oshogbo:

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

commit f7a6cf3a020600b77795729d1c01780dae8e6d2e
Author:     Faraz Vahedi <kfv@kfv.io>
AuthorDate: 2024-10-27 16:33:05 +0000
Commit:     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: 2024-11-27 14:10:29 +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
---
 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 <err.h>
 #include <ctype.h>
+#include <err.h>
 #include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -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);
 }