-
Notifications
You must be signed in to change notification settings - Fork 155
Expand file tree
/
Copy pathuname.c
More file actions
22 lines (21 loc) · 680 Bytes
/
Copy pathuname.c
File metadata and controls
22 lines (21 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* # uname
*
* Get information about the current computer using `uname`.
*
* Unsurprisingly, it is the same information given by the POSIX utility `uname`.
* https://unix.stackexchange.com/questions/136959/where-does-uname-get-its-information-from/485962#485962
*/
#include "common.h"
int main(void) {
struct utsname info;
if (uname(&info) == -1) {
perror("uname");
exit(EXIT_FAILURE);
}
printf("sysname = %s\n", info.sysname );
printf("nodename = %s\n", info.nodename);
printf("release = %s\n", info.release );
printf("version = %s\n", info.version );
printf("machine = %s\n", info.machine );
return EXIT_SUCCESS;
}