aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqorg11 <qorg@vxempire.xyz>2020-08-22 11:53:59 +0200
committerqorg11 <qorg@vxempire.xyz>2020-08-22 11:53:59 +0200
commit4d96265f95d59d94496ff480e769589cbe07d324 (patch)
tree2e6696d77b058bab8cf214a704e7b17ee6dd167a
parentd8c6dd6fe814e644707451a76e331bcc28b426b2 (diff)
downloadk9core-4d96265f95d59d94496ff480e769589cbe07d324.tar.gz
k9core-4d96265f95d59d94496ff480e769589cbe07d324.zip
Improved uname.c
-rw-r--r--src/uname.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/uname.c b/src/uname.c
index 4ff2a82..8c22256 100644
--- a/src/uname.c
+++ b/src/uname.c
@@ -1,6 +1,24 @@
#include <stdio.h>
#include <sys/utsname.h>
#include <getopt.h>
+#include <string.h>
+
+const char
+*get_operating_system()
+{
+#ifdef __gnu_linux__
+ return "GNU/Linux";
+#endif
+#ifdef __FreeBSD__
+ return "FreeBSD";
+#endif
+#ifdef __OpenBSD__
+ return "OpenBSD";
+#endif
+#ifdef _WIN32
+ return "Here's a USB stick kid, get a real operating system";
+#endif
+}
int
main(int argc, char *argv[])
@@ -35,23 +53,25 @@ main(int argc, char *argv[])
if(all)
{
printf("%s %s %s %s %s %s\n",
- kernel_info.machine,
+ kernel_info.sysname,
kernel_info.nodename,
kernel_info.release,
- kernel_info.sysname,
kernel_info.version,
- kernel_info.machine);
+ kernel_info.machine,
+ get_operating_system());
}
else
{
if(machine)
- printf("%s ",kernel_info.machine);
+ printf("%s ",kernel_info.machine);
if(node_name)
- printf("%s ",kernel_info.nodename);
+ printf("%s ",kernel_info.nodename);
if(kernel_release)
- printf("%s ",kernel_info.release);
+ printf("%s ",kernel_info.release);
if(kernel_name || nothing)
- printf("%s ",kernel_info.sysname);
+ printf("%s ",kernel_info.sysname);
+ if(operating_system)
+ printf("%s",get_operating_system());
printf("\n");
}