logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 1dc89fa702a71e748335e6552d2f6bab2b4fe5ba
parent 50140a83a59ebcab0fde677cafb71cf801bf32ed
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed,  2 Jul 2025 03:52:05 +0200

cmd/uname: Add support for -o

Diffstat:

Mcmd/uname.110++++++++--
Mcmd/uname.c5+++--
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/cmd/uname.1 b/cmd/uname.1 @@ -9,7 +9,7 @@ .Nd return system name and information .Sh SYNOPSIS .Nm -.Op Fl amnrsv +.Op Fl amnoprsv .Sh DESCRIPTION .Nm prints the operating system name, and optionally more information about the system to standard output, separated by spaces. @@ -22,6 +22,10 @@ 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 o +(non-standard) Write operating system name. +Currently aliased to +.Fl s . .It Fl p (non-standard) Write processor type. Currently aliased to @@ -48,7 +52,9 @@ IEEE Std 1003.1-2024 (“POSIX.1”) specification. .Pp The +.Fl o +and .Fl p -option is an extension. +options are extensions. .Sh AUTHORS .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me diff --git a/cmd/uname.c b/cmd/uname.c @@ -46,13 +46,13 @@ maybe_print_name(enum uname_names key, char *value) static void usage(void) { - fprintf(stderr, "Usage: uname [-amnprsv]\n"); + fprintf(stderr, "Usage: uname [-amnoprsv]\n"); } int main(int argc, char *argv[]) { - for(int c = -1; (c = getopt_nolong(argc, argv, ":amnprsv")) != -1;) + for(int c = -1; (c = getopt_nolong(argc, argv, ":amnoprsv")) != -1;) { switch(c) { @@ -69,6 +69,7 @@ main(int argc, char *argv[]) case 'r': names |= CMD_UNAME_RELEASE; break; + case 'o': case 's': names |= CMD_UNAME_SYSNAME; break;