sname.c (702B)
- // Collection of Unix tools, comparable to coreutils
- // SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
- #include <stdio.h> // printf(), perror()
- #include <sys/utsname.h> // utsname, uname()
- int
- main()
- {
- struct utsname name;
- if(uname(&name) != 0)
- {
- perror("uname");
- return 1;
- }
- int ret = printf("sysname=%s\nnodename=%s\nrelease=%s\nversion=%s\nmachine=%s\n",
- name.sysname,
- name.nodename,
- name.release,
- name.version,
- name.machine);
- if(ret < 0)
- {
- perror("sname");
- return 1;
- }
- return 0;
- }