1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include "dact.h"
#include "uname.h"
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
int uname(struct utsname *buf) {
#ifdef _USE_WIN32_
uint32_t winver;
SYSTEM_INFO winsysinfo;
#endif
if (buf==NULL) return(-1);
#ifdef _USE_WIN32_
GetSystemInfo(&winsysinfo);
winver=GetVersion();
snprintf(buf->release, 64, "%i.%i", winver&0xff, (winver&0xff00)>>8);
snprintf(buf->machine, 64, "%lu", (unsigned long) winsysinfo.dwProcessorType);
strcpy(buf->sysname, "windows");
#else
strcpy(buf->sysname, "(unknown)");
strcpy(buf->machine, "(unknown)");
strcpy(buf->release, "0.0.0");
#endif
return(0);
}
|