hatte eine install routine in c gebaut die ich jetzt mit ncurses bissl schoener machen mag, hier der code:
Code: Select all
#include <ncurses.h>
#include <menu.h>
char *choices[] =
{
"1 - Keymap",
"2 - Swap partition",
"3 - Root partition",
"4 - Install",
"5 - Config",
"6 - Exit",
};
int main(void)
{
ITEM **my_items;
int c;
MENU *my_menu;
int n_choices, i;
ITEM *cur_item;
initscr();
cbreak();
noecho();
keypad(stdscr, TRUE);
n_choices = (sizeof(choices) / sizeof(choices[0])); //determine how big is one choices element
my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); //allocate needed space
for(i = 0; i < n_choices; i++)
my_items[i] = new_item(choices[i], choices[i]);
my_items[n_choices] = (ITEM *)NULL;
my_menu = new_menu((ITEM **)my_items);
mvprintw(LINES - 2, 0, "Welcome to EDU Linux");
post_menu(my_menu);
refresh();
while(c = getch())
{
switch(c)
{
case KEY_DOWN:
menu_driver(my_menu, REQ_DOWN_ITEM);
break;
case KEY_UP:
menu_driver(my_menu, REQ_UP_ITEM);
break;
}
}
free_item(my_items[0]);
free_item(my_items[1]);
free_menu(my_menu);
endwin();
}
thx
blubb