"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.3/src/help.c" (23 Nov 2018, 43871 Bytes) of package /linux/misc/tin-2.4.3.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 "help.c" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.4.2_vs_2.4.3.

    1 /*
    2  *  Project   : tin - a Usenet reader
    3  *  Module    : help.c
    4  *  Author    : I. Lea
    5  *  Created   : 1991-04-01
    6  *  Updated   : 2018-02-02
    7  *  Notes     :
    8  *
    9  * Copyright (c) 1991-2019 Iain Lea <iain@bricbrac.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  * 1. Redistributions of source code must retain the above copyright
   16  *    notice, this list of conditions and the following disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  * 3. The name of the author may not be used to endorse or promote
   21  *    products derived from this software without specific prior written
   22  *    permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
   25  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
   28  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   30  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   33  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   34  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   35  */
   36 
   37 
   38 #ifndef TIN_H
   39 #   include "tin.h"
   40 #endif /* !TIN_H */
   41 #ifndef TCURSES_H
   42 #   include "tcurses.h"
   43 #endif /* !TCURSES_H */
   44 
   45 
   46 typedef struct thp {
   47     constext *helptext;
   48     t_function func;
   49 } t_help_page;
   50 
   51 /*
   52  * local prototypes
   53  */
   54 static void make_help_page(FILE *fp, const t_help_page *helppage, const struct keylist keys);
   55 
   56 
   57 static constext txt_help_empty_line[] = "";
   58 
   59 static t_help_page attachment_help_page[] = {
   60     { txt_help_title_navi, NOT_ASSIGNED },
   61     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
   62     { txt_help_global_page_up, GLOBAL_PAGE_UP },
   63     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
   64     { txt_help_global_line_up, GLOBAL_LINE_UP },
   65     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
   66     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
   67     { txt_help_empty_line, NOT_ASSIGNED },
   68     { txt_help_attachment_first, GLOBAL_FIRST_PAGE },
   69     { txt_help_attachment_last, GLOBAL_LAST_PAGE },
   70     { txt_help_attachment_goto, NOT_ASSIGNED },
   71     { txt_help_empty_line, NOT_ASSIGNED },
   72     { txt_help_title_disp, NOT_ASSIGNED },
   73     { txt_help_attachment_toggle_info_line, GLOBAL_TOGGLE_INFO_LAST_LINE },
   74     { txt_help_empty_line, NOT_ASSIGNED },
   75     { txt_help_title_attachment_ops, NOT_ASSIGNED },
   76     { txt_help_attachment_select, ATTACHMENT_SELECT },
   77 #ifndef DONT_HAVE_PIPING
   78     { txt_help_attachment_pipe, ATTACHMENT_PIPE },
   79     { txt_help_attachment_pipe_raw, GLOBAL_PIPE },
   80 #endif /* !DONT_HAVE_PIPING */
   81     { txt_help_attachment_save, ATTACHMENT_SAVE },
   82     { txt_help_attachment_tag, ATTACHMENT_TAG },
   83     { txt_help_attachment_tag_pattern, ATTACHMENT_TAG_PATTERN },
   84     { txt_help_attachment_toggle_tagged, ATTACHMENT_TOGGLE_TAGGED },
   85     { txt_help_attachment_untag, ATTACHMENT_UNTAG },
   86     { txt_help_empty_line, NOT_ASSIGNED },
   87     { txt_help_attachment_search_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
   88     { txt_help_attachment_search_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
   89     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
   90     { txt_help_empty_line, NOT_ASSIGNED },
   91     { txt_help_title_misc, NOT_ASSIGNED },
   92     { txt_help_select_quit, GLOBAL_QUIT },
   93     { txt_help_global_help, GLOBAL_HELP },
   94     { txt_help_global_toggle_mini_help, GLOBAL_TOGGLE_HELP_DISPLAY },
   95     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
   96 #ifndef NO_SHELL_ESCAPE
   97     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
   98 #endif /* !NO_SHELL_ESCAPE */
   99     { NULL, NOT_ASSIGNED }
  100 };
  101 
  102 static t_help_page attrib_help_page[] = {
  103     { txt_help_title_navi, NOT_ASSIGNED },
  104     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  105     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  106     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  107     { txt_help_global_line_up, GLOBAL_LINE_UP },
  108     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
  109     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
  110     { txt_help_empty_line, NOT_ASSIGNED },
  111     { txt_help_attrib_first_opt, GLOBAL_FIRST_PAGE },
  112     { txt_help_attrib_last_opt, GLOBAL_LAST_PAGE },
  113     { txt_help_attrib_goto_opt, NOT_ASSIGNED },
  114     { txt_help_empty_line, NOT_ASSIGNED },
  115     { txt_help_attrib_search_opt_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
  116     { txt_help_attrib_search_opt_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
  117     { txt_help_select_search_group_comment, NOT_ASSIGNED },
  118     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
  119     { txt_help_empty_line, NOT_ASSIGNED },
  120     { txt_help_title_attrib_ops, NOT_ASSIGNED },
  121     { txt_help_attrib_reset_attrib, CONFIG_RESET_ATTRIB },
  122     { txt_help_attrib_select, CONFIG_SELECT },
  123     { txt_help_attrib_toggle_attrib, CONFIG_TOGGLE_ATTRIB },
  124     { txt_help_empty_line, NOT_ASSIGNED },
  125     { txt_help_title_misc, NOT_ASSIGNED },
  126     { txt_help_select_quit, GLOBAL_QUIT },
  127     { txt_help_select_quit_no_write, CONFIG_NO_SAVE },
  128     { txt_help_global_help, GLOBAL_HELP },
  129     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  130 #ifndef NO_SHELL_ESCAPE
  131     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  132 #endif /* !NO_SHELL_ESCAPE */
  133     { txt_help_empty_line, NOT_ASSIGNED },
  134     { txt_help_global_version, GLOBAL_VERSION },
  135     { NULL, NOT_ASSIGNED }
  136 };
  137 
  138 static t_help_page config_help_page[] = {
  139     { txt_help_title_navi, NOT_ASSIGNED },
  140     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  141     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  142     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  143     { txt_help_global_line_up, GLOBAL_LINE_UP },
  144     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
  145     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
  146     { txt_help_empty_line, NOT_ASSIGNED },
  147     { txt_help_config_first_opt, GLOBAL_FIRST_PAGE },
  148     { txt_help_config_last_opt, GLOBAL_LAST_PAGE },
  149     { txt_help_config_goto_opt, NOT_ASSIGNED },
  150     { txt_help_empty_line, NOT_ASSIGNED },
  151     { txt_help_config_search_opt_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
  152     { txt_help_config_search_opt_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
  153     { txt_help_select_search_group_comment, NOT_ASSIGNED },
  154     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
  155     { txt_help_empty_line, NOT_ASSIGNED },
  156     { txt_help_title_config_ops, NOT_ASSIGNED },
  157     { txt_help_config_select, CONFIG_SELECT },
  158     { txt_help_config_toggle_attrib, CONFIG_TOGGLE_ATTRIB },
  159     { txt_help_config_scope_menu, CONFIG_SCOPE_MENU },
  160     { txt_help_empty_line, NOT_ASSIGNED },
  161     { txt_help_title_misc, NOT_ASSIGNED },
  162     { txt_help_select_quit, GLOBAL_QUIT },
  163     { txt_help_select_quit_no_write, CONFIG_NO_SAVE },
  164     { txt_help_global_help, GLOBAL_HELP },
  165     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  166 #ifndef NO_SHELL_ESCAPE
  167     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  168 #endif /* !NO_SHELL_ESCAPE */
  169     { txt_help_empty_line, NOT_ASSIGNED },
  170     { txt_help_global_version, GLOBAL_VERSION },
  171     { NULL, NOT_ASSIGNED }
  172 };
  173 
  174 static t_help_page scope_help_page[] = {
  175     { txt_help_title_navi, NOT_ASSIGNED },
  176     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  177     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  178     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  179     { txt_help_global_line_up, GLOBAL_LINE_UP },
  180     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
  181     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
  182     { txt_help_empty_line, NOT_ASSIGNED },
  183     { txt_help_scope_first_scope, GLOBAL_FIRST_PAGE },
  184     { txt_help_scope_last_scope, GLOBAL_LAST_PAGE },
  185     { txt_help_scope_goto_scope, NOT_ASSIGNED },
  186     { txt_help_empty_line, NOT_ASSIGNED },
  187     { txt_help_title_scope_ops, NOT_ASSIGNED },
  188     { txt_help_scope_add, SCOPE_ADD },
  189     { txt_help_scope_move, SCOPE_MOVE },
  190     { txt_help_scope_rename, SCOPE_RENAME },
  191     { txt_help_scope_del, SCOPE_DELETE },
  192     { txt_help_scope_select, SCOPE_SELECT },
  193     { txt_help_empty_line, NOT_ASSIGNED },
  194     { txt_help_scope_edit_attrib_file, SCOPE_EDIT_ATTRIBUTES_FILE },
  195     { txt_help_empty_line, NOT_ASSIGNED },
  196     { txt_help_title_misc, NOT_ASSIGNED },
  197     { txt_help_select_quit, GLOBAL_QUIT },
  198     { txt_help_global_help, GLOBAL_HELP },
  199     { txt_help_global_toggle_mini_help, GLOBAL_TOGGLE_HELP_DISPLAY },
  200     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  201 #ifndef NO_SHELL_ESCAPE
  202     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  203 #endif /* !NO_SHELL_ESCAPE */
  204     { NULL, NOT_ASSIGNED }
  205 };
  206 
  207 static t_help_page select_help_page[] = {
  208     { txt_help_title_navi, NOT_ASSIGNED },
  209     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  210     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  211     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  212     { txt_help_global_line_up, GLOBAL_LINE_UP },
  213     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
  214     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
  215     { txt_help_empty_line, NOT_ASSIGNED },
  216     { txt_help_select_first_group, GLOBAL_FIRST_PAGE },
  217     { txt_help_select_last_group, GLOBAL_LAST_PAGE },
  218     { txt_help_select_group_by_num, NOT_ASSIGNED },
  219     { txt_help_select_goto_group, SELECT_GOTO },
  220     { txt_help_select_next_unread_group, SELECT_NEXT_UNREAD_GROUP },
  221 #ifdef NNTP_ABLE
  222     { txt_help_select_lookup_group, GLOBAL_LOOKUP_MESSAGEID },
  223     { txt_help_select_lookup_group_comment, NOT_ASSIGNED },
  224 #endif /* NNTP_ABLE */
  225     { txt_help_empty_line, NOT_ASSIGNED },
  226     { txt_help_select_search_group_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
  227     { txt_help_select_search_group_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
  228     { txt_help_select_search_group_comment, NOT_ASSIGNED },
  229     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
  230     { txt_help_empty_line, NOT_ASSIGNED },
  231     { txt_help_title_disp, NOT_ASSIGNED },
  232     { txt_help_select_toggle_read_groups, SELECT_TOGGLE_READ_DISPLAY },
  233     { txt_help_global_toggle_info_line, GLOBAL_TOGGLE_INFO_LAST_LINE },
  234     { txt_help_select_toggle_descriptions, SELECT_TOGGLE_DESCRIPTIONS },
  235     { txt_help_global_toggle_inverse_video, GLOBAL_TOGGLE_INVERSE_VIDEO },
  236 #ifdef HAVE_COLOR
  237     { txt_help_global_toggle_color, GLOBAL_TOGGLE_COLOR },
  238 #endif /* HAVE_COLOR */
  239     { txt_help_empty_line, NOT_ASSIGNED },
  240     { txt_help_select_sort_active, SELECT_SORT_ACTIVE },
  241     { txt_help_select_yank_active, SELECT_YANK_ACTIVE },
  242     { txt_help_select_sync_with_active, SELECT_SYNC_WITH_ACTIVE },
  243     { txt_help_empty_line, NOT_ASSIGNED },
  244     { txt_help_title_ops, NOT_ASSIGNED },
  245     { txt_help_select_read_group, SELECT_ENTER_GROUP },
  246     { txt_help_select_next_unread_group, SELECT_ENTER_NEXT_UNREAD_GROUP },
  247 #ifndef NO_POSTING
  248     { txt_help_global_post, GLOBAL_POST },
  249     { txt_help_global_post_postponed, GLOBAL_POSTPONED },
  250 #endif /* NO_POSTING */
  251     { txt_help_empty_line, NOT_ASSIGNED },
  252     { txt_help_select_group_range, GLOBAL_SET_RANGE },
  253     { txt_help_empty_line, NOT_ASSIGNED },
  254     { txt_help_select_catchup, CATCHUP },
  255     { txt_help_select_catchup_next_unread, CATCHUP_NEXT_UNREAD },
  256     { txt_help_select_mark_group_unread, SELECT_MARK_GROUP_UNREAD },
  257     { txt_help_select_subscribe, SELECT_SUBSCRIBE },
  258     { txt_help_select_unsubscribe, SELECT_UNSUBSCRIBE },
  259     { txt_help_select_subscribe_pattern, SELECT_SUBSCRIBE_PATTERN },
  260     { txt_help_select_unsubscribe_pattern, SELECT_UNSUBSCRIBE_PATTERN },
  261     { txt_help_select_move_group, SELECT_MOVE_GROUP },
  262     { txt_help_empty_line, NOT_ASSIGNED },
  263     { txt_help_global_edit_filter, GLOBAL_EDIT_FILTER},
  264     { txt_help_empty_line, NOT_ASSIGNED },
  265     { txt_help_title_misc, NOT_ASSIGNED },
  266     { txt_help_select_quit, GLOBAL_QUIT },
  267     { txt_help_global_quit_tin, GLOBAL_QUIT_TIN },
  268     { txt_help_select_quit_no_write, SELECT_QUIT_NO_WRITE },
  269     { txt_help_global_help, GLOBAL_HELP },
  270     { txt_help_global_toggle_mini_help, GLOBAL_TOGGLE_HELP_DISPLAY },
  271     { txt_help_global_option_menu, GLOBAL_OPTION_MENU },
  272     { txt_help_global_esc, GLOBAL_ABORT },
  273     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  274 #ifndef NO_SHELL_ESCAPE
  275     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  276 #endif /* !NO_SHELL_ESCAPE */
  277     { txt_help_global_posting_history, GLOBAL_DISPLAY_POST_HISTORY },
  278     { txt_help_select_reset_newsrc, SELECT_RESET_NEWSRC },
  279     { txt_help_empty_line, NOT_ASSIGNED },
  280     { txt_help_global_version, GLOBAL_VERSION },
  281     { txt_help_bug_report, GLOBAL_BUGREPORT },
  282     { NULL, NOT_ASSIGNED }
  283 };
  284 
  285 static t_help_page group_help_page[] = {
  286     { txt_help_title_navi, NOT_ASSIGNED },
  287     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  288     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  289     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  290     { txt_help_global_line_up, GLOBAL_LINE_UP },
  291     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
  292     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
  293     { txt_help_empty_line, NOT_ASSIGNED },
  294     { txt_help_group_first_thread, GLOBAL_FIRST_PAGE },
  295     { txt_help_group_last_thread, GLOBAL_LAST_PAGE },
  296     { txt_help_group_thread_by_num, NOT_ASSIGNED },
  297     { txt_help_select_goto_group, GROUP_GOTO },
  298     { txt_help_group_next, GROUP_NEXT_GROUP },
  299     { txt_help_group_prev, GROUP_PREVIOUS_GROUP },
  300     { txt_help_article_next_unread, GROUP_NEXT_UNREAD_ARTICLE },
  301     { txt_help_article_prev_unread, GROUP_PREVIOUS_UNREAD_ARTICLE },
  302     { txt_help_global_last_art, GLOBAL_LAST_VIEWED },
  303     { txt_help_global_lookup_art, GLOBAL_LOOKUP_MESSAGEID },
  304     { txt_help_group_list_thread, GROUP_LIST_THREAD },
  305     { txt_help_empty_line, NOT_ASSIGNED },
  306     { txt_help_global_search_subj_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
  307     { txt_help_global_search_subj_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
  308     { txt_help_global_search_auth_forwards, GLOBAL_SEARCH_AUTHOR_FORWARD },
  309     { txt_help_global_search_auth_backwards, GLOBAL_SEARCH_AUTHOR_BACKWARD },
  310     { txt_help_global_search_body, GLOBAL_SEARCH_BODY },
  311     { txt_help_global_search_body_comment, NOT_ASSIGNED },
  312     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
  313     { txt_help_empty_line, NOT_ASSIGNED },
  314     { txt_help_title_disp, NOT_ASSIGNED },
  315     { txt_help_group_toggle_read_articles, GROUP_TOGGLE_READ_UNREAD },
  316     { txt_help_global_toggle_info_line, GLOBAL_TOGGLE_INFO_LAST_LINE },
  317     { txt_help_select_toggle_descriptions, SELECT_TOGGLE_DESCRIPTIONS },
  318     { txt_help_global_toggle_inverse_video, GLOBAL_TOGGLE_INVERSE_VIDEO },
  319 #ifdef HAVE_COLOR
  320     { txt_help_global_toggle_color, GLOBAL_TOGGLE_COLOR },
  321 #endif /* HAVE_COLOR */
  322     { txt_help_empty_line, NOT_ASSIGNED },
  323     { txt_help_global_toggle_subj_display, GROUP_TOGGLE_SUBJECT_DISPLAY},
  324     { txt_help_group_toggle_threading, GROUP_TOGGLE_THREADING },
  325     { txt_help_group_mark_unsel_art_read, GROUP_MARK_UNSELECTED_ARTICLES_READ },
  326     { txt_help_group_toggle_getart_limit, GROUP_TOGGLE_GET_ARTICLES_LIMIT },
  327     { txt_help_empty_line, NOT_ASSIGNED },
  328     { txt_help_title_ops, NOT_ASSIGNED },
  329     { txt_help_thread_read_article, GROUP_READ_BASENOTE },
  330     { txt_help_article_next_unread, GROUP_NEXT_UNREAD_ARTICLE_OR_GROUP },
  331 #ifndef NO_POSTING
  332     { txt_help_global_post, GLOBAL_POST },
  333     { txt_help_global_post_postponed, GLOBAL_POSTPONED },
  334     { txt_help_article_repost, GROUP_REPOST },
  335     { txt_help_article_cancel, GROUP_CANCEL },
  336 #endif /* NO_POSTING */
  337     { txt_help_empty_line, NOT_ASSIGNED },
  338     { txt_help_global_article_range, GLOBAL_SET_RANGE },
  339     { txt_help_empty_line, NOT_ASSIGNED },
  340     { txt_help_global_mail, GROUP_MAIL },
  341     { txt_help_global_save, GROUP_SAVE },
  342     { txt_help_global_auto_save, GROUP_AUTOSAVE },
  343 #ifndef DONT_HAVE_PIPING
  344     { txt_help_global_pipe, GLOBAL_PIPE },
  345 #endif /* !DONT_HAVE_PIPING */
  346 #ifndef DISABLE_PRINTING
  347     { txt_help_global_print, GLOBAL_PRINT },
  348 #endif /* !DISABLE_PRINTING */
  349     { txt_help_empty_line, NOT_ASSIGNED },
  350     { txt_help_global_tag, GROUP_TAG },
  351     { txt_help_group_tag_parts, GROUP_TAG_PARTS },
  352     { txt_help_group_untag_thread, GROUP_UNTAG },
  353     { txt_help_empty_line, NOT_ASSIGNED },
  354     { txt_help_group_mark_thread_read, GROUP_MARK_THREAD_READ },
  355     { txt_help_group_catchup, CATCHUP },
  356     { txt_help_group_catchup_next, CATCHUP_NEXT_UNREAD },
  357     { txt_help_group_mark_article_unread, MARK_ARTICLE_UNREAD },
  358     { txt_help_group_mark_thread_unread, MARK_THREAD_UNREAD },
  359     { txt_help_mark_feed_read, MARK_FEED_READ },
  360     { txt_help_mark_feed_unread, MARK_FEED_UNREAD },
  361     { txt_help_empty_line, NOT_ASSIGNED },
  362     { txt_help_group_select_all, GROUP_DO_AUTOSELECT },
  363     { txt_help_group_select_thread, GROUP_SELECT_THREAD },
  364     { txt_help_group_select_thread_pattern, GROUP_SELECT_PATTERN },
  365     { txt_help_group_select_thread_if_unread_selected, GROUP_SELECT_THREAD_IF_UNREAD_SELECTED },
  366     { txt_help_group_toggle_thread_selection, GROUP_TOGGLE_SELECT_THREAD },
  367     { txt_help_group_reverse_thread_selection, GROUP_REVERSE_SELECTIONS },
  368     { txt_help_group_undo_thread_selection, GROUP_UNDO_SELECTIONS },
  369     { txt_help_empty_line, NOT_ASSIGNED },
  370     { txt_help_article_autoselect, GLOBAL_MENU_FILTER_SELECT },
  371     { txt_help_article_autokill, GLOBAL_MENU_FILTER_KILL },
  372     { txt_help_article_quick_select, GLOBAL_QUICK_FILTER_SELECT },
  373     { txt_help_article_quick_kill, GLOBAL_QUICK_FILTER_KILL },
  374     { txt_help_global_edit_filter, GLOBAL_EDIT_FILTER},
  375     { txt_help_empty_line, NOT_ASSIGNED },
  376     { txt_help_title_misc, NOT_ASSIGNED },
  377     { txt_help_global_previous_menu, GLOBAL_QUIT },
  378     { txt_help_global_quit_tin, GLOBAL_QUIT_TIN },
  379     { txt_help_global_help, GLOBAL_HELP },
  380     { txt_help_global_toggle_mini_help, GLOBAL_TOGGLE_HELP_DISPLAY },
  381     { txt_help_global_option_menu, GLOBAL_OPTION_MENU },
  382     { txt_help_global_esc, GLOBAL_ABORT },
  383     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  384 #ifndef NO_SHELL_ESCAPE
  385     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  386 #endif /* !NO_SHELL_ESCAPE */
  387     { txt_help_global_posting_history, GLOBAL_DISPLAY_POST_HISTORY },
  388     { txt_help_empty_line, NOT_ASSIGNED },
  389     { txt_help_global_version, GLOBAL_VERSION },
  390     { txt_help_bug_report, GLOBAL_BUGREPORT },
  391     { NULL, NOT_ASSIGNED }
  392 };
  393 
  394 static t_help_page thread_help_page[] = {
  395     { txt_help_title_navi, NOT_ASSIGNED },
  396     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  397     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  398     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  399     { txt_help_global_line_up, GLOBAL_LINE_UP },
  400     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
  401     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
  402     { txt_help_empty_line, NOT_ASSIGNED },
  403     { txt_help_thread_first_article, GLOBAL_FIRST_PAGE },
  404     { txt_help_thread_last_article, GLOBAL_LAST_PAGE },
  405     { txt_help_thread_article_by_num, NOT_ASSIGNED },
  406     { txt_help_global_last_art, GLOBAL_LAST_VIEWED },
  407     { txt_help_global_lookup_art, GLOBAL_LOOKUP_MESSAGEID },
  408     { txt_help_empty_line, NOT_ASSIGNED },
  409     { txt_help_global_search_subj_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
  410     { txt_help_global_search_subj_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
  411     { txt_help_global_search_auth_forwards, GLOBAL_SEARCH_AUTHOR_FORWARD },
  412     { txt_help_global_search_auth_backwards, GLOBAL_SEARCH_AUTHOR_BACKWARD },
  413     { txt_help_global_search_body, GLOBAL_SEARCH_BODY },
  414     { txt_help_global_search_body_comment, NOT_ASSIGNED },
  415     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
  416     { txt_help_empty_line, NOT_ASSIGNED },
  417     { txt_help_title_disp, NOT_ASSIGNED },
  418     { txt_help_global_toggle_info_line, GLOBAL_TOGGLE_INFO_LAST_LINE },
  419     { txt_help_global_toggle_subj_display, THREAD_TOGGLE_SUBJECT_DISPLAY},
  420     { txt_help_global_toggle_inverse_video, GLOBAL_TOGGLE_INVERSE_VIDEO },
  421 #ifdef HAVE_COLOR
  422     { txt_help_global_toggle_color, GLOBAL_TOGGLE_COLOR },
  423 #endif /* HAVE_COLOR */
  424     { txt_help_empty_line, NOT_ASSIGNED },
  425     { txt_help_title_ops, NOT_ASSIGNED },
  426     { txt_help_thread_read_article, THREAD_READ_ARTICLE },
  427     { txt_help_article_next_unread, THREAD_READ_NEXT_ARTICLE_OR_THREAD },
  428 #ifndef NO_POSTING
  429     { txt_help_global_post, GLOBAL_POST },
  430     { txt_help_global_post_postponed, GLOBAL_POSTPONED },
  431     { txt_help_article_cancel, THREAD_CANCEL },
  432 #endif /* NO_POSTING */
  433     { txt_help_empty_line, NOT_ASSIGNED },
  434     { txt_help_global_article_range, GLOBAL_SET_RANGE },
  435     { txt_help_empty_line, NOT_ASSIGNED },
  436     { txt_help_global_mail, THREAD_MAIL },
  437     { txt_help_global_save, THREAD_SAVE },
  438     { txt_help_global_auto_save, THREAD_AUTOSAVE },
  439 #ifndef DONT_HAVE_PIPING
  440     { txt_help_global_pipe, GLOBAL_PIPE },
  441 #endif /* !DONT_HAVE_PIPING */
  442 #ifndef DISABLE_PRINTING
  443     { txt_help_global_print, GLOBAL_PRINT },
  444 #endif /* !DISABLE_PRINTING */
  445     { txt_help_empty_line, NOT_ASSIGNED },
  446     { txt_help_global_tag, THREAD_TAG },
  447     { txt_help_group_untag_thread, THREAD_UNTAG },
  448     { txt_help_empty_line, NOT_ASSIGNED },
  449     { txt_help_thread_mark_article_read, THREAD_MARK_ARTICLE_READ },
  450     { txt_help_thread_catchup, CATCHUP },
  451     { txt_help_thread_catchup_next_unread, CATCHUP_NEXT_UNREAD },
  452     { txt_help_thread_mark_article_unread, MARK_ARTICLE_UNREAD },
  453     { txt_help_thread_mark_thread_unread, MARK_THREAD_UNREAD },
  454     { txt_help_mark_feed_read, MARK_FEED_READ },
  455     { txt_help_mark_feed_unread, MARK_FEED_UNREAD },
  456     { txt_help_empty_line, NOT_ASSIGNED },
  457     { txt_help_group_select_thread, THREAD_SELECT_ARTICLE },
  458     { txt_help_group_toggle_thread_selection, THREAD_TOGGLE_ARTICLE_SELECTION },
  459     { txt_help_group_reverse_thread_selection, THREAD_REVERSE_SELECTIONS },
  460     { txt_help_group_undo_thread_selection, THREAD_UNDO_SELECTIONS },
  461     { txt_help_empty_line, NOT_ASSIGNED },
  462     { txt_help_article_autoselect, GLOBAL_MENU_FILTER_SELECT },
  463     { txt_help_article_autokill, GLOBAL_MENU_FILTER_KILL },
  464     { txt_help_global_edit_filter, GLOBAL_EDIT_FILTER },
  465     { txt_help_empty_line, NOT_ASSIGNED },
  466     { txt_help_title_misc, NOT_ASSIGNED },
  467     { txt_help_global_previous_menu, GLOBAL_QUIT },
  468     { txt_help_global_quit_tin, GLOBAL_QUIT_TIN },
  469     { txt_help_global_help, GLOBAL_HELP },
  470     { txt_help_global_toggle_mini_help, GLOBAL_TOGGLE_HELP_DISPLAY },
  471     { txt_help_global_option_menu, GLOBAL_OPTION_MENU },
  472     { txt_help_global_esc, GLOBAL_ABORT },
  473     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  474 #ifndef NO_SHELL_ESCAPE
  475     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  476 #endif /* !NO_SHELL_ESCAPE */
  477     { txt_help_global_posting_history, GLOBAL_DISPLAY_POST_HISTORY },
  478     { txt_help_empty_line, NOT_ASSIGNED },
  479     { txt_help_global_version, GLOBAL_VERSION },
  480     { txt_help_bug_report, GLOBAL_BUGREPORT },
  481     { NULL, NOT_ASSIGNED }
  482 };
  483 
  484 static t_help_page page_help_page[] = {
  485     { txt_help_title_navi, NOT_ASSIGNED },
  486     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  487     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  488     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  489     { txt_help_global_line_up, GLOBAL_LINE_UP },
  490     { txt_help_article_first_page, GLOBAL_FIRST_PAGE },
  491     { txt_help_article_last_page, GLOBAL_LAST_PAGE },
  492     { txt_help_empty_line, NOT_ASSIGNED },
  493     { txt_help_article_by_num, NOT_ASSIGNED },
  494     { txt_help_article_next_thread, PAGE_NEXT_THREAD },
  495     { txt_help_article_next_unread, PAGE_NEXT_UNREAD },
  496     { txt_help_article_next, PAGE_NEXT_ARTICLE },
  497     { txt_help_article_next_unread, PAGE_NEXT_UNREAD_ARTICLE },
  498     { txt_help_article_prev, PAGE_PREVIOUS_ARTICLE },
  499     { txt_help_article_prev_unread, PAGE_PREVIOUS_UNREAD_ARTICLE },
  500     { txt_help_article_first_in_thread, PAGE_TOP_THREAD },
  501     { txt_help_article_last_in_thread, PAGE_BOTTOM_THREAD },
  502     { txt_help_global_last_art, GLOBAL_LAST_VIEWED },
  503     { txt_help_group_list_thread, PAGE_LIST_THREAD },
  504     { txt_help_article_parent, PAGE_GOTO_PARENT },
  505     { txt_help_global_lookup_art, GLOBAL_LOOKUP_MESSAGEID },
  506     { txt_help_article_quit_to_select_level, PAGE_GROUP_SELECT },
  507     { txt_help_article_skip_quote, PAGE_SKIP_INCLUDED_TEXT },
  508     { txt_help_empty_line, NOT_ASSIGNED },
  509     { txt_help_article_search_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
  510     { txt_help_article_search_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
  511     { txt_help_global_search_auth_forwards, GLOBAL_SEARCH_AUTHOR_FORWARD },
  512     { txt_help_global_search_auth_backwards, GLOBAL_SEARCH_AUTHOR_BACKWARD },
  513     { txt_help_global_search_body, GLOBAL_SEARCH_BODY },
  514     { txt_help_global_search_body_comment, NOT_ASSIGNED },
  515     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
  516     { txt_help_empty_line, NOT_ASSIGNED },
  517     { txt_help_title_disp, NOT_ASSIGNED },
  518     { txt_help_global_toggle_info_line, GLOBAL_TOGGLE_INFO_LAST_LINE },
  519     { txt_help_article_toggle_rot13, PAGE_TOGGLE_ROT13 },
  520     { txt_help_global_toggle_inverse_video, GLOBAL_TOGGLE_INVERSE_VIDEO },
  521     { txt_help_article_show_raw, PAGE_TOGGLE_RAW },
  522     { txt_help_article_toggle_headers, PAGE_TOGGLE_HEADERS },
  523 #ifdef HAVE_COLOR
  524     { txt_help_global_toggle_color, GLOBAL_TOGGLE_COLOR },
  525 #endif /* HAVE_COLOR */
  526     { txt_help_article_toggle_highlight, PAGE_TOGGLE_HIGHLIGHTING },
  527     { txt_help_article_toggle_tex2iso, PAGE_TOGGLE_TEX2ISO },
  528     { txt_help_article_toggle_tabwidth, PAGE_TOGGLE_TABS },
  529     { txt_help_article_toggle_uue, PAGE_TOGGLE_UUE },
  530     { txt_help_article_toggle_formfeed, PAGE_REVEAL },
  531     { txt_help_empty_line, NOT_ASSIGNED },
  532     { txt_help_title_ops, NOT_ASSIGNED },
  533 #ifndef NO_POSTING
  534     { txt_help_global_post, GLOBAL_POST },
  535     { txt_help_global_post_postponed, GLOBAL_POSTPONED },
  536     { txt_help_article_followup, PAGE_FOLLOWUP_QUOTE },
  537     { txt_help_article_followup_no_quote, PAGE_FOLLOWUP },
  538     { txt_help_article_followup_with_header, PAGE_FOLLOWUP_QUOTE_HEADERS },
  539     { txt_help_article_repost, PAGE_REPOST },
  540     { txt_help_article_cancel, PAGE_CANCEL },
  541 #endif /* NO_POSTING */
  542     { txt_help_article_reply, PAGE_REPLY_QUOTE },
  543     { txt_help_article_reply_no_quote, PAGE_REPLY },
  544     { txt_help_article_reply_with_header, PAGE_REPLY_QUOTE_HEADERS },
  545     { txt_help_article_edit, PAGE_EDIT_ARTICLE },
  546     { txt_help_empty_line, NOT_ASSIGNED },
  547     { txt_help_global_mail, PAGE_MAIL },
  548     { txt_help_global_save, PAGE_SAVE },
  549     { txt_help_global_auto_save, PAGE_AUTOSAVE },
  550 #ifndef DONT_HAVE_PIPING
  551     { txt_help_global_pipe, GLOBAL_PIPE },
  552 #endif /* !DONT_HAVE_PIPING */
  553 #ifndef DISABLE_PRINTING
  554     { txt_help_global_print, GLOBAL_PRINT },
  555 #endif /* !DISABLE_PRINTING */
  556     { txt_help_article_view_attachments, PAGE_VIEW_ATTACHMENTS },
  557     { txt_help_empty_line, NOT_ASSIGNED },
  558     { txt_help_global_tag, PAGE_TAG },
  559     { txt_help_empty_line, NOT_ASSIGNED },
  560     { txt_help_article_mark_thread_read, PAGE_MARK_THREAD_READ },
  561     { txt_help_thread_catchup, CATCHUP },
  562     { txt_help_thread_catchup_next_unread, CATCHUP_NEXT_UNREAD },
  563     { txt_help_group_mark_article_unread, MARK_ARTICLE_UNREAD },
  564     { txt_help_thread_mark_thread_unread, MARK_THREAD_UNREAD },
  565     { txt_help_empty_line, NOT_ASSIGNED },
  566     { txt_help_article_autoselect, GLOBAL_MENU_FILTER_SELECT },
  567     { txt_help_article_autokill, GLOBAL_MENU_FILTER_KILL },
  568     { txt_help_article_quick_select, GLOBAL_QUICK_FILTER_SELECT },
  569     { txt_help_article_quick_kill, GLOBAL_QUICK_FILTER_KILL },
  570     { txt_help_global_edit_filter, GLOBAL_EDIT_FILTER },
  571     { txt_help_empty_line, NOT_ASSIGNED },
  572     { txt_help_title_misc, NOT_ASSIGNED },
  573     { txt_help_article_browse_urls, PAGE_VIEW_URL },
  574     { txt_help_global_previous_menu, GLOBAL_QUIT },
  575     { txt_help_global_quit_tin, GLOBAL_QUIT_TIN },
  576     { txt_help_global_help, GLOBAL_HELP },
  577     { txt_help_global_toggle_mini_help, GLOBAL_TOGGLE_HELP_DISPLAY },
  578     { txt_help_global_option_menu, GLOBAL_OPTION_MENU },
  579     { txt_help_global_esc, GLOBAL_ABORT },
  580     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  581 #ifndef NO_SHELL_ESCAPE
  582     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  583 #endif /* !NO_SHELL_ESCAPE */
  584     { txt_help_global_posting_history, GLOBAL_DISPLAY_POST_HISTORY },
  585 #ifdef HAVE_PGP_GPG
  586     { txt_help_empty_line, NOT_ASSIGNED },
  587     { txt_help_article_pgp, PAGE_PGP_CHECK_ARTICLE },
  588 #endif /* HAVE_PGP_GPG */
  589     { txt_help_empty_line, NOT_ASSIGNED },
  590     { txt_help_global_version, GLOBAL_VERSION },
  591     { NULL, NOT_ASSIGNED }
  592 };
  593 
  594 static t_help_page url_help_page[] = {
  595     { txt_help_title_navi, NOT_ASSIGNED },
  596     { txt_help_global_page_down, GLOBAL_PAGE_DOWN },
  597     { txt_help_global_page_up, GLOBAL_PAGE_UP },
  598     { txt_help_global_line_down, GLOBAL_LINE_DOWN },
  599     { txt_help_global_line_up, GLOBAL_LINE_UP },
  600     { txt_help_global_scroll_down, GLOBAL_SCROLL_DOWN },
  601     { txt_help_global_scroll_up, GLOBAL_SCROLL_UP },
  602     { txt_help_empty_line, NOT_ASSIGNED },
  603     { txt_help_url_first_url, GLOBAL_FIRST_PAGE },
  604     { txt_help_url_last_url, GLOBAL_LAST_PAGE },
  605     { txt_help_url_goto_url, NOT_ASSIGNED },
  606     { txt_help_empty_line, NOT_ASSIGNED },
  607     { txt_help_title_url_ops, NOT_ASSIGNED },
  608     { txt_help_url_select, URL_SELECT },
  609     { txt_help_empty_line, NOT_ASSIGNED },
  610     { txt_help_url_search_forwards, GLOBAL_SEARCH_SUBJECT_FORWARD },
  611     { txt_help_url_search_backwards, GLOBAL_SEARCH_SUBJECT_BACKWARD },
  612     { txt_help_global_search_repeat, GLOBAL_SEARCH_REPEAT },
  613     { txt_help_empty_line, NOT_ASSIGNED },
  614     { txt_help_title_disp, NOT_ASSIGNED },
  615     { txt_help_url_toggle_info_line, GLOBAL_TOGGLE_INFO_LAST_LINE },
  616     { txt_help_empty_line, NOT_ASSIGNED },
  617     { txt_help_title_misc, NOT_ASSIGNED },
  618     { txt_help_select_quit, GLOBAL_QUIT },
  619     { txt_help_global_help, GLOBAL_HELP },
  620     { txt_help_global_toggle_mini_help, GLOBAL_TOGGLE_HELP_DISPLAY },
  621     { txt_help_global_esc, GLOBAL_ABORT },
  622     { txt_help_global_redraw_screen, GLOBAL_REDRAW_SCREEN },
  623 #ifndef NO_SHELL_ESCAPE
  624     { txt_help_global_shell_escape, GLOBAL_SHELL_ESCAPE },
  625 #endif /* !NO_SHELL_ESCAPE */
  626     { NULL, NOT_ASSIGNED }
  627 };
  628 
  629 
  630 static void
  631 make_help_page(
  632     FILE *fp,
  633     const t_help_page *helppage,
  634     const struct keylist keys)
  635 {
  636     char *buf;
  637     char *last;
  638     char key[MAXKEYLEN];
  639     /*
  640      * length is only needed to pass it to expand_ctrl_chars()
  641      * we have no need for the value
  642      */
  643     size_t length;
  644     size_t i;
  645 
  646     if (!helppage)
  647         return;
  648 
  649     buf = my_malloc(LEN);
  650     last = my_malloc(LEN);
  651 
  652     last[0] = '\0';
  653 
  654     while (helppage->helptext) {
  655         if (helppage->func == NOT_ASSIGNED) {
  656             /*
  657              * as expand_ctrl_chars() may has shrunk buf
  658              * make sure buf is large enough to contain the helpline
  659              */
  660             buf = my_realloc(buf, LEN);
  661 
  662             if (!strlen(helppage->helptext))    /* avoid translation of empty strings */
  663                 strcpy(buf, "\n");
  664             else
  665                 strncpy(buf, _(helppage->helptext), LEN);
  666             buf[LEN - 1] = '\0';
  667             expand_ctrl_chars(&buf, &length, 8);
  668             fprintf(fp, "%s\n", buf);
  669         } else {
  670             for (i = 0; i < keys.used; i++) {
  671                 if (keys.list[i].function == helppage->func && keys.list[i].key) {
  672                     buf = my_realloc(buf, LEN);
  673                     snprintf(buf, LEN, "%s\t  %s", printascii(key, keys.list[i].key), _(helppage->helptext));
  674                     expand_ctrl_chars(&buf, &length, 8);
  675                     if (strcmp(last, buf)) {
  676                         fprintf(fp, "%s\n", buf);
  677                         strncpy(last, buf, LEN - 1);
  678                     }
  679                 }
  680             }
  681         }
  682         helppage++;
  683     }
  684 
  685     free(buf);
  686     free(last);
  687 }
  688 
  689 
  690 void
  691 show_help_page(
  692     const int level,
  693     const char *title)
  694 {
  695     FILE *fp;
  696 
  697     if (!(fp = tmpfile()))
  698         return;
  699 
  700     switch (level) {
  701         case ATTACHMENT_LEVEL:
  702             make_help_page(fp, attachment_help_page, attachment_keys);
  703             break;
  704 
  705         case ATTRIB_LEVEL:
  706             make_help_page(fp, attrib_help_page, option_menu_keys);
  707             break;
  708 
  709         case CONFIG_LEVEL:
  710             make_help_page(fp, config_help_page, option_menu_keys);
  711             break;
  712 
  713         case SCOPE_LEVEL:
  714             make_help_page(fp, scope_help_page, scope_keys);
  715             break;
  716 
  717         case SELECT_LEVEL:
  718             make_help_page(fp, select_help_page, select_keys);
  719             break;
  720 
  721         case GROUP_LEVEL:
  722             make_help_page(fp, group_help_page, group_keys);
  723             break;
  724 
  725         case THREAD_LEVEL:
  726             make_help_page(fp, thread_help_page, thread_keys);
  727             break;
  728 
  729         case PAGE_LEVEL:
  730             make_help_page(fp, page_help_page, page_keys);
  731             break;
  732 
  733         case URL_LEVEL:
  734             make_help_page(fp, url_help_page, url_keys);
  735             break;
  736 
  737         case INFO_PAGER:
  738         default: /* should not happen */
  739             error_message(2, _(txt_error_unknown_dlevel));
  740             fclose(fp);
  741             return;
  742     }
  743 
  744     info_pager(fp, title, TRUE);
  745     fclose(fp);
  746     info_pager(NULL, NULL, TRUE); /* free mem */
  747 }
  748 
  749 
  750 void
  751 show_mini_help(
  752     int level)
  753 {
  754     char buf[LEN];
  755     char key[20][MAXKEYLEN];
  756     int line;
  757     size_t bufs;
  758 
  759     if (!tinrc.beginner_level)
  760         return;
  761 
  762     line = NOTESLINES + MINI_HELP_LINES - 2;
  763     bufs = sizeof(buf) - 1;
  764 
  765 #ifdef HAVE_COLOR
  766     fcol(tinrc.col_minihelp);
  767 #endif /* HAVE_COLOR */
  768 
  769     switch (level) {
  770         case ATTACHMENT_LEVEL:
  771             snprintf(buf, bufs, _(txt_mini_attachment_1),
  772                 printascii(key[0], func_to_key(GLOBAL_LINE_DOWN, attachment_keys)),
  773                 printascii(key[1], func_to_key(GLOBAL_LINE_UP, attachment_keys)),
  774                 printascii(key[2], func_to_key(GLOBAL_HELP, attachment_keys)),
  775                 printascii(key[3], func_to_key(GLOBAL_QUIT, attachment_keys)));
  776             center_line(line, FALSE, buf);
  777 #ifndef DONT_HAVE_PIPING
  778             snprintf(buf, bufs, _(txt_mini_attachment_2),
  779                 printascii(key[0], func_to_key(ATTACHMENT_SELECT, attachment_keys)),
  780                 printascii(key[5], func_to_key(ATTACHMENT_PIPE, attachment_keys)),
  781                 printascii(key[6], func_to_key(GLOBAL_PIPE, attachment_keys)),
  782                 printascii(key[1], func_to_key(ATTACHMENT_SAVE, attachment_keys)),
  783                 printascii(key[2], func_to_key(ATTACHMENT_TAG, attachment_keys)),
  784                 printascii(key[3], func_to_key(ATTACHMENT_TAG_PATTERN, attachment_keys)),
  785                 printascii(key[4], func_to_key(ATTACHMENT_UNTAG, attachment_keys)));
  786 #else
  787             snprintf(buf, bufs, _(txt_mini_attachment_2),
  788                 printascii(key[0], func_to_key(ATTACHMENT_SELECT, attachment_keys)),
  789                 printascii(key[1], func_to_key(ATTACHMENT_SAVE, attachment_keys)),
  790                 printascii(key[2], func_to_key(ATTACHMENT_TAG, attachment_keys)),
  791                 printascii(key[3], func_to_key(ATTACHMENT_TAG_PATTERN, attachment_keys)),
  792                 printascii(key[4], func_to_key(ATTACHMENT_UNTAG, attachment_keys)));
  793 #endif /* !DONT_HAVE_PIPING */
  794             center_line(line + 1, FALSE, buf);
  795             snprintf(buf, bufs, _(txt_mini_attachment_3),
  796                 printascii(key[1], func_to_key(ATTACHMENT_TOGGLE_TAGGED, attachment_keys)),
  797                 printascii(key[2], func_to_key(GLOBAL_SEARCH_SUBJECT_FORWARD, attachment_keys)),
  798                 printascii(key[3], func_to_key(GLOBAL_SEARCH_SUBJECT_BACKWARD, attachment_keys)),
  799                 printascii(key[4], func_to_key(GLOBAL_SEARCH_REPEAT, attachment_keys)));
  800             center_line(line + 2, FALSE, buf);
  801             break;
  802 
  803         case SCOPE_LEVEL:
  804             snprintf(buf, bufs, _(txt_mini_scope_1),
  805                 printascii(key[0], func_to_key(SCOPE_ADD, scope_keys)),
  806                 printascii(key[1], func_to_key(SCOPE_MOVE, scope_keys)),
  807                 printascii(key[2], func_to_key(SCOPE_RENAME, scope_keys)),
  808                 printascii(key[3], func_to_key(SCOPE_DELETE, scope_keys)));
  809             center_line(line, FALSE, buf);
  810             snprintf(buf, bufs, _(txt_mini_scope_2),
  811                 printascii(key[0], func_to_key(GLOBAL_LINE_DOWN, scope_keys)),
  812                 printascii(key[1], func_to_key(GLOBAL_LINE_UP, scope_keys)),
  813                 printascii(key[2], func_to_key(GLOBAL_HELP, scope_keys)),
  814                 printascii(key[3], func_to_key(GLOBAL_QUIT, scope_keys)));
  815             center_line(line + 1, FALSE, buf);
  816             break;
  817 
  818         case SELECT_LEVEL:
  819             snprintf(buf, bufs, _(txt_mini_select_1),
  820                 printascii(key[0], func_to_key(SELECT_ENTER_NEXT_UNREAD_GROUP, select_keys)),
  821                 printascii(key[1], func_to_key(SELECT_GOTO, select_keys)),
  822                 printascii(key[2], func_to_key(GLOBAL_SEARCH_SUBJECT_FORWARD, select_keys)),
  823                 printascii(key[3], func_to_key(CATCHUP, select_keys)));
  824             center_line(line, FALSE, buf);
  825             snprintf(buf, bufs, _(txt_mini_select_2),
  826                 printascii(key[0], func_to_key(GLOBAL_LINE_DOWN, select_keys)),
  827                 printascii(key[1], func_to_key(GLOBAL_LINE_UP, select_keys)),
  828                 printascii(key[2], func_to_key(GLOBAL_HELP, select_keys)),
  829                 printascii(key[3], func_to_key(SELECT_MOVE_GROUP, select_keys)),
  830                 printascii(key[4], func_to_key(GLOBAL_QUIT, select_keys)),
  831                 printascii(key[5], func_to_key(SELECT_TOGGLE_READ_DISPLAY, select_keys)));
  832             center_line(line + 1, FALSE, buf);
  833             snprintf(buf, bufs, _(txt_mini_select_3),
  834                 printascii(key[0], func_to_key(SELECT_SUBSCRIBE, select_keys)),
  835                 printascii(key[1], func_to_key(SELECT_SUBSCRIBE_PATTERN, select_keys)),
  836                 printascii(key[2], func_to_key(SELECT_UNSUBSCRIBE, select_keys)),
  837                 printascii(key[3], func_to_key(SELECT_UNSUBSCRIBE_PATTERN, select_keys)),
  838                 printascii(key[4], func_to_key(SELECT_YANK_ACTIVE, select_keys)));
  839             center_line(line + 2, FALSE, buf);
  840             break;
  841 
  842         case GROUP_LEVEL:
  843             snprintf(buf, bufs, _(txt_mini_group_1),
  844                 printascii(key[0], func_to_key(GROUP_NEXT_UNREAD_ARTICLE_OR_GROUP, group_keys)),
  845                 printascii(key[1], func_to_key(GLOBAL_SEARCH_SUBJECT_FORWARD, group_keys)),
  846                 printascii(key[2], func_to_key(GLOBAL_MENU_FILTER_KILL, group_keys)));
  847             center_line(line, FALSE, buf);
  848             snprintf(buf, bufs, _(txt_mini_group_2),
  849                 printascii(key[0], func_to_key(GLOBAL_SEARCH_AUTHOR_FORWARD, group_keys)),
  850                 printascii(key[1], func_to_key(CATCHUP, group_keys)),
  851                 printascii(key[2], func_to_key(GLOBAL_LINE_DOWN, group_keys)),
  852                 printascii(key[3], func_to_key(GLOBAL_LINE_UP, group_keys)),
  853                 printascii(key[4], func_to_key(GROUP_MARK_THREAD_READ, group_keys)),
  854                 printascii(key[5], func_to_key(GROUP_LIST_THREAD, group_keys)));
  855             center_line(line + 1, FALSE, buf);
  856 
  857 #if defined(DONT_HAVE_PIPING) && defined(DISABLE_PRINTING)
  858             snprintf(buf, bufs, _(txt_mini_group_3),
  859                 printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
  860                 printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
  861                 printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
  862                 printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
  863                 printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
  864 #else
  865 #   ifdef DONT_HAVE_PIPING
  866             snprintf(buf, bufs, _(txt_mini_group_3),
  867                 printascii(key[1], func_to_key(GROUP_MAIL, group_keys)),
  868                 printascii(key[2], func_to_key(GLOBAL_PRINT, group_keys)),
  869                 printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
  870                 printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
  871                 printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
  872                 printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
  873                 printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
  874 #   else
  875 #       ifdef DISABLE_PRINTING
  876             snprintf(buf, bufs, _(txt_mini_group_3),
  877                 printascii(key[0], func_to_key(GLOBAL_PIPE, group_keys)),
  878                 printascii(key[1], func_to_key(GROUP_MAIL, group_keys)),
  879                 printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
  880                 printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
  881                 printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
  882                 printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
  883                 printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
  884 #       else
  885             snprintf(buf, bufs, _(txt_mini_group_3),
  886                 printascii(key[0], func_to_key(GLOBAL_PIPE, group_keys)),
  887                 printascii(key[1], func_to_key(GROUP_MAIL, group_keys)),
  888                 printascii(key[2], func_to_key(GLOBAL_PRINT, group_keys)),
  889                 printascii(key[3], func_to_key(GLOBAL_QUIT, group_keys)),
  890                 printascii(key[4], func_to_key(GROUP_TOGGLE_READ_UNREAD, group_keys)),
  891                 printascii(key[5], func_to_key(GROUP_SAVE, group_keys)),
  892                 printascii(key[6], func_to_key(GROUP_TAG, group_keys)),
  893                 printascii(key[7], func_to_key(GLOBAL_POST, group_keys)));
  894 #       endif /* DISABLE_PRINTING */
  895 #   endif /* DONT_HAVE_PIPING */
  896 #endif /* DONT_HAVE_PIPING && DISABLE_PRINTING */
  897 
  898             center_line(line + 2, FALSE, buf);
  899             break;
  900 
  901         case THREAD_LEVEL:
  902             snprintf(buf, bufs, _(txt_mini_thread_1),
  903                 printascii(key[0], func_to_key(THREAD_READ_NEXT_ARTICLE_OR_THREAD, thread_keys)),
  904                 printascii(key[1], func_to_key(CATCHUP, thread_keys)),
  905                 printascii(key[2], func_to_key(THREAD_TOGGLE_SUBJECT_DISPLAY, thread_keys)));
  906             center_line(line, FALSE, buf);
  907             snprintf(buf, bufs, _(txt_mini_thread_2),
  908                 printascii(key[0], func_to_key(GLOBAL_HELP, thread_keys)),
  909                 printascii(key[1], func_to_key(GLOBAL_LINE_DOWN, thread_keys)),
  910                 printascii(key[2], func_to_key(GLOBAL_LINE_UP, thread_keys)),
  911                 printascii(key[3], func_to_key(GLOBAL_QUIT, thread_keys)),
  912                 printascii(key[4], func_to_key(THREAD_TAG, thread_keys)),
  913                 printascii(key[5], func_to_key(MARK_ARTICLE_UNREAD, thread_keys)));
  914             center_line(line + 1, FALSE, buf);
  915             break;
  916 
  917         case PAGE_LEVEL:
  918             snprintf(buf, bufs, _(txt_mini_page_1),
  919                 printascii(key[0], func_to_key(PAGE_NEXT_UNREAD, page_keys)),
  920                 printascii(key[1], func_to_key(GLOBAL_SEARCH_SUBJECT_FORWARD, page_keys)),
  921                 printascii(key[2], func_to_key(GLOBAL_MENU_FILTER_KILL, page_keys)));
  922             center_line(line, FALSE, buf);
  923             snprintf(buf, bufs, _(txt_mini_page_2),
  924                 printascii(key[0], func_to_key(GLOBAL_SEARCH_AUTHOR_FORWARD, page_keys)),
  925                 printascii(key[1], func_to_key(GLOBAL_SEARCH_BODY, page_keys)),
  926                 printascii(key[2], func_to_key(CATCHUP, page_keys)),
  927                 printascii(key[3], func_to_key(PAGE_FOLLOWUP_QUOTE, page_keys)),
  928                 printascii(key[4], func_to_key(PAGE_MARK_THREAD_READ, page_keys)));
  929             center_line(line + 1, FALSE, buf);
  930 
  931 #if defined(DONT_HAVE_PIPING) && defined(DISABLE_PRINTING)
  932             snprintf(buf, bufs, _(txt_mini_page_3),
  933                 printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
  934                 printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
  935                 printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
  936                 printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
  937                 printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
  938                 printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
  939 #else
  940 #   ifdef DONT_HAVE_PIPING
  941             snprintf(buf, bufs, _(txt_mini_page_3),
  942                 printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
  943                 printascii(key[2], func_to_key(GLOBAL_PRINT, page_keys)),
  944                 printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
  945                 printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
  946                 printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
  947                 printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
  948                 printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
  949 #   else
  950 #       ifdef DISABLE_PRINTING
  951             snprintf(buf, bufs, _(txt_mini_page_3),
  952                 printascii(key[0], func_to_key(GLOBAL_PIPE, page_keys)),
  953                 printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
  954                 printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
  955                 printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
  956                 printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
  957                 printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
  958                 printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
  959 #       else
  960             snprintf(buf, bufs, _(txt_mini_page_3),
  961                 printascii(key[0], func_to_key(GLOBAL_PIPE, page_keys)),
  962                 printascii(key[1], func_to_key(PAGE_MAIL, page_keys)),
  963                 printascii(key[2], func_to_key(GLOBAL_PRINT, page_keys)),
  964                 printascii(key[3], func_to_key(GLOBAL_QUIT, page_keys)),
  965                 printascii(key[4], func_to_key(PAGE_REPLY_QUOTE, page_keys)),
  966                 printascii(key[5], func_to_key(PAGE_SAVE, page_keys)),
  967                 printascii(key[6], func_to_key(PAGE_TAG, page_keys)),
  968                 printascii(key[7], func_to_key(GLOBAL_POST, page_keys)));
  969 #       endif /* DISABLE_PRINTING */
  970 #   endif /* DONT_HAVE_PIPING */
  971 #endif /* DONT_HAVE_PIPING && DISABLE_PRINTING */
  972 
  973             center_line(line + 2, FALSE, buf);
  974             break;
  975 
  976         case URL_LEVEL:
  977             snprintf(buf, bufs, _(txt_mini_url_1),
  978                 printascii(key[0], func_to_key(GLOBAL_LINE_DOWN, url_keys)),
  979                 printascii(key[1], func_to_key(GLOBAL_LINE_UP, url_keys)),
  980                 printascii(key[2], func_to_key(GLOBAL_HELP, url_keys)),
  981                 printascii(key[3], func_to_key(GLOBAL_QUIT, url_keys)));
  982             center_line(line, FALSE, buf);
  983             snprintf(buf, bufs, _(txt_mini_url_2),
  984                 printascii(key[2], func_to_key(GLOBAL_SEARCH_SUBJECT_FORWARD, url_keys)),
  985                 printascii(key[3], func_to_key(GLOBAL_SEARCH_SUBJECT_BACKWARD, url_keys)),
  986                 printascii(key[4], func_to_key(GLOBAL_SEARCH_REPEAT, url_keys)));
  987             center_line(line + 1, FALSE, buf);
  988             break;
  989 
  990         case INFO_PAGER:
  991             snprintf(buf, bufs, _(txt_mini_info_1),
  992                 printascii(key[0], func_to_key(GLOBAL_LINE_UP, info_keys)),
  993                 printascii(key[1], func_to_key(GLOBAL_LINE_DOWN, info_keys)),
  994                 printascii(key[2], func_to_key(GLOBAL_PAGE_UP, info_keys)),
  995                 printascii(key[3], func_to_key(GLOBAL_PAGE_DOWN, info_keys)),
  996                 printascii(key[4], func_to_key(GLOBAL_FIRST_PAGE, info_keys)),
  997                 printascii(key[5], func_to_key(GLOBAL_LAST_PAGE, info_keys)));
  998             center_line(line, FALSE, buf);
  999             snprintf(buf, bufs, _(txt_mini_info_2),
 1000                 printascii(key[0], func_to_key(GLOBAL_SEARCH_SUBJECT_FORWARD, info_keys)),
 1001                 printascii(key[1], func_to_key(GLOBAL_SEARCH_SUBJECT_BACKWARD, info_keys)),
 1002                 printascii(key[2], func_to_key(GLOBAL_QUIT, info_keys)));
 1003             center_line(line + 1, FALSE, buf);
 1004             break;
 1005 
 1006         default: /* should not happen */
 1007             error_message(2, _(txt_error_unknown_dlevel));
 1008             break;
 1009     }
 1010 #ifdef HAVE_COLOR
 1011     fcol(tinrc.col_normal);
 1012 #endif /* HAVE_COLOR */
 1013 }
 1014 
 1015 
 1016 void
 1017 toggle_mini_help(
 1018     int level)
 1019 {
 1020     tinrc.beginner_level = bool_not(tinrc.beginner_level);
 1021     set_noteslines(cLINES);
 1022     show_mini_help(level);
 1023 }