2004-07-19 Robert Millan * src/uname.c: When -a is used, only print operating system name if different from kernel name. --- coreutils-5.2.1/src/uname.c.old 2004-07-19 02:59:58.000000000 +0200 +++ coreutils-5.2.1/src/uname.c 2004-07-19 03:31:19.000000000 +0200 @@ -146,6 +146,7 @@ { int c; static char const unknown[] = "unknown"; + struct utsname name; /* Mask indicating which elements to print. */ unsigned toprint = 0; @@ -221,10 +222,8 @@ if (toprint & (PRINT_KERNEL_NAME | PRINT_NODENAME | PRINT_KERNEL_RELEASE - | PRINT_KERNEL_VERSION | PRINT_MACHINE)) + | PRINT_KERNEL_VERSION | PRINT_MACHINE | PRINT_OPERATING_SYSTEM)) { - struct utsname name; - if (uname (&name) == -1) error (EXIT_FAILURE, errno, _("cannot get system name")); @@ -287,8 +286,10 @@ print_element (element); } - if (toprint & PRINT_OPERATING_SYSTEM) - print_element (HOST_OPERATING_SYSTEM); + /* If -a was chosen, only print OS if different from kernel name. */ + if ((toprint & PRINT_OPERATING_SYSTEM) && + ((toprint != -1) || strcmp (name.sysname, HOST_OPERATING_SYSTEM))) + print_element (HOST_OPERATING_SYSTEM); putchar ('\n');