From 6f122a2794396f1777e3fe41bc98fda27e67ae44 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Mon, 17 Apr 2000 20:00:33 +0000 Subject: merge from anaconda-6-2j-branch --- loader/lang.c | 65 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 24 deletions(-) (limited to 'loader/lang.c') diff --git a/loader/lang.c b/loader/lang.c index 2f9752ea4..f516c1f77 100644 --- a/loader/lang.c +++ b/loader/lang.c @@ -70,7 +70,7 @@ char * translateString(char * str) { } struct langInfo { - char * lang, * key, * font, * map, * lc_all; + char * lang, * key, * font, * map, * lc_all, * keyboard; } ; static struct langInfo * languages = NULL; @@ -81,7 +81,8 @@ static void loadLanguageList(int flags) { "/etc/lang-table"; FILE * f; char line[256]; - char name[256], key[256], sun[256], console[256], code[256]; + char name[256], key[256], sun[256], console[256], code[256], + keyboard[256], timezone[256]; int lineNum = 0; f = fopen(file, "r"); @@ -94,8 +95,8 @@ static void loadLanguageList(int flags) { while (fgets(line, sizeof(line), f)) { lineNum++; languages = realloc(languages, sizeof(*languages) * (numLanguages + 1)); - if (sscanf(line, "%s %s %s %s %s\n", name, key, sun, console, - code) != 5) { + if (sscanf(line, "%s %s %s %s %s %s %s\n", name, key, sun, console, + code, keyboard, timezone) != 7) { logMessage("bad line %d in lang-table", lineNum); } else { languages[numLanguages].lang = strdup(name); @@ -103,6 +104,7 @@ static void loadLanguageList(int flags) { languages[numLanguages].font = strdup(sun); languages[numLanguages].map = strdup(console); languages[numLanguages].lc_all = strdup(code); + languages[numLanguages].keyboard = strdup(keyboard); numLanguages++; } } @@ -302,29 +304,34 @@ int chooseLanguage(char ** lang, int flags) { numStrings = allocedStrings = 0; } + { + extern int continuing; + extern void stopNewt(void); + + if (!strcmp (languages[choice].key, "ja") && !continuing) { + char * args[4]; + + stopNewt(); + + args[0] = "kon"; + args[1] = "-e"; + args[2] = FL_TESTING(flags) ? "./loader" : "/sbin/continue"; + args[3] = NULL; + + execv(FL_TESTING(flags) ? "./loader" : "/sbin/loader", args); + } + } + loadLanguage (NULL, flags); if (languages[choice].map) loadFont(languages[choice].map, flags); + newtDrawRootText(0, 0, _("Welcome to Red Hat Linux")); + newtPushHelpLine(_(" / between elements | selects | next screen ")); + return 0; } -struct defaultKeyboardByLang { - char * lang, * keyboard; -} defaultKeyboards[] = { - { "de", "de-latin1" }, - { "cs", "cz-lat2" }, - { "fi", "fi-latin1" }, - { "hu", "hu" }, - { "is", "is-latin1" }, - { "it", "it" }, - { "no", "no-latin1" }, - { "ru", "ru" }, - { "se", "se-latin1" }, - { "tr", "trq" }, - { "ja", "jp106" }, - { NULL, NULL } }; - #ifdef __sparc__ struct defaultKeyboardByLang defaultSunKeyboards[] = { @@ -406,6 +413,7 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) { int i; char * defkbd = keymap ? *keymap : NULL; struct defaultKeyboardByLang * kbdEntry; + char *lang; #ifdef __sparc__ #define KBDTYPE_SUN 0 @@ -452,17 +460,26 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) { } } #endif - - if (!defkbd && getenv("LANG")) { - kbdEntry = defaultKeyboards; + + if (!languages) loadLanguageList(flags); + + lang = getenv("LANG"); + if (!defkbd && lang) { + for (i = 0; i < numLanguages; i++) { + if (!strncmp(languages[i].key, lang, 2)) { + defkbd = languages[i].keyboard; + break; + } + } + #ifdef __sparc__ if (kbdtype == KBDTYPE_SUN) kbdEntry = defaultSunKeyboards; -#endif while (kbdEntry->lang && strcmp(kbdEntry->lang, getenv("LANG"))) kbdEntry++; if (kbdEntry->keyboard) defkbd = kbdEntry->keyboard; +#endif } if (!defkbd) #ifdef __sparc__ -- cgit