]> git.sur5r.net Git - cc65/commitdiff
New file uname-test.c
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 12 Aug 2003 17:32:16 +0000 (17:32 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 12 Aug 2003 17:32:16 +0000 (17:32 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2287 b7a2c559-68d2-44c3-8de9-860c34a00d81

testcode/lib/files.txt
testcode/lib/uname-test.c [new file with mode: 0644]

index 232fbb2ad57feadfc379ebdf8b7f646d807b27e4..f7623eaf4826c591c31f439667b33cfe29a30b58 100644 (file)
@@ -16,3 +16,4 @@ posixio-test.c  -       test POSIX file i/o routines (open/read/write/close)
 seek.c         -       test lseek()/fseek()/ftell()
 signal-test.c   -       small test program for signal/raise
 time-test.c     -       test the time/mktime/gmtime/asctime functions
+uname-test.c    -       test the uname function
diff --git a/testcode/lib/uname-test.c b/testcode/lib/uname-test.c
new file mode 100644 (file)
index 0000000..b0733d0
--- /dev/null
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/utsname.h>
+
+
+int main (void)
+{                  
+    /* Get the uname data */
+    struct utsname buf;
+    if (uname (&buf) != 0) {
+        perror ("uname");
+        return EXIT_FAILURE;
+    }
+
+    /* Print it */      
+    printf ("sysname:  \"%s\"\n", buf.sysname);
+    printf ("nodename: \"%s\"\n", buf.nodename);
+    printf ("release:  \"%s\"\n", buf.release);
+    printf ("version:  \"%s\"\n", buf.version);
+    printf ("machine:  \"%s\"\n", buf.machine);
+
+    /* Done */
+    return EXIT_SUCCESS;
+}
+
+