Author: emaste
Date: Sun Mar  8 18:13:40 2020
New Revision: 358757
URL: https://svnweb.freebsd.org/changeset/base/358757

Log:
  MFC r355614: kbdmap: allow INDEX.keymaps to provide the dialog title
  
  Previously kbdmap had a localized menu heading ("Choose your keyboard
  layout") but not the dialog title ("Keyboard Menu").
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/usr.sbin/kbdmap/kbdmap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/kbdmap/kbdmap.c
==============================================================================
--- stable/11/usr.sbin/kbdmap/kbdmap.c  Sun Mar  8 18:13:16 2020        
(r358756)
+++ stable/11/usr.sbin/kbdmap/kbdmap.c  Sun Mar  8 18:13:40 2020        
(r358757)
@@ -57,6 +57,7 @@ static const char *sysconfig = DEFAULT_SYSCONFIG;
 static const char *font_current;
 static const char *dir;
 static const char *menu = "";
+static const char *title = "Keyboard Menu";
 
 static int x11;
 static int using_vt;
@@ -361,8 +362,8 @@ show_dialog(struct keymap **km_sorted, int num_keymaps
                    tmp_name);
                exit(1);
        }
-       asprintf(&dialog, "/usr/bin/dialog --clear --title \"Keyboard Menu\" "
-                         "--menu \"%s\" 0 0 0", menu);
+       asprintf(&dialog, "/usr/bin/dialog --clear --title \"%s\" "
+                         "--menu \"%s\" 0 0 0", title, menu);
 
        /* start right font, assume that current font is equal
         * to default font in /etc/rc.conf
@@ -628,8 +629,9 @@ menu_read(void)
                        matches = sscanf(p, "%64[^:]:%64[^:]:%256[^:\n]", 
                            keym, lng, desc);
                        if (matches == 3) {
-                               if (strcmp(keym, "FONT")
-                                   && strcmp(keym, "MENU")) {
+                               if (strcmp(keym, "FONT") != 0 &&
+                                   strcmp(keym, "MENU") != 0 &&
+                                   strcmp(keym, "TITLE") != 0) {
                                        /* Check file exists & is readable */
                                        if (check_file(keym) == -1)
                                                continue;
@@ -706,6 +708,10 @@ menu_read(void)
                exit(0);
        }
 
+       km = get_keymap("TITLE");
+       if (km)
+               /* Take note of dialog title */
+               title = strdup(km->desc);
        km = get_keymap("MENU");
        if (km)
                /* Take note of menu title */
@@ -716,8 +722,9 @@ menu_read(void)
                font = strdup(km->desc);
 
        /* Remove unwanted items from list */
-       remove_keymap("MENU");
        remove_keymap("FONT");
+       remove_keymap("MENU");
+       remove_keymap("TITLE");
 
        /* Look for keymaps not in database */
        dirp = opendir(dir);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to