Beispiel #1
0
int main(const int argc, const char *argv[])
{
    char version_string[256];
    static struct s_hardware hardware;

    snprintf(version_string, sizeof version_string, "%s %s (%s)",
	     PRODUCT_NAME, VERSION, CODENAME);

    /* Cleaning structures */
    init_hardware(&hardware);

    /* Detecting Syslinux version */
    detect_syslinux(&hardware);

    /* Detecting parameters */
    detect_parameters(argc, argv, &hardware);

    /* Opening the Syslinux console */
    init_console(&hardware);

    /* Detect hardware */
    detect_hardware(&hardware);

    /* Clear the screen and reset position of the cursor */
    clear_screen();
    printf("\033[1;1H");

    more_printf("%s\n", version_string);

    int return_code = 0;

    if (!menumode || automode)
	start_cli_mode(&hardware);
    else {
	return_code = start_menu_mode(&hardware, version_string);
	if (return_code == HDT_RETURN_TO_CLI)
	    start_cli_mode(&hardware);
    }

    /* Do we got request to do something at exit time ? */
    if (strlen(hardware.postexec)>0) {
	    more_printf("Executing postexec instructions : %s\n",hardware.postexec);
	    runsyslinuxcmd(hardware.postexec);
    }

    return return_code;
}
Beispiel #2
0
int main(const int argc, const char *argv[])
{
    char version_string[256];
    const char *arg;
    struct s_hardware hardware;

    snprintf(version_string, sizeof version_string, "%s %s (%s)",
	     PRODUCT_NAME, VERSION, CODENAME);

    /* Cleaning structures */
    init_hardware(&hardware);

    /* Detecting Syslinux version */
    detect_syslinux(&hardware);

    /* Detecting parameters */
    detect_parameters(argc, argv, &hardware);

    /* Opening the Syslinux console */
    init_console(&hardware);

    /* Clear the screen and reset position of the cursor */
    clear_screen();
    printf("\033[1;1H");

    printf("%s\n", version_string);

    if ((arg = find_argument(argv + 1, "nomenu"))
	|| (find_argument(argv + 1, "auto")))
	start_cli_mode(&hardware);
    else {
	int return_code = start_menu_mode(&hardware, version_string);
	if (return_code == HDT_RETURN_TO_CLI)
	    start_cli_mode(&hardware);
	else
	    return return_code;
    }
    return 0;
}