Latest version of this package from Wolfram. Is now /etc/sysconfig aware,
handles default settings and has a prototype translation file for people wishing to add extra languages (please!). Submitted by: Wolfram Schneider <wosch@cs.tu-berlin.de>
This commit is contained in:
parent
13371b2c57
commit
21ef412144
78
usr.sbin/kbdmap/ChangeLog
Normal file
78
usr.sbin/kbdmap/ChangeLog
Normal file
@ -0,0 +1,78 @@
|
||||
Mon Apr 3 21:13:52 1995 Wolfram Schneider <w@campa>
|
||||
|
||||
* kbdmap.pl:
|
||||
the all singing and dancing algorithm for language matching
|
||||
support now states and fonts
|
||||
|
||||
* INDEX.keymaps, INDEX.fonts: *** empty log message ***
|
||||
|
||||
* Makefile: add INDEX.*
|
||||
|
||||
Sun Apr 2 15:31:23 1995 Wolfram Schneider <w@campa>
|
||||
|
||||
* kbdmap.pl: add comments
|
||||
|
||||
* INDEX.keymaps, INDEX.fonts: FONT en cp437
|
||||
|
||||
* kbdmap.pl: readd x11 test
|
||||
don't start always right font
|
||||
|
||||
Sat Apr 1 18:26:51 1995 Wolfram Schneider <w@campa>
|
||||
|
||||
* INDEX.keymaps: *** empty log message ***
|
||||
|
||||
* kbdmap.pl: spaces, perl -cw
|
||||
|
||||
* kbdmap.1, Languages.phrases: *** empty log message ***
|
||||
|
||||
* Languages.phrases: don't miss french
|
||||
|
||||
* INDEX.keymaps: add FONT
|
||||
|
||||
* INDEX.fonts: *** empty log message ***
|
||||
|
||||
* INDEX.fonts: add FONT
|
||||
|
||||
* kbdmap.1: replace kbdfont with vidfont
|
||||
add option -r
|
||||
|
||||
* kbdmap.pl: load always right font
|
||||
sort: 8x8 font is less than 8x14
|
||||
|
||||
* kbdmap.pl: langsupport for MENU and FONT
|
||||
read current font from /etc/sysconfig
|
||||
option -restore for loading default font from /etc/sysconfig
|
||||
|
||||
Mon Mar 27 20:59:31 1995 Wolfram Schneider <w@campa>
|
||||
|
||||
* kbdmap.pl: LC_CTYPE
|
||||
use only first two characters of language
|
||||
|
||||
* INDEX.keymaps, INDEX.fonts: add french
|
||||
|
||||
Sat Mar 25 23:57:11 1995 Wolfram Schneider <w@campa>
|
||||
|
||||
* INDEX.keymaps, INDEX.fonts, Makefile: *** empty log message ***
|
||||
|
||||
* Makefile: Initial revision
|
||||
|
||||
* kbdmap.1: *** empty log message ***
|
||||
|
||||
* Languages.phrases: Initial revision
|
||||
|
||||
* kbdmap.pl: comment die on X11 out
|
||||
strip ending '.pl' or '.perl', which confuse the program name
|
||||
sort languages for -show
|
||||
LANG=C is a synonym for 'en'
|
||||
|
||||
* kbdmap.1: *** empty log message ***
|
||||
|
||||
* kbdmap.1, INDEX.fonts, INDEX.keymaps: Initial revision
|
||||
|
||||
* kbdmap.pl: move menu title into database
|
||||
strip country and font from LANG
|
||||
Option -d for default langague/don't using LANG
|
||||
Option -s: show currently supported languages
|
||||
|
||||
* kbdmap.pl: Initial revision
|
||||
|
37
usr.sbin/kbdmap/Languages.phrases
Normal file
37
usr.sbin/kbdmap/Languages.phrases
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# Please use only iso-latin character set, which available
|
||||
# at console *and* X11 (IBM cp850 does not)
|
||||
#
|
||||
# missing: Norwegian, Russian, Danish, Swedish
|
||||
#
|
||||
|
||||
1. Chose your keyboard font
|
||||
|
||||
2. Codepage
|
||||
|
||||
3. English
|
||||
|
||||
4. thin
|
||||
|
||||
5. Multilingual Latin I
|
||||
|
||||
6. Norwegian
|
||||
|
||||
7. Russian
|
||||
|
||||
8. West European
|
||||
|
||||
9. Chose your keyboard language
|
||||
|
||||
10. Danish
|
||||
|
||||
11. French
|
||||
|
||||
12. German
|
||||
|
||||
13. Swedish
|
||||
|
||||
14. United Kingdom
|
||||
|
||||
15. United States of America
|
||||
|
5
usr.sbin/kbdmap/TODO
Normal file
5
usr.sbin/kbdmap/TODO
Normal file
@ -0,0 +1,5 @@
|
||||
o kbdmap.5 man page
|
||||
o remember some hackers to translate Languages.phrases into
|
||||
Norwegian, Russian, Danish, Swedish
|
||||
|
||||
95/04/03 Wolfram
|
133
usr.sbin/kbdmap/kbdmap.1
Normal file
133
usr.sbin/kbdmap/kbdmap.1
Normal file
@ -0,0 +1,133 @@
|
||||
.\"
|
||||
.\" Copyright (c) March 1995 Wolfram Schneider. All rights reserved.
|
||||
.\" Alle Rechte vorbehalten. Es gilt das kontinentaleuropäische Urheberrecht.
|
||||
.\"
|
||||
.\" 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 Wolfram Schneider
|
||||
.\" 4. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
||||
.\"
|
||||
|
||||
.\"
|
||||
.\" kbdmap/vidfont - front end for syscons
|
||||
.\"
|
||||
.\" E-Mail: Wolfram Schneider <wosch@cs.tu-berlin.de>
|
||||
.\"
|
||||
.\" $Id: kbdmap.1,v 1.5 1995/04/01 17:07:26 w Exp $
|
||||
.\"
|
||||
|
||||
.Dd Mar 25, 1995
|
||||
.Dt KBDMAP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm kbdmap ,
|
||||
.Nm vidfont
|
||||
.Nd front end for syscons
|
||||
|
||||
.Sh SYNOPSIS
|
||||
.Nm kbdmap
|
||||
.Op Fl d | Fl default
|
||||
.Op Fl h | Fl help
|
||||
.Op Fl l | Fl lang Ar language
|
||||
.Op Fl r | Fl restore
|
||||
.Op Fl s | Fl show
|
||||
.Op Fl v | Fl verbose
|
||||
|
||||
.Sh DESCRIPTION
|
||||
.Nm kbdmap
|
||||
allow easy setting of avaible keymaps.
|
||||
.Nm vidfont
|
||||
do it for fonts.
|
||||
Both looking in a database for a description. Description is
|
||||
in English (default) or any other language.
|
||||
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width Ds
|
||||
|
||||
.It Fl d , Fl default
|
||||
Use default language. Ignore $LANG.
|
||||
|
||||
.It Fl h , Fl help
|
||||
Print options and exit.
|
||||
|
||||
.It Fl l , Fl lang Ar language
|
||||
Use
|
||||
.Ar language
|
||||
for description and menu
|
||||
|
||||
.It Fl s , Fl show
|
||||
Show currently supported languages and exit.
|
||||
|
||||
.It Fl r , Fl restore
|
||||
Load default font from /etc/sysconfig
|
||||
|
||||
.It Fl v , Fl verbose
|
||||
More warnings.
|
||||
|
||||
.Sh ENVIROMENT
|
||||
.Bl -tag -width /etc/master.passwdxx -compact
|
||||
.Pa LANG
|
||||
Prefered language.
|
||||
|
||||
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/master.passwd -compact
|
||||
.Pa /usr/share/syscons/keymaps/INDEX.keymaps
|
||||
Database for keymaps.
|
||||
|
||||
.Pa /usr/share/syscons/fonts/INDEX.fonts
|
||||
Database for fonts.
|
||||
|
||||
.Pa /etc/sysconfig
|
||||
Default font.
|
||||
|
||||
|
||||
.Pa /usr/X11/lib/X11/locale/locale.alias
|
||||
Describe common LANG values.
|
||||
|
||||
.Sh BUGS
|
||||
.\" .Nm kbdmap/vidfont
|
||||
.\" does not know which font is in use. E.g. if the current font
|
||||
.\" is iso-8859-1 and you choise lang 'ru' (for russian)
|
||||
.\" you get funny latin1 characters and not russkij shrift.
|
||||
.\"
|
||||
.Nm vidcontrol
|
||||
and
|
||||
.Nm kbdcontrol
|
||||
work only on a (virtual) console an not with X11.
|
||||
|
||||
.Sh SEE ALSO
|
||||
.Xr kbdcontrol 1 ,
|
||||
.Xr vidcontrol 1 ,
|
||||
.Xr sysconfig 8 ,
|
||||
.Xr dialog 1 .
|
||||
|
||||
.Sh HISTORY
|
||||
.Nm kbdmap/vidfont
|
||||
command appeared in FreeBSD 2.1
|
||||
|
||||
.Sh AUTHOR
|
||||
Wolfram Schneider
|
||||
.Aq wosch@cs.tu-berlin.de ,
|
||||
Germany.
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (c) March 1995 Wolfram Schneider. All rights reserved.
|
||||
# Alle Rechte vorbehalten. Es gilt das kontinentaleuropäische Urheberrecht.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@ -30,63 +31,120 @@
|
||||
#
|
||||
|
||||
#
|
||||
# kbdmap/kbdfont - front end for syscons
|
||||
# kbdmap/vidfont - front end for syscons
|
||||
#
|
||||
# E-Mail: Wolfram Schneider <wosch@cs.tu-berlin.de>
|
||||
# E-Mail: Wolfram Schneider <wosch@cs.tu-berlin.de>
|
||||
#
|
||||
# $Id: kbdmap.pl,v 1.10 1995/04/03 21:13:52 w Exp $
|
||||
#
|
||||
|
||||
system("kbdcontrol -d >/dev/null");
|
||||
die "You are on a virtual console?\n" .
|
||||
"This program does not work with X11\n" if $?;
|
||||
# simple test if syscons works
|
||||
$x11 = system("kbdcontrol -d >/dev/null");
|
||||
if ($x11) {
|
||||
warn "You are not on a virtual console - " .
|
||||
"expect certain strange side-effects\n";
|
||||
sleep 2;
|
||||
}
|
||||
|
||||
#die "You are on a virtual console?\n" .
|
||||
# "This program does not work with X11\n" if $?;
|
||||
|
||||
|
||||
sub variables_static {
|
||||
$lang = $ENV{'LANG'}; # use standard enviroment variable $LANG
|
||||
$lang = "en" unless $lang;
|
||||
$lang_default = "en";
|
||||
$program = $0; $program =~ s|.*/||;
|
||||
$lang_default = "en"; # set default language
|
||||
$lang = $ENV{'LC_CTYPE'} || $ENV{'LANG'} || $lang_default;
|
||||
$lang = &lang($lang);
|
||||
$program = $0; $program =~ s|.*/||; $program =~ s/\.(pl|perl)$//;
|
||||
$keymapdir = "/usr/share/syscons/keymaps";
|
||||
$fontdir = "/usr/share/syscons/fonts";
|
||||
$index = "INDEX"; # Keyboard language database
|
||||
$verbose = 0;
|
||||
$sysconfig = "/etc/sysconfig";
|
||||
|
||||
# menu
|
||||
$menu_map{en} = "Choise your keyboard language";
|
||||
$menu_map{de} = "Wähle Deine Tastaturbelegung";
|
||||
$menu_font{en} = "Choise your keyboard font";
|
||||
$menu_font{de} = "Wähle Deine Schrift";
|
||||
#$keymapdir = "./syscons/keymaps";
|
||||
#$fontdir = "./syscons/fonts";
|
||||
#$sysconfig = "./sysconfig";
|
||||
|
||||
%keymap = '';
|
||||
}
|
||||
# read current font from sysconfig
|
||||
$font_default = "cp437-8x16.fnt";
|
||||
$font_current = &font_current($font_default);
|
||||
|
||||
sub variables_dynamic {
|
||||
if ($program eq "kbdmap") {
|
||||
$menu = $menu_map{$lang};
|
||||
if ($program eq "kbdmap") {
|
||||
$dir = $keymapdir;
|
||||
} else {
|
||||
$menu = $menu_font{$lang};
|
||||
$dir = $fontdir;
|
||||
}
|
||||
|
||||
$dialog = "/usr/bin/dialog \\
|
||||
--clear \\
|
||||
--title \"Keyboard Menu\" \\
|
||||
--menu \"$menu\" \\
|
||||
-1 -1 8";
|
||||
@langsupport = ('MENU', 'FONT'); # lang depended variables
|
||||
$show = 0; # show which languages currently supported
|
||||
$index = "INDEX"; # Keyboard language database
|
||||
$verbose = 0;
|
||||
%keymap = '';
|
||||
}
|
||||
|
||||
sub lang {
|
||||
local($lang) = @_;
|
||||
|
||||
#$lang =~ s/_.*//; # strip country and font
|
||||
$lang =~ s/^(C)$/en/; # aliases
|
||||
#$lang =~ s/^(..).*/$1/; # use only first to characters
|
||||
|
||||
return $lang;
|
||||
}
|
||||
|
||||
sub font_current {
|
||||
local($font) = @_;
|
||||
local($font_current);
|
||||
|
||||
open(F, "$sysconfig") || warn "$sysconfig: $!\n";
|
||||
|
||||
while(<F>) {
|
||||
/^#/ && next;
|
||||
if (/^\s*font[0-9]+x[0-9]+\s*=\s*(\S+)/) {
|
||||
$font_current = $1 if $1 ne "NO";
|
||||
}
|
||||
}
|
||||
close F;
|
||||
|
||||
return $font_current if $font_current;
|
||||
return $font;
|
||||
}
|
||||
|
||||
sub vidcontrol {
|
||||
local($font) = @_;
|
||||
|
||||
return $x11 if $x11; # syscons test failed
|
||||
|
||||
if ($font =~ /.*([0-9]+x[0-9]+)(\.fnt)?$/) {
|
||||
warn "vidcontrol -f $1 $font\n" if $verbose;
|
||||
return system("vidcontrol -f $1 $font");
|
||||
} else {
|
||||
warn "Which font size? ``$font''\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub menu_read {
|
||||
local($e,@a,$mark,$ext);
|
||||
local($keym, $lg, $desc);
|
||||
local($keym, $lg, $dialect, $desc);
|
||||
local(@langlist) = $lang_default;
|
||||
|
||||
$ext = $dir; $ext =~ s|.*/||;
|
||||
# en_US.ISO8859-1 -> en_..\.ISO8859-1
|
||||
($dialect = $lang) =~ s/^(..)_..(.+)$/$1_..$2/;
|
||||
# en_US.ISO8859-1 -> en
|
||||
($lang_abk = $lang) =~ s/^(..)_.*$/$1/;
|
||||
|
||||
$ext = $dir; $ext =~ s|.*/||;
|
||||
# read index database
|
||||
open(I, "$dir/$index.$ext") || warn "$dir/$index.$ext: $!\n";
|
||||
while(<I>) {
|
||||
chop;
|
||||
# skip blank lines and comments
|
||||
/^#/ && next;
|
||||
s/^\s+//;
|
||||
/^\w/ || next;
|
||||
s/\s+$//;
|
||||
|
||||
($keym, $lg, $desc) = split(/:/);
|
||||
if (! -r "$keym" && ! -r "$dir/$keym") {
|
||||
if (! -r "$keym" && ! -r "$dir/$keym" &&
|
||||
!grep(/$keym/, @langsupport)) {
|
||||
warn "$keym not found!\n" if $verbose;
|
||||
next;
|
||||
}
|
||||
@ -94,24 +152,64 @@ sub menu_read {
|
||||
# set empty language to default language
|
||||
$lg = $lang_default if $lg eq "";
|
||||
|
||||
# ----> 1) your choise if exist
|
||||
# --> 2) default language if exist and not 1)
|
||||
# -> 3) unknown language if 1) and 2) not exist
|
||||
if ($lg eq $lang) {
|
||||
# found your favorite language :-)
|
||||
# save language
|
||||
if ($show) {
|
||||
foreach $e (split(/,/, $lg)) {
|
||||
push(@langlist, $e) if !grep($_ eq $e, @langlist);
|
||||
}
|
||||
}
|
||||
|
||||
# 4) your choise if exist
|
||||
# 3) long match e.g. en_GB.ISO8859-1 is equal to en_..\.ISO8859-1
|
||||
# 2) short match 'de'
|
||||
# 1) default langlist 'en'
|
||||
# 0) any language
|
||||
#
|
||||
# language may be a kommalist
|
||||
# higher match overwrite lower
|
||||
# last entry overwrite previous if exist twice in database
|
||||
|
||||
# found your favorite language :-)
|
||||
if ($lg =~ /^(.+,)?$lang(,.+)?$/) {
|
||||
$keymap{$keym} = $desc;
|
||||
$mark{$keym} = 4;
|
||||
} elsif ($mark{$keym} <= 3 && $lg =~ /^(.+,)?$dialect(,.+)?$/) {
|
||||
# dialect
|
||||
$keymap{$keym} = $desc;
|
||||
} elsif (!$keymap{$keym}) {
|
||||
# found a language, but not your
|
||||
# set mark if unknown language
|
||||
$mark{$keym} = 1 if ($lg ne $lang_default);
|
||||
$mark{$keym} = 3;
|
||||
} elsif ($mark{$keym} <= 2 && $lg =~ /^(.+,)?$lang_abk(,.+)?$/) {
|
||||
# abrevation
|
||||
$keymap{$keym} = $desc;
|
||||
} elsif ($lg eq $lang_default && $mark{$keym}) {
|
||||
# overwrite unknown language with default language
|
||||
$mark{$keym} = 2;
|
||||
} elsif ($mark{$keym} <= 1 && $lg =~ /^(.+,)?$lang_default(,.+)?$/) {
|
||||
# default
|
||||
$keymap{$keym} = $desc;
|
||||
$mark{$keym} = 1;
|
||||
} elsif ($mark{$keym} <= 0) {
|
||||
# any
|
||||
$keymap{$keym} = $desc;
|
||||
$mark{$keym} = 0;
|
||||
}
|
||||
}
|
||||
close I;
|
||||
|
||||
if ($show) {
|
||||
@langlist = sort(@langlist);
|
||||
print "Currently supported languages: @langlist\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
# remove variables from list
|
||||
local($ee);
|
||||
foreach $e (@langsupport) {
|
||||
($ee = $e) =~ y/A-Z/a-z/;
|
||||
eval "\$$ee = \"$keymap{$e}\"";
|
||||
#warn "$e \$$ee = \"$keymap{$e}\"";
|
||||
delete $keymap{$e};
|
||||
}
|
||||
#warn "$font $font_default $font_current\n";
|
||||
|
||||
|
||||
# look for keymaps which are not in database
|
||||
opendir(D, "$dir") || warn "$dir: $!\n";
|
||||
foreach $e (readdir(D)) {
|
||||
@ -123,18 +221,42 @@ sub menu_read {
|
||||
}
|
||||
closedir D;
|
||||
|
||||
# sort menu
|
||||
# sort menu, font 8x8 is less than 8x14 and 8x16
|
||||
foreach $e (sort(keys %keymap)) {
|
||||
push(@a, "\"$keymap{$e}\" \"\"");
|
||||
}
|
||||
# side effects to @a
|
||||
grep(s/8x8/8x08/, @a);
|
||||
@a = sort @a;
|
||||
@a;
|
||||
grep(s/8x08/8x8/, @a);
|
||||
return @a;
|
||||
}
|
||||
|
||||
sub dialog {
|
||||
local(@argv) = @_;
|
||||
local($tmp) = "/tmp/_kbd_lang$$";
|
||||
|
||||
$dialog = "/usr/bin/dialog \\
|
||||
--clear \\
|
||||
--title \"Keyboard Menu\" \\
|
||||
--menu \"$menu\" \\
|
||||
-1 -1 10";
|
||||
|
||||
## *always* start right font, don't believe that your current font
|
||||
## is equal with default font in /etc/sysconfig
|
||||
## see also at end of this function
|
||||
## if ($font) {
|
||||
|
||||
# start right font, assume that current font is equal
|
||||
# to default font in /etc/sysconfig
|
||||
#
|
||||
# $font is the font which require the language $lang; e.g.
|
||||
# russian *need* a koi8 font
|
||||
# $font_current is the current font from /etc/sysconfig
|
||||
if ($font && $font ne $font_current) {
|
||||
&vidcontrol($font);
|
||||
}
|
||||
|
||||
# start dialog
|
||||
system("$dialog @argv 2> $tmp");
|
||||
|
||||
@ -143,11 +265,10 @@ sub dialog {
|
||||
foreach $e (keys %keymap) {
|
||||
if ($keymap{$e} eq $choise) {
|
||||
if ($program eq "kbdmap") {
|
||||
system("kbdcontrol -l $dir/$e\n");
|
||||
system("kbdcontrol -l $dir/$e\n") unless $x11;
|
||||
print "keymap=$e", "\n";
|
||||
} else {
|
||||
$f = $e; $f =~ s/\.fnt$//; $f =~ s/.*-//;
|
||||
system("vidcontrol -f $f $dir/$e\n");
|
||||
&vidcontrol("$dir/$e");
|
||||
$_ = $e;
|
||||
if (/^.*\-(.*)\.fnt/) {
|
||||
$font=$1
|
||||
@ -157,6 +278,10 @@ sub dialog {
|
||||
last;
|
||||
}
|
||||
}
|
||||
# } else {
|
||||
} elsif ($font && $font ne $font_current) {
|
||||
# cancel, restore old font
|
||||
&vidcontrol($font_current);
|
||||
}
|
||||
unlink $tmp;
|
||||
exit($?);
|
||||
@ -164,7 +289,8 @@ sub dialog {
|
||||
|
||||
sub usage {
|
||||
warn <<EOF;
|
||||
usage: $program [-v|-verbose] [-h|-help] [-l|-lang language]
|
||||
usage: $program\t[-v|-verbose] [-h|-help] [-l|-lang language]
|
||||
\t\t[-d|-default] [-s|-show] [-r|-restore]
|
||||
EOF
|
||||
exit 1;
|
||||
}
|
||||
@ -174,11 +300,14 @@ sub parse {
|
||||
local(@argv) = @_;
|
||||
|
||||
while($_ = $argv[0], /^-/) {
|
||||
shift @argv;
|
||||
last if /^--$/;
|
||||
if (/^--?(h|help|\?)$/) { &usage; }
|
||||
shift @argv;
|
||||
last if /^--$/;
|
||||
if (/^--?(h|help|\?)$/) { &usage; }
|
||||
elsif (/^--?(v|verbose)$/) { $verbose = 1; }
|
||||
elsif (/^--?(l|lang)$/) { $lang = $argv[0]; shift @argv; }
|
||||
elsif (/^--?(l|lang)$/) { $lang = &lang($argv[0]); shift @argv; }
|
||||
elsif (/^--?(d|default)$/) { $lang = $lang_default }
|
||||
elsif (/^--?(s|show)$/) { $show = 1 }
|
||||
elsif (/^--?(r|restore)$/) { &vidcontrol($font_current); exit(0) }
|
||||
else { &usage }
|
||||
}
|
||||
}
|
||||
@ -186,6 +315,4 @@ sub parse {
|
||||
# main
|
||||
&variables_static; # read variables
|
||||
&parse(@ARGV); # parse arguments
|
||||
&variables_dynamic; # read variable after parsing
|
||||
&dialog(&menu_read); # start dialog and kbdcontrol/vidcontrol
|
||||
|
||||
|
12
usr.sbin/kbdmap/strip_pl.pl
Normal file
12
usr.sbin/kbdmap/strip_pl.pl
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# makes perl scripts smaller, useful for boot floppies
|
||||
|
||||
while(<>) {
|
||||
s/(\s|^|;)#.*//; # comments
|
||||
s/\s+$//; # leading spaces
|
||||
s/^\s+//; # ending spaces
|
||||
s/\s+/ /g; # double spaces
|
||||
s/\s*([=\(\{\)\}])\s*/$1/g; # spaces around =(){}
|
||||
print "$_\n" if $_;
|
||||
}
|
Loading…
Reference in New Issue
Block a user