31 #define _WIN32_WINNT 0x0500 48 #define COIL_UTSNAME_LENGTH 65 83 if (name == NULL)
return 0;
87 ::strcpy(name->
sysname,
"Win32");
90 OSVERSIONINFO version_info;
91 version_info.dwOSVersionInfoSize =
sizeof(OSVERSIONINFO);
92 if (::GetVersionEx(&version_info) ==
false)
96 if (version_info.dwPlatformId == VER_PLATFORM_WIN32_NT)
98 os =
"Windows NT %d.%d";
102 os =
"Windows CE %d.%d";
106 (
int) version_info.dwMajorVersion,
107 (
int) version_info.dwMinorVersion);
110 (
int) version_info.dwBuildNumber,
111 version_info.szCSDVersion);
114 SYSTEM_INFO sys_info;
115 GetSystemInfo(&sys_info);
116 WORD arch = sys_info.wProcessorArchitecture;
122 case PROCESSOR_ARCHITECTURE_INTEL:
123 strcpy(cputype,
"Intel");
124 if (sys_info.wProcessorLevel == 3)
125 strcpy(subtype,
"80386");
126 else if (sys_info.wProcessorLevel == 4)
127 strcpy(subtype,
"80486");
128 else if (sys_info.wProcessorLevel == 5)
129 strcpy(subtype,
"Pentium");
130 else if (sys_info.wProcessorLevel == 6)
131 strcpy(subtype,
"Pentium Pro");
132 else if (sys_info.wProcessorLevel == 7)
133 strcpy(subtype,
"Pentium II");
135 strcpy(subtype,
"Pentium Family");
138 strcpy(cputype,
"Unknown");
139 strcpy(subtype,
"Unknown");
145 if (GetComputerNameExA(ComputerNameDnsHostname,
224 inline char*
getenv(
const char* name)
235 #define BADCH (int)'?' 236 #define BADARG (int)':' 258 static int getopt(
int nargc,
char *
const *nargv,
const char *ostr)
260 static char *place =
EMSG;
264 if (optreset || !*place) {
294 if (place[1] && *++place ==
'-') {
300 if ((
optopt = (
int)*place++) == (
int)
':' ||
301 !(oli = strchr(ostr,
optopt))) {
310 if (opterr && *ostr !=
':') {
311 if (!(p = strrchr(*nargv,
'/')))
315 fprintf(stderr,
"%s: illegal option -- %c\n",
328 else if (nargc <= ++
optind) {
330 if (!(p = strrchr(*nargv,
'/')))
338 "%s: option requires an argument -- %c\n",
385 GetOpt(
int argc,
char*
const argv[],
const char* opt,
int flag)
386 : m_argc(argc), m_argv(argv), m_opt(opt), m_flag(flag),
optind(1), opterr(1),
optopt(0)
437 int result =
getopt(m_argc, m_argv, m_opt);
454 char*
const * m_argv;
char version[COIL_UTSNAME_LENGTH]
#define COIL_UTSNAME_LENGTH
int operator()()
Parses the command line arguments.
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
char sysname[COIL_UTSNAME_LENGTH]
pid_t getppid()
Get process ID of the parent process.
GetOpt(int argc, char *const argv[], const char *opt, int flag)
Constructor.
char nodename[COIL_UTSNAME_LENGTH]
::pid_t pid_t
Get process ID of the caller process.
int uname(utsname *name)
Get System information.
static int getopt(int nargc, char *const *nargv, const char *ostr)
Function of parses the command line arguments.
char * getenv(const char *name)
Get environment variable.
std::string sprintf(char const *__restrict fmt,...)
Convert it into a format given with an argumen.
char machine[COIL_UTSNAME_LENGTH]
char release[COIL_UTSNAME_LENGTH]
Common Object Interface Layer.