Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jun 2013 07:36:09 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r251905 - in head/usr.sbin/bsdconfig/console: . include
Message-ID:  <201306180736.r5I7a94J048160@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Tue Jun 18 07:36:09 2013
New Revision: 251905
URL: http://svnweb.freebsd.org/changeset/base/251905

Log:
  Remove unnecessary loops, perform some code consolidation, and add some
  additional error checking/reporting.

Modified:
  head/usr.sbin/bsdconfig/console/font
  head/usr.sbin/bsdconfig/console/include/messages.subr
  head/usr.sbin/bsdconfig/console/keymap
  head/usr.sbin/bsdconfig/console/repeat
  head/usr.sbin/bsdconfig/console/saver
  head/usr.sbin/bsdconfig/console/screenmap
  head/usr.sbin/bsdconfig/console/ttys

Modified: head/usr.sbin/bsdconfig/console/font
==============================================================================
--- head/usr.sbin/bsdconfig/console/font	Tue Jun 18 07:33:45 2013	(r251904)
+++ head/usr.sbin/bsdconfig/console/font	Tue Jun 18 07:36:09 2013	(r251905)
@@ -137,86 +137,52 @@ f_mustberoot_init
 #
 # Launch application main menu
 #
-while :; do
-	dialog_menu_main || f_die
-	f_dialog_menutag_fetch mtag
-
-	case "$mtag" in
-	"1 $msg_none") # Use hardware default font
-		f_sysrc_set font8x8 "NO" || f_die
-		f_sysrc_set font8x14 "NO" || f_die
-		f_sysrc_set font8x16 "NO" || f_die
-		break ;;
-	"2 $msg_ibm_437") # English and others, VGA default
-		f_sysrc_set font8x8 "cp437-8x8" || f_die
-		f_sysrc_set font8x14 "cp437-8x14" || f_die
-		f_sysrc_set font8x16 "cp437-8x16" || f_die
-		break ;;
-	"3 $msg_ibm_850") # Western Europe, IBM encoding
-		f_sysrc_set font8x8 "cp850-8x8" || f_die
-		f_sysrc_set font8x14 "cp850-8x14" || f_die
-		f_sysrc_set font8x16 "cp850-8x16" || f_die
-		break ;;
-	"4 $msg_ibm_865") # Norwegian, IBM encoding
-		f_sysrc_set font8x8 "cp865-8x8" || f_die
-		f_sysrc_set font8x14 "cp865-8x14" || f_die
-		f_sysrc_set font8x16 "cp865-8x16" || f_die
-		break ;;
-	"5 $msg_ibm_866") # Russian, IBM encoding (use with KOI8-R screenmap)
-		f_sysrc_set font8x8 "cp866-8x8" || f_die
-		f_sysrc_set font8x14 "cp866-8x14" || f_die
-		f_sysrc_set font8x16 "cp866b-8x16" || f_die
-		f_sysrc_set mousechar_start 3 || f_die
-		break ;;
-	"6 $msg_ibm_866u") # Ukrainian, IBM encoding (use w/ KOI8-U screenmap)
-		f_sysrc_set font8x8 "cp866u-8x8" || f_die
-		f_sysrc_set font8x14 "cp866u-8x14" || f_die
-		f_sysrc_set font8x16 "cp866u-8x16" || f_die
-		f_sysrc_set mousechar_start 3 || f_die
-		break ;;
-	"7 $msg_ibm_1251") # Cyrillic, MS Windows encoding
-		f_sysrc_set font8x8 "cp1251-8x8" || f_die
-		f_sysrc_set font8x14 "cp1251-8x14" || f_die
-		f_sysrc_set font8x16 "cp1251-8x16" || f_die
-		f_sysrc_set mousechar_start 3 || f_die
-		break ;;
-	"8 $msg_iso_8859_1") # Western Europe, ISO encoding
-		f_sysrc_set font8x8 "iso-8x8" || f_die
-		f_sysrc_set font8x14 "iso-8x14" || f_die
-		f_sysrc_set font8x16 "iso-8x16" || f_die
-		break ;;
-	"9 $msg_iso_8859_2") # Eastern Europe, ISO encoding
-		f_sysrc_set font8x8 "iso02-8x8" || f_die
-		f_sysrc_set font8x14 "iso02-8x14" || f_die
-		f_sysrc_set font8x16 "iso02-8x16" || f_die
-		break ;;
-	"a $msg_iso_8859_4") # Baltic, ISO encoding
-		f_sysrc_set font8x8 "iso04-8x8" || f_die
-		f_sysrc_set font8x14 "iso04-8x14" || f_die
-		f_sysrc_set font8x16 "iso04-8x16" || f_die
-		break ;;
-	"b $msg_iso_8859_7") # Greek, ISO encoding
-		f_sysrc_set font8x8 "iso07-8x8" || f_die
-		f_sysrc_set font8x14 "iso07-8x14" || f_die
-		f_sysrc_set font8x16 "iso07-8x16" || f_die
-		break ;;
-	"c $msg_iso_8859_8") # Hebrew, ISO encoding
-		f_sysrc_set font8x8 "iso08-8x8" || f_die
-		f_sysrc_set font8x14 "iso08-8x14" || f_die
-		f_sysrc_set font8x16 "iso08-8x16" || f_die
-		break ;;
-	"d $msg_iso_8859_15") # Europe, ISO encoding
-		f_sysrc_set font8x8 "iso15-8x8" || f_die
-		f_sysrc_set font8x14 "iso15-8x14" || f_die
-		f_sysrc_set font8x16 "iso15-8x16" || f_die
-		break ;;
-	"e $msg_swiss") # English, better resolution
-		f_sysrc_set font8x8 "swiss-8x8" || f_die
-		f_sysrc_set font8x14 "NO" || f_die
-		f_sysrc_set font8x16 "swiss-8x16" || f_die
-		break ;;
-	esac
-done
+dialog_menu_main || f_die
+f_dialog_menutag_fetch mtag
+
+f8= f14= f16= mc_start=
+case "$mtag" in
+"1 $msg_none") # Use hardware default font
+	f8="NO" f14="NO" f16="NO" ;;
+"2 $msg_ibm_437") # English and others, VGA default
+	f8="cp437-8x8" f14="cp437-8x14" f16="cp437-8x16" ;;
+"3 $msg_ibm_850") # Western Europe, IBM encoding
+	f8="cp850-8x8" f14="cp850-8x14" f16="cp850-8x16" ;;
+"4 $msg_ibm_865") # Norwegian, IBM encoding
+	f8="cp865-8x8" f14="cp865-8x14" f16="cp865-8x16" ;;
+"5 $msg_ibm_866") # Russian, IBM encoding (use with KOI8-R screenmap)
+	f8="cp866-8x8" f14="cp866-8x14" f16="cp866b-8x16" mc_start="3" ;;
+"6 $msg_ibm_866u") # Ukrainian, IBM encoding (use w/ KOI8-U screenmap)
+	f8="cp866u-8x8" f14="cp866u-8x14" f16="cp866u-8x16" mc_start="3" ;;
+"7 $msg_ibm_1251") # Cyrillic, MS Windows encoding
+	f8="cp1251-8x8" f14="cp1251-8x14" f16="cp1251-8x16" mc_start="3" ;;
+"8 $msg_iso_8859_1") # Western Europe, ISO encoding
+	f8="iso-8x8" f14="iso-8x14" f16="iso-8x16" ;;
+"9 $msg_iso_8859_2") # Eastern Europe, ISO encoding
+	f8="iso02-8x8" f14="iso02-8x14" f16="iso02-8x16" ;;
+"a $msg_iso_8859_4") # Baltic, ISO encoding
+	f8="iso04-8x8" f14="iso04-8x14" f16="iso04-8x16" ;;
+"b $msg_iso_8859_7") # Greek, ISO encoding
+	f8="iso07-8x8" f14="iso07-8x14" f16="iso07-8x16" ;;
+"c $msg_iso_8859_8") # Hebrew, ISO encoding
+	f8="iso08-8x8" f14="iso08-8x14" f16="iso08-8x16" ;;
+"d $msg_iso_8859_15") # Europe, ISO encoding
+	f8="iso15-8x8" f14="iso15-8x14" f16="iso15-8x16" ;;
+"e $msg_swiss") # English, better resolution
+	f8="swiss-8x8" f14="NO" f16="swiss-8x16" ;;
+esac
+
+[ "$f8" -a "$f14" -a "$f16" ] || f_die "$msg_unknown_font_selection"
+
+f_sysrc_set font8x8 "$f8" || f_die
+f_sysrc_set font8x14 "$f14" || f_die
+f_sysrc_set font8x16 "$f16" || f_die
+
+if [ "$mc_start" ]; then
+	f_sysrc_set mousechar_start "$mc_start" || f_die
+else
+	f_sysrc_delete mousechar_start || f_die
+fi
 
 exit $SUCCESS
 

Modified: head/usr.sbin/bsdconfig/console/include/messages.subr
==============================================================================
--- head/usr.sbin/bsdconfig/console/include/messages.subr	Tue Jun 18 07:33:45 2013	(r251904)
+++ head/usr.sbin/bsdconfig/console/include/messages.subr	Tue Jun 18 07:36:09 2013	(r251905)
@@ -241,6 +241,11 @@ msg_ukrainian_koi8_u="Ukranian KOI8-U"
 msg_ukrainian_koi8_u_desc="Ukranian KOI8-U keymap"
 msg_ukrainian_koi8_u_koi8_r="Ukranian KOI8-U+KOI8-R"
 msg_ukrainian_koi8_u_koi8_r_desc="Ukranian KOI8-U+KOI8-R keymap (alter)"
+msg_unknown_font_selection="Unknown font selection"
+msg_unknown_keymap="Unknown keymap"
+msg_unknown_repeat_rate="Unknown repeat rate"
+msg_unknown_saver="Unknown saver"
+msg_unknown_screenmap_selection="Unknown screenmap selection"
 msg_us_ascii="US-ASCII"
 msg_us_ascii_to_ibm327="US-ASCII to IBM437"
 msg_us_ascii_to_ibm327_desc="US-ASCII to IBM 437 screenmap"

Modified: head/usr.sbin/bsdconfig/console/keymap
==============================================================================
--- head/usr.sbin/bsdconfig/console/keymap	Tue Jun 18 07:33:45 2013	(r251904)
+++ head/usr.sbin/bsdconfig/console/keymap	Tue Jun 18 07:36:09 2013	(r251905)
@@ -254,188 +254,76 @@ while :; do
 
 	[ "$keymap_name" ] || continue
 
+	keymap_to_set=
 	case "$keymap_name" in
-	belgian)
-		f_sysrc_set keymap "be.iso" || f_die
-		break ;;
-	brazil_cp850)
-		f_sysrc_set keymap "br275.cp850" || f_die
-		break ;;
-	brazil_iso)
-		f_sysrc_set keymap "br275.iso" || f_die
-		break ;;
-	brazil_iso_accent)
-		f_sysrc_set keymap "br275.iso.acc" || f_die
-		break ;;
-	bulgarian_bds)
-		f_sysrc_set keymap "bg.bds.ctrlcaps" || f_die
-		break ;;
-	bulgarian_phonetic)
-		f_sysrc_set keymap "bg.phonetic.ctrlcaps" || f_die
-		break ;;
-	central_european_iso)
-		f_sysrc_set keymap "ce.iso2" || f_die
-		break ;;
-	croatian_iso)
-		f_sysrc_set keymap "hr.iso" || f_die
-		break ;;
-	czech_iso_accent)
-		f_sysrc_set keymap "cs.latin2.qwertz" || f_die
-		break ;;
-	danish_cp865)
-		f_sysrc_set keymap "danish.cp865" || f_die
-		break ;;
-	danish_iso)
-		f_sysrc_set keymap "danish.iso" || f_die
-		break ;;
-	estonian_cp850)
-		f_sysrc_set keymap "estonian.cp850" || f_die
-		break ;;
-	estonian_iso)
-		f_sysrc_set keymap "estonian.iso" || f_die
-		break ;;
-	estonian_iso_15)
-		f_sysrc_set keymap "estonian.iso15" || f_die
-		break ;;
-	finnish_cp850)
-		f_sysrc_set keymap "finnish.cp850" || f_die
-		break ;;
-	finnish_iso)
-		f_sysrc_set keymap "finnish.iso" || f_die
-		break ;;
-	french_iso)
-		f_sysrc_set keymap "fr.iso" || f_die
-		break ;;
-	french_iso_accent)
-		f_sysrc_set keymap "fr.iso.acc" || f_die
-		break ;;
-	french_iso_macbook)
-		f_sysrc_set keymap "fr.macbook.acc" || f_die
-		break ;;
-	german_cp850)
-		f_sysrc_set keymap "german.cp850" || f_die
-		break ;;
-	german_iso)
-		f_sysrc_set keymap "german.iso" || f_die
-		break ;;
-	greek_101)
-		f_sysrc_set keymap "gr.us101.acc" || f_die
-		break ;;
-	greek_104)
-		f_sysrc_set keymap "el.iso07" || f_die
-		break ;;
-	greek_elot)
-		f_sysrc_set keymap "gr.elot.acc" || f_die
-		break ;;
-	hungarian_101)
-		f_sysrc_set keymap "hu.iso2.101keys" || f_die
-		break ;;
-	hungarian_102)
-		f_sysrc_set keymap "hu.iso2.102keys" || f_die
-		break ;;
-	icelandic)
-		f_sysrc_set keymap "icelandic.iso" || f_die
-		break ;;
-	icelandic_accent)
-		f_sysrc_set keymap "icelandic.iso.acc" || f_die
-		break ;;
-	italian)
-		f_sysrc_set keymap "it.iso" || f_die
-		break ;;
-	japanese_106)
-		f_sysrc_set keymap "jp.106" || f_die
-		break ;;
-	latin_american)
-		f_sysrc_set keymap "latinamerican" || f_die
-		break ;;
-	latin_american_accent)
-		f_sysrc_set keymap "latinamerican.iso.acc" || f_die
-		break ;;
-	norway_iso)
-		f_sysrc_set keymap "norwegian.iso" || f_die
-		break ;;
-	polish_iso)
-		f_sysrc_set keymap "pl_PL.ISO8859-2" || f_die
-		break ;;
-	portuguese)
-		f_sysrc_set keymap "pt.iso" || f_die
-		break ;;
-	portuguese_accent)
-		f_sysrc_set keymap "pt.iso.acc" || f_die
-		break ;;
-	russia_koi8_r)
-		f_sysrc_set keymap "ru.koi8-r" || f_die
-		break ;;
-	slovak) 
-		f_sysrc_set keymap "sk.iso2" || f_die
-		break ;;
-	slovenian)
-		f_sysrc_set keymap "si.iso" || f_die
-		break ;;
-	spanish)
-		f_sysrc_set keymap "spanish.iso" || f_die
-		break ;;
-	spanish_accent)
-		f_sysrc_set keymap "spanish.iso.acc" || f_die
-		break ;;
-	swedish_cp850)
-		f_sysrc_set keymap "swedish.cp850" || f_die
-		break ;;
-	swedish_iso)
-		f_sysrc_set keymap "swedish.iso" || f_die
-		break ;;
-	swiss_french_cp850)
-		f_sysrc_set keymap "swissfrench.cp850" || f_die
-		break ;;
-	swiss_french_iso)
-		f_sysrc_set keymap "swissfrench.iso" || f_die
-		break ;;
-	swiss_french_iso_accent)
-		f_sysrc_set keymap "swissfrench.iso.acc" || f_die
-		break ;;
-	swiss_german_cp850)
-		f_sysrc_set keymap "swissgerman.cp850" || f_die
-		break ;;
-	swiss_german_iso)
-		f_sysrc_set keymap "swissgerman.iso" || f_die
-		break ;;
-	swiss_german_iso_accent)
-		f_sysrc_set keymap "swissgerman.iso.acc" || f_die
-		break ;;
-	uk_cp850)
-		f_sysrc_set keymap "uk.cp850" || f_die
-		break ;;
-	uk_iso)
-		f_sysrc_set keymap "uk.iso" || f_die
-		break ;;
-	ukrainian_koi8_u)
-		f_sysrc_set keymap "ua.koi8-u" || f_die
-		break ;;
-	ukrainian_koi8_u_koi8_r)
-		f_sysrc_set keymap "ua.koi8-u.shift.alt" || f_die
-		break ;;
-	usa_capslock_ctrl)
-		f_sysrc_set keymap "us.pc-ctrl" || f_die
-		break ;;
-	usa_dvorak)
-		f_sysrc_set keymap "us.dvorak" || f_die
-		break ;;
-	usa_dvorak_left)
-		f_sysrc_set keymap "us.dvorakl" || f_die
-		break ;;
-	usa_dvorak_right)
-		f_sysrc_set keymap "us.dvorakr" || f_die
-		break ;;
-	usa_emacs)
-		f_sysrc_set keymap "us.emacs" || f_die
-		break ;;
-	usa_iso)
-		f_sysrc_set keymap "us.iso" || f_die
-		break ;;
-	usa_unix)
-		f_sysrc_set keymap "us.unix" || f_die
-		break ;;
+	belgian)                 keymap_to_set="be.iso"                ;;
+	brazil_cp850)            keymap_to_set="br275.cp850"           ;;
+	brazil_iso)              keymap_to_set="br275.iso"             ;;
+	brazil_iso_accent)       keymap_to_set="br275.iso.acc"         ;;
+	bulgarian_bds)           keymap_to_set="bg.bds.ctrlcaps"       ;;
+	bulgarian_phonetic)      keymap_to_set="bg.phonetic.ctrlcaps"  ;;
+	central_european_iso)    keymap_to_set="ce.iso2"               ;;
+	croatian_iso)            keymap_to_set="hr.iso"                ;;
+	czech_iso_accent)        keymap_to_set="cs.latin2.qwertz"      ;;
+	danish_cp865)            keymap_to_set="danish.cp865"          ;;
+	danish_iso)              keymap_to_set="danish.iso"            ;;
+	estonian_cp850)          keymap_to_set="estonian.cp850"        ;;
+	estonian_iso)            keymap_to_set="estonian.iso"          ;;
+	estonian_iso_15)         keymap_to_set="estonian.iso15"        ;;
+	finnish_cp850)           keymap_to_set="finnish.cp850"         ;;
+	finnish_iso)             keymap_to_set="finnish.iso"           ;;
+	french_iso)              keymap_to_set="fr.iso"                ;;
+	french_iso_accent)       keymap_to_set="fr.iso.acc"            ;;
+	french_iso_macbook)      keymap_to_set="fr.macbook.acc"        ;;
+	german_cp850)            keymap_to_set="german.cp850"          ;;
+	german_iso)              keymap_to_set="german.iso"            ;;
+	greek_101)               keymap_to_set="gr.us101.acc"          ;;
+	greek_104)               keymap_to_set="el.iso07"              ;;
+	greek_elot)              keymap_to_set="gr.elot.acc"           ;;
+	hungarian_101)           keymap_to_set="hu.iso2.101keys"       ;;
+	hungarian_102)           keymap_to_set="hu.iso2.102keys"       ;;
+	icelandic)               keymap_to_set="icelandic.iso"         ;;
+	icelandic_accent)        keymap_to_set="icelandic.iso.acc"     ;;
+	italian)                 keymap_to_set="it.iso"                ;;
+	japanese_106)            keymap_to_set="jp.106"                ;;
+	latin_american)          keymap_to_set="latinamerican"         ;;
+	latin_american_accent)   keymap_to_set="latinamerican.iso.acc" ;;
+	norway_iso)              keymap_to_set="norwegian.iso"         ;;
+	polish_iso)              keymap_to_set="pl_PL.ISO8859-2"       ;;
+	portuguese)              keymap_to_set="pt.iso"                ;;
+	portuguese_accent)       keymap_to_set="pt.iso.acc"            ;;
+	russia_koi8_r)           keymap_to_set="ru.koi8-r"             ;;
+	slovak)                  keymap_to_set="sk.iso2"               ;;
+	slovenian)               keymap_to_set="si.iso"                ;;
+	spanish)                 keymap_to_set="spanish.iso"           ;;
+	spanish_accent)          keymap_to_set="spanish.iso.acc"       ;;
+	swedish_cp850)           keymap_to_set="swedish.cp850"         ;;
+	swedish_iso)             keymap_to_set="swedish.iso"           ;;
+	swiss_french_cp850)      keymap_to_set="swissfrench.cp850"     ;;
+	swiss_french_iso)        keymap_to_set="swissfrench.iso"       ;;
+	swiss_french_iso_accent) keymap_to_set="swissfrench.iso.acc"   ;;
+	swiss_german_cp850)      keymap_to_set="swissgerman.cp850"     ;;
+	swiss_german_iso)        keymap_to_set="swissgerman.iso"       ;;
+	swiss_german_iso_accent) keymap_to_set="swissgerman.iso.acc"   ;;
+	uk_cp850)                keymap_to_set="uk.cp850"              ;;
+	uk_iso)                  keymap_to_set="uk.iso"                ;;
+	ukrainian_koi8_u)        keymap_to_set="ua.koi8-u"             ;;
+	ukrainian_koi8_u_koi8_r) keymap_to_set="ua.koi8-u.shift.alt"   ;;
+	usa_capslock_ctrl)       keymap_to_set="us.pc-ctrl"            ;;
+	usa_dvorak)              keymap_to_set="us.dvorak"             ;;
+	usa_dvorak_left)         keymap_to_set="us.dvorakl"            ;;
+	usa_dvorak_right)        keymap_to_set="us.dvorakr"            ;;
+	usa_emacs)               keymap_to_set="us.emacs"              ;;
+	usa_iso)                 keymap_to_set="us.iso"                ;;
+	usa_unix)                keymap_to_set="us.unix"               ;;
 	esac
+
+	if [ "$keymap_to_set" ]; then
+		f_sysrc_set keymap "$keymap_to_set" || f_die
+		break
+	else
+		f_die "$msg_unknown_keymap"
+	fi
 done
 
 exit $SUCCESS

Modified: head/usr.sbin/bsdconfig/console/repeat
==============================================================================
--- head/usr.sbin/bsdconfig/console/repeat	Tue Jun 18 07:33:45 2013	(r251904)
+++ head/usr.sbin/bsdconfig/console/repeat	Tue Jun 18 07:36:09 2013	(r251905)
@@ -117,25 +117,23 @@ f_mustberoot_init
 #
 # Launch application main menu
 #
-while :; do
-	dialog_menu_main || f_die
-	f_dialog_menutag_fetch mtag
+dialog_menu_main || f_die
+f_dialog_menutag_fetch mtag
 
-	case "$mtag" in
-	"$msg_slow") # Slow keyboard repeat rate
-		f_sysrc_set keyrate "slow" || f_die
-		break ;;
-	"$msg_normal") # "Normal" keyboard repeat rate
-		f_sysrc_set keyrate "normal" || f_die
-		break ;;
-	"$msg_fast") # Fast keyboard repeat rate
-		f_sysrc_set keyrate "fast" || f_die
-		break ;;
-	"$msg_default") # Use default keyboard repeat rate
-		f_sysrc_set keyrate "NO" || f_die
-		break ;;
-	esac
-done
+repeat_rate_to_set=
+case "$mtag" in
+"$msg_default") repeat_rate_to_set="NO"     ;; # Use default repeat rate
+"$msg_slow")    repeat_rate_to_set="slow"   ;; # Slow keyboard repeat rate
+"$msg_normal")  repeat_rate_to_set="normal" ;; # "Normal" keyboard repeat rate
+"$msg_fast")    repeat_rate_to_set="fast"   ;; # Fast keyboard repeat rate
+esac
+
+if [ "$repeat_rate_to_set" ]; then
+	f_sysrc_set keyrate "$repeat_rate_to_set" || f_die
+	break
+else
+	f_die "$msg_unknown_repeat_rate"
+fi
 
 exit $SUCCESS
 

Modified: head/usr.sbin/bsdconfig/console/saver
==============================================================================
--- head/usr.sbin/bsdconfig/console/saver	Tue Jun 18 07:33:45 2013	(r251904)
+++ head/usr.sbin/bsdconfig/console/saver	Tue Jun 18 07:36:09 2013	(r251905)
@@ -136,59 +136,55 @@ f_mustberoot_init
 #
 # Launch application main menu
 #
-while :; do
-	dialog_menu_main || f_die
-	f_dialog_menutag_fetch mtag
+dialog_menu_main || f_die
+f_dialog_menutag_fetch mtag
 
-	case "$mtag" in
-	"1 $msg_none") # Disable the screensaver
-		f_sysrc_set saver "NO" || f_die
-		break ;;
-	"2 $msg_blank") # Simply blank the screen
-		f_sysrc_set saver "blank" || f_die
-		break ;;
-	"3 $msg_beastie") # "BSD Daemon" animated screen saver (graphics)
-		f_sysrc_set saver "beastie" || f_die
-		break ;;
-	"4 $msg_daemon") # "BSD Daemon" animated screen saver (text)
-		f_sysrc_set saver "daemon" || f_die
-		break ;;
-	"5 $msg_dragon") # Dragon screensaver (graphics)
-		f_sysrc_set saver "dragon" || f_die
-		break ;;
-	"6 $msg_fade") # Fade out effect screen saver
-		f_sysrc_set saver "fade" || f_die
-		break ;;
-	"7 $msg_fire") # Flames effect screen saver
-		f_sysrc_set saver "fire" || f_die
-		break ;;
-	"8 $msg_green") # "Green" power saving mode (if supported by monitor)
-		f_sysrc_set saver "green" || f_die
-		break ;;
-	"9 $msg_logo") # FreeBSD "logo" animated screen saver (graphics)
-		f_sysrc_set saver "logo" || f_die
-		break ;;
-	"a $msg_rain") # Rain drops screen saver
-		f_sysrc_set saver "rain" || f_die
-		break ;;
-	"b $msg_snake") # Draw a FreeBSD "snake" on your screen
-		f_sysrc_set saver "snake" || f_die
-		break ;;
-	"c $msg_star") # A "twinkling stars" effect
-		f_sysrc_set saver "star" || f_die
-		break ;;
-	"d $msg_warp") # A "stars warping" effect
-		f_sysrc_set saver "warp" || f_die
-		break ;;
-	"$msg_timeout") # Set the screen saver timeout interval
-		f_dialog_title "$msg_value_required"
-		f_dialog_input blanktime "$msg_enter_timeout_period" \
-		               "$( f_sysrc_get blanktime )" &&
-			f_sysrc_set blanktime "$blanktime"
-		f_dialog_title_restore
-		;;
-	esac
-done
+case "$mtag" in
+"$msg_timeout") # Set the screen saver timeout interval
+	f_dialog_title "$msg_value_required"
+	f_dialog_input blanktime "$msg_enter_timeout_period" \
+	               "$( f_sysrc_get blanktime )" &&
+		f_sysrc_set blanktime "$blanktime" || f_die
+	f_dialog_title_restore
+	exit $SUCCESS
+esac
+
+saver_to_set=
+case "$mtag" in
+"1 $msg_none") # Disable the screensaver
+	saver_to_set="NO" ;;
+"2 $msg_blank") # Simply blank the screen
+	saver_to_set="blank" ;;
+"3 $msg_beastie") # "BSD Daemon" animated screen saver (graphics)
+	saver_to_set="beastie" ;;
+"4 $msg_daemon") # "BSD Daemon" animated screen saver (text)
+	saver_to_set="daemon" ;;
+"5 $msg_dragon") # Dragon screensaver (graphics)
+	saver_to_set="dragon" ;;
+"6 $msg_fade") # Fade out effect screen saver
+	saver_to_set="fade" ;;
+"7 $msg_fire") # Flames effect screen saver
+	saver_to_set="fire" ;;
+"8 $msg_green") # "Green" power saving mode (if supported by monitor)
+	saver_to_set="green" ;;
+"9 $msg_logo") # FreeBSD "logo" animated screen saver (graphics)
+	saver_to_set="logo" ;;
+"a $msg_rain") # Rain drops screen saver
+	saver_to_set="rain" ;;
+"b $msg_snake") # Draw a FreeBSD "snake" on your screen
+	saver_to_set="snake" ;;
+"c $msg_star") # A "twinkling stars" effect
+	saver_to_set="star" ;;
+"d $msg_warp") # A "stars warping" effect
+	saver_to_set="warp" ;;
+esac
+
+if [ "$saver_to_set" ]; then
+	f_sysrc_set saver "$saver_to_set" || f_die
+	break
+else
+	f_die "$msg_unknown_saver"
+fi
 
 exit $SUCCESS
 

Modified: head/usr.sbin/bsdconfig/console/screenmap
==============================================================================
--- head/usr.sbin/bsdconfig/console/screenmap	Tue Jun 18 07:33:45 2013	(r251904)
+++ head/usr.sbin/bsdconfig/console/screenmap	Tue Jun 18 07:36:09 2013	(r251905)
@@ -121,31 +121,31 @@ f_mustberoot_init
 #
 # Launch application main menu
 #
-while :; do
-	dialog_menu_main || f_die
-	f_dialog_menutag_fetch mtag
+dialog_menu_main || f_die
+f_dialog_menutag_fetch mtag
 
-	case "$mtag" in
-	"1 $msg_none") # No screenmap, don't touch font
-		f_sysrc_set scrnmap "NO" || f_die
-		break ;;
-	"2 $msg_iso_8859_1_to_ibm437") # W-Europe ISO 8859-1 to IBM 437 scrnmap
-		f_sysrc_set scrnmap "iso-8859-1_to_cp437" || f_die
-		break ;;
-	"3 $msg_iso_8859_7_to_ibm437") # Greek ISO 8859-7 to IBM 437 screenmap
-		f_sysrc_set scrnmap "iso-8859-7_to_cp437" || f_die
-		break ;;
-	"4 $msg_us_ascii_to_ibm327") # US-ASCII to IBM 437 screenmap
-		f_sysrc_set scrnmap "us-ascii_to_cp437" || f_die
-		break ;;
-	"5 $msg_koi8_r_to_ibm866") # Russian KOI8-R to IBM 866 screenmap
-		f_sysrc_set scrnmap "koi8-r2cp866" || f_die
-		break ;;
-	"6 $msg_koi8_u_to_ibm866u") # Ukrainian KOI8-U to IBM 866u screenmap
-		f_sysrc_set scrnmap "koi8-u2cp866u" || f_die
-		break ;;
-	esac
-done
+scrnmap_to_set=
+case "$mtag" in
+"1 $msg_none") # No screenmap, don't touch font
+	scrnmap_to_set="NO" ;;
+"2 $msg_iso_8859_1_to_ibm437") # W-Europe ISO 8859-1 to IBM 437 scrnmap
+	scrnmap_to_set="iso-8859-1_to_cp437" ;;
+"3 $msg_iso_8859_7_to_ibm437") # Greek ISO 8859-7 to IBM 437 screenmap
+	scrnmap_to_set="iso-8859-7_to_cp437" ;;
+"4 $msg_us_ascii_to_ibm327") # US-ASCII to IBM 437 screenmap
+	scrnmap_to_set="us-ascii_to_cp437" ;;
+"5 $msg_koi8_r_to_ibm866") # Russian KOI8-R to IBM 866 screenmap
+	scrnmap_to_set="koi8-r2cp866" ;;
+"6 $msg_koi8_u_to_ibm866u") # Ukrainian KOI8-U to IBM 866u screenmap
+	scrnmap_to_set="koi8-u2cp866u" ;;
+esac
+
+if [ "$scrnmap_to_set" ]; then
+	f_sysrc_set scrnmap "$scrnmap_to_set" || f_die
+	break
+else
+	f_die "$msg_unknown_screenmap_selection"
+fi
 
 exit $SUCCESS
 

Modified: head/usr.sbin/bsdconfig/console/ttys
==============================================================================
--- head/usr.sbin/bsdconfig/console/ttys	Tue Jun 18 07:33:45 2013	(r251904)
+++ head/usr.sbin/bsdconfig/console/ttys	Tue Jun 18 07:36:09 2013	(r251905)
@@ -189,15 +189,13 @@ f_mustberoot_init
 #
 # Launch application main menu
 #
-while :; do
-	dialog_menu_main || f_die
-	f_dialog_menutag_fetch mtag
+dialog_menu_main || f_die
+f_dialog_menutag_fetch mtag
 
-	[ "$mtag" = "1 $msg_none" ] && break
+[ "$mtag" = "1 $msg_none" ] && exit $SUCCESS
 
-	f_dialog_menuitem_fetch consterm
-	ttys_set_type "$consterm" && break
-done
+f_dialog_menuitem_fetch consterm
+ttys_set_type "$consterm" || f_die
 
 exit $SUCCESS
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306180736.r5I7a94J048160>