snippet: view plain - save this
1 /**
2 DO WHAT THE FUCK YOU WANT TO, BUT IT'S NOT MY FAULT PUBLIC LICENSE
3 Version 1, November 2007
4
5 Copyright (C) 2004 Sam Hocevar
6 14 rue de Plaisance, 75014 Paris, France
7 Everyone is permitted to copy and distribute verbatim or modified
8 copies of this license document, and changing it is allowed as long
9 as the name is changed.
10
11 DO WHAT THE FUCK YOU WANT TO, BUT IT'S NOT MY FAULT PUBLIC LICENSE
12 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
13
14 0. You just DO WHAT THE FUCK YOU WANT TO, BUT IT'S NOT MY FAULT.
15 **/
16
17 #include <stdlib.h>
18 #include <stdio.h>
19 #include <sys/utsname.h>
20
21 int main(void)
22 {
23 struct utsname uname_s;
24
25 if (uname(&uname_s) >= 0) {
26 printf("Sysname\t: %s\nNodename: %s\nRelease\t: %s\nVersion\t: %s\nMachine\t: %s\n",
27 uname_s.sysname,
28 uname_s.nodename,
29 uname_s.release,
30 uname_s.version,
31 uname_s.version);
32 #ifdef _GNU_SOURCE
33 printf("Domain\t: %s\n", uname_s.domainname);
34 #endif
35 printf("\n");
36 return EXIT_SUCCESS;
37 }
38
39 return EXIT_FAILURE;
40 }

0 comments