-
-
Save mrahimygk/fb16a53b071cb9447779caeaebe8d41a to your computer and use it in GitHub Desktop.
Showing system info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/utsname.h> | |
int main(int argc, char *argv[]) { | |
struct utsname *_system_ = malloc(sizeof(struct utsname)); | |
uname(_system_); | |
if(argc==2 && | |
(strcmp(argv[1], "version")==0 | |
|| strcmp(argv[1],"VERSION" ) == 0)) | |
printf("%s\n",_system_->version); | |
else{ | |
printf("SYS NAME: %s\n", _system_->sysname); | |
printf("NODE NAME: %s\n", _system_->nodename); | |
printf("RELEASE: %s\n", _system_->release); | |
printf("VERSION: %s\n", _system_->version); | |
printf("MACHINE: %s\n", _system_->machine); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment