Esempio n. 1
0
int start_menu_mode(struct s_hardware *hardware, char *version_string)
{
    struct s_hdt_menu hdt_menu;

    memset(&hdt_menu, 0, sizeof(hdt_menu));

    /* Setup the menu system */
    setup_menu(version_string);

    /* Compute all submenus */
    compute_submenus(&hdt_menu, hardware);

    /* Compute the main menu */
    compute_main_menu(&hdt_menu, hardware);

#ifdef WITH_MENU_DISPLAY
    t_menuitem *curr;
    char cmd[160];

    if (!quiet)
	more_printf("Starting Menu (%d menus)\n", hdt_menu.total_menu_count);
    curr = showmenus(hdt_menu.main_menu.menu);
    /* When we exit the menu, do we have something to do? */
    if (curr) {
	/* When want to execute something */
	if (curr->action == OPT_RUN) {
	    /* Tweak, we want to switch to the cli */
	    if (!strncmp
		(curr->data, HDT_SWITCH_TO_CLI, sizeof(HDT_SWITCH_TO_CLI))) {
		return HDT_RETURN_TO_CLI;
	    }
	    /* Tweak, we want to start the dump mode */
	    if (!strncmp
		(curr->data, HDT_DUMP, sizeof(HDT_DUMP))) {
		    dump(hardware);
	        return 0;
	    }
	    if (!strncmp
		(curr->data, HDT_REBOOT, sizeof(HDT_REBOOT))) {
		syslinux_reboot(1);
	    }
	    strcpy(cmd, curr->data);

	    /* Use specific syslinux call if needed */
	    if (issyslinux())
		runsyslinuxcmd(cmd);
	    else
		csprint(cmd, 0x07);
	    return 1;		// Should not happen when run from SYSLINUX
	}
    }
#endif
    return 0;
}
Esempio n. 2
0
/**
 Main menu to select the file, edit, compute, report functions
 for the statistics package. Starting point for the project.
 */
int main(int argc, char * argv[])
{

	int selection=0;
	int error_code = NO_ERROR;

	while (selection != EXIT_SEL)
    {
		selection = main_menu();
		switch (selection)
        {
			case FILE_SEL:
            {
				file_main_menu();
				selection = 0;
				break;
			}
			case EDIT_SEL:
            {
				edit_main_menu();
				break;
			}
			case COMPUTE_SEL:
            {
				compute_main_menu();
				break;
			}
            case REPORT_SEL:
            {
                report_main_menu();
                break;
            }
		}
	}
	clear_screen();
	printf("Thank you for using StatPac. Goodbye.\n");
	fflush(stdout);

	return error_code;
}