4581490 [rkeene@sledge /home/rkeene/devel/libopennet-0.9.9]$ cat -n uname.c
 1 #include "compat.h"
 2 #include "uname.h"
 3 #ifdef HAVE_STDIO_H
 4 #include <stdio.h>
 5 #endif
 6 
 7 int uname(struct utsname *buf) {
 8 #ifdef _USE_WIN32_
 9     uint32_t winver;
10     SYSTEM_INFO winsysinfo;
11 #endif
12 
13     if (!buf) {
14         return(-1);
15     }
16 
17 #ifdef _USE_WIN32_
18     GetSystemInfo(&winsysinfo);
19     winver = GetVersion();
20                         
21     snprintf(buf->release, 64, "%i.%i", winver & 0xff, (winver & 0xff00) >> 8);
22     snprintf(buf->machine, 64, "%lu", (unsigned long) winsysinfo.dwProcessorType); 
23     strcpy(buf->sysname, "windows");
24 #else
25     strcpy(buf->sysname, "(unknown)");
26     strcpy(buf->machine, "(unknown)");
27     strcpy(buf->release, "0.0.0");
28 #endif
29     return(0);
30 }
4581491 [rkeene@sledge /home/rkeene/devel/libopennet-0.9.9]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2005-07-04 04:01:56