-
Notifications
You must be signed in to change notification settings - Fork 4
/
sysinfo.c
71 lines (63 loc) · 1.77 KB
/
sysinfo.c
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* @namespace biew
* @file sysinfo.c
* @brief This file contains system information utility and tools.
* @version -
* @remark this source file is part of Binary vIEW project (BIEW).
* The Binary vIEW (BIEW) is copyright (C) 1995 Nickols_K.
* All rights reserved. This software is redistributable under the
* licence given in the file "Licence.en" ("Licence.ru" in russian
* translation) distributed in the BIEW archive.
* @note Requires POSIX compatible development system
*
* @author Nickols_K
* @since 1995
* @note Development, fixes and improvements
**/
#include <stddef.h>
#include <stdint.h>
#include "bconsole.h"
#include "beyeutil.h"
#include "reg_form.h"
extern REGISTRY_SYSINFO AsciiTable;
extern REGISTRY_SYSINFO CPUPerformance;
extern REGISTRY_SYSINFO InputViewer;
extern REGISTRY_SYSINFO ConsoleInfo;
static REGISTRY_SYSINFO *toolTable[] =
{
&AsciiTable,
&ConsoleInfo,
&InputViewer,
&CPUPerformance
};
static int defToolSel = 0;
void SelectSysInfo( void )
{
const char *toolName[sizeof(toolTable)/sizeof(REGISTRY_TOOL *)];
size_t i,nTools;
int retval;
nTools = sizeof(toolTable)/sizeof(REGISTRY_TOOL *);
for(i = 0;i < nTools;i++) toolName[i] = toolTable[i]->name;
retval = SelBoxA(toolName,nTools," Select tool: ",defToolSel);
if(retval != -1)
{
toolTable[retval]->sysinfo();
defToolSel = retval;
}
}
void init_sysinfo( void )
{
size_t i;
for(i = 0;i < sizeof(toolTable)/sizeof(REGISTRY_TOOL *);i++)
{
if(toolTable[i]->read_ini) toolTable[i]->read_ini();
}
}
void term_sysinfo( void )
{
size_t i;
for(i = 0;i < sizeof(toolTable)/sizeof(REGISTRY_TOOL *);i++)
{
if(toolTable[i]->save_ini) toolTable[i]->save_ini();
}
}