commit: edf6bf7701c82730dca390eace7fa92dfd8f0df7
parent 3f4ec818db3a23693088ca390e5bba01764f11c4
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 20 Sep 2024 03:09:16 +0200
cmd/mkfifo: unify error message formatting
Diffstat:
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/cmd/mkfifo.c b/cmd/mkfifo.c
@@ -38,16 +38,16 @@ main(int argc, char *argv[])
mode = new_mode(optarg, 0666, &errstr);
if(errstr != NULL)
{
- fprintf(stderr, "mkfifo: Failed parsing mode '%s': %s\n", optarg, errstr);
+ fprintf(stderr, "mkfifo: error: Failed parsing mode '%s': %s\n", optarg, errstr);
return 1;
}
break;
case ':':
- fprintf(stderr, "mkfifo: Error: Missing operand for option: '-%c'\n", optopt);
+ fprintf(stderr, "mkfifo: error: Missing operand for option: '-%c'\n", optopt);
usage();
return 1;
case '?':
- fprintf(stderr, "mkfifo: Error: Unrecognised option: '-%c'\n", optopt);
+ fprintf(stderr, "mkfifo: error: Unrecognised option: '-%c'\n", optopt);
usage();
return 1;
default:
@@ -62,7 +62,7 @@ main(int argc, char *argv[])
if(argc < 1)
{
- fprintf(stderr, "mkfifo: Missing file argument\n");
+ fprintf(stderr, "mkfifo: error: Missing file argument\n");
usage();
return 1;
}
@@ -71,7 +71,8 @@ main(int argc, char *argv[])
{
if(mkfifo(argv[i], mode) != 0)
{
- fprintf(stderr, "mkfifo: Failed creating FIFO at '%s': %s\n", argv[i], strerror(errno));
+ fprintf(
+ stderr, "mkfifo: error: Failed creating FIFO at '%s': %s\n", argv[i], strerror(errno));
return 1;
}
}
diff --git a/test-cmd/mkfifo.sh b/test-cmd/mkfifo.sh
@@ -12,9 +12,9 @@ t_cmd foo:test '' test -p foo
t_cmd foo:rm '' rm foo
t_cmd exists:touch '' touch exists
-t --exit=1 exists exists "mkfifo: Failed creating FIFO at 'exists': File exists
+t --exit=1 exists exists "mkfifo: error: Failed creating FIFO at 'exists': File exists
"
t_cmd exists:rm '' rm exists
-t --exit=1 enotdir /dev/null/e/noent "mkfifo: Failed creating FIFO at '/dev/null/e/noent': Not a directory
+t --exit=1 enotdir /dev/null/e/noent "mkfifo: error: Failed creating FIFO at '/dev/null/e/noent': Not a directory
"