commit: d0a54c2647da65ae765854e42aabef8cb7749179
parent 8fd4ff38bd19cd97717118081cc702ee41d04c09
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 20 Sep 2024 04:47:42 +0200
cmd/uname: unify error message formatting
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/cmd/uname.c b/cmd/uname.c
@@ -33,7 +33,7 @@ maybe_print_name(enum uname_names key, char *value)
{
if(printf(fmt, value) < 0)
{
- fprintf(stderr, "uname: Write Error: %s", strerror(errno));
+ fprintf(stderr, "uname: error: Failed writing %s", strerror(errno));
exit(1);
}
fmt = " %s";
@@ -73,11 +73,11 @@ main(int argc, char *argv[])
names |= CMD_UNAME_VERSION;
break;
case ':':
- fprintf(stderr, "uname: Error: Missing operand for option: '-%c'\n", optopt);
+ fprintf(stderr, "uname: error: Missing operand for option: '-%c'\n", optopt);
usage();
return 1;
case '?':
- fprintf(stderr, "uname: Error: Unrecognised option: '-%c'\n", optopt);
+ fprintf(stderr, "uname: error: Unrecognised option: '-%c'\n", optopt);
usage();
return 1;
default:
@@ -89,8 +89,9 @@ main(int argc, char *argv[])
struct utsname name;
if(uname(&name) != 0)
{
- fprintf(
- stderr, "uname: Failed getting current system names via uname(): %s\n", strerror(errno));
+ fprintf(stderr,
+ "uname: error: Failed getting current system names via uname(): %s\n",
+ strerror(errno));
return 1;
}