From c58250956947ed692c455987f6f10ef8640d2575 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 22 Feb 2026 13:10:23 +0100 Subject: m fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- README | 2 +- alarm.1 | 4 ++-- alarm.c | 8 +++++--- config.mk | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README b/README index 6358061..2890343 100644 --- a/README +++ b/README @@ -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. diff --git a/alarm.1 b/alarm.1 index 9a9f79b..974144d 100644 --- a/alarm.1 +++ b/alarm.1 @@ -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 diff --git a/alarm.c b/alarm.c index 81ad107..dc24f0e 100644 --- a/alarm.c +++ b/alarm.c @@ -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; } diff --git a/config.mk b/config.mk index aa81003..974b0d1 100644 --- a/config.mk +++ b/config.mk @@ -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 -- cgit v1.2.3-70-g09d2