Sync with sys/i386/i386/userconfig.c revision 1.128.
This commit is contained in:
parent
aa11c7f9d1
commit
a4af40881f
|
@ -46,7 +46,7 @@
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
**
|
**
|
||||||
** $Id: userconfig.c,v 1.65 1999/01/18 11:01:57 kato Exp $
|
** $Id: userconfig.c,v 1.66 1999/01/28 09:13:20 kato Exp $
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,96 +193,85 @@ SYSCTL_PROC( _machdep, OID_AUTO, uc_devlist, CTLFLAG_RD,
|
||||||
** Note that quit commands encountered in the script will be
|
** Note that quit commands encountered in the script will be
|
||||||
** ignored if the RB_CONFIG flag is supplied.
|
** ignored if the RB_CONFIG flag is supplied.
|
||||||
*/
|
*/
|
||||||
|
static const char *config_script;
|
||||||
|
static int config_script_size; /* use of int for -ve magic value */
|
||||||
|
|
||||||
|
#define has_config_script() (config_script_size > 0)
|
||||||
|
|
||||||
|
static int
|
||||||
|
init_config_script(void)
|
||||||
|
{
|
||||||
|
caddr_t autoentry, autoattr;
|
||||||
|
|
||||||
|
/* Look for loaded userconfig script */
|
||||||
|
autoentry = preload_search_by_type("userconfig_script");
|
||||||
|
if (autoentry != NULL) {
|
||||||
|
/* We have one, get size and data */
|
||||||
|
config_script_size = 0;
|
||||||
|
if ((autoattr = preload_search_info(autoentry, MODINFO_SIZE)) != NULL)
|
||||||
|
config_script_size = (size_t)*(u_int32_t *)autoattr;
|
||||||
|
config_script = NULL;
|
||||||
|
if ((autoattr = preload_search_info(autoentry, MODINFO_ADDR)) != NULL)
|
||||||
|
config_script = *(const char **)autoattr;
|
||||||
|
/* sanity check */
|
||||||
|
if ((config_script_size == 0) || (config_script == NULL)) {
|
||||||
|
config_script_size = 0;
|
||||||
|
config_script = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return has_config_script();
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getchar(void)
|
getchar(void)
|
||||||
{
|
{
|
||||||
static const char *asp;
|
int c = -1;
|
||||||
static int assize; /* use of int for -ve magic value */
|
#ifdef INTRO_USERCONFIG
|
||||||
static int autocheck = 0;
|
|
||||||
caddr_t autoentry, autoattr;
|
|
||||||
int c = 0;
|
|
||||||
static int intro = 0;
|
static int intro = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Look for loaded userconfig script */
|
if (has_config_script())
|
||||||
if (autocheck == 0)
|
|
||||||
{
|
|
||||||
autocheck = 1;
|
|
||||||
autoentry = preload_search_by_type("userconfig_script");
|
|
||||||
if (autoentry != NULL)
|
|
||||||
{
|
|
||||||
/* We have one, get size and data */
|
|
||||||
assize = 0;
|
|
||||||
if ((autoattr = preload_search_info(autoentry, MODINFO_SIZE)) != NULL)
|
|
||||||
assize = (size_t)*(u_int32_t *)autoattr;
|
|
||||||
asp = NULL;
|
|
||||||
if ((autoattr = preload_search_info(autoentry, MODINFO_ADDR)) != NULL)
|
|
||||||
asp = *(const char **)autoattr;
|
|
||||||
/* sanity check */
|
|
||||||
if ((assize == 0) || (asp == NULL)) {
|
|
||||||
assize = 0;
|
|
||||||
asp = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assize > 0)
|
|
||||||
{
|
{
|
||||||
/* Consume character from loaded userconfig script, display */
|
/* Consume character from loaded userconfig script, display */
|
||||||
userconfig_boot_parsing = 1;
|
userconfig_boot_parsing = 1;
|
||||||
c = *asp;
|
c = *config_script;
|
||||||
asp++;
|
config_script++;
|
||||||
assize--;
|
config_script_size--;
|
||||||
|
|
||||||
} else if (assize == 0) {
|
} else {
|
||||||
|
|
||||||
#ifdef INTRO_USERCONFIG
|
#ifdef INTRO_USERCONFIG
|
||||||
if (intro == 0)
|
if (userconfig_boot_parsing) {
|
||||||
{
|
if (!(boothowto & RB_CONFIG)) {
|
||||||
/*
|
/* userconfig_script, !RB_CONFIG -> quit */
|
||||||
* We don't want intro if we just executed a
|
if (intro == 0) {
|
||||||
* script (userconfig_boot_parsing==1), otherwise
|
|
||||||
* we would always block here waiting for user input.
|
|
||||||
*/
|
|
||||||
intro = 1;
|
|
||||||
if (userconfig_boot_parsing == 0)
|
|
||||||
{
|
|
||||||
/* userconfig_boot_parsing will be set to 1 on next pass,
|
|
||||||
* which will allow using 'intro' in the middle of other
|
|
||||||
* userconfig_script commands.
|
|
||||||
*/
|
|
||||||
c = 'i';
|
|
||||||
asp = "ntro\n";
|
|
||||||
assize = strlen(asp);
|
|
||||||
} else {
|
|
||||||
userconfig_boot_parsing = 0;
|
|
||||||
assize=-1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
userconfig_boot_parsing = 0;
|
|
||||||
if (!(boothowto & RB_CONFIG))
|
|
||||||
{
|
|
||||||
/* don't want to drop to interpreter */
|
|
||||||
c = 'q';
|
c = 'q';
|
||||||
asp = "uit\n";
|
config_script = "uit\n";
|
||||||
assize = strlen(asp);
|
config_script_size = strlen(config_script);
|
||||||
#endif
|
/* userconfig_script will be 1 on the next pass */
|
||||||
userconfig_boot_parsing = 0;
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Only display signon banner if we are about to go interactive */
|
/* userconfig_script, RB_CONFIG -> cngetc() */
|
||||||
if (!intro)
|
}
|
||||||
printf("\nFreeBSD Kernel Configuration Utility - Version 1.2\n"
|
} else {
|
||||||
" Type \"help\" for help"
|
if (!(boothowto & RB_CONFIG)) {
|
||||||
#ifdef VISUAL_USERCONFIG
|
/* no userconfig_script, !RB_CONFIG -> show intro */
|
||||||
" or \"visual\" to go to the visual\n"
|
if (intro == 0) {
|
||||||
" configuration interface (requires MGA/VGA display or\n"
|
intro = 1;
|
||||||
" serial terminal capable of displaying ANSI graphics)"
|
c = 'i';
|
||||||
#endif
|
config_script = "ntro\n";
|
||||||
".\n");
|
config_script_size = strlen(config_script);
|
||||||
assize = -1;
|
/* userconfig_script will be 1 on the next pass */
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* no userconfig_script, RB_CONFIG -> cngetc() */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (assize < 0) {
|
#else /* !INTRO_USERCONFIG */
|
||||||
/* No script, read from the keyboard */
|
/* assert(boothowto & RB_CONFIG) */
|
||||||
|
#endif /* INTRO_USERCONFIG */
|
||||||
|
userconfig_boot_parsing = 0;
|
||||||
|
if (c <= 0)
|
||||||
c = cngetc();
|
c = cngetc();
|
||||||
}
|
}
|
||||||
return(c);
|
return(c);
|
||||||
|
@ -2531,7 +2520,7 @@ visuserconfig(void)
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: userconfig.c,v 1.65 1999/01/18 11:01:57 kato Exp $
|
* $Id: userconfig.c,v 1.66 1999/01/28 09:13:20 kato Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "scbus.h"
|
#include "scbus.h"
|
||||||
|
@ -2675,11 +2664,35 @@ static Cmd CmdList[] = {
|
||||||
void
|
void
|
||||||
userconfig(void)
|
userconfig(void)
|
||||||
{
|
{
|
||||||
|
static char banner = 1;
|
||||||
char input[80];
|
char input[80];
|
||||||
int rval;
|
int rval;
|
||||||
Cmd *cmd;
|
Cmd *cmd;
|
||||||
|
|
||||||
|
init_config_script();
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
/* Only display signon banner if we are about to go interactive */
|
||||||
|
if (!has_config_script()) {
|
||||||
|
if (!(boothowto & RB_CONFIG))
|
||||||
|
#ifdef INTRO_USERCONFIG
|
||||||
|
banner = 0;
|
||||||
|
#else
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
if (banner) {
|
||||||
|
banner = 0;
|
||||||
|
printf("FreeBSD Kernel Configuration Utility - Version 1.2\n"
|
||||||
|
" Type \"help\" for help"
|
||||||
|
#ifdef VISUAL_USERCONFIG
|
||||||
|
" or \"visual\" to go to the visual\n"
|
||||||
|
" configuration interface (requires MGA/VGA display or\n"
|
||||||
|
" serial terminal capable of displaying ANSI graphics)"
|
||||||
|
#endif
|
||||||
|
".\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("config> ");
|
printf("config> ");
|
||||||
cngets(input, 80);
|
cngets(input, 80);
|
||||||
if (input[0] == '\0')
|
if (input[0] == '\0')
|
||||||
|
|
Loading…
Reference in New Issue