summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/info
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/texinfo/info')
-rw-r--r--contrib/texinfo/info/doc.c222
-rw-r--r--contrib/texinfo/info/doc.h65
-rw-r--r--contrib/texinfo/info/echo-area.c30
-rw-r--r--contrib/texinfo/info/filesys.c44
-rw-r--r--contrib/texinfo/info/funs.h117
-rw-r--r--contrib/texinfo/info/info.c100
-rw-r--r--contrib/texinfo/info/info.h25
-rw-r--r--contrib/texinfo/info/infodoc.c615
-rw-r--r--contrib/texinfo/info/infokey.c908
-rw-r--r--contrib/texinfo/info/infokey.h128
-rw-r--r--contrib/texinfo/info/infomap.c1110
-rw-r--r--contrib/texinfo/info/infomap.h13
-rw-r--r--contrib/texinfo/info/key.c146
-rw-r--r--contrib/texinfo/info/key.h35
-rw-r--r--contrib/texinfo/info/m-x.c43
-rw-r--r--contrib/texinfo/info/man.c33
-rw-r--r--contrib/texinfo/info/nodes.c76
-rw-r--r--contrib/texinfo/info/session.c291
-rw-r--r--contrib/texinfo/info/session.h5
-rw-r--r--contrib/texinfo/info/termdep.h11
-rw-r--r--contrib/texinfo/info/terminal.c56
-rw-r--r--contrib/texinfo/info/terminal.h13
-rw-r--r--contrib/texinfo/info/variables.c44
-rw-r--r--contrib/texinfo/info/window.c51
24 files changed, 3621 insertions, 560 deletions
diff --git a/contrib/texinfo/info/doc.c b/contrib/texinfo/info/doc.c
index e9756e4e..4ca2266 100644
--- a/contrib/texinfo/info/doc.c
+++ b/contrib/texinfo/info/doc.c
@@ -18,125 +18,129 @@
a string which is the user-visible name of the function,
and a string which documents its purpose. */
-#include "doc.h"
+#include "info.h"
#include "funs.h"
FUNCTION_DOC function_doc_array[] = {
/* Commands found in "./session.c". */
- { info_next_line, "next-line", "Move down to the next line" },
- { info_prev_line, "prev-line", "Move up to the previous line" },
- { info_end_of_line, "end-of-line", "Move to the end of the line" },
- { info_beginning_of_line, "beginning-of-line", "Move to the start of the line" },
- { info_forward_char, "forward-char", "Move forward a character" },
- { info_backward_char, "backward-char", "Move backward a character" },
- { info_forward_word, "forward-word", "Move forward a word" },
- { info_backward_word, "backward-word", "Move backward a word" },
- { info_global_next_node, "global-next-node", "Move forwards or down through node structure" },
- { info_global_prev_node, "global-prev-node", "Move backwards or up through node structure" },
- { info_scroll_forward, "scroll-forward", "Scroll forward in this window" },
- { info_scroll_forward_set_window, "scroll-forward-set-window", "Scroll forward in this window and set default window size" },
- { info_scroll_backward, "scroll-backward", "Scroll backward in this window" },
- { info_scroll_backward_set_window, "scroll-backward-set-window", "Scroll backward in this window and set default window size" },
- { info_beginning_of_node, "beginning-of-node", "Move to the start of this node" },
- { info_end_of_node, "end-of-node", "Move to the end of this node" },
- { info_down_line, "down-line", "Scroll down by lines" },
- { info_up_line, "up-line", "Scroll up by lines" },
- { info_scroll_half_screen_down, "scroll-half-screen-down", "Scroll down by half screen size" },
- { info_scroll_half_screen_up, "scroll-half-screen-up", "Scroll up by half screen size" },
- { info_next_window, "next-window", "Select the next window" },
- { info_prev_window, "prev-window", "Select the previous window" },
- { info_split_window, "split-window", "Split the current window" },
- { info_delete_window, "delete-window", "Delete the current window" },
- { info_keep_one_window, "keep-one-window", "Delete all other windows" },
- { info_scroll_other_window, "scroll-other-window", "Scroll the other window" },
- { info_scroll_other_window_backward, "scroll-other-window-backward", "Scroll the other window backward" },
- { info_grow_window, "grow-window", "Grow (or shrink) this window" },
- { info_tile_windows, "tile-windows", "Divide the available screen space among the visible windows" },
- { info_toggle_wrap, "toggle-wrap", "Toggle the state of line wrapping in the current window" },
- { info_next_node, "next-node", "Select the Next node" },
- { info_prev_node, "prev-node", "Select the Prev node" },
- { info_up_node, "up-node", "Select the Up node" },
- { info_last_node, "last-node", "Select the last node in this file" },
- { info_first_node, "first-node", "Select the first node in this file" },
- { info_last_menu_item, "last-menu-item", "Select the last item in this node's menu" },
- { info_menu_digit, "menu-digit", "Select this menu item" },
- { info_menu_item, "menu-item", "Read a menu item and select its node" },
- { info_xref_item, "xref-item", "Read a footnote or cross reference and select its node" },
- { info_find_menu, "find-menu", "Move to the start of this node's menu" },
- { info_visit_menu, "visit-menu", "Visit as many menu items at once as possible" },
- { info_goto_node, "goto-node", "Read a node name and select it" },
- { info_menu_sequence, "menu-sequence", "Read a list of menus starting from dir and follow them" },
- { info_goto_invocation_node, "goto-invocation-node", "Find the node describing program invocation" },
- { info_man, "man", "Read a manpage reference and select it" },
- { info_top_node, "top-node", "Select the node `Top' in this file" },
- { info_dir_node, "dir-node", "Select the node `(dir)'" },
- { info_history_node, "history-node", "Select the most recently selected node" },
- { info_kill_node, "kill-node", "Kill this node" },
- { info_view_file, "view-file", "Read the name of a file and select it" },
- { info_print_node, "print-node", "Pipe the contents of this node through INFO_PRINT_COMMAND" },
- { info_search_case_sensitively, "search-case-sensitively", "Read a string and search for it case-sensitively" },
- { info_search, "search", "Read a string and search for it" },
- { info_search_backward, "search-backward", "Read a string and search backward for it" },
- { info_search_next, "search-next", "Repeat last search in the same direction" },
- { info_search_previous, "search-previous", "Repeat last search in the reverse direction" },
- { isearch_forward, "isearch-forward", "Search interactively for a string as you type it" },
- { isearch_backward, "isearch-backward", "Search interactively for a string as you type it" },
- { info_move_to_prev_xref, "move-to-prev-xref", "Move to the previous cross reference" },
- { info_move_to_next_xref, "move-to-next-xref", "Move to the next cross reference" },
- { info_select_reference_this_line, "select-reference-this-line", "Select reference or menu item appearing on this line" },
- { info_abort_key, "abort-key", "Cancel current operation" },
- { info_move_to_window_line, "move-to-window-line", "Move the cursor to a specific line of the window" },
- { info_redraw_display, "redraw-display", "Redraw the display" },
- { info_quit, "quit", "Quit using Info" },
- { info_do_lowercase_version, "do-lowercase-version", "" },
- { info_add_digit_to_numeric_arg, "add-digit-to-numeric-arg", "Add this digit to the current numeric argument" },
- { info_universal_argument, "universal-argument", "Start (or multiply by 4) the current numeric argument" },
- { info_numeric_arg_digit_loop, "numeric-arg-digit-loop", "Internally used by \\[universal-argument]" },
+ { info_next_line, "next-line", (FUNCTION_KEYSEQ *)0, "Move down to the next line" },
+ { info_prev_line, "prev-line", (FUNCTION_KEYSEQ *)0, "Move up to the previous line" },
+ { info_end_of_line, "end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of the line" },
+ { info_beginning_of_line, "beginning-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of the line" },
+ { info_forward_char, "forward-char", (FUNCTION_KEYSEQ *)0, "Move forward a character" },
+ { info_backward_char, "backward-char", (FUNCTION_KEYSEQ *)0, "Move backward a character" },
+ { info_forward_word, "forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" },
+ { info_backward_word, "backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" },
+ { info_global_next_node, "global-next-node", (FUNCTION_KEYSEQ *)0, "Move forwards or down through node structure" },
+ { info_global_prev_node, "global-prev-node", (FUNCTION_KEYSEQ *)0, "Move backwards or up through node structure" },
+ { info_scroll_forward, "scroll-forward", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window" },
+ { info_scroll_forward_set_window, "scroll-forward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window and set default window size" },
+ { info_scroll_forward_page_only, "scroll-forward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window staying within node" },
+ { info_scroll_forward_page_only_set_window, "scroll-forward-page-only-set-window", (FUNCTION_KEYSEQ *)0, "Scroll forward in this window staying within node and set default window size" },
+ { info_scroll_backward, "scroll-backward", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window" },
+ { info_scroll_backward_set_window, "scroll-backward-set-window", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window and set default window size" },
+ { info_scroll_backward_page_only, "scroll-backward-page-only", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window staying within node" },
+ { info_scroll_backward_page_only_set_window, "scroll-backward-page-only-set-window", (FUNCTION_KEYSEQ *)0, "Scroll backward in this window staying within node and set default window size" },
+ { info_beginning_of_node, "beginning-of-node", (FUNCTION_KEYSEQ *)0, "Move to the start of this node" },
+ { info_end_of_node, "end-of-node", (FUNCTION_KEYSEQ *)0, "Move to the end of this node" },
+ { info_down_line, "down-line", (FUNCTION_KEYSEQ *)0, "Scroll down by lines" },
+ { info_up_line, "up-line", (FUNCTION_KEYSEQ *)0, "Scroll up by lines" },
+ { info_scroll_half_screen_down, "scroll-half-screen-down", (FUNCTION_KEYSEQ *)0, "Scroll down by half screen size" },
+ { info_scroll_half_screen_up, "scroll-half-screen-up", (FUNCTION_KEYSEQ *)0, "Scroll up by half screen size" },
+ { info_next_window, "next-window", (FUNCTION_KEYSEQ *)0, "Select the next window" },
+ { info_prev_window, "prev-window", (FUNCTION_KEYSEQ *)0, "Select the previous window" },
+ { info_split_window, "split-window", (FUNCTION_KEYSEQ *)0, "Split the current window" },
+ { info_delete_window, "delete-window", (FUNCTION_KEYSEQ *)0, "Delete the current window" },
+ { info_keep_one_window, "keep-one-window", (FUNCTION_KEYSEQ *)0, "Delete all other windows" },
+ { info_scroll_other_window, "scroll-other-window", (FUNCTION_KEYSEQ *)0, "Scroll the other window" },
+ { info_scroll_other_window_backward, "scroll-other-window-backward", (FUNCTION_KEYSEQ *)0, "Scroll the other window backward" },
+ { info_grow_window, "grow-window", (FUNCTION_KEYSEQ *)0, "Grow (or shrink) this window" },
+ { info_tile_windows, "tile-windows", (FUNCTION_KEYSEQ *)0, "Divide the available screen space among the visible windows" },
+ { info_toggle_wrap, "toggle-wrap", (FUNCTION_KEYSEQ *)0, "Toggle the state of line wrapping in the current window" },
+ { info_next_node, "next-node", (FUNCTION_KEYSEQ *)0, "Select the Next node" },
+ { info_prev_node, "prev-node", (FUNCTION_KEYSEQ *)0, "Select the Prev node" },
+ { info_up_node, "up-node", (FUNCTION_KEYSEQ *)0, "Select the Up node" },
+ { info_last_node, "last-node", (FUNCTION_KEYSEQ *)0, "Select the last node in this file" },
+ { info_first_node, "first-node", (FUNCTION_KEYSEQ *)0, "Select the first node in this file" },
+ { info_last_menu_item, "last-menu-item", (FUNCTION_KEYSEQ *)0, "Select the last item in this node's menu" },
+ { info_menu_digit, "menu-digit", (FUNCTION_KEYSEQ *)0, "Select this menu item" },
+ { info_menu_item, "menu-item", (FUNCTION_KEYSEQ *)0, "Read a menu item and select its node" },
+ { info_xref_item, "xref-item", (FUNCTION_KEYSEQ *)0, "Read a footnote or cross reference and select its node" },
+ { info_find_menu, "find-menu", (FUNCTION_KEYSEQ *)0, "Move to the start of this node's menu" },
+ { info_visit_menu, "visit-menu", (FUNCTION_KEYSEQ *)0, "Visit as many menu items at once as possible" },
+ { info_goto_node, "goto-node", (FUNCTION_KEYSEQ *)0, "Read a node name and select it" },
+ { info_menu_sequence, "menu-sequence", (FUNCTION_KEYSEQ *)0, "Read a list of menus starting from dir and follow them" },
+ { info_goto_invocation_node, "goto-invocation-node", (FUNCTION_KEYSEQ *)0, "Find the node describing program invocation" },
+ { info_man, "man", (FUNCTION_KEYSEQ *)0, "Read a manpage reference and select it" },
+ { info_top_node, "top-node", (FUNCTION_KEYSEQ *)0, "Select the node `Top' in this file" },
+ { info_dir_node, "dir-node", (FUNCTION_KEYSEQ *)0, "Select the node `(dir)'" },
+ { info_history_node, "history-node", (FUNCTION_KEYSEQ *)0, "Select the most recently selected node" },
+ { info_kill_node, "kill-node", (FUNCTION_KEYSEQ *)0, "Kill this node" },
+ { info_view_file, "view-file", (FUNCTION_KEYSEQ *)0, "Read the name of a file and select it" },
+ { info_print_node, "print-node", (FUNCTION_KEYSEQ *)0, "Pipe the contents of this node through INFO_PRINT_COMMAND" },
+ { info_search_case_sensitively, "search-case-sensitively", (FUNCTION_KEYSEQ *)0, "Read a string and search for it case-sensitively" },
+ { info_search, "search", (FUNCTION_KEYSEQ *)0, "Read a string and search for it" },
+ { info_search_backward, "search-backward", (FUNCTION_KEYSEQ *)0, "Read a string and search backward for it" },
+ { info_search_next, "search-next", (FUNCTION_KEYSEQ *)0, "Repeat last search in the same direction" },
+ { info_search_previous, "search-previous", (FUNCTION_KEYSEQ *)0, "Repeat last search in the reverse direction" },
+ { isearch_forward, "isearch-forward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" },
+ { isearch_backward, "isearch-backward", (FUNCTION_KEYSEQ *)0, "Search interactively for a string as you type it" },
+ { info_move_to_prev_xref, "move-to-prev-xref", (FUNCTION_KEYSEQ *)0, "Move to the previous cross reference" },
+ { info_move_to_next_xref, "move-to-next-xref", (FUNCTION_KEYSEQ *)0, "Move to the next cross reference" },
+ { info_select_reference_this_line, "select-reference-this-line", (FUNCTION_KEYSEQ *)0, "Select reference or menu item appearing on this line" },
+ { info_abort_key, "abort-key", (FUNCTION_KEYSEQ *)0, "Cancel current operation" },
+ { info_move_to_window_line, "move-to-window-line", (FUNCTION_KEYSEQ *)0, "Move the cursor to a specific line of the window" },
+ { info_redraw_display, "redraw-display", (FUNCTION_KEYSEQ *)0, "Redraw the display" },
+ { info_quit, "quit", (FUNCTION_KEYSEQ *)0, "Quit using Info" },
+ { info_do_lowercase_version, "do-lowercase-version", (FUNCTION_KEYSEQ *)0, "Run command bound to this key's lowercase variant" },
+ { info_add_digit_to_numeric_arg, "add-digit-to-numeric-arg", (FUNCTION_KEYSEQ *)0, "Add this digit to the current numeric argument" },
+ { info_universal_argument, "universal-argument", (FUNCTION_KEYSEQ *)0, "Start (or multiply by 4) the current numeric argument" },
+ { info_numeric_arg_digit_loop, "numeric-arg-digit-loop", (FUNCTION_KEYSEQ *)0, "Internally used by \\[universal-argument]" },
/* Commands found in "./echo-area.c". */
- { ea_forward, "echo-area-forward", "Move forward a character" },
- { ea_backward, "echo-area-backward", "Move backward a character" },
- { ea_beg_of_line, "echo-area-beg-of-line", "Move to the start of this line" },
- { ea_end_of_line, "echo-area-end-of-line", "Move to the end of this line" },
- { ea_forward_word, "echo-area-forward-word", "Move forward a word" },
- { ea_backward_word, "echo-area-backward-word", "Move backward a word" },
- { ea_delete, "echo-area-delete", "Delete the character under the cursor" },
- { ea_rubout, "echo-area-rubout", "Delete the character behind the cursor" },
- { ea_abort, "echo-area-abort", "Cancel or quit operation" },
- { ea_newline, "echo-area-newline", "Accept (or force completion of) this line" },
- { ea_quoted_insert, "echo-area-quoted-insert", "Insert next character verbatim" },
- { ea_insert, "echo-area-insert", "Insert this character" },
- { ea_tab_insert, "echo-area-tab-insert", "Insert a TAB character" },
- { ea_transpose_chars, "echo-area-transpose-chars", "Transpose characters at point" },
- { ea_yank, "echo-area-yank", "Yank back the contents of the last kill" },
- { ea_yank_pop, "echo-area-yank-pop", "Yank back a previous kill" },
- { ea_kill_line, "echo-area-kill-line", "Kill to the end of the line" },
- { ea_backward_kill_line, "echo-area-backward-kill-line", "Kill to the beginning of the line" },
- { ea_kill_word, "echo-area-kill-word", "Kill the word following the cursor" },
- { ea_backward_kill_word, "echo-area-backward-kill-word", "Kill the word preceding the cursor" },
- { ea_possible_completions, "echo-area-possible-completions", "List possible completions" },
- { ea_complete, "echo-area-complete", "Insert completion" },
- { ea_scroll_completions_window, "echo-area-scroll-completions-window", "Scroll the completions window" },
+ { ea_forward, "echo-area-forward", (FUNCTION_KEYSEQ *)0, "Move forward a character" },
+ { ea_backward, "echo-area-backward", (FUNCTION_KEYSEQ *)0, "Move backward a character" },
+ { ea_beg_of_line, "echo-area-beg-of-line", (FUNCTION_KEYSEQ *)0, "Move to the start of this line" },
+ { ea_end_of_line, "echo-area-end-of-line", (FUNCTION_KEYSEQ *)0, "Move to the end of this line" },
+ { ea_forward_word, "echo-area-forward-word", (FUNCTION_KEYSEQ *)0, "Move forward a word" },
+ { ea_backward_word, "echo-area-backward-word", (FUNCTION_KEYSEQ *)0, "Move backward a word" },
+ { ea_delete, "echo-area-delete", (FUNCTION_KEYSEQ *)0, "Delete the character under the cursor" },
+ { ea_rubout, "echo-area-rubout", (FUNCTION_KEYSEQ *)0, "Delete the character behind the cursor" },
+ { ea_abort, "echo-area-abort", (FUNCTION_KEYSEQ *)0, "Cancel or quit operation" },
+ { ea_newline, "echo-area-newline", (FUNCTION_KEYSEQ *)0, "Accept (or force completion of) this line" },
+ { ea_quoted_insert, "echo-area-quoted-insert", (FUNCTION_KEYSEQ *)0, "Insert next character verbatim" },
+ { ea_insert, "echo-area-insert", (FUNCTION_KEYSEQ *)0, "Insert this character" },
+ { ea_tab_insert, "echo-area-tab-insert", (FUNCTION_KEYSEQ *)0, "Insert a TAB character" },
+ { ea_transpose_chars, "echo-area-transpose-chars", (FUNCTION_KEYSEQ *)0, "Transpose characters at point" },
+ { ea_yank, "echo-area-yank", (FUNCTION_KEYSEQ *)0, "Yank back the contents of the last kill" },
+ { ea_yank_pop, "echo-area-yank-pop", (FUNCTION_KEYSEQ *)0, "Yank back a previous kill" },
+ { ea_kill_line, "echo-area-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the end of the line" },
+ { ea_backward_kill_line, "echo-area-backward-kill-line", (FUNCTION_KEYSEQ *)0, "Kill to the beginning of the line" },
+ { ea_kill_word, "echo-area-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word following the cursor" },
+ { ea_backward_kill_word, "echo-area-backward-kill-word", (FUNCTION_KEYSEQ *)0, "Kill the word preceding the cursor" },
+ { ea_possible_completions, "echo-area-possible-completions", (FUNCTION_KEYSEQ *)0, "List possible completions" },
+ { ea_complete, "echo-area-complete", (FUNCTION_KEYSEQ *)0, "Insert completion" },
+ { ea_scroll_completions_window, "echo-area-scroll-completions-window", (FUNCTION_KEYSEQ *)0, "Scroll the completions window" },
/* Commands found in "./infodoc.c". */
- { info_get_help_window, "get-help-window", "Display help message" },
- { info_get_info_help_node, "get-info-help-node", "Visit Info node `(info)Help'" },
- { describe_key, "describe-key", "Print documentation for KEY" },
- { info_where_is, "where-is", "Show what to type to execute a given command" },
+ { info_get_help_window, "get-help-window", (FUNCTION_KEYSEQ *)0, "Display help message" },
+ { info_get_info_help_node, "get-info-help-node", (FUNCTION_KEYSEQ *)0, "Visit Info node `(info)Help'" },
+ { describe_key, "describe-key", (FUNCTION_KEYSEQ *)0, "Print documentation for KEY" },
+ { info_where_is, "where-is", (FUNCTION_KEYSEQ *)0, "Show what to type to execute a given command" },
/* Commands found in "./m-x.c". */
- { describe_command, "describe-command", "Read the name of an Info command and describe it" },
- { info_execute_command, "execute-command", "Read a command name in the echo area and execute it" },
- { set_screen_height, "set-screen-height", "Set the height of the displayed window" },
+ { describe_command, "describe-command", (FUNCTION_KEYSEQ *)0, "Read the name of an Info command and describe it" },
+ { info_execute_command, "execute-command", (FUNCTION_KEYSEQ *)0, "Read a command name in the echo area and execute it" },
+ { set_screen_height, "set-screen-height", (FUNCTION_KEYSEQ *)0, "Set the height of the displayed window" },
/* Commands found in "./indices.c". */
- { info_index_search, "index-search", "Look up a string in the index for this file" },
- { info_next_index_match, "next-index-match", "Go to the next matching index item from the last `\\[index-search]' command" },
- { info_index_apropos, "index-apropos", "Grovel all known info file's indices for a string and build a menu" },
+ { info_index_search, "index-search", (FUNCTION_KEYSEQ *)0, "Look up a string in the index for this file" },
+ { info_next_index_match, "next-index-match", (FUNCTION_KEYSEQ *)0, "Go to the next matching index item from the last `\\[index-search]' command" },
+ { info_index_apropos, "index-apropos", (FUNCTION_KEYSEQ *)0, "Grovel all known info file's indices for a string and build a menu" },
/* Commands found in "./nodemenu.c". */
- { list_visited_nodes, "list-visited-nodes", "Make a window containing a menu of all of the currently visited nodes" },
- { select_visited_node, "select-visited-node", "Select a node which has been previously visited in a visible window" },
+ { list_visited_nodes, "list-visited-nodes", (FUNCTION_KEYSEQ *)0, "Make a window containing a menu of all of the currently visited nodes" },
+ { select_visited_node, "select-visited-node", (FUNCTION_KEYSEQ *)0, "Select a node which has been previously visited in a visible window" },
/* Commands found in "./footnotes.c". */
- { info_show_footnotes, "show-footnotes", "Show the footnotes associated with this node in another window" },
+ { info_show_footnotes, "show-footnotes", (FUNCTION_KEYSEQ *)0, "Show the footnotes associated with this node in another window" },
/* Commands found in "./variables.c". */
- { describe_variable, "describe-variable", "Explain the use of a variable" },
- { set_variable, "set-variable", "Set the value of an Info variable" },
- { (VFunction *)NULL, (char *)NULL, (char *)NULL }
+ { describe_variable, "describe-variable", (FUNCTION_KEYSEQ *)0, "Explain the use of a variable" },
+ { set_variable, "set-variable", (FUNCTION_KEYSEQ *)0, "Set the value of an Info variable" },
+ { (VFunction *)NULL, (char *)NULL, (FUNCTION_KEYSEQ *)NULL, (char *)NULL }
};
diff --git a/contrib/texinfo/info/doc.h b/contrib/texinfo/info/doc.h
index 423998e..53597d1 100644
--- a/contrib/texinfo/info/doc.h
+++ b/contrib/texinfo/info/doc.h
@@ -1,9 +1,7 @@
-/* doc.h -- Structure associating function pointers with documentation. */
+/* doc.h -- Structures associating function pointers with documentation.
+ $Id: doc.h,v 1.5 2001/11/16 23:16:40 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,12 +24,44 @@
#include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc. */
-typedef struct {
+#if defined (INFOKEY)
+/* For each function, we keep track of the first defined key sequence
+ which invokes that function, for each different map. This is so that
+ the dynamic documentation generation in infodoc.c (a) doesn't have to
+ search through copious KEYMAP_ENTRYs, and, more importantly, (b) the
+ user and programmer can choose the preferred key sequence that is
+ printed for any given function -- it's just the first one that
+ appears in the user's infokey file or the default keymaps in
+ infomap.c.
+
+ Each FUNCTION_DOC has a linked list of FUNCTION_KEYSEQ structs
+ hanging off it, which are created on startup when the user and/or
+ default keymaps are being parsed. */
+typedef struct function_keyseq
+{
+ struct function_keyseq *next;
+ struct keymap_entry *map;
+ char *keyseq;
+} FUNCTION_KEYSEQ;
+
+#endif /* INFOKEY */
+
+
+/* An array of FUNCTION_DOC structures is defined in doc.c, which is
+ automagically generated by the makedoc utility, whose job is to scan
+ through the source files for command function declarations and
+ compile a list of all the ones it finds. This saves tedious
+ housekeeping and avoids errors of omission. */
+typedef struct
+{
VFunction *func;
#if defined (NAMED_FUNCTIONS)
char *func_name;
#endif /* NAMED_FUNCTIONS */
- char *doc;
+#if defined (INFOKEY)
+ FUNCTION_KEYSEQ *keys;
+#endif /* INFOKEY */
+ char *doc;
} FUNCTION_DOC;
extern FUNCTION_DOC function_doc_array[];
@@ -39,12 +69,31 @@ extern FUNCTION_DOC function_doc_array[];
extern char *function_documentation ();
extern char *key_documentation ();
extern char *pretty_keyname ();
+extern char *pretty_keyseq ();
+extern char *where_is ();
extern char *replace_in_documentation ();
extern void info_document_key ();
extern void dump_map_to_message_buffer ();
+/* Under the old key-binding system, an info command is specified by
+ the pointer to its function. Under the new INFOKEY binding system,
+ it is specified by a pointer to the command's FUNCTION_DOC structure,
+ defined in doc.c, from which the pointer to the function can be
+ easily divined using the InfoFunction() extractor. */
+#if defined(INFOKEY)
+typedef FUNCTION_DOC InfoCommand;
+#define InfoFunction(ic) ((ic) ? (ic)->func : NULL)
+#define InfoCmd(fn) (&function_doc_array[A_##fn])
+#define DocInfoCmd(fd) ((fd) && (fd)->func ? (fd) : NULL)
+#else /* !INFOKEY */
+typedef VFunction InfoCommand;
+#define InfoFunction(vf) ((vf))
+#define InfoCmd(fn) fn
+#define DocInfoCmd(fd) ((fd)->func)
+#endif /* !INFOKEY */
+
#if defined (NAMED_FUNCTIONS)
extern char *function_name ();
-extern VFunction *named_function ();
+extern InfoCommand *named_function ();
#endif /* NAMED_FUNCTIONS */
#endif /* !DOC_H */
diff --git a/contrib/texinfo/info/echo-area.c b/contrib/texinfo/info/echo-area.c
index 7500523..078e8e7 100644
--- a/contrib/texinfo/info/echo-area.c
+++ b/contrib/texinfo/info/echo-area.c
@@ -1,7 +1,7 @@
/* echo-area.c -- how to read a line in the echo area.
- $Id: echo-area.c,v 1.12 1999/03/03 22:22:14 karl Exp $
+ $Id: echo-area.c,v 1.15 2001/12/12 16:19:39 karl Exp $
- Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 99, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -868,7 +868,10 @@ info_read_completing_internal (window, prompt, completions, force)
/* If no match, go back and try again. */
if (i == completions_found_index)
{
- inform_in_echo_area (_("Not complete"));
+ if (!completions_found_index)
+ inform_in_echo_area (_("No completions"));
+ else
+ inform_in_echo_area (_("Not complete"));
continue;
}
}
@@ -1258,7 +1261,26 @@ build_completions ()
maybe_free (LCD_reference.label);
LCD_reference.label = (char *)xmalloc (1 + shortest);
- strncpy (LCD_reference.label, completions_found[0]->label, shortest);
+ /* Since both the sorting done inside remove_completion_duplicates
+ and all the comparisons above are case-insensitive, it's
+ possible that the completion we are going to return is
+ identical to what the user typed but for the letter-case. This
+ is confusing, since the user could type FOOBAR<TAB> and get her
+ string change letter-case for no good reason. So try to find a
+ possible completion whose letter-case is identical, and if so,
+ use that. */
+ if (completions_found_index > 1)
+ {
+ int req_len = strlen (request);
+
+ for (i = 0; i < completions_found_index; i++)
+ if (strncmp (request, completions_found[i]->label, req_len) == 0)
+ break;
+ /* If none of the candidates match exactly, use the first one. */
+ if (i >= completions_found_index)
+ i = 0;
+ }
+ strncpy (LCD_reference.label, completions_found[i]->label, shortest);
LCD_reference.label[shortest] = '\0';
LCD_completion = &LCD_reference;
}
diff --git a/contrib/texinfo/info/filesys.c b/contrib/texinfo/info/filesys.c
index 96f0ed9..cdf1365 100644
--- a/contrib/texinfo/info/filesys.c
+++ b/contrib/texinfo/info/filesys.c
@@ -1,7 +1,7 @@
/* filesys.c -- filesystem specific functions.
- $Id: filesys.c,v 1.10 1998/12/06 21:58:30 karl Exp $
+ $Id: filesys.c,v 1.14 2002/03/02 15:05:04 karl Exp $
- Copyright (C) 1993, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -163,6 +163,11 @@ info_file_in_path (filename, path)
char *temp_dirname;
int statable, dirname_index;
+ /* Reject ridiculous cases up front, to prevent infinite recursion
+ later on. E.g., someone might say "info '(.)foo'"... */
+ if (!*filename || STREQ (filename, ".") || STREQ (filename, ".."))
+ return NULL;
+
dirname_index = 0;
while ((temp_dirname = extract_colon_unit (path, &dirname_index)))
@@ -557,7 +562,7 @@ filesys_read_compressed (pathname, filesize, finfo)
/* Read chunks from this file until there are none left to read. */
if (stream)
{
- int offset, size;
+ long offset, size;
char *chunk;
offset = size = 0;
@@ -689,25 +694,34 @@ filesys_error_string (filename, error_num)
}
-/* Check for FILENAME eq "dir" first, then all the compression
- suffixes. */
+/* Check for "dir" with all the possible info and compression suffixes,
+ in combination. */
int
is_dir_name (filename)
char *filename;
{
unsigned i;
- if (strcasecmp (filename, "dir") == 0)
- return 1;
-
- for (i = 0; compress_suffixes[i].suffix; i++)
+
+ for (i = 0; info_suffixes[i]; i++)
{
- char dir_compressed[50]; /* can be short */
- strcpy (dir_compressed, "dir");
- strcat (dir_compressed, compress_suffixes[i].suffix);
- if (strcasecmp (filename, dir_compressed) == 0)
+ unsigned c;
+ char trydir[50];
+ strcpy (trydir, "dir");
+ strcat (trydir, info_suffixes[i]);
+
+ if (strcasecmp (filename, trydir) == 0)
return 1;
- }
-
+
+ for (c = 0; compress_suffixes[c].suffix; c++)
+ {
+ char dir_compressed[50]; /* can be short */
+ strcpy (dir_compressed, trydir);
+ strcat (dir_compressed, compress_suffixes[c].suffix);
+ if (strcasecmp (filename, dir_compressed) == 0)
+ return 1;
+ }
+ }
+
return 0;
}
diff --git a/contrib/texinfo/info/funs.h b/contrib/texinfo/info/funs.h
index f5c4d33..5e8bc04 100644
--- a/contrib/texinfo/info/funs.h
+++ b/contrib/texinfo/info/funs.h
@@ -1,124 +1,241 @@
/* funs.h -- Generated declarations for Info commands. */
/* Functions declared in "./session.c". */
+#define A_info_next_line 0
extern void info_next_line ();
+#define A_info_prev_line 1
extern void info_prev_line ();
+#define A_info_end_of_line 2
extern void info_end_of_line ();
+#define A_info_beginning_of_line 3
extern void info_beginning_of_line ();
+#define A_info_forward_char 4
extern void info_forward_char ();
+#define A_info_backward_char 5
extern void info_backward_char ();
+#define A_info_forward_word 6
extern void info_forward_word ();
+#define A_info_backward_word 7
extern void info_backward_word ();
+#define A_info_global_next_node 8
extern void info_global_next_node ();
+#define A_info_global_prev_node 9
extern void info_global_prev_node ();
+#define A_info_scroll_forward 10
extern void info_scroll_forward ();
+#define A_info_scroll_forward_set_window 11
extern void info_scroll_forward_set_window ();
+#define A_info_scroll_forward_page_only 12
+extern void info_scroll_forward_page_only ();
+#define A_info_scroll_forward_page_only_set_window 13
+extern void info_scroll_forward_page_only_set_window ();
+#define A_info_scroll_backward 14
extern void info_scroll_backward ();
+#define A_info_scroll_backward_set_window 15
extern void info_scroll_backward_set_window ();
+#define A_info_scroll_backward_page_only 16
+extern void info_scroll_backward_page_only ();
+#define A_info_scroll_backward_page_only_set_window 17
+extern void info_scroll_backward_page_only_set_window ();
+#define A_info_beginning_of_node 18
extern void info_beginning_of_node ();
+#define A_info_end_of_node 19
extern void info_end_of_node ();
+#define A_info_down_line 20
extern void info_down_line ();
+#define A_info_up_line 21
extern void info_up_line ();
+#define A_info_scroll_half_screen_down 22
extern void info_scroll_half_screen_down ();
+#define A_info_scroll_half_screen_up 23
extern void info_scroll_half_screen_up ();
+#define A_info_next_window 24
extern void info_next_window ();
+#define A_info_prev_window 25
extern void info_prev_window ();
+#define A_info_split_window 26
extern void info_split_window ();
+#define A_info_delete_window 27
extern void info_delete_window ();
+#define A_info_keep_one_window 28
extern void info_keep_one_window ();
+#define A_info_scroll_other_window 29
extern void info_scroll_other_window ();
+#define A_info_scroll_other_window_backward 30
extern void info_scroll_other_window_backward ();
+#define A_info_grow_window 31
extern void info_grow_window ();
+#define A_info_tile_windows 32
extern void info_tile_windows ();
+#define A_info_toggle_wrap 33
extern void info_toggle_wrap ();
+#define A_info_next_node 34
extern void info_next_node ();
+#define A_info_prev_node 35
extern void info_prev_node ();
+#define A_info_up_node 36
extern void info_up_node ();
+#define A_info_last_node 37
extern void info_last_node ();
+#define A_info_first_node 38
extern void info_first_node ();
+#define A_info_last_menu_item 39
extern void info_last_menu_item ();
+#define A_info_menu_digit 40
extern void info_menu_digit ();
+#define A_info_menu_item 41
extern void info_menu_item ();
+#define A_info_xref_item 42
extern void info_xref_item ();
+#define A_info_find_menu 43
extern void info_find_menu ();
+#define A_info_visit_menu 44
extern void info_visit_menu ();
+#define A_info_goto_node 45
extern void info_goto_node ();
+#define A_info_menu_sequence 46
extern void info_menu_sequence ();
+#define A_info_goto_invocation_node 47
extern void info_goto_invocation_node ();
+#define A_info_man 48
extern void info_man ();
+#define A_info_top_node 49
extern void info_top_node ();
+#define A_info_dir_node 50
extern void info_dir_node ();
+#define A_info_history_node 51
extern void info_history_node ();
+#define A_info_kill_node 52
extern void info_kill_node ();
+#define A_info_view_file 53
extern void info_view_file ();
+#define A_info_print_node 54
extern void info_print_node ();
+#define A_info_search_case_sensitively 55
extern void info_search_case_sensitively ();
+#define A_info_search 56
extern void info_search ();
+#define A_info_search_backward 57
extern void info_search_backward ();
+#define A_info_search_next 58
extern void info_search_next ();
+#define A_info_search_previous 59
extern void info_search_previous ();
+#define A_isearch_forward 60
extern void isearch_forward ();
+#define A_isearch_backward 61
extern void isearch_backward ();
+#define A_info_move_to_prev_xref 62
extern void info_move_to_prev_xref ();
+#define A_info_move_to_next_xref 63
extern void info_move_to_next_xref ();
+#define A_info_select_reference_this_line 64
extern void info_select_reference_this_line ();
+#define A_info_abort_key 65
extern void info_abort_key ();
+#define A_info_move_to_window_line 66
extern void info_move_to_window_line ();
+#define A_info_redraw_display 67
extern void info_redraw_display ();
+#define A_info_quit 68
extern void info_quit ();
+#define A_info_do_lowercase_version 69
extern void info_do_lowercase_version ();
+#define A_info_add_digit_to_numeric_arg 70
extern void info_add_digit_to_numeric_arg ();
+#define A_info_universal_argument 71
extern void info_universal_argument ();
+#define A_info_numeric_arg_digit_loop 72
extern void info_numeric_arg_digit_loop ();
/* Functions declared in "./echo-area.c". */
+#define A_ea_forward 73
extern void ea_forward ();
+#define A_ea_backward 74
extern void ea_backward ();
+#define A_ea_beg_of_line 75
extern void ea_beg_of_line ();
+#define A_ea_end_of_line 76
extern void ea_end_of_line ();
+#define A_ea_forward_word 77
extern void ea_forward_word ();
+#define A_ea_backward_word 78
extern void ea_backward_word ();
+#define A_ea_delete 79
extern void ea_delete ();
+#define A_ea_rubout 80
extern void ea_rubout ();
+#define A_ea_abort 81
extern void ea_abort ();
+#define A_ea_newline 82
extern void ea_newline ();
+#define A_ea_quoted_insert 83
extern void ea_quoted_insert ();
+#define A_ea_insert 84
extern void ea_insert ();
+#define A_ea_tab_insert 85
extern void ea_tab_insert ();
+#define A_ea_transpose_chars 86
extern void ea_transpose_chars ();
+#define A_ea_yank 87
extern void ea_yank ();
+#define A_ea_yank_pop 88
extern void ea_yank_pop ();
+#define A_ea_kill_line 89
extern void ea_kill_line ();
+#define A_ea_backward_kill_line 90
extern void ea_backward_kill_line ();
+#define A_ea_kill_word 91
extern void ea_kill_word ();
+#define A_ea_backward_kill_word 92
extern void ea_backward_kill_word ();
+#define A_ea_possible_completions 93
extern void ea_possible_completions ();
+#define A_ea_complete 94
extern void ea_complete ();
+#define A_ea_scroll_completions_window 95
extern void ea_scroll_completions_window ();
/* Functions declared in "./infodoc.c". */
+#define A_info_get_help_window 96
extern void info_get_help_window ();
+#define A_info_get_info_help_node 97
extern void info_get_info_help_node ();
+#define A_describe_key 98
extern void describe_key ();
+#define A_info_where_is 99
extern void info_where_is ();
/* Functions declared in "./m-x.c". */
+#define A_describe_command 100
extern void describe_command ();
+#define A_info_execute_command 101
extern void info_execute_command ();
+#define A_set_screen_height 102
extern void set_screen_height ();
/* Functions declared in "./indices.c". */
+#define A_info_index_search 103
extern void info_index_search ();
+#define A_info_next_index_match 104
extern void info_next_index_match ();
+#define A_info_index_apropos 105
extern void info_index_apropos ();
/* Functions declared in "./nodemenu.c". */
+#define A_list_visited_nodes 106
extern void list_visited_nodes ();
+#define A_select_visited_node 107
extern void select_visited_node ();
/* Functions declared in "./footnotes.c". */
+#define A_info_show_footnotes 108
extern void info_show_footnotes ();
/* Functions declared in "./variables.c". */
+#define A_describe_variable 109
extern void describe_variable ();
+#define A_set_variable 110
extern void set_variable ();
+
+#define A_NCOMMANDS 111
diff --git a/contrib/texinfo/info/info.c b/contrib/texinfo/info/info.c
index 4f4999c..33aacdf 100644
--- a/contrib/texinfo/info/info.c
+++ b/contrib/texinfo/info/info.c
@@ -1,7 +1,8 @@
/* info.c -- Display nodes of Info files in multiple windows.
- $Id: info.c,v 1.41 1999/09/25 16:10:04 karl Exp $
+ $Id: info.c,v 1.53 2002/03/02 15:18:58 karl Exp $
- Copyright (C) 1993, 96, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -76,6 +77,9 @@ int dump_subnodes = 0;
/* Non-zero means make default keybindings be loosely modeled on vi(1). */
int vi_keys_p = 0;
+/* Non-zero means don't remove ANSI escape sequences from man pages. */
+int raw_escapes_p = 0;
+
#ifdef __MSDOS__
/* Non-zero indicates that screen output should be made 'speech-friendly'.
Since on MSDOS the usual behavior is to write directly to the video
@@ -99,6 +103,7 @@ static struct option long_options[] = {
{ "file", 1, 0, 'f' },
{ "subnodes", 0, &dump_subnodes, 1 },
{ "output", 1, 0, 'o' },
+ { "raw-escapes", 0, &raw_escapes_p, 1 },
{ "show-options", 0, 0, 'O' },
{ "usage", 0, 0, 'O' },
{ "vi-keys", 0, &vi_keys_p, 1 },
@@ -115,9 +120,9 @@ static struct option long_options[] = {
/* String describing the shorthand versions of the long options found above. */
#ifdef __MSDOS__
-static char *short_options = "d:n:f:o:Osb";
+static char *short_options = "d:n:f:o:ORsb";
#else
-static char *short_options = "d:n:f:o:Os";
+static char *short_options = "d:n:f:o:ORs";
#endif
/* When non-zero, the Info window system has been initialized. */
@@ -126,6 +131,7 @@ int info_windows_initialized_p = 0;
/* Some "forward" declarations. */
static void info_short_help (), remember_info_program_name ();
static void init_messages ();
+extern void add_file_directory_to_path ();
/* **************************************************************** */
@@ -206,6 +212,12 @@ main (argc, argv)
goto_invocation_p = 1;
break;
+ /* User has specified that she wants the escape sequences
+ in man pages to be passed thru unaltered. */
+ case 'R':
+ raw_escapes_p = 1;
+ break;
+
/* User is specifying that she wishes to dump the subnodes of
the node that she is dumping. */
case 's':
@@ -213,7 +225,7 @@ main (argc, argv)
break;
#ifdef __MSDOS__
- /* User specifies that she wants speech-friendly output. */
+ /* User wants speech-friendly output. */
case 'b':
speech_friendly = 1;
break;
@@ -268,7 +280,7 @@ main (argc, argv)
There is NO warranty. You may redistribute this software\n\
under the terms of the GNU General Public License.\n\
For more information about these matters, see the files named COPYING.\n"),
- "1999");
+ "2002");
xexit (0);
}
@@ -313,25 +325,7 @@ For more information about these matters, see the files named COPYING.\n"),
/* If the user specified a particular filename, add the path of that
file to the contents of INFOPATH. */
if (user_filename)
- {
- char *directory_name = xstrdup (user_filename);
- char *temp = filename_non_directory (directory_name);
-
- if (temp != directory_name)
- {
- if (HAVE_DRIVE (directory_name) && temp == directory_name + 2)
- {
- /* The directory of "d:foo" is stored as "d:.", to avoid
- mixing it with "d:/" when a slash is appended. */
- *temp = '.';
- temp += 2;
- }
- temp[-1] = 0;
- info_add_path (directory_name, INFOPATH_PREPEND);
- }
-
- free (directory_name);
- }
+ add_file_directory_to_path (user_filename);
/* If the user wants to search every known index for a given string,
do that now, and report the results. */
@@ -382,13 +376,14 @@ For more information about these matters, see the files named COPYING.\n"),
char *errstr, *errarg1, *errarg2;
NODE *new_initial_node = info_follow_menus (initial_node, argv + optind,
&errstr, &errarg1, &errarg2);
+
if (new_initial_node && new_initial_node != initial_node)
initial_node = new_initial_node;
/* If the user specified that this node should be output, then do that
now. Otherwise, start the Info session with this node. Or act
accordingly if the initial node was not found. */
- if (user_output_filename)
+ if (user_output_filename && !goto_invocation_p)
{
if (!errstr)
dump_node_to_file (initial_node, user_output_filename,
@@ -447,7 +442,13 @@ For more information about these matters, see the files named COPYING.\n"),
free (program);
}
- info_read_and_dispatch ();
+ if (user_output_filename)
+ {
+ dump_node_to_file (windows->node, user_output_filename,
+ dump_subnodes);
+ }
+ else
+ info_read_and_dispatch ();
/* On program exit, leave the cursor at the bottom of the
window, and restore the terminal IO. */
@@ -474,6 +475,29 @@ For more information about these matters, see the files named COPYING.\n"),
}
}
+void
+add_file_directory_to_path (filename)
+ char *filename;
+{
+ char *directory_name = xstrdup (filename);
+ char *temp = filename_non_directory (directory_name);
+
+ if (temp != directory_name)
+ {
+ if (HAVE_DRIVE (directory_name) && temp == directory_name + 2)
+ {
+ /* The directory of "d:foo" is stored as "d:.", to avoid
+ mixing it with "d:/" when a slash is appended. */
+ *temp = '.';
+ temp += 2;
+ }
+ temp[-1] = 0;
+ info_add_path (directory_name, INFOPATH_PREPEND);
+ }
+
+ free (directory_name);
+}
+
/* Error handling. */
@@ -527,6 +551,14 @@ info_error (format, arg1, arg2)
static void
info_short_help ()
{
+#ifdef __MSDOS__
+ static const char speech_friendly_string[] = N_("\
+ --speech-friendly be friendly to speech synthesizers.\n");
+#else
+ static const char speech_friendly_string[] = "";
+#endif
+
+
printf (_("\
Usage: %s [OPTION]... [MENU-ITEM...]\n\
\n\
@@ -541,9 +573,10 @@ Options:\n\
--index-search=STRING go to node pointed by index entry STRING.\n\
--node=NODENAME specify nodes in first visited Info file.\n\
--output=FILENAME output selected nodes to FILENAME.\n\
+ --raw-escapes don't remove ANSI escapes from man pages.\n\
--restore=FILENAME read initial keystrokes from FILENAME.\n\
- --show-options, --usage go to command-line options node.\n\
- --subnodes recursively output menu items.\n%s\
+ --show-options, --usage go to command-line options node.\n%s\
+ --subnodes recursively output menu items.\n\
--vi-keys use vi-like and less-like key bindings.\n\
--version display version information and exit.\n\
\n\
@@ -563,14 +596,7 @@ Examples:\n\
Email bug reports to bug-texinfo@gnu.org,\n\
general questions and discussion to help-texinfo@gnu.org.\n\
"),
- program_name,
-#ifdef __MSDOS__
-"\
- --speech-friendly be friendly to speech synthesizers.\n"
-#else
-""
-#endif
- );
+ program_name, speech_friendly_string);
xexit (0);
}
diff --git a/contrib/texinfo/info/info.h b/contrib/texinfo/info/info.h
index 2f85d80..1746660 100644
--- a/contrib/texinfo/info/info.h
+++ b/contrib/texinfo/info/info.h
@@ -1,7 +1,7 @@
/* info.h -- Header file which includes all of the other headers.
- $Id: info.h,v 1.14 1999/09/25 16:10:04 karl Exp $
+ $Id: info.h,v 1.16 2002/02/23 19:12:02 karl Exp $
- Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 99, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
/* We always want these, so why clutter up the compile command? */
#define HANDLE_MAN_PAGES
#define NAMED_FUNCTIONS
+#define INFOKEY
/* System dependencies. */
#include "system.h"
@@ -34,12 +35,11 @@ typedef int Function ();
typedef void VFunction ();
typedef char *CFunction ();
-
#include "filesys.h"
+#include "doc.h"
#include "display.h"
#include "session.h"
#include "echo-area.h"
-#include "doc.h"
#include "footnotes.h"
#include "gc.h"
@@ -119,14 +119,14 @@ extern int info_error_rings_bell_p;
/* Non-zero means default keybindings are loosely modeled on vi(1). */
extern int vi_keys_p;
+/* Non-zero means don't remove ANSI escape sequences from man pages. */
+extern int raw_escapes_p;
+
/* Print FORMAT with ARG1 and ARG2. If the window system was initialized,
then the message is printed in the echo area. Otherwise, a message is
output to stderr. */
extern void info_error ();
-/* The version numbers of Info. */
-extern int info_major_version, info_minor_version;
-
/* Error message defines. */
extern char *msg_cant_find_node;
extern char *msg_cant_file_node;
@@ -146,13 +146,14 @@ extern char *msg_win_too_small;
extern char *msg_cant_make_help;
-/* Found in info-utils.c. */
-extern char *filename_non_directory ();
+extern char *filename_non_directory (); /* Found in info-utils.c. */
-#if !defined (BUILDING_LIBRARY)
-/* Found in session.c */
-extern int info_windows_initialized_p;
+#if defined(INFOKEY)
+extern void set_variable_to_value (); /* Found in variables.c. */
+#endif /* INFOKEY */
+#if !defined (BUILDING_LIBRARY)
+extern int info_windows_initialized_p; /* Found in session.c */
/* Found in window.c. */
extern void message_in_echo_area (), unmessage_in_echo_area ();
#endif /* !BUILDING_LIBRARY */
diff --git a/contrib/texinfo/info/infodoc.c b/contrib/texinfo/info/infodoc.c
index 2b70918..731cb48 100644
--- a/contrib/texinfo/info/infodoc.c
+++ b/contrib/texinfo/info/infodoc.c
@@ -1,7 +1,7 @@
/* infodoc.c -- Functions which build documentation nodes.
- $Id: infodoc.c,v 1.23 1999/09/25 16:10:04 karl Exp $
+ $Id: infodoc.c,v 1.28 2002/02/27 13:37:33 karl Exp $
- Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 99, 2001, 02 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,17 +20,12 @@
Written by Brian Fox (bfox@ai.mit.edu). */
#include "info.h"
+#include "funs.h"
/* HELP_NODE_GETS_REGENERATED is always defined now that keys may get
rebound, or other changes in the help text may occur. */
#define HELP_NODE_GETS_REGENERATED 1
-/* **************************************************************** */
-/* */
-/* Info Help Windows */
-/* */
-/* **************************************************************** */
-
/* The name of the node used in the help window. */
static char *info_help_nodename = "*Info Help*";
@@ -40,26 +35,71 @@ static NODE *internal_info_help_node = (NODE *)NULL;
/* A pointer to the contents of the help node. */
static char *internal_info_help_node_contents = (char *)NULL;
-/* The static text which appears in the internal info help node. */
+/* The (more or less) static text which appears in the internal info
+ help node. The actual key bindings are inserted. Keep the
+ underlines (****, etc.) in the same N_ call as the text lines they
+ refer to, so translations can make the number of *'s or -'s match. */
+#if defined(INFOKEY)
+
+static char *info_internal_help_text[] = {
+ N_("Basic Commands in Info Windows\n\
+******************************\n"),
+ "\n",
+ N_("\\%-10[quit-help] Quit this help.\n"),
+ N_("\\%-10[quit] Quit Info altogether.\n"),
+ N_("\\%-10[get-info-help-node] Invoke the Info tutorial.\n"),
+ "\n",
+ N_("Selecting other nodes:\n\
+----------------------\n"),
+ N_("\\%-10[next-node] Move to the \"next\" node of this node.\n"),
+ N_("\\%-10[prev-node] Move to the \"previous\" node of this node.\n"),
+ N_("\\%-10[up-node] Move \"up\" from this node.\n"),
+ N_("\\%-10[menu-item] Pick menu item specified by name.\n\
+ Picking a menu item causes another node to be selected.\n"),
+ N_("\\%-10[xref-item] Follow a cross reference. Reads name of reference.\n"),
+ N_("\\%-10[history-node] Move to the last node seen in this window.\n"),
+ N_("\\%-10[move-to-next-xref] Skip to next hypertext link within this node.\n"),
+ N_("\\%-10[move-to-prev-xref] Skip to previous hypertext link within this node.\n"),
+ N_("\\%-10[select-reference-this-line] Follow the hypertext link under cursor.\n"),
+ N_("\\%-10[dir-node] Move to the `directory' node. Equivalent to `\\[goto-node] (DIR)'.\n"),
+ N_("\\%-10[top-node] Move to the Top node. Equivalent to `\\[goto-node] Top'.\n"),
+ "\n",
+ N_("Moving within a node:\n\
+---------------------\n"),
+ N_("\\%-10[scroll-forward] Scroll forward a page.\n"),
+ N_("\\%-10[scroll-backward] Scroll backward a page.\n"),
+ N_("\\%-10[beginning-of-node] Go to the beginning of this node.\n"),
+ N_("\\%-10[end-of-node] Go to the end of this node.\n"),
+ N_("\\%-10[scroll-forward] Scroll forward 1 line.\n"),
+ N_("\\%-10[scroll-backward] Scroll backward 1 line.\n"),
+ "\n",
+ N_("Other commands:\n\
+---------------\n"),
+ N_("\\%-10[menu-digit] Pick first ... ninth item in node's menu.\n"),
+ N_("\\%-10[last-menu-item] Pick last item in node's menu.\n"),
+ N_("\\%-10[index-search] Search for a specified string in the index entries of this Info\n\
+ file, and select the node referenced by the first entry found.\n"),
+ N_("\\%-10[goto-node] Move to node specified by name.\n\
+ You may include a filename as well, as in (FILENAME)NODENAME.\n"),
+ N_("\\%-10[search] Search forward for a specified string\n\
+ and select the node in which the next occurrence is found.\n"),
+ N_("\\%-10[search-backward] Search backward for a specified string\n\
+ and select the node in which the previous occurrence is found.\n"),
+ NULL
+};
+
+#else /* !INFOKEY */
+
static char *info_internal_help_text[] = {
- N_("Basic Commands in Info Windows\n"),
- N_("******************************\n"),
+ N_("Basic Commands in Info Windows\n\
+******************************\n"),
"\n",
N_(" %-10s Quit this help.\n"),
N_(" %-10s Quit Info altogether.\n"),
N_(" %-10s Invoke the Info tutorial.\n"),
"\n",
- N_("Moving within a node:\n"),
- N_("---------------------\n"),
- N_(" %-10s Scroll forward a page.\n"),
- N_(" %-10s Scroll backward a page.\n"),
- N_(" %-10s Go to the beginning of this node.\n"),
- N_(" %-10s Go to the end of this node.\n"),
- N_(" %-10s Scroll forward 1 line.\n"),
- N_(" %-10s Scroll backward 1 line.\n"),
- "\n",
- N_("Selecting other nodes:\n"),
- N_("----------------------\n"),
+ N_("Selecting other nodes:\n\
+----------------------\n",
N_(" %-10s Move to the `next' node of this node.\n"),
N_(" %-10s Move to the `previous' node of this node.\n"),
N_(" %-10s Move `up' from this node.\n"),
@@ -72,17 +112,26 @@ static char *info_internal_help_text[] = {
N_(" %-10s Move to the `directory' node. Equivalent to `g (DIR)'.\n"),
N_(" %-10s Move to the Top node. Equivalent to `g Top'.\n"),
"\n",
- N_("Other commands:\n"),
- N_("---------------\n"),
+ N_("Moving within a node:\n\
+---------------------\n"),
+ N_(" %-10s Scroll forward a page.\n"),
+ N_(" %-10s Scroll backward a page.\n"),
+ N_(" %-10s Go to the beginning of this node.\n"),
+ N_(" %-10s Go to the end of this node.\n"),
+ N_(" %-10s Scroll forward 1 line.\n"),
+ N_(" %-10s Scroll backward 1 line.\n"),
+ "\n",
+ N_("Other commands:\n\
+---------------\n"),
N_(" %-10s Pick first ... ninth item in node's menu.\n"),
N_(" %-10s Pick last item in node's menu.\n"),
N_(" %-10s Search for a specified string in the index entries of this Info\n"),
N_(" file, and select the node referenced by the first entry found.\n"),
N_(" %-10s Move to node specified by name.\n"),
N_(" You may include a filename as well, as in (FILENAME)NODENAME.\n"),
- N_(" %-10s Search forward through this Info file for a specified string,\n"),
+ N_(" %-10s Search forward for a specified string,\n"),
N_(" and select the node in which the next occurrence is found.\n"),
- N_(" %-10s Search backward in this Info file for a specified string,\n"),
+ N_(" %-10s Search backward for a specified string\n"),
N_(" and select the node in which the next occurrence is found.\n"),
NULL
};
@@ -133,7 +182,9 @@ static char *info_help_keys_text[][2] = {
NULL
};
-static char *where_is (), *where_is_internal ();
+#endif /* !INFOKEY */
+
+static char *where_is_internal ();
void
dump_map_to_message_buffer (prefix, map)
@@ -141,20 +192,18 @@ dump_map_to_message_buffer (prefix, map)
Keymap map;
{
register int i;
+ unsigned prefix_len = strlen (prefix);
+ char *new_prefix = (char *)xmalloc (prefix_len + 2);
+
+ strncpy (new_prefix, prefix, prefix_len);
+ new_prefix[prefix_len + 1] = '\0';
for (i = 0; i < 256; i++)
{
+ new_prefix[prefix_len] = i;
if (map[i].type == ISKMAP)
{
- char *new_prefix, *keyname;
-
- keyname = pretty_keyname (i);
- new_prefix = (char *)
- xmalloc (3 + strlen (prefix) + strlen (keyname));
- sprintf (new_prefix, "%s%s%s ", prefix, *prefix ? " " : "", keyname);
-
dump_map_to_message_buffer (new_prefix, (Keymap)map[i].function);
- free (new_prefix);
}
else if (map[i].function)
{
@@ -176,14 +225,13 @@ dump_map_to_message_buffer (prefix, map)
if (last - 1 != i)
{
- printf_to_message_buffer
- ("%s%s .. ", prefix, pretty_keyname (i));
- printf_to_message_buffer
- ("%s%s\t", prefix, pretty_keyname (last - 1));
+ printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix));
+ new_prefix[prefix_len] = last - 1;
+ printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix));
i = last - 1;
}
else
- printf_to_message_buffer ("%s%s\t", prefix, pretty_keyname (i));
+ printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix));
#if defined (NAMED_FUNCTIONS)
/* Print the name of the function, and some padding before the
@@ -210,6 +258,7 @@ dump_map_to_message_buffer (prefix, map)
printf_to_message_buffer ("%s\n", doc);
}
}
+ free (new_prefix);
}
/* How to create internal_info_help_node. HELP_IS_ONLY_WINDOW_P says
@@ -225,6 +274,7 @@ create_internal_info_help_node (help_is_only_window_p)
register int i;
NODE *node;
char *contents = NULL;
+ char *exec_keys;
#ifndef HELP_NODE_GETS_REGENERATED
if (internal_info_help_node_contents)
@@ -239,6 +289,10 @@ create_internal_info_help_node (help_is_only_window_p)
for (i = 0; info_internal_help_text[i]; i++)
{
+#ifdef INFOKEY
+ printf_to_message_buffer (replace_in_documentation (
+ _(info_internal_help_text[i]), help_is_only_window_p));
+#else
/* Don't translate blank lines, gettext outputs the po file
header in that case. We want a blank line. */
char *msg = *(info_internal_help_text[i])
@@ -252,6 +306,7 @@ create_internal_info_help_node (help_is_only_window_p)
key = "l";
printf_to_message_buffer (msg, key);
+#endif /* !INFOKEY */
}
printf_to_message_buffer ("---------------------\n\n");
@@ -265,35 +320,46 @@ create_internal_info_help_node (help_is_only_window_p)
dump_map_to_message_buffer ("", echo_area_keymap);
#if defined (NAMED_FUNCTIONS)
- /* Get a list of the M-x commands which have no keystroke equivs. */
+ /* Get a list of commands which have no keystroke equivs. */
+ exec_keys = where_is (info_keymap, InfoCmd(info_execute_command));
+ if (exec_keys)
+ exec_keys = xstrdup (exec_keys);
for (i = 0; function_doc_array[i].func; i++)
{
- VFunction *func = function_doc_array[i].func;
+ InfoCommand *cmd = DocInfoCmd(&function_doc_array[i]);
- if ((!where_is_internal (info_keymap, func)) &&
- (!where_is_internal (echo_area_keymap, func)))
+ if (InfoFunction(cmd) != info_do_lowercase_version
+ && !where_is_internal (info_keymap, cmd)
+ && !where_is_internal (echo_area_keymap, cmd))
{
if (!printed_one_mx)
{
printf_to_message_buffer ("---------------------\n\n");
- printf_to_message_buffer
- (_("The following commands can only be invoked via M-x:\n\n"));
+ if (exec_keys && exec_keys[0])
+ printf_to_message_buffer
+ (_("The following commands can only be invoked via %s:\n\n"), exec_keys);
+ else
+ printf_to_message_buffer
+ (_("The following commands cannot be invoked at all:\n\n"));
printed_one_mx = 1;
}
printf_to_message_buffer
- ("M-x %s\n %s\n",
+ ("%s %s\n %s\n",
+ exec_keys,
function_doc_array[i].func_name,
replace_in_documentation (strlen (function_doc_array[i].doc)
- == 0
- ? function_doc_array[i].doc
- : _(function_doc_array[i].doc)));
+ ? _(function_doc_array[i].doc)
+ : "")
+ );
}
}
if (printed_one_mx)
printf_to_message_buffer ("\n");
+
+ maybe_free (exec_keys);
#endif /* NAMED_FUNCTIONS */
printf_to_message_buffer
@@ -492,39 +558,56 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'")
/* Return the documentation associated with the Info command FUNCTION. */
char *
-function_documentation (function)
- VFunction *function;
+function_documentation (cmd)
+ InfoCommand *cmd;
{
+ char *doc;
+
+#if defined (INFOKEY)
+
+ doc = cmd->doc;
+
+#else /* !INFOKEY */
+
register int i;
for (i = 0; function_doc_array[i].func; i++)
- if (function == function_doc_array[i].func)
+ if (InfoFunction(cmd) == function_doc_array[i].func)
break;
- return replace_in_documentation ((strlen (function_doc_array[i].doc) == 0)
- ? function_doc_array[i].doc
- : _(function_doc_array[i].doc));
+ doc = function_doc_array[i].func ? function_doc_array[i].doc : "";
+
+#endif /* !INFOKEY */
+
+ return replace_in_documentation ((strlen (doc) == 0) ? doc : _(doc));
}
#if defined (NAMED_FUNCTIONS)
/* Return the user-visible name of the function associated with the
Info command FUNCTION. */
char *
-function_name (function)
-
- VFunction *function;
+function_name (cmd)
+ InfoCommand *cmd;
{
+#if defined (INFOKEY)
+
+ return cmd->func_name;
+
+#else /* !INFOKEY */
+
register int i;
for (i = 0; function_doc_array[i].func; i++)
- if (function == function_doc_array[i].func)
+ if (InfoFunction(cmd) == function_doc_array[i].func)
break;
return (function_doc_array[i].func_name);
+
+#endif /* !INFOKEY */
}
-/* Return a pointer to the function named NAME. */
-VFunction *
+/* Return a pointer to the info command for function NAME. */
+InfoCommand *
named_function (name)
char *name;
{
@@ -534,7 +617,7 @@ named_function (name)
if (strcmp (function_doc_array[i].func_name, name) == 0)
break;
- return (function_doc_array[i].func);
+ return (DocInfoCmd(&function_doc_array[i]));
}
#endif /* NAMED_FUNCTIONS */
@@ -544,7 +627,7 @@ key_documentation (key, map)
char key;
Keymap map;
{
- VFunction *function = map[key].function;
+ InfoCommand *function = map[key].function;
if (function)
return (function_documentation (function));
@@ -554,21 +637,21 @@ key_documentation (key, map)
DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
{
- char keyname[50];
- int keyname_index = 0;
+ char keys[50];
unsigned char keystroke;
- char *rep;
+ char *k = keys;
Keymap map;
- keyname[0] = 0;
+ *k = '\0';
map = window->keymap;
for (;;)
{
- message_in_echo_area (_("Describe key: %s"), keyname);
+ message_in_echo_area (_("Describe key: %s"), pretty_keyseq (keys));
keystroke = info_get_input_char ();
unmessage_in_echo_area ();
+#if !defined (INFOKEY)
if (Meta_p (keystroke))
{
if (map[ESC].type != ISKMAP)
@@ -578,32 +661,53 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
return;
}
- strcpy (keyname + keyname_index, "ESC ");
- keyname_index = strlen (keyname);
+ *k++ = '\e';
keystroke = UnMeta (keystroke);
map = (Keymap)map[ESC].function;
}
+#endif /* !INFOKEY */
- /* Add the printed representation of KEYSTROKE to our keyname. */
- rep = pretty_keyname (keystroke);
- strcpy (keyname + keyname_index, rep);
- keyname_index = strlen (keyname);
+ /* Add the KEYSTROKE to our list. */
+ *k++ = keystroke;
+ *k = '\0';
- if (map[keystroke].function == (VFunction *)NULL)
+ if (map[keystroke].function == (InfoCommand *)NULL)
{
- message_in_echo_area (_("%s is undefined."), keyname);
+ message_in_echo_area (_("%s is undefined."), pretty_keyseq (keys));
return;
}
else if (map[keystroke].type == ISKMAP)
{
map = (Keymap)map[keystroke].function;
- strcat (keyname, " ");
- keyname_index = strlen (keyname);
continue;
}
else
{
- char *message, *fundoc, *funname = "";
+ char *keyname, *message, *fundoc, *funname = "";
+
+#if defined (INFOKEY)
+ /* If the key is bound to do-lowercase-version, but its
+ lower-case variant is undefined, say that this key is
+ also undefined. This is especially important for unbound
+ edit keys that emit an escape sequence: it's terribly
+ confusing to see a message "Home (do-lowercase-version)"
+ or some such when Home is unbound. */
+ if (InfoFunction(map[keystroke].function) == info_do_lowercase_version)
+ {
+ unsigned char lowerkey = Meta_p(keystroke)
+ ? Meta (tolower (UnMeta (keystroke)))
+ : tolower (keystroke);
+
+ if (map[lowerkey].function == (InfoCommand *)NULL)
+ {
+ message_in_echo_area (_("%s is undefined."),
+ pretty_keyseq (keys));
+ return;
+ }
+ }
+#endif
+
+ keyname = pretty_keyseq (keys);
#if defined (NAMED_FUNCTIONS)
funname = function_name (map[keystroke].function);
@@ -627,13 +731,12 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
}
}
-/* How to get the pretty printable name of a character. */
-static char rep_buffer[30];
-
+/* Return the pretty printable name of a single character. */
char *
pretty_keyname (key)
unsigned char key;
{
+ static char rep_buffer[30];
char *rep;
if (Meta_p (key))
@@ -642,7 +745,11 @@ pretty_keyname (key)
rep = pretty_keyname (UnMeta (key));
+#if defined (INFOKEY)
+ sprintf (temp, "M-%s", rep);
+#else /* !INFOKEY */
sprintf (temp, "ESC %s", rep);
+#endif /* !INFOKEY */
strcpy (rep_buffer, temp);
rep = rep_buffer;
}
@@ -675,57 +782,269 @@ pretty_keyname (key)
return (rep);
}
+/* Return the pretty printable string which represents KEYSEQ. */
+
+static void pretty_keyseq_internal ();
+
+char *
+pretty_keyseq (keyseq)
+ char *keyseq;
+{
+ static char keyseq_rep[200];
+
+ keyseq_rep[0] = '\0';
+ if (*keyseq)
+ pretty_keyseq_internal (keyseq, keyseq_rep);
+ return (keyseq_rep);
+}
+
+static void
+pretty_keyseq_internal (keyseq, rep)
+ char *keyseq, *rep;
+{
+ if (term_kP && strncmp(keyseq, term_kP, strlen(term_kP)) == 0)
+ {
+ strcpy(rep, "PgUp");
+ keyseq += strlen(term_kP);
+ }
+ else if (term_kN && strncmp(keyseq, term_kN, strlen(term_kN)) == 0)
+ {
+ strcpy(rep, "PgDn");
+ keyseq += strlen(term_kN);
+ }
+#if defined(INFOKEY)
+ else if (term_kh && strncmp(keyseq, term_kh, strlen(term_kh)) == 0)
+ {
+ strcpy(rep, "Home");
+ keyseq += strlen(term_kh);
+ }
+ else if (term_ke && strncmp(keyseq, term_ke, strlen(term_ke)) == 0)
+ {
+ strcpy(rep, "End");
+ keyseq += strlen(term_ke);
+ }
+ else if (term_ki && strncmp(keyseq, term_ki, strlen(term_ki)) == 0)
+ {
+ strcpy(rep, "INS");
+ keyseq += strlen(term_ki);
+ }
+ else if (term_kx && strncmp(keyseq, term_kx, strlen(term_kx)) == 0)
+ {
+ strcpy(rep, "DEL");
+ keyseq += strlen(term_kx);
+ }
+#endif /* INFOKEY */
+ else if (term_ku && strncmp(keyseq, term_ku, strlen(term_ku)) == 0)
+ {
+ strcpy(rep, "Up");
+ keyseq += strlen(term_ku);
+ }
+ else if (term_kd && strncmp(keyseq, term_kd, strlen(term_kd)) == 0)
+ {
+ strcpy(rep, "Down");
+ keyseq += strlen(term_kd);
+ }
+ else if (term_kl && strncmp(keyseq, term_kl, strlen(term_kl)) == 0)
+ {
+ strcpy(rep, "Left");
+ keyseq += strlen(term_kl);
+ }
+ else if (term_kr && strncmp(keyseq, term_kr, strlen(term_kr)) == 0)
+ {
+ strcpy(rep, "Right");
+ keyseq += strlen(term_kr);
+ }
+ else
+ {
+ strcpy (rep, pretty_keyname (keyseq[0]));
+ keyseq++;
+ }
+ if (*keyseq)
+ {
+ strcat (rep, " ");
+ pretty_keyseq_internal (keyseq, rep + strlen(rep));
+ }
+}
+
+/* Return a pointer to the last character in s that is found in f. */
+static char *
+strrpbrk (s, f)
+ const char *s, *f;
+{
+ register const char *e = s + strlen(s);
+ register const char *t;
+
+ while (e-- != s)
+ {
+ for (t = f; *t; t++)
+ if (*e == *t)
+ return (char *)e;
+ }
+ return NULL;
+}
+
/* Replace the names of functions with the key that invokes them. */
char *
-replace_in_documentation (string)
+replace_in_documentation (string, help_is_only_window_p)
char *string;
+ int help_is_only_window_p;
{
+ unsigned reslen = strlen (string);
register int i, start, next;
static char *result = (char *)NULL;
maybe_free (result);
- result = (char *)xmalloc (1 + strlen (string));
+ result = (char *)xmalloc (1 + reslen);
i = next = start = 0;
/* Skip to the beginning of a replaceable function. */
for (i = start; string[i]; i++)
{
- /* Is this the start of a replaceable function name? */
- if (string[i] == '\\' && string[i + 1] == '[')
- {
- char *fun_name, *rep;
- VFunction *function;
-
- /* Copy in the old text. */
- strncpy (result + next, string + start, i - start);
- next += (i - start);
- start = i + 2;
-
- /* Move to the end of the function name. */
- for (i = start; string[i] && (string[i] != ']'); i++);
-
- fun_name = (char *)xmalloc (1 + i - start);
- strncpy (fun_name, string + start, i - start);
- fun_name[i - start] = '\0';
-
- /* Find a key which invokes this function in the info_keymap. */
- function = named_function (fun_name);
+ int j = i + 1;
- /* If the internal documentation string fails, there is a
- serious problem with the associated command's documentation.
- We croak so that it can be fixed immediately. */
- if (!function)
- abort ();
-
- rep = where_is (info_keymap, function);
- strcpy (result + next, rep);
- next = strlen (result);
-
- start = i;
- if (string[i])
- start++;
- }
+ /* Is this the start of a replaceable function name? */
+ if (string[i] == '\\')
+ {
+ char *fmt = NULL;
+ unsigned min = 0;
+ unsigned max = 0;
+
+ if(string[j] == '%')
+ {
+ if (string[++j] == '-')
+ j++;
+ if (isdigit(string[j]))
+ {
+ min = atoi(string + j);
+ while (isdigit(string[j]))
+ j++;
+ if (string[j] == '.' && isdigit(string[j + 1]))
+ {
+ j += 1;
+ max = atoi(string + j);
+ while (isdigit(string[j]))
+ j++;
+ }
+ fmt = (char *)xmalloc (j - i + 2);
+ strncpy (fmt, string + i + 1, j - i);
+ fmt[j - i - 1] = 's';
+ fmt[j - i] = '\0';
+ }
+ else
+ j = i + 1;
+ }
+ if (string[j] == '[')
+ {
+ unsigned arg = 0;
+ char *argstr = NULL;
+ char *rep_name, *fun_name, *rep;
+ InfoCommand *command;
+ char *repstr = NULL;
+ unsigned replen;
+
+ /* Copy in the old text. */
+ strncpy (result + next, string + start, i - start);
+ next += (i - start);
+ start = j + 1;
+
+ /* Look for an optional numeric arg. */
+ i = start;
+ if (isdigit(string[i])
+ || (string[i] == '-' && isdigit(string[i + 1])) )
+ {
+ arg = atoi(string + i);
+ if (string[i] == '-')
+ i++;
+ while (isdigit(string[i]))
+ i++;
+ }
+ start = i;
+
+ /* Move to the end of the function name. */
+ for (i = start; string[i] && (string[i] != ']'); i++);
+
+ rep_name = (char *)xmalloc (1 + i - start);
+ strncpy (rep_name, string + start, i - start);
+ rep_name[i - start] = '\0';
+
+ /* If we have only one window (because the window size was too
+ small to split it), we have to quit help by going back one
+ noew in the history list, not deleting the window. */
+ if (strcmp (rep_name, "quit-help") == 0)
+ fun_name = help_is_only_window_p ? "history-node"
+ : "delete-window";
+ else
+ fun_name = rep_name;
+
+ /* Find a key which invokes this function in the info_keymap. */
+ command = named_function (fun_name);
+
+ free (rep_name);
+
+ /* If the internal documentation string fails, there is a
+ serious problem with the associated command's documentation.
+ We croak so that it can be fixed immediately. */
+ if (!command)
+ abort ();
+
+ if (arg)
+ {
+ char *argrep, *p;
+
+ argrep = where_is (info_keymap, InfoCmd(info_add_digit_to_numeric_arg));
+ p = argrep ? strrpbrk (argrep, "0123456789-") : NULL;
+ if (p)
+ {
+ argstr = (char *)xmalloc (p - argrep + 21);
+ strncpy (argstr, argrep, p - argrep);
+ sprintf (argstr + (p - argrep), "%d", arg);
+ }
+ else
+ command = NULL;
+ }
+ rep = command ? where_is (info_keymap, command) : NULL;
+ if (!rep)
+ rep = "N/A";
+ replen = (argstr ? strlen (argstr) + 1 : 0) + strlen (rep);
+ repstr = (char *)xmalloc (replen);
+ repstr[0] = '\0';
+ if (argstr)
+ {
+ strcat(repstr, argstr);
+ strcat(repstr, " ");
+ free (argstr);
+ }
+ strcat(repstr, rep);
+
+ if (fmt)
+ {
+ if (replen > max)
+ replen = max;
+ if (replen < min)
+ replen = min;
+ }
+ if (next + replen > reslen)
+ {
+ reslen = next + replen + 1;
+ result = (char *)xrealloc (result, reslen + 1);
+ }
+
+ if (fmt)
+ sprintf (result + next, fmt, repstr);
+ else
+ strcpy (result + next, repstr);
+
+ next = strlen (result);
+ free (repstr);
+
+ start = i;
+ if (string[i])
+ start++;
+ }
+
+ maybe_free (fmt);
+ }
}
strcpy (result + next, string + start);
return (result);
@@ -737,10 +1056,10 @@ static char *where_is_rep = (char *)NULL;
static int where_is_rep_index = 0;
static int where_is_rep_size = 0;
-static char *
-where_is (map, function)
+char *
+where_is (map, cmd)
Keymap map;
- VFunction *function;
+ InfoCommand *cmd;
{
char *rep;
@@ -748,35 +1067,53 @@ where_is (map, function)
where_is_rep = (char *)xmalloc (where_is_rep_size = 100);
where_is_rep_index = 0;
- rep = where_is_internal (map, function);
+ rep = where_is_internal (map, cmd);
- /* If it couldn't be found, return "M-x Foo". */
+ /* If it couldn't be found, return "M-x Foo" (or equivalent). */
if (!rep)
{
char *name;
- name = function_name (function);
+ name = function_name (cmd);
+ if (!name)
+ return NULL; /* no such function */
+
+ rep = where_is_internal (map, InfoCmd(info_execute_command));
+ if (!rep)
+ return ""; /* function exists but can't be got to by user */
- if (name)
- sprintf (where_is_rep, "M-x %s", name);
+ sprintf (where_is_rep, "%s %s", rep, name);
rep = where_is_rep;
}
return (rep);
}
-/* Return the printed rep of FUNCTION as found in MAP, or NULL. */
+/* Return the printed rep of the keystrokes that invoke FUNCTION,
+ as found in MAP, or NULL. */
static char *
-where_is_internal (map, function)
+where_is_internal (map, cmd)
Keymap map;
- VFunction *function;
+ InfoCommand *cmd;
{
+#if defined(INFOKEY)
+
+ register FUNCTION_KEYSEQ *k;
+
+ for (k = cmd->keys; k; k = k->next)
+ if (k->map == map)
+ return pretty_keyseq (k->keyseq);
+
+ return NULL;
+
+#else /* !INFOKEY */
+
register int i;
/* If the function is directly invokable in MAP, return the representation
of that keystroke. */
for (i = 0; i < 256; i++)
- if ((map[i].type == ISFUNC) && map[i].function == function)
+ if ((map[i].type == ISFUNC) && map[i].function == cmd)
{
sprintf (where_is_rep + where_is_rep_index, "%s", pretty_keyname (i));
return (where_is_rep);
@@ -794,7 +1131,7 @@ where_is_internal (map, function)
pretty_keyname (i));
where_is_rep_index = strlen (where_is_rep);
- rep = where_is_internal ((Keymap)map[i].function, function);
+ rep = where_is_internal ((Keymap)map[i].function, cmd);
if (rep)
return (where_is_rep);
@@ -804,6 +1141,8 @@ where_is_internal (map, function)
}
return NULL;
+
+#endif /* INFOKEY */
}
extern char *read_function_name ();
@@ -823,23 +1162,23 @@ DECLARE_INFO_COMMAND (info_where_is,
if (*command_name)
{
- VFunction *function;
+ InfoCommand *command;
- function = named_function (command_name);
+ command = named_function (command_name);
- if (function)
+ if (command)
{
char *location;
- location = where_is (active_window->keymap, function);
+ location = where_is (active_window->keymap, command);
- if (!location)
+ if (!location || !location[0])
{
info_error (_("`%s' is not on any keys"), command_name);
}
else
{
- if (strncmp (location, "M-x ", 4) == 0)
+ if (strstr (location, function_name (command)))
window_message_in_echo_area
(_("%s can only be invoked via %s."), command_name, location);
else
diff --git a/contrib/texinfo/info/infokey.c b/contrib/texinfo/info/infokey.c
new file mode 100644
index 0000000..e84a2d7
--- /dev/null
+++ b/contrib/texinfo/info/infokey.c
@@ -0,0 +1,908 @@
+/* infokey.c -- compile ~/.infokey to ~/.info.
+ $Id: infokey.c,v 1.5 2002/02/26 16:17:57 karl Exp $
+
+ Copyright (C) 1999, 2001, 02 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Written by Andrew Bettison <andrewb@zip.com.au>. */
+
+#include "info.h"
+#include "infomap.h"
+#include "infokey.h"
+#include "key.h"
+#include "getopt.h"
+
+static char *program_name = "infokey";
+
+/* Non-zero means print version info only. */
+static int print_version_p = 0;
+
+/* Non-zero means print a short description of the options. */
+static int print_help_p = 0;
+
+/* String specifying the source file. This is set by the user on the
+ command line, or a default is used. */
+static char *input_filename = (char *) NULL;
+
+/* String specifying the name of the file to output to. This is
+ set by the user on the command line, or a default is used. */
+static char *output_filename = (char *) NULL;
+
+/* Structure describing the options that Infokey accepts. We pass this
+ structure to getopt_long (). If you add or otherwise change this
+ structure, you must also change the string which follows it. */
+static struct option long_options[] =
+{
+ {"output", 1, 0, 'o'},
+ {"help", 0, &print_help_p, 1},
+ {"version", 0, &print_version_p, 1},
+ {NULL, 0, NULL, 0}
+};
+
+/* String describing the shorthand versions of the long options found above. */
+static char *short_options = "o:";
+
+/* Structure for holding the compiled sections. */
+enum sect_e
+ {
+ info = 0,
+ ea = 1,
+ var = 2,
+ };
+struct sect
+ {
+ unsigned int cur;
+ unsigned char data[INFOKEY_MAX_SECTIONLEN];
+ };
+
+/* Some "forward" declarations. */
+static char *mkpath ();
+static int compile (), write_infokey_file ();
+static void syntax_error (), error_message (), suggest_help (), short_help ();
+
+
+/* **************************************************************** */
+/* */
+/* Main Entry Point to the Infokey Program */
+/* */
+/* **************************************************************** */
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int getopt_long_index; /* Index returned by getopt_long (). */
+ NODE *initial_node; /* First node loaded by Info. */
+
+#ifdef HAVE_SETLOCALE
+ /* Set locale via LC_ALL. */
+ setlocale (LC_ALL, "");
+#endif
+
+ /* Set the text message domain. */
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ while (1)
+ {
+ int option_character;
+
+ option_character = getopt_long
+ (argc, argv, short_options, long_options, &getopt_long_index);
+
+ /* getopt_long () returns EOF when there are no more long options. */
+ if (option_character == EOF)
+ break;
+
+ /* If this is a long option, then get the short version of it. */
+ if (option_character == 0 && long_options[getopt_long_index].flag == 0)
+ option_character = long_options[getopt_long_index].val;
+
+ /* Case on the option that we have received. */
+ switch (option_character)
+ {
+ case 0:
+ break;
+
+ /* User is specifying the name of a file to output to. */
+ case 'o':
+ if (output_filename)
+ free (output_filename);
+ output_filename = xstrdup (optarg);
+ break;
+
+ default:
+ suggest_help ();
+ xexit (1);
+ }
+ }
+
+ /* If the user specified --version, then show the version and exit. */
+ if (print_version_p)
+ {
+ printf ("%s (GNU %s) %s\n", program_name, PACKAGE, VERSION);
+ puts ("");
+ printf (_ ("Copyright (C) %s Free Software Foundation, Inc.\n\
+There is NO warranty. You may redistribute this software\n\
+under the terms of the GNU General Public License.\n\
+For more information about these matters, see the files named COPYING.\n"),
+ "1999");
+ xexit (0);
+ }
+
+ /* If the `--help' option was present, show the help and exit. */
+ if (print_help_p)
+ {
+ short_help ();
+ xexit (0);
+ }
+
+ /* If there is one argument remaining, it is the name of the input
+ file. */
+ if (optind == argc - 1)
+ {
+ if (input_filename)
+ free (input_filename);
+ input_filename = xstrdup (argv[optind]);
+ }
+ else if (optind != argc)
+ {
+ error_message (0, _("incorrect number of arguments"));
+ suggest_help ();
+ xexit (1);
+ }
+
+ /* Use default filenames where none given. */
+ {
+ char *homedir;
+
+ homedir = getenv ("HOME");
+#ifdef __MSDOS__
+ if (!homedir)
+ homedir = ".";
+#endif
+ if (!input_filename)
+ input_filename = mkpath (homedir, INFOKEY_SRCFILE);
+ if (!output_filename)
+ output_filename = mkpath (homedir, INFOKEY_FILE);
+ }
+
+ {
+ FILE *inf;
+ FILE *outf;
+ int write_error;
+ static struct sect sections[3];
+
+ /* Open the input file. */
+ inf = fopen (input_filename, "r");
+ if (!inf)
+ {
+ error_message (errno, _("cannot open input file `%s'"), input_filename);
+ xexit (1);
+ }
+
+ /* Compile the input file to its verious sections, then write the
+ section data to the output file. */
+
+ if (compile (inf, input_filename, sections))
+ {
+ /* Open the output file. */
+ outf = fopen (output_filename, FOPEN_WBIN);
+ if (!outf)
+ {
+ error_message (errno, _("cannot create output file `%s'"), output_filename);
+ xexit (1);
+ }
+
+ /* Write the contents of the output file and close it. If there is
+ an error writing to the file, delete it and exit with a failure
+ status. */
+ write_error = 0;
+ if (!write_infokey_file (outf, sections))
+ {
+ error_message (errno, _("error writing to `%s'"), output_filename);
+ write_error = 1;
+ }
+ if (fclose (outf) == EOF)
+ {
+ error_message (errno, _("error closing output file `%s'"), output_filename);
+ write_error = 1;
+ }
+ if (write_error)
+ {
+ unlink (output_filename);
+ xexit (1);
+ }
+ }
+
+ /* Close the input file. */
+ fclose (inf);
+ }
+
+ xexit (0);
+}
+
+static char *
+mkpath (dir, file)
+ const char *dir;
+ const char *file;
+{
+ char *p;
+
+ p = xmalloc (strlen (dir) + 1 + strlen (file) + 2);
+ strcpy (p, dir);
+ strcat (p, "/");
+ strcat (p, file);
+ return p;
+}
+
+
+/* Compilation - the real work.
+
+ Source file syntax
+ ------------------
+ The source file is a line-based text file with the following
+ structure:
+
+ # comments
+ # more comments
+
+ #info
+ u prev-line
+ d next-line
+ ^a invalid # just beep
+ \ku prev-line
+ #stop
+ \kd next-line
+ q quit # of course!
+
+ #echo-area
+ ^a echo-area-beg-of-line
+ ^e echo-area-end-of-line
+ \kr echo-area-forward
+ \kl echo-area-backward
+ \kh echo-area-beg-of-line
+ \ke echo-area-end-of-line
+
+ #var
+ scroll-step=1
+ ISO-Latin=Off
+
+ Lines starting with '#' are comments, and are ignored. Blank
+ lines are ignored. Each section is introduced by one of the
+ following lines:
+
+ #info
+ #echo-area
+ #var
+
+ The sections may occur in any order. Each section may be
+ omitted completely. If the 'info' section is the first in the
+ file, its '#info' line may be omitted.
+
+ The 'info' and 'echo-area' sections
+ -----------------------------------
+ Each line in the 'info' or 'echo-area' sections has the
+ following syntax:
+
+ key-sequence SPACE action-name [ SPACE [ # comment ] ] \n
+
+ Where SPACE is one or more white space characters excluding
+ newline, "action-name" is the name of a GNU Info command,
+ "comment" is any sequence of characters excluding newline, and
+ "key-sequence" is a concatenation of one or more key definitions
+ using the following syntax:
+
+ 1. A carat ^ followed by one character indicates a single
+ control character;
+
+ 2. A backslash \ followed by one, two, or three octal
+ digits indicates a single character having that ASCII
+ code;
+
+ 3. \n indicates a single NEWLINE;
+ \e indicates a single ESC;
+ \r indicates a single CR;
+ \t indicates a single TAB;
+ \b indicates a single BACKSPACE;
+
+ 4. \ku indicates the Up Arrow key;
+ \kd indicates the Down Arrow key;
+ \kl indicates the Left Arrow key;
+ \kr indicates the Right Arrow key;
+ \kP indicates the Page Up (PRIOR) key;
+ \kN indicates the Page Down (NEXT) key;
+ \kh indicates the Home key;
+ \ke indicates the End key;
+ \kx indicates the DEL key;
+ \k followed by any other character indicates a single
+ control-K, and the following character is interpreted
+ as in rules 1, 2, 3, 5 and 6.
+
+ 5. \m followed by any sequence defined in rules 1, 2, 3, 4
+ or 6 indicates the "Meta" modification of that key.
+
+ 6. A backslash \ followed by any character not described
+ above indicates that character itself. In particular:
+ \\ indicates a single backslash \,
+ \ (backslash-space) indicates a single space,
+ \^ indicates a single caret ^,
+
+ If the following line:
+
+ #stop
+
+ occurs anywhere in an 'info' or 'echo-area' section, that
+ indicates to GNU Info to suppress all of its default key
+ bindings in that context.
+
+ The 'var' section
+ -----------------
+ Each line in the 'var' section has the following syntax:
+
+ variable-name = value \n
+
+ Where "variable-name" is the name of a GNU Info variable and
+ "value" is the value that GNU Info will assign to that variable
+ when commencing execution. There must be no white space in the
+ variable name, nor between the variable name and the '='. All
+ characters immediately following the '=', up to but not
+ including the terminating newline, are considered to be the
+ value that will be assigned. In other words, white space
+ following the '=' is not ignored.
+ */
+
+static int add_to_section (), lookup_action ();
+
+/* Compile the input file into its various sections. Return true if no
+ error was encountered.
+ */
+static int
+compile (fp, filename, sections)
+ FILE *fp;
+ const char *filename;
+ struct sect sections[];
+{
+ int error = 0;
+ char rescan = 0;
+ unsigned int lnum = 0;
+ int c;
+
+ /* This parser is a true state machine, with no sneaky fetching
+ of input characters inside the main loop. In other words, all
+ state is fully represented by the following variables:
+ */
+ enum
+ {
+ start_of_line,
+ start_of_comment,
+ in_line_comment,
+ in_trailing_comment,
+ get_keyseq,
+ got_keyseq,
+ get_action,
+ got_action,
+ get_varname,
+ got_varname,
+ get_equals,
+ got_equals,
+ get_value,
+ }
+ state = start_of_line;
+ enum sect_e section = info;
+ enum
+ {
+ normal,
+ slosh,
+ control,
+ octal,
+ special_key,
+ }
+ seqstate; /* used if state == get_keyseq */
+ char meta = 0;
+ char ocnt; /* used if state == get_keyseq && seqstate == octal */
+
+ /* Data is accumulated in the following variables. The code
+ avoids overflowing these strings, and throws an error
+ where appropriate if a string limit is exceeded. These string
+ lengths are arbitrary (and should be large enough) and their
+ lengths are not hard-coded anywhere else, so increasing them
+ here will not break anything. */
+ char oval;
+ char comment[10];
+ unsigned int clen;
+ char seq[20];
+ unsigned int slen;
+ char act[80];
+ unsigned int alen;
+ char varn[80];
+ unsigned int varlen;
+ char val[80];
+ unsigned int vallen;
+
+#define To_seq(c) \
+ do { \
+ if (slen < sizeof seq) \
+ seq[slen++] = meta ? Meta(c) : (c); \
+ else \
+ { \
+ syntax_error(filename, lnum, _("key sequence too long")); \
+ error = 1; \
+ } \
+ meta = 0; \
+ } while (0)
+
+ sections[info].cur = 1;
+ sections[info].data[0] = 0;
+ sections[ea].cur = 1;
+ sections[ea].data[0] = 0;
+ sections[var].cur = 0;
+
+ while (!error && (rescan || (c = fgetc (fp)) != EOF))
+ {
+ rescan = 0;
+ switch (state)
+ {
+ case start_of_line:
+ lnum++;
+ if (c == '#')
+ state = start_of_comment;
+ else if (c != '\n')
+ {
+ switch (section)
+ {
+ case info:
+ case ea:
+ state = get_keyseq;
+ seqstate = normal;
+ slen = 0;
+ break;
+ case var:
+ state = get_varname;
+ varlen = 0;
+ break;
+ }
+ rescan = 1;
+ }
+ break;
+
+ case start_of_comment:
+ clen = 0;
+ state = in_line_comment;
+ /* fall through */
+ case in_line_comment:
+ if (c == '\n')
+ {
+ state = start_of_line;
+ comment[clen] = '\0';
+ if (strcmp (comment, "info") == 0)
+ section = info;
+ else if (strcmp (comment, "echo-area") == 0)
+ section = ea;
+ else if (strcmp (comment, "var") == 0)
+ section = var;
+ else if (strcmp (comment, "stop") == 0
+ && (section == info || section == ea))
+ sections[section].data[0] = 1;
+ }
+ else if (clen < sizeof comment - 1)
+ comment[clen++] = c;
+ break;
+
+ case in_trailing_comment:
+ if (c == '\n')
+ state = start_of_line;
+ break;
+
+ case get_keyseq:
+ switch (seqstate)
+ {
+ case normal:
+ if (c == '\n' || isspace (c))
+ {
+ state = got_keyseq;
+ rescan = 1;
+ if (slen == 0)
+ {
+ syntax_error (filename, lnum, _("missing key sequence"));
+ error = 1;
+ }
+ }
+ else if (c == '\\')
+ seqstate = slosh;
+ else if (c == '^')
+ seqstate = control;
+ else
+ To_seq (c);
+ break;
+
+ case slosh:
+ switch (c)
+ {
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ seqstate = octal;
+ oval = c - '0';
+ ocnt = 1;
+ break;
+ case 'b':
+ To_seq ('\b');
+ seqstate = normal;
+ break;
+ case 'e':
+ To_seq ('\033');
+ seqstate = normal;
+ break;
+ case 'n':
+ To_seq ('\n');
+ seqstate = normal;
+ break;
+ case 'r':
+ To_seq ('\r');
+ seqstate = normal;
+ break;
+ case 't':
+ To_seq ('\t');
+ seqstate = normal;
+ break;
+ case 'm':
+ meta = 1;
+ seqstate = normal;
+ break;
+ case 'k':
+ seqstate = special_key;
+ break;
+ default:
+ /* Backslash followed by any other char
+ just means that char. */
+ To_seq (c);
+ seqstate = normal;
+ break;
+ }
+ break;
+
+ case octal:
+ switch (c)
+ {
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ if (++ocnt <= 3)
+ oval = oval * 8 + c - '0';
+ if (ocnt == 3)
+ seqstate = normal;
+ break;
+ default:
+ ocnt = 4;
+ seqstate = normal;
+ rescan = 1;
+ break;
+ }
+ if (seqstate != octal)
+ {
+ if (oval)
+ To_seq (oval);
+ else
+ {
+ syntax_error (filename, lnum, _("NUL character (\\000) not permitted"));
+ error = 1;
+ }
+ }
+ break;
+
+ case special_key:
+ To_seq (SK_ESCAPE);
+ switch (c)
+ {
+ case 'u': To_seq (SK_UP_ARROW); break;
+ case 'd': To_seq (SK_DOWN_ARROW); break;
+ case 'r': To_seq (SK_RIGHT_ARROW); break;
+ case 'l': To_seq (SK_LEFT_ARROW); break;
+ case 'U': To_seq (SK_PAGE_UP); break;
+ case 'D': To_seq (SK_PAGE_DOWN); break;
+ case 'h': To_seq (SK_HOME); break;
+ case 'e': To_seq (SK_END); break;
+ case 'x': To_seq (SK_DELETE); break;
+ default: To_seq (SK_LITERAL); rescan = 1; break;
+ }
+ seqstate = normal;
+ break;
+
+ case control:
+ if (CONTROL (c))
+ To_seq (CONTROL (c));
+ else
+ {
+ syntax_error (filename, lnum, _("NUL character (^%c) not permitted"), c);
+ error = 1;
+ }
+ seqstate = normal;
+ break;
+ }
+ break;
+
+ case got_keyseq:
+ if (isspace (c) && c != '\n')
+ break;
+ state = get_action;
+ alen = 0;
+ /* fall through */
+ case get_action:
+ if (c == '\n' || isspace (c))
+ {
+ int a;
+
+ state = got_action;
+ rescan = 1;
+ if (alen == 0)
+ {
+ syntax_error (filename, lnum, _("missing action name"), c);
+ error = 1;
+ }
+ else
+ {
+ act[alen] = '\0';
+ a = lookup_action (act);
+ if (a != -1)
+ {
+ char av = a;
+
+ if (!(add_to_section (&sections[section], seq, slen)
+ && add_to_section (&sections[section], "", 1)
+ && add_to_section (&sections[section], &av, 1)))
+ {
+ syntax_error (filename, lnum, _("section too long"));
+ error = 1;
+ }
+ }
+ else
+ {
+ syntax_error (filename, lnum, _("unknown action `%s'"), act);
+ error = 1;
+ }
+ }
+ }
+ else if (alen < sizeof act - 1)
+ act[alen++] = c;
+ else
+ {
+ syntax_error (filename, lnum, _("action name too long"));
+ error = 1;
+ }
+ break;
+
+ case got_action:
+ if (c == '#')
+ state = in_trailing_comment;
+ else if (c == '\n')
+ state = start_of_line;
+ else if (!isspace (c))
+ {
+ syntax_error (filename, lnum, _("extra characters following action `%s'"), act);
+ error = 1;
+ }
+ break;
+
+ case get_varname:
+ if (c == '=')
+ {
+ if (varlen == 0)
+ {
+ syntax_error (filename, lnum, _("missing variable name"));
+ error = 1;
+ }
+ state = get_value;
+ vallen = 0;
+ }
+ else if (c == '\n' || isspace (c))
+ {
+ syntax_error (filename, lnum, _("missing `=' immediately after variable name"));
+ error = 1;
+ }
+ else if (varlen < sizeof varn)
+ varn[varlen++] = c;
+ else
+ {
+ syntax_error (filename, lnum, _("variable name too long"));
+ error = 1;
+ }
+ break;
+
+ case get_value:
+ if (c == '\n')
+ {
+ state = start_of_line;
+ if (!(add_to_section (&sections[section], varn, varlen)
+ && add_to_section (&sections[section], "", 1)
+ && add_to_section (&sections[section], val, vallen)
+ && add_to_section (&sections[section], "", 1)))
+ {
+ syntax_error (filename, lnum, _("section too long"));
+ error = 1;
+ }
+ }
+ else if (vallen < sizeof val)
+ val[vallen++] = c;
+ else
+ {
+ syntax_error (filename, lnum, _("value too long"));
+ error = 1;
+ }
+ break;
+ }
+ }
+
+#undef To_seq
+
+ return !error;
+}
+
+/* Add some characters to a section's data. Return true if all the
+ characters fit, or false if the section's size limit was exceeded.
+ */
+static int
+add_to_section (s, str, len)
+ struct sect *s;
+ const char *str;
+ unsigned int len;
+{
+ if (s->cur + len > sizeof s->data)
+ return 0;
+ strncpy (s->data + s->cur, str, len);
+ s->cur += len;
+ return 1;
+}
+
+/* Translate from an action name to its numeric code. This uses the
+ auto-generated array in key.c.
+ */
+static int
+lookup_action (actname)
+ const char *actname;
+{
+ int i;
+
+ if (strcmp ("invalid", actname) == 0)
+ return A_INVALID;
+ for (i = 0; function_key_array[i].name != NULL; i++)
+ if (strcmp (function_key_array[i].name, actname) == 0)
+ return function_key_array[i].code;
+ return -1;
+}
+
+/* Put an integer to an infokey file.
+ Integers are stored as two bytes, low order first,
+ in radix INFOKEY_RADIX.
+ */
+static int
+putint (i, fp)
+ int i;
+ FILE *fp;
+{
+ return fputc (i % INFOKEY_RADIX, fp) != EOF
+ && fputc ((i / INFOKEY_RADIX) % INFOKEY_RADIX, fp) != EOF;
+}
+
+/* Write an entire section to an infokey file. If the section is
+ empty, simply omit it.
+ */
+static int
+putsect (s, code, fp)
+ struct sect *s;
+ int code;
+ FILE *fp;
+{
+ if (s->cur == 0)
+ return 1;
+ return fputc (code, fp) != EOF
+ && putint (s->cur, fp)
+ && fwrite (s->data, s->cur, 1, fp) == 1;
+}
+
+/* Write an entire infokey file, given an array containing its sections.
+ */
+static int
+write_infokey_file (fp, sections)
+ FILE *fp;
+ struct sect sections[];
+{
+ /* Get rid of sections with no effect. */
+ if (sections[info].cur == 1 && sections[info].data[0] == 0)
+ sections[info].cur = 0;
+ if (sections[ea].cur == 1 && sections[ea].data[0] == 0)
+ sections[ea].cur = 0;
+
+ /* Write all parts of the file out in order (no lseeks),
+ checking for errors all the way. */
+ return fputc (INFOKEY_MAGIC_S0, fp) != EOF
+ && fputc (INFOKEY_MAGIC_S1, fp) != EOF
+ && fputc (INFOKEY_MAGIC_S2, fp) != EOF
+ && fputc (INFOKEY_MAGIC_S3, fp) != EOF
+ && fputs (VERSION, fp) != EOF
+ && fputc ('\0', fp) != EOF
+ && putsect (&sections[info], INFOKEY_SECTION_INFO, fp)
+ && putsect (&sections[ea], INFOKEY_SECTION_EA, fp)
+ && putsect (&sections[var], INFOKEY_SECTION_VAR, fp)
+ && fputc (INFOKEY_MAGIC_E0, fp) != EOF
+ && fputc (INFOKEY_MAGIC_E1, fp) != EOF
+ && fputc (INFOKEY_MAGIC_E2, fp) != EOF
+ && fputc (INFOKEY_MAGIC_E3, fp) != EOF;
+}
+
+
+/* Error handling. */
+
+/* Give the user a "syntax error" message in the form
+ progname: "filename", line N: message
+ */
+static void
+error_message (error_code, fmt, a1, a2, a3, a4)
+ int error_code;
+ const char *fmt;
+ const void *a1, *a2, *a3, *a4;
+{
+ fprintf (stderr, "%s: ", program_name);
+ fprintf (stderr, fmt, a1, a2, a3, a4);
+ if (error_code)
+ fprintf (stderr, " - %s", strerror (error_code));
+ fprintf (stderr, "\n");
+}
+
+/* Give the user a generic error message in the form
+ progname: message
+ */
+static void
+syntax_error (filename, linenum, fmt, a1, a2, a3, a4)
+ const char *filename;
+ unsigned int linenum;
+ const char *fmt;
+ const void *a1, *a2, *a3, *a4;
+{
+ fprintf (stderr, "%s: ", program_name);
+ fprintf (stderr, _("\"%s\", line %u: "), filename, linenum);
+ fprintf (stderr, fmt, a1, a2, a3, a4);
+ fprintf (stderr, "\n");
+}
+
+/* Produce a gentle rtfm. */
+static void
+suggest_help ()
+{
+ fprintf (stderr, _("Try --help for more information.\n"));
+}
+
+/* Produce a scaled down description of the available options to Info. */
+static void
+short_help ()
+{
+ printf (_ ("\
+Usage: %s [OPTION]... [INPUT-FILE]\n\
+\n\
+Compile infokey source file to infokey file. Reads INPUT-FILE (default\n\
+$HOME/.infokey) and writes compiled key file to (by default) $HOME/.info.\n\
+\n\
+Options:\n\
+ --output FILE output to FILE instead of $HOME/.info\n\
+ --help display this help and exit.\n\
+ --version display version information and exit.\n\
+\n\
+Email bug reports to bug-texinfo@gnu.org,\n\
+general questions and discussion to help-texinfo@gnu.org.\n\
+"),
+ program_name
+ );
+ xexit (0);
+}
diff --git a/contrib/texinfo/info/infokey.h b/contrib/texinfo/info/infokey.h
new file mode 100644
index 0000000..0babea9
--- /dev/null
+++ b/contrib/texinfo/info/infokey.h
@@ -0,0 +1,128 @@
+/* infokey.h -- Custom keystroke definition support.
+ $Id: $
+
+ Copyright (C) 1999 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Written by Andrew Bettison <andrewb@zip.com.au>.
+
+ This design was derived from the "lesskey" system in less 3.4.0. by
+ Mark Nudelman.
+
+ The following terminology is confusing:
+ source file = $HOME/.infokey
+ infokey file = $HOME/.info
+ Oh, well.
+ */
+
+
+/* Default source file, where user writes text definitions to be
+ compiled to the infokey file. MS-DOS doesn't allow leading
+ dots in file names. */
+#ifdef __MSDOS__
+#define INFOKEY_SRCFILE "_infokey"
+#else
+#define INFOKEY_SRCFILE ".infokey"
+#endif
+
+/* Default "infokey file", where compiled user defs are kept and
+ read by Info. MS-DOS doesn't allow leading dots in file names. */
+#ifdef __MSDOS__
+#define INFOKEY_FILE "_info"
+#else
+#define INFOKEY_FILE ".info"
+#endif
+
+/*
+Format of entire infokey file:
+
+ 4 bytes magic number S
+ X bytes version string
+ 1 byte '\0' terminator
+
+ any number of sections:
+ 1 byte section id
+ 2 bytes section length (N)
+ N bytes section definitions: format depends on section
+
+ 4 bytes magic number E
+
+Format of INFO and EA sections:
+
+ 1 byte flag: 1 == suppress default key bindings
+ Repeat:
+ X bytes key sequence
+ 1 byte '\0' terminator
+ 1 byte action code (A_xxx)
+
+Format of VAR section:
+
+ Repeat:
+ X bytes variable name
+ 1 byte '\0' terminator
+ Y bytes value
+ 1 byte '\0' terminator
+
+*/
+
+#define INFOKEY_NMAGIC 8
+
+#define INFOKEY_MAGIC_S0 '\001'
+#define INFOKEY_MAGIC_S1 'I'
+#define INFOKEY_MAGIC_S2 'n'
+#define INFOKEY_MAGIC_S3 'f'
+
+#define INFOKEY_SECTION_INFO 'i'
+#define INFOKEY_SECTION_EA 'e'
+#define INFOKEY_SECTION_VAR 'v'
+
+#define INFOKEY_MAGIC_E0 'A'
+#define INFOKEY_MAGIC_E1 'l'
+#define INFOKEY_MAGIC_E2 'f'
+#define INFOKEY_MAGIC_E3 'n'
+
+#define INFOKEY_RADIX 64
+#define INFOKEY_MAX_SECTIONLEN 500
+#define INFOKEY_MAX_DEFLEN 16
+
+#define A_MAX_COMMAND 120
+#define A_INVALID 121
+
+/* Character transformations (independent of info's own) */
+
+#define CONTROL(c) ((c) & 0x1f)
+#define ISCONTROL(c) (((c) & ~0x1f) == 0)
+#define META(c) ((c) | 0x80)
+#define UNMETA(c) ((c) & ~0x80)
+#define ISMETA(c) (((c) & 0x80) != 0)
+
+/* Special keys (keys which output different strings on different terminals) */
+
+#define SK_ESCAPE CONTROL('k')
+#define SK_RIGHT_ARROW 1
+#define SK_LEFT_ARROW 2
+#define SK_UP_ARROW 3
+#define SK_DOWN_ARROW 4
+#define SK_PAGE_UP 5
+#define SK_PAGE_DOWN 6
+#define SK_HOME 7
+#define SK_END 8
+#define SK_DELETE 9
+#define SK_INSERT 10
+#define SK_CTL_LEFT_ARROW 11
+#define SK_CTL_RIGHT_ARROW 12
+#define SK_CTL_DELETE 13
+#define SK_LITERAL 40
diff --git a/contrib/texinfo/info/infomap.c b/contrib/texinfo/info/infomap.c
index 932435e..7749d53 100644
--- a/contrib/texinfo/info/infomap.c
+++ b/contrib/texinfo/info/infomap.c
@@ -1,7 +1,7 @@
-/* infomap.c -- Keymaps for Info.
- $Id: infomap.c,v 1.20 1999/06/25 21:57:40 karl Exp $
+/* infomap.c -- keymaps for Info.
+ $Id: infomap.c,v 1.28 2002/02/08 23:02:53 karl Exp $
- Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 99, 2001, 02 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,12 +24,17 @@
#include "funs.h"
#include "terminal.h"
+#if defined(INFOKEY)
+#include "infokey.h"
+#include "variables.h"
+#endif /* INFOKEY */
+
/* Return a new keymap which has all the uppercase letters mapped to run
the function info_do_lowercase_version (). */
Keymap
keymap_make_keymap ()
{
- register int i;
+ int i;
Keymap keymap;
keymap = (Keymap)xmalloc (256 * sizeof (KEYMAP_ENTRY));
@@ -37,13 +42,17 @@ keymap_make_keymap ()
for (i = 0; i < 256; i++)
{
keymap[i].type = ISFUNC;
- keymap[i].function = (VFunction *)NULL;
+ keymap[i].function = (InfoCommand *)NULL;
}
for (i = 'A'; i < ('Z' + 1); i++)
{
keymap[i].type = ISFUNC;
- keymap[i].function = info_do_lowercase_version;
+#if defined(INFOKEY)
+ keymap[Meta(i)].type = ISFUNC;
+ keymap[Meta(i)].function =
+#endif /* INFOKEY */
+ keymap[i].function = InfoCmd(info_do_lowercase_version);
}
return (keymap);
@@ -54,7 +63,7 @@ Keymap
keymap_copy_keymap (map)
Keymap map;
{
- register int i;
+ int i;
Keymap keymap;
keymap = keymap_make_keymap ();
@@ -72,7 +81,7 @@ void
keymap_discard_keymap (map)
Keymap (map);
{
- register int i;
+ int i;
if (!map)
return;
@@ -99,9 +108,9 @@ keymap_bind_keyseq (map, keyseq, keyentry)
const unsigned char *keyseq;
KEYMAP_ENTRY *keyentry;
{
- register Keymap m = map;
- register const unsigned char *s = keyseq;
- register int c;
+ Keymap m = map;
+ const unsigned char *s = keyseq;
+ int c;
if (s == NULL || *s == '\0') return 0;
@@ -110,14 +119,18 @@ keymap_bind_keyseq (map, keyseq, keyentry)
switch (m[c].type)
{
case ISFUNC:
- if (!(m[c].function == NULL ||
- (m != map && m[c].function == info_do_lowercase_version)))
+ if (!(m[c].function == NULL || (
+#if !defined(INFOKEY)
+ m != map &&
+#endif /* !INFOKEY */
+ m[c].function == InfoCmd(info_do_lowercase_version))
+ ))
return 0;
if (*s != '\0')
{
m[c].type = ISKMAP;
- m[c].function = (VFunction *)keymap_make_keymap ();
+ m[c].function = (InfoCommand *)keymap_make_keymap ();
}
break;
@@ -132,6 +145,20 @@ keymap_bind_keyseq (map, keyseq, keyentry)
}
else
{
+#if defined(INFOKEY)
+ FUNCTION_KEYSEQ *k;
+
+ for (k = keyentry->function->keys; k && k->map != map; k = k->next)
+ ;
+ if (!k)
+ {
+ FUNCTION_KEYSEQ *ks = (FUNCTION_KEYSEQ *)xmalloc (sizeof(FUNCTION_KEYSEQ));
+ ks->next = keyentry->function->keys;
+ ks->map = map;
+ ks->keyseq = xstrdup (keyseq);
+ keyentry->function->keys = ks;
+ }
+#endif /* INFOKEY */
m[c] = *keyentry;
}
}
@@ -144,6 +171,8 @@ keymap_bind_keyseq (map, keyseq, keyentry)
Keymap info_keymap = NULL;
Keymap echo_area_keymap = NULL;
+#if !defined(INFOKEY)
+
static void
initialize_emacs_like_keymaps ()
{
@@ -157,9 +186,9 @@ initialize_emacs_like_keymaps ()
}
info_keymap[ESC].type = ISKMAP;
- info_keymap[ESC].function = (VFunction *)keymap_make_keymap ();
+ info_keymap[ESC].function = (InfoCommand *)keymap_make_keymap ();
info_keymap[Control ('x')].type = ISKMAP;
- info_keymap[Control ('x')].function = (VFunction *)keymap_make_keymap ();
+ info_keymap[Control ('x')].function = (InfoCommand *)keymap_make_keymap ();
/* Bind the echo area insert routines. Let's make all characters
insertable by default, regardless of which character set we might
@@ -168,10 +197,10 @@ initialize_emacs_like_keymaps ()
echo_area_keymap[i].function = ea_insert;
echo_area_keymap[ESC].type = ISKMAP;
- echo_area_keymap[ESC].function = (VFunction *) keymap_make_keymap ();
+ echo_area_keymap[ESC].function = (InfoCommand *) keymap_make_keymap ();
echo_area_keymap[Control ('x')].type = ISKMAP;
echo_area_keymap[Control ('x')].function
- = (VFunction *) keymap_make_keymap ();
+ = (InfoCommand *) keymap_make_keymap ();
/* Bind numeric arg functions for both echo area and info window maps. */
for (i = '0'; i < '9' + 1; i++)
@@ -253,6 +282,9 @@ initialize_emacs_like_keymaps ()
keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
+ keymap_bind_keyseq (map, term_kh, &map[Control ('a')]); /* home */
+ keymap_bind_keyseq (map, term_ke, &map[Control ('e')]); /* end */
map = (Keymap)echo_area_keymap[ESC].function;
keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
@@ -261,6 +293,10 @@ initialize_emacs_like_keymaps ()
keymap_bind_keyseq (map, term_kr, &map['f']); /* right */
keymap_bind_keyseq (map, "\033OB", &map['f']);
keymap_bind_keyseq (map, "\033[B", &map['f']);
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
+
+ map = (Keymap)echo_area_keymap[Control ('x')].function;
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
/* Bind commands for Info window keymaps. */
map = info_keymap;
@@ -280,7 +316,7 @@ initialize_emacs_like_keymaps ()
map[Control ('r')].function = isearch_backward;
map[Control ('s')].function = isearch_forward;
map[Control ('u')].function = info_universal_argument;
- map[Control ('v')].function = info_scroll_forward;
+ map[Control ('v')].function = info_scroll_forward_page_only;
map[','].function = info_next_index_match;
map['/'].function = info_search;
@@ -327,7 +363,7 @@ initialize_emacs_like_keymaps ()
map['b'].function = info_backward_word;
map['f'].function = info_forward_word;
map['r'].function = info_move_to_window_line;
- map['v'].function = info_scroll_backward;
+ map['v'].function = info_scroll_backward_page_only;
#if defined (NAMED_FUNCTIONS)
map['x'].function = info_execute_command;
#endif /* NAMED_FUNCTIONS */
@@ -368,6 +404,9 @@ initialize_emacs_like_keymaps ()
keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
+ keymap_bind_keyseq (map, term_kh, &map['b']); /* home */
+ keymap_bind_keyseq (map, term_ke, &map['e']); /* end */
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
map = (Keymap)info_keymap[ESC].function;
keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
@@ -378,6 +417,7 @@ initialize_emacs_like_keymaps ()
keymap_bind_keyseq (map, "\033[B", &map['f']);
keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */
keymap_bind_keyseq (map, term_kP, &map[DEL]); /* pageup */
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
/* The alternative to this definition of a `main map' key in the
`ESC map' section, is something like:
@@ -389,7 +429,7 @@ initialize_emacs_like_keymaps ()
static void
initialize_vi_like_keymaps ()
{
- register int i;
+ int i;
Keymap map;
if (!info_keymap)
@@ -399,19 +439,19 @@ initialize_vi_like_keymaps ()
}
info_keymap[ESC].type = ISKMAP;
- info_keymap[ESC].function = (VFunction *)keymap_make_keymap ();
+ info_keymap[ESC].function = (InfoCommand *)keymap_make_keymap ();
info_keymap[Control ('x')].type = ISKMAP;
- info_keymap[Control ('x')].function = (VFunction *)keymap_make_keymap ();
+ info_keymap[Control ('x')].function = (InfoCommand *)keymap_make_keymap ();
/* Bind the echo area insert routines. */
for (i = 0; i < 256; i++)
echo_area_keymap[i].function = ea_insert;
echo_area_keymap[ESC].type = ISKMAP;
- echo_area_keymap[ESC].function = (VFunction *)keymap_make_keymap ();
+ echo_area_keymap[ESC].function = (InfoCommand *)keymap_make_keymap ();
echo_area_keymap[Control ('x')].type = ISKMAP;
echo_area_keymap[Control ('x')].function =
- (VFunction *)keymap_make_keymap ();
+ (InfoCommand *)keymap_make_keymap ();
/* Bind numeric arg functions for both echo area and info window maps. */
for (i = '0'; i < '9' + 1; i++)
@@ -497,6 +537,9 @@ initialize_vi_like_keymaps ()
keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
+ keymap_bind_keyseq (map, term_kh, &map[Control ('a')]); /* home */
+ keymap_bind_keyseq (map, term_ke, &map[Control ('e')]); /* end */
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
map = (Keymap)echo_area_keymap[ESC].function;
keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
@@ -505,6 +548,10 @@ initialize_vi_like_keymaps ()
keymap_bind_keyseq (map, term_kr, &map['f']); /* right */
keymap_bind_keyseq (map, "\033OB", &map['f']);
keymap_bind_keyseq (map, "\033[B", &map['f']);
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
+
+ map = (Keymap)echo_area_keymap[Control ('x')].function;
+ keymap_bind_keyseq (map, term_kD, &map[DEL]);
/* Bind commands for Info window keymaps. */
map = info_keymap;
@@ -513,10 +560,10 @@ initialize_vi_like_keymaps ()
map[RET].function = info_down_line;
map[SPC].function = info_scroll_forward;
map[Control ('a')].function = info_beginning_of_line;
- map[Control ('b')].function = info_scroll_backward;
+ map[Control ('b')].function = info_scroll_backward_page_only;
map[Control ('d')].function = info_scroll_half_screen_down;
map[Control ('e')].function = info_down_line;
- map[Control ('f')].function = info_scroll_forward;
+ map[Control ('f')].function = info_scroll_forward_page_only;
map[Control ('g')].function = info_abort_key;
map[Control ('k')].function = info_up_line;
map[Control ('l')].function = info_redraw_display;
@@ -525,7 +572,7 @@ initialize_vi_like_keymaps ()
map[Control ('r')].function = info_redraw_display;
map[Control ('s')].function = isearch_forward;
map[Control ('u')].function = info_scroll_half_screen_up;
- map[Control ('v')].function = info_scroll_forward;
+ map[Control ('v')].function = info_scroll_forward_page_only;
map[Control ('y')].function = info_up_line;
map[','].function = info_next_index_match;
map['/'].function = info_search;
@@ -545,8 +592,8 @@ initialize_vi_like_keymaps ()
map['d'].function = info_scroll_half_screen_down;
map['e'].function = info_down_line;
map['E'].function = info_view_file;
- map['f'].function = info_scroll_forward;
- map['F'].function = info_scroll_forward;
+ map['f'].function = info_scroll_forward_page_only;
+ map['F'].function = info_scroll_forward_page_only;
map['g'].function = info_first_node;
map['G'].function = info_last_node;
map['h'].function = info_get_help_window;
@@ -569,11 +616,12 @@ initialize_vi_like_keymaps ()
map['S'].function = info_search_case_sensitively;
map['t'].function = info_top_node;
map['u'].function = info_scroll_half_screen_up;
- map['w'].function = info_scroll_backward_set_window;
+ map['w'].function = info_scroll_backward_page_only_set_window;
map['y'].function = info_up_line;
- map['z'].function = info_scroll_forward_set_window;
+ map['z'].function = info_scroll_forward_page_only_set_window;
map['Z'].function = NULL; /* unbind, so it works to bind "ZZ" below */
map[DEL].function = info_scroll_backward;
+ keymap_bind_keyseq (map, term_kD, &map[DEL]);
keymap_bind_keyseq (map, ":q", &map['q']);
keymap_bind_keyseq (map, ":Q", &map['q']);
keymap_bind_keyseq (map, "ZZ", &map['q']);
@@ -583,7 +631,7 @@ initialize_vi_like_keymaps ()
map[Control ('f')].function = info_show_footnotes;
map[Control ('g')].function = info_abort_key;
map[TAB].function = info_move_to_prev_xref;
- map[SPC].function = info_scroll_forward;
+ map[SPC].function = info_scroll_forward_page_only;
map[Control ('v')].function = info_scroll_other_window;
map['<'].function = info_beginning_of_node;
map['>'].function = info_end_of_node;
@@ -601,7 +649,7 @@ initialize_vi_like_keymaps ()
map['r'].function = isearch_backward;
map['s'].function = isearch_forward;
map['t'].function = info_top_node;
- map['v'].function = info_scroll_backward;
+ map['v'].function = info_scroll_backward_page_only;
#if defined (NAMED_FUNCTIONS)
map['x'].function = info_execute_command;
#endif /* NAMED_FUNCTIONS */
@@ -652,6 +700,8 @@ initialize_vi_like_keymaps ()
keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
+ keymap_bind_keyseq (map, term_kh, &map['b']); /* home */
+ keymap_bind_keyseq (map, term_ke, &map['e']); /* end */
map = (Keymap)info_keymap[ESC].function;
keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
@@ -662,6 +712,7 @@ initialize_vi_like_keymaps ()
keymap_bind_keyseq (map, "\033[B", &map['f']);
keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */
keymap_bind_keyseq (map, term_kP, &map[DEL]); /* pageup */
+ keymap_bind_keyseq (map, term_kD, &map[DEL]); /* delete */
/* The alternative to this definition of a `main map' key in the
`ESC map' section, is something like:
@@ -679,3 +730,994 @@ initialize_info_keymaps ()
initialize_emacs_like_keymaps ();
}
+#else /* defined(INFOKEY) */
+
+/* Make sure that we don't have too many command codes defined. */
+
+#if A_NCOMMANDS > A_MAX_COMMAND + 1
+#error "too many commands defined"
+#endif
+
+/* Initialize the keymaps from the .info keymap file. */
+
+#define NUL '\0'
+
+static unsigned char default_emacs_like_info_keys[] =
+{
+ 0, /* suppress-default-keybindings flag */
+ TAB, NUL, A_info_move_to_next_xref,
+ LFD, NUL, A_info_select_reference_this_line,
+ RET, NUL, A_info_select_reference_this_line,
+ SPC, NUL, A_info_scroll_forward,
+ CONTROL('a'), NUL, A_info_beginning_of_line,
+ CONTROL('b'), NUL, A_info_backward_char,
+ CONTROL('e'), NUL, A_info_end_of_line,
+ CONTROL('f'), NUL, A_info_forward_char,
+ CONTROL('g'), NUL, A_info_abort_key,
+ CONTROL('h'), NUL, A_info_get_help_window,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('n'), NUL, A_info_next_line,
+ CONTROL('p'), NUL, A_info_prev_line,
+ CONTROL('r'), NUL, A_isearch_backward,
+ CONTROL('s'), NUL, A_isearch_forward,
+ CONTROL('u'), NUL, A_info_universal_argument,
+ CONTROL('v'), NUL, A_info_scroll_forward_page_only,
+ ',', NUL, A_info_next_index_match,
+ '/', NUL, A_info_search,
+ '0', NUL, A_info_last_menu_item,
+ '1', NUL, A_info_menu_digit,
+ '2', NUL, A_info_menu_digit,
+ '3', NUL, A_info_menu_digit,
+ '4', NUL, A_info_menu_digit,
+ '5', NUL, A_info_menu_digit,
+ '6', NUL, A_info_menu_digit,
+ '7', NUL, A_info_menu_digit,
+ '8', NUL, A_info_menu_digit,
+ '9', NUL, A_info_menu_digit,
+ '<', NUL, A_info_first_node,
+ '>', NUL, A_info_last_node,
+ '?', NUL, A_info_get_help_window,
+ '[', NUL, A_info_global_prev_node,
+ ']', NUL, A_info_global_next_node,
+ 'b', NUL, A_info_beginning_of_node,
+ 'd', NUL, A_info_dir_node,
+ 'e', NUL, A_info_end_of_node,
+ 'f', NUL, A_info_xref_item,
+ 'g', NUL, A_info_goto_node,
+ 'G', NUL, A_info_menu_sequence,
+ 'h', NUL, A_info_get_info_help_node,
+ 'i', NUL, A_info_index_search,
+ 'l', NUL, A_info_history_node,
+ 'm', NUL, A_info_menu_item,
+ 'n', NUL, A_info_next_node,
+ 'O', NUL, A_info_goto_invocation_node,
+ 'p', NUL, A_info_prev_node,
+ 'q', NUL, A_info_quit,
+ 'r', NUL, A_info_xref_item,
+ 's', NUL, A_info_search,
+ 'S', NUL, A_info_search_case_sensitively,
+ 't', NUL, A_info_top_node,
+ 'u', NUL, A_info_up_node,
+ DEL, NUL, A_info_scroll_backward,
+ ESC, '0', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, CONTROL('f'), NUL, A_info_show_footnotes,
+ ESC, CONTROL('g'), NUL, A_info_abort_key,
+ ESC, TAB, NUL, A_info_move_to_prev_xref,
+ ESC, CONTROL('v'), NUL, A_info_scroll_other_window,
+ ESC, '<', NUL, A_info_beginning_of_node,
+ ESC, '>', NUL, A_info_end_of_node,
+ ESC, 'b', NUL, A_info_backward_word,
+ ESC, 'f', NUL, A_info_forward_word,
+ ESC, 'r', NUL, A_info_move_to_window_line,
+ ESC, 'v', NUL, A_info_scroll_backward_page_only,
+ Meta('0'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta(CONTROL('f')), NUL, A_info_show_footnotes,
+ Meta(CONTROL('g')), NUL, A_info_abort_key,
+ Meta(TAB), NUL, A_info_move_to_prev_xref,
+ Meta(CONTROL('v')), NUL, A_info_scroll_other_window,
+ Meta('<'), NUL, A_info_beginning_of_node,
+ Meta('>'), NUL, A_info_end_of_node,
+ Meta('b'), NUL, A_info_backward_word,
+ Meta('f'), NUL, A_info_forward_word,
+ Meta('r'), NUL, A_info_move_to_window_line,
+ Meta('v'), NUL, A_info_scroll_backward_page_only,
+#if defined (NAMED_FUNCTIONS)
+ ESC, 'x', NUL, A_info_execute_command,
+ Meta('x'), NUL, A_info_execute_command,
+#endif /* NAMED_FUNCTIONS */
+
+ CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes,
+ CONTROL('x'), CONTROL('c'), NUL, A_info_quit,
+ CONTROL('x'), CONTROL('f'), NUL, A_info_view_file,
+ CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key,
+ CONTROL('x'), CONTROL('v'), NUL, A_info_view_file,
+ CONTROL('x'), '0', NUL, A_info_delete_window,
+ CONTROL('x'), '1', NUL, A_info_keep_one_window,
+ CONTROL('x'), '2', NUL, A_info_split_window,
+ CONTROL('x'), '^', NUL, A_info_grow_window,
+ CONTROL('x'), 'b', NUL, A_select_visited_node,
+ CONTROL('x'), 'k', NUL, A_info_kill_node,
+ CONTROL('x'), 'n', NUL, A_info_search_next,
+ CONTROL('x'), 'N', NUL, A_info_search_previous,
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), 't', NUL, A_info_tile_windows,
+ CONTROL('x'), 'w', NUL, A_info_toggle_wrap,
+
+/* Arrow key bindings for info keymaps. It seems that some
+ terminals do not match their termcap entries, so it's best to just
+ define everything with both of the usual prefixes. */
+
+ SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward_page_only,
+ SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward_page_only,
+ SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line,
+ '\033', 'O', 'A', NUL, A_info_prev_line,
+ '\033', '[', 'A', NUL, A_info_prev_line,
+ SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line,
+ '\033', 'O', 'B', NUL, A_info_next_line,
+ '\033', '[', 'B', NUL, A_info_next_line,
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_char,
+ '\033', 'O', 'C', NUL, A_info_forward_char,
+ '\033', '[', 'C', NUL, A_info_forward_char,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_char,
+ '\033', 'O', 'D', NUL, A_info_backward_char,
+ '\033', '[', 'D', NUL, A_info_backward_char,
+ SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node,
+ SK_ESCAPE, SK_END, NUL, A_info_end_of_node,
+ SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_backward,
+
+ ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward,
+ ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window,
+ ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line,
+ ESC, '\033', 'O', 'A', NUL, A_info_prev_line,
+ ESC, '\033', '[', 'A', NUL, A_info_prev_line,
+ ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line,
+ ESC, '\033', 'O', 'B', NUL, A_info_next_line,
+ ESC, '\033', '[', 'B', NUL, A_info_next_line,
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_word,
+ ESC, '\033', 'O', 'C', NUL, A_info_forward_word,
+ ESC, '\033', '[', 'C', NUL, A_info_forward_word,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_word,
+ ESC, '\033', 'O', 'D', NUL, A_info_backward_word,
+ ESC, '\033', '[', 'D', NUL, A_info_backward_word,
+};
+
+static unsigned char default_emacs_like_ea_keys[] =
+{
+ 0, /* suppress-default-keybindings flag */
+ ESC, '0', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
+ Meta('0'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
+ ESC, CONTROL('g'), NUL, A_ea_abort,
+ ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window,
+ ESC, 'b', NUL, A_ea_backward_word,
+ ESC, 'd', NUL, A_ea_kill_word,
+ ESC, 'f', NUL, A_ea_forward_word,
+ ESC, 'y', NUL, A_ea_yank_pop,
+ ESC, '?', NUL, A_ea_possible_completions,
+ ESC, TAB, NUL, A_ea_tab_insert,
+ ESC, DEL, NUL, A_ea_backward_kill_word,
+ Meta(CONTROL('g')), NUL, A_ea_abort,
+ Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window,
+ Meta('b'), NUL, A_ea_backward_word,
+ Meta('d'), NUL, A_ea_kill_word,
+ Meta('f'), NUL, A_ea_forward_word,
+ Meta('y'), NUL, A_ea_yank_pop,
+ Meta('?'), NUL, A_ea_possible_completions,
+ Meta(TAB), NUL, A_ea_tab_insert,
+ Meta(DEL), NUL, A_ea_backward_kill_word,
+ CONTROL('a'), NUL, A_ea_beg_of_line,
+ CONTROL('b'), NUL, A_ea_backward,
+ CONTROL('d'), NUL, A_ea_delete,
+ CONTROL('e'), NUL, A_ea_end_of_line,
+ CONTROL('f'), NUL, A_ea_forward,
+ CONTROL('g'), NUL, A_ea_abort,
+ CONTROL('h'), NUL, A_ea_rubout,
+/* CONTROL('k') */
+ SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('q'), NUL, A_ea_quoted_insert,
+ CONTROL('t'), NUL, A_ea_transpose_chars,
+ CONTROL('u'), NUL, A_info_universal_argument,
+ CONTROL('y'), NUL, A_ea_yank,
+ LFD, NUL, A_ea_newline,
+ RET, NUL, A_ea_newline,
+ SPC, NUL, A_ea_complete,
+ TAB, NUL, A_ea_complete,
+ '?', NUL, A_ea_possible_completions,
+#ifdef __MSDOS__
+ /* PC users will lynch me if I don't give them their usual DEL
+ effect... */
+ DEL, NUL, A_ea_delete,
+#else
+ DEL, NUL, A_ea_rubout,
+#endif
+#if defined (NAMED_FUNCTIONS)
+ /* ESC, 'x', NUL, A_info_execute_command, */
+ /* Meta('x'), NUL, A_info_execute_command, */
+#endif /* NAMED_FUNCTIONS */
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), DEL, NUL, A_ea_backward_kill_line,
+
+/* Arrow key bindings for echo area keymaps. It seems that some
+ terminals do not match their termcap entries, so it's best to just
+ define everything with both of the usual prefixes. */
+
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward,
+ '\033', 'O', 'C', NUL, A_ea_forward,
+ '\033', '[', 'C', NUL, A_ea_forward,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward,
+ '\033', 'O', 'D', NUL, A_ea_backward,
+ '\033', '[', 'D', NUL, A_ea_backward,
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word,
+ ESC, '\033', 'O', 'C', NUL, A_ea_forward_word,
+ ESC, '\033', '[', 'C', NUL, A_ea_forward_word,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word,
+ ESC, '\033', 'O', 'D', NUL, A_ea_backward_word,
+ ESC, '\033', '[', 'D', NUL, A_ea_backward_word,
+#ifdef __MSDOS__
+ SK_ESCAPE, SK_DELETE, NUL, A_ea_delete,
+#else
+ SK_ESCAPE, SK_DELETE, NUL, A_ea_rubout,
+#endif
+ SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line,
+ SK_ESCAPE, SK_END, NUL, A_ea_end_of_line,
+ ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_backward_kill_word,
+ CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
+};
+
+static unsigned char default_vi_like_info_keys[] =
+{
+ 0, /* suppress-default-keybindings flag */
+ '0', NUL, A_info_add_digit_to_numeric_arg,
+ '1', NUL, A_info_add_digit_to_numeric_arg,
+ '2', NUL, A_info_add_digit_to_numeric_arg,
+ '3', NUL, A_info_add_digit_to_numeric_arg,
+ '4', NUL, A_info_add_digit_to_numeric_arg,
+ '5', NUL, A_info_add_digit_to_numeric_arg,
+ '6', NUL, A_info_add_digit_to_numeric_arg,
+ '7', NUL, A_info_add_digit_to_numeric_arg,
+ '8', NUL, A_info_add_digit_to_numeric_arg,
+ '9', NUL, A_info_add_digit_to_numeric_arg,
+ '-', NUL, A_info_add_digit_to_numeric_arg,
+ TAB, NUL, A_info_move_to_next_xref,
+ LFD, NUL, A_info_down_line,
+ RET, NUL, A_info_down_line,
+ SPC, NUL, A_info_scroll_forward,
+ CONTROL('a'), NUL, A_info_beginning_of_line,
+ CONTROL('b'), NUL, A_info_scroll_backward_page_only,
+ CONTROL('d'), NUL, A_info_scroll_half_screen_down,
+ CONTROL('e'), NUL, A_info_down_line,
+ CONTROL('f'), NUL, A_info_scroll_forward_page_only,
+ CONTROL('g'), NUL, A_info_abort_key,
+ CONTROL('k'), NUL, A_info_up_line,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('n'), NUL, A_info_down_line,
+ CONTROL('p'), NUL, A_info_up_line,
+ CONTROL('r'), NUL, A_info_redraw_display,
+ CONTROL('s'), NUL, A_isearch_forward,
+ CONTROL('u'), NUL, A_info_scroll_half_screen_up,
+ CONTROL('v'), NUL, A_info_scroll_forward_page_only,
+ CONTROL('y'), NUL, A_info_up_line,
+ ',', NUL, A_info_next_index_match,
+ '/', NUL, A_info_search,
+ ESC, '0', NUL, A_info_last_menu_item,
+ ESC, '1', NUL, A_info_menu_digit,
+ ESC, '2', NUL, A_info_menu_digit,
+ ESC, '3', NUL, A_info_menu_digit,
+ ESC, '4', NUL, A_info_menu_digit,
+ ESC, '5', NUL, A_info_menu_digit,
+ ESC, '6', NUL, A_info_menu_digit,
+ ESC, '7', NUL, A_info_menu_digit,
+ ESC, '8', NUL, A_info_menu_digit,
+ ESC, '9', NUL, A_info_menu_digit,
+ Meta('0'), NUL, A_info_last_menu_item,
+ Meta('1'), NUL, A_info_menu_digit,
+ Meta('2'), NUL, A_info_menu_digit,
+ Meta('3'), NUL, A_info_menu_digit,
+ Meta('4'), NUL, A_info_menu_digit,
+ Meta('5'), NUL, A_info_menu_digit,
+ Meta('6'), NUL, A_info_menu_digit,
+ Meta('7'), NUL, A_info_menu_digit,
+ Meta('8'), NUL, A_info_menu_digit,
+ Meta('9'), NUL, A_info_menu_digit,
+ '<', NUL, A_info_first_node,
+ '>', NUL, A_info_last_node,
+ '?', NUL, A_info_search_backward,
+ '[', NUL, A_info_global_prev_node,
+ ']', NUL, A_info_global_next_node,
+ '\'', NUL, A_info_history_node,
+ 'b', NUL, A_info_scroll_backward,
+ 'd', NUL, A_info_scroll_half_screen_down,
+ 'e', NUL, A_info_down_line,
+ 'E', NUL, A_info_view_file,
+ ':', 'e', NUL, A_info_view_file,
+ 'f', NUL, A_info_scroll_forward_page_only,
+ 'F', NUL, A_info_scroll_forward_page_only,
+ 'g', NUL, A_info_first_node,
+ 'G', NUL, A_info_last_node,
+ 'h', NUL, A_info_get_help_window,
+ 'H', NUL, A_info_get_help_window,
+ 'i', NUL, A_info_index_search,
+ 'I', NUL, A_info_goto_invocation_node,
+ 'j', NUL, A_info_down_line,
+ 'k', NUL, A_info_up_line,
+ 'l', NUL, A_info_history_node,
+ 'm', NUL, A_info_menu_item,
+ 'n', NUL, A_info_search_next,
+ 'N', NUL, A_info_search_previous,
+ 'O', NUL, A_info_goto_invocation_node,
+ 'p', NUL, A_info_prev_node,
+ 'q', NUL, A_info_quit,
+ 'Q', NUL, A_info_quit,
+ ':', 'q', NUL, A_info_quit,
+ ':', 'Q', NUL, A_info_quit,
+ 'Z', 'Z', NUL, A_info_quit,
+ 'r', NUL, A_info_redraw_display,
+ 'R', NUL, A_info_redraw_display,
+ 's', NUL, A_info_search,
+ 'S', NUL, A_info_search_case_sensitively,
+ 't', NUL, A_info_top_node,
+ 'u', NUL, A_info_scroll_half_screen_up,
+ 'w', NUL, A_info_scroll_backward_page_only_set_window,
+ 'y', NUL, A_info_up_line,
+ 'z', NUL, A_info_scroll_forward_page_only_set_window,
+ DEL, NUL, A_info_scroll_backward,
+ ESC, CONTROL('f'), NUL, A_info_show_footnotes,
+ ESC, CONTROL('g'), NUL, A_info_abort_key,
+ ESC, TAB, NUL, A_info_move_to_prev_xref,
+ ESC, SPC, NUL, A_info_scroll_forward_page_only,
+ ESC, CONTROL('v'), NUL, A_info_scroll_other_window,
+ ESC, '<', NUL, A_info_beginning_of_node,
+ ESC, '>', NUL, A_info_end_of_node,
+ ESC, '/', NUL, A_info_search,
+ ESC, '?', NUL, A_info_search_backward,
+ ESC, 'b', NUL, A_info_beginning_of_node,
+ ESC, 'd', NUL, A_info_dir_node,
+ ESC, 'e', NUL, A_info_end_of_node,
+ ESC, 'f', NUL, A_info_xref_item,
+ ESC, 'g', NUL, A_info_select_reference_this_line,
+ ESC, 'h', NUL, A_info_get_info_help_node,
+ ESC, 'm', NUL, A_info_menu_item,
+ ESC, 'n', NUL, A_info_search,
+ ESC, 'N', NUL, A_info_search_backward,
+ ESC, 'r', NUL, A_isearch_backward,
+ ESC, 's', NUL, A_isearch_forward,
+ ESC, 't', NUL, A_info_top_node,
+ ESC, 'v', NUL, A_info_scroll_backward_page_only,
+#if defined (NAMED_FUNCTIONS)
+ ESC, 'x', NUL, A_info_execute_command,
+ Meta('x'), NUL, A_info_execute_command,
+#endif /* NAMED_FUNCTIONS */
+ ESC, DEL, NUL, A_info_scroll_other_window_backward,
+ CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes,
+ CONTROL('x'), CONTROL('c'), NUL, A_info_quit,
+ CONTROL('x'), CONTROL('f'), NUL, A_info_view_file,
+ CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key,
+ CONTROL('x'), CONTROL('v'), NUL, A_info_view_file,
+ CONTROL('x'), LFD, NUL, A_info_select_reference_this_line,
+ CONTROL('x'), RET, NUL, A_info_select_reference_this_line,
+ CONTROL('x'), '0', NUL, A_info_delete_window,
+ CONTROL('x'), '1', NUL, A_info_keep_one_window,
+ CONTROL('x'), '2', NUL, A_info_split_window,
+ CONTROL('x'), '^', NUL, A_info_grow_window,
+ CONTROL('x'), 'b', NUL, A_select_visited_node,
+ CONTROL('x'), 'g', NUL, A_info_goto_node,
+ CONTROL('x'), 'i', NUL, A_info_index_search,
+ CONTROL('x'), 'I', NUL, A_info_goto_invocation_node,
+ CONTROL('x'), 'k', NUL, A_info_kill_node,
+ CONTROL('x'), 'n', NUL, A_info_next_node,
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), 'O', NUL, A_info_goto_invocation_node,
+ CONTROL('x'), 'p', NUL, A_info_prev_node,
+ CONTROL('x'), 'r', NUL, A_info_xref_item,
+ CONTROL('x'), 't', NUL, A_info_tile_windows,
+ CONTROL('x'), 'u', NUL, A_info_up_node,
+ CONTROL('x'), 'w', NUL, A_info_toggle_wrap,
+ CONTROL('x'), ',', NUL, A_info_next_index_match,
+
+/* Arrow key bindings for info keymaps. It seems that some
+ terminals do not match their termcap entries, so it's best to just
+ define everything with both of the usual prefixes. */
+
+ SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward_page_only,
+ SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward_page_only,
+ SK_ESCAPE, SK_UP_ARROW, NUL, A_info_up_line,
+ '\033', 'O', 'A', NUL, A_info_up_line,
+ '\033', '[', 'A', NUL, A_info_up_line,
+ SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_down_line,
+ '\033', 'O', 'B', NUL, A_info_down_line,
+ '\033', '[', 'B', NUL, A_info_down_line,
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_scroll_forward_page_only,
+ '\033', 'O', 'C', NUL, A_info_scroll_forward_page_only,
+ '\033', '[', 'C', NUL, A_info_scroll_forward_page_only,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_scroll_backward_page_only,
+ '\033', 'O', 'D', NUL, A_info_scroll_backward_page_only,
+ '\033', '[', 'D', NUL, A_info_scroll_backward_page_only,
+ SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node,
+ SK_ESCAPE, SK_END, NUL, A_info_end_of_node,
+ ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window,
+ ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward,
+ ESC, SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_other_window_backward,
+ ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_node,
+ ESC, '\033', 'O', 'A', NUL, A_info_prev_node,
+ ESC, '\033', '[', 'A', NUL, A_info_prev_node,
+ ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_node,
+ ESC, '\033', 'O', 'B', NUL, A_info_next_node,
+ ESC, '\033', '[', 'B', NUL, A_info_next_node,
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_xref_item,
+ ESC, '\033', 'O', 'C', NUL, A_info_xref_item,
+ ESC, '\033', '[', 'C', NUL, A_info_xref_item,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_beginning_of_node,
+ ESC, '\033', 'O', 'D', NUL, A_info_beginning_of_node,
+ ESC, '\033', '[', 'D', NUL, A_info_beginning_of_node,
+ CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
+};
+
+static unsigned char default_vi_like_ea_keys[] =
+{
+ 0, /* suppress-default-keybindings flag */
+ ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
+ Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
+ ESC, CONTROL('g'), NUL, A_ea_abort,
+ ESC, CONTROL('h'), NUL, A_ea_backward_kill_word,
+ ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window,
+ ESC, '0', NUL, A_ea_beg_of_line,
+ ESC, '$', NUL, A_ea_end_of_line,
+ ESC, 'b', NUL, A_ea_backward_word,
+ ESC, 'd', NUL, A_ea_kill_word,
+ ESC, 'f', NUL, A_ea_forward_word,
+ ESC, 'h', NUL, A_ea_forward,
+ ESC, 'l', NUL, A_ea_backward,
+ ESC, 'w', NUL, A_ea_forward_word,
+ ESC, 'x', NUL, A_ea_delete,
+ ESC, 'X', NUL, A_ea_kill_word,
+ ESC, 'y', NUL, A_ea_yank_pop,
+ ESC, '?', NUL, A_ea_possible_completions,
+ ESC, TAB, NUL, A_ea_tab_insert,
+ ESC, DEL, NUL, A_ea_kill_word,
+ Meta(CONTROL('g')), NUL, A_ea_abort,
+ Meta(CONTROL('h')), NUL, A_ea_backward_kill_word,
+ Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window,
+ Meta('0'), NUL, A_ea_beg_of_line,
+ Meta('$'), NUL, A_ea_end_of_line,
+ Meta('b'), NUL, A_ea_backward_word,
+ Meta('d'), NUL, A_ea_kill_word,
+ Meta('f'), NUL, A_ea_forward_word,
+ Meta('h'), NUL, A_ea_forward,
+ Meta('l'), NUL, A_ea_backward,
+ Meta('w'), NUL, A_ea_forward_word,
+ Meta('x'), NUL, A_ea_delete,
+ Meta('X'), NUL, A_ea_kill_word,
+ Meta('y'), NUL, A_ea_yank_pop,
+ Meta('?'), NUL, A_ea_possible_completions,
+ Meta(TAB), NUL, A_ea_tab_insert,
+ Meta(DEL), NUL, A_ea_kill_word,
+ CONTROL('a'), NUL, A_ea_beg_of_line,
+ CONTROL('b'), NUL, A_ea_backward,
+ CONTROL('d'), NUL, A_ea_delete,
+ CONTROL('e'), NUL, A_ea_end_of_line,
+ CONTROL('f'), NUL, A_ea_forward,
+ CONTROL('g'), NUL, A_ea_abort,
+ CONTROL('h'), NUL, A_ea_rubout,
+/* CONTROL('k') */
+ SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('q'), NUL, A_ea_quoted_insert,
+ CONTROL('t'), NUL, A_ea_transpose_chars,
+ CONTROL('u'), NUL, A_ea_abort,
+ CONTROL('v'), NUL, A_ea_quoted_insert,
+ CONTROL('y'), NUL, A_ea_yank,
+ LFD, NUL, A_ea_newline,
+ RET, NUL, A_ea_newline,
+ SPC, NUL, A_ea_complete,
+ TAB, NUL, A_ea_complete,
+ '?', NUL, A_ea_possible_completions,
+#ifdef __MSDOS__
+ /* PC users will lynch me if I don't give them their usual DEL
+ effect... */
+ DEL, NUL, A_ea_delete,
+#else
+ DEL, NUL, A_ea_rubout,
+#endif
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), DEL, NUL, A_ea_backward_kill_line,
+
+ /* Arrow key bindings for echo area keymaps. It seems that some
+ terminals do not match their termcap entries, so it's best to just
+ define everything with both of the usual prefixes. */
+
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward,
+ '\033', 'O', 'C', NUL, A_ea_forward,
+ '\033', '[', 'C', NUL, A_ea_forward,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward,
+ '\033', 'O', 'D', NUL, A_ea_backward,
+ '\033', '[', 'D', NUL, A_ea_backward,
+ SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line,
+ SK_ESCAPE, SK_END, NUL, A_ea_end_of_line,
+#ifdef __MSDOS__
+ SK_ESCAPE, SK_DELETE, NUL, A_ea_delete,
+#else
+ SK_DELETE, SK_DELETE, NUL, A_ea_rubout,
+#endif
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word,
+ ESC, '\033', 'O', 'C', NUL, A_ea_forward_word,
+ ESC, '\033', '[', 'C', NUL, A_ea_forward_word,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word,
+ ESC, '\033', 'O', 'D', NUL, A_ea_backward_word,
+ ESC, '\033', '[', 'D', NUL, A_ea_backward_word,
+ ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_kill_word,
+ CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
+};
+
+static unsigned char *user_info_keys;
+static unsigned int user_info_keys_len;
+static unsigned char *user_ea_keys;
+static unsigned int user_ea_keys_len;
+static unsigned char *user_vars;
+static unsigned int user_vars_len;
+
+/*
+ * Return the size of a file, or 0 if the size can't be determined.
+ */
+static unsigned long
+filesize(f)
+ int f;
+{
+ long pos = lseek(f, 0L, SEEK_CUR);
+ long sz = -1L;
+ if (pos != -1L)
+ {
+ sz = lseek(f, 0L, SEEK_END);
+ lseek(f, pos, SEEK_SET);
+ }
+ return sz == -1L ? 0L : sz;
+}
+
+/* Get an integer from a infokey file.
+ Integers are stored as two bytes, low order first, in radix INFOKEY_RADIX.
+ */
+static int
+getint(sp)
+ unsigned char **sp;
+{
+ int n;
+
+ if ( !((*sp)[0] < INFOKEY_RADIX && (*sp)[1] < INFOKEY_RADIX) )
+ return -1;
+ n = (*sp)[0] + (*sp)[1] * INFOKEY_RADIX;
+ *sp += 2;
+ return n;
+}
+
+
+/* Fetch the contents of the standard infokey file "$HOME/.info". Return
+ true if ok, false if not. */
+static int
+fetch_user_maps()
+{
+ char *filename = NULL;
+ char *homedir;
+ int f;
+ unsigned char *buf;
+ unsigned long len;
+ long nread;
+ unsigned char *p;
+ int n;
+
+ /* Find and open file. */
+ if ((filename = getenv("INFOKEY")) != NULL)
+ filename = xstrdup(filename);
+ else if ((homedir = getenv("HOME")) != NULL)
+ {
+ filename = xmalloc(strlen(homedir) + 2 + strlen(INFOKEY_FILE));
+ strcpy(filename, homedir);
+ strcat(filename, "/");
+ strcat(filename, INFOKEY_FILE);
+ }
+#ifdef __MSDOS__
+ /* Poor baby, she doesn't have a HOME... */
+ else
+ filename = xstrdup(INFOKEY_FILE); /* try current directory */
+#endif
+ if (filename == NULL || (f = open(filename, O_RDONLY)) == (-1))
+ {
+ if (filename)
+ {
+ info_error(filesys_error_string(filename, errno));
+ free(filename);
+ }
+ return 0;
+ }
+ SET_BINARY (f);
+
+ /* Ensure that the file is a reasonable size. */
+ len = filesize(f);
+ if (len < INFOKEY_NMAGIC + 2 || len > 100 * 1024)
+ {
+ /* Bad file (a valid file must have at least 9 chars, and
+ more than 100 KB is a problem). */
+ if (len < INFOKEY_NMAGIC + 2)
+ info_error(_("Ignoring invalid infokey file `%s' - too small"),
+ filename);
+ else
+ info_error(_("Ignoring invalid infokey file `%s' - too big"),
+ filename);
+ close(f);
+ free(filename);
+ return 0;
+ }
+
+ /* Read the file into a buffer. */
+ buf = (unsigned char *)xmalloc((int)len);
+ nread = read(f, buf, (unsigned int) len);
+ close(f);
+ if (nread != len)
+ {
+ info_error(_("Error reading infokey file `%s' - short read"), filename);
+ free(buf);
+ free(filename);
+ return 0;
+ }
+
+ /* Check the header, trailer, and version of the file to increase
+ our confidence that the contents are valid. */
+ if ( buf[0] != INFOKEY_MAGIC_S0
+ || buf[1] != INFOKEY_MAGIC_S1
+ || buf[2] != INFOKEY_MAGIC_S2
+ || buf[3] != INFOKEY_MAGIC_S3
+ || buf[len - 4] != INFOKEY_MAGIC_E0
+ || buf[len - 3] != INFOKEY_MAGIC_E1
+ || buf[len - 2] != INFOKEY_MAGIC_E2
+ || buf[len - 1] != INFOKEY_MAGIC_E3
+ )
+ {
+ info_error(_("Invalid infokey file `%s' (bad magic numbers) -- run infokey to update it"), filename);
+ free(filename);
+ return 0;
+ }
+ if (len < INFOKEY_NMAGIC + strlen(VERSION) + 1 || strcmp(VERSION, buf + 4) != 0)
+ {
+ info_error(_("Your infokey file `%s' is out of date -- run infokey to update it"), filename);
+ free(filename);
+ return 0;
+ }
+
+ /* Extract the pieces. */
+ for (p = buf + 4 + strlen(VERSION) + 1; p - buf < len - 4; p += n)
+ {
+ int s = *p++;
+
+ n = getint(&p);
+ if (n < 0 || n > len - 4 - (p - buf))
+ {
+ info_error(_("Invalid infokey file `%s' (bad section length) -- run infokey to update it"), filename);
+ free(filename);
+ return 0;
+ }
+
+ switch (s)
+ {
+ case INFOKEY_SECTION_INFO:
+ user_info_keys = p;
+ user_info_keys_len = n;
+ break;
+ case INFOKEY_SECTION_EA:
+ user_ea_keys = p;
+ user_ea_keys_len = n;
+ break;
+ case INFOKEY_SECTION_VAR:
+ user_vars = p;
+ user_vars_len = n;
+ break;
+ default:
+ info_error(_("Invalid infokey file `%s' (bad section code) -- run infokey to update it"), filename);
+ free(filename);
+ return 0;
+ }
+ }
+
+ free(filename);
+ return 1;
+}
+
+/* Decode special key sequences from the infokey file. Return zero
+ if the key sequence includes special keys which the terminal
+ doesn't define.
+ */
+static int
+decode_keys(src, slen, dst, dlen)
+ unsigned char *src;
+ unsigned int slen;
+ unsigned char *dst;
+ unsigned int dlen;
+{
+ unsigned char *s = src;
+ unsigned char *d = dst;
+
+#define To_dst(c) do { if (d - dst < dlen) *d++ = (c); } while (0)
+
+ while (s - src < slen)
+ {
+ unsigned char c = ISMETA(*s) ? UNMETA(*s) : *s;
+
+ if (c == SK_ESCAPE)
+ {
+ unsigned char *t;
+ static char lit[] = { SK_ESCAPE, NUL };
+
+ switch (s + 1 - src < slen ? s[1] : '\0')
+ {
+ case SK_RIGHT_ARROW: t = term_kr; break;
+ case SK_LEFT_ARROW: t = term_kl; break;
+ case SK_UP_ARROW: t = term_ku; break;
+ case SK_DOWN_ARROW: t = term_kd; break;
+ case SK_PAGE_UP: t = term_kP; break;
+ case SK_PAGE_DOWN: t = term_kN; break;
+ case SK_HOME: t = term_kh; break;
+ case SK_END: t = term_ke; break;
+ case SK_DELETE: t = term_kx; break;
+ case SK_INSERT: t = term_ki; break;
+ case SK_LITERAL:
+ default: t = lit; break;
+ }
+ if (t == NULL)
+ return 0;
+ while (*t)
+ To_dst(ISMETA(*s) ? Meta(*t++) : *t++);
+ s += 2;
+ }
+ else
+ {
+ if (ISMETA(*s))
+ To_dst(Meta(*s++));
+ else
+ To_dst(*s++);
+ }
+ }
+
+ To_dst('\0');
+
+ return 1;
+
+#undef To_dst
+
+}
+
+/* Convert an infokey file section to keymap bindings. Return false if
+ the default bindings are to be suppressed. */
+static int
+section_to_keymaps(map, table, len)
+ Keymap map;
+ unsigned char *table;
+ unsigned int len;
+{
+ int stop;
+ unsigned char *p;
+ unsigned char *seq;
+ unsigned int seqlen;
+ KEYMAP_ENTRY ke;
+ enum { getseq, gotseq, getaction } state = getseq;
+
+ stop = len > 0 ? table[0] : 0;
+
+ for (p = table + 1; p - table < len; p++)
+ {
+ switch (state)
+ {
+ case getseq:
+ if (*p)
+ {
+ seq = p;
+ state = gotseq;
+ }
+ break;
+
+ case gotseq:
+ if (!*p)
+ {
+ seqlen = p - seq;
+ state = getaction;
+ }
+ break;
+
+ case getaction:
+ {
+ unsigned int action = *p;
+ unsigned char keyseq[256];
+ KEYMAP_ENTRY ke;
+
+ state = getseq;
+ /* If decode_keys returns zero, it
+ means that seq includes keys which
+ the terminal doesn't support, like
+ PageDown. In that case, don't bind
+ the key sequence. */
+ if (decode_keys(seq, seqlen, keyseq,
+ sizeof keyseq))
+ {
+ keyseq[sizeof keyseq - 1] = '\0';
+ ke.type = ISFUNC;
+ ke.function =
+ action < A_NCOMMANDS
+ ? &function_doc_array[action]
+ : NULL;
+ keymap_bind_keyseq(map, keyseq, &ke);
+ }
+ }
+ break;
+ }
+ }
+ if (state != getseq)
+ info_error(_("Bad data in infokey file -- some key bindings ignored"));
+ return !stop;
+}
+
+/* Convert an infokey file section to variable settings.
+ */
+static void
+section_to_vars(table, len)
+ unsigned char *table;
+ unsigned int len;
+{
+ enum { getvar, gotvar, getval, gotval } state = getvar;
+ unsigned char *var = NULL;
+ unsigned char *val = NULL;
+ unsigned char *p;
+
+ for (p = table; p - table < len; p++)
+ {
+ switch (state)
+ {
+ case getvar:
+ if (*p)
+ {
+ var = p;
+ state = gotvar;
+ }
+ break;
+
+ case gotvar:
+ if (!*p)
+ state = getval;
+ break;
+
+ case getval:
+ if (*p)
+ {
+ val = p;
+ state = gotval;
+ }
+ break;
+
+ case gotval:
+ if (!*p)
+ {
+ set_variable_to_value(var, val);
+ state = getvar;
+ }
+ break;
+ }
+ }
+ if (state != getvar)
+ info_error(_("Bad data in infokey file -- some var settings ignored"));
+}
+
+void
+initialize_info_keymaps ()
+{
+ int i;
+ int suppress_info_default_bindings = 0;
+ int suppress_ea_default_bindings = 0;
+ Keymap map;
+
+ if (!info_keymap)
+ {
+ info_keymap = keymap_make_keymap ();
+ echo_area_keymap = keymap_make_keymap ();
+ }
+
+ /* Bind the echo area insert routines. */
+ for (i = 0; i < 256; i++)
+ if (isprint (i))
+ echo_area_keymap[i].function = InfoCmd(ea_insert);
+
+ /* Get user-defined keys and variables. */
+ if (fetch_user_maps())
+ {
+ if (user_info_keys_len && user_info_keys[0])
+ suppress_info_default_bindings = 1;
+ if (user_ea_keys_len && user_ea_keys[0])
+ suppress_ea_default_bindings = 1;
+ }
+
+ /* Apply the default bindings, unless the user says to suppress
+ them. */
+ if (vi_keys_p)
+ {
+ if (!suppress_info_default_bindings)
+ section_to_keymaps(info_keymap, default_vi_like_info_keys,
+ sizeof(default_vi_like_info_keys));
+ if (!suppress_ea_default_bindings)
+ section_to_keymaps(echo_area_keymap, default_vi_like_ea_keys,
+ sizeof(default_vi_like_ea_keys));
+ }
+ else
+ {
+ if (!suppress_info_default_bindings)
+ section_to_keymaps(info_keymap, default_emacs_like_info_keys,
+ sizeof(default_emacs_like_info_keys));
+ if (!suppress_ea_default_bindings)
+ section_to_keymaps(echo_area_keymap, default_emacs_like_ea_keys,
+ sizeof(default_emacs_like_ea_keys));
+ }
+
+ /* If the user specified custom bindings, apply them on top of the
+ default ones. */
+ if (user_info_keys_len)
+ section_to_keymaps(info_keymap, user_info_keys, user_info_keys_len);
+
+ if (user_ea_keys_len)
+ section_to_keymaps(echo_area_keymap, user_ea_keys, user_ea_keys_len);
+
+ if (user_vars_len)
+ section_to_vars(user_vars, user_vars_len);
+}
+
+#endif /* defined(INFOKEY) */
diff --git a/contrib/texinfo/info/infomap.h b/contrib/texinfo/info/infomap.h
index 65968cb..bf46399 100644
--- a/contrib/texinfo/info/infomap.h
+++ b/contrib/texinfo/info/infomap.h
@@ -1,9 +1,7 @@
-/* infomap.h -- Description of a keymap in Info and related functions. */
+/* infomap.h -- description of a keymap in Info and related functions.
+ $Id: infomap.h,v 1.6 2001/11/16 23:16:59 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -52,9 +50,10 @@
FUNCTION is the address of a function to run, or the
address of a keymap to indirect through.
TYPE says which kind of thing FUNCTION is. */
-typedef struct {
+typedef struct keymap_entry
+{
char type;
- VFunction *function;
+ InfoCommand *function;
} KEYMAP_ENTRY;
typedef KEYMAP_ENTRY *Keymap;
diff --git a/contrib/texinfo/info/key.c b/contrib/texinfo/info/key.c
new file mode 100644
index 0000000..06be6fa
--- /dev/null
+++ b/contrib/texinfo/info/key.c
@@ -0,0 +1,146 @@
+/* key.c -- Generated array containing function names.
+
+ This file was automatically made from various source files with the
+ command "./makedoc". DO NOT EDIT THIS FILE, only "./makedoc.c".
+
+ Source files groveled to make this file include:
+
+ ./session.c
+ ./echo-area.c
+ ./infodoc.c
+ ./m-x.c
+ ./indices.c
+ ./nodemenu.c
+ ./footnotes.c
+ ./variables.c
+
+ An entry in the array FUNCTION_KEY_ARRAY is made for each command
+ found in the above files; each entry consists of
+ a string which is the user-visible name of the function. */
+
+#include "key.h"
+#include "funs.h"
+
+FUNCTION_KEY function_key_array[] = {
+
+/* Commands found in "./session.c". */
+ { "next-line", A_info_next_line },
+ { "prev-line", A_info_prev_line },
+ { "end-of-line", A_info_end_of_line },
+ { "beginning-of-line", A_info_beginning_of_line },
+ { "forward-char", A_info_forward_char },
+ { "backward-char", A_info_backward_char },
+ { "forward-word", A_info_forward_word },
+ { "backward-word", A_info_backward_word },
+ { "global-next-node", A_info_global_next_node },
+ { "global-prev-node", A_info_global_prev_node },
+ { "scroll-forward", A_info_scroll_forward },
+ { "scroll-forward-set-window", A_info_scroll_forward_set_window },
+ { "scroll-forward-page-only", A_info_scroll_forward_page_only },
+ { "scroll-forward-page-only-set-window", A_info_scroll_forward_page_only_set_window },
+ { "scroll-backward", A_info_scroll_backward },
+ { "scroll-backward-set-window", A_info_scroll_backward_set_window },
+ { "scroll-backward-page-only", A_info_scroll_backward_page_only },
+ { "scroll-backward-page-only-set-window", A_info_scroll_backward_page_only_set_window },
+ { "beginning-of-node", A_info_beginning_of_node },
+ { "end-of-node", A_info_end_of_node },
+ { "down-line", A_info_down_line },
+ { "up-line", A_info_up_line },
+ { "scroll-half-screen-down", A_info_scroll_half_screen_down },
+ { "scroll-half-screen-up", A_info_scroll_half_screen_up },
+ { "next-window", A_info_next_window },
+ { "prev-window", A_info_prev_window },
+ { "split-window", A_info_split_window },
+ { "delete-window", A_info_delete_window },
+ { "keep-one-window", A_info_keep_one_window },
+ { "scroll-other-window", A_info_scroll_other_window },
+ { "scroll-other-window-backward", A_info_scroll_other_window_backward },
+ { "grow-window", A_info_grow_window },
+ { "tile-windows", A_info_tile_windows },
+ { "toggle-wrap", A_info_toggle_wrap },
+ { "next-node", A_info_next_node },
+ { "prev-node", A_info_prev_node },
+ { "up-node", A_info_up_node },
+ { "last-node", A_info_last_node },
+ { "first-node", A_info_first_node },
+ { "last-menu-item", A_info_last_menu_item },
+ { "menu-digit", A_info_menu_digit },
+ { "menu-item", A_info_menu_item },
+ { "xref-item", A_info_xref_item },
+ { "find-menu", A_info_find_menu },
+ { "visit-menu", A_info_visit_menu },
+ { "goto-node", A_info_goto_node },
+ { "menu-sequence", A_info_menu_sequence },
+ { "goto-invocation-node", A_info_goto_invocation_node },
+ { "man", A_info_man },
+ { "top-node", A_info_top_node },
+ { "dir-node", A_info_dir_node },
+ { "history-node", A_info_history_node },
+ { "kill-node", A_info_kill_node },
+ { "view-file", A_info_view_file },
+ { "print-node", A_info_print_node },
+ { "search-case-sensitively", A_info_search_case_sensitively },
+ { "search", A_info_search },
+ { "search-backward", A_info_search_backward },
+ { "search-next", A_info_search_next },
+ { "search-previous", A_info_search_previous },
+ { "isearch-forward", A_isearch_forward },
+ { "isearch-backward", A_isearch_backward },
+ { "move-to-prev-xref", A_info_move_to_prev_xref },
+ { "move-to-next-xref", A_info_move_to_next_xref },
+ { "select-reference-this-line", A_info_select_reference_this_line },
+ { "abort-key", A_info_abort_key },
+ { "move-to-window-line", A_info_move_to_window_line },
+ { "redraw-display", A_info_redraw_display },
+ { "quit", A_info_quit },
+ { "do-lowercase-version", A_info_do_lowercase_version },
+ { "add-digit-to-numeric-arg", A_info_add_digit_to_numeric_arg },
+ { "universal-argument", A_info_universal_argument },
+ { "numeric-arg-digit-loop", A_info_numeric_arg_digit_loop },
+/* Commands found in "./echo-area.c". */
+ { "echo-area-forward", A_ea_forward },
+ { "echo-area-backward", A_ea_backward },
+ { "echo-area-beg-of-line", A_ea_beg_of_line },
+ { "echo-area-end-of-line", A_ea_end_of_line },
+ { "echo-area-forward-word", A_ea_forward_word },
+ { "echo-area-backward-word", A_ea_backward_word },
+ { "echo-area-delete", A_ea_delete },
+ { "echo-area-rubout", A_ea_rubout },
+ { "echo-area-abort", A_ea_abort },
+ { "echo-area-newline", A_ea_newline },
+ { "echo-area-quoted-insert", A_ea_quoted_insert },
+ { "echo-area-insert", A_ea_insert },
+ { "echo-area-tab-insert", A_ea_tab_insert },
+ { "echo-area-transpose-chars", A_ea_transpose_chars },
+ { "echo-area-yank", A_ea_yank },
+ { "echo-area-yank-pop", A_ea_yank_pop },
+ { "echo-area-kill-line", A_ea_kill_line },
+ { "echo-area-backward-kill-line", A_ea_backward_kill_line },
+ { "echo-area-kill-word", A_ea_kill_word },
+ { "echo-area-backward-kill-word", A_ea_backward_kill_word },
+ { "echo-area-possible-completions", A_ea_possible_completions },
+ { "echo-area-complete", A_ea_complete },
+ { "echo-area-scroll-completions-window", A_ea_scroll_completions_window },
+/* Commands found in "./infodoc.c". */
+ { "get-help-window", A_info_get_help_window },
+ { "get-info-help-node", A_info_get_info_help_node },
+ { "describe-key", A_describe_key },
+ { "where-is", A_info_where_is },
+/* Commands found in "./m-x.c". */
+ { "describe-command", A_describe_command },
+ { "execute-command", A_info_execute_command },
+ { "set-screen-height", A_set_screen_height },
+/* Commands found in "./indices.c". */
+ { "index-search", A_info_index_search },
+ { "next-index-match", A_info_next_index_match },
+ { "index-apropos", A_info_index_apropos },
+/* Commands found in "./nodemenu.c". */
+ { "list-visited-nodes", A_list_visited_nodes },
+ { "select-visited-node", A_select_visited_node },
+/* Commands found in "./footnotes.c". */
+ { "show-footnotes", A_info_show_footnotes },
+/* Commands found in "./variables.c". */
+ { "describe-variable", A_describe_variable },
+ { "set-variable", A_set_variable },
+ (char *)0
+};
diff --git a/contrib/texinfo/info/key.h b/contrib/texinfo/info/key.h
new file mode 100644
index 0000000..35d2762
--- /dev/null
+++ b/contrib/texinfo/info/key.h
@@ -0,0 +1,35 @@
+/* key.h -- Structure associating function names with numeric codes. */
+
+/* This file is part of GNU Info, a program for reading online documentation
+ stored in Info format.
+
+ Copyright (C) 1993 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Written by Andrew Bettison <andrewb@zip.com.au> */
+
+#if !defined (KEY_H)
+#define KEY_H
+
+typedef struct {
+ char *name;
+ unsigned char code;
+}
+ FUNCTION_KEY;
+
+extern FUNCTION_KEY function_key_array[];
+
+#endif /* !KEY_H */
diff --git a/contrib/texinfo/info/m-x.c b/contrib/texinfo/info/m-x.c
index 2fc5a60..5085235 100644
--- a/contrib/texinfo/info/m-x.c
+++ b/contrib/texinfo/info/m-x.c
@@ -1,7 +1,7 @@
/* m-x.c -- Meta-x minibuffer reader.
- $Id: m-x.c,v 1.8 1999/06/25 21:57:40 karl Exp $
+ $Id: m-x.c,v 1.9 2001/11/16 23:14:33 karl Exp $
- Copyright (C) 1993, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */
#include "info.h"
+#include "funs.h"
/* **************************************************************** */
/* */
@@ -81,13 +82,13 @@ DECLARE_INFO_COMMAND (describe_command,
/* Describe the function named in "LINE". */
if (*line)
{
- VFunction *fun = named_function (line);
+ InfoCommand *cmd = named_function (line);
- if (!fun)
+ if (!cmd)
return;
window_message_in_echo_area ("%s: %s.",
- line, function_documentation (fun));
+ line, function_documentation (cmd));
}
free (line);
}
@@ -96,18 +97,24 @@ DECLARE_INFO_COMMAND (info_execute_command,
_("Read a command name in the echo area and execute it"))
{
char *line;
+ char *keys;
+ char *prompt;
- /* Ask the completer to read a reference for us. */
- if (info_explicit_arg || count != 1)
- {
- char *prompt;
+ prompt = (char *)xmalloc (20);
- prompt = (char *)xmalloc (20);
- sprintf (prompt, "%d M-x ", count);
- line = read_function_name (prompt, window);
- }
+ keys = where_is (info_keymap, InfoCmd(info_execute_command));
+ /* If the where_is () function thinks that this command doesn't exist,
+ there's something very wrong! */
+ if (!keys)
+ abort();
+
+ if (info_explicit_arg || count != 1)
+ sprintf (prompt, "%d %s ", count, keys);
else
- line = read_function_name ("M-x ", window);
+ sprintf (prompt, "%s ", keys);
+
+ /* Ask the completer to read a reference for us. */
+ line = read_function_name (prompt, window);
/* User aborted? */
if (!line)
@@ -125,7 +132,7 @@ DECLARE_INFO_COMMAND (info_execute_command,
/* User wants to execute a named command. Do it. */
{
- VFunction *function;
+ InfoCommand *command;
if ((active_window != the_echo_area) &&
(strncmp (line, "echo-area-", 10) == 0))
@@ -135,13 +142,13 @@ DECLARE_INFO_COMMAND (info_execute_command,
return;
}
- function = named_function (line);
+ command = named_function (line);
free (line);
- if (!function)
+ if (!command)
return;
- (*function) (active_window, count, 0);
+ (*InfoFunction(command)) (active_window, count, 0);
}
}
diff --git a/contrib/texinfo/info/man.c b/contrib/texinfo/info/man.c
index ee68cbb..1332cc5 100644
--- a/contrib/texinfo/info/man.c
+++ b/contrib/texinfo/info/man.c
@@ -1,7 +1,7 @@
/* man.c: How to read and format man files.
- $Id: man.c,v 1.13 1999/07/05 20:43:23 karl Exp $
+ $Id: man.c,v 1.16 2002/02/23 19:12:02 karl Exp $
- Copyright (C) 1995, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1995, 97, 98, 99, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -397,11 +397,36 @@ clean_manpage (manpage)
newline_count--;
}
- if (manpage[i] == '\b' || manpage[i] == '\f')
+ /* A malformed man page could have a \b as its first character,
+ in which case decrementing j by 2 will cause us to write into
+ newpage[-1], smashing the hidden info stored there by malloc. */
+ if (manpage[i] == '\b' || manpage[i] == '\f' && j > 0)
j -= 2;
+ else if (!raw_escapes_p)
+ {
+ /* Remove the ANSI escape sequences for color, boldface,
+ underlining, and italics, generated by some versions of
+ Groff. */
+ if (manpage[i] == '\033' && manpage[i + 1] == '['
+ && isdigit (manpage[i + 2]))
+ {
+ if (isdigit (manpage[i + 3]) && manpage[i + 4] == 'm')
+ {
+ i += 4;
+ j--;
+ }
+ else if (manpage[i + 3] == 'm')
+ {
+ i += 3;
+ j--;
+ }
+ /* Else do nothing: it's some unknown escape sequence,
+ so let's leave it alone. */
+ }
+ }
}
- newpage[j++] = '\0';
+ newpage[j++] = 0;
strcpy (manpage, newpage);
free (newpage);
diff --git a/contrib/texinfo/info/nodes.c b/contrib/texinfo/info/nodes.c
index 0aaee52..7f0bf0f 100644
--- a/contrib/texinfo/info/nodes.c
+++ b/contrib/texinfo/info/nodes.c
@@ -1,7 +1,7 @@
/* nodes.c -- how to get an Info file and node.
- $Id: nodes.c,v 1.14 1999/08/15 10:18:09 karl Exp $
+ $Id: nodes.c,v 1.15 2000/11/11 00:40:37 karl Exp $
- Copyright (C) 1993, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 98, 99, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -222,11 +222,12 @@ info_find_file_internal (filename, get_tags)
if (info_loaded_files)
{
for (i = 0; (file_buffer = info_loaded_files[i]); i++)
- if ((FILENAME_CMP (filename, file_buffer->filename) == 0) ||
- (FILENAME_CMP (filename, file_buffer->fullpath) == 0) ||
- (!IS_ABSOLUTE (filename) &&
- FILENAME_CMP (filename,
- filename_non_directory (file_buffer->fullpath)) == 0))
+ if ((FILENAME_CMP (filename, file_buffer->filename) == 0)
+ || (FILENAME_CMP (filename, file_buffer->fullpath) == 0)
+ || (!IS_ABSOLUTE (filename)
+ && FILENAME_CMP (filename,
+ filename_non_directory (file_buffer->fullpath))
+ == 0))
{
struct stat new_info, *old_info;
@@ -241,9 +242,8 @@ info_find_file_internal (filename, get_tags)
return file_buffer;
#endif /* HANDLE_MAN_PAGES */
- /* The file appears to be already loaded, and it is not "dir".
- Check to see if it has changed since the last time it was
- loaded. */
+ /* The file appears to be already loaded, and is not "dir". Check
+ to see if it's changed since the last time it was loaded. */
if (stat (file_buffer->fullpath, &new_info) == -1)
{
filesys_error_number = errno;
@@ -252,8 +252,8 @@ info_find_file_internal (filename, get_tags)
old_info = &file_buffer->finfo;
- if ((new_info.st_size != old_info->st_size) ||
- (new_info.st_mtime != old_info->st_mtime))
+ if (new_info.st_size != old_info->st_size
+ || new_info.st_mtime != old_info->st_mtime)
{
/* The file has changed. Forget that we ever had loaded it
in the first place. */
@@ -267,13 +267,13 @@ info_find_file_internal (filename, get_tags)
for this file, and there isn't one here, build the nodes
for this file_buffer. In any case, return the file_buffer
object. */
- if (!file_buffer->contents)
- {
- /* The file's contents have been gc'ed. Reload it. */
- info_reload_file_buffer_contents (file_buffer);
- if (!file_buffer->contents)
- return NULL;
- }
+ if (!file_buffer->contents)
+ {
+ /* The file's contents have been gc'ed. Reload it. */
+ info_reload_file_buffer_contents (file_buffer);
+ if (!file_buffer->contents)
+ return NULL;
+ }
if (get_tags && !file_buffer->tags)
build_tags_and_nodes (file_buffer);
@@ -770,20 +770,20 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding)
/* Build the file buffer's list of subfiles. */
{
char *containing_dir = xstrdup (file_buffer->fullpath);
- char *temp = filename_non_directory (containing_dir);
+ char *temp = filename_non_directory (containing_dir);
int len_containing_dir;
- if (temp > containing_dir)
- {
- if (HAVE_DRIVE (file_buffer->fullpath) &&
- temp == containing_dir + 2)
- {
- /* Avoid converting "d:foo" into "d:/foo" below. */
- *temp = '.';
- temp += 2;
- }
- temp[-1] = 0;
- }
+ if (temp > containing_dir)
+ {
+ if (HAVE_DRIVE (file_buffer->fullpath) &&
+ temp == containing_dir + 2)
+ {
+ /* Avoid converting "d:foo" into "d:/foo" below. */
+ *temp = '.';
+ temp += 2;
+ }
+ temp[-1] = 0;
+ }
len_containing_dir = strlen (containing_dir);
@@ -940,20 +940,22 @@ info_node_of_file_buffer_tags (file_buffer, nodename)
TAG *tag;
int i;
+ /* If no tags at all (possibly a misformatted info file), quit. */
+ if (!file_buffer->tags) {
+ return NULL;
+ }
+
for (i = 0; (tag = file_buffer->tags[i]); i++)
if (strcmp (nodename, tag->nodename) == 0)
{
- FILE_BUFFER *subfile;
-
- subfile = info_find_file_internal (tag->filename, INFO_NO_TAGS);
-
+ FILE_BUFFER *subfile = info_find_file_internal (tag->filename,
+ INFO_NO_TAGS);
if (!subfile)
return NULL;
if (!subfile->contents)
{
info_reload_file_buffer_contents (subfile);
-
if (!subfile->contents)
return NULL;
}
@@ -1187,7 +1189,7 @@ info_reload_file_buffer_contents (fb)
/* Let the filesystem do all the work for us. */
fb->contents =
filesys_read_info_file (fb->fullpath, &(fb->filesize), &(fb->finfo),
- &is_compressed);
+ &is_compressed);
if (is_compressed)
fb->flags |= N_IsCompressed;
}
diff --git a/contrib/texinfo/info/session.c b/contrib/texinfo/info/session.c
index 69b138d..229dd4e 100644
--- a/contrib/texinfo/info/session.c
+++ b/contrib/texinfo/info/session.c
@@ -1,7 +1,8 @@
/* session.c -- user windowing interface to Info.
- $Id: session.c,v 1.38 1999/09/25 16:10:04 karl Exp $
+ $Id: session.c,v 1.45 2002/03/02 15:05:04 karl Exp $
- Copyright (C) 1993, 96, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1139,19 +1140,26 @@ DECLARE_INFO_COMMAND (info_global_prev_node,
}
}
-/* Show the next screen of WINDOW's node. */
-DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window"))
+static void _scroll_forward();
+static void _scroll_backward();
+
+static void
+_scroll_forward(window, count, key, behaviour)
+ WINDOW *window;
+ int count;
+ unsigned char key;
+ int behaviour;
{
if (count < 0)
- info_scroll_backward (window, -count, key);
+ _scroll_backward (window, -count, key, behaviour);
else
{
int desired_top;
/* Without an explicit numeric argument, scroll the bottom two
lines to the top of this window, Or, if at bottom of window,
- and the user wishes to scroll through nodes get the "Next" node
- for this window. */
+ and the chosen behaviour is to scroll through nodes get the
+ "Next" node for this window. */
if (default_window_size > 0)
desired_top = window->pagetop + default_window_size;
else if (!info_explicit_arg && count == 1)
@@ -1159,16 +1167,9 @@ DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window"))
desired_top = window->pagetop + (window->height - 2);
/* If there are no more lines to scroll here, error, or get
- another node, depending on INFO_SCROLL_BEHAVIOUR. */
+ another node, depending on BEHAVIOUR. */
if (desired_top > window->line_count)
{
- int behaviour = info_scroll_behaviour;
-
- /* Here is a hack. If the key being used is not SPC, do the
- PageOnly behaviour. */
- if (key != SPC && key != DEL)
- behaviour = IS_PageOnly;
-
forward_move_node_structure (window, behaviour);
return;
}
@@ -1186,28 +1187,22 @@ DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window"))
}
}
-/* Like info_scroll_forward, but sets default_window_size as a side
- effect. */
-DECLARE_INFO_COMMAND (info_scroll_forward_set_window,
- _("Scroll forward in this window and set default window size"))
-{
- if (info_explicit_arg)
- default_window_size = count;
- info_scroll_forward (window, count, key);
-}
-
-/* Show the previous screen of WINDOW's node. */
-DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window"))
+static void
+_scroll_backward(window, count, key, behaviour)
+ WINDOW *window;
+ int count;
+ unsigned char key;
+ int behaviour;
{
if (count < 0)
- info_scroll_forward (window, -count, key);
+ _scroll_forward (window, -count, key, behaviour);
else
{
int desired_top;
/* Without an explicit numeric argument, scroll the top two lines
- to the bottom of this window, or move to the previous, or Up'th
- node. */
+ to the bottom of this window, or, depending on the selected
+ behaviour, move to the previous, or Up'th node. */
if (default_window_size > 0)
desired_top = window->pagetop - default_window_size;
else if (!info_explicit_arg && count == 1)
@@ -1216,14 +1211,6 @@ DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window"))
if ((desired_top < 0) && (window->pagetop == 0))
{
- int behaviour = info_scroll_behaviour;
-
- /* Same kind of hack as in info_scroll_forward. If the key
- used to invoke this command is not DEL, do only the PageOnly
- behaviour. */
- if (key != DEL && key != SPC)
- behaviour = IS_PageOnly;
-
backward_move_node_structure (window, behaviour);
return;
}
@@ -1238,6 +1225,44 @@ DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window"))
}
}
+/* Show the next screen of WINDOW's node. */
+DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window"))
+{
+ _scroll_forward (window, count, key, info_scroll_behaviour);
+}
+
+/* Like info_scroll_forward, but sets default_window_size as a side
+ effect. */
+DECLARE_INFO_COMMAND (info_scroll_forward_set_window,
+ _("Scroll forward in this window and set default window size"))
+{
+ if (info_explicit_arg)
+ default_window_size = count;
+ _scroll_forward (window, count, key, info_scroll_behaviour);
+}
+
+/* Show the next screen of WINDOW's node but never advance to next node. */
+DECLARE_INFO_COMMAND (info_scroll_forward_page_only, _("Scroll forward in this window staying within node"))
+{
+ _scroll_forward (window, count, key, IS_PageOnly);
+}
+
+/* Like info_scroll_forward_page_only, but sets default_window_size as a side
+ effect. */
+DECLARE_INFO_COMMAND (info_scroll_forward_page_only_set_window,
+ _("Scroll forward in this window staying within node and set default window size"))
+{
+ if (info_explicit_arg)
+ default_window_size = count;
+ _scroll_forward (window, count, key, IS_PageOnly);
+}
+
+/* Show the previous screen of WINDOW's node. */
+DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window"))
+{
+ _scroll_backward (window, count, key, info_scroll_behaviour);
+}
+
/* Like info_scroll_backward, but sets default_window_size as a side
effect. */
DECLARE_INFO_COMMAND (info_scroll_backward_set_window,
@@ -1245,7 +1270,24 @@ DECLARE_INFO_COMMAND (info_scroll_backward_set_window,
{
if (info_explicit_arg)
default_window_size = count;
- info_scroll_backward (window, count, key);
+ _scroll_backward (window, count, key, info_scroll_behaviour);
+}
+
+/* Show the previous screen of WINDOW's node but never move to previous
+ node. */
+DECLARE_INFO_COMMAND (info_scroll_backward_page_only, _("Scroll backward in this window staying within node"))
+{
+ _scroll_backward (window, count, key, IS_PageOnly);
+}
+
+/* Like info_scroll_backward_page_only, but sets default_window_size as a side
+ effect. */
+DECLARE_INFO_COMMAND (info_scroll_backward_page_only_set_window,
+ _("Scroll backward in this window staying within node and set default window size"))
+{
+ if (info_explicit_arg)
+ default_window_size = count;
+ _scroll_backward (window, count, key, IS_PageOnly);
}
/* Move to the beginning of the node. */
@@ -1301,7 +1343,7 @@ DECLARE_INFO_COMMAND (info_scroll_half_screen_down,
_("Scroll down by half screen size"))
{
if (count < 0)
- info_scroll_half_screen_up (window -count, key);
+ info_scroll_half_screen_up (window, -count, key);
else
{
int scroll_size = (the_screen->height + 1) / 2;
@@ -1327,7 +1369,7 @@ DECLARE_INFO_COMMAND (info_scroll_half_screen_up,
_("Scroll up by half screen size"))
{
if (count < 0)
- info_scroll_half_screen_down (window -count, key);
+ info_scroll_half_screen_down (window, -count, key);
else
{
int scroll_size = (the_screen->height + 1) / 2;
@@ -2028,7 +2070,19 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
refs = manpage_xrefs_in_binding (window->node, &binding);
else
#endif /* HANDLE_MAN_PAGES */
- refs = info_xrefs (&binding);
+ {
+ refs = info_xrefs (&binding);
+ if (!refs && point_line > 0)
+ {
+ /* People get annoyed that Info cannot find an xref
+ which starts on a previous line and ends on this
+ one. So if we fail to find a reference on this
+ line, let's try the one before. */
+ binding.start =
+ window->line_starts[point_line - 1] - binding.buffer;
+ refs = info_xrefs (&binding);
+ }
+ }
}
if (refs)
@@ -2139,8 +2193,43 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
if (line)
{
- /* Find the selected label in the references. */
- entry = info_get_labeled_reference (line, menu);
+ /* It is possible that the references have more than a single
+ entry with the same label, and also LINE is down-cased, which
+ complicates matters even more. Try to be as accurate as we
+ can: if they've chosen the default, use defentry directly. */
+ if (defentry && strcmp (line, defentry->label) == 0)
+ entry = defentry;
+ else
+ /* Find the selected label in the references. If there are
+ more than one label which matches, find the one that's
+ closest to point. */
+ {
+ register int i;
+ int best = -1, min_dist = window->node->nodelen;
+ REFERENCE *ref;
+
+ for (i = 0; menu && (ref = menu[i]); i++)
+ {
+ /* Need to use strcasecmp because LINE is downcased
+ inside info_read_completing_in_echo_area. */
+ if (strcasecmp (line, ref->label) == 0)
+ {
+ /* ref->end is more accurate estimate of position
+ for menus than ref->start. Go figure. */
+ int dist = abs (window->point - ref->end);
+
+ if (dist < min_dist)
+ {
+ min_dist = dist;
+ best = i;
+ }
+ }
+ }
+ if (best != -1)
+ entry = menu[best];
+ else
+ entry = (REFERENCE *)NULL;
+ }
if (!entry && defentry)
info_error (_("The reference disappeared! (%s)."), line);
@@ -2413,7 +2502,12 @@ info_follow_menus (initial_node, menus, errstr, errarg1, errarg2)
{
if (arg == first_arg)
{
- node = make_manpage_node (first_arg);
+ /* Maybe they typed "info foo" instead of "info -f foo". */
+ node = info_get_node (first_arg, 0);
+ if (node)
+ add_file_directory_to_path (first_arg);
+ else
+ node = make_manpage_node (first_arg);
if (node)
goto maybe_got_node;
}
@@ -3873,14 +3967,27 @@ incremental_search (window, count, ignore)
if (!Meta_p (key) || key > 32)
{
- func = window->keymap[key].function;
+ func = InfoFunction(window->keymap[key].function);
+
+ if (isprint (key) || func == (VFunction *)NULL)
+ {
+ insert_and_search:
+
+ if (isearch_string_index + 2 >= isearch_string_size)
+ isearch_string = (char *)xrealloc
+ (isearch_string, isearch_string_size += 100);
- /* If this key invokes an incremental search, then this means that
- we will either search again in the same direction, search
- again in the reverse direction, or insert the last search
- string that was accepted through incremental searching. */
- if (func == isearch_forward || func == isearch_backward)
+ isearch_string[isearch_string_index++] = key;
+ isearch_string[isearch_string_index] = '\0';
+ goto search_now;
+ }
+ else if (func == isearch_forward || func == isearch_backward)
{
+ /* If this key invokes an incremental search, then this
+ means that we will either search again in the same
+ direction, search again in the reverse direction, or
+ insert the last search string that was accepted through
+ incremental searching. */
if ((func == isearch_forward && dir > 0) ||
(func == isearch_backward && dir < 0))
{
@@ -3918,18 +4025,6 @@ incremental_search (window, count, ignore)
dir = -dir;
}
}
- else if (isprint (key) || func == (VFunction *)NULL)
- {
- insert_and_search:
-
- if (isearch_string_index + 2 >= isearch_string_size)
- isearch_string = (char *)xrealloc
- (isearch_string, isearch_string_size += 100);
-
- isearch_string[isearch_string_index++] = key;
- isearch_string[isearch_string_index] = '\0';
- goto search_now;
- }
else if (func == info_abort_key)
{
/* If C-g pressed, and the search is failing, pop the search
@@ -3971,8 +4066,9 @@ incremental_search (window, count, ignore)
/* FIXME: this seems like a kludge! We need a more reliable
mechanism to know when ESC is a separate key and when it is
part of an escape sequence. */
- if (key != isearch_terminate_search_key ||
- info_any_buffered_input_p ())
+ if (key != RET /* Emacs addicts want RET to get lost */
+ && (key != isearch_terminate_search_key
+ || info_any_buffered_input_p ()))
info_set_pending_input (key);
if (func == info_abort_key)
@@ -4377,8 +4473,10 @@ DECLARE_INFO_COMMAND (info_quit, _("Quit using Info"))
/* */
/* **************************************************************** */
-/* Declaration only. Special cased in info_dispatch_on_key (). */
-DECLARE_INFO_COMMAND (info_do_lowercase_version, "")
+/* Declaration only. Special cased in info_dispatch_on_key ().
+ Doc string is to avoid ugly results with describe_key etc. */
+DECLARE_INFO_COMMAND (info_do_lowercase_version,
+ _("Run command bound to this key's lowercase variant"))
{}
static void
@@ -4403,7 +4501,6 @@ dispatch_error (keyseq)
/* Keeping track of key sequences. */
static char *info_keyseq = (char *)NULL;
-static char keyseq_rep[100];
static int info_keyseq_index = 0;
static int info_keyseq_size = 0;
static int info_keyseq_displayed_p = 0;
@@ -4428,25 +4525,6 @@ add_char_to_keyseq (character)
info_keyseq[info_keyseq_index] = '\0';
}
-/* Return the pretty printable string which represents KEYSEQ. */
-char *
-pretty_keyseq (keyseq)
- char *keyseq;
-{
- register int i;
-
- keyseq_rep[0] = '\0';
-
- for (i = 0; keyseq[i]; i++)
- {
- sprintf (keyseq_rep + strlen (keyseq_rep), "%s%s",
- strlen (keyseq_rep) ? " " : "",
- pretty_keyname (keyseq[i]));
- }
-
- return (keyseq_rep);
-}
-
/* Display the current value of info_keyseq. If argument EXPECTING is
non-zero, input is expected to be read after the key sequence is
displayed, so add an additional prompting character to the sequence. */
@@ -4513,6 +4591,7 @@ info_dispatch_on_key (key, map)
unsigned char key;
Keymap map;
{
+#if !defined(INFOKEY)
if (Meta_p (key) && (!ISO_Latin_p || map[key].function != ea_insert))
{
if (map[ESC].type == ISKMAP)
@@ -4528,6 +4607,7 @@ info_dispatch_on_key (key, map)
}
return;
}
+#endif /* INFOKEY */
switch (map[key].type)
{
@@ -4535,13 +4615,26 @@ info_dispatch_on_key (key, map)
{
VFunction *func;
- func = map[key].function;
+ func = InfoFunction(map[key].function);
if (func != (VFunction *)NULL)
{
/* Special case info_do_lowercase_version (). */
if (func == info_do_lowercase_version)
{
+#if defined(INFOKEY)
+ unsigned char lowerkey;
+
+ lowerkey = Meta_p(key) ? Meta (tolower (UnMeta (key))) : tolower (key);
+ if (lowerkey == key)
+ {
+ add_char_to_keyseq (key);
+ dispatch_error (info_keyseq);
+ return;
+ }
+ info_dispatch_on_key (lowerkey, map);
+#else /* !INFOKEY */
info_dispatch_on_key (tolower (key), map);
+#endif /* INFOKEY */
return;
}
@@ -4554,7 +4647,7 @@ info_dispatch_on_key (key, map)
WINDOW *where;
where = active_window;
- (*map[key].function)
+ (*InfoFunction(map[key].function))
(active_window, info_numeric_arg * info_numeric_arg_sign, key);
/* If we have input pending, then the last command was a prefix
@@ -4564,9 +4657,9 @@ info_dispatch_on_key (key, map)
if (!info_input_pending_p ())
{
if (where == the_echo_area)
- ea_last_executed_command = map[key].function;
+ ea_last_executed_command = InfoFunction(map[key].function);
else
- info_last_executed_command = map[key].function;
+ info_last_executed_command = InfoFunction(map[key].function);
}
}
}
@@ -4581,7 +4674,7 @@ info_dispatch_on_key (key, map)
case ISKMAP:
add_char_to_keyseq (key);
- if (map[key].function != (VFunction *)NULL)
+ if (map[key].function != (InfoCommand *)NULL)
{
unsigned char newkey;
@@ -4660,23 +4753,35 @@ DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop,
pure_key = key = info_get_another_input_char ();
+#if !defined(INFOKEY)
if (Meta_p (key))
add_char_to_keyseq (ESC);
add_char_to_keyseq (UnMeta (key));
+#else /* defined(INFOKEY) */
+ add_char_to_keyseq (key);
+#endif /* defined(INFOKEY) */
}
+#if !defined(INFOKEY)
if (Meta_p (key))
key = UnMeta (key);
+#endif /* !defined(INFOKEY) */
if (keymap[key].type == ISFUNC &&
- keymap[key].function == info_universal_argument)
+ InfoFunction(keymap[key].function) == info_universal_argument)
{
info_numeric_arg *= 4;
key = 0;
continue;
}
+#if defined(INFOKEY)
+ if (Meta_p (key))
+ key = UnMeta (key);
+#endif /* !defined(INFOKEY) */
+
+
if (isdigit (key))
{
if (info_explicit_arg)
diff --git a/contrib/texinfo/info/session.h b/contrib/texinfo/info/session.h
index 07ffd5f..99892fc 100644
--- a/contrib/texinfo/info/session.h
+++ b/contrib/texinfo/info/session.h
@@ -1,7 +1,7 @@
/* session.h -- Functions found in session.c.
- $Id: session.h,v 1.9 1999/06/25 21:57:40 karl Exp $
+ $Id: session.h,v 1.10 2001/11/16 23:17:15 karl Exp $
- Copyright (C) 1993, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 98, 99, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -65,7 +65,6 @@ extern unsigned char info_get_input_char (), info_get_another_input_char ();
extern unsigned char info_input_pending_p ();
extern void remember_window_and_node (), set_remembered_pagetop_and_point ();
extern void set_window_pagetop (), info_set_node_of_window ();
-extern char *pretty_keyseq ();
extern void initialize_keyseq (), add_char_to_keyseq ();
extern void info_gather_typeahead ();
extern FILE_BUFFER *file_buffer_of_window ();
diff --git a/contrib/texinfo/info/termdep.h b/contrib/texinfo/info/termdep.h
index 5f4b41a..0ab6c44 100644
--- a/contrib/texinfo/info/termdep.h
+++ b/contrib/texinfo/info/termdep.h
@@ -1,7 +1,7 @@
/* termdep.h -- System things that terminal.c depends on.
- $Id: termdep.h,v 1.4 1998/04/13 22:02:57 karl Exp $
+ $Id: termdep.h,v 1.5 2001/09/12 17:26:03 karl Exp $
- Copyright (C) 1993, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1993, 96, 97, 98, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,9 +30,6 @@
#ifdef HAVE_TERMIOS_H
# include <termios.h>
-# ifdef GWINSZ_IN_SYS_IOCTL
-# include <sys/ioctl.h>
-# endif
#else
# if defined (HAVE_TERMIO_H)
# include <termio.h>
@@ -50,6 +47,10 @@
# endif /* !HAVE_TERMIO_H */
#endif /* !HAVE_TERMIOS_H */
+#ifdef GWINSZ_IN_SYS_IOCTL
+# include <sys/ioctl.h>
+#endif
+
#ifdef HAVE_SYS_TTOLD_H
# include <sys/ttold.h>
#endif /* HAVE_SYS_TTOLD_H */
diff --git a/contrib/texinfo/info/terminal.c b/contrib/texinfo/info/terminal.c
index 9223d95..dd4673e 100644
--- a/contrib/texinfo/info/terminal.c
+++ b/contrib/texinfo/info/terminal.c
@@ -1,7 +1,7 @@
/* terminal.c -- How to handle the physical terminal for Info.
- $Id: terminal.c,v 1.19 1999/09/20 12:28:54 karl Exp $
+ $Id: terminal.c,v 1.23 2001/11/16 23:16:04 karl Exp $
- Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98, 99
+ Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98, 99, 2001
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <signal.h>
-#include <sys/ioctl.h> /* TIOCGWINSZ on LynxOS, at least */
/* The Unix termcap interface code. */
#ifdef HAVE_NCURSES_TERMCAP_H
@@ -217,12 +216,17 @@ int terminal_use_visible_bell_p = 0;
int terminal_can_scroll = 0;
/* The key sequences output by the arrow keys, if this terminal has any. */
-char *term_ku = (char *)NULL;
-char *term_kd = (char *)NULL;
-char *term_kr = (char *)NULL;
-char *term_kl = (char *)NULL;
-char *term_kP = (char *)NULL; /* page-up */
-char *term_kN = (char *)NULL; /* page-down */
+char *term_ku = NULL;
+char *term_kd = NULL;
+char *term_kr = NULL;
+char *term_kl = NULL;
+char *term_kP = NULL; /* page-up */
+char *term_kN = NULL; /* page-down */
+char *term_kh = NULL; /* home */
+char *term_ke = NULL; /* end */
+char *term_kD = NULL; /* delete */
+char *term_ki = NULL; /* ins */
+char *term_kx = NULL; /* del */
/* Move the cursor to the terminal location of X and Y. */
void
@@ -555,6 +559,8 @@ terminal_initialize_terminal (terminal_name)
term_up = term_dn = audible_bell = visible_bell = NULL;
term_ku = term_kd = term_kl = term_kr = NULL;
term_kP = term_kN = NULL;
+ term_kh = term_ke = NULL;
+ term_kD = NULL;
return;
}
@@ -601,7 +607,7 @@ terminal_initialize_terminal (terminal_name)
if (term_invbeg)
term_invend = tgetstr ("me", &buffer);
else
- term_invend = (char *)NULL;
+ term_invend = NULL;
if (!term_cr)
term_cr = "\r";
@@ -611,7 +617,7 @@ terminal_initialize_terminal (terminal_name)
term_up = tgetstr ("up", &buffer);
term_dn = tgetstr ("dn", &buffer);
visible_bell = tgetstr ("vb", &buffer);
- terminal_has_visible_bell_p = (visible_bell != (char *)NULL);
+ terminal_has_visible_bell_p = (visible_bell != NULL);
audible_bell = tgetstr ("bl", &buffer);
if (!audible_bell)
audible_bell = "\007";
@@ -630,8 +636,8 @@ terminal_initialize_terminal (terminal_name)
}
else
{
- term_mm = (char *)NULL;
- term_mo = (char *)NULL;
+ term_mm = NULL;
+ term_mo = NULL;
}
/* Attempt to find the arrow keys. */
@@ -643,6 +649,19 @@ terminal_initialize_terminal (terminal_name)
term_kP = tgetstr ("kP", &buffer);
term_kN = tgetstr ("kN", &buffer);
+#if defined(INFOKEY)
+ term_kh = tgetstr ("kh", &buffer);
+ term_ke = tgetstr ("@7", &buffer);
+ term_ki = tgetstr ("kI", &buffer);
+ term_kx = tgetstr ("kD", &buffer);
+#endif /* defined(INFOKEY) */
+
+ /* Home and end keys. */
+ term_kh = tgetstr ("kh", &buffer);
+ term_ke = tgetstr ("@7", &buffer);
+
+ term_kD = tgetstr ("kD", &buffer);
+
/* If this terminal is not cursor addressable, then it is really dumb. */
if (!term_goto)
terminal_is_dumb_p = 1;
@@ -736,11 +755,22 @@ terminal_prep_terminal ()
#endif /* VLNEXT */
#endif /* TERMIOS or TERMIO */
+/* cf. emacs/src/sysdep.c for being sure output is on. */
#if defined (HAVE_TERMIOS_H)
+ /* linux kernel 2.2.x needs a TCOFF followed by a TCOON to turn output
+ back on if the user presses ^S at the very beginning; just a TCOON
+ doesn't work. --Kevin Ryde <user42@zip.com.au>, 16jun2000. */
tcsetattr (tty, TCSANOW, &ttybuff);
+# ifdef TCOON
+ tcflow (tty, TCOOFF);
+ tcflow (tty, TCOON);
+# endif
#else
# if defined (HAVE_TERMIO_H)
ioctl (tty, TCSETA, &ttybuff);
+# ifdef TCXONC
+ ioctl (tty, TCXONC, 1);
+# endif
# endif
#endif
diff --git a/contrib/texinfo/info/terminal.h b/contrib/texinfo/info/terminal.h
index 2e27268..361fa4c 100644
--- a/contrib/texinfo/info/terminal.h
+++ b/contrib/texinfo/info/terminal.h
@@ -1,9 +1,7 @@
-/* terminal.h -- The external interface to terminal I/O. */
+/* terminal.h -- The external interface to terminal I/O.
+ $Id: terminal.h,v 1.7 2001/11/16 23:17:29 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 96, 97 Free Software Foundation, Inc.
+ Copyright (C) 1993, 96, 97, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -118,8 +116,11 @@ extern VFunction *terminal_scroll_terminal_hook;
extern void terminal_ring_bell ();
extern VFunction *terminal_ring_bell_hook;
-/* The key sequences output by the arrow keys, if this terminal has any. */
+/* The key sequences output by special keys, if this terminal has any. */
extern char *term_ku, *term_kd, *term_kr, *term_kl;
extern char *term_kP, *term_kN;
+extern char *term_ke, *term_kh;
+extern char *term_kx, *term_ki;
+extern char *term_kD;
#endif /* !TERMINAL_H */
diff --git a/contrib/texinfo/info/variables.c b/contrib/texinfo/info/variables.c
index 9412797..581d2bb 100644
--- a/contrib/texinfo/info/variables.c
+++ b/contrib/texinfo/info/variables.c
@@ -1,10 +1,7 @@
/* variables.c -- How to manipulate user visible variables in Info.
- $Id: variables.c,v 1.7 1999/06/25 21:57:40 karl Exp $
+ $Id: variables.c,v 1.8 2001/11/16 23:16:19 karl Exp $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 97 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -273,3 +270,40 @@ make_variable_completions_array ()
return (array);
}
+
+#if defined(INFOKEY)
+
+void
+set_variable_to_value(name, value)
+ char *name;
+ char *value;
+{
+ register int i;
+
+ /* Find the variable in our list of variables. */
+ for (i = 0; info_variables[i].name; i++)
+ if (strcmp(info_variables[i].name, name) == 0)
+ break;
+
+ if (!info_variables[i].name)
+ return;
+
+ if (info_variables[i].choices)
+ {
+ register int j;
+
+ /* Find the choice in our list of choices. */
+ for (j = 0; info_variables[i].choices[j]; j++)
+ if (strcmp (info_variables[i].choices[j], value) == 0)
+ break;
+
+ if (info_variables[i].choices[j])
+ *info_variables[i].value = j;
+ }
+ else
+ {
+ *info_variables[i].value = atoi(value);
+ }
+}
+
+#endif /* INFOKEY */
diff --git a/contrib/texinfo/info/window.c b/contrib/texinfo/info/window.c
index 1b6d062..faa0784 100644
--- a/contrib/texinfo/info/window.c
+++ b/contrib/texinfo/info/window.c
@@ -1,7 +1,7 @@
/* window.c -- windows in Info.
- $Id: window.c,v 1.11 1999/06/25 21:57:40 karl Exp $
+ $Id: window.c,v 1.15 2002/01/19 01:08:20 karl Exp $
- Copyright (C) 1993, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 2001, 02 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -826,7 +826,10 @@ calculate_line_starts (window)
while (1)
{
- c = node->contents[i];
+ /* The cast to unsigned char is for 8-bit characters, which
+ could be passed as negative integers to character_width
+ and wreak havoc on some naive implementations of iscntrl. */
+ c = (unsigned char) node->contents[i];
cwidth = character_width (c, hpos);
/* If this character fits within this line, just do the next one. */
@@ -1298,16 +1301,17 @@ message_buffer_resize (length)
/* Format MESSAGE_BUFFER with the results of printing FORMAT with ARG1 and
ARG2. */
static void
-build_message_buffer (format, arg1, arg2)
+build_message_buffer (format, arg1, arg2, arg3)
char *format;
- void *arg1, *arg2;
+ void *arg1, *arg2, *arg3;
{
register int i, len;
- void *args[2];
+ void *args[3];
int arg_index = 0;
args[0] = arg1;
args[1] = arg2;
+ args[2] = arg3;
len = strlen (format);
@@ -1326,7 +1330,9 @@ build_message_buffer (format, arg1, arg2)
char *fmt_start = format + i;
char *fmt;
int fmt_len, formatted_len;
+ int paramed = 0;
+ format_again:
i++;
while (format[i] && strchr ("-. +0123456789", format[i]))
i++;
@@ -1335,18 +1341,39 @@ build_message_buffer (format, arg1, arg2)
if (c == '\0')
abort ();
+ if (c == '$') {
+ /* position parameter parameter */
+ /* better to use bprintf from bfox's metahtml? */
+ arg_index = atoi(fmt_start + 1) - 1;
+ if (arg_index < 0)
+ arg_index = 0;
+ if (arg_index >= 2)
+ arg_index = 1;
+ paramed = 1;
+ goto format_again;
+ }
+
fmt_len = format + i - fmt_start + 1;
fmt = (char *) xmalloc (fmt_len + 1);
strncpy (fmt, fmt_start, fmt_len);
fmt[fmt_len] = '\0';
+ if (paramed) {
+ /* removed positioned parameter */
+ char *p;
+ for (p = fmt + 1; *p && *p != '$'; p++) {
+ ;
+ }
+ strcpy(fmt + 1, p + 1);
+ }
+
/* If we have "%-98s", maybe 98 calls for a longer string. */
if (fmt_len > 2)
{
int j;
- for (j = 0; j < fmt_len; j++)
- if (isdigit (fmt[j]))
+ for (j = fmt_len - 2; j >= 0; j--)
+ if (isdigit (fmt[j]) || fmt[j] == '$')
break;
formatted_len = atoi (fmt + j);
@@ -1430,7 +1457,7 @@ build_message_node (format, arg1, arg2)
NODE *node;
message_buffer_index = 0;
- build_message_buffer (format, arg1, arg2);
+ build_message_buffer (format, arg1, arg2, 0);
node = message_buffer_to_node ();
return (node);
@@ -1467,11 +1494,11 @@ initialize_message_buffer ()
/* Print FORMAT with ARG1,2 to the end of the current message buffer. */
void
-printf_to_message_buffer (format, arg1, arg2)
+printf_to_message_buffer (format, arg1, arg2, arg3)
char *format;
- void *arg1, *arg2;
+ void *arg1, *arg2, *arg3;
{
- build_message_buffer (format, arg1, arg2);
+ build_message_buffer (format, arg1, arg2, arg3);
}
/* Return the current horizontal position of the "cursor" on the most
OpenPOWER on IntegriCloud