aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2018-04-04 17:07:08 +0200
committerDuncaen <mail@duncano.de>2018-04-04 17:32:09 +0200
commit70522f13f75274053217991b535f40f5cf1437d0 (patch)
treef55e318fd7ba285885f1ab27795282726f436ed6
parent448943ac51aa49d3bfbcb1b6f197d67678f4ada4 (diff)
downloadlobase-70522f13f75274053217991b535f40f5cf1437d0.tar.gz
usr.bin/leave: update to OPENBSD_6_3
-rw-r--r--usr.bin/leave/leave.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/leave/leave.c b/usr.bin/leave/leave.c
index ec11d62..9a82a7e 100644
--- a/usr.bin/leave/leave.c
+++ b/usr.bin/leave/leave.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: leave.c,v 1.17 2015/10/09 01:37:08 deraadt Exp $ */
+/* $OpenBSD: leave.c,v 1.19 2018/02/10 00:00:47 tb Exp $ */
/* $NetBSD: leave.c,v 1.4 1995/07/03 16:50:13 phil Exp $ */
/*
@@ -73,7 +73,7 @@ main(int argc, char *argv[])
(void)fputs("When do you have to leave? ", stdout);
cp = fgets(buf, sizeof(buf), stdin);
if (cp == NULL || *cp == '\n')
- exit(0);
+ return 0;
} else if (argc > 2)
usage();
else
@@ -113,9 +113,10 @@ main(int argc, char *argv[])
secs = (hours - t->tm_hour) * HOUR;
secs += (minutes - t->tm_min) * MINUTE;
+ secs -= t->tm_sec; /* aim for beginning of minute */
}
doalarm(secs);
- exit(0);
+ return 0;
}
static void
@@ -155,12 +156,16 @@ doalarm(u_int secs)
sleep(secs - MINUTE);
if (puts("\a\aJust one more minute!") == EOF)
exit(0);
+ secs = MINUTE;
}
+ sleep(secs);
+
for (bother = 10; bother--;) {
- sleep(MINUTE);
if (puts("\a\aTime to leave!") == EOF)
exit(0);
+ if (bother)
+ sleep(MINUTE);
}
puts("\a\aThat was the last time I'll tell you. Bye.");