logo

utils

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

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

Diffstat:

Mcmd/env.c4++--
Mtest-cmd/env4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/env.c b/cmd/env.c @@ -54,11 +54,11 @@ main(int argc, char *argv[]) unsetenv(optarg); break; case ':': - fprintf(stderr, "Error: Missing operand for option: '-%c'\n", optopt); + fprintf(stderr, "env: Error: Missing operand for option: '-%c'\n", optopt); usage(); return 1; case '?': - fprintf(stderr, "Error: Unrecognised option: '-%c'\n", optopt); + fprintf(stderr, "env: Error: Unrecognised option: '-%c'\n", optopt); usage(); return 1; default: diff --git a/test-cmd/env b/test-cmd/env @@ -11,7 +11,7 @@ noargs_body() { atf_test_case badarg badarg_body() { - atf_check -s not-exit:0 -e "inline:Error: Unrecognised option: '-f'\nenv [-i] [-u key] [key=value ...] [command [args]]\n" ../cmd/env -f + atf_check -s not-exit:0 -e "inline:env: Error: Unrecognised option: '-f'\nenv [-i] [-u key] [key=value ...] [command [args]]\n" ../cmd/env -f } atf_test_case iflag @@ -30,7 +30,7 @@ uflag_body() { atf_check -o "inline:FOO=BAR\n" ../cmd/env -i FOO=BAR BAR=FOO ../cmd/env -u BAR - atf_check -s not-exit:0 -e "inline:Error: Missing operand for option: '-u'\nenv [-i] [-u key] [key=value ...] [command [args]]\n" ../cmd/env -u + atf_check -s not-exit:0 -e "inline:env: Error: Missing operand for option: '-u'\nenv [-i] [-u key] [key=value ...] [command [args]]\n" ../cmd/env -u } atf_test_case devfull