File: uname.c

package info (click to toggle)
dact 0.8.42-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 1,412 kB
  • sloc: ansic: 5,923; sh: 2,748; makefile: 142
file content (28 lines) | stat: -rw-r--r-- 628 bytes parent folder | download | duplicates (4)
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);
}