commit: 4c85e9d2975d1f5467aa53782e87503357e2c525
parent 38714b356c66455460b5c7224d926570215ebe63
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 22 Nov 2024 07:24:19 +0100
cmd/uname: add support for -p option
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/cmd/uname.1 b/cmd/uname.1
@@ -22,6 +22,9 @@ Enable all options, equivalent to passing
Write machine name, also known as the processor architecture.
.It Fl n
Write network node name, also known as hostname.
+.It Fl p
+(non-standard) Write processor type. Currently aliased to
+.Fl m .
.It Fl r
Write running operating system release.
.It Fl s
@@ -42,5 +45,9 @@ was specified.
should be compliant with the
IEEE Std 1003.1-2024 (“POSIX.1”)
specification.
+.Pp
+The
+.Fl p
+option is an extension.
.Sh AUTHORS
.An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me
diff --git a/cmd/uname.c b/cmd/uname.c
@@ -43,20 +43,21 @@ maybe_print_name(enum uname_names key, char *value)
static void
usage(void)
{
- fprintf(stderr, "Usage: uname [-amnrsv]\n");
+ fprintf(stderr, "Usage: uname [-amnprsv]\n");
}
int
main(int argc, char *argv[])
{
int c = -1;
- while((c = getopt(argc, argv, ":amnrsv")) != -1)
+ while((c = getopt(argc, argv, ":amnprsv")) != -1)
{
switch(c)
{
case 'a':
names = CMD_UNAME_ALL;
break;
+ case 'p':
case 'm':
names |= CMD_UNAME_MACHINE;
break;