logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: cbc6775c991dc79faa420d9bc2092658a446da84
parent 414255fde104d0559b0d9cdc8b1ed787afb16c5f
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 24 Sep 2022 05:27:45 +0200

cmd/echo: Always prefix error message with "echo: "

Diffstat:

Mcmd/echo.c4++--
Mtest-cmd/echo2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmd/echo.c b/cmd/echo.c @@ -28,7 +28,7 @@ main(int argc, char *argv[]) buffer = malloc(arg_len); if(buffer == NULL) { - perror("malloc(arg_len)"); + perror("echo: malloc(arg_len)"); return 1; } @@ -48,7 +48,7 @@ main(int argc, char *argv[]) if(write(1, buffer, arg_len) < (ssize_t)arg_len) { - perror("write(1, buffer, arg_len)"); + perror("echo: write(1, buffer, arg_len)"); err++; } diff --git a/test-cmd/echo b/test-cmd/echo @@ -19,7 +19,7 @@ doubledash_body() { atf_test_case devfull devfull_body() { - atf_check -s exit:1 -e 'inline:write(1, buffer, arg_len): No space left on device\n' sh -c '../cmd/echo hello world >/dev/full' + atf_check -s exit:1 -e 'inline:echo: write(1, buffer, arg_len): No space left on device\n' sh -c '../cmd/echo hello world >/dev/full' } atf_init_test_cases() {