k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit b653b7599a92fff8aac70ef75b8243b402a897ee
parent 2b3baec7765435fa0ac6130c0cc4b8525f3f11e2
Author: qorg11 <qorg@vxempire.xyz>
Date:   Fri, 21 Aug 2020 14:06:28 +0200

Better style and stuff to uname.c

Diffstat:
Msrc/uname.c | 33+++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/uname.c b/src/uname.c @@ -14,6 +14,7 @@ main(int argc, char *argv[]) int operating_system = 0; int nothing = 0; struct utsname kernel_info; + if(argc == 1) nothing = 1; while((c = getopt(argc, argv, "amnrsv")) != -1) @@ -25,11 +26,12 @@ main(int argc, char *argv[]) case 'n': node_name = 1; break; case 'r': kernel_release = 1; break; case 's': kernel_name = 1; break; - case 'v': operating_system = 1; break; - + case 'v': operating_system = 1; break; } } + uname(&kernel_info); + if(all) { printf("%s %s %s %s %s %s\n", @@ -38,21 +40,20 @@ main(int argc, char *argv[]) kernel_info.release, kernel_info.sysname, kernel_info.version, - kernel_info.machine); + kernel_info.machine); } - else{ - if(machine) - printf("%s ",kernel_info.machine); - if(node_name) - printf("%s ",kernel_info.nodename); - if(kernel_release) - printf("%s ",kernel_info.release); - if(kernel_name || nothing) - printf("%s ",kernel_info.sysname); - printf("\n"); + else + { + if(machine) + printf("%s ",kernel_info.machine); + if(node_name) + printf("%s ",kernel_info.nodename); + if(kernel_release) + printf("%s ",kernel_info.release); + if(kernel_name || nothing) + printf("%s ",kernel_info.sysname); + printf("\n"); - } - - + } return 0; }