extern struct coreinfo_module pci_module;
extern struct coreinfo_module coreboot_module;
-#define MODULE_COUNT 3
-
-struct coreinfo_module *modules[MODULE_COUNT] = {
+struct coreinfo_module *modules[] = {
&cpuinfo_module,
&pci_module,
- &coreboot_module
+ &coreboot_module,
};
static WINDOW *modwin;
wmove(win, 1, 1);
- for(i = 0; i < 78; i++)
+ for (i = 0; i < 78; i++)
waddch(win, '\304');
}
-void print_menu(void) {
- int i, len;
+static void print_menu(void)
+{
+ int i, j;
char menu[80];
char *ptr = menu;
- int j;
wmove(stdscr, 23, 0);
- for(j = 0; j < SCREEN_X; j++)
+ for (j = 0; j < SCREEN_X; j++)
waddch(stdscr, ' ');
- for(i = 0; i < MODULE_COUNT; i++)
+ for (i = 0; i < ARRAY_SIZE(modules); i++)
ptr += sprintf(ptr, "F%d: %s ", i + 1, modules[i]->name);
mvprintw(23, 0, menu);
}
-void center(int row, const char *str)
+static void center(int row, const char *str)
{
int len = strlen(str);
int j;
wmove(stdscr, row, 0);
- for(j = 0; j < SCREEN_X; j++)
+ for (j = 0; j < SCREEN_X; j++)
waddch(stdscr, ' ');
mvprintw(row, (SCREEN_X - len) / 2, str);
}
-void header(int row, const char *str)
+/* FIXME: Currently unused. */
+#if 0
+static void header(int row, const char *str)
{
char buf[SCREEN_X];
char *ptr = buf;
int i;
int len = strlen(str) + 4;
- for(i = 0; i < (SCREEN_X - len) / 2; i++)
+ for (i = 0; i < (SCREEN_X - len) / 2; i++)
ptr += sprintf(ptr, "=");
ptr += sprintf(ptr, "[ %s ]", str);
-
- for(i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X ; i++)
+ for (i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X; i++)
ptr += sprintf(ptr, "=");
mvprintw(row, 0, buf);
}
+#endif
static void redraw_module(void)
{
refresh();
}
-int loop(void)
+static void loop(void)
{
int key;
modules[curwin]->redraw(modwin);
refresh();
- while(1) {
+ while (1) {
key = getch();
if (key == ERR)
- continue;
+ continue;
if (key >= KEY_F(1) && key <= KEY_F(9)) {
unsigned char ch = key - KEY_F(1);
- if (ch < MODULE_COUNT) {
+ if (ch < ARRAY_SIZE(modules)) {
curwin = ch;
redraw_module();
continue;
wattrset(stdscr, COLOR_PAIR(1) | A_BOLD);
wattrset(modwin, COLOR_PAIR(2));
- for(i = 0; i < 23; i++) {
+ for (i = 0; i < 23; i++) {
wmove(modwin, i - 1, 0);
- for(j = 0; j < SCREEN_X; j++)
+ for (j = 0; j < SCREEN_X; j++)
waddch(modwin, ' ');
}
refresh();
- for(i = 0; i < MODULE_COUNT; i++)
+ for (i = 0; i < ARRAY_SIZE(modules); i++)
modules[i]->init();
-
+
loop();
+
+ return 0;
}