k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit 4d96265f95d59d94496ff480e769589cbe07d324
parent d8c6dd6fe814e644707451a76e331bcc28b426b2
Author: qorg11 <qorg@vxempire.xyz>
Date:   Sat, 22 Aug 2020 11:53:59 +0200

Improved uname.c

Diffstat:
Msrc/uname.c | 34+++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)

diff --git 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"); }