A
program on
UNIX-like
operating systems which tells you
information about the
box you're on. Here's mine:
$ uname -a
Linux tftv 2.4.0-test9 #1 Tue Oct 3 17:25:35 EDT 2000 i686
That means my
kernel is
Linux 2.4.0-test9 compiled on Tuesday
October 3, 2000 at 17:25:35
EDT, I'm running an
i686, and my
host name is
tftv.
Okay, so now here's my little quick rewrite of "uname -a" to demonstrate the system call by the same name:
#include <stdio.h>
#include <sys/utsname.h>
int main() {
struct utsname uname_struct;
uname( &uname_struct );
printf( "%s %s %s %s\n", uname_struct.sysname, uname_struct.nodename,
uname_struct.release, uname_struct.machine );
return 0;
}
Yeah, I'm pretty
bored to be
writing this. :)