#include
#include
#include
int main(void) {
char cmpname[256];
struct utsname uts;
if(gethostname(cmpname, 255) == 0)
printf("gethostname : %s\n", cmpname);
if(uname(&uts) == 0) {
printf("uts.sysname : %s\n", uts.sysname);
printf("uts.machine : %s\n", uts.machine);
printf("uts.nodename : %s\n", uts.nodename);
printf("uts.release : %s\n", uts.release);
printf("uts.version : %s\n", uts.version);
// GNU adds an extra extension .domainname
}
return 0;
}