logo

utils

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

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

Diffstat:

Mcmd/del.c2+-
Mtest-cmd/del6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/del.c b/cmd/del.c @@ -15,7 +15,7 @@ main(int argc, char *argv[]) if(remove(argv[i]) < 0) { // TODO: interact on write protection to force deletion - fprintf(stderr, "remove(%s) error: %s\n", argv[i], strerror(errno)); + fprintf(stderr, "del: remove(%s) error: %s\n", argv[i], strerror(errno)); return 1; } } diff --git a/test-cmd/del b/test-cmd/del @@ -20,7 +20,7 @@ nopermf_body() { chmod 0000 inputs/chmod_000 || atf_fail "chmod 0000 chmod_000" # shellcheck disable=SC1112 - atf_check -s exit:1 -e 'inline:Error opening ‘inputs/chmod_000’: Permission denied\n' ../cmd/del inputs/chmod_000 + atf_check -s exit:1 -e 'inline:del: Error opening ‘inputs/chmod_000’: Permission denied\n' ../cmd/del inputs/chmod_000 } nopermf_cleanup() { rm -fr inputs/chmod_000 inputs/chmod_000.d || atf_fail "rm chmod_000{,.d}" @@ -32,7 +32,7 @@ nopermd_body() { chmod 0000 inputs/chmod_000.d || atf_fail "chmod 0000 chmod_000.d" # shellcheck disable=SC1112 - atf_check -s exit:1 -e 'inline:Error opening ‘inputs/chmod_000’: Permission denied\n' ../cmd/del inputs/chmod_000.d + atf_check -s exit:1 -e 'inline:del: Error opening ‘inputs/chmod_000’: Permission denied\n' ../cmd/del inputs/chmod_000.d } nopermd_cleanup() { rm -fr inputs/chmod_000 inputs/chmod_000.d || atf_fail "rm chmod_000{,.d}" @@ -41,7 +41,7 @@ nopermd_cleanup() { atf_test_case enoent enoent_body() { # shellcheck disable=SC1112 - atf_check -s exit:1 -e 'inline:remove(/var/empty/e/no/ent) error: No such file or directory\n' ../cmd/del /var/empty/e/no/ent + atf_check -s exit:1 -e 'inline:del: remove(/var/empty/e/no/ent) error: No such file or directory\n' ../cmd/del /var/empty/e/no/ent } atf_init_test_cases() {