[BACK]Return to menus.mi CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / distrib / utils / sysinst

File: [cvs.NetBSD.org] / src / distrib / utils / sysinst / Attic / menus.mi (download)

Revision 1.9, Fri Jul 25 08:26:22 2003 UTC (20 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.8: +2 -2 lines

Sprinkle a load of consts, and change a few variable names.
Now compiles with WARNS=3.

/*	$NetBSD: menus.mi,v 1.9 2003/07/25 08:26:22 dsl Exp $	*/

/*-
 * Copyright (c) 2003 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by David Laight.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Menu system definitions -- machine and language independent
 *
 * Some menus may be called directly in the code rather than via the 
 * menu system.
 *
 *  This file must be first in the sed command line.
 *
 */

{
#include <stdio.h>
#include <time.h>
#include <curses.h>
#include "defs.h"
#include "md.h"
#include "msg_defs.h"
#include "menu_defs.h"

}

default y=12, no exit, scrollable;

allow dynamic menus;
allow dynamic messages;


menu selfskind, title MSG_Select_the_type, y=15;
	option "4.2BSD", exit, action 
	    { ((partinfo *)arg)->pi_fstype = FS_BSDFFS; set_bsize(arg, 8192); };
	option "unused", exit, action 
	    { ((partinfo *)arg)->pi_fstype = FS_UNUSED; set_bsize(arg, 0); };
	option "swap", exit, action 
	    { ((partinfo *)arg)->pi_fstype = FS_SWAP;   set_bsize(arg, 0); };
	option "msdos", exit, action 
	    { ((partinfo *)arg)->pi_fstype = FS_MSDOS;  set_bsize(arg, 0); };
	option "4.4LFS", exit, action 
	    { ((partinfo *)arg)->pi_fstype = FS_BSDLFS; set_bsize(arg, 8192); };

menu selbsize, title MSG_Select_file_system_block_size, y = 15;
	option  "8192", exit, action { set_bsize(arg, 8192); };
	option  "4096", exit, action { set_bsize(arg, 4096); };
	option "16384", exit, action { set_bsize(arg, 16384); };
	option "32768", exit, action { set_bsize(arg, 32768); };

menu selfsize, title MSG_Select_number_of_fragments_per_block, y = 15;
	option MSG_f8_per_block, exit, action { set_fsize(arg, 8); };
	option MSG_f4_per_block, exit, action { set_fsize(arg, 4); };
	option MSG_f2_per_block, exit, action { set_fsize(arg, 2); };
	option MSG_f1_per_block, exit, action { set_fsize(arg, 1); };

menu netbsd, title MSG_NetBSD_VERSION_Install_System,
    exit, exitstring MSG_Exit_Install_System;
	display action  { toplevel(); };
	option MSG_Install_NetBSD_to_hard_disk,
		action { do_install(); };
	option MSG_Upgrade_NetBSD_on_a_hard_disk,
		action { do_upgrade(); };
	option MSG_Re_install_sets_or_install_additional_sets,
		action { do_reinstall_sets(); };
	option MSG_Reboot_the_computer, exit,
		action (endwin) { system("/sbin/reboot -q"); };
	option MSG_Utility_menu, sub menu utility;

menu utility, title MSG_NetBSD_VERSION_Utilities, exit;
	option MSG_Run_bin_sh,
		action (endwin) { system("/bin/sh"); };
	option MSG_Set_timezone, 
		action { set_timezone(); };
	option MSG_Configure_network,
		action {
			extern int network_up;

			network_up = 0;
			config_network();
		};
/*	option MSG_Partition a disk; XXX add later.  */
	option MSG_Logging_functions, action { do_logging(); };
	option MSG_Halt_the_system, exit,
		action (endwin) { system("/sbin/halt -q"); };

menu yesno, title MSG_yes_or_no;
	option MSG_Yes, exit, action  {yesno = 1;};
	option MSG_No,  exit, action  {yesno = 0;};

menu noyes, title MSG_yes_or_no;
	option MSG_No,  exit, action  {yesno = 0;};
	option MSG_Yes, exit, action  {yesno = 1;};

menu ok, title MSG_Hit_enter_to_continue;
	option MSG_ok, exit;

menu layout, title  MSG_Choose_your_installation;
	option MSG_Standard, 	  exit, action { layoutkind = 1; };
	option MSG_Use_Existing,  exit, action { layoutkind = 4; };

menu sizechoice, title  MSG_Choose_your_size_specifier;
	option MSG_Megabytes, exit, action 
		{ sizemult = MEG / sectorsize;
		  multname = msg_string(MSG_megname);
		};
	option MSG_Cylinders, exit, action 
		{ sizemult = current_cylsize; 
		  multname = msg_string(MSG_cylname);
		};
	option MSG_Sectors, exit, action 
		{ sizemult = 1; 
		  multname = msg_string(MSG_secname);
		};

menu distmedium, title MSG_Select_medium;
	display action { msg_display (MSG_distmedium); nodist = 0; };
	option MSG_ftp,		exit, action { got_dist = get_via_ftp(); };
	option MSG_nfs,		exit, action { got_dist = get_via_nfs(); };
	option MSG_cdrom,	exit, action  { got_dist = get_via_cdrom(); };
	option MSG_floppy,	exit, action { got_dist = get_via_floppy(); };
	option MSG_unmounted_fs, exit, action { got_dist = get_via_localfs(); };
	option MSG_local_dir,	exit, action { got_dist = get_via_localdir(); };
	option MSG_none,	exit,  action { nodist = 1; };

menu distset, title MSG_Select_your_distribution;
	display action { msg_display (MSG_distset); };
	option MSG_Full_installation, exit;
	option MSG_Custom_installation, exit, action { customise_sets(); };

menu ftpsource, title MSG_Change;
	display action {
		msg_clear();
		msg_table_add(MSG_ftpsource, ftp_host, ftp_dir, ftp_user,
		    strcmp(ftp_user, "ftp") == 0 || ftp_pass[0] == 0
			? ftp_pass : msg_string(MSG_hidden),
		    ftp_proxy);
		};
	option MSG_Host, action
		{ msg_prompt(MSG_host, ftp_host, ftp_host, 255); };
	option MSG_Directory, action
		{ msg_prompt(MSG_dir, ftp_dir, ftp_dir, 255); };
	option MSG_User, action
		{ msg_prompt(MSG_user, ftp_user, ftp_user, 255);
			ftp_pass[0] = 0;
		};
	option MSG_Password, action
		{ if (strcmp(ftp_user, "ftp") == 0)
			msg_prompt(MSG_email, ftp_pass, ftp_pass, 255);
		  else {
			msg_prompt_noecho(MSG_passwd, "", ftp_pass, 255);
		  }
		};
	option MSG_Proxy, action
		{ msg_prompt(MSG_proxy, ftp_proxy, ftp_proxy, 255);
		  if (strcmp(ftp_proxy, "") == 0)
			unsetenv("ftp_proxy");
		  else
			setenv("ftp_proxy", ftp_proxy, 1);
		};
	option MSG_Get_Distribution, exit;

menu nfssource, title MSG_Change;
	display action
		{ msg_display(MSG_nfssource, nfs_host, nfs_dir); };
	option MSG_Host, action
		{ msg_prompt(MSG_host, NULL, nfs_host, 255); };
	option MSG_Directory, action
		{ msg_prompt(MSG_dir, NULL, nfs_dir, 255); };
	option MSG_Continue, exit;

menu nfsbadmount, title MSG_What_do_you_want_to_do;
	option MSG_Try_again, exit, sub menu nfssource, action
		{ yesno = 1; ignorerror = 0; };
	option MSG_Give_up, exit, action
		{ yesno = 0; ignorerror = 0; };
	option MSG_Ignore_continue_anyway, exit, action
		{ yesno = 1; ignorerror = 1; };


menu fdremount, title MSG_What_do_you_want_to_do;
	option MSG_Try_again, exit, action { yesno = 1; };
	option MSG_Set_finished, exit, action { yesno = 2; };
	option MSG_Abort_install, exit, action { yesno = 0; };

menu fdok, title MSG_Hit_enter_to_continue;
	option MSG_OK, exit, action { yesno = 1; };
	option MSG_Set_finished, exit, action { yesno = 2; };
	option MSG_Abort_install, exit, action { yesno = 0; };

menu crypttype, title MSG_Password_cipher, y=16;
	option MSG_DES, exit, action { yesno = 1; };
	option MSG_MD5, exit, action { yesno = 2; };
	option MSG_Blowfish_2_7_round, exit, action { yesno = 3; };
	option MSG_do_not_change, exit, action { yesno = 0; };

menu cdromsource, title MSG_Change;
	display action
		{ msg_display(MSG_cdromsource, cdrom_dev, cdrom_dir); };
	option MSG_Device, action
		{ msg_prompt(MSG_dev, cdrom_dev, cdrom_dev, SSTRSIZE); };
	option MSG_Directory, action
		{ msg_prompt(MSG_dir, cdrom_dir, cdrom_dir, STRSIZE); };
	option MSG_Continue, exit;

menu cdrombadmount, title MSG_What_do_you_want_to_do;
	option MSG_Try_again, exit, sub menu cdromsource, action
		{ yesno = 1; ignorerror = 0; };
	option MSG_Give_up, exit, action
		{ yesno = 0; ignorerror = 0; };
	option MSG_Ignore_continue_anyway, exit, action
		{ yesno = 1; ignorerror = 1; };


menu localfssource, title MSG_Change;
	display action
		{ msg_display(MSG_localfssource, localfs_dev, localfs_fs, localfs_dir); };
	option MSG_Device, action
		{ msg_prompt(MSG_dev, localfs_dev, localfs_dev, SSTRSIZE); };
	option MSG_File_system, action
		{ msg_prompt(MSG_filesys, localfs_fs, localfs_fs, STRSIZE); };
	option MSG_Directory, action
		{ msg_prompt(MSG_dir, localfs_dir, localfs_dir, STRSIZE); };
	option MSG_Continue, exit;

menu localfsbadmount, title MSG_What_do_you_want_to_do;
	option MSG_Try_again, exit, sub menu localfssource, action
		{ yesno = 1; ignorerror = 0; };
	option MSG_Give_up, exit, action
		{ yesno = 0; ignorerror = 0; };
	option MSG_Ignore_continue_anyway, exit, action
		{ yesno = 1; ignorerror = 1; };

menu localdirsource, title MSG_Change;
	display action
		{ msg_display(MSG_localdir, localfs_dir); };
	option MSG_Directory, exit, action
	    { msg_prompt_win(MSG_dir, -1, 12, 0, 0, NULL, localfs_dir, 60); };
	option MSG_Continue, exit;

menu localdirbad, title MSG_What_do_you_want_to_do;
	display action
		{ msg_display(MSG_localdir, localfs_dir);
		  msg_display_add(*(msg *)arg, localfs_dir); };
	option MSG_Change_directory_path, exit,  action
	    { yesno = 1;
	      msg_prompt_win(MSG_dir, -1, 12, 0, 0, NULL, localfs_dir, 60); };
	option MSG_Give_up, exit, action
		{ yesno = 0; ignorerror = 0; };
	option MSG_Ignore_continue_anyway, exit, action
		{ yesno = 1; ignorerror = 1; };

menu namesrv6, title MSG_Select_IPv6_DNS_server;
	option "ns9.iij.ad.jp", exit, action
		{
#ifdef INET6
		  strlcpy(net_namesvr6, "2001:240::1", sizeof(net_namesvr6));
		  yesno = 1;
#else
		  yesno = 0;
#endif
		}; 
	option "ns-wide.wide.ad.jp", exit, action
		{
#ifdef INET6
		  strlcpy(net_namesvr6, "2001:200:0:1::3", sizeof(net_namesvr6));
		  yesno = 1;
#else
		  yesno = 0;
#endif
		}; 
	option "light.imasy.or.jp", exit, action
		{
#ifdef INET6
		  strlcpy(net_namesvr6, "3ffe:505:0:1:2a0:c9ff:fe61:6521",
		      sizeof(net_namesvr6));
		  yesno = 1;
#else
		  yesno = 0;
#endif
		}; 
	option MSG_other, exit, action
		{ yesno = 0; };

menu ip6autoconf, title MSG_Perform_IPv6_autoconfiguration;
	option MSG_Yes, exit, action  {yesno = 1;};
	option MSG_No,  exit, action  {yesno = 0;};

menu dhcpautoconf, title MSG_Perform_DHCP_autoconfiguration;
	option MSG_Yes, exit, action  {yesno = 1;};
	option MSG_No,  exit, action  {yesno = 0;};

menu rootsh, title MSG_Root_shell;
	option "/bin/csh", exit, action {shellpath = "/bin/csh";};
	option "/bin/ksh", exit, action {shellpath = "/bin/ksh";};
	option "/bin/sh",  exit, action {shellpath = "/bin/sh";}; 

menu extract, title MSG_Select_set_extraction_verbosity;
	option MSG_Progress_bar_recommended, exit, action  { yesno = 1; };
	option MSG_Silent, exit, action  { yesno = 0; };
	option MSG_Verbose_file_name_listing_slow, exit, action { yesno = 2; };