logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: 9f7d2a185929826faf9a8c9df3d5af15ce971572
parent 0a5dbb24a2fcaa757f6e68c875aa77aef4e29bdf
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 20 Sep 2024 04:07:12 +0200

cmd/sleep: unify error message formatting

Diffstat:

Mcmd/sleep.c6+++---
Mtest-cmd/sleep.sh4++--
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmd/sleep.c b/cmd/sleep.c @@ -32,7 +32,7 @@ main(int argc, char *argv[]) } if(dur.tv_sec == 0 && dur.tv_nsec == 0) { - fprintf(stderr, "sleep: Got a total duration of 0\n"); + fprintf(stderr, "sleep: error: Got a total duration of 0\n"); return 1; } @@ -42,13 +42,13 @@ main(int argc, char *argv[]) if(errno == EINTR) { fprintf(stderr, - "sleep: Interrupted during sleep, still had %ld.%09ld seconds remaining\n", + "sleep: warning: Interrupted during sleep, still had %ld.%09ld seconds remaining\n", dur.tv_sec, dur.tv_nsec); } else { - perror("sleep: nanosleep"); + perror("sleep: warning: nanosleep"); } } diff --git a/test-cmd/sleep.sh b/test-cmd/sleep.sh @@ -6,10 +6,10 @@ target="$(dirname "$0")/../cmd/sleep" plans=3 . "$(dirname "$0")/tap.sh" -t --exit=1 noargs '' 'sleep: Got a total duration of 0 +t --exit=1 noargs '' 'sleep: error: Got a total duration of 0 ' -t --exit=1 zero '0' 'sleep: Got a total duration of 0 +t --exit=1 zero '0' 'sleep: error: Got a total duration of 0 ' t zero-one 0.1 ''