Sysinstall now offers the installation of a keymap early in the game!

Not all mappings are supported, most languages come only with one
encoding since this should be sufficient to get up & running in using
sysinstall, and we are already pretty tight on space.  (My previous
commit has already bumped the boot MFS size by another 50 KB for
this.)

This feature requires the `kbdcontrol -L' i've just committed.  Plain
text keymaps and the entire scanner are overkill for sysinstall.

Also updated the list of available keymaps while i was at it.

Reviewed by:	jkh
This commit is contained in:
Joerg Wunsch 1996-11-09 16:47:08 +00:00
parent 518c7f2a9a
commit 9b23ef93f3
15 changed files with 540 additions and 72 deletions

View File

@ -7,7 +7,7 @@ CLEANFILES+= makedevs.c rtermcap dumpnlist
SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installUpgrade.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
keymap.c label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
msg.c network.c nfs.c options.c package.c samba.c system.c \
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c \
uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c \
@ -51,7 +51,32 @@ makedevs.c: Makefile rtermcap
rtermcap: ${.CURDIR}/rtermcap.c
${CC} -o rtermcap ${.CURDIR}/rtermcap.c -ltermcap
KEYMAPS= be.iso br275.iso danish.iso fr.iso german.iso it.iso jp.106 \
norwegian.iso ru.koi8-r spanish.iso swedish.iso \
swissgerman.iso uk.iso us.dvorak us.iso
CLEANFILES+= rtermcap rtermcap.tmp makedevs.c
keymap.o: keymap.c keymap.h
keymap.h: Makefile
rm -f keymap.tmp
for map in ${KEYMAPS} ; do \
kbdcontrol -L $$map >> keymap.tmp ; \
done
echo "static struct keymapInfo keymapInfos[] = {" >> keymap.tmp
for map in ${KEYMAPS} ; do \
echo -n ' { "'$$map'", ' >> keymap.tmp ; \
echo "&keymap_$$map }," | tr '[-.]' '_' >> keymap.tmp ; \
done
( echo " { 0 }"; echo "};" ; echo "" ) >> keymap.tmp
mv keymap.tmp keymap.h
CLEANFILES+= keymap.tmp keymap.h
testftp: ftp.c
cc -o testftp -I../libdisk -DSTANDALONE_FTP ftp.c
CLEANFILES+= testftp
.include <bsd.prog.mk>

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.25 1996/08/03 10:10:52 jkh Exp $
* $Id: dmenu.c,v 1.26 1996/11/07 08:03:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -35,6 +35,7 @@
*/
#include "sysinstall.h"
#include <errno.h>
#include <sys/types.h>
#define MAX_MENU 15
@ -108,6 +109,25 @@ dmenuSetVariables(dialogMenuItem *tmp)
return DITEM_SUCCESS;
}
int
dmenuSetKmapVariable(dialogMenuItem *tmp)
{
char *lang;
int err;
variable_set((char *)tmp->data);
lang = variable_get("keymap");
if (lang != NULL)
{
err = loadKeymap(lang);
if (err == -1)
msgConfirm("No appropriate keyboard map found, sorry.");
else if (err == -2)
msgConfirm("Error installing keyboard map, errno = %d.", errno);
}
return DITEM_SUCCESS;
}
int
dmenuToggleVariable(dialogMenuItem *tmp)
{

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 1996 Joerg Wunsch
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
*
* $Id$
*
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <machine/console.h>
struct keymapInfo {
const char *name;
const struct keymap *map;
};
#include "keymap.h"
#include "sysinstall.h"
/*
* keymap.h is being automatically generated by the Makefile. It
* contains definitions for all desired keymaps. Note that since we
* don't support font loading nor screen mapping during installation,
* we simply don't care for any other keys than the ASCII subset.
*
* Therefore, if no keymap with the exact name has been found in the
* first pass, we make a second pass over the table looking just for
* the language name only.
*/
/*
* Return values:
*
* 0: OK
* -1: no appropriate keymap found
* -2: error installing map (other than ENXIO which means we're not on syscons)
*/
int
loadKeymap(const char *lang)
{
int passno, err;
char *llang;
size_t l;
struct keymapInfo *kip;
llang = strdup(lang);
if (llang == NULL)
abort();
for (passno = 0; passno < 2; passno++)
{
if (passno > 0)
{
/* make the match more fuzzy */
l = strspn(llang, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
llang[l] = '\0';
}
l = strlen(llang);
for (kip = keymapInfos; kip->name; kip++)
if (strncmp(kip->name, llang, l) == 0)
{
/* Yep, got it! */
err = ioctl(0, PIO_KEYMAP, kip->map);
free(llang);
return (err == -1 && errno != ENOTTY)? -2: 0;
}
}
free(llang);
return -1;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: menus.c,v 1.93 1996/11/07 08:03:25 jkh Exp $
* $Id: menus.c,v 1.94 1996/11/07 18:30:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -289,13 +289,14 @@ DMenu MenuInitial = {
{ "Exit Install", NULL, NULL, dmenuExit },
{ "1 Usage", "Quick start - How to use this menu system", NULL, dmenuDisplayFile, NULL, "usage" },
{ "2 Doc", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation },
{ "3 Options", "Go to the options editor", NULL, optionsEditor },
{ "4 Novice", "Begin a novice installation (for beginners)", NULL, installNovice },
{ "5 Express", "Begin a quick installation (for the impatient)", NULL, installExpress },
{ "6 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
{ "7 Fixit", "Go into repair mode with CDROM or floppy", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "8 Upgrade", "Upgrade an existing system", NULL, installUpgrade },
{ "9 Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
{ "3 Keymap", "Select a keyboard language.", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap },
{ "4 Options", "Go to the options editor", NULL, optionsEditor },
{ "5 Novice", "Begin a novice installation (for beginners)", NULL, installNovice },
{ "6 Express", "Begin a quick installation (for the impatient)", NULL, installExpress },
{ "7 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
{ "8 Fixit", "Go into repair mode with CDROM or floppy", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "9 Upgrade", "Upgrade an existing system", NULL, installUpgrade },
{ "c Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
{ "0 Index", "Glossary of functions.", NULL, dmenuSubmenu, NULL, &MenuIndex },
{ NULL } },
};
@ -1165,21 +1166,33 @@ DMenu MenuSysconsKeymap = {
"The default system console driver for FreeBSD (syscons) defaults\n\
to a standard \"American\" keyboard map. Users in other countries\n\
(or with different keyboard preferences) may wish to choose one of\n\
the other keymaps below.",
the other keymaps below.\n\
Note that sysinstall itself does only guarantee to use the part of\n\
the keyboard mapping that is required to generate the ANSI character\n\
subset, but the desired mapping will be remembered later.",
"Choose a keyboard map",
NULL,
{ { "Danish CP865", "Danish Code Page 865 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=danish.cp865" },
{ "Danish ISO", "Danish ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=danish.iso" },
{ "French ISO", "French ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=fr.iso" },
{ "German CP850", "German Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=german.cp850" },
{ "German ISO", "German ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=german.iso" },
{ "Italian", "Italian ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=it.iso" },
{ "Japanese 106", "Japanese 106 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=jp.106" },
{ "Swedish CP850", "Swedish Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=swedish.cp850" },
{ "Swedish ISO", "Swedish ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=swedish.iso" },
{ "U.K. CP850", "United Kingdom Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=uk.cp850" },
{ "U.K. ISO", "United Kingdom ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=uk.iso" },
{ "U.S. ISO", "United States ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=us.iso" },
{ { "Belgian", "Belgian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=be.iso" },
{ "Brazil CP850", "Brazil CP850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.cp850" },
{ "Brazil ISO", "Brazil ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.iso" },
{ "Danish CP865", "Danish Code Page 865 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.cp865" },
{ "Danish ISO", "Danish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.iso" },
{ "French ISO", "French ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=fr.iso" },
{ "German CP850", "German Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.cp850" },
{ "German ISO", "German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.iso" },
{ "Italian", "Italian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=it.iso" },
{ "Japanese 106", "Japanese 106 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=jp.106" },
{ "Norway ISO", "Norwegian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=norwegian.iso" },
{ "Russia CP866", "Russian CP866 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ru.cp866" },
{ "Russia KOI8-R", "Russian KOI8-R keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ru.koi8-r" },
{ "Spanish", "Spanish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=spanish.iso" },
{ "Swedish CP850", "Swedish Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.cp850" },
{ "Swedish ISO", "Swedish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.iso" },
{ "Swiss German", "Swiss German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissgerman.iso.kbd" },
{ "U.K. CP850", "United Kingdom Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.cp850" },
{ "U.K. ISO", "United Kingdom ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.iso" },
{ "U.S. Dvorak", "United States Dvorak keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.dvorak" },
{ "U.S. ISO", "United States ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.iso" },
{ NULL } },
};

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.84 1996/11/04 17:42:22 jkh Exp $
* $Id: sysinstall.h,v 1.85 1996/11/07 08:03:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -433,6 +433,7 @@ extern int dmenuSystemCommand(dialogMenuItem *tmp);
extern int dmenuSystemCommandBox(dialogMenuItem *tmp);
extern int dmenuExit(dialogMenuItem *tmp);
extern int dmenuSetVariable(dialogMenuItem *tmp);
extern int dmenuSetKmapVariable(dialogMenuItem *tmp);
extern int dmenuSetVariables(dialogMenuItem *tmp);
extern int dmenuToggleVariable(dialogMenuItem *tmp);
extern int dmenuSetFlag(dialogMenuItem *tmp);
@ -491,6 +492,8 @@ extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
extern Boolean copySelf(void);
/* keymap.c */
extern int loadKeymap(const char *lang);
/* label.c */
extern int diskLabelEditor(dialogMenuItem *self);

View File

@ -7,7 +7,7 @@ CLEANFILES+= makedevs.c rtermcap dumpnlist
SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installUpgrade.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
keymap.c label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
msg.c network.c nfs.c options.c package.c samba.c system.c \
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c \
uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c \
@ -51,7 +51,32 @@ makedevs.c: Makefile rtermcap
rtermcap: ${.CURDIR}/rtermcap.c
${CC} -o rtermcap ${.CURDIR}/rtermcap.c -ltermcap
KEYMAPS= be.iso br275.iso danish.iso fr.iso german.iso it.iso jp.106 \
norwegian.iso ru.koi8-r spanish.iso swedish.iso \
swissgerman.iso uk.iso us.dvorak us.iso
CLEANFILES+= rtermcap rtermcap.tmp makedevs.c
keymap.o: keymap.c keymap.h
keymap.h: Makefile
rm -f keymap.tmp
for map in ${KEYMAPS} ; do \
kbdcontrol -L $$map >> keymap.tmp ; \
done
echo "static struct keymapInfo keymapInfos[] = {" >> keymap.tmp
for map in ${KEYMAPS} ; do \
echo -n ' { "'$$map'", ' >> keymap.tmp ; \
echo "&keymap_$$map }," | tr '[-.]' '_' >> keymap.tmp ; \
done
( echo " { 0 }"; echo "};" ; echo "" ) >> keymap.tmp
mv keymap.tmp keymap.h
CLEANFILES+= keymap.tmp keymap.h
testftp: ftp.c
cc -o testftp -I../libdisk -DSTANDALONE_FTP ftp.c
CLEANFILES+= testftp
.include <bsd.prog.mk>

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.25 1996/08/03 10:10:52 jkh Exp $
* $Id: dmenu.c,v 1.26 1996/11/07 08:03:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -35,6 +35,7 @@
*/
#include "sysinstall.h"
#include <errno.h>
#include <sys/types.h>
#define MAX_MENU 15
@ -108,6 +109,25 @@ dmenuSetVariables(dialogMenuItem *tmp)
return DITEM_SUCCESS;
}
int
dmenuSetKmapVariable(dialogMenuItem *tmp)
{
char *lang;
int err;
variable_set((char *)tmp->data);
lang = variable_get("keymap");
if (lang != NULL)
{
err = loadKeymap(lang);
if (err == -1)
msgConfirm("No appropriate keyboard map found, sorry.");
else if (err == -2)
msgConfirm("Error installing keyboard map, errno = %d.", errno);
}
return DITEM_SUCCESS;
}
int
dmenuToggleVariable(dialogMenuItem *tmp)
{

95
usr.sbin/sade/keymap.c Normal file
View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 1996 Joerg Wunsch
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
*
* $Id$
*
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <machine/console.h>
struct keymapInfo {
const char *name;
const struct keymap *map;
};
#include "keymap.h"
#include "sysinstall.h"
/*
* keymap.h is being automatically generated by the Makefile. It
* contains definitions for all desired keymaps. Note that since we
* don't support font loading nor screen mapping during installation,
* we simply don't care for any other keys than the ASCII subset.
*
* Therefore, if no keymap with the exact name has been found in the
* first pass, we make a second pass over the table looking just for
* the language name only.
*/
/*
* Return values:
*
* 0: OK
* -1: no appropriate keymap found
* -2: error installing map (other than ENXIO which means we're not on syscons)
*/
int
loadKeymap(const char *lang)
{
int passno, err;
char *llang;
size_t l;
struct keymapInfo *kip;
llang = strdup(lang);
if (llang == NULL)
abort();
for (passno = 0; passno < 2; passno++)
{
if (passno > 0)
{
/* make the match more fuzzy */
l = strspn(llang, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
llang[l] = '\0';
}
l = strlen(llang);
for (kip = keymapInfos; kip->name; kip++)
if (strncmp(kip->name, llang, l) == 0)
{
/* Yep, got it! */
err = ioctl(0, PIO_KEYMAP, kip->map);
free(llang);
return (err == -1 && errno != ENOTTY)? -2: 0;
}
}
free(llang);
return -1;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: menus.c,v 1.93 1996/11/07 08:03:25 jkh Exp $
* $Id: menus.c,v 1.94 1996/11/07 18:30:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -289,13 +289,14 @@ DMenu MenuInitial = {
{ "Exit Install", NULL, NULL, dmenuExit },
{ "1 Usage", "Quick start - How to use this menu system", NULL, dmenuDisplayFile, NULL, "usage" },
{ "2 Doc", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation },
{ "3 Options", "Go to the options editor", NULL, optionsEditor },
{ "4 Novice", "Begin a novice installation (for beginners)", NULL, installNovice },
{ "5 Express", "Begin a quick installation (for the impatient)", NULL, installExpress },
{ "6 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
{ "7 Fixit", "Go into repair mode with CDROM or floppy", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "8 Upgrade", "Upgrade an existing system", NULL, installUpgrade },
{ "9 Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
{ "3 Keymap", "Select a keyboard language.", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap },
{ "4 Options", "Go to the options editor", NULL, optionsEditor },
{ "5 Novice", "Begin a novice installation (for beginners)", NULL, installNovice },
{ "6 Express", "Begin a quick installation (for the impatient)", NULL, installExpress },
{ "7 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
{ "8 Fixit", "Go into repair mode with CDROM or floppy", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "9 Upgrade", "Upgrade an existing system", NULL, installUpgrade },
{ "c Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
{ "0 Index", "Glossary of functions.", NULL, dmenuSubmenu, NULL, &MenuIndex },
{ NULL } },
};
@ -1165,21 +1166,33 @@ DMenu MenuSysconsKeymap = {
"The default system console driver for FreeBSD (syscons) defaults\n\
to a standard \"American\" keyboard map. Users in other countries\n\
(or with different keyboard preferences) may wish to choose one of\n\
the other keymaps below.",
the other keymaps below.\n\
Note that sysinstall itself does only guarantee to use the part of\n\
the keyboard mapping that is required to generate the ANSI character\n\
subset, but the desired mapping will be remembered later.",
"Choose a keyboard map",
NULL,
{ { "Danish CP865", "Danish Code Page 865 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=danish.cp865" },
{ "Danish ISO", "Danish ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=danish.iso" },
{ "French ISO", "French ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=fr.iso" },
{ "German CP850", "German Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=german.cp850" },
{ "German ISO", "German ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=german.iso" },
{ "Italian", "Italian ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=it.iso" },
{ "Japanese 106", "Japanese 106 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=jp.106" },
{ "Swedish CP850", "Swedish Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=swedish.cp850" },
{ "Swedish ISO", "Swedish ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=swedish.iso" },
{ "U.K. CP850", "United Kingdom Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=uk.cp850" },
{ "U.K. ISO", "United Kingdom ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=uk.iso" },
{ "U.S. ISO", "United States ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=us.iso" },
{ { "Belgian", "Belgian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=be.iso" },
{ "Brazil CP850", "Brazil CP850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.cp850" },
{ "Brazil ISO", "Brazil ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.iso" },
{ "Danish CP865", "Danish Code Page 865 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.cp865" },
{ "Danish ISO", "Danish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.iso" },
{ "French ISO", "French ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=fr.iso" },
{ "German CP850", "German Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.cp850" },
{ "German ISO", "German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.iso" },
{ "Italian", "Italian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=it.iso" },
{ "Japanese 106", "Japanese 106 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=jp.106" },
{ "Norway ISO", "Norwegian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=norwegian.iso" },
{ "Russia CP866", "Russian CP866 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ru.cp866" },
{ "Russia KOI8-R", "Russian KOI8-R keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ru.koi8-r" },
{ "Spanish", "Spanish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=spanish.iso" },
{ "Swedish CP850", "Swedish Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.cp850" },
{ "Swedish ISO", "Swedish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.iso" },
{ "Swiss German", "Swiss German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissgerman.iso.kbd" },
{ "U.K. CP850", "United Kingdom Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.cp850" },
{ "U.K. ISO", "United Kingdom ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.iso" },
{ "U.S. Dvorak", "United States Dvorak keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.dvorak" },
{ "U.S. ISO", "United States ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.iso" },
{ NULL } },
};

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.84 1996/11/04 17:42:22 jkh Exp $
* $Id: sysinstall.h,v 1.85 1996/11/07 08:03:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -433,6 +433,7 @@ extern int dmenuSystemCommand(dialogMenuItem *tmp);
extern int dmenuSystemCommandBox(dialogMenuItem *tmp);
extern int dmenuExit(dialogMenuItem *tmp);
extern int dmenuSetVariable(dialogMenuItem *tmp);
extern int dmenuSetKmapVariable(dialogMenuItem *tmp);
extern int dmenuSetVariables(dialogMenuItem *tmp);
extern int dmenuToggleVariable(dialogMenuItem *tmp);
extern int dmenuSetFlag(dialogMenuItem *tmp);
@ -491,6 +492,8 @@ extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
extern Boolean copySelf(void);
/* keymap.c */
extern int loadKeymap(const char *lang);
/* label.c */
extern int diskLabelEditor(dialogMenuItem *self);

View File

@ -7,7 +7,7 @@ CLEANFILES+= makedevs.c rtermcap dumpnlist
SRCS= anonFTP.c apache.c attr.c cdrom.c command.c config.c devices.c \
disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c ftp.c \
ftp_strat.c globals.c index.c install.c installUpgrade.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
keymap.c label.c lndir.c main.c makedevs.c media.c menus.c misc.c \
msg.c network.c nfs.c options.c package.c samba.c system.c \
tape.c tcpip.c termcap.c ufs.c variable.c wizard.c \
uc_eisa.c uc_isa.c uc_kmem.c uc_list.c uc_main.c uc_pci.c \
@ -51,7 +51,32 @@ makedevs.c: Makefile rtermcap
rtermcap: ${.CURDIR}/rtermcap.c
${CC} -o rtermcap ${.CURDIR}/rtermcap.c -ltermcap
KEYMAPS= be.iso br275.iso danish.iso fr.iso german.iso it.iso jp.106 \
norwegian.iso ru.koi8-r spanish.iso swedish.iso \
swissgerman.iso uk.iso us.dvorak us.iso
CLEANFILES+= rtermcap rtermcap.tmp makedevs.c
keymap.o: keymap.c keymap.h
keymap.h: Makefile
rm -f keymap.tmp
for map in ${KEYMAPS} ; do \
kbdcontrol -L $$map >> keymap.tmp ; \
done
echo "static struct keymapInfo keymapInfos[] = {" >> keymap.tmp
for map in ${KEYMAPS} ; do \
echo -n ' { "'$$map'", ' >> keymap.tmp ; \
echo "&keymap_$$map }," | tr '[-.]' '_' >> keymap.tmp ; \
done
( echo " { 0 }"; echo "};" ; echo "" ) >> keymap.tmp
mv keymap.tmp keymap.h
CLEANFILES+= keymap.tmp keymap.h
testftp: ftp.c
cc -o testftp -I../libdisk -DSTANDALONE_FTP ftp.c
CLEANFILES+= testftp
.include <bsd.prog.mk>

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated for what's essentially a complete rewrite.
*
* $Id: dmenu.c,v 1.25 1996/08/03 10:10:52 jkh Exp $
* $Id: dmenu.c,v 1.26 1996/11/07 08:03:21 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -35,6 +35,7 @@
*/
#include "sysinstall.h"
#include <errno.h>
#include <sys/types.h>
#define MAX_MENU 15
@ -108,6 +109,25 @@ dmenuSetVariables(dialogMenuItem *tmp)
return DITEM_SUCCESS;
}
int
dmenuSetKmapVariable(dialogMenuItem *tmp)
{
char *lang;
int err;
variable_set((char *)tmp->data);
lang = variable_get("keymap");
if (lang != NULL)
{
err = loadKeymap(lang);
if (err == -1)
msgConfirm("No appropriate keyboard map found, sorry.");
else if (err == -2)
msgConfirm("Error installing keyboard map, errno = %d.", errno);
}
return DITEM_SUCCESS;
}
int
dmenuToggleVariable(dialogMenuItem *tmp)
{

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 1996 Joerg Wunsch
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
*
* $Id$
*
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <machine/console.h>
struct keymapInfo {
const char *name;
const struct keymap *map;
};
#include "keymap.h"
#include "sysinstall.h"
/*
* keymap.h is being automatically generated by the Makefile. It
* contains definitions for all desired keymaps. Note that since we
* don't support font loading nor screen mapping during installation,
* we simply don't care for any other keys than the ASCII subset.
*
* Therefore, if no keymap with the exact name has been found in the
* first pass, we make a second pass over the table looking just for
* the language name only.
*/
/*
* Return values:
*
* 0: OK
* -1: no appropriate keymap found
* -2: error installing map (other than ENXIO which means we're not on syscons)
*/
int
loadKeymap(const char *lang)
{
int passno, err;
char *llang;
size_t l;
struct keymapInfo *kip;
llang = strdup(lang);
if (llang == NULL)
abort();
for (passno = 0; passno < 2; passno++)
{
if (passno > 0)
{
/* make the match more fuzzy */
l = strspn(llang, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
llang[l] = '\0';
}
l = strlen(llang);
for (kip = keymapInfos; kip->name; kip++)
if (strncmp(kip->name, llang, l) == 0)
{
/* Yep, got it! */
err = ioctl(0, PIO_KEYMAP, kip->map);
free(llang);
return (err == -1 && errno != ENOTTY)? -2: 0;
}
}
free(llang);
return -1;
}

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: menus.c,v 1.93 1996/11/07 08:03:25 jkh Exp $
* $Id: menus.c,v 1.94 1996/11/07 18:30:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -289,13 +289,14 @@ DMenu MenuInitial = {
{ "Exit Install", NULL, NULL, dmenuExit },
{ "1 Usage", "Quick start - How to use this menu system", NULL, dmenuDisplayFile, NULL, "usage" },
{ "2 Doc", "Installation instructions, README, etc.", NULL, dmenuSubmenu, NULL, &MenuDocumentation },
{ "3 Options", "Go to the options editor", NULL, optionsEditor },
{ "4 Novice", "Begin a novice installation (for beginners)", NULL, installNovice },
{ "5 Express", "Begin a quick installation (for the impatient)", NULL, installExpress },
{ "6 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
{ "7 Fixit", "Go into repair mode with CDROM or floppy", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "8 Upgrade", "Upgrade an existing system", NULL, installUpgrade },
{ "9 Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
{ "3 Keymap", "Select a keyboard language.", NULL, dmenuSubmenu, NULL, &MenuSysconsKeymap },
{ "4 Options", "Go to the options editor", NULL, optionsEditor },
{ "5 Novice", "Begin a novice installation (for beginners)", NULL, installNovice },
{ "6 Express", "Begin a quick installation (for the impatient)", NULL, installExpress },
{ "7 Custom", "Begin a custom installation (for experts)", NULL, dmenuSubmenu, NULL, &MenuInstallCustom },
{ "8 Fixit", "Go into repair mode with CDROM or floppy", NULL, dmenuSubmenu, NULL, &MenuFixit },
{ "9 Upgrade", "Upgrade an existing system", NULL, installUpgrade },
{ "c Configure", "Do post-install configuration of FreeBSD", NULL, dmenuSubmenu, NULL, &MenuConfigure },
{ "0 Index", "Glossary of functions.", NULL, dmenuSubmenu, NULL, &MenuIndex },
{ NULL } },
};
@ -1165,21 +1166,33 @@ DMenu MenuSysconsKeymap = {
"The default system console driver for FreeBSD (syscons) defaults\n\
to a standard \"American\" keyboard map. Users in other countries\n\
(or with different keyboard preferences) may wish to choose one of\n\
the other keymaps below.",
the other keymaps below.\n\
Note that sysinstall itself does only guarantee to use the part of\n\
the keyboard mapping that is required to generate the ANSI character\n\
subset, but the desired mapping will be remembered later.",
"Choose a keyboard map",
NULL,
{ { "Danish CP865", "Danish Code Page 865 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=danish.cp865" },
{ "Danish ISO", "Danish ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=danish.iso" },
{ "French ISO", "French ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=fr.iso" },
{ "German CP850", "German Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=german.cp850" },
{ "German ISO", "German ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=german.iso" },
{ "Italian", "Italian ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=it.iso" },
{ "Japanese 106", "Japanese 106 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=jp.106" },
{ "Swedish CP850", "Swedish Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=swedish.cp850" },
{ "Swedish ISO", "Swedish ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=swedish.iso" },
{ "U.K. CP850", "United Kingdom Code Page 850 keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=uk.cp850" },
{ "U.K. ISO", "United Kingdom ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=uk.iso" },
{ "U.S. ISO", "United States ISO keymap", dmenuVarCheck, dmenuSetVariable, NULL, "keymap=us.iso" },
{ { "Belgian", "Belgian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=be.iso" },
{ "Brazil CP850", "Brazil CP850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.cp850" },
{ "Brazil ISO", "Brazil ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=br275.iso" },
{ "Danish CP865", "Danish Code Page 865 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.cp865" },
{ "Danish ISO", "Danish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=danish.iso" },
{ "French ISO", "French ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=fr.iso" },
{ "German CP850", "German Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.cp850" },
{ "German ISO", "German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=german.iso" },
{ "Italian", "Italian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=it.iso" },
{ "Japanese 106", "Japanese 106 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=jp.106" },
{ "Norway ISO", "Norwegian ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=norwegian.iso" },
{ "Russia CP866", "Russian CP866 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ru.cp866" },
{ "Russia KOI8-R", "Russian KOI8-R keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=ru.koi8-r" },
{ "Spanish", "Spanish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=spanish.iso" },
{ "Swedish CP850", "Swedish Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.cp850" },
{ "Swedish ISO", "Swedish ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swedish.iso" },
{ "Swiss German", "Swiss German ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=swissgerman.iso.kbd" },
{ "U.K. CP850", "United Kingdom Code Page 850 keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.cp850" },
{ "U.K. ISO", "United Kingdom ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=uk.iso" },
{ "U.S. Dvorak", "United States Dvorak keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.dvorak" },
{ "U.S. ISO", "United States ISO keymap", dmenuVarCheck, dmenuSetKmapVariable, NULL, "keymap=us.iso" },
{ NULL } },
};

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.84 1996/11/04 17:42:22 jkh Exp $
* $Id: sysinstall.h,v 1.85 1996/11/07 08:03:28 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -433,6 +433,7 @@ extern int dmenuSystemCommand(dialogMenuItem *tmp);
extern int dmenuSystemCommandBox(dialogMenuItem *tmp);
extern int dmenuExit(dialogMenuItem *tmp);
extern int dmenuSetVariable(dialogMenuItem *tmp);
extern int dmenuSetKmapVariable(dialogMenuItem *tmp);
extern int dmenuSetVariables(dialogMenuItem *tmp);
extern int dmenuToggleVariable(dialogMenuItem *tmp);
extern int dmenuSetFlag(dialogMenuItem *tmp);
@ -491,6 +492,8 @@ extern int installFilesystems(dialogMenuItem *self);
extern int installVarDefaults(dialogMenuItem *self);
extern Boolean copySelf(void);
/* keymap.c */
extern int loadKeymap(const char *lang);
/* label.c */
extern int diskLabelEditor(dialogMenuItem *self);