diff options
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | alarm.1 | 4 | ||||
| -rw-r--r-- | alarm.c | 8 | ||||
| -rw-r--r-- | config.mk | 4 |
4 files changed, 10 insertions, 8 deletions
@@ -6,7 +6,7 @@ SYNOPSIS DESCRIPTION Schedules an alarm(3) to be triggered after a specified - duration. The process than execvp(3) into command. + duration. The process then execvp(3)s into command. This means that command will be killed by SIGALRM after a selected duration. @@ -11,8 +11,8 @@ Schedules an .BR alarm (3) to be triggered after a specified .IR duration . -The process than -.BR execvp (3) +The process then +.BR execvp (3)s into .IR command . .PP @@ -13,7 +13,7 @@ static void usage(void) { fprintf(stderr, "usage: %s duration command [argument ...]\n", argv0); - exit(0); + exit(125); } int @@ -25,6 +25,7 @@ main(int argc, char **argv) long buf = 0; int hms = 0; char *time, c; + int ret; argv0 = argv[0]; if (argc < 3) @@ -56,6 +57,7 @@ main(int argc, char **argv) alarm((unsigned)seconds); execvp(argv[2], &argv[2]); - fprintf(stderr, "%s: execvp %s: %s\n", argv0, argv[2], strerror(ENOMEM)); - return 1; + ret = errno == ENOENT ? 127 : 126; + fprintf(stderr, "%s: execvp %s: %s\n", argv0, argv[2], strerror(errno)); + return ret; } @@ -1,8 +1,8 @@ PREFIX = /usr MANPREFIX = $(PREFIX)/share/man -CC = cc +CC = c99 CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -CFLAGS = -std=c99 -Wall -O2 +CFLAGS = -O2 LDFLAGS = -s |
