"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.6.1/src/keymap.c" (22 Dec 2021, 105124 Bytes) of package /linux/misc/tin-2.6.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "keymap.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.6.0_vs_2.6.1.

    1 /*
    2  *  Project   : tin - a Usenet reader
    3  *  Module    : keymap.c
    4  *  Author    : D. Nimmich, J. Faultless
    5  *  Created   : 2000-05-25
    6  *  Updated   : 2021-02-23
    7  *  Notes     : This file contains key mapping routines and variables.
    8  *
    9  * Copyright (c) 2000-2022 Dirk Nimmich <nimmich@muenster.de>
   10  * All rights reserved.
   11  *
   12  * Redistribution and use in source and binary forms, with or without
   13  * modification, are permitted provided that the following conditions
   14  * are met:
   15  *
   16  * 1. Redistributions of source code must retain the above copyright notice,
   17  *    this list of conditions and the following disclaimer.
   18  *
   19  * 2. Redistributions in binary form must reproduce the above copyright
   20  *    notice, this list of conditions and the following disclaimer in the
   21  *    documentation and/or other materials provided with the distribution.
   22  *
   23  * 3. Neither the name of the copyright holder nor the names of its
   24  *    contributors may be used to endorse or promote products derived from
   25  *    this software without specific prior written permission.
   26  *
   27  * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 #ifndef TIN_H
   41 #   include "tin.h"
   42 #endif /* !TIN_H */
   43 #ifndef VERSION_H
   44 #   include "version.h"
   45 #endif /* !VERSION_H */
   46 
   47 /*
   48  * local prototypes
   49  */
   50 static void add_default_key(struct keylist *key_list, const char *keys, t_function func);
   51 static void add_global_keys(struct keylist *keys);
   52 static void free_keylist(struct keylist *keys);
   53 static void upgrade_keymap_file(char *old);
   54 static t_bool process_keys(t_function func, const char *keys, struct keylist *kl);
   55 static t_bool process_mapping(char *keyname, char *keys);
   56 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
   57     static t_bool add_key(struct keylist *keys, const wchar_t key, t_function func, t_bool override);
   58 #else
   59     static t_bool add_key(struct keylist *keys, const char key, t_function func, t_bool override);
   60 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
   61 
   62 struct keylist attachment_keys = { NULL, 0, 0};
   63 struct keylist feed_post_process_keys = { NULL, 0, 0 };
   64 struct keylist feed_supersede_article_keys = { NULL, 0, 0 };
   65 struct keylist feed_type_keys = { NULL, 0, 0 };
   66 struct keylist filter_keys = { NULL, 0, 0 };
   67 struct keylist group_keys = { NULL, 0, 0 };
   68 struct keylist info_keys = { NULL, 0, 0 };
   69 struct keylist option_menu_keys = { NULL, 0, 0 };
   70 struct keylist page_keys = { NULL, 0, 0 };
   71 #ifdef HAVE_PGP_GPG
   72     struct keylist pgp_mail_keys = { NULL, 0, 0 };
   73     struct keylist pgp_news_keys = { NULL, 0, 0 };
   74 #endif /* HAVE_PGP_GPG */
   75 struct keylist post_cancel_keys = { NULL, 0, 0 };
   76 struct keylist post_continue_keys = { NULL, 0, 0 };
   77 struct keylist post_delete_keys = { NULL, 0, 0 };
   78 struct keylist post_edit_keys = { NULL, 0, 0 };
   79 struct keylist post_edit_ext_keys = { NULL, 0, 0 };
   80 struct keylist post_ignore_fupto_keys = { NULL, 0, 0 };
   81 struct keylist post_mail_fup_keys = { NULL, 0, 0 };
   82 struct keylist post_hist_keys = { NULL, 0, 0 };
   83 struct keylist post_post_keys = { NULL, 0, 0 };
   84 struct keylist post_postpone_keys = { NULL, 0, 0 };
   85 struct keylist post_send_keys = { NULL, 0, 0 };
   86 struct keylist prompt_keys = { NULL, 0, 0 };
   87 struct keylist save_append_overwrite_keys = { NULL, 0, 0 };
   88 struct keylist scope_keys = { NULL, 0, 0 };
   89 struct keylist select_keys = { NULL, 0, 0 };
   90 struct keylist thread_keys = { NULL, 0, 0 };
   91 struct keylist url_keys = { NULL, 0, 0 };
   92 
   93 
   94 /*
   95  * lookup the associated function to the specified key
   96  */
   97 t_function
   98 key_to_func(
   99 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  100     const wchar_t key,
  101 #else
  102     const char key,
  103 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  104     const struct keylist keys)
  105 {
  106     size_t i;
  107 
  108     for (i = 0; i < keys.used; i++) {
  109         if (keys.list[i].key == key)
  110             return keys.list[i].function;
  111     }
  112 
  113     return NOT_ASSIGNED;
  114 }
  115 
  116 
  117 /*
  118  * lookup the associated key to the specified function
  119  */
  120 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  121 wchar_t
  122 #else
  123 char
  124 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  125 func_to_key(
  126     t_function func,
  127     const struct keylist keys)
  128 {
  129     size_t i;
  130 
  131     for (i = 0; i < keys.used; i++) {
  132         if (keys.list[i].function == func)
  133             return keys.list[i].key;
  134     }
  135 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  136     return (wchar_t) '?';
  137 #else
  138     return '?';
  139 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  140 }
  141 
  142 
  143 /*
  144  * adds a key to a keylist
  145  * default_key: TRUE if a default key should be added
  146  * returns TRUE if the key was successfully added else FALSE
  147  */
  148 static t_bool
  149 add_key(
  150     struct keylist *keys,
  151 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  152     const wchar_t key,
  153 #else
  154     const char key,
  155 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  156     t_function func,
  157     t_bool override)
  158 {
  159     size_t i;
  160     struct keynode *entry = NULL;
  161 
  162     /* is a function already associated with this key */
  163     for (i = 0; key != '\0' && i < keys->used; i++) {
  164         if (keys->list[i].key == key)
  165             entry = &keys->list[i];
  166     }
  167 
  168     if (entry != NULL) {
  169         if (override) {
  170             entry->function = func;
  171             return TRUE;
  172         } else
  173             return FALSE;
  174     } else {
  175         /* add a new entry */
  176         if (keys->used >= keys->max) {
  177             if (keys->list == NULL) {
  178                 keys->max = DEFAULT_MAPKEYS_NUM;
  179                 keys->list = my_malloc(keys->max * sizeof(struct keynode));
  180             } else {
  181                 keys->max++;
  182                 keys->list = my_realloc(keys->list, keys->max * sizeof(struct keynode));
  183             }
  184         }
  185         keys->list[keys->used].key = key;
  186         keys->list[keys->used].function = func;
  187         keys->used++;
  188 
  189         return TRUE;
  190     }
  191 }
  192 
  193 
  194 /*
  195  * FIXME:
  196  * as long as we use only ASCII for default keys no need to change 'keys' to wchar_t
  197  */
  198 static void
  199 add_default_key(
  200     struct keylist *key_list,
  201     const char *keys,
  202     t_function func)
  203 {
  204     const char *key = keys;
  205     /* check if the function has already a key assigned before we add the default one */
  206     if (func_to_key(func, *key_list) != '?')
  207         return;
  208 
  209     for (; *key != '\0'; key++)
  210 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  211         add_key(key_list, (wchar_t) *key, func, FALSE);
  212 #else
  213         add_key(key_list, *key, func, FALSE);
  214 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  215 }
  216 
  217 
  218 static void
  219 free_keylist(
  220     struct keylist *keys)
  221 {
  222     FreeAndNull(keys->list);
  223     keys->used = keys->max = 0;
  224 }
  225 
  226 
  227 /*
  228  * Free all memory for keymaps.
  229  */
  230 void
  231 free_keymaps(
  232     void)
  233 {
  234     free_keylist(&attachment_keys);
  235     free_keylist(&select_keys);
  236     free_keylist(&group_keys);
  237     free_keylist(&thread_keys);
  238     free_keylist(&option_menu_keys);
  239     free_keylist(&page_keys);
  240     free_keylist(&info_keys);
  241     free_keylist(&post_hist_keys);
  242     free_keylist(&post_send_keys);
  243     free_keylist(&post_edit_keys);
  244     free_keylist(&post_edit_ext_keys);
  245     free_keylist(&post_post_keys);
  246     free_keylist(&post_postpone_keys);
  247     free_keylist(&post_mail_fup_keys);
  248     free_keylist(&post_ignore_fupto_keys);
  249     free_keylist(&post_continue_keys);
  250     free_keylist(&post_delete_keys);
  251     free_keylist(&post_cancel_keys);
  252     free_keylist(&filter_keys);
  253 #ifdef HAVE_PGP_GPG
  254     free_keylist(&pgp_mail_keys);
  255     free_keylist(&pgp_news_keys);
  256 #endif /* HAVE_PGP_GPG */
  257     free_keylist(&save_append_overwrite_keys);
  258     free_keylist(&scope_keys);
  259     free_keylist(&feed_type_keys);
  260     free_keylist(&feed_post_process_keys);
  261     free_keylist(&feed_supersede_article_keys);
  262     free_keylist(&prompt_keys);
  263     free_keylist(&url_keys);
  264 }
  265 
  266 
  267 /*
  268  * Render ch in human readable ASCII
  269  * Is there no lib function to do this ?
  270  * *buf must have a size of at least MAXKEYLEN
  271  */
  272 char *
  273 printascii(
  274     char *buf,
  275 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  276     wint_t ch)
  277 #else
  278     int ch)
  279 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  280 {
  281     if (ch == 0)
  282         snprintf(buf, MAXKEYLEN, "%s", _("NULL"));
  283 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  284     else if (iswgraph(ch)) {    /* Regular printables */
  285         int i = wctomb(buf, (wchar_t) ch);
  286 
  287         if (i > 0)
  288             buf[i] = '\0';
  289         else
  290             buf[0] = '\0';
  291     }
  292 #else
  293     else if (isgraph(ch)) {     /* Regular printables */
  294         buf[0] = ch;
  295         buf[1] = '\0';
  296     }
  297 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  298     else if (ch == '\t') {  /* TAB */
  299         snprintf(buf, MAXKEYLEN, "%s", _(txt_tab));
  300     } else if ((ch == '\n') || (ch == '\r')) {  /* LF, CR */
  301         snprintf(buf, MAXKEYLEN, "%s", _(txt_cr));
  302     } else if (ch == ESC) {     /* Escape */
  303         snprintf(buf, MAXKEYLEN, "%s", _(txt_esc));
  304 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  305     } else if (iswcntrl(ch)) {  /* Control keys */
  306 #else
  307     } else if (iscntrl(ch)) {   /* Control keys */
  308 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  309         buf[0] = '^';
  310         buf[1] = (char) (((int) ch & 0xFF) + '@');
  311         buf[2] = '\0';
  312     } else if (ch == ' ')       /* SPACE */
  313         snprintf(buf, MAXKEYLEN, "%s", _(txt_space));
  314     else
  315         strcpy(buf, "???"); /* Never happens? */
  316 
  317     return buf;
  318 }
  319 
  320 
  321 #define KEYSEPS     " \t\n"
  322 /*
  323  * read the keymap file
  324  * returns TRUE if the keymap file was read without an error else FALSE
  325  */
  326 t_bool
  327 read_keymap_file(
  328     void)
  329 {
  330     FILE *fp = (FILE *) 0;
  331     char *line, *keydef, *kname;
  332     char *map, *ptr;
  333     char buf[LEN], buff[NAME_LEN + 1], filename[PATH_LEN];
  334     struct t_version *upgrade = NULL;
  335     t_bool ret = TRUE;
  336 
  337     /*
  338      * checks TIN_HOMEDIR/HOME/TIN_DEFAULTS_DIR
  339      * for KEYMAP_FILE."locale" or KEYMAP_FILE
  340      *
  341      * locale is first match from LC_ALL, LC_CTYPE, LC_MESSAGES, LANG
  342      *
  343      * TODO: LC_CTYPE has higher priority than LC_MESSAGES, does this make sense?
  344      */
  345     /* get locale suffix */
  346     map = my_strdup(get_val("LC_ALL", get_val("LC_CTYPE", get_val("LC_MESSAGES", get_val("LANG", "")))));
  347     if (strlen(map)) {
  348         if ((ptr = strchr(map, '.')))
  349             *ptr = '\0';
  350         snprintf(buff, sizeof(buff), "%s.%s", KEYMAP_FILE, map);
  351         joinpath(filename, sizeof(filename), rcdir, buff);
  352         fp = fopen(filename, "r");
  353     }
  354     if (!fp) {
  355         joinpath(filename, sizeof(filename), rcdir, KEYMAP_FILE);
  356         fp = fopen(filename, "r");
  357     }
  358 #ifdef TIN_DEFAULTS_DIR
  359     if (strlen(map) && !fp) {
  360         joinpath(filename, sizeof(filename), TIN_DEFAULTS_DIR, buff);
  361         fp = fopen(filename, "r");
  362     }
  363     if (!fp) {
  364         joinpath(filename, sizeof(filename), TIN_DEFAULTS_DIR, KEYMAP_FILE);
  365         fp = fopen(filename, "r");
  366     }
  367 #endif /* TIN_DEFAULTS_DIR */
  368 
  369     FreeIfNeeded(map);
  370 
  371     if (!fp)
  372         return TRUE; /* no keymap file is not an error */
  373 
  374     map = my_strdup(filename); /* remember keymap-name */
  375 
  376     /* check if keymap file is up-to-date */
  377     while ((line = fgets(buf, sizeof(buf), fp)) != NULL) {
  378         if (line[0] == '#') {
  379             if (upgrade == NULL && match_string(buf, "# Keymap file V", NULL, 0)) {
  380                 /* TODO: keymap downgrade */
  381                 upgrade = check_upgrade(line, "# Keymap file V", KEYMAP_VERSION);
  382                 if (upgrade->state == RC_UPGRADE) {
  383                     fclose(fp);
  384                     upgrade_keymap_file(map);
  385                     upgrade->state = RC_IGNORE;
  386                     if (!(fp = fopen(map, "r"))) { /* TODO: issue error message? */
  387                         free(map);
  388                         FreeAndNull(upgrade);
  389                         return TRUE;
  390                     }
  391                 }
  392                 break;
  393             }
  394         }
  395     }
  396     rewind(fp);
  397 
  398     free_keymaps();
  399     while ((line = fgets(buf, sizeof(buf), fp)) != NULL) {
  400         /*
  401          * Ignore blank and comment lines
  402          */
  403         if (line[0] == '#' || line[0] == '\n')
  404             continue;
  405 
  406         if ((kname = strsep(&line, KEYSEPS)) != NULL) {
  407             keydef = str_trim(line);
  408             /*
  409              * Warn about basic syntax errors
  410              */
  411             if (keydef == NULL || !strlen(keydef)) {
  412                 error_message(0, _(txt_keymap_missing_key), kname);
  413                 ret = FALSE;
  414                 continue;
  415             }
  416         } else
  417             continue;
  418 
  419         /*
  420          * TODO: useful? shared keymaps (NFS-Home) may differ
  421          * depending on the OS (i.e. one tin has color the other has not)
  422          */
  423         if (!process_mapping(kname, keydef)) {
  424             error_message(0, _(txt_keymap_invalid_name), kname);
  425             prompt_continue();
  426             ret = FALSE;
  427             continue;
  428         }
  429 
  430     }
  431     fclose(fp);
  432     setup_default_keys();
  433     if (upgrade && upgrade->state != RC_IGNORE)
  434         upgrade_prompt_quit(upgrade, map);
  435 
  436     free(map);
  437     FreeAndNull(upgrade);
  438     return ret;
  439 }
  440 
  441 
  442 /*
  443  * associate the keys with the internal function and add them to the keylist
  444  * returns TRUE if all keys could be recognized else FALSE
  445  */
  446 static t_bool
  447 process_keys(
  448     t_function func,
  449     const char *keys,
  450     struct keylist *kl)
  451 {
  452     char *keydef, *tmp;
  453     t_bool error, ret = TRUE;
  454 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  455     wchar_t *wkeydef;
  456     wchar_t key = '\0';
  457 #else
  458     char key = '\0';
  459 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  460 
  461     tmp = my_strdup(keys);      /* don't change "keys" */
  462     keydef = strtok(tmp, KEYSEPS);
  463 
  464     while (keydef != NULL) {
  465         error = FALSE;
  466 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  467         if ((wkeydef = char2wchar_t(keydef)) == NULL) {
  468             error_message(1, _(txt_invalid_multibyte_sequence));
  469             ret = FALSE;
  470 
  471             keydef = strtok(NULL, KEYSEPS);
  472             continue;
  473         }
  474 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  475 
  476         /*
  477          * Parse the key sequence into 'key'
  478          * Special sequences are:
  479          * ^A -> control chars
  480          * TAB -> ^I
  481          * SPACE -> ' '
  482          */
  483 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  484         if (wcslen(wkeydef) > 1) {
  485             switch (wkeydef[0]) /* Only test 1st char - crude but effective */
  486 #else
  487         if (strlen(keydef) > 1) {
  488             switch (keydef[0])  /* Only test 1st char - crude but effective */
  489 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  490             {
  491                 case 'N':
  492                     key = '\0';
  493                     break;
  494 
  495                 case 'S':
  496                     key = ' ';
  497                     break;
  498 
  499                 case 'T':
  500                     key = ctrl('I');
  501                     break;
  502 
  503                 case '^':
  504 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  505                     /* allow only ^A to ^Z */
  506                     if (wkeydef[1] >= 'A' && wkeydef[1] <= 'Z') {
  507                         key = ctrl(wkeydef[1]);
  508                         break;
  509                     }
  510 #else
  511                     if (isupper((int)(unsigned char) keydef[1])) {
  512                         key = ctrl(keydef[1]);
  513                         break;
  514                     }
  515 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  516                     /* FALLTHROUGH */
  517                 default:
  518                     error_message(0, _(txt_keymap_invalid_key), keydef);
  519                     ret = FALSE;
  520                     error = TRUE;
  521                     break;
  522             }
  523         } else {
  524 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  525             if (iswdigit((wint_t) (key = wkeydef[0])))
  526 #else
  527             if (isdigit(key = keydef[0]))
  528 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  529             {
  530                 error_message(0, _(txt_keymap_invalid_key), keydef);
  531                 ret = FALSE;
  532                 error = TRUE;
  533             }
  534         }
  535 
  536         if (!error)
  537             add_key(kl, key, func, TRUE);
  538 
  539         keydef = strtok(NULL, KEYSEPS);
  540 #if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
  541         FreeIfNeeded(wkeydef);
  542 #endif /* MULTIBYTE_ABLE && !NO_LOCALE */
  543     }
  544     free(tmp);
  545 
  546     return ret;
  547 }
  548 
  549 
  550 /*
  551  * map a keyname to the internal function name and assign the keys
  552  * returns TRUE if a mapping was found else FALSE
  553  */
  554 static t_bool
  555 process_mapping(
  556     char *keyname,              /* Keyname we're searching for */
  557     char *keys)             /* Key to assign to keyname if found */
  558 {
  559     switch (keyname[0]) {
  560         case 'A':
  561             if (strcmp(keyname, "AttachPipe") == 0) {
  562                 process_keys(ATTACHMENT_PIPE, keys, &attachment_keys);
  563 
  564                 return TRUE;
  565             }
  566             if (strcmp(keyname, "AttachSelect") == 0) {
  567                 process_keys(ATTACHMENT_SELECT, keys, &attachment_keys);
  568 
  569                 return TRUE;
  570             }
  571             if (strcmp(keyname, "AttachSave") == 0) {
  572                 process_keys(ATTACHMENT_SAVE, keys, &attachment_keys);
  573 
  574                 return TRUE;
  575             }
  576             if (strcmp(keyname, "AttachTag") == 0) {
  577                 process_keys(ATTACHMENT_TAG, keys, &attachment_keys);
  578 
  579                 return TRUE;
  580             }
  581             if (strcmp(keyname, "AttachTagPattern") == 0) {
  582                 process_keys(ATTACHMENT_TAG_PATTERN, keys, &attachment_keys);
  583 
  584                 return TRUE;
  585             }
  586             if (strcmp(keyname, "AttachToggleTagged") == 0) {
  587                 process_keys(ATTACHMENT_TOGGLE_TAGGED, keys, &attachment_keys);
  588 
  589                 return TRUE;
  590             }
  591             if (strcmp(keyname, "AttachUntag") == 0) {
  592                 process_keys(ATTACHMENT_UNTAG, keys, &attachment_keys);
  593 
  594                 return TRUE;
  595             }
  596             break;
  597 
  598         case 'B':
  599             if (strcmp(keyname, "BugReport") == 0) {
  600                 process_keys(GLOBAL_BUGREPORT, keys, &attachment_keys);
  601                 process_keys(GLOBAL_BUGREPORT, keys, &group_keys);
  602                 process_keys(GLOBAL_BUGREPORT, keys, &option_menu_keys);
  603                 process_keys(GLOBAL_BUGREPORT, keys, &select_keys);
  604                 process_keys(GLOBAL_BUGREPORT, keys, &thread_keys);
  605 
  606                 return TRUE;
  607             }
  608             break;
  609 
  610         case 'C':
  611             if (strcmp(keyname, "Catchup") == 0) {
  612                 process_keys(CATCHUP, keys, &group_keys);
  613                 process_keys(CATCHUP, keys, &page_keys);
  614                 process_keys(CATCHUP, keys, &select_keys);
  615                 process_keys(CATCHUP, keys, &thread_keys);
  616 
  617                 return TRUE;
  618             }
  619             if (strcmp(keyname, "CatchupNextUnread") == 0) {
  620                 process_keys(CATCHUP_NEXT_UNREAD, keys, &group_keys);
  621                 process_keys(CATCHUP_NEXT_UNREAD, keys, &page_keys);
  622                 process_keys(CATCHUP_NEXT_UNREAD, keys, &select_keys);
  623                 process_keys(CATCHUP_NEXT_UNREAD, keys, &thread_keys);
  624 
  625                 return TRUE;
  626             }
  627             if (strcmp(keyname, "ConfigFirstPage") == 0) {
  628                 process_keys(GLOBAL_FIRST_PAGE, keys, &option_menu_keys);
  629 
  630                 return TRUE;
  631             }
  632             if (strcmp(keyname, "ConfigLastPage") == 0) {
  633                 process_keys(GLOBAL_LAST_PAGE, keys, &option_menu_keys);
  634 
  635                 return TRUE;
  636             }
  637             if (strcmp(keyname, "ConfigNoSave") == 0) {
  638                 process_keys(CONFIG_NO_SAVE, keys, &option_menu_keys);
  639 
  640                 return TRUE;
  641             }
  642             if (strcmp(keyname, "ConfigResetAttrib") == 0) {
  643                 process_keys(CONFIG_RESET_ATTRIB, keys, &option_menu_keys);
  644 
  645                 return TRUE;
  646             }
  647             if (strcmp(keyname, "ConfigScopeMenu") == 0) {
  648                 process_keys(CONFIG_SCOPE_MENU, keys, &option_menu_keys);
  649 
  650                 return TRUE;
  651             }
  652             if (strcmp(keyname, "ConfigSelect") == 0) {
  653                 process_keys(CONFIG_SELECT, keys, &option_menu_keys);
  654 
  655                 return TRUE;
  656             }
  657             if (strcmp(keyname, "ConfigToggleAttrib") == 0) {
  658                 process_keys(CONFIG_TOGGLE_ATTRIB, keys, &option_menu_keys);
  659 
  660                 return TRUE;
  661             }
  662             break;
  663 
  664         case 'D':
  665             if (strcmp(keyname, "DisplayPostHist") == 0) {
  666                 process_keys(GLOBAL_DISPLAY_POST_HISTORY, keys, &group_keys);
  667                 process_keys(GLOBAL_DISPLAY_POST_HISTORY, keys, &page_keys);
  668                 process_keys(GLOBAL_DISPLAY_POST_HISTORY, keys, &select_keys);
  669                 process_keys(GLOBAL_DISPLAY_POST_HISTORY, keys, &thread_keys);
  670 
  671                 return TRUE;
  672             }
  673             if (strcmp(keyname, "Down") == 0) {
  674                 process_keys(GLOBAL_LINE_DOWN, keys, &attachment_keys);
  675                 process_keys(GLOBAL_LINE_DOWN, keys, &group_keys);
  676                 process_keys(GLOBAL_LINE_DOWN, keys, &info_keys);
  677                 process_keys(GLOBAL_LINE_DOWN, keys, &option_menu_keys);
  678                 process_keys(GLOBAL_LINE_DOWN, keys, &page_keys);
  679                 process_keys(GLOBAL_LINE_DOWN, keys, &post_hist_keys);
  680                 process_keys(GLOBAL_LINE_DOWN, keys, &scope_keys);
  681                 process_keys(GLOBAL_LINE_DOWN, keys, &select_keys);
  682                 process_keys(GLOBAL_LINE_DOWN, keys, &thread_keys);
  683                 process_keys(GLOBAL_LINE_DOWN, keys, &url_keys);
  684 
  685                 return TRUE;
  686             }
  687             break;
  688 
  689         case 'E':
  690             if (strcmp(keyname, "EditFilter") == 0) {
  691                 process_keys(GLOBAL_EDIT_FILTER, keys, &group_keys);
  692                 process_keys(GLOBAL_EDIT_FILTER, keys, &page_keys);
  693                 process_keys(GLOBAL_EDIT_FILTER, keys, &select_keys);
  694                 process_keys(GLOBAL_EDIT_FILTER, keys, &thread_keys);
  695 
  696                 return TRUE;
  697             }
  698             break;
  699 
  700         case 'F':
  701             if (strcmp(keyname, "FeedArt") == 0) {
  702                 process_keys(FEED_ARTICLE, keys, &feed_type_keys);
  703 
  704                 return TRUE;
  705             }
  706             if (strcmp(keyname, "FeedHot") == 0) {
  707                 process_keys(FEED_HOT, keys, &feed_type_keys);
  708 
  709                 return TRUE;
  710             }
  711             if (strcmp(keyname, "FeedPat") == 0) {
  712                 process_keys(FEED_PATTERN, keys, &feed_type_keys);
  713 
  714                 return TRUE;
  715             }
  716             if (strcmp(keyname, "FeedRange") == 0) {
  717                 process_keys(FEED_RANGE, keys, &feed_type_keys);
  718 
  719                 return TRUE;
  720             }
  721             if (strcmp(keyname, "FeedRepost") == 0) {
  722                 process_keys(FEED_KEY_REPOST, keys, &feed_supersede_article_keys);
  723 
  724                 return TRUE;
  725             }
  726             if (strcmp(keyname, "FeedSupersede") == 0) {
  727                 process_keys(FEED_SUPERSEDE, keys, &feed_supersede_article_keys);
  728 
  729                 return TRUE;
  730             }
  731             if (strcmp(keyname, "FeedTag") == 0) {
  732                 process_keys(FEED_TAGGED, keys, &feed_type_keys);
  733 
  734                 return TRUE;
  735             }
  736             if (strcmp(keyname, "FeedThd") == 0) {
  737                 process_keys(FEED_THREAD, keys, &feed_type_keys);
  738 
  739                 return TRUE;
  740             }
  741             if (strcmp(keyname, "FilterEdit") == 0) {
  742                 process_keys(FILTER_EDIT, keys, &filter_keys);
  743 
  744                 return TRUE;
  745             }
  746             if (strcmp(keyname, "FilterSave") == 0) {
  747                 process_keys(FILTER_SAVE, keys, &filter_keys);
  748 
  749                 return TRUE;
  750             }
  751             if (strcmp(keyname, "FirstPage") == 0) {
  752                 process_keys(GLOBAL_FIRST_PAGE, keys, &attachment_keys);
  753                 process_keys(GLOBAL_FIRST_PAGE, keys, &group_keys);
  754                 process_keys(GLOBAL_FIRST_PAGE, keys, &info_keys);
  755                 process_keys(GLOBAL_FIRST_PAGE, keys, &option_menu_keys);
  756                 process_keys(GLOBAL_FIRST_PAGE, keys, &page_keys);
  757                 process_keys(GLOBAL_FIRST_PAGE, keys, &post_hist_keys);
  758                 process_keys(GLOBAL_FIRST_PAGE, keys, &scope_keys);
  759                 process_keys(GLOBAL_FIRST_PAGE, keys, &select_keys);
  760                 process_keys(GLOBAL_FIRST_PAGE, keys, &thread_keys);
  761                 process_keys(GLOBAL_FIRST_PAGE, keys, &url_keys);
  762 
  763                 return TRUE;
  764             }
  765             break;
  766 
  767         case 'G':
  768             if (strcmp(keyname, "GroupAutoSave") == 0) {
  769                 process_keys(GROUP_AUTOSAVE, keys, &group_keys);
  770 
  771                 return TRUE;
  772             }
  773             if (strcmp(keyname, "GroupCancel") == 0) {
  774                 process_keys(GROUP_CANCEL, keys, &group_keys);
  775 
  776                 return TRUE;
  777             }
  778             if (strcmp(keyname, "GroupDoAutoSel") == 0) {
  779                 process_keys(GROUP_DO_AUTOSELECT, keys, &group_keys);
  780 
  781                 return TRUE;
  782             }
  783             if (strcmp(keyname, "GroupGoto") == 0) {
  784                 process_keys(GROUP_GOTO, keys, &group_keys);
  785 
  786                 return TRUE;
  787             }
  788             if (strcmp(keyname, "GroupListThd") == 0) {
  789                 process_keys(GROUP_LIST_THREAD, keys, &group_keys);
  790 
  791                 return TRUE;
  792             }
  793             if (strcmp(keyname, "GroupMail") == 0) {
  794                 process_keys(GROUP_MAIL, keys, &group_keys);
  795 
  796                 return TRUE;
  797             }
  798             if (strcmp(keyname, "GroupMarkThdRead") == 0) {
  799                 process_keys(GROUP_MARK_THREAD_READ, keys, &group_keys);
  800 
  801                 return TRUE;
  802             }
  803             if (strcmp(keyname, "GroupMarkUnselArtRead") == 0) {
  804                 process_keys(GROUP_MARK_UNSELECTED_ARTICLES_READ, keys, &group_keys);
  805 
  806                 return TRUE;
  807             }
  808             if (strcmp(keyname, "GroupNextGroup") == 0) {
  809                 process_keys(GROUP_NEXT_GROUP, keys, &group_keys);
  810 
  811                 return TRUE;
  812             }
  813             if (strcmp(keyname, "GroupNextUnreadArt") == 0) {
  814                 process_keys(GROUP_NEXT_UNREAD_ARTICLE, keys, &group_keys);
  815 
  816                 return TRUE;
  817             }
  818             if (strcmp(keyname, "GroupNextUnreadArtOrGrp") == 0) {
  819                 process_keys(GROUP_NEXT_UNREAD_ARTICLE_OR_GROUP, keys, &group_keys);
  820 
  821                 return TRUE;
  822             }
  823             if (strcmp(keyname, "GroupPrevGroup") == 0) {
  824                 process_keys(GROUP_PREVIOUS_GROUP, keys, &group_keys);
  825 
  826                 return TRUE;
  827             }
  828             if (strcmp(keyname, "GroupPrevUnreadArt") == 0) {
  829                 process_keys(GROUP_PREVIOUS_UNREAD_ARTICLE, keys, &group_keys);
  830 
  831                 return TRUE;
  832             }
  833             if (strcmp(keyname, "GroupReadBasenote") == 0) {
  834                 process_keys(GROUP_READ_BASENOTE, keys, &group_keys);
  835 
  836                 return TRUE;
  837             }
  838             if (strcmp(keyname, "GroupRepost") == 0) {
  839                 process_keys(GROUP_REPOST, keys, &group_keys);
  840 
  841                 return TRUE;
  842             }
  843             if (strcmp(keyname, "GroupReverseSel") == 0) {
  844                 process_keys(GROUP_REVERSE_SELECTIONS, keys, &group_keys);
  845 
  846                 return TRUE;
  847             }
  848             if (strcmp(keyname, "GroupSave") == 0) {
  849                 process_keys(GROUP_SAVE, keys, &group_keys);
  850 
  851                 return TRUE;
  852             }
  853             if (strcmp(keyname, "GroupSelPattern") == 0) {
  854                 process_keys(GROUP_SELECT_PATTERN, keys, &group_keys);
  855 
  856                 return TRUE;
  857             }
  858             if (strcmp(keyname, "GroupSelThd") == 0) {
  859                 process_keys(GROUP_SELECT_THREAD, keys, &group_keys);
  860 
  861                 return TRUE;
  862             }
  863             if (strcmp(keyname, "GroupSelThdIfUnreadSelected") == 0) {
  864                 process_keys(GROUP_SELECT_THREAD_IF_UNREAD_SELECTED, keys, &group_keys);
  865 
  866                 return TRUE;
  867             }
  868             if (strcmp(keyname, "GroupTag") == 0) {
  869                 process_keys(GROUP_TAG, keys, &group_keys);
  870 
  871                 return TRUE;
  872             }
  873             if (strcmp(keyname, "GroupTagParts") == 0) {
  874                 process_keys(GROUP_TAG_PARTS, keys, &group_keys);
  875 
  876                 return TRUE;
  877             }
  878             if (strcmp(keyname, "GroupToggleGetartLimit") == 0) {
  879                 process_keys(GROUP_TOGGLE_GET_ARTICLES_LIMIT, keys, &group_keys);
  880 
  881                 return TRUE;
  882             }
  883             if (strcmp(keyname, "GroupToggleReadUnread") == 0) {
  884                 process_keys(GROUP_TOGGLE_READ_UNREAD, keys, &group_keys);
  885 
  886                 return TRUE;
  887             }
  888             if (strcmp(keyname, "GroupToggleSubjDisplay") == 0) {
  889                 process_keys(GROUP_TOGGLE_SUBJECT_DISPLAY, keys, &group_keys);
  890 
  891                 return TRUE;
  892             }
  893             if (strcmp(keyname, "GroupToggleThdSel") == 0) {
  894                 process_keys(GROUP_TOGGLE_SELECT_THREAD, keys, &group_keys);
  895 
  896                 return TRUE;
  897             }
  898             if (strcmp(keyname, "GroupToggleThreading") == 0) {
  899                 process_keys(GROUP_TOGGLE_THREADING, keys, &group_keys);
  900 
  901                 return TRUE;
  902             }
  903             if (strcmp(keyname, "GroupUndoSel") == 0) {
  904                 process_keys(GROUP_UNDO_SELECTIONS, keys, &group_keys);
  905 
  906                 return TRUE;
  907             }
  908             if (strcmp(keyname, "GroupUntag") == 0) {
  909                 process_keys(GROUP_UNTAG, keys, &group_keys);
  910 
  911                 return TRUE;
  912             }
  913             break;
  914 
  915         case 'H':
  916             if (strcmp(keyname, "Help") == 0) {
  917                 process_keys(GLOBAL_HELP, keys, &attachment_keys);
  918                 process_keys(GLOBAL_HELP, keys, &group_keys);
  919                 process_keys(GLOBAL_HELP, keys, &option_menu_keys);
  920                 process_keys(GLOBAL_HELP, keys, &page_keys);
  921                 process_keys(GLOBAL_HELP, keys, &post_hist_keys);
  922                 process_keys(GLOBAL_HELP, keys, &scope_keys);
  923                 process_keys(GLOBAL_HELP, keys, &select_keys);
  924                 process_keys(GLOBAL_HELP, keys, &thread_keys);
  925                 process_keys(GLOBAL_HELP, keys, &url_keys);
  926 
  927                 return TRUE;
  928             }
  929             if (strcmp(keyname, "HelpFirstPage") == 0) {
  930                 process_keys(GLOBAL_FIRST_PAGE, keys, &info_keys);
  931 
  932                 return TRUE;
  933             }
  934             if (strcmp(keyname, "HelpLastPage") == 0) {
  935                 process_keys(GLOBAL_LAST_PAGE, keys, &info_keys);
  936 
  937                 return TRUE;
  938             }
  939             break;
  940 
  941         case 'L':
  942             if (strcmp(keyname, "LastPage") == 0) {
  943                 process_keys(GLOBAL_LAST_PAGE, keys, &attachment_keys);
  944                 process_keys(GLOBAL_LAST_PAGE, keys, &group_keys);
  945                 process_keys(GLOBAL_LAST_PAGE, keys, &info_keys);
  946                 process_keys(GLOBAL_LAST_PAGE, keys, &option_menu_keys);
  947                 process_keys(GLOBAL_LAST_PAGE, keys, &page_keys);
  948                 process_keys(GLOBAL_LAST_PAGE, keys, &post_hist_keys);
  949                 process_keys(GLOBAL_LAST_PAGE, keys, &scope_keys);
  950                 process_keys(GLOBAL_LAST_PAGE, keys, &select_keys);
  951                 process_keys(GLOBAL_LAST_PAGE, keys, &thread_keys);
  952                 process_keys(GLOBAL_LAST_PAGE, keys, &url_keys);
  953 
  954                 return TRUE;
  955             }
  956             if (strcmp(keyname, "LastViewed") == 0) {
  957                 process_keys(GLOBAL_LAST_VIEWED, keys, &group_keys);
  958                 process_keys(GLOBAL_LAST_VIEWED, keys, &page_keys);
  959                 process_keys(GLOBAL_LAST_VIEWED, keys, &thread_keys);
  960 
  961                 return TRUE;
  962             }
  963             if (strcmp(keyname, "LookupMessage") == 0) {
  964                 process_keys(GLOBAL_LOOKUP_MESSAGEID, keys, &group_keys);
  965                 process_keys(GLOBAL_LOOKUP_MESSAGEID, keys, &page_keys);
  966 #ifdef NNTP_ABLE
  967                 process_keys(GLOBAL_LOOKUP_MESSAGEID, keys, &select_keys);
  968 #endif /* NNTP_ABLE */
  969                 process_keys(GLOBAL_LOOKUP_MESSAGEID, keys, &thread_keys);
  970 
  971                 return TRUE;
  972             }
  973             break;
  974 
  975         case 'M':
  976             if (strcmp(keyname, "MarkArticleUnread") == 0) {
  977                 process_keys(MARK_ARTICLE_UNREAD, keys, &group_keys);
  978                 process_keys(MARK_ARTICLE_UNREAD, keys, &page_keys);
  979                 process_keys(MARK_ARTICLE_UNREAD, keys, &thread_keys);
  980 
  981                 return TRUE;
  982             }
  983             if (strcmp(keyname, "MarkThreadUnread") == 0) {
  984                 process_keys(MARK_THREAD_UNREAD, keys, &group_keys);
  985                 process_keys(MARK_THREAD_UNREAD, keys, &page_keys);
  986                 process_keys(MARK_THREAD_UNREAD, keys, &thread_keys);
  987 
  988                 return TRUE;
  989             }
  990             if (strcmp(keyname, "MarkFeedRead") == 0) {
  991                 process_keys(MARK_FEED_READ, keys, &group_keys);
  992                 process_keys(MARK_FEED_READ, keys, &thread_keys);
  993 
  994                 return TRUE;
  995             }
  996             if (strcmp(keyname, "MarkFeedUnread") == 0) {
  997                 process_keys(MARK_FEED_UNREAD, keys, &group_keys);
  998                 process_keys(MARK_FEED_UNREAD, keys, &thread_keys);
  999 
 1000                 return TRUE;
 1001             }
 1002             if (strcmp(keyname, "MenuFilterKill") == 0) {
 1003                 process_keys(GLOBAL_MENU_FILTER_KILL, keys, &group_keys);
 1004                 process_keys(GLOBAL_MENU_FILTER_KILL, keys, &page_keys);
 1005                 process_keys(GLOBAL_MENU_FILTER_KILL, keys, &thread_keys);
 1006 
 1007                 return TRUE;
 1008             }
 1009             if (strcmp(keyname, "MenuFilterSelect") == 0) {
 1010                 process_keys(GLOBAL_MENU_FILTER_SELECT, keys, &group_keys);
 1011                 process_keys(GLOBAL_MENU_FILTER_SELECT, keys, &page_keys);
 1012                 process_keys(GLOBAL_MENU_FILTER_SELECT, keys, &thread_keys);
 1013 
 1014                 return TRUE;
 1015             }
 1016             break;
 1017 
 1018         case 'O':
 1019             if (strcmp(keyname, "OptionMenu") == 0) {
 1020                 process_keys(GLOBAL_OPTION_MENU, keys, &group_keys);
 1021                 process_keys(GLOBAL_OPTION_MENU, keys, &page_keys);
 1022                 process_keys(GLOBAL_OPTION_MENU, keys, &post_edit_ext_keys);
 1023                 process_keys(GLOBAL_OPTION_MENU, keys, &post_post_keys);
 1024                 process_keys(GLOBAL_OPTION_MENU, keys, &select_keys);
 1025                 process_keys(GLOBAL_OPTION_MENU, keys, &thread_keys);
 1026 
 1027                 return TRUE;
 1028             }
 1029             break;
 1030 
 1031         case 'P':
 1032             if (strcmp(keyname, "PageAutoSave") == 0) {
 1033                 process_keys(PAGE_AUTOSAVE, keys, &page_keys);
 1034 
 1035                 return TRUE;
 1036             }
 1037             if (strcmp(keyname, "PageBotThd") == 0) {
 1038                 process_keys(PAGE_BOTTOM_THREAD, keys, &page_keys);
 1039 
 1040                 return TRUE;
 1041             }
 1042             if (strcmp(keyname, "PageCancel") == 0) {
 1043                 process_keys(PAGE_CANCEL, keys, &page_keys);
 1044 
 1045                 return TRUE;
 1046             }
 1047             if (strcmp(keyname, "PageDown") == 0) {
 1048                 process_keys(GLOBAL_PAGE_DOWN, keys, &attachment_keys);
 1049                 process_keys(GLOBAL_PAGE_DOWN, keys, &group_keys);
 1050                 process_keys(GLOBAL_PAGE_DOWN, keys, &info_keys);
 1051                 process_keys(GLOBAL_PAGE_DOWN, keys, &option_menu_keys);
 1052                 process_keys(GLOBAL_PAGE_DOWN, keys, &page_keys);
 1053                 process_keys(GLOBAL_PAGE_DOWN, keys, &post_hist_keys);
 1054                 process_keys(GLOBAL_PAGE_DOWN, keys, &scope_keys);
 1055                 process_keys(GLOBAL_PAGE_DOWN, keys, &select_keys);
 1056                 process_keys(GLOBAL_PAGE_DOWN, keys, &thread_keys);
 1057                 process_keys(GLOBAL_PAGE_DOWN, keys, &url_keys);
 1058 
 1059                 return TRUE;
 1060             }
 1061             if (strcmp(keyname, "PageEditArticle") == 0) {
 1062                 process_keys(PAGE_EDIT_ARTICLE, keys, &page_keys);
 1063 
 1064                 return TRUE;
 1065             }
 1066             if (strcmp(keyname, "PageFirstPage") == 0) {
 1067                 process_keys(GLOBAL_FIRST_PAGE, keys, &page_keys);
 1068 
 1069                 return TRUE;
 1070             }
 1071             if (strcmp(keyname, "PageFollowup") == 0) {
 1072                 process_keys(PAGE_FOLLOWUP, keys, &page_keys);
 1073 
 1074                 return TRUE;
 1075             }
 1076             if (strcmp(keyname, "PageFollowupQuote") == 0) {
 1077                 process_keys(PAGE_FOLLOWUP_QUOTE, keys, &page_keys);
 1078 
 1079                 return TRUE;
 1080             }
 1081             if (strcmp(keyname, "PageFollowupQuoteHeaders") == 0) {
 1082                 process_keys(PAGE_FOLLOWUP_QUOTE_HEADERS, keys, &page_keys);
 1083 
 1084                 return TRUE;
 1085             }
 1086             if (strcmp(keyname, "PageGotoParent") == 0) {
 1087                 process_keys(PAGE_GOTO_PARENT, keys, &page_keys);
 1088 
 1089                 return TRUE;
 1090             }
 1091             if (strcmp(keyname, "PageGroupSel") == 0) {
 1092                 process_keys(PAGE_GROUP_SELECT, keys, &page_keys);
 1093 
 1094                 return TRUE;
 1095             }
 1096             if (strcmp(keyname, "PageLastPage") == 0) {
 1097                 process_keys(GLOBAL_LAST_PAGE, keys, &page_keys);
 1098 
 1099                 return TRUE;
 1100             }
 1101             if (strcmp(keyname, "PageListThd") == 0) {
 1102                 process_keys(PAGE_LIST_THREAD, keys, &page_keys);
 1103 
 1104                 return TRUE;
 1105             }
 1106             if (strcmp(keyname, "PageKillThd") == 0) {
 1107                 process_keys(PAGE_MARK_THREAD_READ, keys, &page_keys);
 1108 
 1109                 return TRUE;
 1110             }
 1111             if (strcmp(keyname, "PageMail") == 0) {
 1112                 process_keys(PAGE_MAIL, keys, &page_keys);
 1113 
 1114                 return TRUE;
 1115             }
 1116             if (strcmp(keyname, "PageNextArt") == 0) {
 1117                 process_keys(PAGE_NEXT_ARTICLE, keys, &page_keys);
 1118 
 1119                 return TRUE;
 1120             }
 1121             if (strcmp(keyname, "PageNextThd") == 0) {
 1122                 process_keys(PAGE_NEXT_THREAD, keys, &page_keys);
 1123 
 1124                 return TRUE;
 1125             }
 1126             if (strcmp(keyname, "PageNextUnread") == 0) {
 1127                 process_keys(PAGE_NEXT_UNREAD, keys, &page_keys);
 1128 
 1129                 return TRUE;
 1130             }
 1131             if (strcmp(keyname, "PageNextUnreadArt") == 0) {
 1132                 process_keys(PAGE_NEXT_UNREAD_ARTICLE, keys, &page_keys);
 1133 
 1134                 return TRUE;
 1135             }
 1136             if (strcmp(keyname, "PagePGPCheckArticle") == 0) {
 1137 #ifdef HAVE_PGP_GPG
 1138                 process_keys(PAGE_PGP_CHECK_ARTICLE, keys, &page_keys);
 1139 #endif /* HAVE_PGP_GPG */
 1140 
 1141                 return TRUE;
 1142             }
 1143             if (strcmp(keyname, "PagePrevArt") == 0) {
 1144                 process_keys(PAGE_PREVIOUS_ARTICLE, keys, &page_keys);
 1145 
 1146                 return TRUE;
 1147             }
 1148             if (strcmp(keyname, "PagePrevUnreadArt") == 0) {
 1149                 process_keys(PAGE_PREVIOUS_UNREAD_ARTICLE, keys, &page_keys);
 1150 
 1151                 return TRUE;
 1152             }
 1153             if (strcmp(keyname, "PageReply") == 0) {
 1154                 process_keys(PAGE_REPLY, keys, &page_keys);
 1155 
 1156                 return TRUE;
 1157             }
 1158             if (strcmp(keyname, "PageReplyQuote") == 0) {
 1159                 process_keys(PAGE_REPLY_QUOTE, keys, &page_keys);
 1160 
 1161                 return TRUE;
 1162             }
 1163             if (strcmp(keyname, "PageReplyQuoteHeaders") == 0) {
 1164                 process_keys(PAGE_REPLY_QUOTE_HEADERS, keys, &page_keys);
 1165 
 1166                 return TRUE;
 1167             }
 1168             if (strcmp(keyname, "PageRepost") == 0) {
 1169                 process_keys(PAGE_REPOST, keys, &page_keys);
 1170 
 1171                 return TRUE;
 1172             }
 1173             if (strcmp(keyname, "PageReveal") == 0) {
 1174                 process_keys(PAGE_REVEAL, keys, &page_keys);
 1175 
 1176                 return TRUE;
 1177             }
 1178             if (strcmp(keyname, "PageSave") == 0) {
 1179                 process_keys(PAGE_SAVE, keys, &page_keys);
 1180 
 1181                 return TRUE;
 1182             }
 1183             if (strcmp(keyname, "PageSkipIncludedText") == 0) {
 1184                 process_keys(PAGE_SKIP_INCLUDED_TEXT, keys, &page_keys);
 1185 
 1186                 return TRUE;
 1187             }
 1188             if (strcmp(keyname, "PageTag") == 0) {
 1189                 process_keys(PAGE_TAG, keys, &page_keys);
 1190 
 1191                 return TRUE;
 1192             }
 1193             if (strcmp(keyname, "PageTopThd") == 0) {
 1194                 process_keys(PAGE_TOP_THREAD, keys, &page_keys);
 1195 
 1196                 return TRUE;
 1197             }
 1198             if (strcmp(keyname, "PageToggleAllHeaders") == 0) {
 1199                 process_keys(PAGE_TOGGLE_HEADERS, keys, &page_keys);
 1200 
 1201                 return TRUE;
 1202             }
 1203             if (strcmp(keyname, "PageToggleHighlight") == 0) {
 1204                 process_keys(PAGE_TOGGLE_HIGHLIGHTING, keys, &page_keys);
 1205 
 1206                 return TRUE;
 1207             }
 1208             if (strcmp(keyname, "PageToggleRaw") == 0) {
 1209                 process_keys(PAGE_TOGGLE_RAW, keys, &page_keys);
 1210 
 1211                 return TRUE;
 1212             }
 1213             if (strcmp(keyname, "PageToggleRot") == 0) {
 1214                 process_keys(PAGE_TOGGLE_ROT13, keys, &page_keys);
 1215 
 1216                 return TRUE;
 1217             }
 1218             if (strcmp(keyname, "PageToggleTabs") == 0) {
 1219                 process_keys(PAGE_TOGGLE_TABS, keys, &page_keys);
 1220 
 1221                 return TRUE;
 1222             }
 1223             if (strcmp(keyname, "PageToggleTex2iso") == 0) {
 1224                 process_keys(PAGE_TOGGLE_TEX2ISO, keys, &page_keys);
 1225 
 1226                 return TRUE;
 1227             }
 1228             if (strcmp(keyname, "PageToggleUue") == 0) {
 1229                 process_keys(PAGE_TOGGLE_UUE, keys, &page_keys);
 1230 
 1231                 return TRUE;
 1232             }
 1233             if (strcmp(keyname, "PageUp") == 0) {
 1234                 process_keys(GLOBAL_PAGE_UP, keys, &attachment_keys);
 1235                 process_keys(GLOBAL_PAGE_UP, keys, &group_keys);
 1236                 process_keys(GLOBAL_PAGE_UP, keys, &info_keys);
 1237                 process_keys(GLOBAL_PAGE_UP, keys, &option_menu_keys);
 1238                 process_keys(GLOBAL_PAGE_UP, keys, &page_keys);
 1239                 process_keys(GLOBAL_PAGE_UP, keys, &post_hist_keys);
 1240                 process_keys(GLOBAL_PAGE_UP, keys, &scope_keys);
 1241                 process_keys(GLOBAL_PAGE_UP, keys, &select_keys);
 1242                 process_keys(GLOBAL_PAGE_UP, keys, &thread_keys);
 1243                 process_keys(GLOBAL_PAGE_UP, keys, &url_keys);
 1244 
 1245                 return TRUE;
 1246             }
 1247             if (strcmp(keyname, "PageViewAttach") == 0) {
 1248                 process_keys(PAGE_VIEW_ATTACHMENTS, keys, &page_keys);
 1249 
 1250                 return TRUE;
 1251             }
 1252             if (strcmp(keyname, "PageViewUrl") == 0) {
 1253                 process_keys(PAGE_VIEW_URL, keys, &page_keys);
 1254 
 1255                 return TRUE;
 1256             }
 1257             if (strcmp(keyname, "PgpEncrypt") == 0) {
 1258 #ifdef HAVE_PGP_GPG
 1259                 process_keys(PGP_KEY_ENCRYPT, keys, &pgp_mail_keys);
 1260 #endif /* HAVE_PGP_GPG */
 1261 
 1262                 return TRUE;
 1263             }
 1264             if (strcmp(keyname, "PgpEncSign") == 0) {
 1265 #ifdef HAVE_PGP_GPG
 1266                 process_keys(PGP_KEY_ENCRYPT_SIGN, keys, &pgp_mail_keys);
 1267 #endif /* HAVE_PGP_GPG */
 1268 
 1269                 return TRUE;
 1270             }
 1271             if (strcmp(keyname, "PgpIncludekey") == 0) {
 1272 #ifdef HAVE_PGP_GPG
 1273                 process_keys(PGP_INCLUDE_KEY, keys, &pgp_news_keys);
 1274 #endif /* HAVE_PGP_GPG */
 1275 
 1276                 return TRUE;
 1277             }
 1278             if (strcmp(keyname, "PgpSign") == 0) {
 1279 #ifdef HAVE_PGP_GPG
 1280                 process_keys(PGP_KEY_SIGN, keys, &pgp_news_keys);
 1281                 process_keys(PGP_KEY_SIGN, keys, &pgp_mail_keys);
 1282 #endif /* HAVE_PGP_GPG */
 1283 
 1284                 return TRUE;
 1285             }
 1286             if (strcmp(keyname, "Pipe") == 0) {
 1287                 process_keys(GLOBAL_PIPE, keys, &attachment_keys);
 1288                 process_keys(GLOBAL_PIPE, keys, &group_keys);
 1289                 process_keys(GLOBAL_PIPE, keys, &page_keys);
 1290                 process_keys(GLOBAL_PIPE, keys, &thread_keys);
 1291 
 1292                 return TRUE;
 1293             }
 1294             if (strcmp(keyname, "Post") == 0) {
 1295                 process_keys(GLOBAL_POST, keys, &group_keys);
 1296                 process_keys(GLOBAL_POST, keys, &page_keys);
 1297                 process_keys(GLOBAL_POST, keys, &post_ignore_fupto_keys);
 1298                 process_keys(GLOBAL_POST, keys, &post_mail_fup_keys);
 1299                 process_keys(GLOBAL_POST, keys, &post_post_keys);
 1300                 process_keys(GLOBAL_POST, keys, &select_keys);
 1301                 process_keys(GLOBAL_POST, keys, &thread_keys);
 1302 
 1303                 return TRUE;
 1304             }
 1305             if (strcmp(keyname, "PostAbort") == 0) {
 1306                 process_keys(POST_ABORT, keys, &post_continue_keys);
 1307 
 1308                 return TRUE;
 1309             }
 1310             if (strcmp(keyname, "PostCancel") == 0) {
 1311                 process_keys(POST_CANCEL, keys, &post_cancel_keys);
 1312                 process_keys(POST_CANCEL, keys, &post_delete_keys);
 1313 
 1314                 return TRUE;
 1315             }
 1316             if (strcmp(keyname, "PostContinue") == 0) {
 1317                 process_keys(POST_CONTINUE, keys, &post_continue_keys);
 1318 
 1319                 return TRUE;
 1320             }
 1321             if (strcmp(keyname, "PostEdit") == 0) {
 1322                 process_keys(POST_EDIT, keys, &post_cancel_keys);
 1323                 process_keys(POST_EDIT, keys, &post_edit_keys);
 1324                 process_keys(POST_EDIT, keys, &post_edit_ext_keys);
 1325                 process_keys(POST_EDIT, keys, &post_post_keys);
 1326                 process_keys(POST_EDIT, keys, &post_send_keys);
 1327 
 1328                 return TRUE;
 1329             }
 1330             if (strcmp(keyname, "PostIgnore") == 0) {
 1331                 process_keys(POST_IGNORE_FUPTO, keys, &post_ignore_fupto_keys);
 1332 
 1333                 return TRUE;
 1334             }
 1335             if (strcmp(keyname, "PostIspell") == 0) {
 1336 #ifdef HAVE_ISPELL
 1337                 process_keys(POST_ISPELL, keys, &post_post_keys);
 1338                 process_keys(POST_ISPELL, keys, &post_send_keys);
 1339 #endif /* HAVE_ISPELL */
 1340 
 1341                 return TRUE;
 1342             }
 1343             if (strcmp(keyname, "PostMail") == 0) {
 1344                 process_keys(POST_MAIL, keys, &post_mail_fup_keys);
 1345 
 1346                 return TRUE;
 1347             }
 1348             if (strcmp(keyname, "PostPGP") == 0) {
 1349 #ifdef HAVE_PGP_GPG
 1350                 process_keys(POST_PGP, keys, &post_post_keys);
 1351                 process_keys(POST_PGP, keys, &post_send_keys);
 1352 #endif /* HAVE_PGP_GPG */
 1353 
 1354                 return TRUE;
 1355             }
 1356             if (strcmp(keyname, "PostedArticlesSelect") == 0) {
 1357                 process_keys(POSTED_SELECT, keys, &post_hist_keys);
 1358 
 1359                 return TRUE;
 1360             }
 1361             if (strcmp(keyname, "PostponeAll") == 0) {
 1362                 process_keys(POSTPONE_ALL, keys, &post_postpone_keys);
 1363 
 1364                 return TRUE;
 1365             }
 1366             if (strcmp(keyname, "Postponed") == 0) {
 1367                 process_keys(GLOBAL_POSTPONED, keys, &group_keys);
 1368                 process_keys(GLOBAL_POSTPONED, keys, &page_keys);
 1369                 process_keys(GLOBAL_POSTPONED, keys, &select_keys);
 1370                 process_keys(GLOBAL_POSTPONED, keys, &thread_keys);
 1371 
 1372                 return TRUE;
 1373             }
 1374             if (strcmp(keyname, "PostponeOverride") == 0) {
 1375                 process_keys(POSTPONE_OVERRIDE, keys, &post_postpone_keys);
 1376 
 1377                 return TRUE;
 1378             }
 1379             if (strcmp(keyname, "PostPost") == 0) {
 1380                 process_keys(GLOBAL_POST, keys, &post_ignore_fupto_keys);
 1381                 process_keys(GLOBAL_POST, keys, &post_mail_fup_keys);
 1382                 process_keys(GLOBAL_POST, keys, &post_post_keys);
 1383 
 1384                 return TRUE;
 1385             }
 1386             if (strcmp(keyname, "PostPostpone") == 0) {
 1387                 process_keys(POST_POSTPONE, keys, &post_edit_keys);
 1388                 process_keys(POST_POSTPONE, keys, &post_post_keys);
 1389 
 1390                 return TRUE;
 1391             }
 1392             if (strcmp(keyname, "PostSend") == 0) {
 1393                 process_keys(POST_SEND, keys, &post_send_keys);
 1394 
 1395                 return TRUE;
 1396             }
 1397             if (strcmp(keyname, "PostSupersede") == 0) {
 1398                 process_keys(POST_SUPERSEDE, keys, &post_delete_keys);
 1399 
 1400                 return TRUE;
 1401             }
 1402             if (strcmp(keyname, "PProcNo") == 0) {
 1403                 process_keys(POSTPROCESS_NO, keys, &feed_post_process_keys);
 1404 
 1405                 return TRUE;
 1406             }
 1407             if (strcmp(keyname, "PProcShar") == 0) {
 1408                 process_keys(POSTPROCESS_SHAR, keys, &feed_post_process_keys);
 1409 
 1410                 return TRUE;
 1411             }
 1412             if (strcmp(keyname, "PProcYes") == 0) {
 1413                 process_keys(POSTPROCESS_YES, keys, &feed_post_process_keys);
 1414 
 1415                 return TRUE;
 1416             }
 1417             if (strcmp(keyname, "Print") == 0) {
 1418 #ifndef DISABLE_PRINTING
 1419                 process_keys(GLOBAL_PRINT, keys, &group_keys);
 1420                 process_keys(GLOBAL_PRINT, keys, &page_keys);
 1421                 process_keys(GLOBAL_PRINT, keys, &thread_keys);
 1422 #endif /* !DISABLE_PRINTING */
 1423 
 1424                 return TRUE;
 1425             }
 1426             if (strcmp(keyname, "PromptNo") == 0) {
 1427                 process_keys(PROMPT_NO, keys, &post_postpone_keys);
 1428                 process_keys(PROMPT_NO, keys, &prompt_keys);
 1429 
 1430                 return TRUE;
 1431             }
 1432             if (strcmp(keyname, "PromptYes") == 0) {
 1433                 process_keys(PROMPT_YES, keys, &post_postpone_keys);
 1434                 process_keys(PROMPT_YES, keys, &prompt_keys);
 1435 
 1436                 return TRUE;
 1437             }
 1438             break;
 1439 
 1440         case 'Q':
 1441             if (strcmp(keyname, "QuickFilterKill") == 0) {
 1442                 process_keys(GLOBAL_QUICK_FILTER_KILL, keys, &group_keys);
 1443                 process_keys(GLOBAL_QUICK_FILTER_KILL, keys, &page_keys);
 1444 
 1445                 return TRUE;
 1446             }
 1447             if (strcmp(keyname, "QuickFilterSelect") == 0) {
 1448                 process_keys(GLOBAL_QUICK_FILTER_SELECT, keys, &group_keys);
 1449                 process_keys(GLOBAL_QUICK_FILTER_SELECT, keys, &page_keys);
 1450 
 1451                 return TRUE;
 1452             }
 1453             if (strcmp(keyname, "Quit") == 0) {
 1454                 process_keys(GLOBAL_QUIT, keys, &attachment_keys);
 1455                 process_keys(GLOBAL_QUIT, keys, &feed_post_process_keys);
 1456                 process_keys(GLOBAL_QUIT, keys, &feed_supersede_article_keys);
 1457                 process_keys(GLOBAL_QUIT, keys, &feed_type_keys);
 1458                 process_keys(GLOBAL_QUIT, keys, &filter_keys);
 1459                 process_keys(GLOBAL_QUIT, keys, &group_keys);
 1460                 process_keys(GLOBAL_QUIT, keys, &info_keys);
 1461                 process_keys(GLOBAL_QUIT, keys, &option_menu_keys);
 1462                 process_keys(GLOBAL_QUIT, keys, &page_keys);
 1463                 process_keys(GLOBAL_QUIT, keys, &post_hist_keys);
 1464 #ifdef HAVE_PGP_GPG
 1465                 process_keys(GLOBAL_QUIT, keys, &pgp_mail_keys);
 1466                 process_keys(GLOBAL_QUIT, keys, &pgp_news_keys);
 1467 #endif /* HAVE_PGP_GPG */
 1468                 process_keys(GLOBAL_QUIT, keys, &post_cancel_keys);
 1469                 process_keys(GLOBAL_QUIT, keys, &post_continue_keys);
 1470                 process_keys(GLOBAL_QUIT, keys, &post_delete_keys);
 1471                 process_keys(GLOBAL_QUIT, keys, &post_edit_keys);
 1472                 process_keys(GLOBAL_QUIT, keys, &post_edit_ext_keys);
 1473                 process_keys(GLOBAL_QUIT, keys, &post_ignore_fupto_keys);
 1474                 process_keys(GLOBAL_QUIT, keys, &post_mail_fup_keys);
 1475                 process_keys(GLOBAL_QUIT, keys, &post_post_keys);
 1476                 process_keys(GLOBAL_QUIT, keys, &post_postpone_keys);
 1477                 process_keys(GLOBAL_QUIT, keys, &post_send_keys);
 1478                 process_keys(GLOBAL_QUIT, keys, &prompt_keys);
 1479                 process_keys(GLOBAL_QUIT, keys, &save_append_overwrite_keys);
 1480                 process_keys(GLOBAL_QUIT, keys, &scope_keys);
 1481                 process_keys(GLOBAL_QUIT, keys, &select_keys);
 1482                 process_keys(GLOBAL_QUIT, keys, &thread_keys);
 1483                 process_keys(GLOBAL_QUIT, keys, &url_keys);
 1484 
 1485                 return TRUE;
 1486             }
 1487             if (strcmp(keyname, "QuitTin") == 0) {
 1488                 process_keys(GLOBAL_QUIT_TIN, keys, &group_keys);
 1489                 process_keys(GLOBAL_QUIT_TIN, keys, &page_keys);
 1490                 process_keys(GLOBAL_QUIT_TIN, keys, &select_keys);
 1491                 process_keys(GLOBAL_QUIT_TIN, keys, &thread_keys);
 1492 
 1493                 return TRUE;
 1494             }
 1495             break;
 1496 
 1497         case 'R':
 1498             if (strcmp(keyname, "RedrawScr") == 0) {
 1499                 process_keys(GLOBAL_REDRAW_SCREEN, keys, &attachment_keys);
 1500                 process_keys(GLOBAL_REDRAW_SCREEN, keys, &group_keys);
 1501                 process_keys(GLOBAL_REDRAW_SCREEN, keys, &option_menu_keys);
 1502                 process_keys(GLOBAL_REDRAW_SCREEN, keys, &page_keys);
 1503                 process_keys(GLOBAL_REDRAW_SCREEN, keys, &scope_keys);
 1504                 process_keys(GLOBAL_REDRAW_SCREEN, keys, &select_keys);
 1505                 process_keys(GLOBAL_REDRAW_SCREEN, keys, &thread_keys);
 1506 
 1507                 return TRUE;
 1508             }
 1509             break;
 1510 
 1511         case 'S':
 1512             if (strcmp(keyname, "SaveAppendFile") == 0) {
 1513                 process_keys(SAVE_APPEND_FILE, keys, &save_append_overwrite_keys);
 1514 
 1515                 return TRUE;
 1516             }
 1517             if (strcmp(keyname, "SaveOverwriteFile") == 0) {
 1518                 process_keys(SAVE_OVERWRITE_FILE, keys, &save_append_overwrite_keys);
 1519 
 1520                 return TRUE;
 1521             }
 1522             if (strcmp(keyname, "ScopeAdd") == 0) {
 1523                 process_keys(SCOPE_ADD, keys, &scope_keys);
 1524 
 1525                 return TRUE;
 1526             }
 1527             if (strcmp(keyname, "ScopeDelete") == 0) {
 1528                 process_keys(SCOPE_DELETE, keys, &scope_keys);
 1529 
 1530                 return TRUE;
 1531             }
 1532             if (strcmp(keyname, "ScopeEditAttributesFile") == 0) {
 1533                 process_keys(SCOPE_EDIT_ATTRIBUTES_FILE, keys, &scope_keys);
 1534 
 1535                 return TRUE;
 1536             }
 1537             if (strcmp(keyname, "ScopeMove") == 0) {
 1538                 process_keys(SCOPE_MOVE, keys, &scope_keys);
 1539 
 1540                 return TRUE;
 1541             }
 1542             if (strcmp(keyname, "ScopeRename") == 0) {
 1543                 process_keys(SCOPE_RENAME, keys, &scope_keys);
 1544 
 1545                 return TRUE;
 1546             }
 1547             if (strcmp(keyname, "ScopeSelect") == 0) {
 1548                 process_keys(SCOPE_SELECT, keys, &scope_keys);
 1549 
 1550                 return TRUE;
 1551             }
 1552             if (strcmp(keyname, "ScrollDown") == 0) {
 1553                 process_keys(GLOBAL_SCROLL_DOWN, keys, &attachment_keys);
 1554                 process_keys(GLOBAL_SCROLL_DOWN, keys, &group_keys);
 1555                 process_keys(GLOBAL_SCROLL_DOWN, keys, &option_menu_keys);
 1556                 process_keys(GLOBAL_SCROLL_DOWN, keys, &post_hist_keys);
 1557                 process_keys(GLOBAL_SCROLL_DOWN, keys, &scope_keys);
 1558                 process_keys(GLOBAL_SCROLL_DOWN, keys, &select_keys);
 1559                 process_keys(GLOBAL_SCROLL_DOWN, keys, &thread_keys);
 1560                 process_keys(GLOBAL_SCROLL_DOWN, keys, &url_keys);
 1561 
 1562                 return TRUE;
 1563             }
 1564             if (strcmp(keyname, "ScrollUp") == 0) {
 1565                 process_keys(GLOBAL_SCROLL_UP, keys, &attachment_keys);
 1566                 process_keys(GLOBAL_SCROLL_UP, keys, &group_keys);
 1567                 process_keys(GLOBAL_SCROLL_UP, keys, &option_menu_keys);
 1568                 process_keys(GLOBAL_SCROLL_UP, keys, &post_hist_keys);
 1569                 process_keys(GLOBAL_SCROLL_UP, keys, &scope_keys);
 1570                 process_keys(GLOBAL_SCROLL_UP, keys, &select_keys);
 1571                 process_keys(GLOBAL_SCROLL_UP, keys, &thread_keys);
 1572                 process_keys(GLOBAL_SCROLL_UP, keys, &url_keys);
 1573 
 1574                 return TRUE;
 1575             }
 1576             if (strcmp(keyname, "SearchAuthB") == 0) {
 1577                 process_keys(GLOBAL_SEARCH_AUTHOR_BACKWARD, keys, &group_keys);
 1578                 process_keys(GLOBAL_SEARCH_AUTHOR_BACKWARD, keys, &page_keys);
 1579                 process_keys(GLOBAL_SEARCH_AUTHOR_BACKWARD, keys, &thread_keys);
 1580 
 1581                 return TRUE;
 1582             }
 1583             if (strcmp(keyname, "SearchAuthF") == 0) {
 1584                 process_keys(GLOBAL_SEARCH_AUTHOR_FORWARD, keys, &group_keys);
 1585                 process_keys(GLOBAL_SEARCH_AUTHOR_FORWARD, keys, &page_keys);
 1586                 process_keys(GLOBAL_SEARCH_AUTHOR_FORWARD, keys, &thread_keys);
 1587 
 1588                 return TRUE;
 1589             }
 1590             if (strcmp(keyname, "SearchBody") == 0) {
 1591                 process_keys(GLOBAL_SEARCH_BODY, keys, &group_keys);
 1592                 process_keys(GLOBAL_SEARCH_BODY, keys, &page_keys);
 1593                 process_keys(GLOBAL_SEARCH_BODY, keys, &thread_keys);
 1594 
 1595                 return TRUE;
 1596             }
 1597             if (strcmp(keyname, "SearchRepeat") == 0) {
 1598                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &attachment_keys);
 1599                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &group_keys);
 1600                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &info_keys);
 1601                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &option_menu_keys);
 1602                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &page_keys);
 1603                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &post_hist_keys);
 1604                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &select_keys);
 1605                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &thread_keys);
 1606                 process_keys(GLOBAL_SEARCH_REPEAT, keys, &url_keys);
 1607 
 1608                 return TRUE;
 1609             }
 1610             if (strcmp(keyname, "SearchSubjB") == 0) {
 1611                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &attachment_keys);
 1612                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &group_keys);
 1613                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &info_keys);
 1614                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &option_menu_keys);
 1615                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &page_keys);
 1616                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &post_hist_keys);
 1617                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &select_keys);
 1618                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &thread_keys);
 1619                 process_keys(GLOBAL_SEARCH_SUBJECT_BACKWARD, keys, &url_keys);
 1620 
 1621                 return TRUE;
 1622             }
 1623             if (strcmp(keyname, "SearchSubjF") == 0) {
 1624                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &attachment_keys);
 1625                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &group_keys);
 1626                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &info_keys);
 1627                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &option_menu_keys);
 1628                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &page_keys);
 1629                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &post_hist_keys);
 1630                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &select_keys);
 1631                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &thread_keys);
 1632                 process_keys(GLOBAL_SEARCH_SUBJECT_FORWARD, keys, &url_keys);
 1633 
 1634                 return TRUE;
 1635             }
 1636             if (strcmp(keyname, "SelectEnterNextUnreadGrp") == 0) {
 1637                 process_keys(SELECT_ENTER_NEXT_UNREAD_GROUP, keys, &select_keys);
 1638 
 1639                 return TRUE;
 1640             }
 1641             if (strcmp(keyname, "SelectGoto") == 0) {
 1642                 process_keys(SELECT_GOTO, keys, &select_keys);
 1643 
 1644                 return TRUE;
 1645             }
 1646             if (strcmp(keyname, "SelectMarkGrpUnread") == 0) {
 1647                 process_keys(SELECT_MARK_GROUP_UNREAD, keys, &select_keys);
 1648 
 1649                 return TRUE;
 1650             }
 1651             if (strcmp(keyname, "SelectMoveGrp") == 0) {
 1652                 process_keys(SELECT_MOVE_GROUP, keys, &select_keys);
 1653 
 1654                 return TRUE;
 1655             }
 1656             if (strcmp(keyname, "SelectNextUnreadGrp") == 0) {
 1657                 process_keys(SELECT_NEXT_UNREAD_GROUP, keys, &select_keys);
 1658 
 1659                 return TRUE;
 1660             }
 1661             if (strcmp(keyname, "SelectQuitNoWrite") == 0) {
 1662                 process_keys(SELECT_QUIT_NO_WRITE, keys, &select_keys);
 1663 
 1664                 return TRUE;
 1665             }
 1666             if (strcmp(keyname, "SelectReadGrp") == 0) {
 1667                 process_keys(SELECT_ENTER_GROUP, keys, &select_keys);
 1668 
 1669                 return TRUE;
 1670             }
 1671             if (strcmp(keyname, "SelectResetNewsrc") == 0) {
 1672                 process_keys(SELECT_RESET_NEWSRC, keys, &select_keys);
 1673 
 1674                 return TRUE;
 1675             }
 1676             if (strcmp(keyname, "SelectSortActive") == 0) {
 1677                 process_keys(SELECT_SORT_ACTIVE, keys, &select_keys);
 1678 
 1679                 return TRUE;
 1680             }
 1681             if (strcmp(keyname, "SelectSubscribe") == 0) {
 1682                 process_keys(SELECT_SUBSCRIBE, keys, &select_keys);
 1683 
 1684                 return TRUE;
 1685             }
 1686             if (strcmp(keyname, "SelectSubscribePat") == 0) {
 1687                 process_keys(SELECT_SUBSCRIBE_PATTERN, keys, &select_keys);
 1688 
 1689                 return TRUE;
 1690             }
 1691             if (strcmp(keyname, "SelectSyncWithActive") == 0) {
 1692                 process_keys(SELECT_SYNC_WITH_ACTIVE, keys, &select_keys);
 1693 
 1694                 return TRUE;
 1695             }
 1696             if (strcmp(keyname, "SelectToggleDescriptions") == 0) {
 1697                 process_keys(SELECT_TOGGLE_DESCRIPTIONS, keys, &select_keys);
 1698 
 1699                 return TRUE;
 1700             }
 1701             if (strcmp(keyname, "SelectToggleReadDisplay") == 0) {
 1702                 process_keys(SELECT_TOGGLE_READ_DISPLAY, keys, &select_keys);
 1703 
 1704                 return TRUE;
 1705             }
 1706             if (strcmp(keyname, "SelectUnsubscribe") == 0) {
 1707                 process_keys(SELECT_UNSUBSCRIBE, keys, &select_keys);
 1708 
 1709                 return TRUE;
 1710             }
 1711             if (strcmp(keyname, "SelectUnsubscribePat") == 0) {
 1712                 process_keys(SELECT_UNSUBSCRIBE_PATTERN, keys, &select_keys);
 1713 
 1714                 return TRUE;
 1715             }
 1716             if (strcmp(keyname, "SelectYankActive") == 0) {
 1717                 process_keys(SELECT_YANK_ACTIVE, keys, &select_keys);
 1718 
 1719                 return TRUE;
 1720             }
 1721             if (strcmp(keyname, "SetRange") == 0) {
 1722                 process_keys(GLOBAL_SET_RANGE, keys, &group_keys);
 1723                 process_keys(GLOBAL_SET_RANGE, keys, &select_keys);
 1724                 process_keys(GLOBAL_SET_RANGE, keys, &thread_keys);
 1725 
 1726                 return TRUE;
 1727             }
 1728             if (strcmp(keyname, "ShellEscape") == 0) {
 1729 #ifndef NO_SHELL_ESCAPE
 1730                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &attachment_keys);
 1731                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &group_keys);
 1732                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &option_menu_keys);
 1733                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &page_keys);
 1734                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &post_hist_keys);
 1735                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &scope_keys);
 1736                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &select_keys);
 1737                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &thread_keys);
 1738                 process_keys(GLOBAL_SHELL_ESCAPE, keys, &url_keys);
 1739 #endif /* !NO_SHELL_ESCAPE */
 1740 
 1741                 return TRUE;
 1742             }
 1743             break;
 1744 
 1745         case 'T':
 1746             if (strcmp(keyname, "ThreadAutoSave") == 0) {
 1747                 process_keys(THREAD_AUTOSAVE, keys, &thread_keys);
 1748 
 1749                 return TRUE;
 1750             }
 1751             if (strcmp(keyname, "ThreadCancel") == 0) {
 1752                 process_keys(THREAD_CANCEL, keys, &thread_keys);
 1753 
 1754                 return TRUE;
 1755             }
 1756             if (strcmp(keyname, "ThreadMail") == 0) {
 1757                 process_keys(THREAD_MAIL, keys, &thread_keys);
 1758 
 1759                 return TRUE;
 1760             }
 1761             if (strcmp(keyname, "ThreadMarkArtRead") == 0) {
 1762                 process_keys(THREAD_MARK_ARTICLE_READ, keys, &thread_keys);
 1763 
 1764                 return TRUE;
 1765             }
 1766             if (strcmp(keyname, "ThreadReadArt") == 0) {
 1767                 process_keys(THREAD_READ_ARTICLE, keys, &thread_keys);
 1768 
 1769                 return TRUE;
 1770             }
 1771             if (strcmp(keyname, "ThreadReadNextArtOrThread") == 0) {
 1772                 process_keys(THREAD_READ_NEXT_ARTICLE_OR_THREAD, keys, &thread_keys);
 1773 
 1774                 return TRUE;
 1775             }
 1776             if (strcmp(keyname, "ThreadReverseSel") == 0) {
 1777                 process_keys(THREAD_REVERSE_SELECTIONS, keys, &thread_keys);
 1778 
 1779                 return TRUE;
 1780             }
 1781             if (strcmp(keyname, "ThreadSave") == 0) {
 1782                 process_keys(THREAD_SAVE, keys, &thread_keys);
 1783 
 1784                 return TRUE;
 1785             }
 1786             if (strcmp(keyname, "ThreadSelArt") == 0) {
 1787                 process_keys(THREAD_SELECT_ARTICLE, keys, &thread_keys);
 1788 
 1789                 return TRUE;
 1790             }
 1791             if (strcmp(keyname, "ThreadTag") == 0) {
 1792                 process_keys(THREAD_TAG, keys, &thread_keys);
 1793 
 1794                 return TRUE;
 1795             }
 1796             if (strcmp(keyname, "ThreadTagParts") == 0) {
 1797                 process_keys(THREAD_TAG_PARTS, keys, &thread_keys);
 1798 
 1799                 return TRUE;
 1800             }
 1801             if (strcmp(keyname, "ThreadToggleArtSel") == 0) {
 1802                 process_keys(THREAD_TOGGLE_ARTICLE_SELECTION, keys, &thread_keys);
 1803 
 1804                 return TRUE;
 1805             }
 1806             if (strcmp(keyname, "ThreadToggleSubjDisplay") == 0) {
 1807                 process_keys(THREAD_TOGGLE_SUBJECT_DISPLAY, keys, &thread_keys);
 1808 
 1809                 return TRUE;
 1810             }
 1811             if (strcmp(keyname, "ThreadUndoSel") == 0) {
 1812                 process_keys(THREAD_UNDO_SELECTIONS, keys, &thread_keys);
 1813 
 1814                 return TRUE;
 1815             }
 1816             if (strcmp(keyname, "ThreadUntag") == 0) {
 1817                 process_keys(THREAD_UNTAG, keys, &thread_keys);
 1818 
 1819                 return TRUE;
 1820             }
 1821             if (strcmp(keyname, "ToggleColor") == 0) {
 1822 #ifdef HAVE_COLOR
 1823                 process_keys(GLOBAL_TOGGLE_COLOR, keys, &group_keys);
 1824                 process_keys(GLOBAL_TOGGLE_COLOR, keys, &page_keys);
 1825                 process_keys(GLOBAL_TOGGLE_COLOR, keys, &select_keys);
 1826                 process_keys(GLOBAL_TOGGLE_COLOR, keys, &thread_keys);
 1827 #endif /* HAVE_COLOR */
 1828 
 1829                 return TRUE;
 1830             }
 1831             if (strcmp(keyname, "ToggleHelpDisplay") == 0) {
 1832                 process_keys(GLOBAL_TOGGLE_HELP_DISPLAY, keys, &attachment_keys);
 1833                 process_keys(GLOBAL_TOGGLE_HELP_DISPLAY, keys, &group_keys);
 1834                 process_keys(GLOBAL_TOGGLE_HELP_DISPLAY, keys, &info_keys);
 1835                 process_keys(GLOBAL_TOGGLE_HELP_DISPLAY, keys, &page_keys);
 1836                 process_keys(GLOBAL_TOGGLE_HELP_DISPLAY, keys, &scope_keys);
 1837                 process_keys(GLOBAL_TOGGLE_HELP_DISPLAY, keys, &select_keys);
 1838                 process_keys(GLOBAL_TOGGLE_HELP_DISPLAY, keys, &thread_keys);
 1839 
 1840                 return TRUE;
 1841             }
 1842             if (strcmp(keyname, "ToggleInfoLastLine") == 0) {
 1843                 process_keys(GLOBAL_TOGGLE_INFO_LAST_LINE, keys, &attachment_keys);
 1844                 process_keys(GLOBAL_TOGGLE_INFO_LAST_LINE, keys, &group_keys);
 1845                 process_keys(GLOBAL_TOGGLE_INFO_LAST_LINE, keys, &page_keys);
 1846                 process_keys(GLOBAL_TOGGLE_INFO_LAST_LINE, keys, &select_keys);
 1847                 process_keys(GLOBAL_TOGGLE_INFO_LAST_LINE, keys, &thread_keys);
 1848 
 1849                 return TRUE;
 1850             }
 1851             if (strcmp(keyname, "ToggleInverseVideo") == 0) {
 1852                 process_keys(GLOBAL_TOGGLE_INVERSE_VIDEO, keys, &group_keys);
 1853                 process_keys(GLOBAL_TOGGLE_INVERSE_VIDEO, keys, &page_keys);
 1854                 process_keys(GLOBAL_TOGGLE_INVERSE_VIDEO, keys, &select_keys);
 1855                 process_keys(GLOBAL_TOGGLE_INVERSE_VIDEO, keys, &thread_keys);
 1856 
 1857                 return TRUE;
 1858             }
 1859             break;
 1860 
 1861         case 'U':
 1862             if (strcmp(keyname, "Up") == 0) {
 1863                 process_keys(GLOBAL_LINE_UP, keys, &attachment_keys);
 1864                 process_keys(GLOBAL_LINE_UP, keys, &group_keys);
 1865                 process_keys(GLOBAL_LINE_UP, keys, &info_keys);
 1866                 process_keys(GLOBAL_LINE_UP, keys, &option_menu_keys);
 1867                 process_keys(GLOBAL_LINE_UP, keys, &page_keys);
 1868                 process_keys(GLOBAL_LINE_UP, keys, &post_hist_keys);
 1869                 process_keys(GLOBAL_LINE_UP, keys, &scope_keys);
 1870                 process_keys(GLOBAL_LINE_UP, keys, &select_keys);
 1871                 process_keys(GLOBAL_LINE_UP, keys, &thread_keys);
 1872                 process_keys(GLOBAL_LINE_UP, keys, &url_keys);
 1873 
 1874                 return TRUE;
 1875             }
 1876             if (strcmp(keyname, "UrlSelect") == 0) {
 1877                 process_keys(URL_SELECT, keys, &url_keys);
 1878 
 1879                 return TRUE;
 1880             }
 1881             break;
 1882 
 1883         case 'V':
 1884             if (strcmp(keyname, "Version") == 0) {
 1885                 process_keys(GLOBAL_VERSION, keys, &group_keys);
 1886                 process_keys(GLOBAL_VERSION, keys, &page_keys);
 1887                 process_keys(GLOBAL_VERSION, keys, &select_keys);
 1888                 process_keys(GLOBAL_VERSION, keys, &thread_keys);
 1889 
 1890                 return TRUE;
 1891             }
 1892             break;
 1893 
 1894         default:
 1895             break;
 1896     }
 1897 
 1898     return FALSE;
 1899 }
 1900 
 1901 
 1902 /*
 1903  * upgrades the keymap file to the current version
 1904  */
 1905 static void
 1906 upgrade_keymap_file(
 1907     char *old)
 1908 {
 1909     FILE *oldfp, *newfp;
 1910     char *line, *backup;
 1911     const char *keyname, *keydef;
 1912     char newk[NAME_LEN + 1], buf[LEN];
 1913     char *bugreport[3] = { NULL, NULL, NULL };
 1914     char *catchup[4] = { NULL, NULL, NULL, NULL };
 1915     char *catchup_next_unread[4] = { NULL, NULL, NULL, NULL };
 1916     char *config_select[2] = { NULL, NULL };
 1917     char *edit_filter[2] = { NULL, NULL };
 1918     char *down[2] = { NULL, NULL };
 1919     char *groupreadbasenote[2] = { NULL, NULL };
 1920     char *mark_article_unread[3] = { NULL, NULL, NULL };
 1921     char *mark_thread_unread[3] = { NULL, NULL, NULL };
 1922     char *menu_filter_kill[3] = { NULL, NULL, NULL };
 1923     char *menu_filter_select[3] = { NULL, NULL, NULL };
 1924     char *pagedown[3] = { NULL, NULL, NULL };
 1925     char *pagenextthd[2] = { NULL, NULL };
 1926     char *pageup[3] = { NULL, NULL, NULL };
 1927     char *postponed[2] = { NULL, NULL };
 1928     char *postpost[3] = { NULL, NULL, NULL };
 1929     char *postsend[2] = { NULL, NULL };
 1930     char *quick_filter_kill[2] = { NULL, NULL };
 1931     char *quick_filter_select[2] = { NULL, NULL };
 1932     char *selectentergroup[2] = { NULL, NULL };
 1933     char *selectmarkgrpunread[2] = { NULL, NULL };
 1934     char *selectreadgrp[2] = { NULL, NULL };
 1935     char *threadreadart[2] = { NULL, NULL };
 1936     char *up[2] = { NULL, NULL };
 1937 
 1938     if ((oldfp = fopen(old, "r")) == NULL)
 1939         return;
 1940 
 1941     snprintf(newk, sizeof(newk), "%s.%ld", old, (long) process_id);
 1942     if ((newfp = fopen(newk, "w")) == NULL) {
 1943         fclose(oldfp);
 1944         return;
 1945     }
 1946     fprintf(newfp, "# Keymap file V%s for the TIN newsreader\n", KEYMAP_VERSION);
 1947 
 1948     forever {
 1949         line = fgets(buf, sizeof(buf), oldfp);
 1950 
 1951         if (line == NULL || line[0] == '\n') {
 1952             /*
 1953              * we are at the end of a block or file
 1954              * write out the merged lines (if available)
 1955              */
 1956             if (config_select[0] || config_select[1]) {
 1957                 fprintf(newfp, "ConfigSelect\t\t");
 1958                 if (config_select[0])
 1959                     fprintf(newfp, "\t%s", config_select[0]);
 1960                 if (config_select[1])
 1961                     fprintf(newfp, "\t%s", config_select[1]);
 1962                 fprintf(newfp, "\n");
 1963                 FreeAndNull(config_select[0]);
 1964                 FreeAndNull(config_select[1]);
 1965             }
 1966             if (down[0] || down[1]) {
 1967                 fprintf(newfp, "Down\t\t\t");
 1968                 if (down[0])
 1969                     fprintf(newfp, "\t%s", down[0]);
 1970                 if (down[1])
 1971                     fprintf(newfp, "\t%s", down[1]);
 1972                 fprintf(newfp, "\n");
 1973                 FreeAndNull(down[0]);
 1974                 FreeAndNull(down[1]);
 1975             }
 1976             if (groupreadbasenote[0] || groupreadbasenote[1]) {
 1977                 fprintf(newfp, "GroupReadBasenote\t");
 1978                 if (groupreadbasenote[0])
 1979                     fprintf(newfp, "\t%s", groupreadbasenote[0]);
 1980                 if (groupreadbasenote[1])
 1981                     fprintf(newfp, "\t%s", groupreadbasenote[1]);
 1982                 fprintf(newfp, "\n");
 1983                 FreeAndNull(groupreadbasenote[0]);
 1984                 FreeAndNull(groupreadbasenote[1]);
 1985             }
 1986             if (pagedown[0] || pagedown[1] || pagedown[2]) {
 1987                 fprintf(newfp, "PageDown\t\t");
 1988                 if (pagedown[0])
 1989                     fprintf(newfp, "\t%s", pagedown[0]);
 1990                 if (pagedown[1])
 1991                     fprintf(newfp, "\t%s", pagedown[1]);
 1992                 if (pagedown[2])
 1993                     fprintf(newfp, "\t%s", pagedown[2]);
 1994                 fprintf(newfp, "\n");
 1995                 FreeAndNull(pagedown[0]);
 1996                 FreeAndNull(pagedown[1]);
 1997                 FreeAndNull(pagedown[2]);
 1998             }
 1999             if (pagenextthd[0] || pagenextthd[1]) {
 2000                 fprintf(newfp, "PageNextThd\t\t");
 2001                 if (pagenextthd[0])
 2002                     fprintf(newfp, "\t%s", pagenextthd[0]);
 2003                 if (pagenextthd[1])
 2004                     fprintf(newfp, "\t%s", pagenextthd[1]);
 2005                 fprintf(newfp, "\n");
 2006                 FreeAndNull(pagenextthd[0]);
 2007                 FreeAndNull(pagenextthd[1]);
 2008             }
 2009             if (pageup[0] || pageup[1] || pageup[2]) {
 2010                 fprintf(newfp, "PageUp\t\t\t");
 2011                 if (pageup[0])
 2012                     fprintf(newfp, "\t%s", pageup[0]);
 2013                 if (pageup[1])
 2014                     fprintf(newfp, "\t%s", pageup[1]);
 2015                 if (pageup[2])
 2016                     fprintf(newfp, "\t%s", pageup[2]);
 2017                 fprintf(newfp, "\n");
 2018                 FreeAndNull(pageup[0]);
 2019                 FreeAndNull(pageup[1]);
 2020                 FreeAndNull(pageup[2]);
 2021             }
 2022             if (postponed[0] || postponed[1]) {
 2023                 fprintf(newfp, "Postponed\t\t");
 2024                 if (postponed[0])
 2025                     fprintf(newfp, "\t%s", postponed[0]);
 2026                 if (postponed[1])
 2027                     fprintf(newfp, "\t%s", postponed[1]);
 2028                 fprintf(newfp, "\n");
 2029                 FreeAndNull(postponed[0]);
 2030                 FreeAndNull(postponed[1]);
 2031             }
 2032             if (postpost[0] || postpost[1] || postpost[2]) {
 2033                 fprintf(newfp, "PostPost\t\t");
 2034                 if (postpost[0])
 2035                     fprintf(newfp, "\t%s", postpost[0]);
 2036                 if (postpost[1])
 2037                     fprintf(newfp, "\t%s", postpost[1]);
 2038                 if (postpost[2])
 2039                     fprintf(newfp, "\t%s", postpost[2]);
 2040                 fprintf(newfp, "\n");
 2041                 FreeAndNull(postpost[0]);
 2042                 FreeAndNull(postpost[1]);
 2043                 FreeAndNull(postpost[2]);
 2044             }
 2045             if (postsend[0] || postsend[1]) {
 2046                 fprintf(newfp, "PostSend\t\t");
 2047                 if (postsend[0])
 2048                     fprintf(newfp, "\t%s", postsend[0]);
 2049                 if (postsend[1])
 2050                     fprintf(newfp, "\t%s", postsend[1]);
 2051                 fprintf(newfp, "\n");
 2052                 FreeAndNull(postsend[0]);
 2053                 FreeAndNull(postsend[1]);
 2054             }
 2055             if (selectentergroup[0] || selectentergroup[1]) {
 2056                 fprintf(newfp, "SelectEnterNextUnreadGrp");
 2057                 if (selectentergroup[0])
 2058                     fprintf(newfp, "\t%s", selectentergroup[0]);
 2059                 if (selectentergroup[1])
 2060                     fprintf(newfp, "\t%s", selectentergroup[1]);
 2061                 fprintf(newfp, "\n");
 2062                 FreeAndNull(selectentergroup[0]);
 2063                 FreeAndNull(selectentergroup[1]);
 2064             }
 2065             if (selectmarkgrpunread[0] || selectmarkgrpunread[1]) {
 2066                 fprintf(newfp, "SelectMarkGrpUnread\t");
 2067                 if (selectmarkgrpunread[0])
 2068                     fprintf(newfp, "\t%s", selectmarkgrpunread[0]);
 2069                 if (selectmarkgrpunread[1])
 2070                     fprintf(newfp, "\t%s", selectmarkgrpunread[1]);
 2071                 fprintf(newfp, "\n");
 2072                 FreeAndNull(selectmarkgrpunread[0]);
 2073                 FreeAndNull(selectmarkgrpunread[1]);
 2074             }
 2075             if (selectreadgrp[0] || selectreadgrp[1]) {
 2076                 fprintf(newfp, "SelectReadGrp\t\t");
 2077                 if (selectreadgrp[0])
 2078                     fprintf(newfp, "\t%s", selectreadgrp[0]);
 2079                 if (selectreadgrp[1])
 2080                     fprintf(newfp, "\t%s", selectreadgrp[1]);
 2081                 fprintf(newfp, "\n");
 2082                 FreeAndNull(selectreadgrp[0]);
 2083                 FreeAndNull(selectreadgrp[1]);
 2084             }
 2085             if (threadreadart[0] || threadreadart[1]) {
 2086                 fprintf(newfp, "ThreadReadArt\t\t");
 2087                 if (threadreadart[0])
 2088                     fprintf(newfp, "\t%s", threadreadart[0]);
 2089                 if (threadreadart[1])
 2090                     fprintf(newfp, "\t%s", threadreadart[1]);
 2091                 fprintf(newfp, "\n");
 2092                 FreeAndNull(threadreadart[0]);
 2093                 FreeAndNull(threadreadart[1]);
 2094             }
 2095             if (up[0] || up[1]) {
 2096                 fprintf(newfp, "Up\t\t\t");
 2097                 if (up[0])
 2098                     fprintf(newfp, "\t%s", up[0]);
 2099                 if (up[1])
 2100                     fprintf(newfp, "\t%s", up[1]);
 2101                 fprintf(newfp, "\n");
 2102                 FreeAndNull(up[0]);
 2103                 FreeAndNull(up[1]);
 2104             }
 2105             if (line == NULL)
 2106                 break;  /* jump out of the while loop */
 2107             else {
 2108                 fprintf(newfp, "\n");
 2109                 continue;
 2110             }
 2111         }
 2112 
 2113         if (line[0] == '#') {
 2114             if (strncmp(line, "# Keymap file V", strlen("# Keymap file V")) != 0)
 2115                 fprintf(newfp, "%s", line);
 2116             continue;
 2117         }
 2118 
 2119         backup = my_strdup(line);
 2120 
 2121         if ((keyname = strsep(&line, KEYSEPS)) == NULL) {
 2122             free(backup);
 2123             continue;
 2124         }
 2125         if ((keydef = str_trim(line)) == NULL)
 2126             keydef = "";
 2127 
 2128         switch (keyname[0]) {
 2129             case 'C':
 2130                 if (strcmp(keyname, "ConfigFirstPage2") == 0)
 2131                     fprintf(newfp, "ConfigFirstPage\t\t\t%s\n", keydef);
 2132                 else if (strcmp(keyname, "ConfigLastPage2") == 0)
 2133                     fprintf(newfp, "ConfigLastPage\t\t\t%s\n", keydef);
 2134                 else if (strcmp(keyname, "ConfigSelect") == 0)
 2135                     config_select[0] = my_strdup(keydef);
 2136                 else if (strcmp(keyname, "ConfigSelect2") == 0)
 2137                     config_select[1] = my_strdup(keydef);
 2138                 else
 2139                     fprintf(newfp, "%s", backup);
 2140                 break;
 2141 
 2142             case 'D':
 2143                 if (strcmp(keyname, "Down") == 0)
 2144                     down[0] = my_strdup(keydef);
 2145                 else if (strcmp(keyname, "Down2") == 0)
 2146                     down[1] = my_strdup(keydef);
 2147                 else
 2148                     fprintf(newfp, "%s", backup);
 2149                 break;
 2150 
 2151             case 'G':
 2152                 if (strcmp(keyname, "GroupAutoSel") == 0)
 2153                     menu_filter_select[0] = my_strdup(keydef);
 2154                 else if (strcmp(keyname, "GroupQuickAutoSel") == 0)
 2155                     quick_filter_select[0] = my_strdup(keydef);
 2156                 else if (strcmp(keyname, "GroupQuickKill") == 0)
 2157                     quick_filter_kill[0] = my_strdup(keydef);
 2158                 else if (strcmp(keyname, "GroupKill") == 0)
 2159                     menu_filter_kill[0] = my_strdup(keydef);
 2160                 else if (strcmp(keyname, "GroupReadBasenote") == 0)
 2161                     groupreadbasenote[0] = my_strdup(keydef);
 2162                 else if (strcmp(keyname, "GroupReadBasenote2") == 0)
 2163                     groupreadbasenote[1] = my_strdup(keydef);
 2164                 else if (strcmp(keyname, "GroupEditFilter") == 0)
 2165                     edit_filter[0] = my_strdup(keydef);
 2166                 else if (strcmp(keyname, "GroupBugReport") == 0)
 2167                     bugreport[0] = my_strdup(keydef);
 2168                 else if (strcmp(keyname, "GroupMarkArtUnread") == 0)
 2169                     mark_article_unread[0] = my_strdup(keydef);
 2170                 else if (strcmp(keyname, "GroupMarkThdUnread") == 0)
 2171                     mark_thread_unread[0] = my_strdup(keydef);
 2172                 else if (strcmp(keyname, "GroupCatchup") == 0)
 2173                     catchup[0] = my_strdup(keydef);
 2174                 else if (strcmp(keyname, "GroupCatchupNextUnread") == 0)
 2175                     catchup_next_unread[0] = my_strdup(keydef);
 2176                 else
 2177                     fprintf(newfp, "%s", backup);
 2178                 break;
 2179 
 2180             case 'H':
 2181                 if (strcmp(keyname, "HelpFirstPage2") == 0)
 2182                     fprintf(newfp, "HelpFirstPage\t\t\t%s\n", keydef);
 2183                 else if (strcmp(keyname, "HelpLastPage2") == 0)
 2184                     fprintf(newfp, "HelpLastPage\t\t\t%s\n", keydef);
 2185                 else
 2186                     fprintf(newfp, "%s", backup);
 2187                 break;
 2188 
 2189             case 'N':
 2190                 /* Nrc* got removed */
 2191                 if (strcmp(keyname, "NrctblCreate") == 0)
 2192                     ;
 2193                 else if (strcmp(keyname, "NrctblDefault") == 0)
 2194                     ;
 2195                 else if (strcmp(keyname, "NrctblAlternative") == 0)
 2196                     ;
 2197                 else if (strcmp(keyname, "NrctblQuit") == 0)
 2198                     ;
 2199                 else
 2200                     fprintf(newfp, "%s", backup);
 2201                 break;
 2202 
 2203             case 'P':
 2204                 if (strcmp(keyname, "PageAutoSel") == 0)
 2205                     menu_filter_select[1] = my_strdup(keydef);
 2206                 else if (strcmp(keyname, "PageQuickAutoSel") == 0)
 2207                     quick_filter_select[1] = my_strdup(keydef);
 2208                 else if (strcmp(keyname, "PageQuickKill") == 0)
 2209                     quick_filter_kill[1] = my_strdup(keydef);
 2210                 else if (strcmp(keyname, "PageAutoKill") == 0)
 2211                     menu_filter_kill[1] = my_strdup(keydef);
 2212                 else if (strcmp(keyname, "PageDown") == 0)
 2213                     pagedown[0] = my_strdup(keydef);
 2214                 else if (strcmp(keyname, "PageDown2") == 0)
 2215                     pagedown[1] = my_strdup(keydef);
 2216                 else if (strcmp(keyname, "PageDown3") == 0)
 2217                     pagedown[2] = my_strdup(keydef);
 2218                 else if (strcmp(keyname, "PageEditFilter") == 0)
 2219                     edit_filter[1] = my_strdup(keydef);
 2220                 else if (strcmp(keyname, "PageNextThd") == 0)
 2221                     pagenextthd[0] = my_strdup(keydef);
 2222                 else if (strcmp(keyname, "PageNextThd2") == 0)
 2223                     pagenextthd[1] = my_strdup(keydef);
 2224                 else if (strcmp(keyname, "PageUp") == 0)
 2225                     pageup[0] = my_strdup(keydef);
 2226                 else if (strcmp(keyname, "PageUp2") == 0)
 2227                     pageup[1] = my_strdup(keydef);
 2228                 else if (strcmp(keyname, "PageUp3") == 0)
 2229                     pageup[2] = my_strdup(keydef);
 2230                 else if (strcmp(keyname, "Postponed") == 0)
 2231                     postponed[0] = my_strdup(keydef);
 2232                 else if (strcmp(keyname, "Postponed2") == 0)
 2233                     postponed[1] = my_strdup(keydef);
 2234                 else if (strcmp(keyname, "PostPost") == 0)
 2235                     postpost[0] = my_strdup(keydef);
 2236                 else if (strcmp(keyname, "PostPost2") == 0)
 2237                     postpost[1] = my_strdup(keydef);
 2238                 else if (strcmp(keyname, "PostPost3") == 0)
 2239                     postpost[2] = my_strdup(keydef);
 2240                 else if (strcmp(keyname, "PostSend") == 0)
 2241                     postsend[0] = my_strdup(keydef);
 2242                 else if (strcmp(keyname, "PostSend2") == 0)
 2243                     postsend[1] = my_strdup(keydef);
 2244                 else if (strcmp(keyname, "PageMarkArtUnread") == 0)
 2245                     mark_article_unread[1] = my_strdup(keydef);
 2246                 else if (strcmp(keyname, "PageMarkThdUnread") == 0)
 2247                     mark_thread_unread[1] = my_strdup(keydef);
 2248                 else if (strcmp(keyname, "PageCatchup") == 0)
 2249                     catchup[1] = my_strdup(keydef);
 2250                 else if (strcmp(keyname, "PageCatchupNextUnread") == 0)
 2251                     catchup_next_unread[1] = my_strdup(keydef);
 2252                 else if (strcmp(keyname, "PageToggleHeaders") == 0)
 2253                     fprintf(newfp, "PageToggleRaw\t\t\t%s\n", keydef);
 2254                 else if (strcmp(keyname, "PromptNo") == 0 || strcmp(keyname, "PromptYes") == 0) {
 2255                     if (strlen(keydef) == 1 && islower((int)(unsigned char) keydef[0]))
 2256                         fprintf(newfp, "%s\t\t\t%c\t%c\n", keyname, keydef[0], my_toupper((int)(unsigned char) keydef[0]));
 2257                     else
 2258                         fprintf(newfp, "%s", backup);
 2259                 } else
 2260                     fprintf(newfp, "%s", backup);
 2261                 break;
 2262 
 2263             case 'S':
 2264                 if (strcmp(keyname, "SelectEditFilter") == 0)
 2265                     ;
 2266                 else if (strcmp(keyname, "SelectEnterNextUnreadGrp") == 0)
 2267                     selectentergroup[0] = my_strdup(keydef);
 2268                 else if (strcmp(keyname, "SelectEnterNextUnreadGrp2") == 0)
 2269                     selectentergroup[1] = my_strdup(keydef);
 2270                 else if (strcmp(keyname, "SelectMarkGrpUnread") == 0)
 2271                     selectmarkgrpunread[0] = my_strdup(keydef);
 2272                 else if (strcmp(keyname, "SelectMarkGrpUnread2") == 0)
 2273                     selectmarkgrpunread[1] = my_strdup(keydef);
 2274                 else if (strcmp(keyname, "SelectReadGrp") == 0)
 2275                     selectreadgrp[0] = my_strdup(keydef);
 2276                 else if (strcmp(keyname, "SelectReadGrp2") == 0)
 2277                     selectreadgrp[1] = my_strdup(keydef);
 2278                 else if (strcmp(keyname, "SelectBugReport") == 0)
 2279                     bugreport[1] = my_strdup(keydef);
 2280                 else if (strcmp(keyname, "SelectCatchup") == 0)
 2281                     catchup[2] = my_strdup(keydef);
 2282                 else if (strcmp(keyname, "SelectCatchupNextUnread") == 0)
 2283                     catchup_next_unread[2] = my_strdup(keydef);
 2284                 else
 2285                     fprintf(newfp, "%s", backup);
 2286                 break;
 2287 
 2288             case 'T':
 2289                 if (strcmp(keyname, "ThreadEditFilter") == 0)
 2290                     ;
 2291                 else if (strcmp(keyname, "ThreadAutoSel") == 0)
 2292                     menu_filter_select[2] = my_strdup(keydef);
 2293                 else if (strcmp(keyname, "ThreadKill") == 0)
 2294                     menu_filter_kill[2] = my_strdup(keydef);
 2295                 else if (strcmp(keyname, "ThreadReadArt") == 0)
 2296                     threadreadart[0] = my_strdup(keydef);
 2297                 else if (strcmp(keyname, "ThreadReadArt2") == 0)
 2298                     threadreadart[1] = my_strdup(keydef);
 2299                 else if (strcmp(keyname, "ThreadBugReport") == 0)
 2300                     bugreport[2] = my_strdup(keydef);
 2301                 else if (strcmp(keyname, "ThreadMarkArtUnread") == 0)
 2302                     mark_article_unread[2] = my_strdup(keydef);
 2303                 else if (strcmp(keyname, "ThreadMarkThdUnread") == 0)
 2304                     mark_thread_unread[2] = my_strdup(keydef);
 2305                 else if (strcmp(keyname, "ThreadCatchup") == 0)
 2306                     catchup[3] = my_strdup(keydef);
 2307                 else if (strcmp(keyname, "ThreadCatchupNextUnread") == 0)
 2308                     catchup_next_unread[3] = my_strdup(keydef);
 2309                 else
 2310                     fprintf(newfp, "%s", backup);
 2311                 break;
 2312 
 2313             case 'U':
 2314                 if (strcmp(keyname, "Up") == 0)
 2315                     up[0] = my_strdup(keydef);
 2316                 else if (strcmp(keyname, "Up2") == 0)
 2317                     up[1] = my_strdup(keydef);
 2318                 else
 2319                     fprintf(newfp, "%s", backup);
 2320                 break;
 2321 
 2322             default:
 2323                 fprintf(newfp, "%s", backup);
 2324         }
 2325         free(backup);
 2326     }
 2327     fprintf(newfp, "\n#####\n");
 2328     /* joined/renamed keys from different sections */
 2329     if (bugreport[0] || bugreport[1] || bugreport[2]) {
 2330         fprintf(newfp, "BugReport\t");
 2331         if (bugreport[0] && bugreport[1] && !strcmp(bugreport[0], bugreport[1]))
 2332             FreeAndNull(bugreport[1]);
 2333         if (bugreport[0] && bugreport[2] && !strcmp(bugreport[0], bugreport[2]))
 2334             FreeAndNull(bugreport[2]);
 2335         if (bugreport[1] && bugreport[2] && !strcmp(bugreport[1], bugreport[2]))
 2336             FreeAndNull(bugreport[2]);
 2337         if (bugreport[0])
 2338             fprintf(newfp, "\t%s", bugreport[0]);
 2339         if (bugreport[1])
 2340             fprintf(newfp, "\t%s", bugreport[1]);
 2341         if (bugreport[2])
 2342             fprintf(newfp, "\t%s", bugreport[2]);
 2343         fprintf(newfp, "\n");
 2344         FreeAndNull(bugreport[0]);
 2345         FreeAndNull(bugreport[1]);
 2346         FreeAndNull(bugreport[2]);
 2347     }
 2348     if (catchup[0] || catchup[1] || catchup[2] || catchup[3]) {
 2349         fprintf(newfp, "Catchup\t");
 2350         if (catchup[0] && catchup[1] && !strcmp(catchup[0], catchup[1]))
 2351             FreeAndNull(catchup[1]);
 2352         if (catchup[0] && catchup[2] && !strcmp(catchup[0], catchup[2]))
 2353             FreeAndNull(catchup[2]);
 2354         if (catchup[0] && catchup[3] && !strcmp(catchup[0], catchup[3]))
 2355             FreeAndNull(catchup[3]);
 2356         if (catchup[1] && catchup[2] && !strcmp(catchup[1], catchup[2]))
 2357             FreeAndNull(catchup[2]);
 2358         if (catchup[1] && catchup[3] && !strcmp(catchup[1], catchup[3]))
 2359             FreeAndNull(catchup[3]);
 2360         if (catchup[2] && catchup[3] && !strcmp(catchup[2], catchup[3]))
 2361             FreeAndNull(catchup[3]);
 2362         if (catchup[0])
 2363             fprintf(newfp, "\t%s", catchup[0]);
 2364         if (catchup[1])
 2365             fprintf(newfp, "\t%s", catchup[1]);
 2366         if (catchup[2])
 2367             fprintf(newfp, "\t%s", catchup[2]);
 2368         if (catchup[3])
 2369             fprintf(newfp, "\t%s", catchup[3]);
 2370         fprintf(newfp, "\n");
 2371         FreeAndNull(catchup[0]);
 2372         FreeAndNull(catchup[1]);
 2373         FreeAndNull(catchup[2]);
 2374         FreeAndNull(catchup[3]);
 2375     }
 2376     if (catchup_next_unread[0] || catchup_next_unread[1] || catchup_next_unread[2] || catchup_next_unread[3]) {
 2377         fprintf(newfp, "CatchupNextUnread\t");
 2378         if (catchup_next_unread[0] && catchup_next_unread[1] && !strcmp(catchup_next_unread[0], catchup_next_unread[1]))
 2379             FreeAndNull(catchup_next_unread[1]);
 2380         if (catchup_next_unread[0] && catchup_next_unread[2] && !strcmp(catchup_next_unread[0], catchup_next_unread[2]))
 2381             FreeAndNull(catchup_next_unread[2]);
 2382         if (catchup_next_unread[0] && catchup_next_unread[3] && !strcmp(catchup_next_unread[0], catchup_next_unread[3]))
 2383             FreeAndNull(catchup_next_unread[3]);
 2384         if (catchup_next_unread[1] && catchup_next_unread[2] && !strcmp(catchup_next_unread[1], catchup_next_unread[2]))
 2385             FreeAndNull(catchup_next_unread[2]);
 2386         if (catchup_next_unread[1] && catchup_next_unread[3] && !strcmp(catchup_next_unread[1], catchup_next_unread[3]))
 2387             FreeAndNull(catchup_next_unread[3]);
 2388         if (catchup_next_unread[2] && catchup_next_unread[3] && !strcmp(catchup_next_unread[2], catchup_next_unread[3]))
 2389             FreeAndNull(catchup_next_unread[3]);
 2390         if (catchup_next_unread[0])
 2391             fprintf(newfp, "\t%s", catchup_next_unread[0]);
 2392         if (catchup_next_unread[1])
 2393             fprintf(newfp, "\t%s", catchup_next_unread[1]);
 2394         if (catchup_next_unread[2])
 2395             fprintf(newfp, "\t%s", catchup_next_unread[2]);
 2396         if (catchup_next_unread[3])
 2397             fprintf(newfp, "\t%s", catchup_next_unread[3]);
 2398         fprintf(newfp, "\n");
 2399         FreeAndNull(catchup_next_unread[0]);
 2400         FreeAndNull(catchup_next_unread[1]);
 2401         FreeAndNull(catchup_next_unread[2]);
 2402         FreeAndNull(catchup_next_unread[3]);
 2403     }
 2404     if (edit_filter[0] || edit_filter[1]) {
 2405         fprintf(newfp, "EditFilter\t");
 2406         if (edit_filter[0])
 2407             fprintf(newfp, "\t%s", edit_filter[0]);
 2408         if (edit_filter[1] && edit_filter[0] && strcmp(edit_filter[0], edit_filter[1]))
 2409             fprintf(newfp, "\t%s", edit_filter[1]);
 2410         fprintf(newfp, "\n");
 2411         FreeAndNull(edit_filter[0]);
 2412         FreeAndNull(edit_filter[1]);
 2413     }
 2414     if (mark_article_unread[0] || mark_article_unread[1] || mark_article_unread[2]) {
 2415         fprintf(newfp, "MarkArticleUnread\t");
 2416         if (mark_article_unread[0] && mark_article_unread[1] && !strcmp(mark_article_unread[0], mark_article_unread[1]))
 2417             FreeAndNull(mark_article_unread[1]);
 2418         if (mark_article_unread[0] && mark_article_unread[2] && !strcmp(mark_article_unread[0], mark_article_unread[2]))
 2419             FreeAndNull(mark_article_unread[2]);
 2420         if (mark_article_unread[1] && mark_article_unread[2] && !strcmp(mark_article_unread[1], mark_article_unread[2]))
 2421             FreeAndNull(mark_article_unread[2]);
 2422         if (mark_article_unread[0])
 2423             fprintf(newfp, "\t%s", mark_article_unread[0]);
 2424         if (mark_article_unread[1])
 2425             fprintf(newfp, "\t%s", mark_article_unread[1]);
 2426         if (mark_article_unread[2])
 2427             fprintf(newfp, "\t%s", mark_article_unread[2]);
 2428         fprintf(newfp, "\n");
 2429         FreeAndNull(mark_article_unread[0]);
 2430         FreeAndNull(mark_article_unread[1]);
 2431         FreeAndNull(mark_article_unread[2]);
 2432     }
 2433     if (mark_thread_unread[0] || mark_thread_unread[1] || mark_thread_unread[2]) {
 2434         fprintf(newfp, "MarkThreadUnread\t");
 2435         if (mark_thread_unread[0] && mark_thread_unread[1] && !strcmp(mark_thread_unread[0], mark_thread_unread[1]))
 2436             FreeAndNull(mark_thread_unread[1]);
 2437         if (mark_thread_unread[0] && mark_thread_unread[2] && !strcmp(mark_thread_unread[0], mark_thread_unread[2]))
 2438             FreeAndNull(mark_thread_unread[2]);
 2439         if (mark_thread_unread[1] && mark_thread_unread[2] && !strcmp(mark_thread_unread[1], mark_thread_unread[2]))
 2440             FreeAndNull(mark_thread_unread[2]);
 2441         if (mark_thread_unread[0])
 2442             fprintf(newfp, "\t%s", mark_thread_unread[0]);
 2443         if (mark_thread_unread[1])
 2444             fprintf(newfp, "\t%s", mark_thread_unread[1]);
 2445         if (mark_thread_unread[2])
 2446             fprintf(newfp, "\t%s", mark_thread_unread[2]);
 2447         fprintf(newfp, "\n");
 2448         FreeAndNull(mark_thread_unread[0]);
 2449         FreeAndNull(mark_thread_unread[1]);
 2450         FreeAndNull(mark_thread_unread[2]);
 2451     }
 2452     if (menu_filter_kill[0] || menu_filter_kill[1] || menu_filter_kill[2]) {
 2453         fprintf(newfp, "MenuFilterKill\t");
 2454         if (menu_filter_kill[0] && menu_filter_kill[1] && !strcmp(menu_filter_kill[0], menu_filter_kill[1]))
 2455             FreeAndNull(menu_filter_kill[1]);
 2456         if (menu_filter_kill[0] && menu_filter_kill[2] && !strcmp(menu_filter_kill[0], menu_filter_kill[2]))
 2457             FreeAndNull(menu_filter_kill[2]);
 2458         if (menu_filter_kill[1] && menu_filter_kill[2] && !strcmp(menu_filter_kill[1], menu_filter_kill[2]))
 2459             FreeAndNull(menu_filter_kill[2]);
 2460         if (menu_filter_kill[0])
 2461             fprintf(newfp, "\t%s", menu_filter_kill[0]);
 2462         if (menu_filter_kill[1])
 2463             fprintf(newfp, "\t%s", menu_filter_kill[1]);
 2464         if (menu_filter_kill[2])
 2465             fprintf(newfp, "\t%s", menu_filter_kill[2]);
 2466         fprintf(newfp, "\n");
 2467         FreeAndNull(menu_filter_kill[0]);
 2468         FreeAndNull(menu_filter_kill[1]);
 2469         FreeAndNull(menu_filter_kill[2]);
 2470     }
 2471     if (menu_filter_select[0] || menu_filter_select[1] || menu_filter_select[2]) {
 2472         fprintf(newfp, "MenuFilterSelect\t");
 2473         if (menu_filter_select[0] && menu_filter_select[1] && !strcmp(menu_filter_select[0], menu_filter_select[1]))
 2474             FreeAndNull(menu_filter_select[1]);
 2475         if (menu_filter_select[0] && menu_filter_select[2] && !strcmp(menu_filter_select[0], menu_filter_select[2]))
 2476             FreeAndNull(menu_filter_select[2]);
 2477         if (menu_filter_select[1] && menu_filter_select[2] && !strcmp(menu_filter_select[1], menu_filter_select[2]))
 2478             FreeAndNull(menu_filter_select[2]);
 2479         if (menu_filter_select[0])
 2480             fprintf(newfp, "\t%s", menu_filter_select[0]);
 2481         if (menu_filter_select[1])
 2482             fprintf(newfp, "\t%s", menu_filter_select[1]);
 2483         if (menu_filter_select[2])
 2484             fprintf(newfp, "\t%s", menu_filter_select[2]);
 2485         fprintf(newfp, "\n");
 2486         FreeAndNull(menu_filter_select[0]);
 2487         FreeAndNull(menu_filter_select[1]);
 2488         FreeAndNull(menu_filter_select[2]);
 2489     }
 2490     if (quick_filter_kill[0] || quick_filter_kill[1]) {
 2491         fprintf(newfp, "QuickFilterKill\t");
 2492         if (quick_filter_kill[0])
 2493             fprintf(newfp, "\t%s", quick_filter_kill[0]);
 2494         if (quick_filter_kill[1] && quick_filter_kill[0] && strcmp(quick_filter_kill[0], quick_filter_kill[1]))
 2495             fprintf(newfp, "\t%s", quick_filter_kill[1]);
 2496         fprintf(newfp, "\n");
 2497         FreeAndNull(quick_filter_kill[0]);
 2498         FreeAndNull(quick_filter_kill[1]);
 2499     }
 2500     if (quick_filter_select[0] || quick_filter_select[1]) {
 2501         fprintf(newfp, "QuickFilterSelect\t");
 2502         if (quick_filter_select[0])
 2503             fprintf(newfp, "\t%s", quick_filter_select[0]);
 2504         if (quick_filter_select[1] && quick_filter_select[0] && strcmp(quick_filter_select[0], quick_filter_select[1]))
 2505             fprintf(newfp, "\t%s", quick_filter_select[1]);
 2506         fprintf(newfp, "\n");
 2507         FreeAndNull(quick_filter_select[0]);
 2508         FreeAndNull(quick_filter_select[1]);
 2509     }
 2510 
 2511     fclose(oldfp);
 2512     fclose(newfp);
 2513     rename(newk, old);
 2514     wait_message(0, _(txt_keymap_upgraded), KEYMAP_VERSION);
 2515     prompt_continue();
 2516 }
 2517 
 2518 
 2519 /*
 2520  * add the default key bindings for still free keys
 2521  */
 2522 void
 2523 setup_default_keys(
 2524     void)
 2525 {
 2526     /* attachment level */
 2527     add_default_key(&attachment_keys, "1", DIGIT_1);
 2528     add_default_key(&attachment_keys, "2", DIGIT_2);
 2529     add_default_key(&attachment_keys, "3", DIGIT_3);
 2530     add_default_key(&attachment_keys, "4", DIGIT_4);
 2531     add_default_key(&attachment_keys, "5", DIGIT_5);
 2532     add_default_key(&attachment_keys, "6", DIGIT_6);
 2533     add_default_key(&attachment_keys, "7", DIGIT_7);
 2534     add_default_key(&attachment_keys, "8", DIGIT_8);
 2535     add_default_key(&attachment_keys, "9", DIGIT_9);
 2536     add_default_key(&attachment_keys, "b", GLOBAL_PAGE_UP);
 2537     add_default_key(&attachment_keys, " ", GLOBAL_PAGE_DOWN);
 2538     add_default_key(&attachment_keys, "h", GLOBAL_HELP);
 2539     add_default_key(&attachment_keys, "\n\r", ATTACHMENT_SELECT);
 2540     add_default_key(&attachment_keys, "H", GLOBAL_TOGGLE_HELP_DISPLAY);
 2541     add_default_key(&attachment_keys, "", GLOBAL_REDRAW_SCREEN);
 2542     add_default_key(&attachment_keys, "j", GLOBAL_LINE_DOWN);
 2543     add_default_key(&attachment_keys, "k", GLOBAL_LINE_UP);
 2544     add_default_key(&attachment_keys, "g^", GLOBAL_FIRST_PAGE);
 2545     add_default_key(&attachment_keys, "G$", GLOBAL_LAST_PAGE);
 2546     add_default_key(&attachment_keys, "i", GLOBAL_TOGGLE_INFO_LAST_LINE);
 2547     add_default_key(&attachment_keys, "p", ATTACHMENT_PIPE);
 2548     add_default_key(&attachment_keys, "q", GLOBAL_QUIT);
 2549     add_default_key(&attachment_keys, "s", ATTACHMENT_SAVE);
 2550     add_default_key(&attachment_keys, "t", ATTACHMENT_TAG);
 2551     add_default_key(&attachment_keys, "U", ATTACHMENT_UNTAG);
 2552     add_default_key(&attachment_keys, "=", ATTACHMENT_TAG_PATTERN);
 2553     add_default_key(&attachment_keys, "@", ATTACHMENT_TOGGLE_TAGGED);
 2554     add_default_key(&attachment_keys, "|", GLOBAL_PIPE);
 2555     add_default_key(&attachment_keys, ">", GLOBAL_SCROLL_DOWN);
 2556     add_default_key(&attachment_keys, "<", GLOBAL_SCROLL_UP);
 2557     add_default_key(&attachment_keys, "/", GLOBAL_SEARCH_SUBJECT_FORWARD);
 2558     add_default_key(&attachment_keys, "?", GLOBAL_SEARCH_SUBJECT_BACKWARD);
 2559     add_default_key(&attachment_keys, "\\", GLOBAL_SEARCH_REPEAT);
 2560 #ifndef NO_SHELL_ESCAPE
 2561     add_default_key(&attachment_keys, "!", GLOBAL_SHELL_ESCAPE);
 2562 #endif /* !NO_SHELL_ESCAPE */
 2563 
 2564     /* scope level */
 2565     add_default_key(&scope_keys, "1", DIGIT_1);
 2566     add_default_key(&scope_keys, "2", DIGIT_2);
 2567     add_default_key(&scope_keys, "3", DIGIT_3);
 2568     add_default_key(&scope_keys, "4", DIGIT_4);
 2569     add_default_key(&scope_keys, "5", DIGIT_5);
 2570     add_default_key(&scope_keys, "6", DIGIT_6);
 2571     add_default_key(&scope_keys, "7", DIGIT_7);
 2572     add_default_key(&scope_keys, "8", DIGIT_8);
 2573     add_default_key(&scope_keys, "9", DIGIT_9);
 2574     add_default_key(&scope_keys, "a", SCOPE_ADD);
 2575     add_default_key(&scope_keys, "b", GLOBAL_PAGE_UP);
 2576     add_default_key(&scope_keys, " ", GLOBAL_PAGE_DOWN);
 2577     add_default_key(&scope_keys, "d", SCOPE_DELETE);
 2578     add_default_key(&scope_keys, "h", GLOBAL_HELP);
 2579     add_default_key(&scope_keys, "\n\r", SCOPE_SELECT);
 2580     add_default_key(&scope_keys, "E", SCOPE_EDIT_ATTRIBUTES_FILE);
 2581     add_default_key(&scope_keys, "H", GLOBAL_TOGGLE_HELP_DISPLAY);
 2582     add_default_key(&scope_keys, "", GLOBAL_REDRAW_SCREEN);
 2583     add_default_key(&scope_keys, "m", SCOPE_MOVE);
 2584     add_default_key(&scope_keys, "j", GLOBAL_LINE_DOWN);
 2585     add_default_key(&scope_keys, "k", GLOBAL_LINE_UP);
 2586     add_default_key(&scope_keys, "g^", GLOBAL_FIRST_PAGE);
 2587     add_default_key(&scope_keys, "G$", GLOBAL_LAST_PAGE);
 2588     add_default_key(&scope_keys, "q", GLOBAL_QUIT);
 2589     add_default_key(&scope_keys, "r", SCOPE_RENAME);
 2590     add_default_key(&scope_keys, ">", GLOBAL_SCROLL_DOWN);
 2591     add_default_key(&scope_keys, "<", GLOBAL_SCROLL_UP);
 2592 #ifndef NO_SHELL_ESCAPE
 2593     add_default_key(&scope_keys, "!", GLOBAL_SHELL_ESCAPE);
 2594 #endif /* !NO_SHELL_ESCAPE */
 2595 
 2596     /* select level */
 2597     add_global_keys(&select_keys);
 2598     add_default_key(&select_keys, "\n\r", SELECT_ENTER_GROUP);
 2599     add_default_key(&select_keys, "", SELECT_RESET_NEWSRC);
 2600     add_default_key(&select_keys, "c", CATCHUP);
 2601     add_default_key(&select_keys, "d", SELECT_TOGGLE_DESCRIPTIONS);
 2602     add_default_key(&select_keys, "g", SELECT_GOTO);
 2603     add_default_key(&select_keys, "m", SELECT_MOVE_GROUP);
 2604     add_default_key(&select_keys, "n\t", SELECT_ENTER_NEXT_UNREAD_GROUP);
 2605     add_default_key(&select_keys, "r", SELECT_TOGGLE_READ_DISPLAY);
 2606     add_default_key(&select_keys, "s", SELECT_SUBSCRIBE);
 2607     add_default_key(&select_keys, "u", SELECT_UNSUBSCRIBE);
 2608     add_default_key(&select_keys, "y", SELECT_YANK_ACTIVE);
 2609     add_default_key(&select_keys, "z", SELECT_MARK_GROUP_UNREAD);
 2610     add_default_key(&select_keys, "C", CATCHUP_NEXT_UNREAD);
 2611     add_default_key(&select_keys, "E", GLOBAL_EDIT_FILTER);
 2612 #ifdef NNTP_ABLE
 2613     add_default_key(&select_keys, "L", GLOBAL_LOOKUP_MESSAGEID);
 2614 #endif /* NNTP_ABLE */
 2615     add_default_key(&select_keys, "N", SELECT_NEXT_UNREAD_GROUP);
 2616     add_default_key(&select_keys, "S", SELECT_SUBSCRIBE_PATTERN);
 2617     add_default_key(&select_keys, "U", SELECT_UNSUBSCRIBE_PATTERN);
 2618     add_default_key(&select_keys, "X", SELECT_QUIT_NO_WRITE);
 2619     add_default_key(&select_keys, "Y", SELECT_SYNC_WITH_ACTIVE);
 2620     add_default_key(&select_keys, "Z", SELECT_MARK_GROUP_UNREAD);
 2621     add_default_key(&select_keys, ".", SELECT_SORT_ACTIVE);
 2622     add_default_key(&select_keys, ">", GLOBAL_SCROLL_DOWN);
 2623     add_default_key(&select_keys, "<", GLOBAL_SCROLL_UP);
 2624 
 2625     /* group level */
 2626     add_global_keys(&group_keys);
 2627     add_default_key(&group_keys, "", GLOBAL_MENU_FILTER_SELECT);
 2628     add_default_key(&group_keys, "\n\r", GROUP_READ_BASENOTE);
 2629     add_default_key(&group_keys, "", GLOBAL_MENU_FILTER_KILL);
 2630     add_default_key(&group_keys, "", MARK_FEED_READ);
 2631     add_default_key(&group_keys, "", MARK_FEED_UNREAD);
 2632     add_default_key(&group_keys, "a", GLOBAL_SEARCH_AUTHOR_FORWARD);
 2633     add_default_key(&group_keys, "c", CATCHUP);
 2634     add_default_key(&group_keys, "d", GROUP_TOGGLE_SUBJECT_DISPLAY);
 2635     add_default_key(&group_keys, "g", GROUP_GOTO);
 2636     add_default_key(&group_keys, "l", GROUP_LIST_THREAD);
 2637     add_default_key(&group_keys, "m", GROUP_MAIL);
 2638     add_default_key(&group_keys, "n", GROUP_NEXT_GROUP);
 2639 #ifndef DISABLE_PRINTING
 2640     add_default_key(&group_keys, "o", GLOBAL_PRINT);
 2641 #endif /* !DISABLE_PRINTING */
 2642     add_default_key(&group_keys, "p", GROUP_PREVIOUS_GROUP);
 2643     add_default_key(&group_keys, "r", GROUP_TOGGLE_READ_UNREAD);
 2644     add_default_key(&group_keys, "s", GROUP_SAVE);
 2645     add_default_key(&group_keys, "t", GROUP_TAG);
 2646     add_default_key(&group_keys, "u", GROUP_TOGGLE_THREADING);
 2647     add_default_key(&group_keys, "x", GROUP_REPOST);
 2648     add_default_key(&group_keys, "z", MARK_ARTICLE_UNREAD);
 2649     add_default_key(&group_keys, "A", GLOBAL_SEARCH_AUTHOR_BACKWARD);
 2650     add_default_key(&group_keys, "B", GLOBAL_SEARCH_BODY);
 2651     add_default_key(&group_keys, "C", CATCHUP_NEXT_UNREAD);
 2652     add_default_key(&group_keys, "D", GROUP_CANCEL);
 2653     add_default_key(&group_keys, "E", GLOBAL_EDIT_FILTER);
 2654     add_default_key(&group_keys, "G", GROUP_TOGGLE_GET_ARTICLES_LIMIT);
 2655     add_default_key(&group_keys, "K", GROUP_MARK_THREAD_READ);
 2656     add_default_key(&group_keys, "L", GLOBAL_LOOKUP_MESSAGEID);
 2657     add_default_key(&group_keys, "N", GROUP_NEXT_UNREAD_ARTICLE);
 2658     add_default_key(&group_keys, "P", GROUP_PREVIOUS_UNREAD_ARTICLE);
 2659     add_default_key(&group_keys, "S", GROUP_AUTOSAVE);
 2660     add_default_key(&group_keys, "T", GROUP_TAG_PARTS);
 2661     add_default_key(&group_keys, "U", GROUP_UNTAG);
 2662     add_default_key(&group_keys, "X", GROUP_MARK_UNSELECTED_ARTICLES_READ);
 2663     add_default_key(&group_keys, "Z", MARK_THREAD_UNREAD);
 2664     add_default_key(&group_keys, "\t", GROUP_NEXT_UNREAD_ARTICLE_OR_GROUP);
 2665     add_default_key(&group_keys, "-", GLOBAL_LAST_VIEWED);
 2666     add_default_key(&group_keys, "|", GLOBAL_PIPE);
 2667     add_default_key(&group_keys, "[", GLOBAL_QUICK_FILTER_SELECT);
 2668     add_default_key(&group_keys, "]", GLOBAL_QUICK_FILTER_KILL);
 2669     add_default_key(&group_keys, "*", GROUP_SELECT_THREAD);
 2670     add_default_key(&group_keys, ".", GROUP_TOGGLE_SELECT_THREAD);
 2671     add_default_key(&group_keys, "@", GROUP_REVERSE_SELECTIONS);
 2672     add_default_key(&group_keys, "~", GROUP_UNDO_SELECTIONS);
 2673     add_default_key(&group_keys, "=", GROUP_SELECT_PATTERN);
 2674     add_default_key(&group_keys, ";", GROUP_SELECT_THREAD_IF_UNREAD_SELECTED);
 2675     add_default_key(&group_keys, "+", GROUP_DO_AUTOSELECT);
 2676     add_default_key(&group_keys, ">", GLOBAL_SCROLL_DOWN);
 2677     add_default_key(&group_keys, "<", GLOBAL_SCROLL_UP);
 2678 
 2679     /* thread keys */
 2680     add_global_keys(&thread_keys);
 2681     add_default_key(&thread_keys, "", GLOBAL_MENU_FILTER_SELECT);
 2682     add_default_key(&thread_keys, "", GLOBAL_MENU_FILTER_KILL);
 2683     add_default_key(&thread_keys, "", MARK_FEED_READ);
 2684     add_default_key(&thread_keys, "", MARK_FEED_UNREAD);
 2685     add_default_key(&thread_keys, "\n\r", THREAD_READ_ARTICLE);
 2686     add_default_key(&thread_keys, "a", GLOBAL_SEARCH_AUTHOR_FORWARD);
 2687     add_default_key(&thread_keys, "c", CATCHUP);
 2688     add_default_key(&thread_keys, "d", THREAD_TOGGLE_SUBJECT_DISPLAY);
 2689     add_default_key(&thread_keys, "m", THREAD_MAIL);
 2690 #ifndef DISABLE_PRINTING
 2691     add_default_key(&thread_keys, "o", GLOBAL_PRINT);
 2692 #endif /* !DISABLE_PRINTING */
 2693     add_default_key(&thread_keys, "s", THREAD_SAVE);
 2694     add_default_key(&thread_keys, "t", THREAD_TAG);
 2695     add_default_key(&thread_keys, "z", MARK_ARTICLE_UNREAD);
 2696     add_default_key(&thread_keys, "A", GLOBAL_SEARCH_AUTHOR_BACKWARD);
 2697     add_default_key(&thread_keys, "B", GLOBAL_SEARCH_BODY);
 2698     add_default_key(&thread_keys, "C", CATCHUP_NEXT_UNREAD);
 2699     add_default_key(&thread_keys, "D", THREAD_CANCEL);
 2700     add_default_key(&thread_keys, "E", GLOBAL_EDIT_FILTER);
 2701     add_default_key(&thread_keys, "K", THREAD_MARK_ARTICLE_READ);
 2702     add_default_key(&thread_keys, "L", GLOBAL_LOOKUP_MESSAGEID);
 2703     add_default_key(&thread_keys, "S", THREAD_AUTOSAVE);
 2704     add_default_key(&thread_keys, "T", THREAD_TAG_PARTS);
 2705     add_default_key(&thread_keys, "U", THREAD_UNTAG);
 2706     add_default_key(&thread_keys, "Z", MARK_THREAD_UNREAD);
 2707     add_default_key(&thread_keys, "\t", THREAD_READ_NEXT_ARTICLE_OR_THREAD);
 2708     add_default_key(&thread_keys, "-", GLOBAL_LAST_VIEWED);
 2709     add_default_key(&thread_keys, "|", GLOBAL_PIPE);
 2710     add_default_key(&thread_keys, "*", THREAD_SELECT_ARTICLE);
 2711     add_default_key(&thread_keys, ".", THREAD_TOGGLE_ARTICLE_SELECTION);
 2712     add_default_key(&thread_keys, "@", THREAD_REVERSE_SELECTIONS);
 2713     add_default_key(&thread_keys, "~", THREAD_UNDO_SELECTIONS);
 2714     add_default_key(&thread_keys, ">", GLOBAL_SCROLL_DOWN);
 2715     add_default_key(&thread_keys, "<", GLOBAL_SCROLL_UP);
 2716 
 2717     /* page level */
 2718     add_global_keys(&page_keys);
 2719     add_default_key(&page_keys, "", GLOBAL_MENU_FILTER_SELECT);
 2720     add_default_key(&page_keys, "", PAGE_REPLY_QUOTE_HEADERS);
 2721 #ifdef HAVE_PGP_GPG
 2722     add_default_key(&page_keys, "", PAGE_PGP_CHECK_ARTICLE);
 2723 #endif /* HAVE_PGP_GPG */
 2724     add_default_key(&page_keys, "", PAGE_TOGGLE_RAW);
 2725     add_default_key(&page_keys, "", GLOBAL_MENU_FILTER_KILL);
 2726     add_default_key(&page_keys, "\n\r", PAGE_NEXT_THREAD);
 2727     add_default_key(&page_keys, "", PAGE_TOGGLE_TABS);
 2728     add_default_key(&page_keys, "", PAGE_FOLLOWUP_QUOTE_HEADERS);
 2729     add_default_key(&page_keys, "a", GLOBAL_SEARCH_AUTHOR_FORWARD);
 2730     add_default_key(&page_keys, "c", CATCHUP);
 2731     add_default_key(&page_keys, "e", PAGE_EDIT_ARTICLE);
 2732     add_default_key(&page_keys, "f", PAGE_FOLLOWUP_QUOTE);
 2733     add_default_key(&page_keys, "g", GLOBAL_FIRST_PAGE);
 2734     add_default_key(&page_keys, "l", PAGE_LIST_THREAD);
 2735     add_default_key(&page_keys, "m", PAGE_MAIL);
 2736     add_default_key(&page_keys, "n", PAGE_NEXT_ARTICLE);
 2737 #ifndef DISABLE_PRINTING
 2738     add_default_key(&page_keys, "o", GLOBAL_PRINT);
 2739 #endif /* !DISABLE_PRINTING */
 2740     add_default_key(&page_keys, "p", PAGE_PREVIOUS_ARTICLE);
 2741     add_default_key(&page_keys, "r", PAGE_REPLY_QUOTE);
 2742     add_default_key(&page_keys, "s", PAGE_SAVE);
 2743     add_default_key(&page_keys, "t", PAGE_TAG);
 2744     add_default_key(&page_keys, "u", PAGE_GOTO_PARENT);
 2745     add_default_key(&page_keys, "x", PAGE_REPOST);
 2746     add_default_key(&page_keys, "z", MARK_ARTICLE_UNREAD);
 2747     add_default_key(&page_keys, "A", GLOBAL_SEARCH_AUTHOR_BACKWARD);
 2748     add_default_key(&page_keys, "B", GLOBAL_SEARCH_BODY);
 2749     add_default_key(&page_keys, "C", CATCHUP_NEXT_UNREAD);
 2750     add_default_key(&page_keys, "D", PAGE_CANCEL);
 2751     add_default_key(&page_keys, "E", GLOBAL_EDIT_FILTER);
 2752     add_default_key(&page_keys, "F", PAGE_FOLLOWUP);
 2753     add_default_key(&page_keys, "G", GLOBAL_LAST_PAGE);
 2754     add_default_key(&page_keys, "K", PAGE_MARK_THREAD_READ);
 2755     add_default_key(&page_keys, "L", GLOBAL_LOOKUP_MESSAGEID);
 2756     add_default_key(&page_keys, "N", PAGE_NEXT_UNREAD_ARTICLE);
 2757     add_default_key(&page_keys, "P", PAGE_PREVIOUS_UNREAD_ARTICLE);
 2758     add_default_key(&page_keys, "R", PAGE_REPLY);
 2759     add_default_key(&page_keys, "S", PAGE_AUTOSAVE);
 2760     add_default_key(&page_keys, "T", PAGE_GROUP_SELECT);
 2761     add_default_key(&page_keys, "U", PAGE_VIEW_URL);
 2762     add_default_key(&page_keys, "V", PAGE_VIEW_ATTACHMENTS);
 2763     add_default_key(&page_keys, "Z", MARK_THREAD_UNREAD);
 2764     add_default_key(&page_keys, "\t", PAGE_NEXT_UNREAD);
 2765     add_default_key(&page_keys, "-", GLOBAL_LAST_VIEWED);
 2766     add_default_key(&page_keys, "|", GLOBAL_PIPE);
 2767     add_default_key(&page_keys, "<", PAGE_TOP_THREAD);
 2768     add_default_key(&page_keys, ">", PAGE_BOTTOM_THREAD);
 2769     add_default_key(&page_keys, "\"", PAGE_TOGGLE_TEX2ISO);
 2770     add_default_key(&page_keys, "(", PAGE_TOGGLE_UUE);
 2771     add_default_key(&page_keys, ")", PAGE_REVEAL);
 2772     add_default_key(&page_keys, "[", GLOBAL_QUICK_FILTER_SELECT);
 2773     add_default_key(&page_keys, "]", GLOBAL_QUICK_FILTER_KILL);
 2774     add_default_key(&page_keys, "%", PAGE_TOGGLE_ROT13);
 2775     add_default_key(&page_keys, "*", PAGE_TOGGLE_HEADERS);
 2776     add_default_key(&page_keys, ":", PAGE_SKIP_INCLUDED_TEXT);
 2777     add_default_key(&page_keys, "_", PAGE_TOGGLE_HIGHLIGHTING);
 2778 
 2779     /* info pager */
 2780     add_default_key(&info_keys, "", GLOBAL_ABORT);
 2781     add_default_key(&info_keys, "j", GLOBAL_LINE_DOWN);
 2782     add_default_key(&info_keys, "k", GLOBAL_LINE_UP);
 2783     add_default_key(&info_keys, " ", GLOBAL_PAGE_DOWN);
 2784     add_default_key(&info_keys, "b", GLOBAL_PAGE_UP);
 2785     add_default_key(&info_keys, "g^", GLOBAL_FIRST_PAGE);
 2786     add_default_key(&info_keys, "G$", GLOBAL_LAST_PAGE);
 2787     add_default_key(&info_keys, "q", GLOBAL_QUIT);
 2788     add_default_key(&info_keys, "H", GLOBAL_TOGGLE_HELP_DISPLAY);
 2789     add_default_key(&info_keys, "/", GLOBAL_SEARCH_SUBJECT_FORWARD);
 2790     add_default_key(&info_keys, "?", GLOBAL_SEARCH_SUBJECT_BACKWARD);
 2791     add_default_key(&info_keys, "\\", GLOBAL_SEARCH_REPEAT);
 2792 
 2793     /* options menu */
 2794     add_default_key(&option_menu_keys, "1", DIGIT_1);
 2795     add_default_key(&option_menu_keys, "2", DIGIT_2);
 2796     add_default_key(&option_menu_keys, "3", DIGIT_3);
 2797     add_default_key(&option_menu_keys, "4", DIGIT_4);
 2798     add_default_key(&option_menu_keys, "5", DIGIT_5);
 2799     add_default_key(&option_menu_keys, "6", DIGIT_6);
 2800     add_default_key(&option_menu_keys, "7", DIGIT_7);
 2801     add_default_key(&option_menu_keys, "8", DIGIT_8);
 2802     add_default_key(&option_menu_keys, "9", DIGIT_9);
 2803     add_default_key(&option_menu_keys, "b", GLOBAL_PAGE_UP);
 2804     add_default_key(&option_menu_keys, " ", GLOBAL_PAGE_DOWN);
 2805     add_default_key(&option_menu_keys, "\n\r", CONFIG_SELECT);
 2806     add_default_key(&option_menu_keys, "\t", CONFIG_TOGGLE_ATTRIB);
 2807     add_default_key(&option_menu_keys, "", GLOBAL_REDRAW_SCREEN);
 2808     add_default_key(&option_menu_keys, "j", GLOBAL_LINE_DOWN);
 2809     add_default_key(&option_menu_keys, "k", GLOBAL_LINE_UP);
 2810     add_default_key(&option_menu_keys, "g^", GLOBAL_FIRST_PAGE);
 2811     add_default_key(&option_menu_keys, "G$", GLOBAL_LAST_PAGE);
 2812     add_default_key(&option_menu_keys, "h", GLOBAL_HELP);
 2813     add_default_key(&option_menu_keys, "q", GLOBAL_QUIT);
 2814     add_default_key(&option_menu_keys, "r", CONFIG_RESET_ATTRIB);
 2815     add_default_key(&option_menu_keys, "v", GLOBAL_VERSION);
 2816     add_default_key(&option_menu_keys, "Q", CONFIG_NO_SAVE);
 2817     add_default_key(&option_menu_keys, "S", CONFIG_SCOPE_MENU);
 2818     add_default_key(&option_menu_keys, ">", GLOBAL_SCROLL_DOWN);
 2819     add_default_key(&option_menu_keys, "<", GLOBAL_SCROLL_UP);
 2820     add_default_key(&option_menu_keys, "/", GLOBAL_SEARCH_SUBJECT_FORWARD);
 2821     add_default_key(&option_menu_keys, "?", GLOBAL_SEARCH_SUBJECT_BACKWARD);
 2822     add_default_key(&option_menu_keys, "\\", GLOBAL_SEARCH_REPEAT);
 2823 #ifndef NO_SHELL_ESCAPE
 2824     add_default_key(&option_menu_keys, "!", GLOBAL_SHELL_ESCAPE);
 2825 #endif /* !NO_SHELL_ESCAPE */
 2826 
 2827     /* posted articles level */
 2828     add_default_key(&post_hist_keys, "", GLOBAL_ABORT);
 2829     add_default_key(&post_hist_keys, "1", DIGIT_1);
 2830     add_default_key(&post_hist_keys, "2", DIGIT_2);
 2831     add_default_key(&post_hist_keys, "3", DIGIT_3);
 2832     add_default_key(&post_hist_keys, "4", DIGIT_4);
 2833     add_default_key(&post_hist_keys, "5", DIGIT_5);
 2834     add_default_key(&post_hist_keys, "6", DIGIT_6);
 2835     add_default_key(&post_hist_keys, "7", DIGIT_7);
 2836     add_default_key(&post_hist_keys, "8", DIGIT_8);
 2837     add_default_key(&post_hist_keys, "9", DIGIT_9);
 2838     add_default_key(&post_hist_keys, "b", GLOBAL_PAGE_UP);
 2839     add_default_key(&post_hist_keys, " ", GLOBAL_PAGE_DOWN);
 2840     add_default_key(&post_hist_keys, "h", GLOBAL_HELP);
 2841     add_default_key(&post_hist_keys, "\n\r", POSTED_SELECT);
 2842     add_default_key(&post_hist_keys, "H", GLOBAL_TOGGLE_HELP_DISPLAY);
 2843     add_default_key(&post_hist_keys, "", GLOBAL_REDRAW_SCREEN);
 2844     add_default_key(&post_hist_keys, "j", GLOBAL_LINE_DOWN);
 2845     add_default_key(&post_hist_keys, "k", GLOBAL_LINE_UP);
 2846     add_default_key(&post_hist_keys, "g^", GLOBAL_FIRST_PAGE);
 2847     add_default_key(&post_hist_keys, "G$", GLOBAL_LAST_PAGE);
 2848     add_default_key(&post_hist_keys, "i", GLOBAL_TOGGLE_INFO_LAST_LINE);
 2849     add_default_key(&post_hist_keys, "q", GLOBAL_QUIT);
 2850     add_default_key(&post_hist_keys, ">", GLOBAL_SCROLL_DOWN);
 2851     add_default_key(&post_hist_keys, "<", GLOBAL_SCROLL_UP);
 2852     add_default_key(&post_hist_keys, "/", GLOBAL_SEARCH_SUBJECT_FORWARD);
 2853     add_default_key(&post_hist_keys, "?", GLOBAL_SEARCH_SUBJECT_BACKWARD);
 2854     add_default_key(&post_hist_keys, "\\", GLOBAL_SEARCH_REPEAT);
 2855 #ifndef NO_SHELL_ESCAPE
 2856     add_default_key(&post_hist_keys, "!", GLOBAL_SHELL_ESCAPE);
 2857 #endif /* !NO_SHELL_ESCAPE */
 2858 
 2859     /* prompt keys */
 2860     add_default_key(&prompt_keys, "", GLOBAL_ABORT);
 2861     add_default_key(&prompt_keys, "nN", PROMPT_NO);
 2862     add_default_key(&prompt_keys, "q", GLOBAL_QUIT);
 2863     add_default_key(&prompt_keys, "yY", PROMPT_YES);
 2864 
 2865     /* post keys */
 2866     add_default_key(&post_send_keys, "", GLOBAL_ABORT);
 2867     add_default_key(&post_send_keys, "e", POST_EDIT);
 2868 #ifdef HAVE_PGP_GPG
 2869     add_default_key(&post_send_keys, "g", POST_PGP);
 2870 #endif /* HAVE_PGP_GPG */
 2871 #ifdef HAVE_ISPELL
 2872     add_default_key(&post_send_keys, "i", POST_ISPELL);
 2873 #endif /* HAVE_ISPELL */
 2874     add_default_key(&post_send_keys, "q", GLOBAL_QUIT);
 2875     add_default_key(&post_send_keys, "s", POST_SEND);
 2876 
 2877     add_default_key(&post_edit_keys, "", GLOBAL_ABORT);
 2878     add_default_key(&post_edit_keys, "e", POST_EDIT);
 2879     add_default_key(&post_edit_keys, "o", POST_POSTPONE);
 2880     add_default_key(&post_edit_keys, "q", GLOBAL_QUIT);
 2881 
 2882     add_default_key(&post_edit_ext_keys, "", GLOBAL_ABORT);
 2883     add_default_key(&post_edit_ext_keys, "e", POST_EDIT);
 2884     add_default_key(&post_edit_ext_keys, "q", GLOBAL_QUIT);
 2885     add_default_key(&post_edit_ext_keys, "M", GLOBAL_OPTION_MENU);
 2886 
 2887     add_default_key(&post_post_keys, "", GLOBAL_ABORT);
 2888     add_default_key(&post_post_keys, "e", POST_EDIT);
 2889 #ifdef HAVE_PGP_GPG
 2890     add_default_key(&post_post_keys, "g", POST_PGP);
 2891 #endif /* HAVE_PGP_GPG */
 2892 #ifdef HAVE_ISPELL
 2893     add_default_key(&post_post_keys, "i", POST_ISPELL);
 2894 #endif /* HAVE_ISPELL */
 2895     add_default_key(&post_post_keys, "o", POST_POSTPONE);
 2896     add_default_key(&post_post_keys, "p", GLOBAL_POST);
 2897     add_default_key(&post_post_keys, "q", GLOBAL_QUIT);
 2898     add_default_key(&post_post_keys, "M", GLOBAL_OPTION_MENU);
 2899 
 2900     add_default_key(&post_postpone_keys, "", GLOBAL_ABORT);
 2901     add_default_key(&post_postpone_keys, "n", PROMPT_NO);
 2902     add_default_key(&post_postpone_keys, "q", GLOBAL_QUIT);
 2903     add_default_key(&post_postpone_keys, "y", PROMPT_YES);
 2904     add_default_key(&post_postpone_keys, "A", POSTPONE_ALL);
 2905     add_default_key(&post_postpone_keys, "Y", POSTPONE_OVERRIDE);
 2906 
 2907     add_default_key(&post_mail_fup_keys, "", GLOBAL_ABORT);
 2908     add_default_key(&post_mail_fup_keys, "m", POST_MAIL);
 2909     add_default_key(&post_mail_fup_keys, "p", GLOBAL_POST);
 2910     add_default_key(&post_mail_fup_keys, "q", GLOBAL_QUIT);
 2911 
 2912     add_default_key(&post_ignore_fupto_keys, "", GLOBAL_ABORT);
 2913     add_default_key(&post_ignore_fupto_keys, "i", POST_IGNORE_FUPTO);
 2914     add_default_key(&post_ignore_fupto_keys, "p", GLOBAL_POST);
 2915     add_default_key(&post_ignore_fupto_keys, "q", GLOBAL_QUIT);
 2916 
 2917     add_default_key(&post_continue_keys, "", GLOBAL_ABORT);
 2918     add_default_key(&post_continue_keys, "a", POST_ABORT);
 2919     add_default_key(&post_continue_keys, "c", POST_CONTINUE);
 2920     add_default_key(&post_continue_keys, "q", GLOBAL_QUIT);
 2921 
 2922     add_default_key(&post_delete_keys, "", GLOBAL_ABORT);
 2923     add_default_key(&post_delete_keys, "d", POST_CANCEL);
 2924     add_default_key(&post_delete_keys, "q", GLOBAL_QUIT);
 2925     add_default_key(&post_delete_keys, "s", POST_SUPERSEDE);
 2926 
 2927     add_default_key(&post_cancel_keys, "", GLOBAL_ABORT);
 2928     add_default_key(&post_cancel_keys, "e", POST_EDIT);
 2929     add_default_key(&post_cancel_keys, "d", POST_CANCEL);
 2930     add_default_key(&post_cancel_keys, "q", GLOBAL_QUIT);
 2931 
 2932     /* feed keys */
 2933     add_default_key(&feed_post_process_keys, "", GLOBAL_ABORT);
 2934     add_default_key(&feed_post_process_keys, "n", POSTPROCESS_NO);
 2935     add_default_key(&feed_post_process_keys, "s", POSTPROCESS_SHAR);
 2936     add_default_key(&feed_post_process_keys, "y", POSTPROCESS_YES);
 2937     add_default_key(&feed_post_process_keys, "q", GLOBAL_QUIT);
 2938 
 2939     add_default_key(&feed_type_keys, "", GLOBAL_ABORT);
 2940     add_default_key(&feed_type_keys, "a", FEED_ARTICLE);
 2941     add_default_key(&feed_type_keys, "h", FEED_HOT);
 2942     add_default_key(&feed_type_keys, "p", FEED_PATTERN);
 2943     add_default_key(&feed_type_keys, "r", FEED_RANGE);
 2944     add_default_key(&feed_type_keys, "q", GLOBAL_QUIT);
 2945     add_default_key(&feed_type_keys, "t", FEED_THREAD);
 2946     add_default_key(&feed_type_keys, "T", FEED_TAGGED);
 2947 
 2948     add_default_key(&feed_supersede_article_keys, "", GLOBAL_ABORT);
 2949     add_default_key(&feed_supersede_article_keys, "q", GLOBAL_QUIT);
 2950     add_default_key(&feed_supersede_article_keys, "r", FEED_KEY_REPOST);
 2951     add_default_key(&feed_supersede_article_keys, "s", FEED_SUPERSEDE);
 2952 
 2953     /* filter keys */
 2954     add_default_key(&filter_keys, "", GLOBAL_ABORT);
 2955     add_default_key(&filter_keys, "e", FILTER_EDIT);
 2956     add_default_key(&filter_keys, "q", GLOBAL_QUIT);
 2957     add_default_key(&filter_keys, "s", FILTER_SAVE);
 2958 
 2959 #ifdef HAVE_PGP_GPG
 2960     /* pgp mail */
 2961     add_default_key(&pgp_mail_keys, "", GLOBAL_ABORT);
 2962     add_default_key(&pgp_mail_keys, "b", PGP_KEY_ENCRYPT_SIGN);
 2963     add_default_key(&pgp_mail_keys, "e", PGP_KEY_ENCRYPT);
 2964     add_default_key(&pgp_mail_keys, "q", GLOBAL_QUIT);
 2965     add_default_key(&pgp_mail_keys, "s", PGP_KEY_SIGN);
 2966 
 2967     /* pgp news */
 2968     add_default_key(&pgp_news_keys, "", GLOBAL_ABORT);
 2969     add_default_key(&pgp_news_keys, "i", PGP_INCLUDE_KEY);
 2970     add_default_key(&pgp_news_keys, "q", GLOBAL_QUIT);
 2971     add_default_key(&pgp_news_keys, "s", PGP_KEY_SIGN);
 2972 #endif /* HAVE_PGP_GPG */
 2973 
 2974     /* save */
 2975     add_default_key(&save_append_overwrite_keys, "", GLOBAL_ABORT);
 2976     add_default_key(&save_append_overwrite_keys, "a", SAVE_APPEND_FILE);
 2977     add_default_key(&save_append_overwrite_keys, "o", SAVE_OVERWRITE_FILE);
 2978     add_default_key(&save_append_overwrite_keys, "q", GLOBAL_QUIT);
 2979 
 2980     /* url level */
 2981     add_default_key(&url_keys, "", GLOBAL_ABORT);
 2982     add_default_key(&url_keys, "1", DIGIT_1);
 2983     add_default_key(&url_keys, "2", DIGIT_2);
 2984     add_default_key(&url_keys, "3", DIGIT_3);
 2985     add_default_key(&url_keys, "4", DIGIT_4);
 2986     add_default_key(&url_keys, "5", DIGIT_5);
 2987     add_default_key(&url_keys, "6", DIGIT_6);
 2988     add_default_key(&url_keys, "7", DIGIT_7);
 2989     add_default_key(&url_keys, "8", DIGIT_8);
 2990     add_default_key(&url_keys, "9", DIGIT_9);
 2991     add_default_key(&url_keys, "b", GLOBAL_PAGE_UP);
 2992     add_default_key(&url_keys, " ", GLOBAL_PAGE_DOWN);
 2993     add_default_key(&url_keys, "h", GLOBAL_HELP);
 2994     add_default_key(&url_keys, "\n\r", URL_SELECT);
 2995     add_default_key(&url_keys, "H", GLOBAL_TOGGLE_HELP_DISPLAY);
 2996     add_default_key(&url_keys, "", GLOBAL_REDRAW_SCREEN);
 2997     add_default_key(&url_keys, "j", GLOBAL_LINE_DOWN);
 2998     add_default_key(&url_keys, "k", GLOBAL_LINE_UP);
 2999     add_default_key(&url_keys, "g^", GLOBAL_FIRST_PAGE);
 3000     add_default_key(&url_keys, "G$", GLOBAL_LAST_PAGE);
 3001     add_default_key(&url_keys, "i", GLOBAL_TOGGLE_INFO_LAST_LINE);
 3002     add_default_key(&url_keys, "q", GLOBAL_QUIT);
 3003     add_default_key(&url_keys, ">", GLOBAL_SCROLL_DOWN);
 3004     add_default_key(&url_keys, "<", GLOBAL_SCROLL_UP);
 3005     add_default_key(&url_keys, "/", GLOBAL_SEARCH_SUBJECT_FORWARD);
 3006     add_default_key(&url_keys, "?", GLOBAL_SEARCH_SUBJECT_BACKWARD);
 3007     add_default_key(&url_keys, "\\", GLOBAL_SEARCH_REPEAT);
 3008 #ifndef NO_SHELL_ESCAPE
 3009     add_default_key(&url_keys, "!", GLOBAL_SHELL_ESCAPE);
 3010 #endif /* !NO_SHELL_ESCAPE */
 3011 }
 3012 
 3013 
 3014 /*
 3015  * used to add the common keys of SELECT_LEVEL, GROUP_LEVEL, THREAD_LEVEL
 3016  * and PAGE_LEVEL
 3017  */
 3018 static void
 3019 add_global_keys(
 3020     struct keylist *keys)
 3021 {
 3022     add_default_key(keys, "", GLOBAL_ABORT);
 3023     add_default_key(keys, "0", DIGIT_0);
 3024     add_default_key(keys, "1", DIGIT_1);
 3025     add_default_key(keys, "2", DIGIT_2);
 3026     add_default_key(keys, "3", DIGIT_3);
 3027     add_default_key(keys, "4", DIGIT_4);
 3028     add_default_key(keys, "5", DIGIT_5);
 3029     add_default_key(keys, "6", DIGIT_6);
 3030     add_default_key(keys, "7", DIGIT_7);
 3031     add_default_key(keys, "8", DIGIT_8);
 3032     add_default_key(keys, "9", DIGIT_9);
 3033     add_default_key(keys, "b", GLOBAL_PAGE_UP);
 3034     add_default_key(keys, " ", GLOBAL_PAGE_DOWN);
 3035     add_default_key(keys, "", GLOBAL_REDRAW_SCREEN);
 3036     add_default_key(keys, "j", GLOBAL_LINE_DOWN);
 3037     add_default_key(keys, "k", GLOBAL_LINE_UP);
 3038     add_default_key(keys, "O", GLOBAL_POSTPONED);
 3039     add_default_key(keys, "h", GLOBAL_HELP);
 3040     add_default_key(keys, "i", GLOBAL_TOGGLE_INFO_LAST_LINE);
 3041     add_default_key(keys, "q", GLOBAL_QUIT);
 3042     add_default_key(keys, "v", GLOBAL_VERSION);
 3043     add_default_key(keys, "w", GLOBAL_POST);
 3044     add_default_key(keys, "H", GLOBAL_TOGGLE_HELP_DISPLAY);
 3045     add_default_key(keys, "I", GLOBAL_TOGGLE_INVERSE_VIDEO);
 3046     add_default_key(keys, "M", GLOBAL_OPTION_MENU);
 3047     add_default_key(keys, "Q", GLOBAL_QUIT_TIN);
 3048     add_default_key(keys, "R", GLOBAL_BUGREPORT);
 3049     add_default_key(keys, "W", GLOBAL_DISPLAY_POST_HISTORY);
 3050     add_default_key(keys, "^", GLOBAL_FIRST_PAGE);
 3051     add_default_key(keys, "$", GLOBAL_LAST_PAGE);
 3052     add_default_key(keys, "/", GLOBAL_SEARCH_SUBJECT_FORWARD);
 3053     add_default_key(keys, "?", GLOBAL_SEARCH_SUBJECT_BACKWARD);
 3054     add_default_key(keys, "\\", GLOBAL_SEARCH_REPEAT);
 3055     add_default_key(keys, "#", GLOBAL_SET_RANGE);
 3056 #ifndef NO_SHELL_ESCAPE
 3057     add_default_key(keys, "!", GLOBAL_SHELL_ESCAPE);
 3058 #endif /* !NO_SHELL_ESCAPE */
 3059 #ifdef HAVE_COLOR
 3060     add_default_key(keys, "&", GLOBAL_TOGGLE_COLOR);
 3061 #endif /* HAVE COLOR */
 3062 }