diff options
| author | Faraz Vahedi <kfv@kfv.io> | 2024-10-27 16:33:05 +0000 |
|---|---|---|
| committer | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2024-11-27 14:10:29 +0000 |
| commit | f7a6cf3a020600b77795729d1c01780dae8e6d2e (patch) | |
| tree | 0ec3f8d6f670b130e78f63a75764c64660f6cda1 /usr.bin/leave | |
| parent | 95498a5acc0888ed2e73237b82a1e90f109473f9 (diff) | |
Diffstat (limited to 'usr.bin/leave')
| -rw-r--r-- | usr.bin/leave/leave.c | 18 |
1 files 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); } |
