Skip to content

Commit 635dabf

Browse files
ycsincarlescufi
authored andcommitted
posix: uname: shell: update help message with more information
Populate the help message with more information when an error occurs. Signed-off-by: Yong Cong Sin <[email protected]>
1 parent 48c16f9 commit 635dabf

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/posix/shell/uname.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,23 @@
1919
#define UNAME_ALL \
2020
(UNAME_KERNEL | UNAME_NODE | UNAME_RELEASE | UNAME_VERSION | UNAME_MACHINE | UNAME_PLATFORM)
2121

22+
#define HELP_USAGE \
23+
"Usage: uname [OPTION]\n" \
24+
"Print system information\n" \
25+
"\n" \
26+
" -a, all informationn\n" \
27+
" -s, kernel name\n" \
28+
" -o, operating system\n" \
29+
" -n, network node hostname\n" \
30+
" -r, kernel release\n" \
31+
" -v, kernel version\n" \
32+
" -m, machine hardware name\n" \
33+
" -p, processor type\n" \
34+
" -i, hardware platform\n"
35+
2236
static void uname_print_usage(const struct shell *sh)
2337
{
24-
shell_print(sh, "usage: uname [-asonrvmpi]");
38+
shell_print(sh, HELP_USAGE);
2539
}
2640

2741
static int uname_cmd_handler(const struct shell *sh, size_t argc, char **argv)
@@ -83,7 +97,7 @@ static int uname_cmd_handler(const struct shell *sh, size_t argc, char **argv)
8397
}
8498

8599
if (argc != optind) {
86-
shell_error(sh, "extra operand %s", argv[optind]);
100+
shell_error(sh, "uname: extra operand %s", argv[optind]);
87101
uname_print_usage(sh);
88102
return -1;
89103
}

0 commit comments

Comments
 (0)