From 66a9e8fab73fbb74892bdba745e4dd31f508f5ab Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 13 Sep 2005 10:08:16 +0000 Subject: - keyboard::read() now returns false if the value is not recognised - new function keyboard::read_or_default() which always returns a valid value --- perl-install/Xconfig/default.pm | 2 +- perl-install/keyboard.pm | 3 ++- perl-install/standalone/keyboarddrake | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Xconfig/default.pm b/perl-install/Xconfig/default.pm index 3f9038299..d2fb0f783 100644 --- a/perl-install/Xconfig/default.pm +++ b/perl-install/Xconfig/default.pm @@ -13,7 +13,7 @@ use modules::any_conf; sub configure { my ($do_pkgs, $o_keyboard, $o_mouse) = @_; - my $keyboard = $o_keyboard || keyboard::read(); + my $keyboard = $o_keyboard || keyboard::read_or_default(); my $mouse = $o_mouse || do { my $mouse = mouse::read(); add2hash($mouse, mouse::detect(modules::any_conf->read)) if !$::noauto; diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index c8cf30e24..5aeb07900 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -626,8 +626,9 @@ sub read() { if (!$keyboard{KEYBOARD}) { add2hash(\%keyboard, grep { keyboard2kmap($_) eq $keyboard{KEYTABLE} } keyboards()); } - keyboard2text(\%keyboard) ? \%keyboard : {}; + keyboard2text(\%keyboard) && \%keyboard; } +sub read_or_default() { &read() || default() } sub check() { $^W = 0; diff --git a/perl-install/standalone/keyboarddrake b/perl-install/standalone/keyboarddrake index 04f65ffad..ef1e700aa 100755 --- a/perl-install/standalone/keyboarddrake +++ b/perl-install/standalone/keyboarddrake @@ -13,7 +13,7 @@ use c; require_root_capability(); my $in; -my $keyboard = keyboard::read() || keyboard::default(); +my $keyboard = keyboard::read_or_default(); if (my ($kb) = grep { !/^-/ } @ARGV) { keyboard::KEYBOARD2text($kb) or die "bad keyboard $kb\n"; $keyboard->{KEYBOARD} = $kb; -- cgit v1.2.1