/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
char **titles;
char **datasets;
int menu_entry_count;
int menu_table_size;
int in_menu_entry;
extern void set_default_fs(char *fsw_name);
void
init_table(void)
{
menu_entry_count = 0;
prom_panic("out of mem");
in_menu_entry = 0;
}
void
{
/* skip leading white space */
title_str++;
if (menu_entry_count == menu_table_size) {
ENTRY_ALLOC_COUNT * sizeof (char *));
ENTRY_ALLOC_COUNT * sizeof (char *));
prom_panic("out of mem");
}
if (in_menu_entry)
prom_panic("out of mem");
in_menu_entry = 1;
}
void
{
char *cp;
/* skip leading white space */
while (isspace(*dataset_str))
dataset_str++;
/* if there is still any white space in the line, it's invalid */
break;
if (*cp)
return; /* dataset name was invalid */
if (!in_menu_entry)
return; /* dataset line was not preceded by a title */
prom_panic("out of mem");
in_menu_entry = 0;
}
char *
{
char *ep;
/* skip leading white space */
cp++;
/*
* if the string contained nothing but white space, return a
* null string.
*/
if (*cp == '\0')
return (cp);
/* truncate trailing white space */
;
ep++;
*ep = '\0';
return (cp);
}
char *cons_gets(char *, int);
void
{
int n;
unsigned long choice;
set_default_fs("promfs");
if (mountroot("bootfs") != 0)
prom_panic("can't mount root");
prom_panic("can't open menu.lst");
init_table();
/* skip comments and blank lines */
continue;
/* find end of first keyword on line */
;
/* if at the end of the line, the line had no arguments */
if (*ep == '\0')
continue;
*ep = '\0';
continue;
}
continue;
}
}
if (menu_entry_count == 0)
prom_panic("no menu entries found");
for (n = 0; n < menu_entry_count; n++) {
}
/* cut off leading and trailing white space */
/*
* If the input is totally invalid, the return value of
* strtoul() will be 0 or ULONG_MAX. Either way, it's
* of the acceptable range.
*/
printf("Invalid entry.\n");
continue;
}
/* XXX here is the result */
printf("\nTo boot the selected entry, invoke:\n");
}
}